sync: add doc aliases for blocking_* methods (#5448)

This commit is contained in:
Alice Ryhl
2023-02-17 16:23:57 +01:00
committed by GitHub
parent e106c4d32b
commit d19f2f2d39
4 changed files with 5 additions and 0 deletions
+2
View File
@@ -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))
}
+1
View File
@@ -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())
}
+1
View File
@@ -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())
}
+1
View File
@@ -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)
}