pub struct Trng { /* private fields */ }
Expand description
The true random number generator.
Implementations§
source§impl Trng
impl Trng
sourcepub fn new(reg: TRNG, sample_mode: SampleMode, retry_count: RetryCount) -> Self
pub fn new(reg: TRNG, sample_mode: SampleMode, retry_count: RetryCount) -> Self
Create a TRNG given a sampling mode and retry count.
To select the default sampling mode and retry counts, use Default::default()
.
sourcepub fn next_u32(&mut self) -> Result<u32, Error>
pub fn next_u32(&mut self) -> Result<u32, Error>
Return the next randomly-generated u32
. May need to retrieve another block of random numbers.
Returns “would block” if we’re not ready to read entropy; try again. See the module-level example for how to block.
sourcepub fn release_disabled(self) -> TRNG
pub fn release_disabled(self) -> TRNG
Release the TRNG in a disabled state.
This preserves any previously set retry count, sample mode, and peripheral settings. However, the register block is returned in a disabled state.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Trng
impl Send for Trng
impl !Sync for Trng
impl Unpin for Trng
impl !UnwindSafe for Trng
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