mkolosick / timer.rs-temp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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");

About

License:Mozilla Public License 2.0


Languages

Language:Rust 100.0%