Skip to main content

ItemSource

Trait ItemSource 

Source
pub trait ItemSource:
    Send
    + Sync
    + Debug {
    // Required method
    fn next<'life0, 'life1, 'async_trait>(
        &'life0 self,
        after: Option<&'life1 str>,
        limit: usize,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<BatchItem>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Where a batch’s work comes from.

A cursor rather than a collection — see the module docs on why input is never materialised.

Required Methods§

Source

fn next<'life0, 'life1, 'async_trait>( &'life0 self, after: Option<&'life1 str>, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<BatchItem>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The next page of items strictly after after, in strictly increasing byte order of BatchItem::key.

Byte order, not a collation or a numeric sort: the resume cursor is the greatest finished key compared as bytes, so a page in any other order resumes past items that never ran. The driver refuses a page whose keys do not strictly increase past after. Zero-pad numeric keys.

Returning fewer than limit items does not mean the source is exhausted; returning zero does. The distinction matters for sources that page unevenly, and conflating them truncates a batch silently — which is the failure mode this whole crate exists to make loud.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§