/// Handle `PropertyProvider` requests as an infinite stream.
Handle `PropertyProvider` requests as an infinite stream.
Handle ` PropertyProvider ` requests as an infinite stream .
async fn run_provider(
        &mut self,
        mut stream: PropertyProviderRequestStream,
    ) -> Result<(), Error> {
        let listener_key = await!(self.add_listener(stream.control_handle().clone()));
        while let Some(PropertyProviderRequest::GetProfile { responder }) =
            await!(stream.try_next()).context("Error running property provider server")?
        {
            {
                fx_log_verbose!("Received profile get request");
                match self.get_profile() {
                    Some(profile) => {
                        responder.send(profile).context("Error sending response")?;
                        fx_log_verbose!("Sent profile");
                    }
                    None => {
                        fx_log_err!("Profile not initialized");
                        responder
                            .send(Profile {
                                locales: None,
                                time_zones: None,
                                calendars: None,
                                temperature_unit: None,
                            })
                            .context("Error sending response")?;
                        fx_log_verbose!("Sent empty profile");
                    }
                }
            }
        }
        // Don't leak listeners after they disconnect.
        await!(self.remove_listener(listener_key));
        Ok(())
    }
async fn run_provider ( & mut self , mut stream : PropertyProviderRequestStream , ) -> Result < ( ) , Error > { let listener_key = await ! ( self add_listener ( stream control_handle ( ) clone ( ) ) ) ; while let Some ( PropertyProviderRequest :: GetProfile { responder } ) = await ! ( stream try_next ( ) ) . context ( " " ) ? { { fx_log_verbose ! ( " " ) ; match self . get_profile ( ) { Some ( profile ) => { responder . send ( profile ) . context ( " " ) ? ; fx_log_verbose ! ( " " ) ; } None => { fx_log_err ! ( " " ) ; responder . send ( Profile { locales : None , time_zones : None , calendars : None , temperature_unit : None , } ) . context ( " " ) ? ; fx_log_verbose ! ( " " ) ; } } } } // Don't leak listeners after they disconnect. await ! ( self remove_listener ( listener_key ) ) ; Ok ( ( ) ) }
Handle `PropertyProvider` requests as an infinite stream.
Handle ` PropertyProvider ` requests as an infinite stream .
&mut self
stream
PropertyProviderRequestStream