pub struct ChannelBroker { /* private fields */ }Expand description
Thread-safe, cheaply cloneable pub/sub broker backed by tokio broadcast channels.
§Example
use looprs_core::adapters::channel_broker::ChannelBroker;
use looprs_core::ports::{Message, MessageBroker};
let broker = ChannelBroker::new();
let mut rx = broker.subscribe("my.topic");
broker.publish(Message::new("test", "my.topic", 1, serde_json::Value::Null));
// rx.try_recv() would return the messageImplementations§
Source§impl ChannelBroker
impl ChannelBroker
Trait Implementations§
Source§impl Clone for ChannelBroker
impl Clone for ChannelBroker
Source§fn clone(&self) -> ChannelBroker
fn clone(&self) -> ChannelBroker
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for ChannelBroker
impl Default for ChannelBroker
Auto Trait Implementations§
impl Freeze for ChannelBroker
impl RefUnwindSafe for ChannelBroker
impl Send for ChannelBroker
impl Sync for ChannelBroker
impl Unpin for ChannelBroker
impl UnsafeUnpin for ChannelBroker
impl UnwindSafe for ChannelBroker
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