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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more