absolute_unit/unit/
rankine.rs1use crate::{TemperatureUnit, Unit};
2
3#[derive(Clone, Copy, Debug, Default, Eq, Ord, PartialEq, PartialOrd)]
4pub struct Rankine;
5impl Unit for Rankine {
6 const UNIT_NAME: &'static str = "rankine";
7 const UNIT_SHORT_NAME: &'static str = "°R";
8 const UNIT_SUFFIX: &'static str = "°R";
9}
10impl TemperatureUnit for Rankine {
11 fn convert_to_kelvin(degrees_in: f64) -> f64 {
12 degrees_in * 5. / 9.
13 }
14 fn convert_from_kelvin(degrees_k: f64) -> f64 {
15 degrees_k * 9. / 5.
16 }
17}
18
19#[macro_export]
20macro_rules! rankine {
21 ($num:expr) => {
22 $crate::Temperature::<$crate::Rankine>::from(&$num)
23 };
24}