Trait near_async::messaging::HandlerWithContext

source ·
pub trait HandlerWithContext<M: Message> {
    // Required method
    fn handle(
        &mut self,
        msg: M,
        ctx: &mut dyn DelayedActionRunner<Self>,
    ) -> M::Result;
}
Expand description

Trait for handling a message with context. This is similar to the Handler trait, but it allows the handler to access the delayed action runner that is used to schedule actions to be run in the future. For actix::Actor, the context defined as actix::Context implements DelayedActionRunner. Note that the implementer for hander of a message only needs to implement either of Handler or HandlerWithContext, not both.

Required Methods§

source

fn handle( &mut self, msg: M, ctx: &mut dyn DelayedActionRunner<Self>, ) -> M::Result

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<A, M> HandlerWithContext<M> for A
where M: Message, A: Actor + Handler<M>,