pub struct Rng { /* private fields */ }
Available on crate feature
unstable
only.Expand description
Random number generator driver
Implementations§
Source§impl Rng
impl Rng
Sourcepub fn new(_rng: impl Peripheral<P = RNG>) -> Self
pub fn new(_rng: impl Peripheral<P = RNG>) -> Self
Create a new random number generator instance
Sourcepub fn read(&mut self, buffer: &mut [u8])
pub fn read(&mut self, buffer: &mut [u8])
Reads enough bytes from hardware random number generator to fill
buffer
.
If any error is encountered then this function immediately returns. The contents of buf are unspecified in this case.
If this function returns an error, it is unspecified how many bytes it has read, but it will never read more than would be necessary to completely fill the buffer.
Trait Implementations§
Source§impl Peripheral for Rng
impl Peripheral for Rng
Source§unsafe fn clone_unchecked(&self) -> Self::P
unsafe fn clone_unchecked(&self) -> Self::P
Unsafely clone (duplicate) a peripheral singleton. Read more
Source§fn into_ref<'a>(self) -> PeripheralRef<'a, Self::P>where
Self: 'a,
fn into_ref<'a>(self) -> PeripheralRef<'a, Self::P>where
Self: 'a,
Convert a value into a
PeripheralRef
. Read moreSource§impl RngCore for Rng
impl RngCore for Rng
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest
with random data. Read moreSource§fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>
Fill
dest
entirely with random data. Read moreimpl Copy for Rng
Auto Trait Implementations§
impl Freeze for Rng
impl RefUnwindSafe for Rng
impl Send for Rng
impl Sync for Rng
impl Unpin for Rng
impl UnwindSafe for Rng
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut u8)
unsafe fn clone_to_uninit(&self, dst: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)