Skip to main content

Handler

Trait Handler 

Source
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§

Source

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,

Handle the next M-typed message.

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§

Source§

impl Handler<ActorSupervisionEvent> for ProcSupervisionCoordinator

Source§

impl Handler<PingPongMessage> for PingPongActor

Source§

impl<A, M> Handler<IndexedErasedUnbound<M>> for A
where A: Handler<M>, M: Castable,

This handler enables actors to unbind the IndexedErasedUnbound message, and forward the result to corresponding handler.

Source§

impl<A: Actor> Handler<IntrospectMessage> for A

Source§

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.

Source§

impl<A: Actor> Handler<Signal> for A

Blanket Handler impls for bypass-workq message types. Since these messages bypass workq, they will never be sent to actor’s handler.

These exist solely to lock the Handler<M> coherence slot for each bypass type, so no specific impl Handler<BypassType> for SomeActor can be written. The actual delivery for these types goes through dedicated channels set up in Instance::new, not through Handler. See the matching sender-side check in crate::ordering::Sequencer::assign_seq and the registry of bypass types in [crate::ordering::is_bypass_workq_type_id].