pub trait Handler<M>: Actor {
// Required method
fn handle<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cx: &'life1 Context<'_, Self>,
message: M,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Expand description
A Handler allows an actor to handle a specific message type.
Required Methods§
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.
Implementors§
impl Handler<ActorSupervisionEvent> for ProcSupervisionCoordinator
impl Handler<PingPongMessage> for PingPongActor
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
This handler enables actors to unbind the IndexedErasedUnbound message, and forward the result to corresponding handler.
impl<A: Actor> Handler<Signal> for A
We provide this handler to indicate that actors can handle the Signal
message.
Its actual handler is implemented by the runtime.
impl<A: Actor> Handler<Undeliverable<MessageEnvelope>> for A
This handler provides a default behavior when a message sent by the actor to another is returned due to delivery failure.