embedded_hal/blocking/rng.rs
1//! Blocking hardware random number generator
2
3/// Blocking read
4///
5/// *This trait is available if embedded-hal is built with the `"unproven"` feature.*
6#[cfg(feature = "unproven")]
7pub trait Read {
8 /// Error type
9 type Error;
10
11 /// Reads enough bytes from hardware random number generator to fill `buffer`
12 ///
13 /// If any error is encountered then this function immediately returns. The contents of buf are
14 /// unspecified in this case.
15 ///
16 /// If this function returns an error, it is unspecified how many bytes it has read, but it
17 /// will never read more than would be necessary to completely fill the buffer.
18 fn read(&mut self, buffer: &mut [u8]) -> Result<(), Self::Error>;
19}