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: StorageTime
pub const UNIX_EPOCH: StorageTime
The Unix epoch, the earliest storage time.
Sourcepub fn new(seconds: u64, nanos: u32) -> Result<StorageTime, Error>
pub fn new(seconds: u64, nanos: u32) -> Result<StorageTime, Error>
A sample whose fraction is below one second.
Sourcepub fn from_system_time(time: SystemTime) -> Result<StorageTime, Error>
pub fn from_system_time(time: SystemTime) -> Result<StorageTime, Error>
The exact provider time, refusing one before the Unix epoch.
Sourcepub fn since_epoch(since: Duration) -> StorageTime
pub fn since_epoch(since: Duration) -> StorageTime
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<StorageTime>
pub fn checked_add(self, duration: Duration) -> Option<StorageTime>
This time plus duration, or None past the representable range.
Sourcepub fn checked_sub(self, duration: Duration) -> Option<StorageTime>
pub fn checked_sub(self, duration: Duration) -> Option<StorageTime>
This time minus duration, or None before the Unix epoch.
Sourcepub fn duration_since(self, earlier: StorageTime) -> Option<Duration>
pub fn duration_since(self, earlier: StorageTime) -> 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§type Output = StorageTime
type Output = StorageTime
+ operator.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)
+= operation. Read moreSource§impl Clone for StorageTime
impl Clone for StorageTime
Source§fn clone(&self) -> StorageTime
fn clone(&self) -> StorageTime
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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<StorageTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StorageTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Hash for StorageTime
impl Hash for StorageTime
Source§impl Ord for StorageTime
impl Ord for StorageTime
Source§fn cmp(&self, other: &StorageTime) -> Ordering
fn cmp(&self, other: &StorageTime) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
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
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl Sub<Duration> for StorageTime
Panics before the Unix epoch; use checked_sub where that can happen.
impl Sub<Duration> for StorageTime
Panics before the Unix epoch; use checked_sub where that can happen.
Source§type Output = StorageTime
type Output = StorageTime
- operator.Source§impl TryFrom<StoredStorageTime> for StorageTime
impl TryFrom<StoredStorageTime> for StorageTime
impl Copy for StorageTime
impl Eq 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§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
§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
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more