pub struct Timestamp(/* private fields */);Expand description
A point in time, measured in 100-nanosecond ticks since the Unix epoch.
Unlike a raw i64, a Timestamp cannot be accidentally mixed with a
duration or another integer quantity — it is a value object with explicit,
total ordering. It is Copy and allocation-free.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub const fn from_ticks(ticks: i64) -> Self
pub const fn from_ticks(ticks: i64) -> Self
Creates a timestamp from raw 100ns ticks since the Unix epoch.
Sourcepub fn saturating_add(self, duration: Duration) -> Self
pub fn saturating_add(self, duration: Duration) -> Self
Adds a Duration, saturating at Timestamp::MAX instead of
overflowing. Used to derive expiration points from a “now”.
Sourcepub fn saturating_duration_since(self, earlier: Timestamp) -> Duration
pub fn saturating_duration_since(self, earlier: Timestamp) -> Duration
Returns the duration elapsed from earlier to self, or
Duration::ZERO if self is not after earlier.
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 Freeze 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.