#[repr(u8)]pub enum ActorPath {
Unique(UniquePath),
Named(NamedPath),
}Expand description
An actor path is a serialisable, possibly remote reference to an actor
Any message sent via an actor path might go over the network, and must be treated as fallible. It must also be serialisable.
Variants§
Unique(UniquePath)
A unique actor path identifies a concrete instance of an actor
Unique actor paths use the component’s unique id internally.
Unique actor paths become invalid when a component is replaced with a new instance of the same type.
A unique path may look something like "tcp://127.0.0.1:8080#1e555f40-de1d-4aee-8202-64fdc27edfa8", for example.
Named(NamedPath)
A named actor path identifies a service, rather than a concrete actor instance
Named paths must be registered to a particular actor, and their registration can be changed over time, as actors fail and are replaced, for example.
Named paths may be described hierarchically, similar to URLs.
A named path may look something like "tcp://127.0.0.1:8080/my-actor-group/my-actor", for example.
Implementations§
Source§impl ActorPath
impl ActorPath
Sourcepub fn set_protocol(&mut self, proto: Transport)
pub fn set_protocol(&mut self, proto: Transport)
Change the transport protocol for this actor path
Sourcepub fn named(self) -> Option<NamedPath>
pub fn named(self) -> Option<NamedPath>
If this path is a named path, return the underlying named path
Otherwise return None.
Sourcepub fn unwrap_named(self) -> NamedPath
pub fn unwrap_named(self) -> NamedPath
Return the underlying named path
Panics if this is not actually a named path variant.
Sourcepub fn unique(self) -> Option<UniquePath>
pub fn unique(self) -> Option<UniquePath>
If this path is a unique path, return the underlying unique path
Otherwise return None.
Sourcepub fn unwrap_unique(self) -> UniquePath
pub fn unwrap_unique(self) -> UniquePath
Return the underlying unique path
Panics if this is not actually a uniqe path variant.
Source§impl ActorPath
impl ActorPath
Sourcepub fn tell<S, B>(&self, m: B, from: &S)
pub fn tell<S, B>(&self, m: B, from: &S)
Send message m to the actor designated by this path.
The from field is used as a source,
and the ActorPath it resolved to will be supplied at the destination.
Sourcepub fn tell_with_sender<B, D>(&self, m: B, dispatch: &D, from: ActorPath)
pub fn tell_with_sender<B, D>(&self, m: B, dispatch: &D, from: ActorPath)
Send message m to the actor designated by this path with an explicit sender.
Sourcepub fn tell_serialised<CD, B>(&self, m: B, from: &CD) -> Result<(), SerError>
pub fn tell_serialised<CD, B>(&self, m: B, from: &CD) -> Result<(), SerError>
Send message m to the actor designated by this path with eager serialisation.
Sourcepub fn tell_serialised_with_sender<CD, B>(
&self,
m: B,
dispatch: &CD,
from: ActorPath,
) -> Result<(), SerError>
pub fn tell_serialised_with_sender<CD, B>( &self, m: B, dispatch: &CD, from: ActorPath, ) -> Result<(), SerError>
Send message m to the actor designated by this path with eager serialisation and an explicit sender.
Sourcepub fn tell_preserialised<CD>(
&self,
content: ChunkRef,
from: &CD,
) -> Result<(), SerError>
pub fn tell_preserialised<CD>( &self, content: ChunkRef, from: &CD, ) -> Result<(), SerError>
Send prepared message content to the actor designated by this path.
Sourcepub fn tell_preserialised_with_sender<CD>(
&self,
content: ChunkRef,
dispatch: &CD,
from: ActorPath,
) -> Result<(), SerError>where
CD: ComponentTraits + ComponentLifecycle,
pub fn tell_preserialised_with_sender<CD>(
&self,
content: ChunkRef,
dispatch: &CD,
from: ActorPath,
) -> Result<(), SerError>where
CD: ComponentTraits + ComponentLifecycle,
Send preserialised message content to the actor designated by this path with an explicit sender.
Sourcepub fn forward_with_original_sender<D>(
&self,
serialised_message: NetMessage,
dispatcher: &D,
)where
D: Dispatching,
pub fn forward_with_original_sender<D>(
&self,
serialised_message: NetMessage,
dispatcher: &D,
)where
D: Dispatching,
Forwards the still serialised message to this path without changing the sender.
Sourcepub fn forward_with_sender<D>(
&self,
serialised_message: NetMessage,
dispatch: &D,
from: ActorPath,
)where
D: Dispatching,
pub fn forward_with_sender<D>(
&self,
serialised_message: NetMessage,
dispatch: &D,
from: ActorPath,
)where
D: Dispatching,
Forwards the still serialised message to this path replacing the sender with the given one.
Sourcepub fn using_dispatcher<'a, 'b>(
&'a self,
disp: &'b dyn Dispatching,
) -> DispatchingPath<'a, 'b>
pub fn using_dispatcher<'a, 'b>( &'a self, disp: &'b dyn Dispatching, ) -> DispatchingPath<'a, 'b>
Trait Implementations§
Source§impl Deserialiser<ActorPath> for ActorPath
impl Deserialiser<ActorPath> for ActorPath
Source§impl From<ActorPath> for PathResolvable
impl From<ActorPath> for PathResolvable
Source§fn from(path: ActorPath) -> PathResolvable
fn from(path: ActorPath) -> PathResolvable
Source§impl From<UniquePath> for ActorPath
impl From<UniquePath> for ActorPath
Source§fn from(p: UniquePath) -> ActorPath
fn from(p: UniquePath) -> ActorPath
Source§impl Ord for ActorPath
impl Ord for ActorPath
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for ActorPath
impl PartialOrd for ActorPath
Source§impl Serialisable for ActorPath
impl Serialisable for ActorPath
Source§fn serialise(&self, buf: &mut dyn BufMut) -> Result<(), SerError>
fn serialise(&self, buf: &mut dyn BufMut) -> Result<(), SerError>
Serializes a Unique or Named actor path.
Source§fn size_hint(&self) -> Option<usize>
fn size_hint(&self) -> Option<usize>
Source§fn local(
self: Box<ActorPath>,
) -> Result<Box<dyn Any + Send>, Box<dyn Serialisable>>
fn local( self: Box<ActorPath>, ) -> Result<Box<dyn Any + Send>, Box<dyn Serialisable>>
Source§fn serialised(&self) -> Result<Serialised, SerError>
fn serialised(&self) -> Result<Serialised, SerError>
Source§impl SystemField for ActorPath
impl SystemField for ActorPath
Source§fn system(&self) -> &SystemPath
fn system(&self) -> &SystemPath
impl Eq for ActorPath
impl StructuralPartialEq for ActorPath
Auto Trait Implementations§
impl Freeze for ActorPath
impl RefUnwindSafe for ActorPath
impl Send for ActorPath
impl Sync for ActorPath
impl Unpin for ActorPath
impl UnsafeUnpin for ActorPath
impl UnwindSafe for ActorPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<T> DispatchEvent for T
impl<T> DispatchEvent for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.