pub struct SectorCache<'a, D> { /* private fields */ }Expand description
A cacheing wrapper for AsyncBlockDevice that aggregates writes to a device
with large blocks, eliminating multiple flash read-erase-write cycles.
Reads and caches one device block in buf, written back when required or
on flush.
Implementations§
Source§impl<'a, D: AsyncBlockDevice> SectorCache<'a, D>
impl<'a, D: AsyncBlockDevice> SectorCache<'a, D>
Trait Implementations§
Source§impl<'a, D: AsyncBlockDevice> AsyncBlockDevice for SectorCache<'a, D>
impl<'a, D: AsyncBlockDevice> AsyncBlockDevice for SectorCache<'a, D>
Source§type Error = <D as AsyncBlockDevice>::Error
type Error = <D as AsyncBlockDevice>::Error
Error type returned by storage operations.
Source§fn block_size(&self) -> u32
fn block_size(&self) -> u32
Returns the block size in bytes.
Source§fn block_count(&self) -> u32
fn block_count(&self) -> u32
Returns the total amount of logical blocks.
Source§async fn flush(&mut self) -> Result<(), Self::Error>
async fn flush(&mut self) -> Result<(), Self::Error>
Flushes pending writes to backing storage.
Source§fn is_write_protected(&self) -> bool
fn is_write_protected(&self) -> bool
Returns whether the media is write-protected.
Auto Trait Implementations§
impl<'a, D> !UnwindSafe for SectorCache<'a, D>
impl<'a, D> Freeze for SectorCache<'a, D>where
D: Freeze,
impl<'a, D> RefUnwindSafe for SectorCache<'a, D>where
D: RefUnwindSafe,
impl<'a, D> Send for SectorCache<'a, D>where
D: Send,
impl<'a, D> Sync for SectorCache<'a, D>where
D: Sync,
impl<'a, D> Unpin for SectorCache<'a, D>where
D: Unpin,
impl<'a, D> UnsafeUnpin for SectorCache<'a, D>where
D: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more