Skip to main content

WorkerSourceFactory

Trait WorkerSourceFactory 

Source
pub trait WorkerSourceFactory:
    Send
    + Sync
    + 'static {
    type Sample: Send + 'static;
    type Error: Send + 'static;
    type Source: Iterator<Item = Result<WorkerRecord<Self::Sample>, Self::Error>> + Send + 'static;

    // Required method
    fn create(&self, worker: WorkerContext) -> Result<Self::Source, Self::Error>;

    // Provided method
    fn exact_len(&self) -> Option<usize> { ... }
}
Expand description

Creates one independently owned stream shard per worker and generation.

Required Associated Types§

Source

type Sample: Send + 'static

Sample produced by every shard.

Source

type Error: Send + 'static

Typed source creation or iteration failure.

Source

type Source: Iterator<Item = Result<WorkerRecord<Self::Sample>, Self::Error>> + Send + 'static

Independently owned shard iterator.

Required Methods§

Source

fn create(&self, worker: WorkerContext) -> Result<Self::Source, Self::Error>

Creates this worker’s shard for the supplied generation context.

Provided Methods§

Source

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

Returns the exact global record count when known.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§