[][src]Struct sgx_rand::reseeding::ReseedingRng

pub struct ReseedingRng<R, Rsdr> {
    pub reseeder: Rsdr,
    // some fields omitted

A wrapper around any RNG which reseeds the underlying RNG after it has generated a certain number of random bytes.


reseeder: Rsdr

Controls the behaviour when reseeding the RNG.


impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr>[src]

pub fn new(
    rng: R,
    generation_threshold: u64,
    reseeder: Rsdr
) -> ReseedingRng<R, Rsdr>

Create a new ReseedingRng with the given parameters.


  • rng: the random number generator to use.
  • generation_threshold: the number of bytes of entropy at which to reseed the RNG.
  • reseeder: the reseeding object to use.

pub fn reseed_if_necessary(&mut self)[src]

Reseed the internal RNG if the number of bytes that have been generated exceed the threshold.

Trait Implementations

impl<R: Debug, Rsdr: Debug> Debug for ReseedingRng<R, Rsdr>[src]

impl<R: Rng, Rsdr: Reseeder<R>> Rng for ReseedingRng<R, Rsdr>[src]

impl<S, R: SeedableRng<S>, Rsdr: Reseeder<R> + Default> SeedableRng<(Rsdr, S)> for ReseedingRng<R, Rsdr>[src]

fn from_seed((rsdr, seed): (Rsdr, S)) -> ReseedingRng<R, Rsdr>[src]

Create a new ReseedingRng from the given reseeder and seed. This uses a default value for generation_threshold.

Auto Trait Implementations

impl<R, Rsdr> RefUnwindSafe for ReseedingRng<R, Rsdr> where
    R: RefUnwindSafe,
    Rsdr: RefUnwindSafe

impl<R, Rsdr> Send for ReseedingRng<R, Rsdr> where
    R: Send,
    Rsdr: Send

impl<R, Rsdr> Sync for ReseedingRng<R, Rsdr> where
    R: Sync,
    Rsdr: Sync

impl<R, Rsdr> Unpin for ReseedingRng<R, Rsdr> where
    R: Unpin,
    Rsdr: Unpin

impl<R, Rsdr> UnwindSafe for ReseedingRng<R, Rsdr> where
    R: UnwindSafe,
    Rsdr: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.