Trait rand_core::CryptoRngCore
source · [−]pub trait CryptoRngCore: CryptoRng + RngCore {
fn as_rngcore(&mut self) -> &mut dyn RngCoreⓘNotable traits for dyn RngCoreimpl Read for dyn RngCore
;
}
Expand description
An extension trait that is automatically implemented for any type
implementing RngCore
and CryptoRng
.
It may be used as a trait object, and supports upcasting to RngCore
via
the CryptoRngCore::as_rngcore
method.
Example
use rand_core::CryptoRngCore;
#[allow(unused)]
fn make_token(rng: &mut dyn CryptoRngCore) -> [u8; 32] {
let mut buf = [0u8; 32];
rng.fill_bytes(&mut buf);
buf
}