use crate::impl_macros::macros::*;
#[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, from_py_object))]
pub enum PressureRateUnit {
Pa_s,
kPa_s,
MPa_s,
GPa_s,
bar_s,
psi_s,
}
impl PressureRateUnit {
pub const fn base_per_x_const(self) -> (f64, i32) {
match self {
PressureRateUnit::Pa_s => (1., 0),
PressureRateUnit::kPa_s => (1., 3),
PressureRateUnit::MPa_s => (1., 6),
PressureRateUnit::GPa_s => (1., 9),
PressureRateUnit::bar_s => (1., 5),
PressureRateUnit::psi_s => (6.895, 3),
}
}
}
impl PhysicsUnit for PressureRateUnit {
fn name(&self) -> &str {
match &self {
PressureRateUnit::Pa_s => "Pa/s",
PressureRateUnit::kPa_s => "kPa/s",
PressureRateUnit::MPa_s => "MPa/s",
PressureRateUnit::GPa_s => "GPa/s",
PressureRateUnit::bar_s => "bar/s",
PressureRateUnit::psi_s => "psi/s",
}
}
fn base_per_x(&self) -> (f64, i32) {
(*self).base_per_x_const()
}
}
impl_quantity!(PressureRate, PressureRateUnit, [PressureRateUnit::MPa_s]);
impl_div_with_self_to_f64!(PressureRate);