[−][src]Struct sn_fake_clock::FakeClock
Struct representing a fake instant
Implementations
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 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 Add<Duration> for FakeClock
[src]
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Duration) -> FakeClock
[src]
impl Clone for FakeClock
[src]
impl Copy for FakeClock
[src]
impl Debug for FakeClock
[src]
impl Eq for FakeClock
[src]
impl Hash for FakeClock
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for FakeClock
[src]
fn cmp(&self, other: &FakeClock) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]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]
fn lt(&self, other: &FakeClock) -> bool
[src]
fn le(&self, other: &FakeClock) -> bool
[src]
fn gt(&self, other: &FakeClock) -> bool
[src]
fn ge(&self, other: &FakeClock) -> bool
[src]
impl StructuralEq for FakeClock
[src]
impl StructuralPartialEq for FakeClock
[src]
impl Sub<Duration> for FakeClock
[src]
type Output = Self
The resulting type after applying the -
operator.
fn sub(self, other: Duration) -> FakeClock
[src]
impl Sub<FakeClock> for FakeClock
[src]
Auto Trait Implementations
impl RefUnwindSafe for FakeClock
impl Send for FakeClock
impl Sync for FakeClock
impl Unpin for FakeClock
impl UnwindSafe for FakeClock
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,