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
//! Markers that say how an [`Instant`](crate::Instant)'s timeline is read.
/// The set of timelines an [`Instant`](crate::Instant) can be on.
///
/// Sealed: the kinds are [`Monotonic`] and [`Wrapping`].
/// Marker for an instant on a timeline that does not wrap.
///
/// Total order, so [`Ord`]. Arithmetic is plain `+` and `-`, panicking on overflow in debug and
/// wrapping in release. Nothing checks that the timeline really does not wrap, so use
/// [`Wrapping`] for raw hardware counters.
/// Marker for an instant on a circular counter, such as a hardware timer.
///
/// Arithmetic wraps, and comparison reads `self - other` as a signed offset, so it is only
/// meaningful within half the tick range and not transitive. [`PartialOrd`] formally requires
/// transitivity too; implementing it anyway is a conscious decision to keep `<` and `>` usable,
/// and the ordering holds whenever the compared instants lie within half the tick range of each
/// other. [`Ord`] is not implemented:
///
/// ```compile_fail
/// use fugit::WrappingInstant;
///
/// fn assert_ord<T: Ord>() {}
/// assert_ord::<WrappingInstant<u32, 1, 1_000>>();
/// ```