Struct nyx_space::time::Duration [−][src]
pub struct Duration(_);
Expand description
Defines generally usable durations for high precision math with Epoch (all data is stored in seconds)
Implementations
Creates a new duration from the provided unit
Creates a new duration from the provided fraction and unit
Returns this duration in f64 in the provided unit. For high fidelity comparisons, it is recommended to keep using the Duration structure.
Returns this duration in seconds f64. For high fidelity comparisons, it is recommended to keep using the Duration structure.
Returns the value of this duration in the requested unit.
Trait Implementations
Performs the +=
operation. Read more
Performs the +=
operation. Read more
Performs the +=
operation. Read more
pub fn deserialize<D>(
deserializer: D
) -> Result<Duration, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]
pub fn deserialize<D>(
deserializer: D
) -> Result<Duration, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
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);
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for Duration
impl UnwindSafe for Duration
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub fn to_subset_unchecked(&self) -> SS
pub fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
pub fn vzip(self) -> V
impl<T> ClosedNeg for T where
T: Neg<Output = T>,