Struct secp256kfun::nonce::GlobalRng
source · [−]pub struct GlobalRng<R> { /* private fields */ }
Expand description
A zero sized type that wraps an RNG that implementes
Default
e.g. ThreadRng
. 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
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Mark for T
impl<T> Mark for T
sourcefn mark<M>(self) -> <M as ChangeMark<T>>::Out where
M: ChangeMark<T>,
fn mark<M>(self) -> <M as ChangeMark<T>>::Out where
M: ChangeMark<T>,
Returns a new instance of the invocant that will be marked with M
. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more