Skip to main content

ByteSource

Trait ByteSource 

Source
pub trait ByteSource: Sync {
    // Required methods
    fn len(&self) -> u64;
    fn read_at(&self, at: u64, buf: &mut [u8]) -> usize;

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

Bytes read on demand from somewhere too large to hold in memory, such as a huge file the app reads in pieces (see Searcher::find_next_in).

Required Methods§

Source

fn len(&self) -> u64

The length in bytes, fixed for the duration of a search.

Source

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

Reads from at into buf; returns how many bytes were read: fewer at the end of the data, and 0 past it, on an error, or to stop a search early.

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§