pub struct EventBus { /* private fields */ }Available on crate feature
events only.Expand description
Event bus for broadcasting events to multiple subscribers
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn publish(&self, event: CommerceEvent) -> usize
pub fn publish(&self, event: CommerceEvent) -> usize
Publish an event to all subscribers
Sourcepub fn subscribe(&self) -> EventSubscription
pub fn subscribe(&self) -> EventSubscription
Subscribe to events from this bus
Sourcepub fn receiver_count(&self) -> usize
pub fn receiver_count(&self) -> usize
Get the number of active receivers
Sourcepub fn events_published(&self) -> u64
pub fn events_published(&self) -> u64
Get total number of events published
Sourcepub fn events_publish_failures(&self) -> u64
pub fn events_publish_failures(&self) -> u64
Get the number of events that failed to publish to the in-process bus
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for EventBus
impl RefUnwindSafe for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
impl UnwindSafe for EventBus
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