Trait eventually::query::Handler

source ·
pub trait Handler<T>: Send + Sync
where T: Message + Send + Sync,
{ type Output: Send + Sync; type Error: Send + Sync; // Required method fn handle<'life0, 'async_trait>( &'life0 self, query: Envelope<T> ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; }
Expand description

An Handler describes an implementation that is able to handle specific Queries.

The Handler evaluates the Domain Query and produces a result, here described through the Output associated type.

Required Associated Types§

source

type Output: Send + Sync

The result type the Handler produces when evaluating a Query.

source

type Error: Send + Sync

The error type returned by the Handler when Query evaluation fails.

Required Methods§

source

fn handle<'life0, 'async_trait>( &'life0 self, query: Envelope<T> ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Evaluates the Query provided and returns a result type, described by the Output parameter.

§Errors

As the Handler can fail to evaluate the Query, an Error can be returned instead.

Implementors§

source§

impl<T, R, Err, F, Fut> Handler<T> for F
where T: Message + Send + Sync + 'static, R: Send + Sync, Err: Send + Sync, F: Send + Sync + Fn(Envelope<T>) -> Fut, Fut: Send + Sync + Future<Output = Result<R, Err>>,

§

type Output = R

§

type Error = Err