pub trait MessageBroker: Send + Sync {
// Required methods
fn publish(&self, msg: Message) -> usize;
fn subscribe(&self, topic: &str) -> Receiver<Message>;
fn close(&self);
}Expand description
Port: fan-out message broker for inter-component pub/sub.
Implementations must be cheaply cloneable (Arc-backed) so callers
can hold a handle without worrying about lifetimes.
Required Methods§
fn publish(&self, msg: Message) -> usize
fn subscribe(&self, topic: &str) -> Receiver<Message>
fn close(&self)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".