Crate async_timers
source · [−]Expand description
Async timers crate
This library provides timers that can be easily scheduled and canceled. For example, the tokio’s tokio::time::Interval
has no way of stopping the timer.
You could have set the interval duration to a very big value, however that is rather a work around. Also, tokio’s tokio::time::Sleep
is a one-time use object,
meaning it’s .await requires to move the object and requires you to recreated it when you need to sleep again.
This crate provides PeriodicTimer
and OneshotTimer
that aim to make the use of timers more pleasant.
This timers have methods to cancel and restart timers.
Enums
OneshotTimer expires once after a given duration
PeriodicTimer expires on given interval