pub struct BlockDeviceAdapter<B, const SIZE: usize> { /* private fields */ }Expand description
Adapts a block_device_driver::BlockDevice with SIZE-byte blocks into an AsyncBlockDevice.
Buffers, such as the block_buf given to MscClass::run, must be
aligned to B::Align or the call panics.
Implementations§
Source§impl<B: BlockDevice<SIZE>, const SIZE: usize> BlockDeviceAdapter<B, SIZE>
impl<B: BlockDevice<SIZE>, const SIZE: usize> BlockDeviceAdapter<B, SIZE>
Sourcepub fn with_cache<'a>(
self,
buf: &'a mut Aligned<B::Align, [u8; SIZE]>,
block_size: u32,
) -> SectorCache<'a, Self>
pub fn with_cache<'a>( self, buf: &'a mut Aligned<B::Align, [u8; SIZE]>, block_size: u32, ) -> SectorCache<'a, Self>
Present block_size-byte blocks through a SectorCache with an aligned device-block buffer.
Trait Implementations§
Source§impl<B: BlockDevice<SIZE>, const SIZE: usize> AsyncBlockDevice for BlockDeviceAdapter<B, SIZE>
Available on crate feature block-device-driver only.
impl<B: BlockDevice<SIZE>, const SIZE: usize> AsyncBlockDevice for BlockDeviceAdapter<B, SIZE>
Available on crate feature
block-device-driver only.Source§type Error = <B as BlockDevice<SIZE>>::Error
type Error = <B as BlockDevice<SIZE>>::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<B, const SIZE: usize> Freeze for BlockDeviceAdapter<B, SIZE>where
B: Freeze,
impl<B, const SIZE: usize> RefUnwindSafe for BlockDeviceAdapter<B, SIZE>where
B: RefUnwindSafe,
impl<B, const SIZE: usize> Send for BlockDeviceAdapter<B, SIZE>where
B: Send,
impl<B, const SIZE: usize> Sync for BlockDeviceAdapter<B, SIZE>where
B: Sync,
impl<B, const SIZE: usize> Unpin for BlockDeviceAdapter<B, SIZE>where
B: Unpin,
impl<B, const SIZE: usize> UnsafeUnpin for BlockDeviceAdapter<B, SIZE>where
B: UnsafeUnpin,
impl<B, const SIZE: usize> UnwindSafe for BlockDeviceAdapter<B, SIZE>where
B: UnwindSafe,
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