pub struct Instant<Clock>where
Clock: Clock,{ /* private fields */ }Expand description
A measurement of a monotonically non-decreasing clock.
An Instant is generic over a Clock, preventing arithmetic operations
between instants of different clocks at compile-time.
Implementations§
Source§impl<Clock> Instant<Clock>where
Clock: Clock,
impl<Clock> Instant<Clock>where
Clock: Clock,
Sourcepub const fn from_ticks(ticks: u64) -> Instant<Clock>
pub const fn from_ticks(ticks: u64) -> Instant<Clock>
Creates a new Instant from a raw tick count.
Sourcepub const fn checked_add_duration(
self,
duration: Duration<Clock>,
) -> Option<Instant<Clock>>
pub const fn checked_add_duration( self, duration: Duration<Clock>, ) -> Option<Instant<Clock>>
Returns the Instant resulting from adding Duration, or None if overflow occurred.
Sourcepub const fn checked_sub_duration(
self,
duration: Duration<Clock>,
) -> Option<Instant<Clock>>
pub const fn checked_sub_duration( self, duration: Duration<Clock>, ) -> Option<Instant<Clock>>
Returns the Instant resulting from subtracting Duration, or None if underflow occurred.
Trait Implementations§
Source§impl<Clock> Ord for Instant<Clock>where
Clock: Clock,
impl<Clock> Ord for Instant<Clock>where
Clock: Clock,
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<Clock> PartialOrd for Instant<Clock>where
Clock: Clock,
impl<Clock> PartialOrd for Instant<Clock>where
Clock: Clock,
impl<Clock> Copy for Instant<Clock>where
Clock: Clock,
impl<Clock> Eq for Instant<Clock>where
Clock: Clock,
Auto Trait Implementations§
impl<Clock> Freeze for Instant<Clock>
impl<Clock> RefUnwindSafe for Instant<Clock>where
Clock: RefUnwindSafe,
impl<Clock> Send for Instant<Clock>where
Clock: Send,
impl<Clock> Sync for Instant<Clock>where
Clock: Sync,
impl<Clock> Unpin for Instant<Clock>where
Clock: Unpin,
impl<Clock> UnsafeUnpin for Instant<Clock>
impl<Clock> UnwindSafe for Instant<Clock>where
Clock: 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