metrify/src/units.rs

31 lines
413 B
Rust

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Metric {
Metre,
Gram,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum NonMetric {
// Length
Foot,
Inch,
Mile,
Yard,
// Weight
Ounce,
Pound,
Stone,
}
#[derive(Debug, PartialEq)]
pub struct MetricQuantity {
pub amount: f64,
pub unit: Metric,
}
#[derive(Debug, PartialEq)]
pub struct NonMetricQuantity {
pub amount: f64,
pub unit: NonMetric,
}