pub struct SystemRandom(/* private fields */);
Expand description
A secure random number generator where the random values come directly from the operating system.
“Directly from the operating system” here presently means “whatever the
getrandom
crate does” but that may change in the future. That roughly
means calling libc’s getrandom
function or whatever is analogous to that;
see the getrandom
crate’s documentation for more info.
A single SystemRandom
may be shared across multiple threads safely.
new()
is guaranteed to always succeed and to have low latency; it won’t
try to open or read from a file or do similar things. The first call to
fill()
may block a substantial amount of time since any and all
initialization is deferred to it. Therefore, it may be a good idea to call
fill()
once at a non-latency-sensitive time to minimize latency for
future calls.
Implementations§
Source§impl SystemRandom
impl SystemRandom
Trait Implementations§
Source§impl Clone for SystemRandom
impl Clone for SystemRandom
Source§fn clone(&self) -> SystemRandom
fn clone(&self) -> SystemRandom
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for SystemRandom
impl RefUnwindSafe for SystemRandom
impl Send for SystemRandom
impl Sync for SystemRandom
impl Unpin for SystemRandom
impl UnwindSafe for SystemRandom
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> SecureRandom for Twhere
T: SecureRandom,
impl<T> SecureRandom for Twhere
T: SecureRandom,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 0 bytes