Skip to main content

Actor

Trait Actor 

Source
pub trait Actor: Mailbox {
    type A: Actor;

    // Required method
    fn instance(&self) -> &Instance<Self::A>;

    // Provided methods
    fn spawn<C: Actor>(&self, actor: C) -> ActorHandle<C>
       where Self: Sized { ... }
    fn spawn_with_label<C: Actor>(
        &self,
        label: &str,
        actor: C,
    ) -> ActorHandle<C>
       where Self: Sized { ... }
    fn spawn_with_uid<C: Actor>(
        &self,
        uid: Uid,
        actor: C,
    ) -> Result<ActorHandle<C>>
       where Self: Sized { ... }
    fn headers(&self) -> &Flattrs { ... }
}
Expand description

A typed actor context, providing both a Mailbox and an Instance.

Note: Send and Sync markers are here only temporarily in order to bridge the transition to the context types, away from the [crate::cap] module.

Required Associated Types§

Source

type A: Actor

The type of actor associated with this context.

Required Methods§

Source

fn instance(&self) -> &Instance<Self::A>

The instance associated with this context.

Provided Methods§

Source

fn spawn<C: Actor>(&self, actor: C) -> ActorHandle<C>
where Self: Sized,

Spawn a child actor under this actor context.

Source

fn spawn_with_label<C: Actor>(&self, label: &str, actor: C) -> ActorHandle<C>
where Self: Sized,

Spawn a child actor with a fresh uid carrying a display label.

Source

fn spawn_with_uid<C: Actor>(&self, uid: Uid, actor: C) -> Result<ActorHandle<C>>
where Self: Sized,

Spawn a child actor using an explicit uid.

Source

fn headers(&self) -> &Flattrs

The inbound message headers associated with this context, if any.

Plain Instance send contexts are not handling an inbound message, so they use the default empty header set.

Implementors§

Source§

impl Actor for &Client

Source§

impl Actor for Client

Source§

impl<A: Actor> Actor for &Context<'_, A>

Source§

type A = A

Source§

impl<A: Actor> Actor for &Instance<A>

Source§

type A = A

Source§

impl<A: Actor> Actor for Context<'_, A>

Source§

type A = A

Source§

impl<A: Actor> Actor for Instance<A>

Source§

type A = A