Skip to main content

Consumer

Trait Consumer 

Source
pub trait Consumer:
    Clone
    + Send
    + 'static {
    type Key: Span;
    type Value;
    type Subscriber: Clone + Eq + Send + 'static;

    // Required method
    fn deliver(
        &mut self,
        delivery: Delivery<Self::Key, Self::Subscriber>,
        value: Self::Value,
    ) -> Receiver<bool>;
}
Expand description

Notified when data is available, and must validate it.

Required Associated Types§

Source

type Key: Span

Type used to key data requested from peers.

Source

type Value

Type of data to retrieve.

Source

type Subscriber: Clone + Eq + Send + 'static

Type used to track subscribers on fetch keys.

Required Methods§

Source

fn deliver( &mut self, delivery: Delivery<Self::Key, Self::Subscriber>, value: Self::Value, ) -> Receiver<bool>

Deliver data to the consumer.

Returns a receiver that resolves to true if the data is valid for the key.

The returned receiver may be dropped before completion if the application cancels the fetch via Resolver::retain. When this happens, the resolver discards the validation result.

Implementations of Resolver must only invoke deliver for keys that were previously requested via Resolver::fetch (or TargetedResolver variants).

delivery contains the peer-visible key and the retained subscribers for the fetch. Subscribers decide who should observe a valid response; they do not define peer validity.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§