summaryrefslogtreecommitdiffstats
path: root/tokio/src/time/instant.rs
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/src/time/instant.rs
parent971ed2c6df9cb3bf3543a9c780662a0b4d1a8d40 (diff)
time: introduce `sleep` and `sleep_until` functions (#2826)
Diffstat (limited to 'tokio/src/time/instant.rs')
-rw-r--r--tokio/src/time/instant.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/tokio/src/time/instant.rs b/tokio/src/time/instant.rs
index f2cb4bc9..e14a3004 100644
--- a/tokio/src/time/instant.rs
+++ b/tokio/src/time/instant.rs
@@ -50,12 +50,12 @@ impl Instant {
/// # Examples
///
/// ```
- /// use tokio::time::{Duration, Instant, delay_for};
+ /// use tokio::time::{Duration, Instant, sleep};
///
/// #[tokio::main]
/// async fn main() {
/// let now = Instant::now();
- /// delay_for(Duration::new(1, 0)).await;
+ /// sleep(Duration::new(1, 0)).await;
/// let new_now = Instant::now();
/// println!("{:?}", new_now.checked_duration_since(now));
/// println!("{:?}", now.checked_duration_since(new_now)); // None
@@ -71,12 +71,12 @@ impl Instant {
/// # Examples
///
/// ```
- /// use tokio::time::{Duration, Instant, delay_for};
+ /// use tokio::time::{Duration, Instant, sleep};
///
/// #[tokio::main]
/// async fn main() {
/// let now = Instant::now();
- /// delay_for(Duration::new(1, 0)).await;
+ /// sleep(Duration::new(1, 0)).await;
/// let new_now = Instant::now();
/// println!("{:?}", new_now.saturating_duration_since(now));
/// println!("{:?}", now.saturating_duration_since(new_now)); // 0ns
@@ -97,13 +97,13 @@ impl Instant {
/// # Examples
///
/// ```
- /// use tokio::time::{Duration, Instant, delay_for};
+ /// use tokio::time::{Duration, Instant, sleep};
///
/// #[tokio::main]
/// async fn main() {
/// let instant = Instant::now();
/// let three_secs = Duration::from_secs(3);
- /// delay_for(three_secs).await;
+ /// sleep(three_secs).await;
/// assert!(instant.elapsed() >= three_secs);
/// }
/// ```