Function sleep
Source pub fn sleep() -> impl Future<Output = ()>
Expand description
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.
ยงExamples
use futures_micro::{sleep, waker};
let waker = waker().await;
assert_eq!(async { waker.wake(); sleep().await; 1 }.await, 1)