Struct mock_instant::SystemTime
source · pub struct SystemTime(/* private fields */);
Expand description
A simple deterministic SystemTime wrapped around a modifiable Duration
This used a thread-local state as the ‘wall clock’ that is configurable via
the MockClock
Implementations§
source§impl SystemTime
impl SystemTime
pub const UNIX_EPOCH: SystemTime = UNIX_EPOCH
pub fn now() -> Self
pub fn duration_since( &self, earlier: SystemTime ) -> Result<Duration, SystemTimeError>
pub fn elapsed(&self) -> Result<Duration, SystemTimeError>
pub fn checked_add(&self, duration: Duration) -> Option<SystemTime>
pub fn checked_sub(&self, duration: Duration) -> Option<SystemTime>
Trait Implementations§
source§impl Add<Duration> for SystemTime
impl Add<Duration> for SystemTime
source§impl AddAssign<Duration> for SystemTime
impl AddAssign<Duration> for SystemTime
source§fn add_assign(&mut self, rhs: Duration)
fn add_assign(&mut self, rhs: Duration)
Performs the
+=
operation. Read moresource§impl Clone for SystemTime
impl Clone for SystemTime
source§fn clone(&self) -> SystemTime
fn clone(&self) -> SystemTime
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SystemTime
impl Debug for SystemTime
source§impl From<SystemTime> for SystemTime
impl From<SystemTime> for SystemTime
source§fn from(value: SystemTime) -> Self
fn from(value: SystemTime) -> Self
Converts to this type from the input type.
source§impl From<SystemTime> for SystemTime
impl From<SystemTime> for SystemTime
source§fn from(value: SystemTime) -> Self
fn from(value: SystemTime) -> Self
Converts to this type from the input type.
source§impl Hash for SystemTime
impl Hash for SystemTime
source§impl Ord for SystemTime
impl Ord for SystemTime
source§fn cmp(&self, other: &SystemTime) -> Ordering
fn cmp(&self, other: &SystemTime) -> Ordering
1.21.0 · 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
source§impl PartialEq for SystemTime
impl PartialEq for SystemTime
source§fn eq(&self, other: &SystemTime) -> bool
fn eq(&self, other: &SystemTime) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for SystemTime
impl PartialOrd for SystemTime
source§fn partial_cmp(&self, other: &SystemTime) -> Option<Ordering>
fn partial_cmp(&self, other: &SystemTime) -> Option<Ordering>
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 Sub<Duration> for SystemTime
impl Sub<Duration> for SystemTime
source§impl SubAssign<Duration> for SystemTime
impl SubAssign<Duration> for SystemTime
source§fn sub_assign(&mut self, rhs: Duration)
fn sub_assign(&mut self, rhs: Duration)
Performs the
-=
operation. Read moreimpl Copy for SystemTime
impl Eq for SystemTime
impl StructuralPartialEq for SystemTime
Auto Trait Implementations§
impl RefUnwindSafe for SystemTime
impl Send for SystemTime
impl Sync for SystemTime
impl Unpin for SystemTime
impl UnwindSafe for SystemTime
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