/// Subscribe to component lifecycle events.
/// |node| is the node where stats about events seen will be recorded.
Subscribe to component lifecycle events.
|node| is the node where stats about events seen will be recorded.
Subscribe to component lifecycle events . |node| is the node where stats about events seen will be recorded .
async fn listen(&mut self, sender: mpsc::Sender<ComponentEvent>) -> Result<(), EventError> {
        let (client_end, request_stream) =
            fidl::endpoints::create_request_stream::<fsys::EventStreamMarker>()?;
        let mut events = vec![
            fsys::EventSubscription {
                event_name: Some("running".to_string()),
                mode: Some(fsys::EventMode::Async),
                ..fsys::EventSubscription::EMPTY
            },
            fsys::EventSubscription {
                event_name: Some("started".to_string()),
                mode: Some(fsys::EventMode::Async),
                ..fsys::EventSubscription::EMPTY
            },
            fsys::EventSubscription {
                event_name: Some("stopped".to_string()),
                mode: Some(fsys::EventMode::Async),
                ..fsys::EventSubscription::EMPTY
            },
            fsys::EventSubscription {
                event_name: Some("diagnostics_ready".to_string()),
                mode: Some(fsys::EventMode::Async),
                ..fsys::EventSubscription::EMPTY
            },
        ]
        .into_iter();
        let subscription = self.subscribe(&mut events, client_end);
        subscription
            .await
            .map_err(|e| EventError::Fidl("Eventsource subscribe", e))?
            .map_err(|e| EventError::FidlComponent(format!("{:?}", e)))?;
        EventStreamServer::new(sender).spawn(request_stream);
        Ok(())
    }
async fn listen ( & mut self , sender : mpsc :: Sender < ComponentEvent > ) -> Result < ( ) , EventError > { let ( client_end , request_stream ) = fidl :: endpoints :: create_request_stream :: < fsys :: EventStreamMarker > ( ) ? ; let mut events = vec ! [ fsys EventSubscription { event_name Some ( " " to_string ( ) ) mode Some ( fsys EventMode Async ) fsys EventSubscription EMPTY } fsys EventSubscription { event_name Some ( " " to_string ( ) ) mode Some ( fsys EventMode Async ) fsys EventSubscription EMPTY } fsys EventSubscription { event_name Some ( " " to_string ( ) ) mode Some ( fsys EventMode Async ) fsys EventSubscription EMPTY } fsys EventSubscription { event_name Some ( " " to_string ( ) ) mode Some ( fsys EventMode Async ) fsys EventSubscription EMPTY } ] . into_iter ( ) ; let subscription = self . subscribe ( & mut events , client_end ) ; subscription . await . map_err ( | e | EventError :: Fidl ( " " , e ) ) ? . map_err ( | e | EventError :: FidlComponent ( format ! ( " " e ) ) ) ? ; EventStreamServer :: new ( sender ) . spawn ( request_stream ) ; Ok ( ( ) ) }
Subscribe to component lifecycle events.
Subscribe to component lifecycle events .
&mut self
sender
mpsc::Sender<ComponentEvent>