pub struct BasicActorRef {
pub cell: ActorCell,
}Expand description
A lightweight, un-typed reference to interact with its underlying actor instance through concurrent messaging.
BasicActorRef can be derived from an original ActorRef<Msg>.
BasicActorRef allows for un-typed messaging using try_tell,
that will return a Result. If the message type was not supported,
the result will contain an Error.
BasicActorRef can be used when the original ActorRef isn’t available,
when you need to use collections to store references from different actor
types, or when using actor selections to message parts of the actor hierarchy.
In general, it is better to use ActorRef where possible.
Fields§
§cell: ActorCellImplementations§
Source§impl BasicActorRef
impl BasicActorRef
pub fn typed<Msg: Message>(&self, cell: ExtendedCell<Msg>) -> ActorRef<Msg>
Sourcepub fn try_tell<Msg>(
&self,
msg: Msg,
sender: impl Into<Option<Self>>,
) -> Result<(), ()>
pub fn try_tell<Msg>( &self, msg: Msg, sender: impl Into<Option<Self>>, ) -> Result<(), ()>
Send a message to this actor
Returns a result. If the message type is not supported Error is returned.
pub fn try_tell_any( &self, msg: &mut AnyMessage, sender: impl Into<Option<Self>>, ) -> Result<(), ()>
Trait Implementations§
Source§impl ActorReference for &BasicActorRef
impl ActorReference for &BasicActorRef
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
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
Source§fn is_child(&self, actor: &BasicActorRef) -> bool
fn is_child(&self, actor: &BasicActorRef) -> bool
Source§impl ActorReference for BasicActorRef
impl ActorReference for BasicActorRef
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
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
Source§fn is_child(&self, actor: &BasicActorRef) -> bool
fn is_child(&self, actor: &BasicActorRef) -> bool
Source§impl Clone for BasicActorRef
impl Clone for BasicActorRef
Source§fn clone(&self) -> BasicActorRef
fn clone(&self) -> BasicActorRef
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more