pub struct EventBus { /* private fields */ }Expand description
Registry of handlers, built once by Harness::build from every module’s
events(). Cheap to clone (one Arc).
Implementations§
Source§impl EventBus
impl EventBus
Sourcepub fn on(self, name: impl Into<EventName>, handler: EventHandler) -> Self
pub fn on(self, name: impl Into<EventName>, handler: EventHandler) -> Self
Builds a bus from collected (name, handler) pairs, appending the
new pairs after any existing ones (copy-on-write if the bus is
already shared). Modules register via Module::events() at
Harness::build.
Sourcepub fn handlers(&self) -> &[(EventName, EventHandler)]
pub fn handlers(&self) -> &[(EventName, EventHandler)]
The registered (name, handler) pairs, in registration order.
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§
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