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 ec497fb256
9 changed files with 165 additions and 177 deletions

View File

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