Migrated from uom to custom quantity implementation.

This commit is contained in:
Zachary Sunforge
2024-07-09 22:37:00 -07:00
parent 8a23429e5f
commit da5fca74ef
15 changed files with 612 additions and 132 deletions

View File

@ -0,0 +1,22 @@
use derive_more::{Add, AddAssign, Display, Sub, SubAssign};
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 {
"Ω"
}
}