Skip to main content

RandomSource

Trait RandomSource 

Source
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§

Source

type Stream: RandomStream + 'static

Underlying type of the streams of this randomness source.

Required Methods§

Source

fn stream(&self, index: u64) -> Self::Stream

The stream with an index.

Provided Methods§

Source

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".

Implementors§