Trait robots::actors::actor_cell::ActorContext [] [src]

pub trait ActorContext {
    fn actor_ref(&self) -> ActorRef;
fn actor_of(
        &self,
        props: Arc<ActorFactory>,
        name: String
    ) -> Result<ActorRef, &'static str>;
fn tell<MessageTo: Message>(&self, to: ActorRef, message: MessageTo);
fn ask<MessageTo: Message>(
        &self,
        to: ActorRef,
        message: MessageTo,
        future_name: String
    ) -> ActorRef;
fn complete<MessageTo: Message>(&self, to: ActorRef, complete: MessageTo);
fn forward_result<T: Message>(&self, future: ActorRef, to: ActorRef);
fn forward_result_to_future<T: Message>(
        &self,
        future: ActorRef,
        to: ActorRef
    );
fn do_computation<T: Message, F: Fn(Box<Any + Send>, ActorCell) -> T + Send + Sync + 'static>(
        &self,
        future: ActorRef,
        closure: F
    );
fn stop(&self, actor_ref: ActorRef);
fn kill_me(&self);
fn sender(&self) -> ActorRef;
fn father(&self) -> ActorRef;
fn children(&self) -> HashMap<Arc<ActorPath>, ActorRef>;
fn monitoring(&self) -> HashMap<Arc<ActorPath>, (ActorRef, FailureHandler)>;
fn monitored_by(&self) -> Vec<ActorRef>;
fn monitor(&self, actor: ActorRef, handler: FailureHandler);
fn path(&self) -> Arc<ActorPath>;
fn identify_actor(
        &self,
        logical_path: String,
        request_name: String
    ) -> ActorRef;
fn tell_control(&self, actor: ActorRef, message: ControlMessage);
fn fail(&self, reason: &'static str); }

This is the API that Actors are supposed to see of their context while handling a message.

Required Methods

Returns an ActorRef to the Actor.

Spawns a child actor.

Sends a Message to the targeted ActorRef.

Creates a Future, this Future will send the message to the targetted ActorRef (and thus be the sender of the message).

Completes a Future.

Tells a future to forward its result to another Actor. The Future is then dropped.

Tells a future to forward its result to another Future that will be completed with this result. The Future is then dropped.

Sends the Future a closure to apply on its value, the value will be updated with the output of the closure.

Requests the targeted actor to stop.

Asks the father of the actor to terminate it.

Returns an Arc to the sender of the message being handled.

Father of the actor.

Children of the actor.

Lifecycle monitoring, list of monitored actors.

Actors monitoring this actor.

Monitor an actor with the given handler.

Logical path to the actor, such as /user/foo/bar/baz

Future containing an Option with an ActtorRef to the Actor with the given logical path.

The future will have the path: $actor/$name_request

Sends a control message to the given actor.

Puts the actor in a state of failure with the given reason.

Implementors