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§
Sourcefn from_seed(seed: R::Seed) -> Self
fn from_seed(seed: R::Seed) -> Self
Initialize a SeedSource from a given seed value.
Sourcefn clone_seed(&self) -> R::Seed
fn clone_seed(&self) -> R::Seed
Returns a cloned instance of the seed value.
Provided Methods§
Sourcefn from_entropy() -> Selfwhere
Self: Sized,
👎Deprecated: use either SeedSource::from_local_entropy or SeedSource::from_os_rng instead
fn from_entropy() -> Selfwhere
Self: Sized,
SeedSource::from_local_entropy or SeedSource::from_os_rng insteadInitialize 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.
Sourcefn try_from_local_entropy() -> Result<Self, AccessError>where
Self: Sized,
Available on crate feature thread_local_entropy only.
fn try_from_local_entropy() -> Result<Self, AccessError>where
Self: Sized,
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.
Sourcefn from_local_entropy() -> Selfwhere
Self: Sized,
Available on crate feature thread_local_entropy only.
fn from_local_entropy() -> Selfwhere
Self: Sized,
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.
Sourcefn try_from_os_rng() -> Result<Self, OsError>where
Self: Sized,
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.
Sourcefn from_os_rng() -> Selfwhere
Self: Sized,
fn from_os_rng() -> Selfwhere
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.