pub struct Instant(/* private fields */);Expand description
A measurement of a monotonically nondecreasing clock.
Implementations§
Source§impl Instant
impl Instant
Sourcepub fn elapsed(&self) -> Duration
pub fn elapsed(&self) -> Duration
Returns the amount of time elapsed since this instant.
Prefer elapsed_secs_f64() if used for metrics.
Sourcepub fn elapsed_secs_f64(&self) -> f64
pub fn elapsed_secs_f64(&self) -> f64
Returns the number of seconds elapsed since this instant.
This method saturates to zero.
Sourcepub fn elapsed_nanos(&self) -> u64
pub fn elapsed_nanos(&self) -> u64
Returns the number of nanoseconds elapsed since this instant.
This method saturates to zero.
Sourcepub fn duration_since(&self, earlier: Self) -> Duration
pub fn duration_since(&self, earlier: Self) -> Duration
Returns the amount of time elapsed from another instant to this one.
This method saturates to zero.
Prefer secs_f64_since() if used for metrics.
Sourcepub fn secs_f64_since(&self, earlier: Self) -> f64
pub fn secs_f64_since(&self, earlier: Self) -> f64
Returns the number of seconds elapsed from another instant to this one.
This method saturates to zero.
Sourcepub fn nanos_since(&self, earlier: Self) -> u64
pub fn nanos_since(&self, earlier: Self) -> u64
Returns the number of nanosecs elapsed from another instant to this one.
This method saturates to zero.
Trait Implementations§
Source§impl Ord for Instant
impl Ord for Instant
1.21.0 (const: unstable) · 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 PartialOrd for Instant
impl PartialOrd for Instant
impl Copy for Instant
impl Eq for Instant
impl StructuralPartialEq for Instant
Auto Trait Implementations§
impl Freeze for Instant
impl RefUnwindSafe for Instant
impl Send for Instant
impl Sync for Instant
impl Unpin for Instant
impl UnsafeUnpin for Instant
impl UnwindSafe for Instant
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