synchronous-timer

Crates.iosynchronous-timer
lib.rssynchronous-timer
version0.1.0
sourcesrc
created_at2022-06-06 17:24:44.957949
updated_at2022-06-06 17:24:44.957949
descriptionSimpler synchronous timer/scheduler for Rust applications
homepagehttps://github.com/EasyPost/synchronous-timer-rs/
repositoryhttps://github.com/EasyPost/synchronous-timer-rs/
max_upload_size
id600854
size30,005
James Brown (Roguelazer)

documentation

https://docs.rs/synchronous-timer/

README

This is a library, with an API inspired by timer.rs, for scheduling jobs that run synchronously on a background thread.

CI Documentation crates.io

Example:

use std::time::Duration;
use synchronous_timer::Timer;

fn main() {
    let mut timer = Timer::new();
    timer
        .schedule_in(Duration::from_secs(5), || {
            println!("I will run on the background thread in 5 seconds")
        })
        .detach();
    timer.schedule_immediately(|| println!("I will run on the background thread right now"));
    let handle = timer.schedule_in(Duration::from_secs(1), || println!("I will never run"));
    drop(handle);
    std::thread::sleep(Duration::from_secs(6));
}

This work is licensed under the ISC license, a copy of which can be found in LICENSE.txt.

Commit count: 7

cargo fmt