Crates.io | timer-kit |
lib.rs | timer-kit |
version | 0.1.1 |
source | src |
created_at | 2023-02-01 23:27:03.917712 |
updated_at | 2023-02-02 00:39:00.666369 |
description | A timer toolkit that is generic over the underlying timer implementation. |
homepage | https://github.com/minghuaw/timer-kit |
repository | https://github.com/minghuaw/timer-kit |
max_upload_size | |
id | 774358 |
size | 160,512 |
A timer toolkit that is generic over the underlying timer implementation.
This crate does not implement any platform-specific timer but uses a generic abstraction over the timer implementation to provide a set of timer related tools:
sleep()
]/[Sleep
]timeout()
]/[Timeout
]interval()
]/[Interval
]DelayQueue
]This crate currently does not provide any feature beyond the ones that is already provided by
tokio
, so this crate is completely not needed if you are already using tokio
in your
project.
The core of this crate is the [Delay
] trait, and it is implemented for the following types by
enabling the corresponding features:
Type | Feature | Target Arch |
---|---|---|
[tokio::time::Sleep ] |
"tokio" |
non-wasm32 |
[smol::Timer ] |
"smol" |
non-wasm32 |
[futures_timer::Delay ] |
"futures-timer" |
non-wasm32 |
[wasm_timer::Delay ] |
"wasm-timer" |
wasm32 |
[fluvio_wasm_timer::Delay ] |
"fluvio-wasm-timer" |
wasm32 |
Support for wasm32-unknown-unknown
target depends on the chosen timer implementation.
wasm-timer
and fluvio-wasm-timer
are the only two wasm timer implementations that are
currently supported.
The usage remains mostly similar to those provided in tokio::time
with one additional generic
type parameter D
which is the type of the underlying timer implementation. Please refer to the
documentation of the corresponding types for more details.
License: MIT/Apache-2.0