pub trait StoreBackend {
type Data: ?Sized + AsRef<[u8]>;
type Error;
// Required methods
fn data(&self) -> &Self::Data;
fn erase(&mut self) -> Result<(), Self::Error>;
fn program(
&mut self,
offset: usize,
payload: &[u8],
) -> Result<(), Self::Error>;
fn backup_space(&self) -> &'static mut [u8];
// Provided methods
fn len(&self) -> usize { ... }
fn program_done(&mut self) { ... }
}Expand description
Backend interface for Store
Required Associated Types§
Required Methods§
Sourcefn program(&mut self, offset: usize, payload: &[u8]) -> Result<(), Self::Error>
fn program(&mut self, offset: usize, payload: &[u8]) -> Result<(), Self::Error>
program flash with offset into flash page
Sourcefn backup_space(&self) -> &'static mut [u8]
fn backup_space(&self) -> &'static mut [u8]
need for automatic compaction
leaves memory management to the implementer
Provided Methods§
Sourcefn program_done(&mut self)
fn program_done(&mut self)
called after repeated program() invocations to allow for eg. cache flushing