1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// libsw: stopwatch library
// copyright (C) 2022-2023 Ula Shipman <ula.hello@mailbox.org>
// licensed under MIT OR Apache-2.0
use Debug;
use Duration;
/// A trait outlining the behavior of a timekeeping type.
///
/// This trait allows `libsw` to be agnostic about timekeeping: any type which
/// implements `Instant` can be used within a
/// [`Stopwatch`](crate::Stopwatch).
///
/// # Provided implementations
///
/// `libsw_core` provides `Instant` implementations for timekeeping types in the
/// standard library.
///
/// | Type | Feature flag | Notes |
/// |-------------------------|--------------|-------------|
/// | `std::time::Instant` | `std` | |
/// | `std::time::SystemTime` | `std` | |
/// | `tokio::time::Instant` | `tokio` | |
/// | `coarsetime::Instant` | `coarsetime` | |
/// | `quanta::Instant` | `quanta` | |
/// | `time::Instant` | `time` | Deprecated. |
///
/// If a timekeeping type you want to use isn't supported out of the box, please
/// consider [filing an issue](https://github.com/ulahello/libsw-core/issues)
/// on GitHub. If you already implemented `Instant` for it, consider sending a
/// PR upstream.