Skip to content

Commit

Permalink
Doc aliases for pre-1.0 function names
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Feb 14, 2021
1 parent e3f2dcf commit 31ec456
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions tokio/src/io/async_fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<R>(
&mut self,
f: impl FnOnce(&AsyncFd<Inner>) -> io::Result<R>,
Expand Down
1 change: 1 addition & 0 deletions tokio/src/runtime/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions tokio/src/sync/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions tokio/src/time/driver/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 31ec456

Please sign in to comment.