#[non_exhaustive]pub enum DurationUnit {
Second,
Millisecond,
Microsecond,
Nanosecond,
Minute,
Hour,
Day,
Year,
}
Expand description
Represents a specific duration unit - SI or otherwise.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Second
SI Base Unit for Duration - Second.
The second division of the hour by 60.
Millisecond
A milli-second, one-thousandth of a second (1e-3)
Microsecond
A micro-second, one-millionth of a second (1e-6)
Nanosecond
A nano-second, one-billionth of a second (1e-9)
Minute
A minute, the first division of an hour by 60.
Hour
An hour, 24 in a day.
Day
NIST 811 defines a “Day” as 86400 seconds, without the concept of leap seconds.
Year
NIST 811 defines a “Year” as 365 days, or 31_536_000 seconds, without the concept of leap days.
Implementations§
Source§impl DurationUnit
impl DurationUnit
Sourcepub fn as_seconds(self, value: f64) -> f64
pub fn as_seconds(self, value: f64) -> f64
Converts the specified value into Seconds
Sourcepub fn as_minutes(self, value: f64) -> f64
pub fn as_minutes(self, value: f64) -> f64
Converts the specified value into Minutes
Trait Implementations§
Source§impl Clone for DurationUnit
impl Clone for DurationUnit
Source§fn clone(&self) -> DurationUnit
fn clone(&self) -> DurationUnit
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DurationUnit
impl Debug for DurationUnit
Source§impl Default for DurationUnit
impl Default for DurationUnit
Source§fn default() -> DurationUnit
fn default() -> DurationUnit
Returns the “default value” for a type. Read more
Source§impl FromUnits<f32> for DurationUnit
impl FromUnits<f32> for DurationUnit
Source§impl FromUnits<f64> for DurationUnit
impl FromUnits<f64> for DurationUnit
Source§impl FromUnits<i32> for DurationUnit
impl FromUnits<i32> for DurationUnit
Source§impl FromUnits<i64> for DurationUnit
impl FromUnits<i64> for DurationUnit
Source§impl FromUnits<u32> for DurationUnit
impl FromUnits<u32> for DurationUnit
Source§impl FromUnits<u64> for DurationUnit
impl FromUnits<u64> for DurationUnit
Source§impl PartialEq for DurationUnit
impl PartialEq for DurationUnit
Source§impl Unit<DurationUnit> for &Duration
impl Unit<DurationUnit> for &Duration
Source§impl Unit<DurationUnit> for &mut Duration
impl Unit<DurationUnit> for &mut Duration
Source§impl Unit<DurationUnit> for Duration
impl Unit<DurationUnit> for Duration
Source§impl UnitStruct<DurationUnit> for &Duration
impl UnitStruct<DurationUnit> for &Duration
Source§impl UnitStruct<DurationUnit> for &mut Duration
impl UnitStruct<DurationUnit> for &mut Duration
Source§impl UnitStruct<DurationUnit> for Duration
impl UnitStruct<DurationUnit> for Duration
impl Copy for DurationUnit
impl Eq for DurationUnit
impl StructuralPartialEq for DurationUnit
Auto Trait Implementations§
impl Freeze for DurationUnit
impl RefUnwindSafe for DurationUnit
impl Send for DurationUnit
impl Sync for DurationUnit
impl Unpin for DurationUnit
impl UnwindSafe for DurationUnit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more