pub trait BlockDevice {
type Error;
// Required methods
async fn read_block(
&mut self,
block: u32,
buffer: &mut [u8; 512],
) -> Result<(), Self::Error>;
async fn num_blocks(&mut self) -> Result<u32, Self::Error>;
}Expand description
A device that reads 512-byte blocks. The filesystem layer never assumes anything about the device beyond this.
Required Associated Types§
Required Methods§
Sourceasync fn read_block(
&mut self,
block: u32,
buffer: &mut [u8; 512],
) -> Result<(), Self::Error>
async fn read_block( &mut self, block: u32, buffer: &mut [u8; 512], ) -> Result<(), Self::Error>
Reads block number block (counted from 0) into buffer.
Sourceasync fn num_blocks(&mut self) -> Result<u32, Self::Error>
async fn num_blocks(&mut self) -> Result<u32, Self::Error>
The number of blocks the device holds.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<D: BlockDevice + ?Sized> BlockDevice for &mut D
A device lent to the filesystem for a while: a mount that borrows the card and gives it back.
impl<D: BlockDevice + ?Sized> BlockDevice for &mut D
A device lent to the filesystem for a while: a mount that borrows the card and gives it back.