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> CryptoRng for Rng<'d, M>
impl<'d, M: Mode> CryptoRng for Rng<'d, M>
Source§impl<'d, M: Mode> RngCore for Rng<'d, M>
impl<'d, M: Mode> RngCore for Rng<'d, M>
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest with random data. Read moreimpl<'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
impl<R> CryptoRng for R
Source§impl<T> CryptoRngCore for T
impl<T> CryptoRngCore for T
Source§fn as_rngcore(&mut self) -> &mut dyn RngCore
fn as_rngcore(&mut self) -> &mut dyn RngCore
Upcast to an
RngCore trait object.impl<R> RngCore for Rwhere
R: Rng,
impl<_INNER> SuspendablePeripheral for _INNERwhere
_INNER: SealedSuspendablePeripheral,
impl<R> TryCryptoRng for R
Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.