time: rename tokio::timer -> tokio::time (#1745)

This commit is contained in:
Carl Lerche
2019-11-06 23:53:46 -08:00
committed by GitHub
parent 4dbe6af0a1
commit 7e35922a1d
42 changed files with 101 additions and 124 deletions
+6 -7
View File
@@ -1,10 +1,9 @@
//! A mocked clock for use with `tokio::timer` based futures.
//! A mocked clock for use with `tokio::time` based futures.
//!
//! # Example
//!
//! ```
//! use tokio::clock;
//! use tokio::timer::delay;
//! use tokio::time::{clock, delay};
//! use tokio_test::{assert_ready, assert_pending, task};
//!
//! use std::time::Duration;
@@ -23,8 +22,8 @@
//! ```
use tokio::runtime::{Park, Unpark};
use tokio::timer::clock::{Clock, Now};
use tokio::timer::Timer;
use tokio::time::clock::{Clock, Now};
use tokio::time::Timer;
use std::marker::PhantomData;
use std::rc::Rc;
@@ -125,13 +124,13 @@ impl MockClock {
where
F: FnOnce(&mut Handle) -> R,
{
tokio::timer::clock::with_default(&self.clock, || {
tokio::time::clock::with_default(&self.clock, || {
let park = self.time.mock_park();
let timer = Timer::new(park);
let handle = timer.handle();
let time = self.time.clone();
let _timer = tokio::timer::set_default(&handle);
let _timer = tokio::time::set_default(&handle);
let mut handle = Handle::new(timer, time);
f(&mut handle)
// lazy(|| Ok::<_, ()>(f(&mut handle))).wait().unwrap()
+1 -1
View File
@@ -18,7 +18,7 @@
use tokio::io::{AsyncRead, AsyncWrite};
use tokio::sync::mpsc;
use tokio::timer::{clock, timer, Delay};
use tokio::time::{clock, timer, Delay};
use bytes::Buf;
use futures_core::ready;