pub trait RawIoOsIntf: Sized {
// Required methods
fn new(path: &Path, create: bool, read: bool, write: bool) -> Result<Self>;
fn get_sector_size(&self) -> Option<u32>;
fn drop_file_caches(&mut self, offset: u64, size: u64) -> Result<()>;
fn close(&mut self) -> Result<()>;
fn sync(&mut self) -> Result<()>;
fn set_len(&mut self, size: u64) -> Result<()>;
fn seek(&mut self, offset: u64) -> Result<u64>;
fn read(&mut self, buffer: &mut [u8]) -> Result<RawIoResult>;
fn write(&mut self, buffer: &[u8]) -> Result<RawIoResult>;
}Expand description
OS interface for raw I/O.
Required Methods§
Sourcefn new(path: &Path, create: bool, read: bool, write: bool) -> Result<Self>
fn new(path: &Path, create: bool, read: bool, write: bool) -> Result<Self>
Open a file or device.
Sourcefn get_sector_size(&self) -> Option<u32>
fn get_sector_size(&self) -> Option<u32>
Get the physical sector size of the file or device. Returns None, if this is not a raw device.
Sourcefn drop_file_caches(&mut self, offset: u64, size: u64) -> Result<()>
fn drop_file_caches(&mut self, offset: u64, size: u64) -> Result<()>
Close the file, flush all buffers and drop all caches. This function ensures that subsequent reads are not read from RAM cache.
Sourcefn close(&mut self) -> Result<()>
fn close(&mut self) -> Result<()>
Close the file and flush all buffers. (This does not affect the caches).
Sourcefn set_len(&mut self, size: u64) -> Result<()>
fn set_len(&mut self, size: u64) -> Result<()>
Truncate or extend the file length to the given size. This method is for unit testing only.
Sourcefn read(&mut self, buffer: &mut [u8]) -> Result<RawIoResult>
fn read(&mut self, buffer: &mut [u8]) -> Result<RawIoResult>
Read a chunk of data.
Sourcefn write(&mut self, buffer: &[u8]) -> Result<RawIoResult>
fn write(&mut self, buffer: &[u8]) -> Result<RawIoResult>
Write a chunk of data.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.