Handler

Trait Handler 

Source
pub trait Handler<M>
where Self: Actor, M: Message,
{ // Required method fn handle( &mut self, msg: M, ctx: &Context<Self>, ) -> impl Future<Output = ()> + Send; }
Expand description

The implementation for how an actor handles a particular message

An Actor, can implement the Handler trait any number of time, with a unique message type for each implementation.

Required Methods§

Source

fn handle( &mut self, msg: M, ctx: &Context<Self>, ) -> impl Future<Output = ()> + Send

Asynchronously act on the message, with mutable access to self

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§