6 releases
Uses new Rust 2024
| 0.2.3 | Oct 7, 2025 |
|---|---|
| 0.2.2 | Jun 22, 2025 |
| 0.1.1 | Jun 4, 2025 |
#94 in Date and time
5,615 downloads per month
45KB
907 lines
Library for clock and clock abstractions.
This library provides traits representing an abstract clock.
NowOnce,NowMut,Now, these are specialized versions of theFn*traits. They represent the operation to retrieve the current time.SleepOnce,SleepMut,Sleep, these are specialized versions of theFn*traits. They represent the operation to create a timer resolved at a later time.
This crate also provides aliases and utility traits.
ErasedSleep:Sleepvariant returning an opaque boxed future.StdClock,Chrono04Clock: high-level traitsNowExt: helper methods
Horloge - clock abstraction for Rust
The horloge Rust crate defines trait for time sources (Now) and sleeping
(Sleep). These traits allow to abstract over the concrete implementation.
This enables writing generic code using the system clock when deployed or a
virtual clock during tests.
This crate provides trait definitions, and implementation providing support for the major time libraries in the Rust ecosystem.
The name "horloge" means clock in french.
Integration
The intent is to provide integration with most libraries in the ecosystem. Here are the currently support libraries. Contributions are welcome.
Time model
Sleep scheduler
Licence
MIT
Dependencies
~2.9–6.5MB
~106K SLoC