Function cs_utils::asyn::wait

source · []
pub async fn wait(ms: u64)
Expand description

Util to asynchronously wait for ms milliseconds.

Examples

use cs_utils::asyn::wait;
use tokio::time::{Instant, Duration};
 
#[tokio::main]
async fn main() {
    let start_time = Instant::now();
    println!("start");
    wait(1000).await;
    println!("end");
     
    assert!(
        (Instant::now() - start_time) >= Duration::from_millis(1000),
    );
}