pub struct Context<A: Actor> { /* private fields */ }
Expand description
Context
of a ActorRuntime
that contains Address
and Receiver
.
Implementations§
Source§impl<A: Actor> Context<A>
impl<A: Actor> Context<A>
Sourcepub fn spawn_actor_with_addr<T>(
&mut self,
actor: T,
pair: AddressPair<T>,
group: A::GroupBy,
)
pub fn spawn_actor_with_addr<T>( &mut self, actor: T, pair: AddressPair<T>, group: A::GroupBy, )
Starts and binds an Actor
.
Sourcepub fn spawn_actor<T>(&mut self, actor: T, group: A::GroupBy) -> Address<T>
pub fn spawn_actor<T>(&mut self, actor: T, group: A::GroupBy) -> Address<T>
Starts and binds an Actor
.
Sourcepub fn spawn_task<T, M>(
&mut self,
task: T,
tag: M,
group: A::GroupBy,
) -> TaskAddress<T>
pub fn spawn_task<T, M>( &mut self, task: T, tag: M, group: A::GroupBy, ) -> TaskAddress<T>
Starts and binds a Task
.
Sourcepub fn attach<S, M>(&mut self, stream: S, tag: M, group: A::GroupBy)
pub fn attach<S, M>(&mut self, stream: S, tag: M, group: A::GroupBy)
Spawns interaction task that forwards the result of an interaction.
Sourcepub fn track_interaction<I, M>(
&mut self,
task: InteractionTask<I>,
tag: M,
group: A::GroupBy,
)
pub fn track_interaction<I, M>( &mut self, task: InteractionTask<I>, tag: M, group: A::GroupBy, )
Spawns InteractionTask
as a LiteTask
and await the result as an Action
that will call InteractionDone
handler.
Sourcepub fn interrupt<T>(&mut self, address: &mut Address<T>) -> Result<(), Error>where
T: Actor + InterruptedBy<A>,
pub fn interrupt<T>(&mut self, address: &mut Address<T>) -> Result<(), Error>where
T: Actor + InterruptedBy<A>,
Interrupts an Actor
.
Sourcepub fn not_terminating(&self) -> Result<(), Error>
pub fn not_terminating(&self) -> Result<(), Error>
Returns Error
if the Actor
is terminating.
Useful for checking in handlers.
Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Stops the runtime of the Actor
on one message will be processed after this call.
It’s recommended way to terminate Actor
is the shutdown
method.
Attention! Termination process will never started here and all spawned actors and tasks will be orphaned.
Sourcepub fn terminate_group(&mut self, group: A::GroupBy)
pub fn terminate_group(&mut self, group: A::GroupBy)
Sends interruption signal to the sepcific group of actors and tasks.
Sourcepub fn is_terminating(&self) -> bool
pub fn is_terminating(&self) -> bool
Returns true if the shutdown process is in progress.