waker_fnFunction waker_fn
Source pub fn waker_fn<F: Fn() + Send + Sync + 'static>(f: F) -> Waker
Expand description
Converts a closure into a Waker
.
The closure gets called every time the waker is woken.
ยงExamples
use waker_fn::waker_fn;
let waker = waker_fn(|| println!("woken"));
waker.wake_by_ref(); waker.wake();