From 9bec094150e869caae5105d7080f0ae54757b2d9 Mon Sep 17 00:00:00 2001 From: leo-lb Date: Thu, 7 Nov 2019 06:28:21 +0100 Subject: [PATCH] timer: have example use delay_for instead of delay (#1735) It is a more common use case that is to simply cause a delay for an amount of time. I think it is more appropriate to show off `delay_for` in the example rather than `delay` that is useful only for less common use cases. --- tokio/src/timer/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tokio/src/timer/mod.rs b/tokio/src/timer/mod.rs index d05dca84d..5af959244 100644 --- a/tokio/src/timer/mod.rs +++ b/tokio/src/timer/mod.rs @@ -30,15 +30,14 @@ //! Wait 100ms and print "Hello World!" //! //! ``` -//! use tokio::timer::delay; +//! use tokio::timer::delay_for; //! //! use std::time::Duration; //! //! //! #[tokio::main] //! async fn main() { -//! let when = tokio::clock::now() + Duration::from_millis(100); -//! delay(when).await; +//! delay_for(Duration::from_millis(100)).await; //! println!("100 ms have elapsed"); //! } //! ```