Switched custom quantities to using a macro for generation.

This commit is contained in:
Zachary Sunforge
2024-07-10 22:06:16 -07:00
parent da5fca74ef
commit a9f46c549e
9 changed files with 197 additions and 229 deletions

View File

@ -1,22 +1,6 @@
use derive_more::{Add, AddAssign, Display, Sub, SubAssign};
use crate::quantity::{Quantity, Value};
use derive_more::{Add, AddAssign, Display, Sub, SubAssign};
use generate_quantity::quantity_type;
// ---------------------------------------------------------------------------------------------------------------------
// ----- Watts per Square Meter ------------------------
// ---------------------------------------------------------------------------------------------------------------------
#[derive(Copy, Clone, PartialEq, PartialOrd, Add, AddAssign, Sub, SubAssign, Display)]
#[display(fmt = "{} {}", _0, "Self::symbol()")]
#[repr(transparent)]
pub struct WattsPerSquareMeter<V: Value>(pub V);
impl <V: Value> Quantity<V> for WattsPerSquareMeter<V> {
#[inline(always)]
fn value(self) -> V {
self.0
}
#[inline(always)]
fn symbol() -> &'static str {
"W/m²"
}
}
//----- Watter per Square Meter ----------------------------------
quantity_type! {WattsPerSquareMeter, "W/m²"}