Struct actix::Context [−][src]
Actor execution context
Methods
impl<A> Context<A> where
A: Actor<Context = Self>, [src]
impl<A> Context<A> where
A: Actor<Context = Self>, pub fn with_receiver(rx: AddressReceiver<A>) -> Context<A>[src]
pub fn with_receiver(rx: AddressReceiver<A>) -> Context<A>pub fn run(self, act: A) -> Addr<A>[src]
pub fn run(self, act: A) -> Addr<A>pub fn into_future(self, act: A) -> ContextFut<A, Self>[src]
pub fn into_future(self, act: A) -> ContextFut<A, Self>pub fn handle(&self) -> SpawnHandle[src]
pub fn handle(&self) -> SpawnHandleHandle of the running future
SpawnHandle is the handle returned by AsyncContext::spawn() method.
pub fn set_mailbox_capacity(&mut self, cap: usize)[src]
pub fn set_mailbox_capacity(&mut self, cap: usize)Set mailbox capacity
By default mailbox capacity is 16 messages.
Trait Implementations
impl<A> ActorContext for Context<A> where
A: Actor<Context = Self>, [src]
impl<A> ActorContext for Context<A> where
A: Actor<Context = Self>, fn stop(&mut self)[src]
fn stop(&mut self)Immediately stop processing incoming messages and switch to a stopping state Read more
fn terminate(&mut self)[src]
fn terminate(&mut self)Terminate actor execution
fn state(&self) -> ActorState[src]
fn state(&self) -> ActorStateActor execution state
impl<A> AsyncContext<A> for Context<A> where
A: Actor<Context = Self>, [src]
impl<A> AsyncContext<A> for Context<A> where
A: Actor<Context = Self>, fn spawn<F>(&mut self, fut: F) -> SpawnHandle where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static, [src]
fn spawn<F>(&mut self, fut: F) -> SpawnHandle where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static, Spawn async future into context. Returns handle of the item, could be used for cancelling execution. Read more
fn wait<F>(&mut self, fut: F) where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static, [src]
fn wait<F>(&mut self, fut: F) where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static, Spawn future into the context. Stop processing any of incoming events until this future resolves. Read more
fn waiting(&self) -> bool[src]
fn waiting(&self) -> boolCheck if context is paused (waiting for future completion or stopping)
fn cancel_future(&mut self, handle: SpawnHandle) -> bool[src]
fn cancel_future(&mut self, handle: SpawnHandle) -> boolCancel future. handle is a value returned by spawn method.
fn address(&self) -> Addr<A>[src]
fn address(&self) -> Addr<A>Return Address of the context
fn add_stream<S>(&mut self, fut: S) -> SpawnHandle where
S: Stream + 'static,
A: StreamHandler<S::Item, S::Error>, [src]
fn add_stream<S>(&mut self, fut: S) -> SpawnHandle where
S: Stream + 'static,
A: StreamHandler<S::Item, S::Error>, This method register stream to an actor context and allows to handle Stream in similar way as normal actor messages. Read more
fn add_message_stream<S>(&mut self, fut: S) where
S: Stream<Error = ()> + 'static,
S::Item: Message,
A: Handler<S::Item>, [src]
fn add_message_stream<S>(&mut self, fut: S) where
S: Stream<Error = ()> + 'static,
S::Item: Message,
A: Handler<S::Item>, This method is similar to add_stream but it skips stream errors. Read more
fn notify<M>(&mut self, msg: M) where
A: Handler<M>,
M: Message + 'static, [src]
fn notify<M>(&mut self, msg: M) where
A: Handler<M>,
M: Message + 'static, Send message msg to self.
fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle where
A: Handler<M>,
M: Message + 'static, [src]
fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle where
A: Handler<M>,
M: Message + 'static, Send message msg to self after specified period of time. Returns spawn handle which could be used for cancellation. Notification get cancelled if context's stop method get called. Read more
fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
F: FnOnce(&mut A, &mut A::Context) + 'static, [src]
fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
F: FnOnce(&mut A, &mut A::Context) + 'static, Execute closure after specified period of time within same Actor and Context. Execution get cancelled if context's stop method get called. Read more
fn run_interval<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
F: FnMut(&mut A, &mut A::Context) + 'static, [src]
fn run_interval<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
F: FnMut(&mut A, &mut A::Context) + 'static, Spawns job to execute closure with specified interval
impl<A> AsyncContextParts<A> for Context<A> where
A: Actor<Context = Self>, [src]
impl<A> AsyncContextParts<A> for Context<A> where
A: Actor<Context = Self>, fn parts(&mut self) -> &mut ContextParts<A>[src]
fn parts(&mut self) -> &mut ContextParts<A>impl<A, M> ToEnvelope<A, M> for Context<A> where
A: Actor<Context = Context<A>> + Handler<M>,
M: Message + Send + 'static,
M::Result: Send, [src]
impl<A, M> ToEnvelope<A, M> for Context<A> where
A: Actor<Context = Context<A>> + Handler<M>,
M: Message + Send + 'static,
M::Result: Send,