#mocking #testing #deterministic #instant #clock #struct #fake-clock

fake_instant

Fake clock for deterministic testing of code depending on time

2 unstable releases

0.5.0 Apr 29, 2023
0.4.0 Nov 5, 2019

#27 in #instant

Download history 57/week @ 2024-11-30 97/week @ 2024-12-07 104/week @ 2024-12-14 40/week @ 2024-12-21 54/week @ 2024-12-28 105/week @ 2025-01-04 103/week @ 2025-01-11 111/week @ 2025-01-18 66/week @ 2025-01-25 219/week @ 2025-02-01 84/week @ 2025-02-08 119/week @ 2025-02-15 198/week @ 2025-02-22 114/week @ 2025-03-01 220/week @ 2025-03-08 178/week @ 2025-03-15

735 downloads per month
Used in 4 crates (3 directly)

MIT OR BSD-3-Clause

12KB
212 lines

fake_instant

crates.io docs.rs gh-actions CI

This crate supplies a FakeInstant struct, which mimics the interface of std::time::Instant and enables full control over the flow of time as perceived by the code during testing.

License

This (former) SAFE Network library is dual-licensed under the Modified BSD (LICENSE-BSD https://opensource.org/licenses/BSD-3-Clause) or the MIT license (LICENSE-MIT http://opensource.org/licenses/MIT) at your option.

Contribution

Copyrights in the SAFE Network are retained by their contributors. No copyright assignment is required to contribute to this project.


lib.rs:

fake_clock

A crate providing a virtual clock mimicking std::time::Instant's interface, enabling full control over the flow of time during testing.

No runtime deps