time: introduce sleep and sleep_until functions (#2826)

This commit is contained in:
Juan Alvarez
2020-10-01 09:24:33 +02:00
committed by GitHub
parent 971ed2c6df
commit 53ccfc1fd6
31 changed files with 152 additions and 153 deletions
+4 -4
View File
@@ -37,14 +37,14 @@ use core::task::{Context, Poll, Waker};
/// // The token was cancelled
/// 5
/// }
/// _ = tokio::time::delay_for(std::time::Duration::from_secs(9999)) => {
/// _ = tokio::time::sleep(std::time::Duration::from_secs(9999)) => {
/// 99
/// }
/// }
/// });
///
/// tokio::spawn(async move {
/// tokio::time::delay_for(std::time::Duration::from_millis(10)).await;
/// tokio::time::sleep(std::time::Duration::from_millis(10)).await;
/// token.cancel();
/// });
///
@@ -185,14 +185,14 @@ impl CancellationToken {
/// // The token was cancelled
/// 5
/// }
/// _ = tokio::time::delay_for(std::time::Duration::from_secs(9999)) => {
/// _ = tokio::time::sleep(std::time::Duration::from_secs(9999)) => {
/// 99
/// }
/// }
/// });
///
/// tokio::spawn(async move {
/// tokio::time::delay_for(std::time::Duration::from_millis(10)).await;
/// tokio::time::sleep(std::time::Duration::from_millis(10)).await;
/// token.cancel();
/// });
///