pub struct SubscriberRegistry<Event: Clone + Send + Sync + 'static> { /* private fields */ }Expand description
A registry that holds multiple closure-based subscribers for the same event type.
Dispatch an event to all registered subscribers in registration order.
For EventHandler-based subscriptions prefer GenericEventSubscriber.
Implementations§
Source§impl<Event: Clone + Send + Sync + 'static> SubscriberRegistry<Event>
impl<Event: Clone + Send + Sync + 'static> SubscriberRegistry<Event>
pub fn new() -> Self
Sourcepub async fn dispatch_all(&self, event: Event) -> Vec<EventError>
pub async fn dispatch_all(&self, event: Event) -> Vec<EventError>
Dispatch to all registered subscribers, collecting errors.
pub fn subscriber_count(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl<Event> !RefUnwindSafe for SubscriberRegistry<Event>
impl<Event> !UnwindSafe for SubscriberRegistry<Event>
impl<Event> Freeze for SubscriberRegistry<Event>
impl<Event> Send for SubscriberRegistry<Event>
impl<Event> Sync for SubscriberRegistry<Event>
impl<Event> Unpin for SubscriberRegistry<Event>
impl<Event> UnsafeUnpin for SubscriberRegistry<Event>
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