We have several crates, some in this repo, that use traits from rand_core. An example is the aead crate:
https://docs.rs/aead/0.4.1/aead/trait.NewAead.html#method.generate_key
However, while some crates document how to use OsRng as the concrete RNG, we typically don't make this easy.
Some suggestions for improving this:
Re-export rand_core
This would make it easier to access both the traits and the built-in RNG.
It could be exported verbatim as rand_core, or perhaps we could consider making the feature name rand and re-exporting it as rand. But that might be a bit less clear than just the rand_core name, even though it's a bit uglier. (edit: so far we're just doing rand_core for clarity that it's a re-export)
Have the std feature activate rand_core/std
This would mean that rand_core is always pulled in whenever std is enabled (at least until weak feature activation ships), but would make it easy for users to access rand_core::OsRng when the std feature is enabled, e.g. as aead::rand_core::OsRng.
Implementation status
We have several crates, some in this repo, that use traits from
rand_core. An example is theaeadcrate:https://docs.rs/aead/0.4.1/aead/trait.NewAead.html#method.generate_key
However, while some crates document how to use
OsRngas the concrete RNG, we typically don't make this easy.Some suggestions for improving this:
Re-export
rand_coreThis would make it easier to access both the traits and the built-in RNG.
It could be exported verbatim as
rand_core,or perhaps we could consider making the feature name(edit: so far we're just doingrandand re-exporting it asrand. But that might be a bit less clear than just therand_corename, even though it's a bit uglier.rand_corefor clarity that it's a re-export)Have the
stdfeature activaterand_core/stdThis would mean that
rand_coreis always pulled in wheneverstdis enabled (at least until weak feature activation ships), but would make it easy for users to accessrand_core::OsRngwhen thestdfeature is enabled, e.g. asaead::rand_core::OsRng.Implementation status
rand_core#682ciphercrypto-macelliptic-curvepassword-hashsignature