pub struct Timestamp { /* private fields */ }Expand description
Contract timestamp on the pinned RFC3339 profile.
Equality and ordering use the normalized UTC instant, so equivalent offsets compare equal. The original wire spelling is preserved for serialization.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn parse(text: &str) -> Result<Self, ValidationError>
pub fn parse(text: &str) -> Result<Self, ValidationError>
Parse a fail-closed RFC3339 timestamp.
Sourcepub fn compare(&self, other: &Self) -> i8
pub fn compare(&self, other: &Self) -> i8
Compare two timestamps after normalizing to UTC instants.
Returns -1, 0, or 1.
Sourcepub fn saturating_add(&self, duration: Duration) -> Self
pub fn saturating_add(&self, duration: Duration) -> Self
Add duration, saturating at this instant if the sum is unrepresentable.
Sourcepub fn duration_until(&self, later: &Self) -> Duration
pub fn duration_until(&self, later: &Self) -> Duration
Elapsed time from this instant until later, or zero if later is not after.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Timestamp
impl<'de> Deserialize<'de> for Timestamp
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
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
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