pub trait Consumer:
Clone
+ Send
+ 'static {
type Key: Span;
type Value;
type Subscriber: Clone + Eq + Send + 'static;
type Outcome: Into<Outcome> + Send + 'static;
// Required method
fn deliver(
&mut self,
delivery: Delivery<Self::Key, Self::Subscriber>,
value: Self::Value,
) -> Receiver<Self::Outcome> ⓘ;
}Expand description
Determines the disposition of data returned for a fetch.
Required Associated Types§
Sourcetype Subscriber: Clone + Eq + Send + 'static
type Subscriber: Clone + Eq + Send + 'static
Type used to track subscribers on fetch keys.
Sourcetype Outcome: Into<Outcome> + Send + 'static
type Outcome: Into<Outcome> + Send + 'static
Delivery disposition returned after validation.
Consumers that only distinguish valid and invalid data may use
bool, which maps to crate::Outcome::Complete and
crate::Outcome::Invalid.
Required Methods§
Sourcefn deliver(
&mut self,
delivery: Delivery<Self::Key, Self::Subscriber>,
value: Self::Value,
) -> Receiver<Self::Outcome> ⓘ
fn deliver( &mut self, delivery: Delivery<Self::Key, Self::Subscriber>, value: Self::Value, ) -> Receiver<Self::Outcome> ⓘ
Deliver data to the consumer.
Returns a receiver that reports whether the response completes the delivery, is invalid, is valid but leaves subscribers unresolved, or can be ignored because the key is no longer needed.
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.
If the consumer drops the sender without reporting a verdict, the response is handed to the remaining subscribers, or the key is retired without penalizing its source when none remain. The subscribers in the dropped delivery are not retried.
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".