Skip to main content

Terminal

Trait Terminal 

Source
pub trait Terminal:
    Send
    + Sync
    + 'static {
    // Required method
    fn dispatch<'a>(
        &'a self,
        envelope: &'a MessageEnvelope,
        ctx: &'a HandlerContext,
    ) -> Pin<Box<dyn Future<Output = Result<BoxOutput, HexeractError>> + Send + 'a>>;
}
Expand description

Terminal of the middleware chain. The mediator (issue #6) supplies a concrete implementation that downcasts the message and invokes the registered handler.

This trait is public so external dispatchers and test harnesses can build a pipeline without depending on the mediator. The API may evolve before v1.0.

Required Methods§

Source

fn dispatch<'a>( &'a self, envelope: &'a MessageEnvelope, ctx: &'a HandlerContext, ) -> Pin<Box<dyn Future<Output = Result<BoxOutput, HexeractError>> + Send + 'a>>

Dispatches the message to its terminal destination.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§