#[non_exhaustive]#[repr(u8)]pub enum Bandwidth {
Mhz1_7 = 0,
Mhz5 = 1,
Mhz6 = 2,
Mhz7 = 3,
Mhz8 = 4,
Mhz10 = 5,
}Expand description
Bandwidth per §5.2.7 Table 3.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Mhz1_7 = 0
1.7 MHz bandwidth.
Mhz5 = 1
5 MHz bandwidth.
Mhz6 = 2
6 MHz bandwidth.
Mhz7 = 3
7 MHz bandwidth.
Mhz8 = 4
8 MHz bandwidth.
Mhz10 = 5
10 MHz bandwidth.
Implementations§
Source§impl Bandwidth
impl Bandwidth
Sourcepub fn t_sub(self) -> (u32, u32)
pub fn t_sub(self) -> (u32, u32)
Return the elementary period Tsub as a rational (numerator, denominator)
in nanoseconds, exact and without floating-point.
ETSI TS 102 773 §5.2.7 Table 4 gives Tsub = 1/D µs (where D is the
bandwidth-dependent denominator), so in nanoseconds: Tsub = 1000/D ns.
The returned value (numer, denom) satisfies Tsub_ns = numer / denom.
The fraction is not reduced (numer is always 1000, denom is D), so
callers can multiply subseconds × 1000 and divide by denom to get
the total subsecond nanoseconds without any floating-point.
§Example
use dvb_t2mi::payload::timestamp::Bandwidth;
// 8 MHz: Tsub = 1/64 µs = 1000/64 ns.
let (n, d) = Bandwidth::Mhz8.t_sub();
assert_eq!((n, d), (1000, 64));
// subseconds = 32_000_000 → total nanos = 32_000_000 × 1000 / 64 = 500_000_000 ns = 0.5 s.
let nanos = 32_000_000u128 * u128::from(n) / u128::from(d);
assert_eq!(nanos, 500_000_000);Sourcepub fn subseconds_per_second(self) -> u64
pub fn subseconds_per_second(self) -> u64
Return the number of subsecond ticks per second for this bandwidth.
Equals D × 1_000_000, where D is the denominator from ETSI TS 102 773 §5.2.7 Table 4 (Tsub = 1/D µs).