6 releases
0.2.2 | May 22, 2020 |
---|---|
0.2.1 | Nov 21, 2019 |
0.2.0 | Sep 22, 2019 |
0.1.2 | Aug 26, 2019 |
#38 in #mio
55 downloads per month
Used in greenie
16KB
251 lines
Hjul
Hjul is a thin wrapper around mio-extra
timers. Example usage:
use hjul::Runner;
use std::thread;
use std::time::Duration;
let runner = Runner::new(Duration::from_millis(100), 100, 1024);
let timer = runner.timer(|| println!("fired"));
timer.start(Duration::from_millis(200));
// wait for timer to fire
thread::sleep(Duration::from_millis(500));
// start the timer again
timer.start(Duration::from_millis(200));
// stop timer immediately
timer.stop();
// start the timer again
timer.start(Duration::from_millis(200));
// timer is stopped when it goes out of scope
Full documentation at docs.rs/hjul
Dependencies
~0.8–1.1MB
~18K SLoC