pub struct ActorRef<Msg: Message> {
pub cell: ExtendedCell<Msg>,
}Expand description
A lightweight, typed reference to interact with its underlying actor instance through concurrent messaging.
All ActorRefs are products of system.actor_of
or context.actor_of. When an actor is created using actor_of
an ActorRef<Msg> is returned, where Msg is the mailbox
message type for the actor.
Actor references are lightweight and can be cloned without concern for memory use.
Messages sent to an actor are added to the actor’s mailbox.
In the event that the underlying actor is terminated messages sent to the actor will be routed to dead letters.
If an actor is restarted all existing references continue to be valid.
Fields§
§cell: ExtendedCell<Msg>Implementations§
Trait Implementations§
Source§impl<Msg: Message> ActorReference for &ActorRef<Msg>
impl<Msg: Message> ActorReference for &ActorRef<Msg>
Source§fn parent(&self) -> BasicActorRef
fn parent(&self) -> BasicActorRef
Parent reference.
Source§fn children<'a>(&'a self) -> Box<dyn Iterator<Item = BasicActorRef> + 'a>
fn children<'a>(&'a self) -> Box<dyn Iterator<Item = BasicActorRef> + 'a>
Iterator over children references.
Source§fn user_root(&self) -> BasicActorRef
fn user_root(&self) -> BasicActorRef
User root reference Read more
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
True is this actor has any children actors
Source§fn is_child(&self, actor: &BasicActorRef) -> bool
fn is_child(&self, actor: &BasicActorRef) -> bool
True if the given actor is a child of this actor
Source§impl<Msg: Message> ActorReference for ActorRef<Msg>
impl<Msg: Message> ActorReference for ActorRef<Msg>
Source§fn parent(&self) -> BasicActorRef
fn parent(&self) -> BasicActorRef
Parent reference.
Source§fn children<'a>(&'a self) -> Box<dyn Iterator<Item = BasicActorRef> + 'a>
fn children<'a>(&'a self) -> Box<dyn Iterator<Item = BasicActorRef> + 'a>
Iterator over children references.
Source§fn user_root(&self) -> BasicActorRef
fn user_root(&self) -> BasicActorRef
User root reference Read more
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
True is this actor has any children actors
Source§fn is_child(&self, actor: &BasicActorRef) -> bool
fn is_child(&self, actor: &BasicActorRef) -> bool
True if the given actor is a child of this actor
Auto Trait Implementations§
impl<Msg> Freeze for ActorRef<Msg>
impl<Msg> !RefUnwindSafe for ActorRef<Msg>
impl<Msg> Send for ActorRef<Msg>
impl<Msg> Sync for ActorRef<Msg>
impl<Msg> Unpin for ActorRef<Msg>
impl<Msg> !UnwindSafe for ActorRef<Msg>
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