Struct astronomical_quantities::Duration
source · pub struct Duration { /* private fields */ }Expand description
Duration: ‘what a clock reads’
Reference unit: Day (‘d’)
Predefined units:
| Symbol | Name | Definition | Equivalent in ‘d’ |
|---|---|---|---|
| s | Second | SI reference unit | 1.1574074074074073e-5 |
| min | Minute | 60·s | 0.0006944444444444445 |
| h | Hour | 60·min | 0.041666666666666664 |
| dₛ | Siderial Day | a·d/(a + d) | 0.9972685185185185 |
| a | Julian Year | 365.25·d | 365.25 |
| yr | Gregorian Year | 365.2425·d | 365.2425 |
| T🜨 | Earth’s Orbital Period | ≈ 365.256363004·d | 365.256363004 |
Trait Implementations§
source§impl Div<Duration> for Lengthwhere
Self: HasRefUnit,
Duration: HasRefUnit,
impl Div<Duration> for Lengthwhere Self: HasRefUnit, Duration: HasRefUnit,
source§impl HasRefUnit for Duration
impl HasRefUnit for Duration
source§const REF_UNIT: DurationUnit = DurationUnit::Day
const REF_UNIT: DurationUnit = DurationUnit::Day
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 Mul<Duration> for Speedwhere
Self: HasRefUnit,
Duration: HasRefUnit,
impl Mul<Duration> for Speedwhere Self: HasRefUnit, Duration: HasRefUnit,
source§impl Mul<Speed> for Durationwhere
Self: HasRefUnit,
Speed: HasRefUnit,
impl Mul<Speed> for Durationwhere Self: HasRefUnit, Speed: HasRefUnit,
source§impl PartialEq<Duration> for Duration
impl PartialEq<Duration> for Duration
source§impl PartialOrd<Duration> for Duration
impl PartialOrd<Duration> for Duration
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 Duration
impl Quantity for Duration
§type UnitType = DurationUnit
type UnitType = DurationUnit
Associated type of unit
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 Duration
impl Eq for Duration
Auto Trait Implementations§
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
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