esp_wifi::wifi::event

Trait 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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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