1 2 3 4 5 6 7 8 9 10 11 12 13
#[repr(transparent)] #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Hertz(u32); pub trait U32Ext { fn hz(self) -> Hertz; } impl U32Ext for u32 { fn hz(self) -> Hertz { Hertz(self) } }
1 2 3 4 5 6 7 8 9 10 11 12 13
#[repr(transparent)] #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub struct Hertz(u32); pub trait U32Ext { fn hz(self) -> Hertz; } impl U32Ext for u32 { fn hz(self) -> Hertz { Hertz(self) } }