Switched custom quantities to using a macro for generation.
This commit is contained in:
@ -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²"}
|
||||
|
Reference in New Issue
Block a user