#[non_exhaustive]
pub struct TimeDuration { pub hours: f64, pub minutes: f64, pub seconds: f64, pub milliseconds: f64, pub microseconds: f64, pub nanoseconds: f64, }
Expand description

TimeDuration represents the Time Duration record of the Duration.

These fields are laid out in the Temporal Proposal as 64-bit floating point numbers.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§hours: f64

TimeDuration’s internal hour value.

§minutes: f64

TimeDuration’s internal minute value.

§seconds: f64

TimeDuration’s internal second value.

§milliseconds: f64

TimeDuration’s internal millisecond value.

§microseconds: f64

TimeDuration’s internal microsecond value.

§nanoseconds: f64

TimeDuration’s internal nanosecond value.

Implementations§

source§

impl TimeDuration

source

pub fn new( hours: f64, minutes: f64, seconds: f64, milliseconds: f64, microseconds: f64, nanoseconds: f64 ) -> TemporalResult<Self>

Creates a new validated TimeDuration.

source

pub const fn partial() -> Self

Creates a partial TimeDuration with all values set to NaN.

source

pub fn from_partial(partial: &TimeDuration) -> Self

Creates a TimeDuration from a provided partial TimeDuration.

source

pub fn abs(&self) -> Self

Returns a new TimeDuration representing the absolute value of the current.

source

pub fn negated(&self) -> Self

Returns a negated TimeDuration.

source

pub fn is_within_range(&self) -> bool

Utility function for returning if values in a valid range.

source§

impl TimeDuration

source

pub fn round( &self, increment: u64, unit: TemporalUnit, mode: TemporalRoundingMode ) -> TemporalResult<(NormalizedTimeDuration, i64)>

Rounds the current TimeDuration given a rounding increment, unit and rounding mode. round will return a tuple of the rounded TimeDuration and the total value of the smallest unit prior to rounding.

Trait Implementations§

source§

impl Clone for TimeDuration

source§

fn clone(&self) -> TimeDuration

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for TimeDuration

source§

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

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

impl Default for TimeDuration

source§

fn default() -> TimeDuration

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

impl From<TimeDuration> for Duration

source§

fn from(value: TimeDuration) -> Self

Converts to this type from the input type.
source§

impl Copy for TimeDuration

Auto Trait Implementations§

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> 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,

§

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>,

§

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>,

§

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.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T