/// The core logic behind listening to a setting is separate from the watch
/// method definition to facilitate testing.
The core logic behind listening to a setting is separate from the watch
method definition to facilitate testing.
The core logic behind listening to a setting is separate from the watch method definition to facilitate testing .
fn listen(&self, setting_type: SettingType, sender: Sender<SettingData>) -> Result<(), Error> {
        if let Some(adapter_lock) = self.adapters.read().unwrap().get(&setting_type) {
            if let Ok(adapter) = adapter_lock.lock() {
                adapter.listen(sender, self.last_seen_settings.read().unwrap().get(&setting_type));
                return Ok(());
            }
        }
        return Err(format_err!("cannot listen. non-existent adapter"));
    }
fn listen ( & self , setting_type : SettingType , sender : Sender < SettingData > ) -> Result < ( ) , Error > { if let Some ( adapter_lock ) = self . adapters . read ( ) . unwrap ( ) . get ( & setting_type ) { if let Ok ( adapter ) = adapter_lock . lock ( ) { adapter . listen ( sender , self . last_seen_settings . read ( ) . unwrap ( ) . get ( & setting_type ) ) ; return Ok ( ( ) ) ; } } return Err ( format_err ! ( " " ) ) ; }
The core logic behind listening to a setting is separate from the watch
method definition to facilitate testing.
The core logic behind listening to a setting is separate from the watch method definition to facilitate testing .
&self
setting_type
SettingType
sender
Sender<SettingData>