summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVojtech Kral <vojtech@kral.hk>2020-04-04 19:36:12 +0200
committerGitHub <noreply@github.com>2020-04-04 19:36:12 +0200
commitd65bf3805be376505f5c2fb0724cec8917dfb813 (patch)
treef4ac1d82cdf8332b49cb7f5cbcf18d80e2229974
parent7c1bc460f7eccbeef62504d4799b6bccc909e46c (diff)
doc: add error explanation for UnboundedSender::send() (#2372)
-rw-r--r--tokio/src/sync/mpsc/bounded.rs4
-rw-r--r--tokio/src/sync/mpsc/unbounded.rs7
2 files changed, 9 insertions, 2 deletions
diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs
index f83c0532..a0b6db38 100644
--- a/tokio/src/sync/mpsc/bounded.rs
+++ b/tokio/src/sync/mpsc/bounded.rs
@@ -360,8 +360,8 @@ impl<T> Sender<T> {
/// # Errors
///
/// If the receive half of the channel is closed, either due to [`close`]
- /// being called or the [`Receiver`] handle dropping, the function returns
- /// an error. The error includes the value passed to `send`.
+ /// being called or the [`Receiver`] having been dropped,
+ /// the function returns an error. The error includes the value passed to `send`.
///
/// [`close`]: Receiver::close
/// [`Receiver`]: Receiver
diff --git a/tokio/src/sync/mpsc/unbounded.rs b/tokio/src/sync/mpsc/unbounded.rs
index b6b621d2..ba543fe4 100644
--- a/tokio/src/sync/mpsc/unbounded.rs
+++ b/tokio/src/sync/mpsc/unbounded.rs
@@ -162,6 +162,13 @@ impl<T> UnboundedSender<T> {
}
/// Attempts to send a message on this `UnboundedSender` without blocking.
+ ///
+ /// If the receive half of the channel is closed, either due to [`close`]
+ /// being called or the [`UnboundedReceiver`] having been dropped,
+ /// the function returns an error. The error includes the value passed to `send`.
+ ///
+ /// [`close`]: UnboundedReceiver::close
+ /// [`UnboundedReceiver`]: UnboundedReceiver
pub fn send(&self, message: T) -> Result<(), SendError<T>> {
self.chan.send_unbounded(message)?;
Ok(())