pub struct Rng<'d, M: Mode> { /* private fields */ }Expand description
RNG driver.
Implementations§
Source§impl<'d> Rng<'d, Blocking>
impl<'d> Rng<'d, Blocking>
Sourcepub fn new_blocking<T: Instance>(inner: Peri<'d, T>) -> Self
pub fn new_blocking<T: Instance>(inner: Peri<'d, T>) -> Self
Create a new blocking RNG driver.
Source§impl<'d, M: Mode> Rng<'d, M>
impl<'d, M: Mode> Rng<'d, M>
Sourcepub fn recover_seed_error(&mut self)
pub fn recover_seed_error(&mut self)
Try to recover from a seed error.
Sourcepub fn blocking_next_u32(&mut self) -> u32
pub fn blocking_next_u32(&mut self) -> u32
Get a random u32.
This call is infallible: a seed or clock error is recovered by resetting
the RNG. If the error persists after MAX_RESET_RETRIES resets (almost
always a misconfigured RNG clock) it panics, since an infallible API has
no other way to surface the fault. Use fill_bytes
for a fallible path that returns Error instead.
Sourcepub fn blocking_next_u64(&mut self) -> u64
pub fn blocking_next_u64(&mut self) -> u64
Get a random u64
Sourcepub fn blocking_fill_bytes(&mut self, dest: &mut [u8])
pub fn blocking_fill_bytes(&mut self, dest: &mut [u8])
Fill a slice with random bytes
Trait Implementations§
impl<'d, M: Mode> TryCryptoRng for Rng<'d, M>
Auto Trait Implementations§
impl<'d, M> !UnwindSafe for Rng<'d, M>
impl<'d, M> Freeze for Rng<'d, M>
impl<'d, M> RefUnwindSafe for Rng<'d, M>
impl<'d, M> Send for Rng<'d, M>
impl<'d, M> Sync for Rng<'d, M>
impl<'d, M> Unpin for Rng<'d, M>
impl<'d, M> UnsafeUnpin for Rng<'d, M>
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