[−][src]Struct quanta::Mock
Controllable time source for use in tests.
A mocked clock allows the caller to adjust the given time backwards and forwards by whatever
amount they choose. While Clock
promises monotonic values for normal readings,
when running in mocked mode, these guarantees do not apply: the given Clock
/Mock
pair are
directly coupled.
This can be useful for not only testing code that depends on the passage of time, but also for testing that code can handle large shifts in time.
Implementations
impl Mock
[src]
pub fn increment<N: IntoNanoseconds>(&self, amount: N)
[src]
Increments the time by the given amount.
pub fn decrement<N: IntoNanoseconds>(&self, amount: N)
[src]
Decrements the time by the given amount.
pub fn value(&self) -> u64
[src]
Gets the current value of this Mock
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Mock
impl Send for Mock
impl Sync for Mock
impl Unpin for Mock
impl UnwindSafe for Mock
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>,