Skip to main content

simple/
simple.rs

1fn main() {
2    let _once_handle = scheduling::Scheduler::once(|| println!("ONCE")).start();
3
4    let recurring_handle = scheduling::Scheduler::delayed_recurring(
5        std::time::Duration::from_secs(1),
6        std::time::Duration::from_secs(1),
7        || println!("1 SEC ELAPSED"),
8    )
9    .start();
10
11    std::thread::sleep(std::time::Duration::from_secs(5));
12
13    recurring_handle.cancel();
14
15    std::thread::sleep(std::time::Duration::from_secs(5));
16}