[][src]Trait secp256kfun::nonce::NonceRng

pub trait NonceRng {
    fn fill_bytes(&self, bytes: &mut [u8]);
}

A helper trait over RNGs that handle internal mutablility.

RngCore requires self to be mutable which is annoying in our context. This trait requires the rng be able to create randomness without being mutable. The most strightforward way of doing this is to use transient rngs instances like ThreadRng that have a Default implementation. For this reason, this trait is implemented for PhantomData<ThreadRng> (any Rng that implements Default). If you want to BYO rng you have to implement this trait yourself and handle mutability internally.

Required methods

fn fill_bytes(&self, bytes: &mut [u8])

Fill bytes with random data.

Loading content...

Implementors

impl<R: RngCore + CryptoRng + Default> NonceRng for GlobalRng<R>[src]

We implement NonceRng only for rngs we can conjure out of thin air with Default.

Loading content...