pub struct ActorCell { /* private fields */ }Expand description
Main interface for interractiong with an Actor for the internals.
Implementations§
Source§impl ActorCell
impl ActorCell
Sourcepub fn new(
props: Arc<dyn ActorFactory>,
system: ActorSystem,
father: ActorRef,
path: Arc<ActorPath>,
) -> ActorCell
pub fn new( props: Arc<dyn ActorFactory>, system: ActorSystem, father: ActorRef, path: Arc<ActorPath>, ) -> ActorCell
Creates a new ActorCell.
Sourcepub fn receive_message(&self, message: InnerMessage, sender: ActorRef)
pub fn receive_message(&self, message: InnerMessage, sender: ActorRef)
Puts a message with its sender in the Actor’s mailbox and schedules the Actor.
Sourcepub fn receive_system_message(&self, system_message: SystemMessage)
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.
Sourcepub fn handle_envelope(&self)
pub fn handle_envelope(&self)
Makes the Actor handle an envelope in its mailbox.
Trait Implementations§
Source§impl ActorContext for ActorCell
impl ActorContext for ActorCell
Source§fn actor_of(
&self,
props: Arc<dyn ActorFactory>,
name: String,
) -> Result<ActorRef, &'static str>
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)
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
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)
fn complete<MessageTo: Message>(&self, future: ActorRef, complete: MessageTo)
Completes a Future.
Source§fn forward_result<T: Message>(&self, future: ActorRef, actor: ActorRef)
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,
)
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,
)
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 tell_control(&self, actor: ActorRef, message: ControlMessage)
fn tell_control(&self, actor: ActorRef, message: ControlMessage)
Sends a control message to the given actor.
Source§fn monitoring(&self) -> HashMap<Arc<ActorPath>, (ActorRef, FailureHandler)>
fn monitoring(&self) -> HashMap<Arc<ActorPath>, (ActorRef, FailureHandler)>
Lifecycle monitoring, list of monitored actors.
Source§fn monitored_by(&self) -> Vec<ActorRef>
fn monitored_by(&self) -> Vec<ActorRef>
Actors monitoring this actor.
Source§fn monitor(&self, actor: ActorRef, handler: FailureHandler)
fn monitor(&self, actor: ActorRef, handler: FailureHandler)
Monitor an actor with the given handler.
Auto Trait Implementations§
impl Freeze for ActorCell
impl !RefUnwindSafe for ActorCell
impl Send for ActorCell
impl Sync for ActorCell
impl Unpin for ActorCell
impl !UnwindSafe for ActorCell
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more