Trait block_device_driver::BlockDevice
source · pub trait BlockDevice<const SIZE: usize> {
type Error: Debug;
// Required methods
async fn read(
&mut self,
block_address: u32,
data: &mut [[u8; SIZE]]
) -> Result<(), Self::Error>;
async fn write(
&mut self,
block_address: u32,
data: &[[u8; SIZE]]
) -> Result<(), Self::Error>;
async fn size(&mut self) -> Result<u64, Self::Error>;
}Expand description
A trait for a block devices
This trait can be implemented multiple times to support various different block sizes.
Required Associated Types§
Required Methods§
sourceasync fn read(
&mut self,
block_address: u32,
data: &mut [[u8; SIZE]]
) -> Result<(), Self::Error>
async fn read( &mut self, block_address: u32, data: &mut [[u8; SIZE]] ) -> Result<(), Self::Error>
Read one or more blocks at the given block address.
sourceasync fn write(
&mut self,
block_address: u32,
data: &[[u8; SIZE]]
) -> Result<(), Self::Error>
async fn write( &mut self, block_address: u32, data: &[[u8; SIZE]] ) -> Result<(), Self::Error>
Write one or more blocks at the given block address.
async fn size(&mut self) -> Result<u64, Self::Error>
Object Safety§
This trait is not object safe.