cap_std::fs

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_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<(), Error> { ... }
    fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error> { ... }
}
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_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_all_at(&self, buf: &[u8], offset: u64) -> Result<(), Error>

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

Implementors§