pub trait EventExt:
Event
+ Sized
+ 'static {
// Provided methods
fn take_handler() -> Box<Handler<Self>> { ... }
fn replace_handler<F: FnMut(CriticalSection<'_>, &Self) + Sync + Send + 'static>(
f: F,
) -> Box<Handler<Self>> { ... }
fn update_handler<F: FnMut(CriticalSection<'_>, &Self) + Sync + Send + 'static>(
f: F,
) { ... }
}
Expand description
Extension trait for setting handlers for an event.
Register a new event handler like:
event::ApStaconnected::update_handler(|_cs, event| {
new_handler(event);
})
Provided Methods§
sourcefn take_handler() -> Box<Handler<Self>>
fn take_handler() -> Box<Handler<Self>>
Get the handler for this event, replacing it with the default handler.
sourcefn replace_handler<F: FnMut(CriticalSection<'_>, &Self) + Sync + Send + 'static>(
f: F,
) -> Box<Handler<Self>>
fn replace_handler<F: FnMut(CriticalSection<'_>, &Self) + Sync + Send + 'static>( f: F, ) -> Box<Handler<Self>>
Set the handler for this event, returning the old handler.
sourcefn update_handler<F: FnMut(CriticalSection<'_>, &Self) + Sync + Send + 'static>(
f: F,
)
fn update_handler<F: FnMut(CriticalSection<'_>, &Self) + Sync + Send + 'static>( f: F, )
Atomic combination of [take_handler
] and [replace_handler
]. Use this
to add a new handler which runs after the previously registered
handlers.
Object Safety§
This trait is not object safe.