Skip to main content

RemoteAddress

Struct RemoteAddress 

Source
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

Source

pub const REMOTE_FLAG: u64

High bit of the 64-bit id space, reserved to tag a SenderId::index value as remote address.

Source

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.

Source

pub fn closed(&self) -> impl Future<Output = ()> + Send

Completes when the session has been closed.

Source

pub fn is_closed(&self) -> bool

Checks if the session has been closed.

Source

pub fn capacity(&self) -> usize

Returns the capacity of the session.

Trait Implementations§

Source§

impl Clone for RemoteAddress

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RemoteAddress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Decode for RemoteAddress

Source§

fn decode(buf: Bytes, ctx: Option<&DecodeContext>) -> Result<Self, DecodeError>

Decodes the remote message from the provided buffer.
Source§

const ID: u64 = 0

Message identifier. A remote message should have an unique identifier so the Handler<RemoteMessage> can dispatch the message to the proper handler. Read more
Source§

impl<M> From<RemoteAddress> for Recipient<M>
where M: Message + Encode, M::Result: Decode,

Source§

fn from(address: RemoteAddress) -> Self

Converts to this type from the input type.
Source§

impl Hash for RemoteAddress

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RemoteAddress

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<M> Sender<M> for RemoteAddress
where M: Message + Encode, M::Result: Decode,

Source§

fn closed(&self) -> ClosedResultFuture<'_>

Completes when the receiver has been closed.
Source§

fn is_closed(&self) -> bool

Checks if the channel has been closed.
Source§

fn capacity(&self) -> usize

Returns the current capacity of the channel.
Source§

fn send(&self, msg: M) -> SendResultFuture<'_, M>

Sends a message, waiting until there is capacity, and returns a Receiver which can be used to receive the message response.
Source§

fn do_send(&self, msg: M) -> DoSendResultFuture<'_, M>

Sends a message, waiting until there is capacity, without expecting a response.
Source§

fn try_send(&self, msg: M) -> SendResult<M>

Attempts to immediately send a message and returns a Receiver which can be used to receive the message response.
Source§

fn try_do_send(&self, msg: M) -> DoSendResult<M>

Attempts to immediately send a message without expecting a response.
Source§

fn send_timeout(&self, msg: M, timeout: Duration) -> SendResultFuture<'_, M>

Sends a message, waiting until there is capacity, but only for a limited time, and returns a Receiver which can be used to receive the message response.
Source§

fn do_send_timeout( &self, msg: M, timeout: Duration, ) -> DoSendResultFuture<'_, M>

Sends a message, waiting until there is capacity, but only for a limited time, without expecting a response.
Source§

fn blocking_send(&self, msg: M) -> SendResult<M>

Blocking send to call outside of asynchronous contexts. Read more
Source§

fn blocking_do_send(&self, msg: M) -> DoSendResult<M>

Blocking do_send to call outside of asynchronous contexts. Read more
Source§

fn type_erased_recipient(&self) -> Option<TypeErasedRecipient>

Available on crate feature type-erased-recipient-hook only.
Returns a type-erased trait object which can be downcast into a concrete Recipient<M>, where M is a specific message type chosen by the user who overrides the Actor::type_erased_recipient_fn method. Read more
Source§

impl SenderId for RemoteAddress

Source§

fn index(&self) -> u64

Returns the index of the sender.
Source§

fn is_remote(&self) -> bool

Available on crate feature ipc only.
Returns true if this sender refers to an actor in another process. Read more
Source§

impl Eq for RemoteAddress

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> TryClone for T
where T: Clone,

Source§

fn try_clone(&self) -> Result<T, Error>

Clones self, possibly returning an error.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more