Skip to main content

unitforge/quantities/
stress_squared.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))]
7pub enum StressSquaredUnit {
8    Nsq_mmhc,
9}
10
11impl PhysicsUnit for StressSquaredUnit {
12    fn name(&self) -> &str {
13        match &self {
14            StressSquaredUnit::Nsq_mmhc => "N²/m⁴",
15        }
16    }
17
18    fn base_per_x(&self) -> (f64, i32) {
19        match self {
20            StressSquaredUnit::Nsq_mmhc => (1., 0),
21        }
22    }
23}
24
25impl_quantity!(
26    StressSquared,
27    StressSquaredUnit,
28    [StressSquaredUnit::Nsq_mmhc]
29);
30impl_div_with_self_to_f64!(StressSquared);