unitforge 0.3.17

A library for unit and quantity consistent computations in Rust
Documentation
use crate::impl_macros::macros::*;
use crate::quantities::*;

#[cfg_attr(feature = "strum", derive(EnumIter))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
#[cfg_attr(feature = "pyo3", pyclass(eq, eq_int))]
pub enum VelocitySquaredUnit {
    msq_ssq,
}

impl PhysicsUnit for VelocitySquaredUnit {
    fn name(&self) -> &str {
        match &self {
            VelocitySquaredUnit::msq_ssq => "m²/s²",
        }
    }

    fn base_per_x(&self) -> (f64, i32) {
        match self {
            VelocitySquaredUnit::msq_ssq => (1., 0),
        }
    }
}

impl_quantity!(
    VelocitySquared,
    VelocitySquaredUnit,
    [VelocitySquaredUnit::msq_ssq]
);
impl_div_with_self_to_f64!(VelocitySquared);

impl_mul_with_self!(Velocity, VelocitySquared);