Skip to main content

fugit/
aliases.rs

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