Skip to main content

PackReadSource

Trait PackReadSource 

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

    // Provided method
    fn is_empty(&self) -> Result<bool> { ... }
}
Expand description

A source that can read pack bytes positionally without changing shared cursor state or requiring the complete pack to be resident in memory.

Required Methods§

Source

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

Total source length, including the pack trailer.

Source

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

Read bytes beginning at offset, with the same short-read semantics as std::io::Read::read. Returning 0 means end of source.

Provided Methods§

Source

fn is_empty(&self) -> Result<bool>

Whether this source contains no bytes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl PackReadSource for File

Available on Unix only.
Source§

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

Source§

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

Source§

impl PackReadSource for Vec<u8>

Source§

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

Source§

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

Implementors§