[][src]Module tokio01_test::clock

A mocked clock for use with tokio_timer based futures.

Example

clock::mock(|handle| {
    let mut delay = Delay::new(handle.now() + Duration::from_secs(1));

    assert_not_ready!(delay.poll());

    handle.advance(Duration::from_secs(1));

    assert_ready!(delay.poll());
});

Structs

Handle

A handle to the MockClock.

MockClock

Mock clock for use with tokio-timer futures.

Functions

mock

Run the provided closure with a MockClock that starts at the current time.

mock_at

Run the provided closure with a MockClock that starts at the provided Instant.