pub trait Entropy:
Send
+ Sync
+ Debug {
// Required method
fn fill(&self, buf: &mut [u8]) -> Result<(), Error>;
// Provided method
fn seed(&self) -> Result<[u8; 32], Error> { ... }
}Expand description
A source of random bytes.
Required Methods§
Sourcefn fill(&self, buf: &mut [u8]) -> Result<(), Error>
fn fill(&self, buf: &mut [u8]) -> Result<(), Error>
Fills buf with fresh random bytes.
Fails only when the source is unavailable. A caller refuses the operation then, never falls back to a clock: a clock-derived nonce risks the collision the nonce exists to prevent, and a clock-derived credential is guessable.
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".