async_timeout/
async_timeout.rs

1use std::time::Duration;
2
3use swnb_timer::Timer;
4
5fn main() {
6    let timer = Timer::new();
7
8    // this future print count every 1 sec
9    let async_block = async {
10        let mut count = 1;
11        loop {
12            timer.wait(Duration::from_secs(1)).await;
13            count += 1;
14            println!("{count}");
15        }
16    };
17}