smol/examples/compat-async-std.rs

13 lines
280 B
Rust
Raw Normal View History

2020-04-20 15:45:14 +00:00
use std::time::{Duration, Instant};
2020-04-18 13:29:24 +00:00
use async_std::task::sleep;
fn main() {
smol::run(async {
let start = Instant::now();
println!("Sleeping...");
sleep(Duration::from_secs(1)).await;
println!("Woke up after {:?}", start.elapsed());
})
}