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.
This commit is contained in:
leo-lb
2019-11-06 21:28:21 -08:00
committed by Carl Lerche
parent 6f8b986bdb
commit 9bec094150
+2 -3
View File
@@ -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");
//! }
//! ```