Struct RawIo

Source
pub struct RawIo { /* private fields */ }
Expand description

Raw device I/O abstraction.

Implementations§

Source§

impl RawIo

Source

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

Open a file or device.

Source

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.

Source

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.

Source

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

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

Source

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

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

Source

pub fn set_len(&mut self, size: u64) -> Result<()>

Source

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

Seek to a file offset.

Source

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

Read a chunk of data.

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.