[][src]Trait xtra::AsyncHandler

pub trait AsyncHandler<M: Message>: Actor {
    type Responder: Future<Output = M::Result> + Send;
    fn handle<'a>(
        &'a mut self,
        message: M,
        ctx: &'a mut Context<Self>
    ) -> Self::Responder; }

A trait indicating that an Actor can handle a given Message asynchronously, and the logic to handle the message.

Associated Types

type Responder: Future<Output = M::Result> + Send

The responding future of the asynchronous actor. This should probably look like:

This example is not tested
type Responder<'a>: Future<Output = M::Result> + Send
Loading content...

Required methods

fn handle<'a>(
    &'a mut self,
    message: M,
    ctx: &'a mut Context<Self>
) -> Self::Responder

Handle a given message, returning a future eventually resolving to its result. The signature of this function should probably look like:

This example is not tested
fn handle(&mut self, message: M, ctx: &mut Context<Self>) -> Self::Responder<'_>
Loading content...

Implementors

Loading content...