Skip to main content

add_event_handler

Function add_event_handler 

Source
pub unsafe fn add_event_handler<H>(
    dispatcher: *mut EventDispatcher<H>,
    handler: *mut H,
    priority: i8,
) -> bool
Expand description

addEventHandler(handler, priority). false means the handler was already registered, or the dispatcher is null.

§Safety

dispatcher must come from an accessor for the same H, and handler must stay alive until it is removed — the server keeps the pointer.