black_box

Trait Handler

source
pub trait Handler<M>
where Self: Actor, M: Message,
{ // Required method fn handle( &mut self, msg: M, ctx: &Context, ) -> 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) -> impl Future<Output = ()> + Send

Asynchronously act on the message, with mutable access to self

Object Safety§

This trait is not object safe.

Implementors§