Handler

Trait Handler 

Source
pub trait Handler<M>: Actor {
    type Reply: Send + 'static;

    // Required method
    fn handle<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        message: M,
        ctx: &'life1 ActorContext<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Reply, ActorExitStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Message handler that requires actor to provide immediate response

Required Associated Types§

Source

type Reply: Send + 'static

Required Methods§

Source

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, message: M, ctx: &'life1 ActorContext<Self>, ) -> Pin<Box<dyn Future<Output = Result<Self::Reply, ActorExitStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Processes a message.

If an exit status is returned as an error, the actor will exit. It will stop processing more message, the finalize method will be called, and its exit status will be the one defined in the error.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§