pub trait BlockDevice {
// Required methods
fn config(&self) -> Config;
fn read(&self, block: u32, off: usize, out: &mut [u8]) -> Result<()>;
fn prog(&mut self, block: u32, off: usize, data: &[u8]) -> Result<()>;
fn erase(&mut self, block: u32) -> Result<()>;
// Provided method
fn sync(&mut self) -> Result<()> { ... }
}Expand description
Minimal synchronous block-device interface for littlefs experiments.
The trait deliberately mirrors littlefs’s block-level vocabulary instead of
exposing a raw byte slice. read and prog operate inside one logical
block, erase resets an entire block, and sync gives later writable
backends a place to flush durable state.
Required Methods§
fn config(&self) -> Config
fn read(&self, block: u32, off: usize, out: &mut [u8]) -> Result<()>
fn prog(&mut self, block: u32, off: usize, data: &[u8]) -> Result<()>
fn erase(&mut self, block: u32) -> Result<()>
Provided Methods§
Implementations on Foreign Types§
Source§impl<D: BlockDevice + ?Sized> BlockDevice for Box<D>
impl<D: BlockDevice + ?Sized> BlockDevice for Box<D>
Implementors§
impl BlockDevice for FileBlockDevice
Available on crate feature
std only.