Struct sn_fake_clock::FakeClock[][src]

pub struct FakeClock { /* fields omitted */ }

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 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 Add<Duration> for FakeClock[src]

type Output = Self

The resulting type after applying the + operator.

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]

impl Ord for FakeClock[src]

impl PartialEq<FakeClock> for FakeClock[src]

impl PartialOrd<FakeClock> for FakeClock[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.

impl Sub<FakeClock> for FakeClock[src]

type Output = Duration

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.