Skip to main content

Consumer

Trait Consumer 

Source
pub trait Consumer: Send + 'static {
    type Item: Send + 'static;
    type Snap: Snapshot;

    // Required methods
    fn replay(&mut self, snapshot: Self::Snap);
    fn consume(&mut self, item: Self::Item);
}
Expand description

A consumer of producer items + snapshots. Mirrors the producer’s associated types so the type-checker enforces compatible pairs.

Required Associated Types§

Source

type Item: Send + 'static

Items received from the producer’s live stream.

Source

type Snap: Snapshot

Snapshot representation accepted by replay.

Required Methods§

Source

fn replay(&mut self, snapshot: Self::Snap)

Bootstrap the consumer’s local model from a producer snapshot. Called exactly once during the Subscribed → Synced transition.

Source

fn consume(&mut self, item: Self::Item)

Apply a single live item. Called once per item after start_live is invoked.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§