ActorCell

Struct ActorCell 

Source
pub struct ActorCell { /* private fields */ }
Expand description

Main interface for interractiong with an Actor for the internals.

Implementations§

Source§

impl ActorCell

Source

pub fn new( props: Arc<dyn ActorFactory>, system: ActorSystem, father: ActorRef, path: Arc<ActorPath>, ) -> ActorCell

Creates a new ActorCell.

Source

pub fn receive_message(&self, message: InnerMessage, sender: ActorRef)

Puts a message with its sender in the Actor’s mailbox and schedules the Actor.

Source

pub fn receive_system_message(&self, system_message: SystemMessage)

Puts a system message with its sender in the Actor’s system mailbox and schedules the Actor.

Source

pub fn handle_envelope(&self)

Makes the Actor handle an envelope in its mailbox.

Trait Implementations§

Source§

impl ActorContext for ActorCell

Source§

fn actor_ref(&self) -> ActorRef

Returns an ActorRef to the Actor.
Source§

fn actor_of( &self, props: Arc<dyn ActorFactory>, name: String, ) -> Result<ActorRef, &'static str>

Spawns a child actor.
Source§

fn tell<MessageTo: Message>(&self, to: ActorRef, message: MessageTo)

Sends a Message to the targeted ActorRef.
Source§

fn ask<MessageTo: Message>( &self, to: ActorRef, message: MessageTo, name: String, ) -> ActorRef

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

fn complete<MessageTo: Message>(&self, future: ActorRef, complete: MessageTo)

Completes a Future.
Source§

fn forward_result<T: Message>(&self, future: ActorRef, actor: ActorRef)

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

fn forward_result_to_future<T: Message>( &self, future: ActorRef, actor: ActorRef, )

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

fn do_computation<T: Message, F: Fn(Box<dyn Any + Send>, ActorCell) -> T + Send + Sync + 'static>( &self, future: ActorRef, closure: F, )

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

fn sender(&self) -> ActorRef

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

fn tell_control(&self, actor: ActorRef, message: ControlMessage)

Sends a control message to the given actor.
Source§

fn stop(&self, actor_ref: ActorRef)

Requests the targeted actor to stop.
Source§

fn kill_me(&self)

Asks the father of the actor to terminate it.
Source§

fn father(&self) -> ActorRef

Father of the actor.
Source§

fn children(&self) -> HashMap<Arc<ActorPath>, ActorRef>

Children of the actor.
Source§

fn monitoring(&self) -> HashMap<Arc<ActorPath>, (ActorRef, FailureHandler)>

Lifecycle monitoring, list of monitored actors.
Source§

fn monitored_by(&self) -> Vec<ActorRef>

Actors monitoring this actor.
Source§

fn monitor(&self, actor: ActorRef, handler: FailureHandler)

Monitor an actor with the given handler.
Source§

fn path(&self) -> Arc<ActorPath>

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

fn identify_actor(&self, name: String, request_name: String) -> ActorRef

Future containing an Option with an ActtorRef to the Actor with the given logical path. Read more
Source§

fn fail(&self, reason: &'static str)

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

impl Clone for ActorCell

Source§

fn clone(&self) -> ActorCell

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Arguments for T
where T: Clone + Send + Sync + 'static,

Source§

impl<T> Message for T
where T: Clone + Send + Sync + 'static + Any,