Handler

Trait Handler 

Source
pub trait Handler<A, B> {
    type Error;
    type Fut: Future<Output = Result<B, Self::Error>>;

    // Required method
    fn call(&mut self, event: A, context: Context) -> Self::Fut;
}
Expand description

A trait describing an asynchronous function A to B.

Required Associated Types§

Source

type Error

Errors returned by this handler.

Source

type Fut: Future<Output = Result<B, Self::Error>>

Response of this handler.

Required Methods§

Source

fn call(&mut self, event: A, context: Context) -> Self::Fut

Handle the incoming event.

Implementors§

Source§

impl<F, A, B, Error, Fut> Handler<A, B> for HandlerFn<F>
where F: Fn(A, Context) -> Fut, Fut: Future<Output = Result<B, Error>> + Send, Error: Into<Box<dyn Error + Send + Sync + 'static>> + Display,

Source§

type Error = Error

Source§

type Fut = Fut