#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

#113 in Date and time

Download history 15576/week @ 2023-12-15 5801/week @ 2023-12-22 8572/week @ 2023-12-29 15733/week @ 2024-01-05 14705/week @ 2024-01-12 17932/week @ 2024-01-19 17418/week @ 2024-01-26 16505/week @ 2024-02-02 15670/week @ 2024-02-09 15685/week @ 2024-02-16 18880/week @ 2024-02-23 23529/week @ 2024-03-01 20154/week @ 2024-03-08 19987/week @ 2024-03-15 20988/week @ 2024-03-22 15043/week @ 2024-03-29

79,960 downloads per month
Used in 205 crates (34 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