sleep

Function sleep 

Source
pub fn sleep(duration: Duration) -> Sleep 
Expand description

Waits until duration has elapsed.

This function returns a future that will complete after the given duration, effectively yielding the current task for a period of time.

Equivalent to sleep_until(Instant::now() + duration).

§Examples

use std::time::Duration;

use vexide::prelude::*;

#[vexide::main]
async fn main(_peripherals: Peripherals) {
    println!("See you in 5 minutes.");
    sleep(Duration::from_secs(300)).await;
    println!("Hello again!");
}