pub struct EntropySource { /* private fields */ }Expand description
This is a wrapper that sets up the boot entropy source.
On chips with a TRNG this holds the SAR ADC entropy source that
init_entropy() enables. The RNG register only has randomness
while a source is active, and the ADC source is what occurs on boot.
Dropping this guard switches off the source. This handover is required because the ADC source needs to be switched off “before RF subsystem features, ADC, or I2S (ESP32 only) are initialized” and that it’s “not safe to use if any other subsystem is accessing the RF subsystem or the ADC at the same time”.
On the ESP32-C5/C61, there is no TRNG driver yet, so the guard is empty.
See: https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/random.html
Auto Trait Implementations§
impl !UnwindSafe for EntropySource
impl Freeze for EntropySource
impl RefUnwindSafe for EntropySource
impl Send for EntropySource
impl Sync for EntropySource
impl Unpin for EntropySource
impl UnsafeUnpin for EntropySource
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