pub trait Handler {
    type Envelope: Send;

    // Required method
    fn process<'life0, 'async_trait>(
        &'life0 mut self,
        _envelope: Self::Envelope
    ) -> Pin<Box<dyn Future<Output = Result<(), HandlerError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Handle event envelopes in any way that an application requires.

Required Associated Types§

source

type Envelope: Send

The envelope processed by the handler.

Required Methods§

source

fn process<'life0, 'async_trait>( &'life0 mut self, _envelope: Self::Envelope ) -> Pin<Box<dyn Future<Output = Result<(), HandlerError>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Process an envelope. A handler’s result is “completed” where envelopes are processed upon the previous one having been processed successfully.

Implementors§

source§

impl<A, AR, E> Handler for FnHandler<A, AR, E>where A: FnMut(E) -> AR + Send, AR: Future<Output = Result<(), HandlerError>> + Send, E: Send,

§

type Envelope = E

source§

impl<E> Handler for UnusedHandler<E>where E: Send,

§

type Envelope = E