SeedSource

Trait SeedSource 

Source
pub trait SeedSource<R: EntropySource>: SealedSeed<R> {
    // Required methods
    fn from_seed(seed: R::Seed) -> Self;
    fn get_seed(&self) -> &R::Seed;
    fn clone_seed(&self) -> R::Seed;

    // Provided methods
    fn from_entropy() -> Self
       where Self: Sized { ... }
    fn try_from_local_entropy() -> Result<Self, AccessError>
       where Self: Sized { ... }
    fn from_local_entropy() -> Self
       where Self: Sized { ... }
    fn try_from_os_rng() -> Result<Self, OsError>
       where Self: Sized { ... }
    fn from_os_rng() -> Self
       where Self: Sized { ... }
}
Expand description

A trait for providing crate::seed::RngSeed with common initialization strategies. This trait is not object safe and is also a sealed trait.

Required Methods§

Source

fn from_seed(seed: R::Seed) -> Self

Initialize a SeedSource from a given seed value.

Source

fn get_seed(&self) -> &R::Seed

Returns a reference of the seed value.

Source

fn clone_seed(&self) -> R::Seed

Returns a cloned instance of the seed value.

Provided Methods§

Source

fn from_entropy() -> Self
where Self: Sized,

👎Deprecated: use either SeedSource::from_local_entropy or SeedSource::from_os_rng instead

Initialize a SeedSource from a seed value obtained from a user-space RNG source.

§Panics

This method panics if for whatever reason it is unable to source entropy from the User-Space/OS/Hardware source.

Source

fn try_from_local_entropy() -> Result<Self, AccessError>
where Self: Sized,

Available on crate feature thread_local_entropy only.

Initialize a SeedSource from a seed value obtained from a user-space RNG source. This is usually much, much faster than sourcing entropy from OS/Hardware sources.

Source

fn from_local_entropy() -> Self
where Self: Sized,

Available on crate feature thread_local_entropy only.

Initialize a SeedSource from a seed value obtained from a user-space RNG source. This is usually much, much faster than sourcing entropy from OS/Hardware sources.

§Panics

This method panics if for whatever reason it is unable to source entropy from the User-Space source.

Source

fn try_from_os_rng() -> Result<Self, OsError>
where Self: Sized,

Initialize a SeedSource from a seed value obtained from an OS/Hardware RNG source.

Source

fn from_os_rng() -> Self
where Self: Sized,

Initialize a SeedSource from a seed value obtained from an OS/Hardware RNG source.

§Panics

This method panics if for whatever reason it is unable to source entropy from an OS/Hardware source.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<R: EntropySource> SeedSource<R> for RngSeed<R>
where R::Seed: Sync + Send,