pub trait Handler<T>: 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.
The result type the Handler produces when evaluating a Query.
The error type returned by the Handler when Query evaluation fails.
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.