pub struct MailboxMuxer { /* private fields */ }
Expand description
An in-memory mailbox muxer. This is used to route messages to different underlying senders.
Implementations§
Source§impl MailboxMuxer
impl MailboxMuxer
Sourcepub fn bind(
&self,
actor_id: ActorId,
sender: impl MailboxSender + 'static,
) -> bool
pub fn bind( &self, actor_id: ActorId, sender: impl MailboxSender + 'static, ) -> bool
Route messages destined for the provided actor id to the provided
sender. Returns false if there is already a sender associated
with the actor. In this case, the sender is not replaced, and
the caller must MailboxMuxer::unbind
it first.
Sourcepub fn bind_mailbox(&self, mailbox: Mailbox) -> bool
pub fn bind_mailbox(&self, mailbox: Mailbox) -> bool
Convenience function to bind a mailbox.
Sourcepub fn bound_actors(&self) -> Vec<ActorId>
pub fn bound_actors(&self) -> Vec<ActorId>
Returns a list of all actors bound to this muxer. Useful in debugging.
Trait Implementations§
Source§impl Clone for MailboxMuxer
impl Clone for MailboxMuxer
Source§fn clone(&self) -> MailboxMuxer
fn clone(&self) -> MailboxMuxer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MailboxMuxer
impl Debug for MailboxMuxer
Source§impl MailboxSender for MailboxMuxer
impl MailboxSender for MailboxMuxer
Source§fn post(
&self,
envelope: MessageEnvelope,
return_handle: PortHandle<Undeliverable<MessageEnvelope>>,
)
fn post( &self, envelope: MessageEnvelope, return_handle: PortHandle<Undeliverable<MessageEnvelope>>, )
TODO: consider making this publicly inaccessible. While the trait itself
needs to be public, its only purpose for the end-user API is to provide
the typed messaging APIs from (Once)PortRef and ActorRef.
Auto Trait Implementations§
impl Freeze for MailboxMuxer
impl !RefUnwindSafe for MailboxMuxer
impl Send for MailboxMuxer
impl Sync for MailboxMuxer
impl Unpin for MailboxMuxer
impl !UnwindSafe for MailboxMuxer
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
Mutably borrows from an owned value. Read more
Source§impl<T> BoxableMailboxSender for Twhere
T: MailboxSender + Clone + 'static,
impl<T> BoxableMailboxSender for Twhere
T: MailboxSender + Clone + 'static,
Source§fn boxed(&self) -> BoxedMailboxSender
fn boxed(&self) -> BoxedMailboxSender
A boxed clone of this MailboxSender.
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<A, M> Handler<IndexedErasedUnbound<M>> for A
impl<A, M> Handler<IndexedErasedUnbound<M>> for A
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoBoxedMailboxSender for Twhere
T: MailboxSender + 'static,
impl<T> IntoBoxedMailboxSender for Twhere
T: MailboxSender + 'static,
Source§fn into_boxed(self) -> BoxedMailboxSender
fn into_boxed(self) -> BoxedMailboxSender
Rehome this MailboxSender into a BoxedMailboxSender.
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MailboxServer for T
impl<T> MailboxServer for T
Source§fn serve(
self,
rx: impl Rx<MessageEnvelope> + Send + 'static,
) -> MailboxServerHandle ⓘ
fn serve( self, rx: impl Rx<MessageEnvelope> + Send + 'static, ) -> MailboxServerHandle ⓘ
Serve the provided port on the given channel on this sender on
a background task which may be joined with the returned handle.
The task fails on any send error.
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PortSender for Twhere
T: MailboxSender + ?Sized,
impl<T> PortSender for Twhere
T: MailboxSender + ?Sized,
Source§fn serialize_and_send<M: RemoteMessage>(
&self,
port: &PortRef<M>,
message: M,
return_handle: PortHandle<Undeliverable<MessageEnvelope>>,
) -> Result<(), MailboxSenderError>
fn serialize_and_send<M: RemoteMessage>( &self, port: &PortRef<M>, message: M, return_handle: PortHandle<Undeliverable<MessageEnvelope>>, ) -> Result<(), MailboxSenderError>
Deliver a message to the provided port.
Source§fn serialize_and_send_once<M: RemoteMessage>(
&self,
once_port: OncePortRef<M>,
message: M,
return_handle: PortHandle<Undeliverable<MessageEnvelope>>,
) -> Result<(), MailboxSenderError>
fn serialize_and_send_once<M: RemoteMessage>( &self, once_port: OncePortRef<M>, message: M, return_handle: PortHandle<Undeliverable<MessageEnvelope>>, ) -> Result<(), MailboxSenderError>
Deliver a message to a one-shot port, consuming the provided port,
which is not reusable.