Skip to main content

RangeSource

Trait RangeSource 

Source
pub trait RangeSource {
    type Document: Copy + Eq;
    type Generation: Copy + Eq;
    type Error;

    // Required methods
    fn stamp(&self) -> Stamp<Self::Document, Self::Generation>;
    fn read_at<'q, W>(
        &'q self,
        offset: u64,
        output: &'q mut [u8],
        work: &'q W,
    ) -> impl Future<Output = Result<usize, ReadError<Self::Error>>> + 'q
       where W: Work + 'q;
}
Expand description

A stable range source that may suspend during bounded acquisition.

The window admits requested copy bytes before dispatch. Implementations fund additional processing/storage through work, write only output, and return its written length. Short reads and zero at EOF are allowed. Whole-source materialization is not an implementation detail of this API.

Required Associated Types§

Source

type Document: Copy + Eq

Stable, constant-time comparable source-owner identity.

Source

type Generation: Copy + Eq

Constant-time comparable immutable generation.

Source

type Error

Original acquisition failure.

Required Methods§

Source

fn stamp(&self) -> Stamp<Self::Document, Self::Generation>

Constant-time metadata, without allocation, traversal or I/O.

Source

fn read_at<'q, W>( &'q self, offset: u64, output: &'q mut [u8], work: &'q W, ) -> impl Future<Output = Result<usize, ReadError<Self::Error>>> + 'q
where W: Work + 'q,

Fills a bounded original range; no executor, Send or heap future bound.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<D, G> RangeSource for Slice<'_, D, G>
where D: Copy + Eq, G: Copy + Eq,