Struct const_units::Quantity
source · pub struct Quantity<V, const UNITS: SI>(pub V);Expand description
A value with dimensionality
Tuple Fields§
§0: VImplementations§
Trait Implementations§
source§impl<R, O, T: Add<R, Output = O>, const UNITS: SI> Add<Quantity<R, UNITS>> for Quantity<T, UNITS>
impl<R, O, T: Add<R, Output = O>, const UNITS: SI> Add<Quantity<R, UNITS>> for Quantity<T, UNITS>
Units must be the same for addition
source§impl<R, T: AddAssign<R>, const UNITS: SI> AddAssign<Quantity<R, UNITS>> for Quantity<T, UNITS>
impl<R, T: AddAssign<R>, const UNITS: SI> AddAssign<Quantity<R, UNITS>> for Quantity<T, UNITS>
Units must be the same for addition
source§fn add_assign(&mut self, rhs: Quantity<R, UNITS>)
fn add_assign(&mut self, rhs: Quantity<R, UNITS>)
Performs the
+= operation. Read moresource§impl<V> Deref for Quantity<V, DIMENSIONLESS>
impl<V> Deref for Quantity<V, DIMENSIONLESS>
Arbitrary math operations are only reasonable on dimensionless values
source§impl<V> DerefMut for Quantity<V, DIMENSIONLESS>
impl<V> DerefMut for Quantity<V, DIMENSIONLESS>
Arbitrary math operations are only reasonable on dimensionless values
source§impl<R, O, T: Div<R, Output = O>, const LHS_UNITS: SI, const RHS_UNITS: SI> Div<Quantity<R, RHS_UNITS>> for Quantity<T, LHS_UNITS>
impl<R, O, T: Div<R, Output = O>, const LHS_UNITS: SI, const RHS_UNITS: SI> Div<Quantity<R, RHS_UNITS>> for Quantity<T, LHS_UNITS>
Division divides the units
source§impl<R, T: DivAssign<R>, const UNITS: SI> DivAssign<Quantity<R, DIMENSIONLESS>> for Quantity<T, UNITS>
impl<R, T: DivAssign<R>, const UNITS: SI> DivAssign<Quantity<R, DIMENSIONLESS>> for Quantity<T, UNITS>
Scaling by a dimensionless value is OK
source§fn div_assign(&mut self, rhs: Quantity<R, DIMENSIONLESS>)
fn div_assign(&mut self, rhs: Quantity<R, DIMENSIONLESS>)
Performs the
/= operation. Read moresource§impl<R, O, T: Mul<R, Output = O>, const LHS_UNITS: SI, const RHS_UNITS: SI> Mul<Quantity<R, RHS_UNITS>> for Quantity<T, LHS_UNITS>
impl<R, O, T: Mul<R, Output = O>, const LHS_UNITS: SI, const RHS_UNITS: SI> Mul<Quantity<R, RHS_UNITS>> for Quantity<T, LHS_UNITS>
Multiplications multiplies the units
source§impl<R, T: MulAssign<R>, const UNITS: SI> MulAssign<Quantity<R, DIMENSIONLESS>> for Quantity<T, UNITS>
impl<R, T: MulAssign<R>, const UNITS: SI> MulAssign<Quantity<R, DIMENSIONLESS>> for Quantity<T, UNITS>
Scaling by a dimensionless value is OK
source§fn mul_assign(&mut self, rhs: Quantity<R, DIMENSIONLESS>)
fn mul_assign(&mut self, rhs: Quantity<R, DIMENSIONLESS>)
Performs the
*= operation. Read moresource§impl<V: Ord, const UNITS: SI> Ord for Quantity<V, UNITS>
impl<V: Ord, const UNITS: SI> Ord for Quantity<V, UNITS>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<V: PartialEq, const UNITS: SI> PartialEq for Quantity<V, UNITS>
impl<V: PartialEq, const UNITS: SI> PartialEq for Quantity<V, UNITS>
source§impl<V: PartialOrd, const UNITS: SI> PartialOrd for Quantity<V, UNITS>
impl<V: PartialOrd, const UNITS: SI> PartialOrd for Quantity<V, UNITS>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moresource§impl<R, O, T: Sub<R, Output = O>, const UNITS: SI> Sub<Quantity<R, UNITS>> for Quantity<T, UNITS>
impl<R, O, T: Sub<R, Output = O>, const UNITS: SI> Sub<Quantity<R, UNITS>> for Quantity<T, UNITS>
Units must be the same for addition
source§impl<R, T: SubAssign<R>, const UNITS: SI> SubAssign<Quantity<R, UNITS>> for Quantity<T, UNITS>
impl<R, T: SubAssign<R>, const UNITS: SI> SubAssign<Quantity<R, UNITS>> for Quantity<T, UNITS>
Units must be the same for addition
source§fn sub_assign(&mut self, rhs: Quantity<R, UNITS>)
fn sub_assign(&mut self, rhs: Quantity<R, UNITS>)
Performs the
-= operation. Read moreimpl<V: Copy, const UNITS: SI> Copy for Quantity<V, UNITS>
impl<V: Eq, const UNITS: SI> Eq for Quantity<V, UNITS>
impl<V, const UNITS: SI> StructuralEq for Quantity<V, UNITS>
impl<V, const UNITS: SI> StructuralPartialEq for Quantity<V, UNITS>
Auto Trait Implementations§
impl<V, const UNITS: SI> RefUnwindSafe for Quantity<V, UNITS>where
V: RefUnwindSafe,
impl<V, const UNITS: SI> Send for Quantity<V, UNITS>where
V: Send,
impl<V, const UNITS: SI> Sync for Quantity<V, UNITS>where
V: Sync,
impl<V, const UNITS: SI> Unpin for Quantity<V, UNITS>where
V: Unpin,
impl<V, const UNITS: SI> UnwindSafe for Quantity<V, UNITS>where
V: UnwindSafe,
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