pub struct Instant(/* private fields */);
Expand description
Instant represents a number of nanoseconds since some process-specific epoch.
On Windows this is backed by QueryUnbiasedInterruptTimePrecise. On Linux this is backed by CLOCK_MONOTONIC.
This is modeled after std::time::Instant but uses a different clock source on Windows, and it allows access to the raw value.
Implementations§
source§impl Instant
impl Instant
sourcepub fn as_nanos(&self) -> u64
pub fn as_nanos(&self) -> u64
Returns the value of the underlying clock in nanosecond resolution.
sourcepub fn from_nanos(nanos: u64) -> Self
pub fn from_nanos(nanos: u64) -> Self
Creates an instant from an underlying clock value in nanosecond resolution.
sourcepub fn saturating_add(self, duration: Duration) -> Self
pub fn saturating_add(self, duration: Duration) -> Self
Adds a duration to this instant, saturating at the maximum value of the clock.
Trait Implementations§
source§impl Ord for Instant
impl Ord for Instant
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 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
)