metrify/src/units.rs

49 lines
662 B
Rust

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Metric {
Metre,
Gram,
Celsius,
SquareMetre,
CubicMetre,
Litre,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NonMetric {
// Length
Inch,
Foot,
Yard,
Mile,
// Weight
Ounce,
Pound,
Stone,
// Temperature
Fahrenheit,
// Area
SquareInch,
SquareFoot,
Acre,
SquareMile,
// Volume
CubicInch,
CubicFoot,
// Fluid volume
ImperialGallon,
ImperialQuart,
ImperialPint,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MetricQuantity {
pub amount: f64,
pub unit: Metric,
}
#[derive(Clone, Debug, PartialEq)]
pub struct NonMetricQuantity {
pub amount: f64,
pub unit: NonMetric,
}