pub struct InMemoryBus { /* private fields */ }Expand description
In-memory bus backed by tokio::sync::broadcast.
Implementations§
Source§impl InMemoryBus
impl InMemoryBus
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new bus with the given channel capacity. Lagged receivers will skip missed events (lossy).
Sourcepub fn default_capacity() -> Self
pub fn default_capacity() -> Self
Default capacity suitable for most single-process deployments.
Trait Implementations§
Source§impl EventBus for InMemoryBus
impl EventBus for InMemoryBus
Source§fn publish<'life0, 'async_trait>(
&'life0 self,
event: Event,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
event: Event,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish an event to all subscribers.
Source§fn subscribe(&self) -> Box<dyn EventSubscriber>
fn subscribe(&self) -> Box<dyn EventSubscriber>
Create a new subscriber that receives all future events.
Source§fn subscriber_count(&self) -> usize
fn subscriber_count(&self) -> usize
Number of active subscribers.
Auto Trait Implementations§
impl Freeze for InMemoryBus
impl RefUnwindSafe for InMemoryBus
impl Send for InMemoryBus
impl Sync for InMemoryBus
impl Unpin for InMemoryBus
impl UnsafeUnpin for InMemoryBus
impl UnwindSafe for InMemoryBus
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