Registry / async / timer
library0.2.0rscratesunverified

A simple timer. Use it to schedule execution of closures after a delay or at a given timestamp.

# Cargo.toml [dependencies] timer = "0.2.0"
INSTALL
IMPORT
SIG · TIMER
T
timer
asyncrustv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Timer
use timer::Timer;

Scheduling a closure to run after a 5-second delay.

use timer::Timer; let timer = Timer::new(); let guard = timer.schedule_with_delay(std::time::Duration::from_secs(5), || { println!("5 seconds passed"); }); // guard keeps the timer alive
Debug
Known issues
gotchaTimer requires an active event loop (e.g., from tokio or async-std)
fix
Run the timer in a tokio runtime or use the `timer` crate's own event loop
affects: >=0.2.0
Upgrade
Version history
0.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
37 hits · last 30 days
node
32
Resources
timer — cargo add timer · libregistry