[][src]Struct schnorr_fun::nonce::GlobalRng

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

A zero sized type that wraps an instance of an RNG that implementes Default e.g. 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 for GlobalRng<R> where
    R: Clone
[src]

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

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

impl<R> NonceRng for GlobalRng<R> where
    R: Default + RngCore + CryptoRng
[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.