metrify/src/units.rs

61 lines
820 B
Rust
Raw Normal View History

2023-05-13 14:50:18 +00:00
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Metric {
Metre,
Gram,
2023-05-29 18:37:56 +00:00
Celsius,
2023-05-28 23:55:43 +00:00
SquareMetre,
2023-05-29 19:29:10 +00:00
CubicMetre,
2023-05-30 17:01:35 +00:00
Litre,
2023-05-13 14:50:18 +00:00
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NonMetric {
// Length
Inch,
2023-05-13 23:18:27 +00:00
Foot,
2023-05-13 14:50:18 +00:00
Yard,
2023-05-13 23:18:27 +00:00
Mile,
2023-06-01 00:00:10 +00:00
// Mass
2023-05-13 14:50:18 +00:00
Ounce,
Pound,
Stone,
2023-05-31 23:38:49 +00:00
ShortTon,
2023-05-31 23:48:34 +00:00
LongTon,
2023-05-28 17:32:31 +00:00
// Temperature
Fahrenheit,
2023-05-28 23:55:43 +00:00
// Area
SquareInch,
2023-05-29 00:01:56 +00:00
SquareFoot,
2023-06-01 16:24:11 +00:00
SquareYard,
2023-05-29 00:18:30 +00:00
Acre,
2023-05-29 00:27:55 +00:00
SquareMile,
2023-05-29 19:29:10 +00:00
// Volume
CubicInch,
2023-05-29 19:40:03 +00:00
CubicFoot,
2023-06-01 16:31:55 +00:00
CubicYard,
2023-05-30 17:01:35 +00:00
// Fluid volume
2023-05-30 17:34:38 +00:00
ImperialFluidOunce,
ImperialPint,
ImperialQuart,
ImperialGallon,
2023-05-31 19:38:50 +00:00
USTeaspoon,
2023-05-31 19:29:58 +00:00
USTablespoon,
2023-05-31 19:19:55 +00:00
USFluidOunce,
2023-05-31 19:10:49 +00:00
USCup,
2023-05-31 14:49:24 +00:00
USLiquidPint,
2023-05-31 14:42:18 +00:00
USLiquidQuart,
2023-05-31 14:35:19 +00:00
USGallon,
2023-05-13 14:50:18 +00:00
}
#[derive(Clone, Copy, Debug, PartialEq)]
2023-05-13 14:50:18 +00:00
pub struct MetricQuantity {
pub amount: f64,
pub unit: Metric,
}
2023-05-14 00:40:21 +00:00
#[derive(Clone, Debug, PartialEq)]
2023-05-13 14:50:18 +00:00
pub struct NonMetricQuantity {
pub amount: f64,
pub unit: NonMetric,
}