monotonic-timer

Crates.iomonotonic-timer
lib.rsmonotonic-timer
version1.0.0
sourcesrc
created_at2024-03-07 14:37:13.149215
updated_at2024-03-07 14:37:13.149215
descriptionA simple monotonic timer. Use it to schedule execution of closures after a delay.
homepage
repositoryhttps://github.com/ambaxter/monotonic_timer.rs.git
max_upload_size
id1165994
size47,959
datom-rs (github:lutriseng:datom-rs)

documentation

README

Monotonic Timer

Simple implementation of a Monotonic Timer in and for Rust.

Example

extern crate monotonic_timer;
use std::sync::mpsc::channel;

let timer = monotonic_timer::Timer::new();
let (tx, rx) = channel();

let _guard = timer.schedule_with_delay(Duration::from_sec(3), move || {
  tx.send(()).unwrap();
});

rx.recv().unwrap();
println!("This code has been executed after 3 seconds");

Attribution

This project is a slightly modified version of https://github.com/Yoric/timer.rs.

Commit count: 0

cargo fmt