pub fn broadcast(&mut self, value: T) -> Result<(), error::SendError<T>> {
        let shared = match self.shared.upgrade() {
            Some(shared) => shared,
            // All `Watch` handles have been canceled
            None => return Err(error::SendError { inner: value }),
        };

        // Replace the value
        {
            let mut lock = shared.value.write().unwrap();
            *lock = value;
        }

        // Update the version. 2 is used so that the CLOSED bit is not set.
        shared.version.fetch_add(2, SeqCst);

        // Notify all watchers
        notify_all(&*shared);

        // Return the old value
        Ok(())
    }
/// Broadcast a new value via the channel, notifying all receivers.
Broadcast a new value via the channel, notifying all receivers.
Broadcast a new value via the channel notifying all receivers .
pub fn broadcast(&mut self, value: T) -> Result<(), error::SendError<T>> {
        let shared = match self.shared.upgrade() {
            Some(shared) => shared,
            // All `Watch` handles have been canceled
            None => return Err(error::SendError { inner: value }),
        };
        // Replace the value
        {
            let mut lock = shared.value.write().unwrap();
            *lock = value;
        }
        // Update the version. 2 is used so that the CLOSED bit is not set.
        shared.version.fetch_add(2, SeqCst);
        // Notify all watchers
        notify_all(&*shared);
        // Return the old value
        Ok(())
    }
pub fn broadcast ( & mut self , value : T ) -> Result < ( ) , error :: SendError < T > > { let shared = match self . shared . upgrade ( ) { Some ( shared ) => shared , // All `Watch` handles have been canceled None => return Err ( error :: SendError { inner : value } ) , } ; // Replace the value { let mut lock = shared . value . write ( ) . unwrap ( ) ; * lock = value ; } // Update the version. 2 is used so that the CLOSED bit is not set. shared . version . fetch_add ( 2 , SeqCst ) ; // Notify all watchers notify_all ( & * shared ) ; // Return the old value Ok ( ( ) ) }
Broadcast a new value via the channel, notifying all receivers.
Broadcast a new value via the channel notifying all receivers .
&mut self
value
T