Struct nyx_space::time::Duration[][src]

pub struct Duration(_);

Defines generally usable durations for high precision math with Epoch (all data is stored in seconds)

Implementations

impl Duration[src]

pub fn from_days(days: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_hours(hours: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_minutes(minutes: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_seconds(seconds: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_milliseconds(ms: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_microseconds(us: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_nanoseconds(ns: GenericDecimal<u128, u16>) -> Duration[src]

pub fn from_f64(value: f64, unit: TimeUnit) -> Duration[src]

Creates a new duration from the provided unit

pub fn from_fraction(num: i64, denom: i64, unit: TimeUnit) -> Duration[src]

Creates a new duration from the provided fraction and unit

pub fn in_unit_f64(&self, unit: TimeUnit) -> f64[src]

Returns this duration in f64 in the provided unit. For high fidelity comparisons, it is recommended to keep using the Duration structure.

pub fn in_seconds(&self) -> f64[src]

Returns this duration in seconds f64. For high fidelity comparisons, it is recommended to keep using the Duration structure.

pub fn in_unit(&self, unit: TimeUnit) -> GenericDecimal<u128, u16>[src]

Returns the value of this duration in the requested unit.

pub fn abs(&self) -> Duration[src]

Returns the absolute value of this duration

Trait Implementations

impl Add<Duration> for Epoch[src]

type Output = Epoch

The resulting type after applying the + operator.

impl Add<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the + operator.

impl Add<TimeUnit> for Duration[src]

type Output = Duration

The resulting type after applying the + operator.

impl AddAssign<Duration> for Duration[src]

impl AddAssign<Duration> for Epoch[src]

impl AddAssign<TimeUnit> for Duration[src]

impl Clone for Duration[src]

impl Copy for Duration[src]

impl Debug for Duration[src]

impl<'de> Deserialize<'de> for Duration[src]

impl Display for Duration[src]

impl Div<f32> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<f64> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<i16> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<i32> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<i64> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<i8> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<u128> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<u16> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<u32> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<u64> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl Div<u8> for Duration[src]

type Output = Duration

The resulting type after applying the / operator.

impl FromStr for Duration[src]

type Err = Errors

The associated error which can be returned from parsing.

pub fn from_str(s: &str) -> Result<Duration, <Duration as FromStr>::Err>[src]

Attempts to convert a simple string to a Duration. Does not yet support complicated durations.

Identifiers: + d, days, day + h, hours, hour + min, mins, minute + s, second, seconds + ms, millisecond, milliseconds + us, microsecond, microseconds + ns, nanosecond, nanoseconds

Example

use hifitime::{Duration, TimeUnit};
use std::str::FromStr;

assert_eq!(Duration::from_str("1 d").unwrap(), TimeUnit::Day * 1);
assert_eq!(Duration::from_str("10.598 days").unwrap(), TimeUnit::Day * 10.598);
assert_eq!(Duration::from_str("10.598 min").unwrap(), TimeUnit::Minute * 10.598);
assert_eq!(Duration::from_str("10.598 us").unwrap(), TimeUnit::Microsecond * 10.598);
assert_eq!(Duration::from_str("10.598 seconds").unwrap(), TimeUnit::Second * 10.598);
assert_eq!(Duration::from_str("10.598 nanosecond").unwrap(), TimeUnit::Nanosecond * 10.598);

impl LowerExp for Duration[src]

impl Mul<f32> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<f64> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<i16> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<i32> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<i64> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<i8> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<u128> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<u16> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<u32> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<u64> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Mul<u8> for Duration[src]

type Output = Duration

The resulting type after applying the * operator.

impl Neg for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

impl PartialEq<Duration> for Duration[src]

impl PartialEq<TimeUnit> for Duration[src]

impl PartialOrd<Duration> for Duration[src]

impl PartialOrd<TimeUnit> for Duration[src]

impl StructuralPartialEq for Duration[src]

impl Sub<Duration> for Epoch[src]

type Output = Epoch

The resulting type after applying the - operator.

impl Sub<Duration> for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

impl Sub<TimeUnit> for Duration[src]

type Output = Duration

The resulting type after applying the - operator.

impl SubAssign<Duration> for Duration[src]

impl SubAssign<Duration> for Epoch[src]

impl SubAssign<TimeUnit> for Duration[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, Right> ClosedAdd<Right> for T where
    T: Add<Right, Output = T> + AddAssign<Right>, 

impl<T> ClosedNeg for T where
    T: Neg<Output = T>, 

impl<T, Right> ClosedSub<Right> for T where
    T: Sub<Right, Output = T> + SubAssign<Right>, 

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: PartialEq<T> + Copy + Any + Debug
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,