pub struct StorageTime { /* private fields */ }Expand description
A provider storage time: Unix seconds and a nanosecond fraction (§20.5).
It keeps every returned digit on every platform, unlike SystemTime,
which counts 100 ns on Windows; ordering is time order.
Implementations§
Source§impl StorageTime
impl StorageTime
Sourcepub const UNIX_EPOCH: Self
pub const UNIX_EPOCH: Self
The Unix epoch, the earliest storage time.
Sourcepub fn new(seconds: u64, nanos: u32) -> Result<Self, Error>
pub fn new(seconds: u64, nanos: u32) -> Result<Self, Error>
A sample whose fraction is below one second.
Sourcepub fn from_system_time(time: SystemTime) -> Result<Self, Error>
pub fn from_system_time(time: SystemTime) -> Result<Self, Error>
The exact provider time, refusing one before the Unix epoch.
Sourcepub fn since_epoch(since: Duration) -> Self
pub fn since_epoch(since: Duration) -> Self
The time since the Unix epoch.
Sourcepub fn elapsed_since_epoch(self) -> Duration
pub fn elapsed_since_epoch(self) -> Duration
The exact time elapsed since the Unix epoch.
Sourcepub fn checked_add(self, duration: Duration) -> Option<Self>
pub fn checked_add(self, duration: Duration) -> Option<Self>
This time plus duration, or None past the representable range.
Sourcepub fn checked_sub(self, duration: Duration) -> Option<Self>
pub fn checked_sub(self, duration: Duration) -> Option<Self>
This time minus duration, or None before the Unix epoch.
Sourcepub fn duration_since(self, earlier: Self) -> Option<Duration>
pub fn duration_since(self, earlier: Self) -> Option<Duration>
The exact time from earlier to this time, or None if earlier is later.
Trait Implementations§
Source§impl Add<Duration> for StorageTime
Panics past the representable range, as SystemTime does; use
checked_add where the duration is not known to fit.
impl Add<Duration> for StorageTime
Panics past the representable range, as SystemTime does; use
checked_add where the duration is not known to fit.
Source§impl AddAssign<Duration> for StorageTime
impl AddAssign<Duration> for StorageTime
Source§fn add_assign(&mut self, duration: Duration)
fn add_assign(&mut self, duration: Duration)
Performs the
+= operation. Read moreSource§impl Clone for StorageTime
impl Clone for StorageTime
impl Copy for StorageTime
Source§impl Debug for StorageTime
impl Debug for StorageTime
Source§impl<'de> Deserialize<'de> for StorageTime
impl<'de> Deserialize<'de> for StorageTime
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for StorageTime
Source§impl Hash for StorageTime
impl Hash for StorageTime
Source§impl Ord for StorageTime
impl Ord for StorageTime
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 PartialEq for StorageTime
impl PartialEq for StorageTime
Source§impl PartialOrd for StorageTime
impl PartialOrd for StorageTime
Source§impl Serialize for StorageTime
impl Serialize for StorageTime
impl StructuralPartialEq for StorageTime
Auto Trait Implementations§
impl Freeze for StorageTime
impl RefUnwindSafe for StorageTime
impl Send for StorageTime
impl Sync for StorageTime
impl Unpin for StorageTime
impl UnsafeUnpin for StorageTime
impl UnwindSafe for StorageTime
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more