pub struct Instant(/* private fields */);
Expand description
Nanoseconds since some arbitrary epoch.
This is used for high-resolution timing and scheduling decisions. The actual epoch is implementation-defined and may vary between architectures.
Implementations§
Source§impl Instant
impl Instant
Sourcepub fn from_nanos(nanos: u64) -> Self
pub fn from_nanos(nanos: u64) -> Self
Create a new instant from nanoseconds since epoch.
Sourcepub fn as_nanos_u128(self) -> u128
pub fn as_nanos_u128(self) -> u128
Get nanoseconds since epoch as u128 for calculations.
Sourcepub fn now() -> Self
pub fn now() -> Self
Get the current instant.
This reads the current time from the architecture-specific timer.
Sourcepub fn duration_since(self, earlier: Instant) -> Duration
pub fn duration_since(self, earlier: Instant) -> Duration
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