Trait hannibal::Handler

source ·
pub trait Handler<T: Message>: Actor
where Self: Sized,
{ // Required method fn handle( &mut self, ctx: &mut Context<Self>, msg: T ) -> impl Future<Output = T::Result> + Send; }
Expand description

Describes how to handle messages of a specific type. Implementing Handler is a general way to handle incoming messages. The type T is a message which can be handled by the actor.

Required Methods§

source

fn handle( &mut self, ctx: &mut Context<Self>, msg: T ) -> impl Future<Output = T::Result> + Send

Method is called for every message received by this Actor.

Object Safety§

This trait is not object safe.

Implementors§