From 31ec456b454466a8f0138119b91b74fd965ae2e0 Mon Sep 17 00:00:00 2001 From: Kornel Date: Sun, 14 Feb 2021 14:35:50 +0000 Subject: [PATCH] Doc aliases for pre-1.0 function names --- tokio/src/io/async_fd.rs | 1 + tokio/src/runtime/builder.rs | 1 + tokio/src/sync/notify.rs | 1 + tokio/src/time/driver/sleep.rs | 2 ++ 4 files changed, 5 insertions(+) diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 13f4f2d62e9..f4c9699ec68 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -519,6 +519,7 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> { /// create this `AsyncFdReadyGuard`. /// /// [`WouldBlock`]: std::io::ErrorKind::WouldBlock + #[doc(alias = "with_io")] pub fn try_io( &mut self, f: impl FnOnce(&AsyncFd) -> io::Result, diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 33b63e1fe66..90eea82ff88 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -233,6 +233,7 @@ impl Builder { /// # Panic /// /// This will panic if `val` is not larger than `0`. + #[doc(alias = "max_threads")] pub fn max_blocking_threads(&mut self, val: usize) -> &mut Self { assert!(val > 0, "Max blocking threads cannot be set to 0"); self.max_blocking_threads = val; diff --git a/tokio/src/sync/notify.rs b/tokio/src/sync/notify.rs index f39f92f8374..6426d4008c8 100644 --- a/tokio/src/sync/notify.rs +++ b/tokio/src/sync/notify.rs @@ -312,6 +312,7 @@ impl Notify { /// notify.notify_one(); /// } /// ``` + #[doc(alias = "notify")] pub fn notify_one(&self) { // Load the current state let mut curr = self.state.load(SeqCst); diff --git a/tokio/src/time/driver/sleep.rs b/tokio/src/time/driver/sleep.rs index ef1c7212774..501c77d859d 100644 --- a/tokio/src/time/driver/sleep.rs +++ b/tokio/src/time/driver/sleep.rs @@ -16,6 +16,7 @@ use std::task::{self, Poll}; /// /// Canceling a sleep instance is done by dropping the returned future. No additional /// cleanup work is required. +#[doc(alias = "delay_until")] pub fn sleep_until(deadline: Instant) -> Sleep { Sleep::new_timeout(deadline) } @@ -53,6 +54,7 @@ pub fn sleep_until(deadline: Instant) -> Sleep { /// ``` /// /// [`interval`]: crate::time::interval() +#[doc(alias = "delay_for")] pub fn sleep(duration: Duration) -> Sleep { sleep_until(Instant::now() + duration) }