1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
pub use fugit::{HertzU32 as Hertz, KilohertzU32 as KiloHertz, MegahertzU32 as MegaHertz};

/// Bits per second
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug)]
pub struct Bps(pub u32);

/// Extension trait that adds convenience methods to the `u32` type
pub trait U32Ext {
    /// Wrap in `Bps`
    fn bps(self) -> Bps;
}

impl U32Ext for u32 {
    fn bps(self) -> Bps {
        Bps(self)
    }
}