Snooze is a crate that allows you to trigger the sending of a message with a specific delay or interval. This is usefull to handle TTL for example.
Basically, you just need to instanciate an instance of a Notifier
, to which you register events to trigger
at a certain time:
```rust let mut notifier = Nofifier::new(); // do not drop the handle notifier.notifyafer(Duration::fromsecs(1), "world"); let handle = notifier.notifyinterval(Duration::from_secs(2), "hello");
asserteq!(notifier.next().await, Some("hello")); asserteq!(notifier.next().await, Some("world")); assert_eq!(notifier.next().await, Some("hello")); ```