[][src]Trait xtra::SyncHandler

pub trait SyncHandler<M: Message>: Actor {
    fn handle(&mut self, message: M, ctx: &mut Context<Self>) -> M::Result;
}

A trait indicating that an Actor can handle a given Message synchronously, and the logic to handle the message. A SyncHandler implementation automatically creates a corresponding Handler impl. This, however, is not just sugar over the asynchronous Handler trait -- it is also slightly faster than it for handling due to how they get specialized under the hood.

Required methods

fn handle(&mut self, message: M, ctx: &mut Context<Self>) -> M::Result

Handle a given message, returning its result.

Loading content...

Implementors

Loading content...