Skip to main content

FileReader

Trait FileReader 

Source
pub trait FileReader {
    // Required method
    fn read_at(&self, offset: u64, buf: &mut [u8]) -> Result<usize>;
}
Expand description

This trait represents file that can atomically be read at specific point

For unix we implement it for File + AsRawFd with pread() system call. For windows we’re implementing it for Mutex<File> and use seek.

Required Methods§

Source

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

Read file at specified location

This corresponds to the pread system call on most unix systems

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl FileReader for File

Available on Unix only.
Source§

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

Implementors§