metrify/src/units.rs

40 lines
541 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-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-05-13 14:50:18 +00:00
// Weight
Ounce,
Pound,
Stone,
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-05-29 00:18:30 +00:00
Acre,
2023-05-29 00:27:55 +00:00
SquareMile,
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,
}