pub struct Time(/* private fields */);Expand description
A time duration quantity, stored canonically in seconds (s).
§Construction
use space_units::prelude::*;
let t = Time::from_hours(2.0);
let t2 = 2.0.hours(); // NumericExt shorthand§Supported units
| Constructor | Accessor | Unit |
|---|---|---|
from_s | in_s | second (s) |
from_ms | in_ms | millisecond (ms) |
from_us | in_us | microsecond (us) |
from_ns | in_ns | nanosecond (ns) |
from_min | in_min | minute (min) |
from_hours | in_hours | hour (h) |
from_days | in_days | day (d) |
from_julian_years | in_julian_years | Julian year |
§Typed arithmetic
Velocity×Time→LengthAcceleration×Time→VelocityForce×Time→ImpulseAngle/Time→AngularVelocityAngularVelocity×Time→AngleMass/Time→MassFlowRatePower×Time→EnergyTime::frequency()→Frequency
Implementations§
Source§impl Time
impl Time
Sourcepub const fn from_hours(val: f64) -> Self
pub const fn from_hours(val: f64) -> Self
Create from hours. 1 h = 3 600 s.
Sourcepub const fn from_julian_years(val: f64) -> Self
pub const fn from_julian_years(val: f64) -> Self
Create from Julian years. 1 Julian year = 365.25 days.
Sourcepub const fn in_seconds(self) -> f64
pub const fn in_seconds(self) -> f64
Get value in seconds (alias for in_s).
Sourcepub const fn in_julian_years(self) -> f64
pub const fn in_julian_years(self) -> f64
Get value in Julian years.
Sourcepub fn display_as(self, unit: TimeUnit) -> DisplayWithUnit
pub fn display_as(self, unit: TimeUnit) -> DisplayWithUnit
Return a DisplayWithUnit for formatted printing in the given unit.
Trait Implementations§
Source§impl AddAssign for Time
impl AddAssign for Time
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl Div<Time> for Angle
impl Div<Time> for Angle
Source§type Output = AngularVelocity
type Output = AngularVelocity
The resulting type after applying the
/ operator.Source§impl Div<Time> for AngularMomentum
impl Div<Time> for AngularMomentum
Source§impl Div<Time> for AngularVelocity
impl Div<Time> for AngularVelocity
Source§type Output = AngularAcceleration
type Output = AngularAcceleration
The resulting type after applying the
/ operator.Source§impl Div<Time> for Area
impl Div<Time> for Area
Source§type Output = SpecificAngularMomentum
type Output = SpecificAngularMomentum
The resulting type after applying the
/ operator.Source§impl Div<Time> for ElectricCharge
impl Div<Time> for ElectricCharge
Source§type Output = ElectricCurrent
type Output = ElectricCurrent
The resulting type after applying the
/ operator.Source§impl Div<Time> for Mass
impl Div<Time> for Mass
Source§type Output = MassFlowRate
type Output = MassFlowRate
The resulting type after applying the
/ operator.Source§impl Div<Time> for Velocity
impl Div<Time> for Velocity
Source§type Output = Acceleration
type Output = Acceleration
The resulting type after applying the
/ operator.Source§impl DivAssign<f64> for Time
impl DivAssign<f64> for Time
Source§fn div_assign(&mut self, rhs: f64)
fn div_assign(&mut self, rhs: f64)
Performs the
/= operation. Read moreSource§impl Mul<Acceleration> for Time
impl Mul<Acceleration> for Time
Source§impl Mul<AngularVelocity> for Time
impl Mul<AngularVelocity> for Time
Source§impl Mul<ElectricCurrent> for Time
impl Mul<ElectricCurrent> for Time
Source§type Output = ElectricCharge
type Output = ElectricCharge
The resulting type after applying the
* operator.Source§fn mul(self, rhs: ElectricCurrent) -> ElectricCharge
fn mul(self, rhs: ElectricCurrent) -> ElectricCharge
Performs the
* operation. Read moreSource§impl Mul<MassFlowRate> for Time
impl Mul<MassFlowRate> for Time
Source§impl Mul<Time> for Acceleration
impl Mul<Time> for Acceleration
Source§impl Mul<Time> for AngularVelocity
impl Mul<Time> for AngularVelocity
Source§impl Mul<Time> for ElectricCurrent
impl Mul<Time> for ElectricCurrent
Source§type Output = ElectricCharge
type Output = ElectricCharge
The resulting type after applying the
* operator.Source§impl Mul<Time> for MassFlowRate
impl Mul<Time> for MassFlowRate
Source§impl Mul<Time> for Torque
impl Mul<Time> for Torque
Source§type Output = AngularMomentum
type Output = AngularMomentum
The resulting type after applying the
* operator.Source§impl MulAssign<f64> for Time
impl MulAssign<f64> for Time
Source§fn mul_assign(&mut self, rhs: f64)
fn mul_assign(&mut self, rhs: f64)
Performs the
*= operation. Read moreSource§impl PartialOrd for Time
impl PartialOrd for Time
Source§impl SubAssign for Time
impl SubAssign for Time
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnsafeUnpin for Time
impl UnwindSafe for Time
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