pub struct Duration { /* private fields */ }Expand description
A duration of time.
The duration is stored as a 64-bit floating point number of seconds and cannot be negative.
Implementations§
Source§impl Duration
impl Duration
Sourcepub fn weeks(weeks: impl AsPrimitive<f64>) -> Self
pub fn weeks(weeks: impl AsPrimitive<f64>) -> Self
Returns a duration of the given number of weeks.
Sourcepub fn days(days: impl AsPrimitive<f64>) -> Self
pub fn days(days: impl AsPrimitive<f64>) -> Self
Returns a duration of the given number of days.
Sourcepub fn hours(hours: impl AsPrimitive<f64>) -> Self
pub fn hours(hours: impl AsPrimitive<f64>) -> Self
Returns a duration of the given number of hours.
Sourcepub fn mins(mins: impl AsPrimitive<f64>) -> Self
pub fn mins(mins: impl AsPrimitive<f64>) -> Self
Returns a duration of the given number of minutes.
Sourcepub fn secs(secs: impl AsPrimitive<f64>) -> Self
pub fn secs(secs: impl AsPrimitive<f64>) -> Self
Returns a duration of the given number of seconds.
Sourcepub fn hz(hz: impl AsPrimitive<f64>) -> Self
pub fn hz(hz: impl AsPrimitive<f64>) -> Self
Returns a duration of the given number of Hz.
Sourcepub fn ms(ms: impl AsPrimitive<f64>) -> Duration
pub fn ms(ms: impl AsPrimitive<f64>) -> Duration
Returns a duration of the given number of milliseconds.
Sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Returns true if this duration represents a finite amount of time.
Sourcepub fn is_infinite(&self) -> bool
pub fn is_infinite(&self) -> bool
Returns true if this duration represents an infinite amount of time.
Trait Implementations§
Source§impl AddAssign for Duration
impl AddAssign for Duration
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreSource§impl<T> DivAssign<T> for Durationwhere
T: AsPrimitive<f64>,
impl<T> DivAssign<T> for Durationwhere
T: AsPrimitive<f64>,
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
Performs the
/= operation. Read moreSource§impl<T> MulAssign<T> for Durationwhere
T: AsPrimitive<f64>,
impl<T> MulAssign<T> for Durationwhere
T: AsPrimitive<f64>,
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
Performs the
*= operation. Read moreSource§impl Ord for Duration
impl Ord for Duration
Source§impl PartialOrd for Duration
impl PartialOrd for Duration
Source§impl SubAssign for Duration
impl SubAssign for Duration
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-= operation. Read moreimpl Copy for Duration
impl Eq for Duration
impl StructuralPartialEq for Duration
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnwindSafe for Duration
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