pub struct EventBus { /* private fields */ }Expand description
Event Bus - Central publish/subscribe system
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn subscribe(
&self,
event_type: EventType,
handler_id: impl Into<String>,
handler: EventHandler,
)
pub fn subscribe( &self, event_type: EventType, handler_id: impl Into<String>, handler: EventHandler, )
Subscribes to an event type
Sourcepub fn unsubscribe(&self, event_type: &EventType, handler_id: &str)
pub fn unsubscribe(&self, event_type: &EventType, handler_id: &str)
Unsubscribes from an event type
Sourcepub fn subscriber_count(&self, event_type: &EventType) -> usize
pub fn subscriber_count(&self, event_type: &EventType) -> usize
Gets subscriber count for event type
Sourcepub fn get_history(&self, event_type: &EventType) -> Vec<Event>
pub fn get_history(&self, event_type: &EventType) -> Vec<Event>
Gets event history for type
Sourcepub fn total_events(&self) -> u64
pub fn total_events(&self) -> u64
Gets total event count
Sourcepub fn clear_history(&self)
pub fn clear_history(&self)
Clears event history
Sourcepub fn get_all_events(&self) -> Vec<Event>
pub fn get_all_events(&self) -> Vec<Event>
Gets all events
Sourcepub fn get_events_by_correlation(&self, correlation_id: &str) -> Vec<Event>
pub fn get_events_by_correlation(&self, correlation_id: &str) -> Vec<Event>
Gets all events for a specific correlation ID (scan)
Sourcepub fn get_events_by_correlation_and_time(
&self,
correlation_id: &str,
start_ms: u64,
end_ms: u64,
) -> Vec<Event>
pub fn get_events_by_correlation_and_time( &self, correlation_id: &str, start_ms: u64, end_ms: u64, ) -> Vec<Event>
Gets events for correlation ID within time range (ms)
Sourcepub fn get_events_sorted(&self) -> Vec<Event>
pub fn get_events_sorted(&self) -> Vec<Event>
Gets all events sorted by timestamp
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for EventBus
impl !UnwindSafe for EventBus
impl Freeze for EventBus
impl Send for EventBus
impl Sync for EventBus
impl Unpin for EventBus
impl UnsafeUnpin for EventBus
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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