Struct quanta::Mock[][src]

pub struct Mock { /* fields omitted */ }
Expand description

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

Increments the time by the given amount.

Decrements the time by the given amount.

Gets the current value of this Mock.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.