pub trait RandomSource {
type Stream: RandomStream + 'static;
// Required method
fn stream(&self, index: u64) -> Self::Stream;
// Provided method
fn stream_boxed(&self, index: u64) -> Box<dyn RandomStream> { ... }
}Expand description
Source of randomness, which gives a stream of random bytes for every passphrase.
For a source that is not deterministic, the streams can all be the same. For a deterministic one, they are independent of each other, and the stream with an index always gives the same bytes.
Required Associated Types§
Sourcetype Stream: RandomStream + 'static
type Stream: RandomStream + 'static
Underlying type of the streams of this randomness source.
Required Methods§
Provided Methods§
Sourcefn stream_boxed(&self, index: u64) -> Box<dyn RandomStream>
fn stream_boxed(&self, index: u64) -> Box<dyn RandomStream>
The stream with an index, as a trait object.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".