metrify/src/units.rs

37 lines
508 B
Rust

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Metric {
Metre,
Gram,
Celcius,
SquareMetre,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NonMetric {
// Length
Inch,
Foot,
Yard,
Mile,
// Weight
Ounce,
Pound,
Stone,
// Temperature
Fahrenheit,
// Area
SquareInch,
}
#[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,
}