Function wlan_hw_sim::event::matched

source ·
pub fn matched<S, E, T, F>(f: F) -> impl Handler<S, E, Output = T>
where F: FnMut(&mut S, &E) -> T,
Expand description

Constructs an event handler that always matches.

This function can be used to adapt functions into handlers. The output of the accepted function is always wrapped by Handled::Matched, meaning that the framework will always interpret the handler as having matched any event that it receives.

§Examples

let mut handler = event::on_transmit(event::matched(|_state, _event| {
    0 // This handler always return `Handled::Matched(0)`.
}));