[−][src]Struct hifitime::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: Decimal) -> Self
[src]
pub fn from_hours(hours: Decimal) -> Self
[src]
pub fn from_minutes(minutes: Decimal) -> Self
[src]
pub fn from_seconds(seconds: Decimal) -> Self
[src]
pub fn from_milliseconds(ms: Decimal) -> Self
[src]
pub fn from_microseconds(ms: Decimal) -> Self
[src]
pub fn from_nanoseconds(ns: Decimal) -> Self
[src]
pub fn from_f64(value: f64, unit: TimeUnit) -> Self
[src]
Creates a new duration from the provided unit
pub fn from_fraction(num: i64, denom: i64, unit: TimeUnit) -> Self
[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_unit(&self, unit: TimeUnit) -> Decimal
[src]
Returns the value of this duration in the requested unit.
Trait Implementations
impl Add<Duration> for Epoch
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, duration: Duration) -> Self
[src]
impl Add<Duration> for Duration
[src]
type Output = Duration
The resulting type after applying the +
operator.
fn add(self, rhs: Self) -> Duration
[src]
impl Add<TimeUnit> for Duration
[src]
type Output = Duration
The resulting type after applying the +
operator.
fn add(self, rhs: TimeUnit) -> Duration
[src]
impl AddAssign<Duration> for Epoch
[src]
fn add_assign(&mut self, duration: Duration)
[src]
impl AddAssign<Duration> for Duration
[src]
fn add_assign(&mut self, rhs: Duration)
[src]
impl AddAssign<TimeUnit> for Duration
[src]
fn add_assign(&mut self, rhs: TimeUnit)
[src]
impl Clone for Duration
[src]
impl Copy for Duration
[src]
impl Debug for Duration
[src]
impl Display for Duration
[src]
impl Div<f32> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: f32) -> Duration
[src]
impl Div<f64> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: f64) -> Duration
[src]
impl Div<i16> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: i16) -> Duration
[src]
impl Div<i32> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: i32) -> Duration
[src]
impl Div<i64> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: i64) -> Duration
[src]
impl Div<i8> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: i8) -> Duration
[src]
impl Div<u128> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: u128) -> Duration
[src]
impl Div<u16> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: u16) -> Duration
[src]
impl Div<u32> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: u32) -> Duration
[src]
impl Div<u64> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: u64) -> Duration
[src]
impl Div<u8> for Duration
[src]
type Output = Duration
The resulting type after applying the /
operator.
fn div(self, q: u8) -> Duration
[src]
impl FromStr for Duration
[src]
type Err = Errors
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::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<Duration> for f32
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for f64
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for u128
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for u8
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for i8
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for u16
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for i16
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for u32
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for i32
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for u64
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<Duration> for i64
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: Duration) -> Duration
[src]
impl Mul<f32> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: f32) -> Duration
[src]
impl Mul<f64> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: f64) -> Duration
[src]
impl Mul<i16> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: i16) -> Duration
[src]
impl Mul<i32> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: i32) -> Duration
[src]
impl Mul<i64> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: i64) -> Duration
[src]
impl Mul<i8> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: i8) -> Duration
[src]
impl Mul<u128> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: u128) -> Duration
[src]
impl Mul<u16> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: u16) -> Duration
[src]
impl Mul<u32> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: u32) -> Duration
[src]
impl Mul<u64> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: u64) -> Duration
[src]
impl Mul<u8> for Duration
[src]
type Output = Duration
The resulting type after applying the *
operator.
fn mul(self, q: u8) -> Duration
[src]
impl PartialEq<Duration> for Duration
[src]
impl PartialEq<TimeUnit> for Duration
[src]
impl PartialOrd<Duration> for Duration
[src]
fn partial_cmp(&self, other: &Duration) -> Option<Ordering>
[src]
fn lt(&self, other: &Duration) -> bool
[src]
fn le(&self, other: &Duration) -> bool
[src]
fn gt(&self, other: &Duration) -> bool
[src]
fn ge(&self, other: &Duration) -> bool
[src]
impl PartialOrd<TimeUnit> for Duration
[src]
fn partial_cmp(&self, unit: &TimeUnit) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralPartialEq for Duration
[src]
impl Sub<Duration> for Epoch
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, duration: Duration) -> Self
[src]
impl Sub<Duration> for Duration
[src]
type Output = Duration
The resulting type after applying the -
operator.
fn sub(self, rhs: Self) -> Duration
[src]
impl Sub<TimeUnit> for Duration
[src]
type Output = Duration
The resulting type after applying the -
operator.
fn sub(self, rhs: TimeUnit) -> Duration
[src]
impl SubAssign<Duration> for Epoch
[src]
fn sub_assign(&mut self, duration: Duration)
[src]
impl SubAssign<Duration> for Duration
[src]
fn sub_assign(&mut self, rhs: Duration)
[src]
impl SubAssign<TimeUnit> for Duration
[src]
fn sub_assign(&mut self, rhs: TimeUnit)
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,