[−][src]Module tokio_test::clock
A mocked clock for use with tokio_timer
based futures.
Example
use tokio::clock; use tokio_test::{assert_ready, assert_pending, task}; use tokio_timer::delay; use std::time::Duration; tokio_test::clock::mock(|handle| { let mut task = task::spawn(async { delay(clock::now() + Duration::from_secs(1)).await }); assert_pending!(task.poll()); handle.advance(Duration::from_secs(1)); assert_ready!(task.poll()); });
Structs
Handle | A handle to the |
MockClock | Mock clock for use with |
Functions
mock | Run the provided closure with a |
mock_at | Run the provided closure with a |