mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
sync: add doc aliases for blocking_* methods (#5448)
This commit is contained in:
@@ -326,6 +326,7 @@ impl<T> Receiver<T> {
|
||||
/// ```
|
||||
#[track_caller]
|
||||
#[cfg(feature = "sync")]
|
||||
#[cfg_attr(docsrs, doc(alias = "recv_blocking"))]
|
||||
pub fn blocking_recv(&mut self) -> Option<T> {
|
||||
crate::future::block_on(self.recv())
|
||||
}
|
||||
@@ -696,6 +697,7 @@ impl<T> Sender<T> {
|
||||
/// ```
|
||||
#[track_caller]
|
||||
#[cfg(feature = "sync")]
|
||||
#[cfg_attr(docsrs, doc(alias = "send_blocking"))]
|
||||
pub fn blocking_send(&self, value: T) -> Result<(), SendError<T>> {
|
||||
crate::future::block_on(self.send(value))
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ impl<T> UnboundedReceiver<T> {
|
||||
/// ```
|
||||
#[track_caller]
|
||||
#[cfg(feature = "sync")]
|
||||
#[cfg_attr(docsrs, doc(alias = "recv_blocking"))]
|
||||
pub fn blocking_recv(&mut self) -> Option<T> {
|
||||
crate::future::block_on(self.recv())
|
||||
}
|
||||
|
||||
@@ -417,6 +417,7 @@ impl<T: ?Sized> Mutex<T> {
|
||||
/// ```
|
||||
#[track_caller]
|
||||
#[cfg(feature = "sync")]
|
||||
#[cfg_attr(docsrs, doc(alias = "lock_blocking"))]
|
||||
pub fn blocking_lock(&self) -> MutexGuard<'_, T> {
|
||||
crate::future::block_on(self.lock())
|
||||
}
|
||||
|
||||
@@ -1056,6 +1056,7 @@ impl<T> Receiver<T> {
|
||||
/// ```
|
||||
#[track_caller]
|
||||
#[cfg(feature = "sync")]
|
||||
#[cfg_attr(docsrs, doc(alias = "recv_blocking"))]
|
||||
pub fn blocking_recv(self) -> Result<T, RecvError> {
|
||||
crate::future::block_on(self)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user