gloo-timers (0.3.0)
Published 2026-03-26 10:58:33 +00:00 by siennathesane
Installation
[registry]
default = "gitea"
[registries.gitea]
index = "sparse+ " # Sparse index
# index = " " # Git
[net]
git-fetch-with-cli = truecargo add gloo-timers@0.3.0About this package
Convenience crate for working with JavaScript timers
Working with timers on the Web: setTimeout and setInterval.
These APIs come in two flavors:
- a callback style (that more directly mimics the JavaScript APIs), and
- a
Futures andStreams API.
Timeouts
Timeouts fire once after a period of time (measured in milliseconds).
Timeouts with a Callback Function
use gloo_timers::callback::Timeout;
let timeout = Timeout::new(1_000, move || {
// Do something after the one second timeout is up!
});
// Since we don't plan on cancelling the timeout, call `forget`.
timeout.forget();
Timeouts as Futures
With the futures feature enabled, a future module containing futures-based
timers is exposed.
Dependencies
| ID | Version |
|---|---|
| futures-channel | ^0.3 |
| futures-core | ^0.3 |
| js-sys | ^0.3.31 |
| wasm-bindgen | ^0.2 |
| futures-util | ^0.3 |
| wasm-bindgen-futures | ^0.4.4 |
| wasm-bindgen-test | ^0.3.4 |
Details
2026-03-26 10:58:33 +00:00
Assets (1)
Versions (1)
View all
Cargo
0
Rust and WebAssembly Working Group
MIT OR Apache-2.0
8.6 KiB
gloo-timers-0.3.0.crate
8.6 KiB
0.3.0
2026-03-26