pub struct Addr(/* private fields */);
Expand description
Represents the global, usually unique address of an actor or a group.
§Uniqueness
An address is based on an IDR to make it a simple sendable number (as opposed to reference counting) and provide better performance of lookups than hashmaps. However, it means deletions and insertions to the same underlying slot multiple times can lead to reusing the address for a different actor.
Elfo tries to do its best to ensure the uniqueness of this value:
- Alive actors on the same node always have different addresses.
- Actors in different nodes have different address spaces.
- Actors in different groups have different address spaces.
- An address includes the version number to guard against the ABA problem.
- An address is randomized between restarts of the same node if the
network
feature is enabled.
§Using addresses in messages
The current implementation of network depends on the fact that
Addr
cannot be sent inside messages. It prevents from different
possible errors like responding without having a valid connection.
The only way to get an address of remote actor is envelope.sender()
.
If sending Addr
inside a message is unavoidable, use Local<Addr>
,
however it won’t be possible to send such message to a remote actor.
Implementations§
source§impl Addr
impl Addr
sourcepub const NULL: Addr = _
pub const NULL: Addr = _
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
sourcepub fn from_bits(bits: u64) -> Option<Self>
pub fn from_bits(bits: u64) -> Option<Self>
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
sourcepub fn into_bits(self) -> u64
pub fn into_bits(self) -> u64
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
pub fn is_null(self) -> bool
pub fn is_local(self) -> bool
pub fn is_remote(self) -> bool
sourcepub fn node_no(self) -> Option<NodeNo>
pub fn node_no(self) -> Option<NodeNo>
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
sourcepub fn group_no(self) -> Option<GroupNo>
pub fn group_no(self) -> Option<GroupNo>
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
sourcepub fn into_remote(self, node_no: NodeNo) -> Self
pub fn into_remote(self, node_no: NodeNo) -> Self
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
sourcepub fn into_local(self) -> Self
pub fn into_local(self) -> Self
§Availability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed or removed at any time.
Trait Implementations§
source§impl Ord for Addr
impl Ord for Addr
source§impl PartialEq for Addr
impl PartialEq for Addr
source§impl PartialOrd for Addr
impl PartialOrd for Addr
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more