[−][src]Struct fake_instant::FakeClock
Struct representing a fake instant
Methods
impl FakeClock
[src]
pub fn set_time(time: u64)
[src]
Sets the thread-local fake time to the given value
pub fn advance_time(millis: u64)
[src]
Advances the thread-local fake time by the given amount of milliseconds
pub fn time() -> u64
[src]
Returns the current thread-local fake time
pub fn now() -> Self
[src]
Returns a FakeClock
instance representing the current instant.
pub fn duration_since(self, earlier: Self) -> Duration
[src]
Returns the duration that passed between self
and earlier
.
pub fn checked_duration_since(&self, earlier: FakeClock) -> Option<Duration>
[src]
Returns the amount of fake time elapsed from another FakeClock
to
this one, or None
if that FakeClock
is earlier than this one.
pub fn saturating_duration_since(&self, earlier: FakeClock) -> Duration
[src]
Returns the amount of fake time elapsed from another FakeClock
to
this one, or zero duration if that FakeClock
is earlier than this one.
pub fn elapsed(self) -> Duration
[src]
Returns how much fake time has elapsed since the creation of self
.
pub fn checked_add(&self, duration: Duration) -> Option<FakeClock>
[src]
Returns Some(t)
where t
is the time self + duration
if t
can be
represented as FakeClock
, None
otherwise.
pub fn checked_sub(&self, duration: Duration) -> Option<FakeClock>
[src]
Returns Some(t)
where t
is the time self - duration
if t
can be
represented as FakeClock
, None
otherwise.
Trait Implementations
impl Clone for FakeClock
[src]
impl Copy for FakeClock
[src]
impl Eq for FakeClock
[src]
impl Ord for FakeClock
[src]
fn cmp(&self, other: &FakeClock) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<FakeClock> for FakeClock
[src]
impl PartialOrd<FakeClock> for FakeClock
[src]
fn partial_cmp(&self, other: &FakeClock) -> Option<Ordering>
[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Debug for FakeClock
[src]
impl Sub<Duration> for FakeClock
[src]
type Output = FakeClock
The resulting type after applying the -
operator.
fn sub(self, other: Duration) -> FakeClock
[src]
impl Sub<FakeClock> for FakeClock
[src]
type Output = Duration
The resulting type after applying the -
operator.
fn sub(self, other: FakeClock) -> Duration
[src]
impl Add<Duration> for FakeClock
[src]
Auto Trait Implementations
impl Send for FakeClock
impl Sync for FakeClock
impl Unpin for FakeClock
impl UnwindSafe for FakeClock
impl RefUnwindSafe for FakeClock
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,