mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-19 00:00:09 +02:00
doc: add error explanation for UnboundedSender::send() (#2372)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user