Struct Time

Source
pub struct Time { /* private fields */ }
Expand description

Time (base UnitDefinition second, s). Scalar storage of a quantity (f64 and TimeUnit).

Implementations§

Source§

impl Time

Source

pub fn new(value: f64, unit: TimeUnit) -> Self

Create a new TimeUnit.

Source

pub fn yottasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::yottasecond.

Source

pub fn zettasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::zettasecond.

Source

pub fn exasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::exasecond.

Source

pub fn petasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::petasecond.

Source

pub fn terasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::terasecond.

Source

pub fn gigasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::gigasecond.

Source

pub fn megasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::megasecond.

Source

pub fn kilosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::kilosecond.

Source

pub fn hectosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::hectosecond.

Source

pub fn decasecond(value: f64) -> Self

Create a new Time with units of TimeUnit::decasecond.

Source

pub fn second(value: f64) -> Self

Create a new Time with units of TimeUnit::second.

Source

pub fn decisecond(value: f64) -> Self

Create a new Time with units of TimeUnit::decisecond.

Source

pub fn centisecond(value: f64) -> Self

Create a new Time with units of TimeUnit::centisecond.

Source

pub fn millisecond(value: f64) -> Self

Create a new Time with units of TimeUnit::millisecond.

Source

pub fn microsecond(value: f64) -> Self

Create a new Time with units of TimeUnit::microsecond.

Source

pub fn nanosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::nanosecond.

Source

pub fn picosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::picosecond.

Source

pub fn femtosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::femtosecond.

Source

pub fn attosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::attosecond.

Source

pub fn zeptosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::zeptosecond.

Source

pub fn yoctosecond(value: f64) -> Self

Create a new Time with units of TimeUnit::yoctosecond.

Source

pub fn second_sidereal(value: f64) -> Self

Create a new Time with units of TimeUnit::second_sidereal.

Source

pub fn day(value: f64) -> Self

Create a new Time with units of TimeUnit::day.

Source

pub fn day_sidereal(value: f64) -> Self

Create a new Time with units of TimeUnit::day_sidereal.

Source

pub fn hour(value: f64) -> Self

Create a new Time with units of TimeUnit::hour.

Source

pub fn hour_sidereal(value: f64) -> Self

Create a new Time with units of TimeUnit::hour_sidereal.

Source

pub fn minute(value: f64) -> Self

Create a new Time with units of TimeUnit::minute.

Source

pub fn shake(value: f64) -> Self

Create a new Time with units of TimeUnit::shake.

Source

pub fn year(value: f64) -> Self

Create a new Time with units of TimeUnit::year.

Source

pub fn year_sidereal(value: f64) -> Self

Create a new Time with units of TimeUnit::year_sidereal.

Source

pub fn year_tropical(value: f64) -> Self

Create a new Time with units of TimeUnit::year_tropical.

Source

pub fn value(&self) -> f64

Retrieve the value associated with this Time.

Source

pub fn value_mut(&mut self) -> &mut f64

Retrieve the mutable value associated with this Time.

Source

pub fn definition(&self) -> UnitDefinition

Retrieve the UnitDefinition associated with this Time.

Source

pub fn to_yottasecond(&self) -> Self

Source

pub fn to_zettasecond(&self) -> Self

Source

pub fn to_exasecond(&self) -> Self

Convert to TimeUnit::exasecond.

Source

pub fn to_petasecond(&self) -> Self

Source

pub fn to_terasecond(&self) -> Self

Source

pub fn to_gigasecond(&self) -> Self

Source

pub fn to_megasecond(&self) -> Self

Source

pub fn to_kilosecond(&self) -> Self

Source

pub fn to_hectosecond(&self) -> Self

Source

pub fn to_decasecond(&self) -> Self

Source

pub fn to_second(&self) -> Self

Convert to TimeUnit::second.

Source

pub fn to_decisecond(&self) -> Self

Source

pub fn to_centisecond(&self) -> Self

Source

pub fn to_millisecond(&self) -> Self

Source

pub fn to_microsecond(&self) -> Self

Source

pub fn to_nanosecond(&self) -> Self

Source

pub fn to_picosecond(&self) -> Self

Source

pub fn to_femtosecond(&self) -> Self

Source

pub fn to_attosecond(&self) -> Self

Source

pub fn to_zeptosecond(&self) -> Self

Source

pub fn to_yoctosecond(&self) -> Self

Source

pub fn to_second_sidereal(&self) -> Self

Source

pub fn to_day(&self) -> Self

Convert to TimeUnit::day.

Source

pub fn to_day_sidereal(&self) -> Self

Source

pub fn to_hour(&self) -> Self

Convert to TimeUnit::hour.

Source

pub fn to_hour_sidereal(&self) -> Self

Source

pub fn to_minute(&self) -> Self

Convert to TimeUnit::minute.

Source

pub fn to_shake(&self) -> Self

Convert to TimeUnit::shake.

Source

pub fn to_year(&self) -> Self

Convert to TimeUnit::year.

Source

pub fn to_year_sidereal(&self) -> Self

Source

pub fn to_year_tropical(&self) -> Self

Trait Implementations§

Source§

impl Add<Quantity> for Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Quantity) -> Self

Performs the + operation. Read more
Source§

impl Add for Time

Source§

type Output = Time

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Time) -> Self

Performs the + operation. Read more
Source§

impl AddAssign<Quantity> for Time

Source§

fn add_assign(&mut self, rhs: Quantity)

Performs the += operation. Read more
Source§

impl AddAssign for Time

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl Clone for Time

Source§

fn clone(&self) -> Time

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Time

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Time

Source§

fn default() -> Time

Returns the “default value” for a type. Read more
Source§

impl<T: IsScalarQuantity> Div<T> for Time

Source§

type Output = Quantity

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Quantity

Performs the / operation. Read more
Source§

impl Div<f64> for Time

Source§

type Output = Time

The resulting type after applying the / operator.
Source§

fn div(self, rhs: f64) -> Self::Output

Performs the / operation. Read more
Source§

impl DivAssign<f64> for Time

Source§

fn div_assign(&mut self, rhs: f64)

Performs the /= operation. Read more
Source§

impl FixedQuantity<TimeUnit> for Time

Source§

fn unit(&self) -> TimeUnit

Return unit associated with this quantity
Source§

fn convert(&self, unit: TimeUnit) -> Self

Convert from this unit to another (creates a copy). No validation of base unit is made.
Source§

fn convert_mut(&mut self, unit: TimeUnit)

Convert from this unit to another (modifies current quantity). No validation of base unit is made.
Source§

fn unit_mut(&mut self) -> &mut TimeUnit

Return mutable unit associated with this quantity
Source§

fn try_convert(&self, unit: Units) -> Result<Self, RuntimeUnitError>
where Self: Sized,

Try to convert from this unit to another (creates a copy)
Source§

impl From<&Time> for Units

Source§

fn from(value: &Time) -> Self

Converts to this type from the input type.
Source§

impl From<Quantity> for Time

Source§

fn from(quantity: Quantity) -> Time

Converts to this type from the input type.
Source§

impl From<Time> for Quantity

Source§

fn from(quantity: Time) -> Self

Converts to this type from the input type.
Source§

impl From<Time> for UnitDefinition

Source§

fn from(value: Time) -> Self

Converts to this type from the input type.
Source§

impl From<Time> for Units

Source§

fn from(value: Time) -> Self

Converts to this type from the input type.
Source§

impl<T: IsScalarQuantity> Mul<T> for Time

Source§

type Output = Quantity

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Quantity

Performs the * operation. Read more
Source§

impl Mul<f64> for Time

Source§

type Output = Time

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: f64) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign<f64> for Time

Source§

fn mul_assign(&mut self, rhs: f64)

Performs the *= operation. Read more
Source§

impl PartialEq<Quantity> for Time

Source§

fn eq(&self, other: &Quantity) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq<Time> for Quantity

Source§

fn eq(&self, other: &Time) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for Time

Source§

fn eq(&self, other: &Time) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Time

Source§

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 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Sub<Quantity> for Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Quantity) -> Self

Performs the - operation. Read more
Source§

impl Sub for Time

Source§

type Output = Time

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Time) -> Self

Performs the - operation. Read more
Source§

impl SubAssign<Quantity> for Time

Source§

fn sub_assign(&mut self, rhs: Quantity)

Performs the -= operation. Read more
Source§

impl SubAssign for Time

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl Copy 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 UnwindSafe for Time

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.