Trait Handler

Source
pub trait Handler<M: Message>
where M::Result: Send,
{ // Required method fn handle(&mut self, msg: M) -> M::Result; }
Expand description

Trait for handling a message. This works in unison with the CanSend trait. An actor implements the Handler trait for all messages it would like to handle, while the CanSend trait implements the logic to send the message to the actor. Handle and CanSend are typically not both implemented by the same struct. Note that the actor is any struct that implements the Handler trait, not just actix actors.

Required Methods§

Source

fn handle(&mut self, msg: M) -> M::Result

Implementors§