Crate tokio_switching_sleep[][src]

Expand description

This crate contains two objects: SwitchingSleep and ASwitchingSleep.

ASwitchingSleep is just a wrapper around Arc<RwLock<SwitchingSleep>>.

They are a tokio::time::Sleep with a switchable state. When you call the start method a Sleep is created, when you call the stop one the current Sleep is dropped. So calling start will reset the timer.

The timer will complete after the duration time since start method is called (or new_start, new + start).



The Sync one.


The !Sync one.