Struct bee_runtime::event::Bus [−][src]
An event bus for arbitrary event types.
Implementations
impl<'a, ID: Clone + PartialEq> Bus<'a, ID>
[src]
pub fn dispatch<E: Any>(&self, event: E)
[src]
Dispatch an event via this event bus.
All active listeners registered for this event will be invoked.
pub fn add_listener_raw<E: Any, F: Fn(&E) + Send + Sync + 'a>(
&self,
id: ID,
handler: F
)
[src]
&self,
id: ID,
handler: F
)
Add an event listener bound to a specific event type, E
, and registered with the given ID.
pub fn remove_listeners_by_id(&self, id: ID)
[src]
Remove all event listeners registered with the given ID, dropping them in the process.
impl<'a> Bus<'a, TypeId>
[src]
pub fn add_listener<T: Any, E: Any, F: Fn(&E) + Send + Sync + 'a>(
&self,
handler: F
)
[src]
&self,
handler: F
)
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
.
pub fn add_static_listener<E: Any, F: Fn(&E) + Send + Sync + 'a>(
&self,
handler: F
)
[src]
&self,
handler: F
)
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
Auto Trait Implementations
impl<'a, ID = TypeId> !RefUnwindSafe for Bus<'a, ID>
[src]
impl<'a, ID> Send for Bus<'a, ID> where
ID: Send,
[src]
ID: Send,
impl<'a, ID> Sync for Bus<'a, ID> where
ID: Send + Sync,
[src]
ID: Send + Sync,
impl<'a, ID> Unpin for Bus<'a, ID>
[src]
impl<'a, ID = TypeId> !UnwindSafe for Bus<'a, ID>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,