#chrono #schedule #alarm #chronometer

timer

A simple timer. Use it to schedule execution of closures after a delay or at a given timestamp.

8 releases

Uses old Rust 2015

0.2.0 Sep 11, 2017
0.1.6 Mar 11, 2016

#145 in Date and time

Download history 20163/week @ 2024-03-14 21434/week @ 2024-03-21 18120/week @ 2024-03-28 21040/week @ 2024-04-04 21796/week @ 2024-04-11 24556/week @ 2024-04-18 21499/week @ 2024-04-25 20105/week @ 2024-05-02 22862/week @ 2024-05-09 23996/week @ 2024-05-16 19875/week @ 2024-05-23 21860/week @ 2024-05-30 21320/week @ 2024-06-06 20860/week @ 2024-06-13 19810/week @ 2024-06-20 14542/week @ 2024-06-27

80,802 downloads per month
Used in 212 crates (35 directly)

MPL-2.0 license

31KB
414 lines

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

lib.rs:

A simple timer, used to enqueue operations meant to be executed at a given time or after a given delay.

Dependencies

~1MB
~18K SLoC