Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc aliases for pre-1.0 function names #3523

Merged
merged 1 commit into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tokio/src/io/async_fd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,8 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> {
/// create this `AsyncFdReadyGuard`.
///
/// [`WouldBlock`]: std::io::ErrorKind::WouldBlock
// Alias for old name in 0.x
#[cfg_attr(docsrs, doc(alias = "with_io"))]
pub fn try_io<R>(
&mut self,
f: impl FnOnce(&AsyncFd<Inner>) -> io::Result<R>,
Expand Down
6 changes: 6 additions & 0 deletions tokio/src/runtime/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ impl Builder {
/// # Panic
///
/// This will panic if `val` is not larger than `0`.
///
/// # Upgrading from 0.x
///
/// In old versions `max_threads` limited both blocking and worker threads, but the
/// current `max_blocking_threads` does not include async worker threads in the count.
#[cfg_attr(docsrs, 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
2 changes: 2 additions & 0 deletions tokio/src/sync/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ impl Notify {
/// notify.notify_one();
/// }
/// ```
// Alias for old name in 0.x
#[cfg_attr(docsrs, doc(alias = "notify"))]
pub fn notify_one(&self) {
// Load the current state
let mut curr = self.state.load(SeqCst);
Expand Down
4 changes: 4 additions & 0 deletions tokio/src/time/driver/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ use std::task::{self, Poll};
///
/// Canceling a sleep instance is done by dropping the returned future. No additional
/// cleanup work is required.
// Alias for old name in 0.x
#[cfg_attr(docsrs, doc(alias = "delay_until"))]
pub fn sleep_until(deadline: Instant) -> Sleep {
Sleep::new_timeout(deadline)
}
Expand Down Expand Up @@ -53,6 +55,8 @@ pub fn sleep_until(deadline: Instant) -> Sleep {
/// ```
///
/// [`interval`]: crate::time::interval()
// Alias for old name in 0.x
#[cfg_attr(docsrs, doc(alias = "delay_for"))]
pub fn sleep(duration: Duration) -> Sleep {
sleep_until(Instant::now() + duration)
}
Expand Down