async_sleep

Function async_sleep 

Source
pub async fn async_sleep(dur: Duration)
Expand description

Sleeps for the specified amount of time.

This function might sleep for slightly longer than the specified duration but never less.

This function is an async version of std::thread::sleep.

See also: stream::interval.

ยงExamples

use std::time::Duration;

use async_std::task;

task::sleep(Duration::from_secs(1)).await;