Struct casper_types::TimeDiff
source · pub struct TimeDiff(/* private fields */);
Expand description
A time difference between two timestamps.
Implementations§
source§impl TimeDiff
impl TimeDiff
sourcepub fn millis(&self) -> u64
pub 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 Ord for TimeDiff
impl Ord for TimeDiff
source§impl PartialEq for TimeDiff
impl PartialEq for TimeDiff
source§impl PartialOrd for TimeDiff
impl PartialOrd for TimeDiff
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§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 StructuralEq for TimeDiff
impl StructuralPartialEq for TimeDiff
Auto Trait Implementations§
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