Function eventbus::register

source ·
pub fn register<T: Event + ?Sized, F: for<'a> Fn(&'a mut T) + Send + Sync + 'static>(
    bus: &EventBus,
    priority: i32,
    handler: F,
    id: usize
)
Expand description

Low-level event handling function, registers an event.

This function is kinda slow. It doesn’t block currently executing hooks (and, in fact, may be safely called from a running hook), but does block threads from starting hook execution.

Panics

Panics if id doesn’t match the given T, or if id doesn’t exist.