From d65bf3805be376505f5c2fb0724cec8917dfb813 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Sat, 4 Apr 2020 19:36:12 +0200 Subject: doc: add error explanation for UnboundedSender::send() (#2372) --- tokio/src/sync/mpsc/unbounded.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tokio/src/sync/mpsc/unbounded.rs') 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 UnboundedSender { } /// 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> { self.chan.send_unbounded(message)?; Ok(()) -- cgit v1.2.3