Closed twittner closed 9 years ago
The other solution is to add this to your crate:
extern crate rand;
use rand::Rng;
What is the right thing to do here? Are there any downsides to re-exporting it? That certainly seems like the more convenient option (and one I hadn't thought of!).
The other solution is to add this to your crate: [...]
Yes. In addition it requires adding rand
explicitly as a dependency in your Cargo.toml
file.
OK, I fixed this by re-exporting the rand::Rng
type. I'm not sure if it's the right solution, but it seems better than requiring an explicit dependency on rand
just to use methods defined by the Gen
trait.
Please consider this test case:
Compilation with
rustc 1.3.0-nightly (0c052199b 2015-07-11)
gives:I think it is necessary to export not only
Gen
but also it's parent traitRng
: