Trait Actor

Source
pub trait Actor {
    // Provided methods
    fn start_actor(&mut self, _ctx: &mut dyn DelayedActionRunner<Self>) { ... }
    fn wrap_handler<M: Message>(
        &mut self,
        msg: M,
        ctx: &mut dyn DelayedActionRunner<Self>,
        f: impl FnOnce(&mut Self, M, &mut dyn DelayedActionRunner<Self>) -> M::Result,
    ) -> M::Result { ... }
}
Expand description

Trait for an actor. An actor is a struct that can handle messages and implements the Handler or HandlerWithContext trait. We can optionally implement the start_actor trait which is executed in the beginning of the actor’s lifecycle. This corresponds to the actix::Actor trait started function.

Provided Methods§

Source

fn start_actor(&mut self, _ctx: &mut dyn DelayedActionRunner<Self>)

Source

fn wrap_handler<M: Message>( &mut self, msg: M, ctx: &mut dyn DelayedActionRunner<Self>, f: impl FnOnce(&mut Self, M, &mut dyn DelayedActionRunner<Self>) -> M::Result, ) -> M::Result

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§