pub trait ActorContext: Sized {
// Required methods
fn stop(&mut self);
fn terminate(&mut self);
fn state(&self) -> ActorState;
}
Expand description
Actor execution context.
Each actor runs within a specific execution context. The actor’s
associated type Actor::Context
defines the context to use for
the actor, and must implement the ActorContext
trait.
The execution context defines the type of execution, and the actor’s communication channels (message handling).
Required Methods§
Sourcefn stop(&mut self)
fn stop(&mut self)
Immediately stop processing incoming messages and switch to a
stopping
state. This only affects actors that are currently
running
. Future attempts to queue messages will fail.
Sourcefn terminate(&mut self)
fn terminate(&mut self)
Terminate actor execution unconditionally. This sets the actor
into the stopped
state. This causes future attempts to queue
messages to fail.
Sourcefn state(&self) -> ActorState
fn state(&self) -> ActorState
Retrieve the current Actor execution state.
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.