pub struct EventDispatcher { /* private fields */ }Expand description
Event dispatcher for routing events to handlers based on filters
Implementations§
Source§impl EventDispatcher
impl EventDispatcher
Sourcepub async fn register<F, Fut>(&self, filter: EventFilter, handler: F)
pub async fn register<F, Fut>(&self, filter: EventFilter, handler: F)
Register a handler with a filter
Sourcepub async fn dispatch(&self, event: Event) -> Result<()>
pub async fn dispatch(&self, event: Event) -> Result<()>
Dispatch an event to all matching handlers
§Errors
Returns an error if any handler fails to process the event.
Sourcepub async fn handler_count(&self) -> usize
pub async fn handler_count(&self) -> usize
Get the number of registered handlers
Trait Implementations§
Source§impl Clone for EventDispatcher
impl Clone for EventDispatcher
Source§fn clone(&self) -> EventDispatcher
fn clone(&self) -> EventDispatcher
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EventDispatcher
impl Debug for EventDispatcher
Auto Trait Implementations§
impl Freeze for EventDispatcher
impl !RefUnwindSafe for EventDispatcher
impl Send for EventDispatcher
impl Sync for EventDispatcher
impl Unpin for EventDispatcher
impl !UnwindSafe for EventDispatcher
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