summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync/mpsc/unbounded.rs
diff options
context:
space:
mode:
authorAlice Ryhl <alice@ryhl.io>2020-06-17 22:14:09 +0200
committerGitHub <noreply@github.com>2020-06-17 22:14:09 +0200
commit3db22e29d19eba5b2a85e78f4ae8330d3edf6776 (patch)
tree0628a2eb32d39f56063da54a446d1aa9fb17c9a6 /tokio/src/sync/mpsc/unbounded.rs
parente2adf2612d215d1925ef0dd9e2aa8cdd4c825abc (diff)
sync: documentation for mpsc channels (#2600)
Diffstat (limited to 'tokio/src/sync/mpsc/unbounded.rs')
-rw-r--r--tokio/src/sync/mpsc/unbounded.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/tokio/src/sync/mpsc/unbounded.rs b/tokio/src/sync/mpsc/unbounded.rs
index ba543fe4..1b2288ab 100644
--- a/tokio/src/sync/mpsc/unbounded.rs
+++ b/tokio/src/sync/mpsc/unbounded.rs
@@ -163,9 +163,13 @@ impl<T> UnboundedSender<T> {
/// Attempts to send a message on this `UnboundedSender` without blocking.
///
+ /// This method is not marked async because sending a message to an unbounded channel
+ /// never requires any form of waiting. Because of this, the `send` method can be
+ /// used in both synchronous and asynchronous code without problems.
+ ///
/// 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`.
+ /// being called or the [`UnboundedReceiver`] having been dropped, this
+ /// function returns an error. The error includes the value passed to `send`.
///
/// [`close`]: UnboundedReceiver::close
/// [`UnboundedReceiver`]: UnboundedReceiver