Skip to main content

Source

Trait Source 

Source
pub trait Source<T: DatasetItem>: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn stream(self: Box<Self>, cancel: CancellationToken) -> BoxItemStream<T>;
    fn cache_key(&self) -> Value;
    fn max_items(&self) -> Option<usize>;

    // Provided methods
    fn display_name(&self) -> &str { ... }
    fn set_resume_state(&mut self, _offset: usize, _already_fetched: usize) { ... }
}
Expand description

Protocol for dataset sources over any DatasetItem type.

Required Methods§

Source

fn name(&self) -> &str

Stable source identifier used in manifests.

Source

fn stream(self: Box<Self>, cancel: CancellationToken) -> BoxItemStream<T>

Stream items from this source.

Source

fn cache_key(&self) -> Value

Stable cache key describing this source’s configured inputs.

Source

fn max_items(&self) -> Option<usize>

Optional maximum number of items this source will emit.

Provided Methods§

Source

fn display_name(&self) -> &str

Human-readable source label.

Source

fn set_resume_state(&mut self, _offset: usize, _already_fetched: usize)

Configure resume state before streaming.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§