Expand description
This module implements a relatively simple synchronous Timer/Scheduler backed by the standard library BinaryHeap type. It is suitable for a reasonably large number of tasks, but you should really use some kind of timer-wheel implementation if you want to have millions and millions of tasks.
§Panics
Panics in a scheduled task will be caught and logged; repeating task will not be rerun after they panics.
Structs§
- Task
Guard - A
TaskGuard
represents a handle to a future task. When it is dropped, we will attempt to cancel that task. If you would like the task to continue running in the background, use the.detach()
method - Timer
- The main structure of this library, a
Timer
handles scheduling one-off and repeating tasks, which are executed on a background thread. Tasks should be short-lived (as they block the thread) synchronous functions.