pub struct MockClock { /* private fields */ }
Expand description

A Clock which can be set to arbitrary timestamps for testing purposes.

It can be used in a test case as demonstrated in the following example:

use futures_intrusive::timer::MockClock;

static TEST_CLOCK: MockClock = MockClock::new();
TEST_CLOCK.set_time(2300); // Set the current time
let timer = TimerService::new(&TEST_CLOCK);

Implementations

Creates a new instance of the MockClock, which is initialized to timestamp 0.

Sets the current timestamp inside to MockClock to the given value

Trait Implementations

Returns a timestamp in milliseconds which represents the current time according to the clock. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.