pub trait Handler<M: Message> where
    Self: Actor
{ fn handle(&mut self, msg: M) -> Return<'_, <M as Message>::Return>; fn handle_local(
        &mut self,
        msg: M
    ) -> ReturnNoSend<'_, <M as Message>::Return> { ... } }
Expand description

Trait indicating that the implementor can receive messages of a certain type. An actor can implement Handler for as many types as desired.

Required Methods

Define how your actor handles this message type. If your actor is !Send, you should implement handle_local and give handle an “unreachable!()” implementation. It shall never be called.

Provided Methods

Define how your actor handles this message type.

You still have to implement handle because that is a required method, but if your actor is Send and you implement handle, you get handle_local automatically.

Implementors