mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
doc: doc aliases for pre-1.0 function names (#3523)
This commit is contained in:
parent
36bcfa6b9d
commit
6fd06aaeec
@ -519,6 +519,8 @@ impl<'a, Inner: AsRawFd> AsyncFdReadyGuard<'a, Inner> {
|
|||||||
/// create this `AsyncFdReadyGuard`.
|
/// create this `AsyncFdReadyGuard`.
|
||||||
///
|
///
|
||||||
/// [`WouldBlock`]: std::io::ErrorKind::WouldBlock
|
/// [`WouldBlock`]: std::io::ErrorKind::WouldBlock
|
||||||
|
// Alias for old name in 0.x
|
||||||
|
#[cfg_attr(docsrs, doc(alias = "with_io"))]
|
||||||
pub fn try_io<R>(
|
pub fn try_io<R>(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: impl FnOnce(&AsyncFd<Inner>) -> io::Result<R>,
|
f: impl FnOnce(&AsyncFd<Inner>) -> io::Result<R>,
|
||||||
|
@ -233,6 +233,12 @@ impl Builder {
|
|||||||
/// # Panic
|
/// # Panic
|
||||||
///
|
///
|
||||||
/// This will panic if `val` is not larger than `0`.
|
/// 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 {
|
pub fn max_blocking_threads(&mut self, val: usize) -> &mut Self {
|
||||||
assert!(val > 0, "Max blocking threads cannot be set to 0");
|
assert!(val > 0, "Max blocking threads cannot be set to 0");
|
||||||
self.max_blocking_threads = val;
|
self.max_blocking_threads = val;
|
||||||
|
@ -312,6 +312,8 @@ impl Notify {
|
|||||||
/// notify.notify_one();
|
/// notify.notify_one();
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
// Alias for old name in 0.x
|
||||||
|
#[cfg_attr(docsrs, doc(alias = "notify"))]
|
||||||
pub fn notify_one(&self) {
|
pub fn notify_one(&self) {
|
||||||
// Load the current state
|
// Load the current state
|
||||||
let mut curr = self.state.load(SeqCst);
|
let mut curr = self.state.load(SeqCst);
|
||||||
|
@ -16,6 +16,8 @@ use std::task::{self, Poll};
|
|||||||
///
|
///
|
||||||
/// Canceling a sleep instance is done by dropping the returned future. No additional
|
/// Canceling a sleep instance is done by dropping the returned future. No additional
|
||||||
/// cleanup work is required.
|
/// 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 {
|
pub fn sleep_until(deadline: Instant) -> Sleep {
|
||||||
Sleep::new_timeout(deadline)
|
Sleep::new_timeout(deadline)
|
||||||
}
|
}
|
||||||
@ -53,6 +55,8 @@ pub fn sleep_until(deadline: Instant) -> Sleep {
|
|||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// [`interval`]: crate::time::interval()
|
/// [`interval`]: crate::time::interval()
|
||||||
|
// Alias for old name in 0.x
|
||||||
|
#[cfg_attr(docsrs, doc(alias = "delay_for"))]
|
||||||
pub fn sleep(duration: Duration) -> Sleep {
|
pub fn sleep(duration: Duration) -> Sleep {
|
||||||
sleep_until(Instant::now() + duration)
|
sleep_until(Instant::now() + duration)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user