summaryrefslogtreecommitdiffstats
path: root/tokio-test
diff options
context:
space:
mode:
authorJuan Alvarez <j@yabit.io>2020-10-01 02:24:33 -0500
committerGitHub <noreply@github.com>2020-10-01 09:24:33 +0200
commit53ccfc1fd694ee70c7a4d1e7af09a856bafb49e5 (patch)
tree66f0b4c089729616b57bbb69b0a6351b45a0c898 /tokio-test
parent971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40 (diff)
time: introduce `sleep` and `sleep_until` functions (#2826)
Diffstat (limited to 'tokio-test')
-rw-r--r--tokio-test/src/io.rs4
-rw-r--r--tokio-test/tests/block_on.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/tokio-test/src/io.rs b/tokio-test/src/io.rs
index b91ddc34..3d04a58a 100644
--- a/tokio-test/src/io.rs
+++ b/tokio-test/src/io.rs
@@ -365,7 +365,7 @@ impl AsyncRead for Mock {
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
if let Some(rem) = self.inner.remaining_wait() {
let until = Instant::now() + rem;
- self.inner.sleep = Some(time::delay_until(until));
+ self.inner.sleep = Some(time::sleep_until(until));
} else {
self.inner.read_wait = Some(cx.waker().clone());
return Poll::Pending;
@@ -410,7 +410,7 @@ impl AsyncWrite for Mock {
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {
if let Some(rem) = self.inner.remaining_wait() {
let until = Instant::now() + rem;
- self.inner.sleep = Some(time::delay_until(until));
+ self.inner.sleep = Some(time::sleep_until(until));
} else {
panic!("unexpected WouldBlock");
}
diff --git a/tokio-test/tests/block_on.rs b/tokio-test/tests/block_on.rs
index d640a13c..280471df 100644
--- a/tokio-test/tests/block_on.rs
+++ b/tokio-test/tests/block_on.rs
@@ -1,6 +1,6 @@
#![warn(rust_2018_idioms)]
-use tokio::time::{delay_until, Duration, Instant};
+use tokio::time::{sleep_until, Duration, Instant};
use tokio_test::block_on;
#[test]
@@ -22,6 +22,6 @@ fn test_delay() {
let deadline = Instant::now() + Duration::from_millis(100);
block_on(async {
- delay_until(deadline).await;
+ sleep_until(deadline).await;
});
}