task_scheduler

Crates.iotask_scheduler
lib.rstask_scheduler
version0.2.0
sourcesrc
created_at2017-10-24 16:32:12.024526
updated_at2019-03-12 22:47:22.631693
descriptionA library to easilty schedule an FnOnce to run in the future
homepage
repositoryhttps://github.com/fuchsnj/task_scheduler
max_upload_size
id36790
size4,862
Nathan (fuchsnj)

documentation

README

Build Status

Task Scheduler

A library to easily schedule an FnOnce to run sometime in the future. It is guaranteed that the task will not run before the given time, but due to delays may run slightly after.

The timer uses a single thread to schedule and run all tasks. A long-running task will delay other tasks from running.

Example

extern crate task_scheduler;

use task_scheduler::Scheduler;

let scheduler = Scheduler::new();

//pick some time in the future
let time = Instant::now() + Duration::from_secs(5);
scheduler.after_instant(time, ||{
    println!("do something here")
});

scheduler.after_duration(Duration::from_millis(100), ||{
    println!("do something else")
});

Commit count: 11

cargo fmt