Trait Consumer

Source
pub trait Consumer:
    Clone
    + Send
    + 'static {
    type Key: Array;
    type Value;
    type Failure;

    // Required methods
    fn deliver(
        &mut self,
        key: Self::Key,
        value: Self::Value,
    ) -> impl Future<Output = bool> + Send;
    fn failed(
        &mut self,
        key: Self::Key,
        failure: Self::Failure,
    ) -> impl Future<Output = ()> + Send;
}
Expand description

Notified when data is available, and must validate it.

Required Associated Types§

Source

type Key: Array

Type used to uniquely identify data.

Source

type Value

Type of data to retrieve.

Source

type Failure

Type used to indicate why data is not available.

Required Methods§

Source

fn deliver( &mut self, key: Self::Key, value: Self::Value, ) -> impl Future<Output = bool> + Send

Deliver data to the consumer.

Returns true if the data is valid.

Source

fn failed( &mut self, key: Self::Key, failure: Self::Failure, ) -> impl Future<Output = ()> + Send

Let the consumer know that the data is not being fetched anymore.

The failure is used to indicate why.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§