pub trait BlockDevice: Send + Sync {
// Required methods
fn read_offset(&self, offset: usize) -> Result<Vec<u8>, BlockDeviceError>;
fn write_offset(
&mut self,
offset: usize,
data: &[u8],
) -> Result<(), BlockDeviceError>;
fn size(&self) -> Result<usize, BlockDeviceError>;
}Expand description
Block device trait that ext4_rs requires
This trait must be implemented by any device driver that wants to provide block-level access to EXT4 filesystems.
Required Methods§
Sourcefn read_offset(&self, offset: usize) -> Result<Vec<u8>, BlockDeviceError>
fn read_offset(&self, offset: usize) -> Result<Vec<u8>, BlockDeviceError>
Read data from the device at the given byte offset
Sourcefn write_offset(
&mut self,
offset: usize,
data: &[u8],
) -> Result<(), BlockDeviceError>
fn write_offset( &mut self, offset: usize, data: &[u8], ) -> Result<(), BlockDeviceError>
Write data to the device at the given byte offset
Sourcefn size(&self) -> Result<usize, BlockDeviceError>
fn size(&self) -> Result<usize, BlockDeviceError>
Get the size of the device in bytes