pub struct TimeDiff(/* private fields */);
Expand description
A time difference between two timestamps.
Implementations§
Source§impl TimeDiff
impl TimeDiff
Sourcepub const fn millis(&self) -> u64
pub const fn millis(&self) -> u64
Returns the time difference as the number of milliseconds since the Unix epoch
Sourcepub const fn from_seconds(seconds: u32) -> Self
pub const fn from_seconds(seconds: u32) -> Self
Creates a new time difference from seconds.
Sourcepub const fn from_millis(millis: u64) -> Self
pub const fn from_millis(millis: u64) -> Self
Creates a new time difference from milliseconds.
Sourcepub fn saturating_add(self, rhs: u64) -> Self
pub fn saturating_add(self, rhs: u64) -> Self
Returns the sum, or TimeDiff(u64::MAX)
if it would overflow.
Sourcepub fn saturating_mul(self, rhs: u64) -> Self
pub fn saturating_mul(self, rhs: u64) -> Self
Returns the product, or TimeDiff(u64::MAX)
if it would overflow.
Sourcepub fn checked_mul(self, rhs: u64) -> Option<Self>
pub fn checked_mul(self, rhs: u64) -> Option<Self>
Returns the product, or None
if it would overflow.
Trait Implementations§
Source§impl AddAssign<TimeDiff> for Timestamp
impl AddAssign<TimeDiff> for Timestamp
Source§fn add_assign(&mut self, rhs: TimeDiff)
fn add_assign(&mut self, rhs: TimeDiff)
Performs the
+=
operation. Read moreSource§impl AddAssign for TimeDiff
impl AddAssign for TimeDiff
Source§fn add_assign(&mut self, rhs: TimeDiff)
fn add_assign(&mut self, rhs: TimeDiff)
Performs the
+=
operation. Read moreSource§impl DataSize for TimeDiff
impl DataSize for TimeDiff
Source§const IS_DYNAMIC: bool = false
const IS_DYNAMIC: bool = false
If
true
, the type has a heap size that can vary at runtime, depending on the actual value.Source§const STATIC_HEAP_SIZE: usize = 0usize
const STATIC_HEAP_SIZE: usize = 0usize
The amount of space a value of the type always occupies. If
IS_DYNAMIC
is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.Source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
Estimates the size of heap memory taken up by this value. Read more
Source§impl<'de> Deserialize<'de> for TimeDiff
Available on crate feature std
only.
impl<'de> Deserialize<'de> for TimeDiff
Available on crate feature
std
only.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
Source§impl JsonSchema for TimeDiff
impl JsonSchema for TimeDiff
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref
keyword. Read moreSource§impl Ord for TimeDiff
impl Ord for TimeDiff
Source§impl PartialOrd for TimeDiff
impl PartialOrd for TimeDiff
Source§impl SubAssign for TimeDiff
impl SubAssign for TimeDiff
Source§fn sub_assign(&mut self, rhs: TimeDiff)
fn sub_assign(&mut self, rhs: TimeDiff)
Performs the
-=
operation. Read moreSource§impl ToBytes for TimeDiff
impl ToBytes for TimeDiff
Source§fn serialized_length(&self) -> usize
fn serialized_length(&self) -> usize
Returns the length of the
Vec<u8>
which would be returned from a successful call to
to_bytes()
or into_bytes()
. The data is not actually serialized, so this call is
relatively cheap.impl Copy for TimeDiff
impl Eq for TimeDiff
impl StructuralPartialEq for TimeDiff
Auto Trait Implementations§
impl Freeze for TimeDiff
impl RefUnwindSafe for TimeDiff
impl Send for TimeDiff
impl Sync for TimeDiff
impl Unpin for TimeDiff
impl UnwindSafe for TimeDiff
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.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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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