doc: add error explanation for UnboundedSender::send() (#2372)

This commit is contained in:
Vojtech Kral
2020-04-04 19:36:12 +02:00
committed by GitHub
parent 7c1bc460f7
commit d65bf3805b
2 changed files with 9 additions and 2 deletions
+2 -2
View File
@@ -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
+7
View File
@@ -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(())