pub struct Bus<'a, ID = TypeId> { /* private fields */ }
Expand description

An event bus for arbitrary event types.

Implementations

Dispatch an event via this event bus.

All active listeners registered for this event will be invoked.

Add an event listener bound to a specific event type, E, and registered with the given ID.

Remove all event listeners registered with the given ID, dropping them in the process.

Add an event listener bound to a specific event type, E, and bound to a type T.

This event listener will be removed when Bus::remove_listeners_by_id is called with the TypeId of T.

Add an event listener bound to a specific event type, E, registered using a hidden type that will prevent its removal until the event bus is dropped.

Trait Implementations

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.