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 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: '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 'life0: 'async_trait, 'life1: 'async_trait, Self: '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.

Implementations on Foreign Types§

Source§

impl Handler<CommActorMode> for CommActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, _cx: &'life1 Context<'_, CommActor>, mode: CommActorMode, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CommActor: 'async_trait,

Source§

impl Handler<TestMessage> for TestActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, TestActor>, msg: TestMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, TestActor: 'async_trait,

Source§

impl Handler<LogClientMessage> for LogClientActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, LogClientActor>, message: LogClientMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, LogClientActor: 'async_trait,

Source§

impl Handler<LogForwardMessage> for LogForwardActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, LogForwardActor>, message: LogForwardMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, LogForwardActor: 'async_trait,

Source§

impl Handler<LogMessage> for LogClientActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, LogClientActor>, message: LogMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, LogClientActor: 'async_trait,

Source§

impl Handler<ActorSupervisionEvent> for MeshAgent

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, MeshAgent>, event: ActorSupervisionEvent, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MeshAgent: 'async_trait,

Source§

impl Handler<Wait> for TestActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, _: &'life1 Context<'_, TestActor>, __arg2: Wait, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, TestActor: 'async_trait,

Source§

impl Handler<CastMessage> for CommActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, CommActor>, cast_message: CastMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CommActor: 'async_trait,

Source§

impl Handler<EmptyMessage> for EmptyActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, _: &'life1 Context<'_, EmptyActor>, __arg2: EmptyMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, EmptyActor: 'async_trait,

Source§

impl Handler<ForwardMessage> for CommActor

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, CommActor>, fwd_message: ForwardMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CommActor: 'async_trait,

Source§

impl Handler<MeshAgentMessage> for MeshAgent

Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, cx: &'life1 Context<'_, MeshAgent>, message: MeshAgentMessage, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, MeshAgent: 'async_trait,

Implementors§

Source§

impl Handler<MailboxAdminMessage> for ProcActor

Source§

impl Handler<ProcMessage> for ProcActor

Source§

impl Handler<ProcSupervisionMessage> for SystemActor

Source§

impl Handler<WorldSupervisionMessage> for SystemActor

Source§

impl Handler<SystemMessage> for SystemActor

Source§

impl Handler<ActorSupervisionEvent> for ProcSupervisionCoordinator

Source§

impl Handler<ActorSupervisionEvent> for ProcActor

Source§

impl Handler<PingPongMessage> for PingPongActor

Source§

impl Handler<ProcStopResult> for SystemActor

Source§

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

We provide this handler to indicate that actors can handle the Signal message. Its actual handler is implemented by the runtime.

Source§

impl<A> Handler<Undeliverable<MessageEnvelope>> for A
where A: Actor,

This handler provides a default behavior when a message sent by the actor to another is returned due to delivery failure.

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.