#scheduler #task #schedule #time #future #fnonce #run

task_scheduler

A library to easilty schedule an FnOnce to run in the future

2 unstable releases

✓ Uses Rust 2018 edition

0.2.0 Mar 12, 2019
0.1.0 Oct 24, 2017
Download history 4/week @ 2018-11-27 5/week @ 2018-12-04 2/week @ 2018-12-11 15/week @ 2018-12-18 2/week @ 2018-12-25 3/week @ 2019-01-08 1/week @ 2019-01-15 2/week @ 2019-01-22 1/week @ 2019-01-29 1/week @ 2019-02-19 2/week @ 2019-02-26 1/week @ 2019-03-05

10 downloads per month

MIT/Apache

5KB
103 lines

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

No runtime deps