Crates.io | ianaio-timers |
lib.rs | ianaio-timers |
version | 0.1.1 |
source | src |
created_at | 2024-02-18 14:24:16.065379 |
updated_at | 2024-06-08 07:30:53.77145 |
description | IanaIO crate for working with JavaScript timers |
homepage | https://rustwasm.iana.io/timers/ |
repository | https://github.com/ianaio/timers |
max_upload_size | |
id | 1144108 |
size | 42,333 |
ianaio-timers
Built with 🦀🕸 by The IanaIO Rust and WebAssembly Working Group
Working with timers on the Web: setTimeout
and setInterval
.
These APIs come in two flavors:
Future
s and Stream
s API.Timeouts fire once after a period of time (measured in milliseconds).
use ianaio_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();
Future
sWith the futures
feature enabled, a future
module containing futures-based
timers is exposed.