Struct actix::prelude::Context[][src]

pub struct Context<A> where
    A: Actor<Context = Context<A>>, 
{ /* fields omitted */ }

An actor execution context.

Implementations

impl<A> Context<A> where
    A: Actor<Context = Self>, 
[src]

pub fn with_receiver(rx: AddressReceiver<A>) -> Self[src]

pub fn run(self, act: A) -> Addr<A>[src]

pub fn into_future(self, act: A) -> ContextFut<A, Self>[src]

pub fn handle(&self) -> SpawnHandle[src]

Returns a handle to the running future.

This is the handle returned by the AsyncContext::spawn() method.

pub fn set_mailbox_capacity(&mut self, cap: usize)[src]

Sets the mailbox capacity.

The default mailbox capacity is 16 messages. #Examples

struct MyActor;
impl Actor for MyActor {
    type Context = Context<Self>;

    fn started(&mut self, ctx: &mut Self::Context) {
        ctx.set_mailbox_capacity(1);
        System::current().stop();
    }
}

let addr = sys.block_on(async { MyActor.start() });
sys.run();

pub fn connected(&self) -> bool[src]

Returns whether any addresses are still connected.

Trait Implementations

impl<A> ActorContext for Context<A> where
    A: Actor<Context = Self>, 
[src]

impl<A> AsyncContext<A> for Context<A> where
    A: Actor<Context = Self>, 
[src]

impl<A> AsyncContextParts<A> for Context<A> where
    A: Actor<Context = Self>, 
[src]

impl<A: Actor<Context = Context<A>>> Debug for Context<A>[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
[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.