[][src]Struct secp256kfun::nonce::GlobalRng

pub struct GlobalRng<R> { /* fields omitted */ }

A zero sized type that wraps an instance of an RNG that implementes Default e.g. [ThreadRng] and [OsRng]. GlobalRng implements NonceRng and care has been taken to ensure it is Sync.

Examples

use rand::rngs::ThreadRng;
use secp256kfun::nonce::{GlobalRng, NonceRng};
let nonce_rng = GlobalRng::<ThreadRng>::default();
let mut bytes = [0u8; 32];
nonce_rng.fill_bytes(&mut bytes);
assert_ne!(bytes, [0u8; 32]);

fn is_sync<S: Sync>(x: S) -> bool {
    true
}
assert!(is_sync(nonce_rng));

Trait Implementations

impl<R: Clone> Clone for GlobalRng<R>[src]

impl<R: Debug> Debug for GlobalRng<R>[src]

impl<R: Default> Default for GlobalRng<R>[src]

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.

Auto Trait Implementations

impl<R> RefUnwindSafe for GlobalRng<R>

impl<R> Send for GlobalRng<R>

impl<R> Sync for GlobalRng<R>

impl<R> Unpin for GlobalRng<R>

impl<R> UnwindSafe for GlobalRng<R>

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Mark for T[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.