pub fn add_subscriber(&mut self, subscriber: Arc<Mutex<dyn Subscriber>>) -> Result<()> {
        // Unwrapping here is safe because we want to panic in case the lock is poisoned.
        let interest_list = subscriber.lock().unwrap().interest_list();

        for event in interest_list {
            self.register(event.data() as i32, event, subscriber.clone())?
        }

        Ok(())
    }
/// Register a new subscriber. All events that the subscriber is interested are registered.
///
// TODO: Remove this workaround method. The desired state in the future is for each
// subscriber to call `register` directly when it needs to register an event and not have
// all events registered at once. This way we can also remove the `interest_list` which is
// only used once in this function.
Register a new subscriber. All events that the subscriber is interested are registered.
TODO: Remove this workaround method. The desired state in the future is for each
subscriber to call `register` directly when it needs to register an event and not have
all events registered at once. This way we can also remove the `interest_list` which is
only used once in this function.
Register a new subscriber . All events that the subscriber is interested are registered . TODO : Remove this workaround method . The desired state in the future is for each subscriber to call ` register ` directly when it needs to register an event and not have all events registered at once . This way we can also remove the ` interest_list ` which is only used once in this function .
pub fn add_subscriber(&mut self, subscriber: Arc<Mutex<dyn Subscriber>>) -> Result<()> {
        // Unwrapping here is safe because we want to panic in case the lock is poisoned.
        let interest_list = subscriber.lock().unwrap().interest_list();
        for event in interest_list {
            self.register(event.data() as i32, event, subscriber.clone())?
        }
        Ok(())
    }
pub fn add_subscriber ( & mut self , subscriber : Arc < Mutex < dyn Subscriber > > ) -> Result < ( ) > { // Unwrapping here is safe because we want to panic in case the lock is poisoned. let interest_list = subscriber . lock ( ) . unwrap ( ) . interest_list ( ) ; for event in interest_list { self . register ( event . data ( ) as i32 , event , subscriber . clone ( ) ) ? } Ok ( ( ) ) }
Register a new subscriber.
Register a new subscriber .
&mut self
subscriber
Arc<Mutex<dyn Subscriber>>