pub struct Instant(/* private fields */);Expand description
A point on a monotonic timeline.
The origin is whatever the Timer chose; only differences are
meaningful. It never goes backwards and is unaffected by the wall clock changing.
Implementations§
Source§impl Instant
impl Instant
Sourcepub const fn from_micros(micros: u64) -> Self
pub const fn from_micros(micros: u64) -> Self
From microseconds since the origin.
Sourcepub const fn as_millis(self) -> u64
pub const fn as_millis(self) -> u64
As milliseconds since the origin — Core §7.19.2.7’s systime-ms.
Truncating, like every other reading of a coarser clock from a finer one. The specification’s own use of it is a client correlating its clock with the node’s (§11.12.7.3), where a sub-millisecond difference is below the jitter of the message carrying it.
Sourcepub const fn saturating_add(self, d: Duration) -> Self
pub const fn saturating_add(self, d: Duration) -> Self
This instant plus a span, saturating.
Sourcepub const fn saturating_sub(self, d: Duration) -> Self
pub const fn saturating_sub(self, d: Duration) -> Self
This instant minus a span, saturating at the origin.
Sourcepub const fn saturating_duration_since(self, earlier: Self) -> Duration
pub const fn saturating_duration_since(self, earlier: Self) -> Duration
How long from earlier to this instant; zero if this one is not later.
Sourcepub const fn is_elapsed_at(self, now: Self) -> bool
pub const fn is_elapsed_at(self, now: Self) -> bool
Whether this instant has been reached at now.
Trait Implementations§
impl Copy for Instant
impl Eq for Instant
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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for Instant
impl PartialOrd for Instant
impl StructuralPartialEq for Instant
Auto Trait Implementations§
impl Forget for Instant
impl Freeze for Instant
impl Move 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