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
networkfeature 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
Available on crate feature unstable only.
pub const NULL: Addr
unstable only.§Stability
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>
Available on crate feature unstable only.
pub fn from_bits(bits: u64) -> Option<Self>
unstable only.§Stability
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
Available on crate feature unstable only.
pub fn into_bits(self) -> u64
unstable only.§Stability
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
network only.Sourcepub fn node_no(self) -> Option<NodeNo>
Available on crate feature unstable only.
pub fn node_no(self) -> Option<NodeNo>
unstable only.§Stability
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>
Available on crate feature unstable only.
pub fn group_no(self) -> Option<GroupNo>
unstable only.§Stability
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
Available on crate feature unstable only.
pub fn into_remote(self, node_no: NodeNo) -> Self
unstable only.§Stability
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
Available on crate feature unstable only.
pub fn into_local(self) -> Self
unstable only.§Stability
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.