Struct quantities::mass::Mass
source · [−]pub struct Mass { /* private fields */ }Expand description
The quantity of matter in a physical body.
Also used as measure of a physical body’s resistance to acceleration.
Reference unit: Kilogram (‘kg’)
Predefined units:
| Symbol | Name | Definition | Equivalent in ‘kg’ |
|---|---|---|---|
| mg | Milligram | 0.001·g | 0.000001 |
| ct | Carat | 0.2·g | 0.0002 |
| g | Gram | 0.001·kg | 0.001 |
| oz | Ounce | 0.0625·lb | 0.028349523125 |
| lb | Pound | 0.45359237·kg | 0.45359237 |
| st | Stone | 14·lb | 6.35029318 |
| t | Tonne | 1000·kg | 1000 |
Trait Implementations
sourceimpl Div<Mass> for Force where
Self: HasRefUnit,
Mass: HasRefUnit,
impl Div<Mass> for Force where
Self: HasRefUnit,
Mass: HasRefUnit,
sourceimpl HasRefUnit for Mass
impl HasRefUnit for Mass
sourceconst REF_UNIT: MassUnit = MassUnit::Kilogram
const REF_UNIT: MassUnit = MassUnit::Kilogram
Unit used as reference for scaling the units of Self::UnitType.
sourcefn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
fn unit_from_scale(amnt: AmountT) -> Option<Self::UnitType>
Returns Some(unit) where unit.scale() == amnt, or None if
there is no such unit. Read more
sourcefn equiv_amount(&self, unit: Self::UnitType) -> AmountT
fn equiv_amount(&self, unit: Self::UnitType) -> AmountT
Returns factor so that factor * unit == self.
sourcefn convert(&self, to_unit: Self::UnitType) -> Self
fn convert(&self, to_unit: Self::UnitType) -> Self
Returns qty where qty == self and qty.unit() is to_unit.
sourcefn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Returns true, if self and other have equivalent amounts, otherwise
false. Read more
sourceimpl Mul<&Acceleration> for &Mass where
Mass: Mul<Acceleration>,
impl Mul<&Acceleration> for &Mass where
Mass: Mul<Acceleration>,
type Output = <Mass as Mul<Acceleration>>::Output
type Output = <Mass as Mul<Acceleration>>::Output
The resulting type after applying the * operator.
sourcefn mul(self, rhs: &Acceleration) -> Self::Output
fn mul(self, rhs: &Acceleration) -> Self::Output
Performs the * operation. Read more
sourceimpl Mul<&Acceleration> for Mass where
Self: Mul<Acceleration>,
impl Mul<&Acceleration> for Mass where
Self: Mul<Acceleration>,
type Output = <Mass as Mul<Acceleration>>::Output
type Output = <Mass as Mul<Acceleration>>::Output
The resulting type after applying the * operator.
sourcefn mul(self, rhs: &Acceleration) -> Self::Output
fn mul(self, rhs: &Acceleration) -> Self::Output
Performs the * operation. Read more
sourceimpl Mul<&Mass> for &Acceleration where
Acceleration: Mul<Mass>,
impl Mul<&Mass> for &Acceleration where
Acceleration: Mul<Mass>,
sourceimpl<'a> Mul<Acceleration> for &'a Mass where
Mass: Mul<Acceleration>,
impl<'a> Mul<Acceleration> for &'a Mass where
Mass: Mul<Acceleration>,
type Output = <Mass as Mul<Acceleration>>::Output
type Output = <Mass as Mul<Acceleration>>::Output
The resulting type after applying the * operator.
sourcefn mul(self, rhs: Acceleration) -> Self::Output
fn mul(self, rhs: Acceleration) -> Self::Output
Performs the * operation. Read more
sourceimpl Mul<Acceleration> for Mass where
Self: HasRefUnit,
Acceleration: HasRefUnit,
impl Mul<Acceleration> for Mass where
Self: HasRefUnit,
Acceleration: HasRefUnit,
sourceimpl<'a> Mul<Mass> for &'a Acceleration where
Acceleration: Mul<Mass>,
impl<'a> Mul<Mass> for &'a Acceleration where
Acceleration: Mul<Mass>,
sourceimpl Mul<Mass> for Acceleration where
Self: HasRefUnit,
Mass: HasRefUnit,
impl Mul<Mass> for Acceleration where
Self: HasRefUnit,
Mass: HasRefUnit,
sourceimpl PartialEq<Mass> for Mass
impl PartialEq<Mass> for Mass
sourceimpl PartialOrd<Mass> for Mass
impl PartialOrd<Mass> for Mass
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl Quantity for Mass
impl Quantity for Mass
sourcefn new(amount: AmountT, unit: Self::UnitType) -> Self
fn new(amount: AmountT, unit: Self::UnitType) -> Self
Returns a new instance of the type implementing Quantity.
sourcefn iter_units<'a>() -> Iter<'a, Self::UnitType>
fn iter_units<'a>() -> Iter<'a, Self::UnitType>
Returns an iterator over the variants of Self::UnitType.
sourcefn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
fn unit_from_symbol(symbol: &str) -> Option<Self::UnitType>
Returns Some(unit) where unit.symbol() == symbol, or None if
there is no such unit. Read more
sourcefn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Return true if self and other have the same unit and their amounts
are equal, otherwise false. Read more
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
Returns the partial order of selfs and others amounts, if both have
the same unit, otherwise None. Read more
sourcefn add(self, rhs: Self) -> Self
fn add(self, rhs: Self) -> Self
Returns the sum of self and other, if both have the same unit. Read more
sourcefn sub(self, rhs: Self) -> Self
fn sub(self, rhs: Self) -> Self
Returns the difference between self and other, if both have the same
unit. Read more
impl Copy for Mass
impl Eq for Mass
Auto Trait Implementations
impl RefUnwindSafe for Mass
impl Send for Mass
impl Sync for Mass
impl Unpin for Mass
impl UnwindSafe for Mass
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more