Function futures_micro::sleep[][src]

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.

Examples

use futures_micro::{sleep, waker};

let waker = waker().await;
assert_eq!(async { waker.wake(); sleep().await; 1 }.await, 1)