#chrono #alarm #schedule #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

#185 in Date and time

Download history 22956/week @ 2025-10-07 23638/week @ 2025-10-14 23235/week @ 2025-10-21 25094/week @ 2025-10-28 23278/week @ 2025-11-04 21356/week @ 2025-11-11 26192/week @ 2025-11-18 20550/week @ 2025-11-25 27549/week @ 2025-12-02 23608/week @ 2025-12-09 22460/week @ 2025-12-16 12107/week @ 2025-12-23 10826/week @ 2025-12-30 22598/week @ 2026-01-06 27897/week @ 2026-01-13 32842/week @ 2026-01-20

96,400 downloads per month
Used in 263 crates (45 directly)

MPL-2.0 license

31KB
414 lines

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


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

Dependencies

~1MB
~18K SLoC