Skip to main content

interval_func/
interval_func.rs

1extern crate rotor;
2extern crate rotor_tools;
3
4use std::time::{Duration};
5
6use rotor::{Loop, Config};
7use rotor_tools::timer::interval_func;
8
9
10fn main() {
11    let loop_creator = Loop::new(&Config::new()).unwrap();
12    let mut loop_inst = loop_creator.instantiate(());
13    loop_inst.add_machine_with(|scope| {
14        interval_func(scope, Duration::new(1, 0), |_| {
15            println!("Second passed");
16        })
17    }).unwrap();
18    loop_inst.run().unwrap();
19}