[−][src]Struct riker::actor::ActorSelection
A selection represents part of the actor heirarchy, allowing messages to be sent to all actors in the selection.
There are several use cases where you would interact with actors via a selection instead of actor references:
- You know the path of an actor but you don't have its
ActorRef
- You want to broadcast a message to all actors within a path
ActorRef
is almost always the better choice for actor interaction,
since messages are directly sent to the actor's mailbox without
any preprocessing or cloning.
ActorSelection
provides flexibility for the cases where at runtime
the ActorRef
s can't be known. This comes at the cost of traversing
part of the actor heirarchy and cloning messages.
A selection is anchored to an ActorRef
and the path is relative
to that actor's path.
selection.try_tell()
is used to message actors in the selection.
Since a selection is a collection of BasicActorRef
s messaging is
un-typed. Messages not supported by any actor in the selection will
be dropped.
Methods
impl ActorSelection
[src]
pub fn new(
anchor: BasicActorRef,
path: String
) -> Result<ActorSelection, InvalidPath>
[src]
anchor: BasicActorRef,
path: String
) -> Result<ActorSelection, InvalidPath>
pub fn try_tell<Msg>(&self, msg: Msg, sender: impl Into<Option<BasicActorRef>>) where
Msg: Message,
[src]
Msg: Message,
pub fn sys_tell(&self, msg: SystemMsg, sender: impl Into<Option<BasicActorRef>>)
[src]
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for ActorSelection
impl Send for ActorSelection
impl Sync for ActorSelection
impl Unpin for ActorSelection
impl !UnwindSafe for ActorSelection
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,