pub trait BlockDevice: Send + Sync {
// Required methods
fn read_block(
&self,
block_no: usize,
buf: &mut [u8],
) -> Result<(), FileError>;
fn write_block(&self, block_no: usize, buf: &[u8]) -> Result<(), FileError>;
fn block_count(&self) -> usize;
// Provided method
fn flush(&self) -> Result<(), FileError> { ... }
}Required Methods§
fn read_block(&self, block_no: usize, buf: &mut [u8]) -> Result<(), FileError>
fn write_block(&self, block_no: usize, buf: &[u8]) -> Result<(), FileError>
fn block_count(&self) -> usize
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".