metrify/src/units.rs

61 lines
820 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,
// Mass
Ounce,
Pound,
Stone,
ShortTon,
LongTon,
// Temperature
Fahrenheit,
// Area
SquareInch,
SquareFoot,
SquareYard,
Acre,
SquareMile,
// Volume
CubicInch,
CubicFoot,
CubicYard,
// Fluid volume
ImperialFluidOunce,
ImperialPint,
ImperialQuart,
ImperialGallon,
USTeaspoon,
USTablespoon,
USFluidOunce,
USCup,
USLiquidPint,
USLiquidQuart,
USGallon,
}
#[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,
}