diff --git a/src/lib.rs b/src/lib.rs index 7161408..0a8c370 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,18 +14,21 @@ mod test; /// Backend interface for `Store` pub trait StoreBackend { + /// type returned by `data()` for reading the flash type Data: ?Sized + AsRef<[u8]>; - /// Memory-mapped + /// memory-mapped fn data(&self) -> &Self::Data; + /// size of flash page fn len(&self) -> usize { self.data().as_ref().len() } + /// error type returned by `erase()`/`flash()` operations type Error; - /// erase flash + /// erase flash page fn erase(&mut self) -> Result<(), Self::Error>; - /// program flash + /// program flash with offset into flash page fn program(&mut self, offset: usize, payload: &[u8]) -> Result<(), Self::Error>; /// called after repeated `program()` invocations to allow for eg. cache flushing fn program_done(&mut self) {} diff --git a/src/no_flash.rs b/src/no_flash.rs index ba7ca33..b0875ce 100644 --- a/src/no_flash.rs +++ b/src/no_flash.rs @@ -1,3 +1,5 @@ +//! Support for configurations without flash + use crate::StoreBackend; use core::fmt;