pub struct Duration<T, U = NsUnit>(/* private fields */);
Implementations§
source§impl<T: Timeline> Duration<T, NsUnit>
impl<T: Timeline> Duration<T, NsUnit>
pub const INFINITE: Duration<T> = _
pub const INFINITE_PAST: Duration<T> = _
pub const ZERO: Duration<T> = _
sourcepub const fn into_nanos(self) -> i64
pub const fn into_nanos(self) -> i64
Returns the number of nanoseconds contained by this Duration
.
sourcepub const fn into_micros(self) -> i64
pub const fn into_micros(self) -> i64
Returns the total number of whole microseconds contained by this Duration
.
sourcepub const fn into_millis(self) -> i64
pub const fn into_millis(self) -> i64
Returns the total number of whole milliseconds contained by this Duration
.
sourcepub const fn into_seconds(self) -> i64
pub const fn into_seconds(self) -> i64
Returns the total number of whole seconds contained by this Duration
.
sourcepub fn into_seconds_f64(self) -> f64
pub fn into_seconds_f64(self) -> f64
Returns the duration as a floating-point value in seconds.
sourcepub const fn into_minutes(self) -> i64
pub const fn into_minutes(self) -> i64
Returns the total number of whole minutes contained by this Duration
.
sourcepub const fn into_hours(self) -> i64
pub const fn into_hours(self) -> i64
Returns the total number of whole hours contained by this Duration
.
pub const fn from_nanos(nanos: i64) -> Self
pub const fn from_micros(micros: i64) -> Self
pub const fn from_millis(millis: i64) -> Self
pub const fn from_seconds(secs: i64) -> Self
pub const fn from_minutes(min: i64) -> Self
pub const fn from_hours(hours: i64) -> Self
Trait Implementations§
source§impl<T: Timeline, U: TimeUnit> AddAssign<Duration<T, U>> for Instant<T, U>
impl<T: Timeline, U: TimeUnit> AddAssign<Duration<T, U>> for Instant<T, U>
source§fn add_assign(&mut self, dur: Duration<T, U>)
fn add_assign(&mut self, dur: Duration<T, U>)
Performs the
+=
operation. Read moresource§impl<T: Timeline, U: TimeUnit> AddAssign for Duration<T, U>
impl<T: Timeline, U: TimeUnit> AddAssign for Duration<T, U>
source§fn add_assign(&mut self, rhs: Duration<T, U>)
fn add_assign(&mut self, rhs: Duration<T, U>)
Performs the
+=
operation. Read moresource§impl<T: Ord, U: Ord> Ord for Duration<T, U>
impl<T: Ord, U: Ord> Ord for Duration<T, U>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl<T: PartialEq, U: PartialEq> PartialEq for Duration<T, U>
impl<T: PartialEq, U: PartialEq> PartialEq for Duration<T, U>
source§impl<T: PartialOrd, U: PartialOrd> PartialOrd for Duration<T, U>
impl<T: PartialOrd, U: PartialOrd> PartialOrd for Duration<T, U>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl<T: Timeline, U: TimeUnit> SubAssign<Duration<T, U>> for Instant<T, U>
impl<T: Timeline, U: TimeUnit> SubAssign<Duration<T, U>> for Instant<T, U>
source§fn sub_assign(&mut self, dur: Duration<T, U>)
fn sub_assign(&mut self, dur: Duration<T, U>)
Performs the
-=
operation. Read moresource§impl<T: Timeline, U: TimeUnit> SubAssign for Duration<T, U>
impl<T: Timeline, U: TimeUnit> SubAssign for Duration<T, U>
source§fn sub_assign(&mut self, rhs: Duration<T, U>)
fn sub_assign(&mut self, rhs: Duration<T, U>)
Performs the
-=
operation. Read moreimpl<T: Copy, U: Copy> Copy for Duration<T, U>
impl<T: Eq, U: Eq> Eq for Duration<T, U>
impl<T, U> StructuralPartialEq for Duration<T, U>
Auto Trait Implementations§
impl<T, U> Freeze for Duration<T, U>
impl<T, U> RefUnwindSafe for Duration<T, U>where
T: RefUnwindSafe,
U: RefUnwindSafe,
impl<T, U> Send for Duration<T, U>
impl<T, U> Sync for Duration<T, U>
impl<T, U> Unpin for Duration<T, U>
impl<T, U> UnwindSafe for Duration<T, U>where
T: UnwindSafe,
U: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)