Skip to main content

unitforge/quantities/
force_area.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 ForceAreaUnit {
8    Nmsq,
9}
10
11impl ForceAreaUnit {
12    pub const fn base_per_x_const(self) -> (f64, i32) {
13        match self {
14            ForceAreaUnit::Nmsq => (1., 0),
15        }
16    }
17}
18
19impl PhysicsUnit for ForceAreaUnit {
20    fn name(&self) -> &str {
21        match &self {
22            ForceAreaUnit::Nmsq => "Nm²",
23        }
24    }
25
26    fn base_per_x(&self) -> (f64, i32) {
27        (*self).base_per_x_const()
28    }
29}
30
31impl_quantity!(ForceArea, ForceAreaUnit, [ForceAreaUnit::Nmsq]);
32impl_div_with_self_to_f64!(ForceArea);