task_scheduler 0.2.0

A library to easilty schedule an FnOnce to run in the future
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 4.50 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 253.71 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • fuchsnj/task_scheduler
    2 2 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • fuchsnj

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