Skip to main content

unitforge/quantities/
inverse_angle.rs

1use crate::impl_macros::macros::*;
2
3#[cfg_attr(feature = "strum", derive(EnumIter))]
4#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
5#[derive(Copy, Clone, PartialEq, Debug, Hash, Eq)]
6#[cfg_attr(feature = "pyo3", pyclass(eq, eq_int, from_py_object))]
7pub enum InverseAngleUnit {
8    _rad,
9}
10
11impl InverseAngleUnit {
12    pub const fn base_per_x_const(self) -> (f64, i32) {
13        match self {
14            InverseAngleUnit::_rad => (1., 0),
15        }
16    }
17}
18
19impl PhysicsUnit for InverseAngleUnit {
20    fn name(&self) -> &str {
21        match &self {
22            InverseAngleUnit::_rad => "1/rad",
23        }
24    }
25
26    fn base_per_x(&self) -> (f64, i32) {
27        (*self).base_per_x_const()
28    }
29}
30
31impl_quantity!(InverseAngle, InverseAngleUnit, [InverseAngleUnit::_rad]);
32impl_div_with_self_to_f64!(InverseAngle);