Trait esp_wifi::wifi::event::EventExt

source ·
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§

source

fn take_handler() -> Box<Handler<Self>>

Get the handler for this event, replacing it with the default handler.

source

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.

source

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.

Implementors§

source§

impl<T: Event + 'static> EventExt for T