pub trait IO {
type Error: Debug;
// Required methods
fn set_sector_size_shift(&mut self, shift: u8) -> Result<(), Self::Error>;
fn read<'a>(&'a mut self, id: SectorID) -> Result<&'a [Block], Self::Error>;
fn write(
&mut self,
id: SectorID,
offset: usize,
data: &[u8],
) -> Result<(), Self::Error>;
fn flush(&mut self) -> Result<(), Self::Error>;
}
Required Associated Types§
Required Methods§
Sourcefn set_sector_size_shift(&mut self, shift: u8) -> Result<(), Self::Error>
fn set_sector_size_shift(&mut self, shift: u8) -> Result<(), Self::Error>
Default to 9, which means 512B
fn read<'a>(&'a mut self, id: SectorID) -> Result<&'a [Block], Self::Error>
Sourcefn write(
&mut self,
id: SectorID,
offset: usize,
data: &[u8],
) -> Result<(), Self::Error>
fn write( &mut self, id: SectorID, offset: usize, data: &[u8], ) -> Result<(), Self::Error>
Caller guarantees bytes.len() <= SECTOR_SIZE - offset