Function gloo::timers::future::sleep

source ·
pub fn sleep(dur: Duration) -> TimeoutFuture 
Available on crate features timers and futures only.
Expand description

Waits until the specified duration has elapsed.

Panics

This function will panic if the specified Duration cannot be casted into a u32 in milliseconds.

Example

use std::time::Duration;
use gloo_timers::future::sleep;

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