pub struct Rng<'d, M: Mode> { /* private fields */ }Expand description
Driver for the true random number generator.
Create it with Rng::new_blocking for the blocking API, or with Rng::new for the
async API. The blocking methods are available either way.
Implementations§
Source§impl<'d> Rng<'d, Blocking>
impl<'d> Rng<'d, Blocking>
Sourcepub fn new_blocking(_rng: Peri<'d, CRYPTO_RNG>) -> Self
pub fn new_blocking(_rng: Peri<'d, CRYPTO_RNG>) -> Self
Creates a new blocking RNG driver.
Source§impl<'d> Rng<'d, Async>
impl<'d> Rng<'d, Async>
Sourcepub fn new(
_rng: Peri<'d, CRYPTO_RNG>,
_irq: impl Binding<CRYPTOCELL, InterruptHandler> + 'd,
) -> Self
pub fn new( _rng: Peri<'d, CRYPTO_RNG>, _irq: impl Binding<CRYPTOCELL, InterruptHandler> + 'd, ) -> Self
Creates a new async RNG driver.
The future returned by Rng::fill_bytes must not be leaked, for example with
mem::forget. It must be either polled to completion or dropped.
Source§impl<'d> Rng<'d, Async>
impl<'d> Rng<'d, Async>
Sourcepub async fn fill_bytes(&mut self, dest: &mut [u8])
pub async fn fill_bytes(&mut self, dest: &mut [u8])
Fills the buffer with random bytes.
Source§impl<'d, M: Mode> Rng<'d, M>
impl<'d, M: Mode> Rng<'d, M>
Sourcepub fn blocking_fill_bytes(&mut self, dest: &mut [u8])
pub fn blocking_fill_bytes(&mut self, dest: &mut [u8])
Fills the buffer with random bytes.
Sourcepub fn blocking_next_u32(&mut self) -> u32
pub fn blocking_next_u32(&mut self) -> u32
Returns a random u32.
Sourcepub fn blocking_next_u64(&mut self) -> u64
pub fn blocking_next_u64(&mut self) -> u64
Returns a random u64.
Trait Implementations§
impl<'d, M: Mode> TryCryptoRng for Rng<'d, M>
Auto Trait Implementations§
impl<'d, M> !RefUnwindSafe for Rng<'d, M>
impl<'d, M> !UnwindSafe for Rng<'d, M>
impl<'d, M> Freeze 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