pub struct UnitSimple<S>where
S: MeasureSystem,{
pub ratio: <S as MeasureSystem>::N,
pub offset: <S as MeasureSystem>::N,
}Expand description
A Simple Unit in a given MeasureSystem
The equations for Unit are as follows:
self.to_base = (val + self.offset) * self.ratio
self.to_self = (val / self.ratio) - self.offset
If greater flexibility is required, please see `UnitTrait
Fields§
§ratio: <S as MeasureSystem>::N§offset: <S as MeasureSystem>::NTrait Implementations§
Source§impl<S> Debug for UnitSimple<S>where
S: MeasureSystem,
impl<S> Debug for UnitSimple<S>where
S: MeasureSystem,
Source§impl<S> PartialEq for UnitSimple<S>
impl<S> PartialEq for UnitSimple<S>
Source§impl<S> UnitTrait for UnitSimple<S>where
S: MeasureSystem,
impl<S> UnitTrait for UnitSimple<S>where
S: MeasureSystem,
type System = S
Source§fn from(&self, val: <S as MeasureSystem>::N) -> Measure<S>
fn from(&self, val: <S as MeasureSystem>::N) -> Measure<S>
Generate a new Measure from this unit and value
Source§fn to_base(&self, val: <S as MeasureSystem>::N) -> <S as MeasureSystem>::N
fn to_base(&self, val: <S as MeasureSystem>::N) -> <S as MeasureSystem>::N
Convert the given value as this unit into the base unit Read more
Source§fn to_self(&self, val: <S as MeasureSystem>::N) -> <S as MeasureSystem>::N
fn to_self(&self, val: <S as MeasureSystem>::N) -> <S as MeasureSystem>::N
Convert the value as the base unit into this unit Read more
impl<S> StructuralPartialEq for UnitSimple<S>where
S: MeasureSystem,
Auto Trait Implementations§
impl<S> Freeze for UnitSimple<S>
impl<S> RefUnwindSafe for UnitSimple<S>
impl<S> Send for UnitSimple<S>
impl<S> Sync for UnitSimple<S>
impl<S> Unpin for UnitSimple<S>
impl<S> UnwindSafe for UnitSimple<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more