pub struct Timestamp(/* private fields */);Expand description
A point in time: microseconds from an arbitrary monotonic epoch.
Only differences between timestamps from one Clock mean anything. A type of its own
rather than a bare u64, so microseconds are not mixed with other counts; u64
microseconds do not wrap in any lifetime a device has.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_micros(micros: u64) -> Timestamp
pub const fn from_micros(micros: u64) -> Timestamp
The timestamp micros microseconds after the epoch.
Sourcepub const fn checked_duration_since(
self,
earlier: Timestamp,
) -> Option<Duration>
pub const fn checked_duration_since( self, earlier: Timestamp, ) -> Option<Duration>
The time from earlier to self, or None if earlier is later.
Sourcepub const fn saturating_duration_since(self, earlier: Timestamp) -> Duration
pub const fn saturating_duration_since(self, earlier: Timestamp) -> Duration
The time from earlier to self, or zero if earlier is later.
Sourcepub const fn checked_add(self, duration: Duration) -> Option<Timestamp>
pub const fn checked_add(self, duration: Duration) -> Option<Timestamp>
The timestamp duration after self, or None on overflow.
A duration that is not a whole number of microseconds is rounded up, so a deadline computed with it is never earlier than asked.
Trait Implementations§
impl Copy for Timestamp
impl Eq for Timestamp
Source§impl Ord for Timestamp
impl Ord for Timestamp
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 Timestamp
impl PartialOrd for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Forget for Timestamp
impl Freeze for Timestamp
impl Move for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnsafeUnpin for Timestamp
impl UnwindSafe for Timestamp
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