[−][src]Struct xtra::Context
Context
is used to signal things to the ActorManager
's
management loop or to get the actor's address from inside of a message handler.
Methods
impl<A: Actor> Context<A>
[src]
pub fn stop(&mut self)
[src]
Stop the actor as soon as it has finished processing current message. This will mean that the
Actor::stopping
method will be called.
If that returns KeepRunning::No
, any subsequent attempts
to send messages to this actor will return the Disconnected
error.
pub fn address(&self) -> Option<Address<A>>
[src]
Get an address to the current actor if the actor is still running.
pub fn notify_immediately<M>(&mut self, msg: M) where
M: Message,
A: Handler<M> + Send,
[src]
M: Message,
A: Handler<M> + Send,
Notify this actor with a message that is handled synchronously before any other messages
from the general queue are processed (therefore, immediately). If multiple
notify_immediately
messages are queued, they will still be processed in the order that they
are queued (i.e the immediate priority is only over other messages).
pub fn notify_later<M>(&mut self, msg: M) where
M: Message,
A: Handler<M> + Send,
[src]
M: Message,
A: Handler<M> + Send,
Notify this actor with a message that is handled synchronously after any other messages from the general queue are processed.
pub fn notify_interval<F, M>(&mut self, duration: Duration, constructor: F) where
F: Send + 'static + Fn() -> M,
M: Message,
A: Handler<M> + Send,
[src]
F: Send + 'static + Fn() -> M,
M: Message,
A: Handler<M> + Send,
feature="with-tokio-0_2"
and feature="with-async_std-1"
only.Notify the actor with a synchronously handled message every interval until it is stopped
(either directly with Context::stop
, or for a lack of
strong Address
es). This does not take priority over other messages.
pub fn notify_after<M>(&mut self, duration: Duration, notification: M) where
M: Message,
A: Handler<M> + Send,
[src]
M: Message,
A: Handler<M> + Send,
feature="with-async_std-1"
only.Notify the actor with a synchronously handled message after a certain duration has elapsed. This does not take priority over other messages.
Auto Trait Implementations
impl<A> !RefUnwindSafe for Context<A>
impl<A> Send for Context<A>
impl<A> !Sync for Context<A>
impl<A> Unpin for Context<A>
impl<A> !UnwindSafe for Context<A>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,