Skip to main content

interval

Function interval 

Source
pub fn interval(period: Duration) -> Interval
Expand description

Create a new Interval that fires every period.

The first tick fires after one full period from the call site.

§Panics

Panics if period is zero.

§Example

use moduvex_runtime::time::interval;
use std::time::Duration;

moduvex_runtime::block_on(async {
    let mut ticker = interval(Duration::from_millis(50));
    for _ in 0..3 {
        ticker.tick().await;
        println!("tick");
    }
});