Migrated from uom to custom quantity implementation.
This commit is contained in:
22
src/quantity/resistance.rs
Normal file
22
src/quantity/resistance.rs
Normal 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 {
|
||||
"Ω"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user