/// Returns the state with each field represented as an event.
Returns the state with each field represented as an event.
Returns the state with each field represented as an event .
pub fn events(&self) -> Vec<SessionEvent> {
        let mut events = Vec::new();
        if let Some(event) = self
            .playback_status
            .as_ref()
            .map(clone_playback_status)
            .map(|playback_status| SessionEvent::OnPlaybackStatusChanged { playback_status })
        {
            events.push(event);
        }
        if let Some(event) =
            self.playback_capabilities.as_ref().map(clone_playback_capabilities).map(
                |playback_capabilities| SessionEvent::OnPlaybackCapabilitiesChanged {
                    playback_capabilities,
                },
            )
        {
            events.push(event);
        }
        if let Some(event) = self
            .media_metadata
            .as_ref()
            .map(clone_metadata)
            .map(|media_metadata| SessionEvent::OnMetadataChanged { media_metadata })
        {
            events.push(event);
        }
        // We don't want to send an empty list of media images on first connection.
        if !self.media_images.is_empty() {
            events.push(SessionEvent::OnMediaImagesChanged {
                media_images: self.media_images.values().map(clone_media_image).collect(),
            });
        }
        events
    }
pub fn events ( & self ) -> Vec < SessionEvent > { let mut events = Vec :: new ( ) ; if let Some ( event ) = self . playback_status . as_ref ( ) . map ( clone_playback_status ) . map ( | playback_status | SessionEvent :: OnPlaybackStatusChanged { playback_status } ) { events . push ( event ) ; } if let Some ( event ) = self . playback_capabilities . as_ref ( ) . map ( clone_playback_capabilities ) . map ( | playback_capabilities | SessionEvent :: OnPlaybackCapabilitiesChanged { playback_capabilities , } , ) { events . push ( event ) ; } if let Some ( event ) = self . media_metadata . as_ref ( ) . map ( clone_metadata ) . map ( | media_metadata | SessionEvent :: OnMetadataChanged { media_metadata } ) { events . push ( event ) ; } // We don't want to send an empty list of media images on first connection. if ! self . media_images . is_empty ( ) { events . push ( SessionEvent :: OnMediaImagesChanged { media_images : self . media_images . values ( ) . map ( clone_media_image ) . collect ( ) , } ) ; } events }
Returns the state with each field represented as an event.
Returns the state with each field represented as an event .
&self