Actor

Trait Actor 

Source
pub trait Actor: Sized {
    // Provided methods
    fn starting(
        &mut self,
        _ctx: &Context<Self>,
    ) -> impl Future<Output = ()> + Send { ... }
    fn stopping(
        &mut self,
        _ctx: &Context<Self>,
    ) -> impl Future<Output = ()> + Send { ... }
}
Expand description

Abstraction for message handleing

Actors are spawned in an Executor, and run in the executor’s event loop. When new messages are received by the executor, the appropriate handler Handler is invoked, allowing the actor to take any necessary action, including mutating it’s internal state.

Provided Methods§

Source

fn starting(&mut self, _ctx: &Context<Self>) -> impl Future<Output = ()> + Send

Source

fn stopping(&mut self, _ctx: &Context<Self>) -> impl Future<Output = ()> + Send

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§