1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
pub type Fd = u32; pub type Pid = u32; pub type Count = u64; pub type Bytes = Count; pub type Rpm = Count; pub type Percent = f32; pub type FloatCount = f64; pub type Degrees = FloatCount; pub type Mhz = FloatCount; #[derive(Debug, Clone)] pub struct Temperature { celsius: Degrees, } impl Temperature { pub fn new(celsius: Degrees) -> Temperature { Temperature { celsius } } pub fn celsius(&self) -> Degrees { self.celsius } #[allow(clippy::unnecessary_cast)] pub fn fahrenheit(&self) -> Degrees { (self.celsius * (9 as Degrees / 5 as Degrees)) + 32 as Degrees } }