cap_std::fs_utf8

Trait FileExt

Source
pub trait FileExt {
    // Required methods
    fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize, Error>;
    fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize, Error>;

    // Provided methods
    fn read_vectored_at(
        &self,
        bufs: &mut [IoSliceMut<'_>],
        offset: u64,
    ) -> Result<usize, Error> { ... }
    fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<(), Error> { ... }
    fn write_vectored_at(
        &self,
        bufs: &[IoSlice<'_>],
        offset: u64,
    ) -> Result<usize, Error> { ... }
    fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error> { ... }
}
Available on crate feature fs_utf8 only.
Expand description

Unix-specific extensions to [fs::File].

Required Methods§

Source

fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize, Error>

Reads a number of bytes starting from a given offset.

Source

fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize, Error>

Writes a number of bytes starting from a given offset.

Provided Methods§

Source

fn read_vectored_at( &self, bufs: &mut [IoSliceMut<'_>], offset: u64, ) -> Result<usize, Error>

Available on unix_file_vectored_at only.

Like read_at, except that it reads into a slice of buffers.

Source

fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<(), Error>

Reads the exact number of bytes required to fill buf from the given offset.

Source

fn write_vectored_at( &self, bufs: &[IoSlice<'_>], offset: u64, ) -> Result<usize, Error>

Available on unix_file_vectored_at only.

Like write_at, except that it writes from a slice of buffers.

Source

fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error>

Attempts to write an entire buffer starting from a given offset.

Implementors§

Source§

impl FileExt for cap_std::fs::File

Available on Unix only.
Source§

impl FileExt for cap_std::fs_utf8::File

Available on Unix only.