fugit/aliases.rs
1//! Type aliases for common uses
2
3use crate::Duration;
4use crate::Instant;
5use crate::Rate;
6
7/// Alias for nanosecond duration
8pub type NanosDuration<T> = Duration<T, 1, 1_000_000_000>;
9
10/// Alias for nanosecond duration (`u32` backing storage)
11pub type NanosDurationU32 = Duration<u32, 1, 1_000_000_000>;
12
13/// Alias for nanosecond duration (`u64` backing storage)
14pub type NanosDurationU64 = Duration<u64, 1, 1_000_000_000>;
15
16/// Alias for microsecond duration
17pub type MicrosDuration<T> = Duration<T, 1, 1_000_000>;
18
19/// Alias for microsecond duration (`u32` backing storage)
20pub type MicrosDurationU32 = Duration<u32, 1, 1_000_000>;
21
22/// Alias for microsecond duration (`u64` backing storage)
23pub type MicrosDurationU64 = Duration<u64, 1, 1_000_000>;
24
25/// Alias for millisecond duration
26pub type MillisDuration<T> = Duration<T, 1, 1_000>;
27
28/// Alias for millisecond duration (`u32` backing storage)
29pub type MillisDurationU32 = Duration<u32, 1, 1_000>;
30
31/// Alias for millisecond duration (`u64` backing storage)
32pub type MillisDurationU64 = Duration<u64, 1, 1_000>;
33
34/// Alias for second duration
35pub type SecsDuration<T> = Duration<T, 1, 1>;
36
37/// Alias for second duration (`u32` backing storage)
38pub type SecsDurationU32 = Duration<u32, 1, 1>;
39
40/// Alias for second duration (`u64` backing storage)
41pub type SecsDurationU64 = Duration<u64, 1, 1>;
42
43/// Alias for minutes duration
44pub type MinutesDuration<T> = Duration<T, 60, 1>;
45
46/// Alias for minutes duration (`u32` backing storage)
47pub type MinutesDurationU32 = Duration<u32, 60, 1>;
48
49/// Alias for minutes duration (`u64` backing storage)
50pub type MinutesDurationU64 = Duration<u64, 60, 1>;
51
52/// Alias for hours duration
53pub type HoursDuration<T> = Duration<T, 3_600, 1>;
54
55/// Alias for hours duration (`u32` backing storage)
56pub type HoursDurationU32 = Duration<u32, 3_600, 1>;
57
58/// Alias for hours duration (`u64` backing storage)
59pub type HoursDurationU64 = Duration<u64, 3_600, 1>;
60
61/// Alias for durations that come from timers with a specific frequency
62pub type TimerDuration<T, const FREQ_HZ: u32> = Duration<T, 1, FREQ_HZ>;
63
64/// Alias for durations that come from timers with a specific frequency (`u32` backing storage)
65pub type TimerDurationU32<const FREQ_HZ: u32> = Duration<u32, 1, FREQ_HZ>;
66
67/// Alias for durations that come from timers with a specific frequency (`u64` backing storage)
68pub type TimerDurationU64<const FREQ_HZ: u32> = Duration<u64, 1, FREQ_HZ>;
69
70// -------------------------------
71
72/// Alias for instants that come from timers with a specific frequency
73pub type TimerInstant<T, const FREQ_HZ: u32> = Instant<T, 1, FREQ_HZ>;
74
75/// Alias for instants that come from timers with a specific frequency (`u32` backing storage)
76pub type TimerInstantU32<const FREQ_HZ: u32> = Instant<u32, 1, FREQ_HZ>;
77
78/// Alias for instants that come from timers with a specific frequency (`u64` backing storage)
79pub type TimerInstantU64<const FREQ_HZ: u32> = Instant<u64, 1, FREQ_HZ>;
80
81// -------------------------------
82
83/// Alias for hertz rate
84pub type Hertz<T> = Rate<T, 1, 1>;
85
86/// Alias for hertz rate (`u32` backing storage)
87pub type HertzU32 = Rate<u32, 1, 1>;
88
89/// Alias for hertz rate (`u64` backing storage)
90pub type HertzU64 = Rate<u64, 1, 1>;
91
92/// Alias for kilohertz rate
93pub type Kilohertz<T> = Rate<T, 1_000, 1>;
94
95/// Alias for kilohertz rate (`u32` backing storage)
96pub type KilohertzU32 = Rate<u32, 1_000, 1>;
97
98/// Alias for kilohertz rate (`u64` backing storage)
99pub type KilohertzU64 = Rate<u64, 1_000, 1>;
100
101/// Alias for megahertz rate
102pub type Megahertz<T> = Rate<T, 1_000_000, 1>;
103
104/// Alias for megahertz rate (`u32` backing storage)
105pub type MegahertzU32 = Rate<u32, 1_000_000, 1>;
106
107/// Alias for megahertz rate (`u64` backing storage)
108pub type MegahertzU64 = Rate<u64, 1_000_000, 1>;
109
110/// Alias for rate that come from timers with a specific frequency
111pub type TimerRate<T, const FREQ_HZ: u32> = Rate<T, FREQ_HZ, 1>;
112
113/// Alias for rate that come from timers with a specific frequency (`u32` backing storage)
114pub type TimerRateU32<const FREQ_HZ: u32> = Rate<u32, FREQ_HZ, 1>;
115
116/// Alias for rate that come from timers with a specific frequency (`u64` backing storage)
117pub type TimerRateU64<const FREQ_HZ: u32> = Rate<u64, FREQ_HZ, 1>;