Function maitake::time::sleep

source ·
pub fn sleep(duration: Duration) -> Sleep<'static> 
Expand description

Returns a Future that completes after the specified Duration.

This function uses the global default timer, and the returned Sleep future will live for the 'static lifetime. See the module-level documentation for details on using the global default timer.


For a version of this function that does not panic, see try_sleep() instead.


use maitake::time;

async fn example() {
    println!("one second has passed!");