sync: document when watch::send fails (#4021)

This commit is contained in:
Alice Ryhl
2021-08-03 09:38:58 +02:00
committed by GitHub
parent 175d84e2b1
commit e66217575b
+3
View File
@@ -422,6 +422,9 @@ impl<T> Drop for Receiver<T> {
impl<T> Sender<T> {
/// Sends a new value via the channel, notifying all receivers.
///
/// This method fails if the channel has been closed, which happens when
/// every receiver has been dropped.
pub fn send(&self, value: T) -> Result<(), error::SendError<T>> {
// This is pretty much only useful as a hint anyway, so synchronization isn't critical.
if 0 == self.shared.ref_count_rx.load(Relaxed) {