Struct astronomical_quantities::Mass
source · pub struct Mass { /* private fields */ }Expand description
The quantity of matter in an astonomical body.
Reference unit: Solar Mass (‘M☉’)
Predefined units:
| Symbol | Name | Definition | Equivalent in ‘M☉’ |
|---|---|---|---|
| M☾ | Lunar Mass | 1/27068510 M☉ | 3.694329684197616e-8 |
| M🜨 | Earth Mass | 10000/3329460487 M☉ | 3.003489616124103e-6 |
| M♃ | Jupiter Mass | 1000000/1047348644 M☉ | 9.547918983127074e-4 |
Trait Implementations§
source§impl HasRefUnit for Mass
impl HasRefUnit for Mass
source§const REF_UNIT: MassUnit = MassUnit::SolarMass
const REF_UNIT: MassUnit = MassUnit::SolarMass
Unit used as reference for scaling the units of
Self::UnitType.source§fn unit_from_scale(amnt: f64) -> Option<Self::UnitType>
fn unit_from_scale(amnt: f64) -> Option<Self::UnitType>
Returns
Some(unit) where unit.scale() == amnt, or None if
there is no such unit.source§fn equiv_amount(&self, unit: Self::UnitType) -> f64
fn equiv_amount(&self, unit: Self::UnitType) -> f64
Returns
factor so that factor * unit == self.source§fn 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.source§fn eq(&self, other: &Self) -> bool
fn eq(&self, other: &Self) -> bool
Returns true, if
self and other have equivalent amounts, otherwise
false.source§impl PartialEq<Mass> for Mass
impl PartialEq<Mass> for Mass
source§impl PartialOrd<Mass> for Mass
impl PartialOrd<Mass> for Mass
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 Quantity for Mass
impl Quantity for Mass
source§fn new(amount: AmountT, unit: Self::UnitType) -> Self
fn new(amount: AmountT, unit: Self::UnitType) -> Self
Returns a new instance of the type implementing
Quantity.source§fn iter_units<'a>() -> Iter<'a, Self::UnitType>
fn iter_units<'a>() -> Iter<'a, Self::UnitType>
Returns an iterator over the variants of
Self::UnitType.source§fn 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.source§fn 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.source§fn 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.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§
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