pub struct MessageBus<T, U>{ /* private fields */ }Expand description
Generic message bus for bidirectional messaging
Implementations§
Source§impl<T, U> MessageBus<T, U>
impl<T, U> MessageBus<T, U>
Sourcepub fn default_capacity() -> Self
pub fn default_capacity() -> Self
Create with default capacity (100)
Sourcepub async fn publish_inbound(&self, msg: T) -> Result<(), SendError<T>>
pub async fn publish_inbound(&self, msg: T) -> Result<(), SendError<T>>
Publish an inbound message
Sourcepub fn subscribe_inbound(&self) -> Receiver<T>
pub fn subscribe_inbound(&self) -> Receiver<T>
Subscribe to inbound messages
Sourcepub async fn publish_outbound(&self, msg: U) -> Result<(), SendError<U>>
pub async fn publish_outbound(&self, msg: U) -> Result<(), SendError<U>>
Publish an outbound message
Sourcepub fn subscribe_outbound(&self) -> Receiver<U>
pub fn subscribe_outbound(&self) -> Receiver<U>
Subscribe to outbound messages
Sourcepub async fn subscribe_outbound_key<F, Fut>(&self, key: String, callback: F)
pub async fn subscribe_outbound_key<F, Fut>(&self, key: String, callback: F)
Subscribe to outbound messages for a specific routing key with a callback
Sourcepub fn inbound_subscriber_count(&self) -> usize
pub fn inbound_subscriber_count(&self) -> usize
Get the number of inbound subscribers
Sourcepub fn outbound_subscriber_count(&self) -> usize
pub fn outbound_subscriber_count(&self) -> usize
Get the number of outbound subscribers
Trait Implementations§
Source§impl<T, U> Clone for MessageBus<T, U>
impl<T, U> Clone for MessageBus<T, U>
Source§fn clone(&self) -> MessageBus<T, U>
fn clone(&self) -> MessageBus<T, U>
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 moreAuto Trait Implementations§
impl<T, U> Freeze for MessageBus<T, U>
impl<T, U> !RefUnwindSafe for MessageBus<T, U>
impl<T, U> Send for MessageBus<T, U>
impl<T, U> Sync for MessageBus<T, U>
impl<T, U> Unpin for MessageBus<T, U>
impl<T, U> UnsafeUnpin for MessageBus<T, U>
impl<T, U> !UnwindSafe for MessageBus<T, U>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage