Registry / async / wasm-timer

wasm-timer

JSON →
library0.2.5rscratesunverified

Abstraction over std::time::Instant and futures-timer that works on WASM.

# Cargo.toml [dependencies] wasm-timer = "0.2.5"
INSTALL
IMPORT
SIG · WASM-TIMER
W
wasm-timer
asyncrustv0.2.5
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.

Instant
use wasm_timer::Instant;

Measures elapsed time using WASM-compatible Instant.

use wasm_timer::Instant; use std::thread::sleep; use std::time::Duration; fn main() { let start = Instant::now(); sleep(Duration::from_secs(1)); let elapsed = start.elapsed(); println!("Elapsed: {:?}", elapsed); }
Debug
Known issues
gotchaOn WASM, requires wasm-bindgen and a browser environment
fix
Use wasm-pack and ensure running in browser or Node.js with appropriate polyfills
affects: >=0.2.0
Upgrade
Version history
0.2.5latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
42 hits · last 30 days
node
36
OpenAI (training)
1
Resources
wasm-timer — cargo add wasm-timer · libregistry