pub struct Process<A: Actor<Context = Self>> { /* private fields */ }
Expand description
A special execution context. In this context the actor has a stable identity, whuch should not change. It can also receive messages from remote nodes.
Implementations§
Source§impl<A> Process<A>where
A: ProcessDispatch + Actor<Context = Self>,
impl<A> Process<A>where
A: ProcessDispatch + Actor<Context = Self>,
Trait Implementations§
Source§impl<A: Actor<Context = Self>> ActorContext for Process<A>
impl<A: Actor<Context = Self>> ActorContext for Process<A>
Source§fn 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.Source§fn 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.Source§fn state(&self) -> ActorState
fn state(&self) -> ActorState
Retrieve the current Actor execution state.
Source§impl<A: Actor<Context = Self>> AsyncContext<A> for Process<A>
impl<A: Actor<Context = Self>> AsyncContext<A> for Process<A>
Source§fn spawn<F>(&mut self, fut: F) -> SpawnHandlewhere
F: ActorFuture<Output = (), Actor = A> + 'static,
fn spawn<F>(&mut self, fut: F) -> SpawnHandlewhere
F: ActorFuture<Output = (), Actor = A> + 'static,
Spawns a future into the context. Read more
Source§fn wait<F>(&mut self, fut: F)where
F: ActorFuture<Output = (), Actor = A> + 'static,
fn wait<F>(&mut self, fut: F)where
F: ActorFuture<Output = (), Actor = A> + 'static,
Spawns a future into the context, waiting for it to resolve. Read more
Source§fn waiting(&self) -> bool
fn waiting(&self) -> bool
Checks if the context is paused (waiting for future completion or stopping).
Source§fn cancel_future(&mut self, handle: SpawnHandle) -> bool
fn cancel_future(&mut self, handle: SpawnHandle) -> bool
Cancels a spawned future. Read more
Source§fn add_stream<S>(&mut self, fut: S) -> SpawnHandle
fn add_stream<S>(&mut self, fut: S) -> SpawnHandle
Registers a stream with the context. Read more
Source§fn add_message_stream<S>(&mut self, fut: S)
fn add_message_stream<S>(&mut self, fut: S)
Registers a stream with the context, ignoring errors. Read more
Source§fn notify<M>(&mut self, msg: M)
fn notify<M>(&mut self, msg: M)
Sends the message
msg
to self. This bypasses the mailbox capacity, and
will always queue the message. If the actor is in the stopped
state, an
error will be raised.Source§fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle
fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle
Sends the message
msg
to self after a specified period of time. Read moreSource§fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle
fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle
Executes a closure after a specified period of time. Read more
Source§fn run_interval<F>(&mut self, dur: Duration, f: F) -> SpawnHandle
fn run_interval<F>(&mut self, dur: Duration, f: F) -> SpawnHandle
Spawns a job to execute the given closure periodically, at a
specified fixed interval.
Source§impl<A: Actor<Context = Self>> AsyncContextParts<A> for Process<A>
impl<A: Actor<Context = Self>> AsyncContextParts<A> for Process<A>
fn parts(&mut self) -> &mut ContextParts<A>
Auto Trait Implementations§
impl<A> Freeze for Process<A>
impl<A> !RefUnwindSafe for Process<A>
impl<A> !Send for Process<A>
impl<A> !Sync for Process<A>
impl<A> Unpin for Process<A>
impl<A> !UnwindSafe for Process<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more