#timer #closures #async #delay #task #execution #schedule

timer-rs

A simple timer used to schedule execution of closures at a given timestamp

6 releases

0.0.6 Aug 21, 2023
0.0.5 Aug 18, 2023
0.0.1 Jul 27, 2023

#531 in Concurrency

27 downloads per month

MIT license

12KB
121 lines

Timer

Simple implementation of a Timer in async Rust.

Example

let task = || {
    eprintln!("task was executed");
    None
};

let timer = Timer::new(task).with_graceful_shutdown(signal::ctrl_c());

timer.await;

lib.rs:

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

Dependencies

~4–6.5MB
~107K SLoC