From 3db22e29d19eba5b2a85e78f4ae8330d3edf6776 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Wed, 17 Jun 2020 22:14:09 +0200 Subject: sync: documentation for mpsc channels (#2600) --- tokio/src/sync/oneshot.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tokio/src/sync/oneshot.rs') diff --git a/tokio/src/sync/oneshot.rs b/tokio/src/sync/oneshot.rs index 4b033ac3..54cd5b76 100644 --- a/tokio/src/sync/oneshot.rs +++ b/tokio/src/sync/oneshot.rs @@ -144,8 +144,11 @@ impl Sender { /// Attempts to send a value on this channel, returning it back if it could /// not be sent. /// - /// The function consumes `self` as only one value may ever be sent on a - /// one-shot channel. + /// This method consumes `self` as only one value may ever be sent on a oneshot + /// channel. It is not marked async because sending a message to an oneshot + /// channel never requires any form of waiting. Because of this, the `send` + /// method can be used in both synchronous and asynchronous code without + /// problems. /// /// A successful send occurs when it is determined that the other end of the /// channel has not hung up already. An unsuccessful send would be one where -- cgit v1.2.3