pub trait Device: Send {
// Required methods
fn size_bytes(&self) -> Result<u64>;
fn read_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<()>;
fn write_at(&mut self, offset: u64, buf: &[u8]) -> Result<()>;
fn sync(&mut self) -> Result<()>;
fn describe(&self) -> String;
}Required Methods§
Sourcefn size_bytes(&self) -> Result<u64>
fn size_bytes(&self) -> Result<u64>
Total addressable bytes of the underlying device.
Sourcefn read_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<()>
fn read_at(&mut self, offset: u64, buf: &mut [u8]) -> Result<()>
Read exactly buf.len() bytes at offset. Errors if read short.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".