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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
// libsw: stopwatch library
// copyright (C) 2022-2023 Ula Shipman <ula.hello@mailbox.org>
// licensed under MIT OR Apache-2.0
//! `libsw` is a comprehensive stopwatch implementation.
//!
//! It offers [checked stopping](StopwatchImpl::checked_stop) and
//! [arithmetic](StopwatchImpl::checked_add), [precise
//! control](StopwatchImpl::start_at) over when operations occur, and supports
//! [arbitrary timekeeping types](Instant).
//!
//! If you want to do benchmarking, please use something like
//! [Criterion](https://docs.rs/criterion).
//!
//! # Introduction
//!
//! `libsw` provides the [`StopwatchImpl`] type as a stopwatch.
//!
//! This implementation is agnostic to the timekeeping type used, by virtue of
//! being generic. Any type `I` that implements the [`Instant`] trait (as in
//! `StopwatchImpl<I>`) can be used for timekeeping.
//!
//! `Instant` is implemented for several timekeeping types out of the box (see
//! [timekeeping support](#timekeeping-support)). If present, these
//! implementations are exposed as type aliases.
//!
//! # Features
//!
//! | Name | Features enabled | Description |
//! |------------------|---------------------------------|---------------------------------------------------------------------------------------------------------|
//! | `default` | `std_instant`, `std_systemtime` | Enabled by default. |
//! | `std` | | Depends on the standard library. Implements `std::error::Error` for [`Error`]. |
//! | `nightly` | | Implements `core::error::Error` for [`Error`] **if** `std` is not enabled. Requires a nightly compiler. |
//! | `std_instant` | `std` | Implements [`Instant`] for `std::time::Instant`. Exposes `Sw` type alias. |
//! | `std_systemtime` | `std` | Implements [`Instant`] for `std::time::SystemTime`. Exposes `SystemSw` type alias. |
//! | `tokio` | `std` | Implements [`Instant`] for `tokio::time::Instant`. Exposes `TokioSw` type alias. |
//! | `coarsetime` | `std` | Implements [`Instant`] for `coarsetime::Instant`. Exposes `CoarseSw` type alias. |
//! | `quanta` | `std` | Implements [`Instant`] for `quanta::Instant`. Exposes `QuantaSw` type alias. |
//! | `time` | `std` | Deprecated. Implements [`Instant`] for `time::Instant`. Exposes `TimeSw` type alias. |
//!
//! ## Timekeeping support
//!
//! `libsw` can be used with any timekeeping type that implements [`Instant`],
//! as long as the appropriate feature flag is enabled.
//!
//! See `Instant`'s [documentation](Instant#provided-implementations) for a list
//! of types supported out of the box.
//!
//! ## `no_std` support
//!
//! The `std` feature flag unsets `#[no_std]`. It is enabled by default, but you
//! can disable it by disabling the default features.
//!
//! In `Cargo.toml`,
//!
//! ```toml
//! [dependencies]
//! # replace '...' with the appropriate version
//! libsw = { version = ..., default-features = false }
//! ```
//!
//! # Compiler support
//!
//! Standalone, the minimum supported version of Rust is `1.61.0`.
//! Adding dependencies may bump this.
//!
//! # Safety
//!
//! `libsw` contains no unsafe code (`#![forbid(unsafe_code)]`).
extern crate core;
pub use crate;
pub use crateGuard;
pub use crateStopwatchImpl;
pub use Instant;
/// Alias to [`StopwatchImpl`] using the standard library's
/// [`Instant`](std::time::Instant) type.
///
/// This is the "default" stopwatch.
pub type Sw = ;
/// Deprecated alias to the "default" stopwatch.
pub type Stopwatch = Sw;
/// Alias to [`StopwatchImpl`] using the standard library's
/// [`SystemTime`](std::time::SystemTime) type.
pub type SystemSw = ;
/// Alias to [`StopwatchImpl`] using Tokio's [`Instant`](tokio::time::Instant)
/// type.
pub type TokioSw = ;
/// Alias to [`StopwatchImpl`] using the `coarsetime` crate's
/// [`Instant`](coarsetime::Instant) type.
pub type CoarseSw = ;
/// Alias to [`StopwatchImpl`] using the `quanta` crate's
/// [`Instant`](quanta::Instant) type.
pub type QuantaSw = ;
/// Alias to [`StopwatchImpl`] using the `time` crate's
/// [`Instant`](time::Instant) type.
pub type TimeSw = ;