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