pub struct RawIo { /* private fields */ }
Expand description
Raw device I/O abstraction.
Implementations§
Source§impl RawIo
impl RawIo
Sourcepub fn new(path: &Path, create: bool, read: bool, write: bool) -> Result<Self>
pub fn new(path: &Path, create: bool, read: bool, write: bool) -> Result<Self>
Open a file or device.
Sourcepub fn get_sector_size(&self) -> Option<u32>
pub 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.
Sourcepub fn drop_file_caches(self, offset: u64, size: u64) -> Result<()>
pub fn drop_file_caches(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.
Sourcepub fn close(&mut self) -> Result<()>
pub fn close(&mut self) -> Result<()>
Close the file and flush all buffers. (This does not affect the caches).
pub fn set_len(&mut self, size: u64) -> Result<()>
Sourcepub fn read(&mut self, buffer: &mut [u8]) -> Result<RawIoResult>
pub fn read(&mut self, buffer: &mut [u8]) -> Result<RawIoResult>
Read a chunk of data.
Sourcepub fn write(&mut self, buffer: &[u8]) -> Result<RawIoResult>
pub fn write(&mut self, buffer: &[u8]) -> Result<RawIoResult>
Write a chunk of data.
Auto Trait Implementations§
impl Freeze for RawIo
impl !RefUnwindSafe for RawIo
impl !Send for RawIo
impl !Sync for RawIo
impl Unpin for RawIo
impl !UnwindSafe for RawIo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more