pub async fn sleep_until(deadline: Instant)
Available on crate feature
time
only.Expand description
Waits until deadline
is reached.
To run something regularly on a schedule, see interval
.
§Examples
Wait 100ms and print “100 ms have elapsed”.
use std::time::{Duration, Instant};
use compio_runtime::time::sleep_until;
sleep_until(Instant::now() + Duration::from_millis(100)).await;
println!("100 ms have elapsed");