Function sleep

Source
pub fn sleep<D>(duration: Duration) -> Sleep<D> 
where D: Delay,
Expand description

Creates a new Sleep that completes after the specified duration.

§Example

Creates a sleep with smol’s timer

use std::time::Duration;
use timer_kit::sleep;
 
sleep::<smol::Timer>(Duration::from_millis(100)).await;

Creates a sleep with fluvio_wasm_timer::Delay

use std::time::Duration;
use timer_kit::sleep;
 
sleep::<fluvio_wasm_timer::Delay>(Duration::from_millis(100)).await;