pub struct RemoteAddress { /* private fields */ }Expand description
A type which is used to send messages to a remote actor.
Sender trait is implemented for this type, so it can be converted into a Recipient
type easily. This will allow us to store a remote address in the same place as a locals
address, and send messages with it without caring about the underlying transport details.
NOTE: user should not send a received RemoteAddress to another remote actor,
it is considered as a meaningless operation.
Implementations§
Source§impl RemoteAddress
impl RemoteAddress
Sourcepub const REMOTE_FLAG: u64
pub const REMOTE_FLAG: u64
High bit of the 64-bit id space, reserved to tag a SenderId::index value as
remote address.
Sourcepub fn new(
remote_actor_id: u64,
session: Address<Session>,
registry: RemoteActorRegistry,
) -> Self
pub fn new( remote_actor_id: u64, session: Address<Session>, registry: RemoteActorRegistry, ) -> Self
Constructs a new RemoteAddress with the specified remote actor index and the address
of the IPC connection session actor. The registry is used to construct the encode
context for this address.
The index is computed by reversing the bits of session.index() into bits 0..62 (small
session ids occupy the high bits, growing downward) and XORing with remote_actor_id
(small ids occupy the low bits, growing upward). Bit 63 is reserved for
REMOTE_FLAG.
The collision of the index is structurally possible but extremely unlikely in practice
since it requires remote_actor_id * session.index() > 2^63.
Trait Implementations§
Source§impl Clone for RemoteAddress
impl Clone for RemoteAddress
Source§impl Debug for RemoteAddress
impl Debug for RemoteAddress
Source§impl Decode for RemoteAddress
impl Decode for RemoteAddress
Source§fn decode(buf: Bytes, ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>
fn decode(buf: Bytes, ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>
Source§impl<M> From<RemoteAddress> for Recipient<M>
impl<M> From<RemoteAddress> for Recipient<M>
Source§fn from(address: RemoteAddress) -> Self
fn from(address: RemoteAddress) -> Self
Source§impl Hash for RemoteAddress
impl Hash for RemoteAddress
Source§impl PartialEq for RemoteAddress
impl PartialEq for RemoteAddress
Source§impl<M> Sender<M> for RemoteAddress
impl<M> Sender<M> for RemoteAddress
Source§fn closed(&self) -> ClosedResultFuture<'_>
fn closed(&self) -> ClosedResultFuture<'_>
Source§fn send(&self, msg: M) -> SendResultFuture<'_, M>
fn send(&self, msg: M) -> SendResultFuture<'_, M>
Receiver which can be
used to receive the message response.Source§fn do_send(&self, msg: M) -> DoSendResultFuture<'_, M>
fn do_send(&self, msg: M) -> DoSendResultFuture<'_, M>
Source§fn try_send(&self, msg: M) -> SendResult<M>
fn try_send(&self, msg: M) -> SendResult<M>
Receiver which can be used to
receive the message response.Source§fn try_do_send(&self, msg: M) -> DoSendResult<M>
fn try_do_send(&self, msg: M) -> DoSendResult<M>
Source§fn send_timeout(&self, msg: M, timeout: Duration) -> SendResultFuture<'_, M>
fn send_timeout(&self, msg: M, timeout: Duration) -> SendResultFuture<'_, M>
Receiver which can be used to receive the message response.Source§fn do_send_timeout(
&self,
msg: M,
timeout: Duration,
) -> DoSendResultFuture<'_, M>
fn do_send_timeout( &self, msg: M, timeout: Duration, ) -> DoSendResultFuture<'_, M>
Source§fn blocking_send(&self, msg: M) -> SendResult<M>
fn blocking_send(&self, msg: M) -> SendResult<M>
Source§fn blocking_do_send(&self, msg: M) -> DoSendResult<M>
fn blocking_do_send(&self, msg: M) -> DoSendResult<M>
Source§fn type_erased_recipient(&self) -> Option<TypeErasedRecipient>
fn type_erased_recipient(&self) -> Option<TypeErasedRecipient>
type-erased-recipient-hook only.Recipient<M>, where M is a specific message type chosen
by the user who overrides the
Actor::type_erased_recipient_fn method. Read more