pub trait Handler<M: Message>: Actor {
// Required method
fn handle(
&mut self,
msg: M,
ctx: &Context<Self>,
) -> impl Future<Output = M::Result> + Send;
}Expand description
Per-message handler trait. Implement once for each message type the actor handles.
Uses RPITIT (return-position impl Trait in traits), which means this trait
is not object-safe. For type-erased references, use Receiver<M> / Recipient<M>.
Required Methods§
fn handle( &mut self, msg: M, ctx: &Context<Self>, ) -> impl Future<Output = M::Result> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.