Trait Handler

Source
pub trait Handler<M: Message> {
    // Required method
    fn deliver(&mut self, m: M) -> M::Reply;
}
Expand description

Implement this trait to indicate that your service can process a specific message.

The deliver() method is passed a &mut self reference to the service, making it very easy to update your state. You can optionally include a reply.

Required Methods§

Source

fn deliver(&mut self, m: M) -> M::Reply

Implementors§

Source§

impl<M: Message, S: Handler<M>> Handler<Vec<M>> for S

Blanket implementation of delivering a Vec<Message> to a Handler<Message>.

Source§

impl<S: Service> Handler<PingMessage> for S

Source§

impl<S: Service> Handler<ShutdownServiceMessage> for S