timer

Crates.iotimer
lib.rstimer
version0.2.0
sourcesrc
created_at2016-03-01 22:19:44.10565
updated_at2017-09-11 16:51:38.537899
descriptionA simple timer. Use it to schedule execution of closures after a delay or at a given timestamp.
homepagehttps://github.com/Yoric/timer.rs
repository
max_upload_size
id4342
size47,036
David Teller (Yoric)

documentation

http://yoric.github.io/timer.rs/doc/timer/

README

Timer

Build Status

Simple implementation of a Timer in and for Rust.

Example

extern crate timer;
extern crate chrono;
use std::sync::mpsc::channel;

let timer = timer::Timer::new();
let (tx, rx) = channel();

timer.schedule_with_delay(chrono::Duration::seconds(3), move || {
  tx.send(()).unwrap();
});

rx.recv().unwrap();
println!("This code has been executed after 3 seconds");
Commit count: 0

cargo fmt