pub trait NonvolatileStorage<'a> {
// Required methods
fn set_client(&self, client: &'a dyn NonvolatileStorageClient);
fn read(
&self,
buffer: &'static mut [u8],
address: usize,
length: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>;
fn write(
&self,
buffer: &'static mut [u8],
address: usize,
length: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>;
}Expand description
Simple interface for reading and writing nonvolatile memory. It is expected that drivers for nonvolatile memory would implement this trait.
Required Methods§
fn set_client(&self, client: &'a dyn NonvolatileStorageClient)
Sourcefn read(
&self,
buffer: &'static mut [u8],
address: usize,
length: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn read( &self, buffer: &'static mut [u8], address: usize, length: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>
Read length bytes starting at address address in to the provided
buffer. The buffer must be at least length bytes long. The address
must be in the address space of the physical storage.
On error, the buffer is returned alongside the ErrorCode so the
caller does not lose ownership of it.
Sourcefn write(
&self,
buffer: &'static mut [u8],
address: usize,
length: usize,
) -> Result<(), (ErrorCode, &'static mut [u8])>
fn write( &self, buffer: &'static mut [u8], address: usize, length: usize, ) -> Result<(), (ErrorCode, &'static mut [u8])>
Write length bytes starting at address address from the provided
buffer. The buffer must be at least length bytes long. This address
must be in the address space of the physical storage.
On error, the buffer is returned alongside the ErrorCode so the
caller does not lose ownership of it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".