RawIoOsIntf

Trait RawIoOsIntf 

Source
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§

Source

fn new(path: &Path, create: bool, read: bool, write: bool) -> Result<Self>

Open a file or device.

Source

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.

Source

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.

Source

fn close(&mut self) -> Result<()>

Close the file and flush all buffers. (This does not affect the caches).

Source

fn sync(&mut self) -> Result<()>

Flush all buffers. (This does not affect the caches).

Source

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.

Source

fn seek(&mut self, offset: u64) -> Result<u64>

Seek to a file offset.

Source

fn read(&mut self, buffer: &mut [u8]) -> Result<RawIoResult>

Read a chunk of data.

Source

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.

Implementors§