Trait ReadAt

Source
pub trait ReadAt:
    Send
    + Sync
    + 'static {
    // Required methods
    fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>;
    fn size(&self) -> Result<u64>;
}
Expand description

Read from a file-like object at an offset.

Required Methods§

Source

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

Seeks to offset and performs reads into buf.

Returns the number of bytes read.

Note that similar to File::read, it is not an error to return with a short read. May or may not move any underlying file pointer, even if the read fails or is short.

Source

fn size(&self) -> Result<u64>

Returns the length of the data.

Implementations on Foreign Types§

Source§

impl ReadAt for Vec<u8>

Source§

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

Source§

fn size(&self) -> Result<u64>

Source§

impl ReadAt for File

Source§

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

Source§

fn size(&self) -> Result<u64>

Implementors§