pub fn sleep() -> impl Future<Output = ()>
Goes to sleep until woken by its Waker
being called.
This is a low level primitive for implementing more complex
patterns while avoiding the Poll
API.
use futures_micro::{sleep, waker};
let waker = waker().await;
assert_eq!(async { waker.wake(); sleep().await; 1 }.await, 1)