pub trait Entropy32<'a> {
// Required methods
fn get(&self) -> Result<(), ErrorCode>;
fn cancel(&self) -> Result<(), ErrorCode>;
fn set_client(&'a self, _: &'a dyn Client32);
}
Expand description
Generic interface for a 32-bit entropy source.
Implementors should assume the client implements the Client trait.
Required Methods§
Sourcefn get(&self) -> Result<(), ErrorCode>
fn get(&self) -> Result<(), ErrorCode>
Initiate the acquisition of entropy.
There are three valid return values:
- Ok(()): a
entropy_available
callback will be called in the future when entropy is available. - FAIL: a
entropy_available
callback will not be called in the future, because entropy cannot be generated. This is a general failure condition. - OFF: a
entropy_available
callback will not be called in the future, because the random number generator is off/not powered.
Sourcefn cancel(&self) -> Result<(), ErrorCode>
fn cancel(&self) -> Result<(), ErrorCode>
Cancel acquisition of entropy.
There are three valid return values:
- Ok(()): an outstanding request from
get
has been cancelled, or there was no outstanding request. Noentropy_available
callback will be issued. - FAIL: There will be a
entropy_available
callback, which may or may not return an error code.
Sourcefn set_client(&'a self, _: &'a dyn Client32)
fn set_client(&'a self, _: &'a dyn Client32)
Set the client to receive entropy_available
callbacks.