/// Handle a battery update request - returns the extracted battery information on success,
/// BatteryClientError otherwise.
Handle a battery update request - returns the extracted battery information on success,
BatteryClientError otherwise.
Handle a battery update request - returns the extracted battery information on success BatteryClientError otherwise .
fn handle_battery_info_request(
        &mut self,
        request: fpower::BatteryInfoWatcherRequest,
    ) -> Result<BatteryInfo, BatteryClientError> {
        let fpower::BatteryInfoWatcherRequest::OnChangeBatteryInfo { info, responder, .. } =
            request;
        debug!("Received battery update from system: {:?}", info);
        responder.send()?;
        // TODO(fxbug.dev/89894): Invalid upstream information likely indicates a bug or a mismatch
        // between this library and the battery manager. Close the watcher channel and attempt to
        // re-register for updates.
        let converted_result: Result<BatteryInfo, BatteryClientError> = info.try_into();
        self.current_info =
            converted_result.as_ref().map_or(BatteryInfo::NotAvailable, Clone::clone);
        converted_result
    }
fn handle_battery_info_request ( & mut self , request : fpower :: BatteryInfoWatcherRequest , ) -> Result < BatteryInfo , BatteryClientError > { let fpower :: BatteryInfoWatcherRequest :: OnChangeBatteryInfo { info , responder , .. } = request ; debug ! ( " " info ) ; responder . send ( ) ? ; // TODO(fxbug.dev/89894): Invalid upstream information likely indicates a bug or a mismatch // between this library and the battery manager. Close the watcher channel and attempt to // re-register for updates. let converted_result : Result < BatteryInfo , BatteryClientError > = info . try_into ( ) ; self . current_info = converted_result . as_ref ( ) . map_or ( BatteryInfo :: NotAvailable , Clone :: clone ) ; converted_result }
Handle a battery update request - returns the extracted battery information on success,
BatteryClientError otherwise.
Handle a battery update request - returns the extracted battery information on success BatteryClientError otherwise .
&mut self
request
fpower::BatteryInfoWatcherRequest