fidl_fuchsia_media_sessions2/
fidl_fuchsia_media_sessions2.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// A domain identifies the ecosystem in which the session takes place.
14///
15/// Domains should take the form of
16///
17///    `domain://<unique name for protocol>.version`
18///
19/// The `|` symbol is reserved and should not be used in a domain string.
20pub type Domain = String;
21
22pub type SessionId = u64;
23
24bitflags! {
25    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
26    pub struct PlayerCapabilityFlags: u32 {
27        /// If set, the player can `Play()`.
28        const PLAY = 1;
29        /// If set, the player can `Pause()`.
30        const PAUSE = 4;
31        /// If set, the player can `Seek()`.
32        const SEEK = 8;
33        /// If set, the player can `SkipForward()`.
34        const SKIP_FORWARD = 16;
35        /// If set, the player can `SkipReverse()`.
36        const SKIP_REVERSE = 32;
37        /// If set, the player can shuffle media.
38        const SHUFFLE = 64;
39        const CHANGE_TO_NEXT_ITEM = 128;
40        const CHANGE_TO_PREV_ITEM = 256;
41        /// If set, the player can `BindGainControl()`.
42        const HAS_GAIN_CONTROL = 512;
43        /// If set, the player can repeat groups.
44        const REPEAT_GROUPS = 1024;
45        /// If set, the player can repeat single media items.
46        const REPEAT_SINGLE = 2048;
47        /// If set, the player can accept playback rate changes.
48        const SET_PLAYBACK_RATE = 4096;
49    }
50}
51
52impl PlayerCapabilityFlags {
53    #[deprecated = "Strict bits should not use `has_unknown_bits`"]
54    #[inline(always)]
55    pub fn has_unknown_bits(&self) -> bool {
56        false
57    }
58
59    #[deprecated = "Strict bits should not use `get_unknown_bits`"]
60    #[inline(always)]
61    pub fn get_unknown_bits(&self) -> u32 {
62        0
63    }
64}
65
66/// The type of content playing back, which should be set to the largest
67/// applicable value.
68#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
69#[repr(u32)]
70pub enum ContentType {
71    /// Content does not qualify for any of the other values.
72    Other = 1,
73    /// Audio-only content that does not qualify as music.
74    Audio = 2,
75    /// Video-only or audio-video content that does not qualify as a TV show or a movie.
76    Video = 3,
77    /// Audio-only content generally recognized as music.
78    Music = 4,
79    /// Audio-video content that is part of a television or streaming series.
80    TvShow = 5,
81    /// Audio-video content consisting of a feature film.
82    Movie = 6,
83}
84
85impl ContentType {
86    #[inline]
87    pub fn from_primitive(prim: u32) -> Option<Self> {
88        match prim {
89            1 => Some(Self::Other),
90            2 => Some(Self::Audio),
91            3 => Some(Self::Video),
92            4 => Some(Self::Music),
93            5 => Some(Self::TvShow),
94            6 => Some(Self::Movie),
95            _ => None,
96        }
97    }
98
99    #[inline]
100    pub const fn into_primitive(self) -> u32 {
101        self as u32
102    }
103
104    #[deprecated = "Strict enums should not use `is_unknown`"]
105    #[inline]
106    pub fn is_unknown(&self) -> bool {
107        false
108    }
109}
110
111#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
112#[repr(u32)]
113pub enum Error {
114    Other = 1,
115}
116
117impl Error {
118    #[inline]
119    pub fn from_primitive(prim: u32) -> Option<Self> {
120        match prim {
121            1 => Some(Self::Other),
122            _ => None,
123        }
124    }
125
126    #[inline]
127    pub const fn into_primitive(self) -> u32 {
128        self as u32
129    }
130
131    #[deprecated = "Strict enums should not use `is_unknown`"]
132    #[inline]
133    pub fn is_unknown(&self) -> bool {
134        false
135    }
136}
137
138/// The behavior enforced on the player when it is
139/// interrupted, such as by an alarm.
140///
141/// Interruptions are detected using the player's usage.
142///
143/// By default the interruption behavior is `NONE`.
144#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
145#[repr(u32)]
146pub enum InterruptionBehavior {
147    /// Interruptions have no effect on the player
148    /// and it may continue in spite of reduced audibility.
149    None = 0,
150    /// With this behavior, when playback is interrupted, the player
151    /// will be paused until the interruption is over, so the user
152    /// does not miss any content.
153    Pause = 1,
154}
155
156impl InterruptionBehavior {
157    #[inline]
158    pub fn from_primitive(prim: u32) -> Option<Self> {
159        match prim {
160            0 => Some(Self::None),
161            1 => Some(Self::Pause),
162            _ => None,
163        }
164    }
165
166    #[inline]
167    pub const fn into_primitive(self) -> u32 {
168        self as u32
169    }
170
171    #[deprecated = "Strict enums should not use `is_unknown`"]
172    #[inline]
173    pub fn is_unknown(&self) -> bool {
174        false
175    }
176}
177
178#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
179#[repr(u32)]
180pub enum MediaImageType {
181    /// Artwork for the playing media.
182    Artwork = 0,
183    /// An icon for the source of the playing media (e.g. the player or
184    /// streaming service).
185    SourceIcon = 1,
186}
187
188impl MediaImageType {
189    #[inline]
190    pub fn from_primitive(prim: u32) -> Option<Self> {
191        match prim {
192            0 => Some(Self::Artwork),
193            1 => Some(Self::SourceIcon),
194            _ => None,
195        }
196    }
197
198    #[inline]
199    pub const fn into_primitive(self) -> u32 {
200        self as u32
201    }
202
203    #[deprecated = "Strict enums should not use `is_unknown`"]
204    #[inline]
205    pub fn is_unknown(&self) -> bool {
206        false
207    }
208}
209
210/// State of a media player.
211#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
212#[repr(u32)]
213pub enum PlayerState {
214    /// The initial state of a session if there is no associated media.
215    Idle = 0,
216    /// The player is playing.
217    Playing = 1,
218    /// The player is paused.
219    Paused = 2,
220    /// The player would be playing, but is temporarily paused for buffering.
221    Buffering = 3,
222    /// The player cannot recover from this state and will close.
223    Error = 4,
224}
225
226impl PlayerState {
227    #[inline]
228    pub fn from_primitive(prim: u32) -> Option<Self> {
229        match prim {
230            0 => Some(Self::Idle),
231            1 => Some(Self::Playing),
232            2 => Some(Self::Paused),
233            3 => Some(Self::Buffering),
234            4 => Some(Self::Error),
235            _ => None,
236        }
237    }
238
239    #[inline]
240    pub const fn into_primitive(self) -> u32 {
241        self as u32
242    }
243
244    #[deprecated = "Strict enums should not use `is_unknown`"]
245    #[inline]
246    pub fn is_unknown(&self) -> bool {
247        false
248    }
249}
250
251/// Modes of repeating playback of the current media.
252#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
253#[repr(u32)]
254pub enum RepeatMode {
255    /// No repeat.
256    Off = 0,
257    /// Repeat the relevant group of media (e.g. playlist).
258    Group = 1,
259    /// Repeat the currently playing media.
260    Single = 2,
261}
262
263impl RepeatMode {
264    #[inline]
265    pub fn from_primitive(prim: u32) -> Option<Self> {
266        match prim {
267            0 => Some(Self::Off),
268            1 => Some(Self::Group),
269            2 => Some(Self::Single),
270            _ => None,
271        }
272    }
273
274    #[inline]
275    pub const fn into_primitive(self) -> u32 {
276        self as u32
277    }
278
279    #[deprecated = "Strict enums should not use `is_unknown`"]
280    #[inline]
281    pub fn is_unknown(&self) -> bool {
282        false
283    }
284}
285
286#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
287pub struct ActiveSessionWatchActiveSessionResponse {
288    pub session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
289}
290
291impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
292    for ActiveSessionWatchActiveSessionResponse
293{
294}
295
296#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
297pub struct DiscoveryConnectToSessionRequest {
298    pub session_id: u64,
299    pub session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
300}
301
302impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
303    for DiscoveryConnectToSessionRequest
304{
305}
306
307#[derive(Debug, PartialEq)]
308pub struct DiscoveryWatchSessionsRequest {
309    pub watch_options: WatchOptions,
310    pub session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
311}
312
313impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
314    for DiscoveryWatchSessionsRequest
315{
316}
317
318/// A variant of an image at a specific size.
319#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
320pub struct ImageSizeVariant {
321    pub url: String,
322    pub width: u32,
323    pub height: u32,
324}
325
326impl fidl::Persistable for ImageSizeVariant {}
327
328#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
329pub struct ObserverDiscoveryConnectToSessionRequest {
330    pub session_id: u64,
331    pub session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
332}
333
334impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
335    for ObserverDiscoveryConnectToSessionRequest
336{
337}
338
339#[derive(Debug, PartialEq)]
340pub struct ObserverDiscoveryWatchSessionsRequest {
341    pub watch_options: WatchOptions,
342    pub sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
343}
344
345impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
346    for ObserverDiscoveryWatchSessionsRequest
347{
348}
349
350#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
351pub struct PlayerControlBindVolumeControlRequest {
352    pub volume_control_request:
353        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
354}
355
356impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
357    for PlayerControlBindVolumeControlRequest
358{
359}
360
361#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
362#[repr(C)]
363pub struct PlayerControlSeekRequest {
364    pub position: i64,
365}
366
367impl fidl::Persistable for PlayerControlSeekRequest {}
368
369#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
370pub struct PlayerControlSetPlaybackRateRequest {
371    pub playback_rate: f32,
372}
373
374impl fidl::Persistable for PlayerControlSetPlaybackRateRequest {}
375
376#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
377pub struct PlayerControlSetRepeatModeRequest {
378    pub repeat_mode: RepeatMode,
379}
380
381impl fidl::Persistable for PlayerControlSetRepeatModeRequest {}
382
383#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
384pub struct PlayerControlSetShuffleModeRequest {
385    pub shuffle_on: bool,
386}
387
388impl fidl::Persistable for PlayerControlSetShuffleModeRequest {}
389
390#[derive(Clone, Debug, PartialEq)]
391pub struct PlayerWatchInfoChangeResponse {
392    pub player_info_delta: PlayerInfoDelta,
393}
394
395impl fidl::Persistable for PlayerWatchInfoChangeResponse {}
396
397#[derive(Debug, PartialEq)]
398pub struct PublisherPublishRequest {
399    pub player: fidl::endpoints::ClientEnd<PlayerMarker>,
400    pub registration: PlayerRegistration,
401}
402
403impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PublisherPublishRequest {}
404
405#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
406#[repr(C)]
407pub struct PublisherPublishResponse {
408    pub session_id: u64,
409}
410
411impl fidl::Persistable for PublisherPublishResponse {}
412
413#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
414pub struct SessionControlBindVolumeControlRequest {
415    pub volume_control_request:
416        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
417}
418
419impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
420    for SessionControlBindVolumeControlRequest
421{
422}
423
424#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
425#[repr(C)]
426pub struct SessionControlSeekRequest {
427    pub position: i64,
428}
429
430impl fidl::Persistable for SessionControlSeekRequest {}
431
432#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
433pub struct SessionControlSetPlaybackRateRequest {
434    pub playback_rate: f32,
435}
436
437impl fidl::Persistable for SessionControlSetPlaybackRateRequest {}
438
439#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
440pub struct SessionControlSetRepeatModeRequest {
441    pub repeat_mode: RepeatMode,
442}
443
444impl fidl::Persistable for SessionControlSetRepeatModeRequest {}
445
446#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
447pub struct SessionControlSetShuffleModeRequest {
448    pub shuffle_on: bool,
449}
450
451impl fidl::Persistable for SessionControlSetShuffleModeRequest {}
452
453#[derive(Clone, Debug, PartialEq)]
454pub struct SessionControlWatchStatusResponse {
455    pub session_info_delta: SessionInfoDelta,
456}
457
458impl fidl::Persistable for SessionControlWatchStatusResponse {}
459
460#[derive(Clone, Debug, PartialEq)]
461pub struct SessionObserverWatchStatusResponse {
462    pub session_info_delta: SessionInfoDelta,
463}
464
465impl fidl::Persistable for SessionObserverWatchStatusResponse {}
466
467#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
468#[repr(C)]
469pub struct SessionsWatcherSessionRemovedRequest {
470    pub session_id: u64,
471}
472
473impl fidl::Persistable for SessionsWatcherSessionRemovedRequest {}
474
475#[derive(Clone, Debug, PartialEq)]
476pub struct SessionsWatcherSessionUpdatedRequest {
477    pub session_id: u64,
478    pub session_info_delta: SessionInfoDelta,
479}
480
481impl fidl::Persistable for SessionsWatcherSessionUpdatedRequest {}
482
483/// An image for playing media.
484#[derive(Clone, Debug, Default, PartialEq)]
485pub struct MediaImage {
486    pub image_type: Option<MediaImageType>,
487    /// Available variants of the image.
488    pub sizes: Option<Vec<ImageSizeVariant>>,
489    #[doc(hidden)]
490    pub __source_breaking: fidl::marker::SourceBreaking,
491}
492
493impl fidl::Persistable for MediaImage {}
494
495/// Describes the capabilities of a player.
496#[derive(Clone, Debug, Default, PartialEq)]
497pub struct PlayerCapabilities {
498    /// Indicates which capabilities are supported by the player. See `PlayerControl` for
499    /// details.
500    pub flags: Option<PlayerCapabilityFlags>,
501    #[doc(hidden)]
502    pub __source_breaking: fidl::marker::SourceBreaking,
503}
504
505impl fidl::Persistable for PlayerCapabilities {}
506
507/// When emitted, fields that have changed should be set.
508/// The first emission to a new client should be a snapshot.
509#[derive(Clone, Debug, Default, PartialEq)]
510pub struct PlayerInfoDelta {
511    /// Whether the entry point for the media into our device network is the
512    /// local machine; this should be true if this is the device streaming
513    /// from a music service, but false or omitted if this machine is just
514    /// receiving an audio stream to act as a speaker.
515    ///
516    /// If omitted, the value is unchanged. Initially, this value is `true`.
517    pub local: Option<bool>,
518    /// The status of the player.
519    ///
520    /// If omitted, all constituent values are unchanged. If a field within `PlayerStatus` is
521    /// omitted, its value is unchanged. Initial values are indicated for each field in
522    /// `player_status`.
523    pub player_status: Option<PlayerStatus>,
524    /// The metadata of the playing media.
525    ///
526    /// If omitted, the metadata is unchanged. Initially, there is no metadata.
527    pub metadata: Option<fidl_fuchsia_media::Metadata>,
528    /// The images associated with the playing media.
529    ///
530    /// If omitted, the media images are unchanged. An empty
531    /// vector indicates that there are no media images, which is also the initial state.
532    pub media_images: Option<Vec<MediaImage>>,
533    /// The capabilities of the player.
534    ///
535    /// If omitted, the capabilities are unchanged. Initially, the player is assumed to have no
536    /// capabilities.
537    pub player_capabilities: Option<PlayerCapabilities>,
538    /// The behavior the player would like to engage in when interrupted
539    /// by something, such as an alarm.
540    ///
541    /// If omitted, the behavior is unchanged. Initially, the value is `NONE`.
542    pub interruption_behavior: Option<InterruptionBehavior>,
543    #[doc(hidden)]
544    pub __source_breaking: fidl::marker::SourceBreaking,
545}
546
547impl fidl::Persistable for PlayerInfoDelta {}
548
549/// All information required by the media session registry service to
550/// register a player so that clients may observe its status and control
551/// it.
552#[derive(Clone, Debug, Default, PartialEq)]
553pub struct PlayerRegistration {
554    /// The domain on which the player exists. Unset if it is the native
555    /// Fuchsia domain.
556    pub domain: Option<String>,
557    /// The usage of the player's audio output. Either 'usage' or 'usage2'
558    /// may be set, but not both. If neither is set, this is assumed to be MEDIA.
559    pub usage: Option<fidl_fuchsia_media::AudioRenderUsage>,
560    pub usage2: Option<fidl_fuchsia_media::AudioRenderUsage2>,
561    #[doc(hidden)]
562    pub __source_breaking: fidl::marker::SourceBreaking,
563}
564
565impl fidl::Persistable for PlayerRegistration {}
566
567/// Status of a media player.
568#[derive(Clone, Debug, Default, PartialEq)]
569pub struct PlayerStatus {
570    /// Total duration of playing media.
571    ///
572    /// If this value is omitted, the duration is unknown, not applicable or unchanged. Initially,
573    /// the duration is assumed to be unknown.
574    pub duration: Option<i64>,
575    /// State of the player.
576    ///
577    /// If this field is omitted, the value is unchanged. Initially, the value is `IDLE`.
578    pub player_state: Option<PlayerState>,
579    /// A playback function that describes the position and rate of
580    /// play through the media as a function of `CLOCK_MONOTONIC`.
581    ///
582    /// If this field is omitted, the value is unchanged. Initially, `reference_delta` is 1 and
583    /// the remaining constituent fields are 0.
584    pub timeline_function: Option<fidl_fuchsia_media::TimelineFunction>,
585    /// Repeat mode of the player.
586    ///
587    /// If this field is omitted, the value is unchanged. Initially, the value is `NONE`.
588    pub repeat_mode: Option<RepeatMode>,
589    /// Shuffle mode of the player.
590    ///
591    /// If this field is omitted, the value is unchanged. Initially, the value is false.
592    pub shuffle_on: Option<bool>,
593    /// The type of content playing back.
594    ///
595    /// If this field is omitted, the value is unchanged. Initially, the value is `OTHER`.
596    pub content_type: Option<ContentType>,
597    /// An error the player may have encountered.
598    ///
599    /// This field is omitted unless there is an error. Once an error is indicated, it cannot
600    /// be rescinded.
601    pub error: Option<Error>,
602    /// Whether the playing media is live (such as television or a live stream).
603    ///
604    /// If this field is omitted, the value is unchanged. Initially, the value is false.
605    pub is_live: Option<bool>,
606    #[doc(hidden)]
607    pub __source_breaking: fidl::marker::SourceBreaking,
608}
609
610impl fidl::Persistable for PlayerStatus {}
611
612/// SessionInfoDelta holds a description of a media session.
613#[derive(Clone, Debug, Default, PartialEq)]
614pub struct SessionInfoDelta {
615    /// The domain on which the session takes place. A domain identifies a set of
616    /// mutually compatible media targets and sessions; sessions on a domain may
617    /// be played back on targets of the same domain.
618    ///
619    /// This field is always present.
620    pub domain: Option<String>,
621    /// Whether the source of the media playback is on this device.
622    ///
623    /// This field is present only if known.
624    pub is_local: Option<bool>,
625    /// If this is `true`, the playback is taking place local to the device.
626    /// Playing on the device speaker is local, playing on a remote speaker
627    /// is not. This is only set when the session is playing back; a paused
628    /// session is not active.
629    ///
630    /// This field is always present.
631    pub is_locally_active: Option<bool>,
632    /// The status of the player.
633    ///
634    /// This field is always present.
635    pub player_status: Option<PlayerStatus>,
636    /// Metadata describing the media session.
637    ///
638    /// This field is always present.
639    pub metadata: Option<fidl_fuchsia_media::Metadata>,
640    /// Images associated with the media or its source.
641    ///
642    /// This field is always present.
643    pub media_images: Option<Vec<MediaImage>>,
644    /// The capabilities the player of the media implements.
645    ///
646    /// This field is always present.
647    pub player_capabilities: Option<PlayerCapabilities>,
648    #[doc(hidden)]
649    pub __source_breaking: fidl::marker::SourceBreaking,
650}
651
652impl fidl::Persistable for SessionInfoDelta {}
653
654/// Options that specify which sessions are watched when watching the collection.
655///
656/// The watched set is the set of sessions which satisfies all options.
657#[derive(Clone, Debug, Default, PartialEq)]
658pub struct WatchOptions {
659    /// Watch only the active session. Watches all if not set.
660    pub only_active: Option<bool>,
661    /// Watch only sessions with these allowlisted ids. Watches all if not set.
662    pub allowed_sessions: Option<Vec<u64>>,
663    #[doc(hidden)]
664    pub __source_breaking: fidl::marker::SourceBreaking,
665}
666
667impl fidl::Persistable for WatchOptions {}
668
669#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
670pub struct ActiveSessionMarker;
671
672impl fidl::endpoints::ProtocolMarker for ActiveSessionMarker {
673    type Proxy = ActiveSessionProxy;
674    type RequestStream = ActiveSessionRequestStream;
675    #[cfg(target_os = "fuchsia")]
676    type SynchronousProxy = ActiveSessionSynchronousProxy;
677
678    const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.ActiveSession";
679}
680impl fidl::endpoints::DiscoverableProtocolMarker for ActiveSessionMarker {}
681
682pub trait ActiveSessionProxyInterface: Send + Sync {
683    type WatchActiveSessionResponseFut: std::future::Future<
684            Output = Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error>,
685        > + Send;
686    fn r#watch_active_session(&self) -> Self::WatchActiveSessionResponseFut;
687}
688#[derive(Debug)]
689#[cfg(target_os = "fuchsia")]
690pub struct ActiveSessionSynchronousProxy {
691    client: fidl::client::sync::Client,
692}
693
694#[cfg(target_os = "fuchsia")]
695impl fidl::endpoints::SynchronousProxy for ActiveSessionSynchronousProxy {
696    type Proxy = ActiveSessionProxy;
697    type Protocol = ActiveSessionMarker;
698
699    fn from_channel(inner: fidl::Channel) -> Self {
700        Self::new(inner)
701    }
702
703    fn into_channel(self) -> fidl::Channel {
704        self.client.into_channel()
705    }
706
707    fn as_channel(&self) -> &fidl::Channel {
708        self.client.as_channel()
709    }
710}
711
712#[cfg(target_os = "fuchsia")]
713impl ActiveSessionSynchronousProxy {
714    pub fn new(channel: fidl::Channel) -> Self {
715        let protocol_name = <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
716        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
717    }
718
719    pub fn into_channel(self) -> fidl::Channel {
720        self.client.into_channel()
721    }
722
723    /// Waits until an event arrives and returns it. It is safe for other
724    /// threads to make concurrent requests while waiting for an event.
725    pub fn wait_for_event(
726        &self,
727        deadline: zx::MonotonicInstant,
728    ) -> Result<ActiveSessionEvent, fidl::Error> {
729        ActiveSessionEvent::decode(self.client.wait_for_event(deadline)?)
730    }
731
732    /// Watches the active session. The first request will be answered immediately
733    /// with the current active session. Always leave a request hanging to receive
734    /// a reply when the active session changes.
735    pub fn r#watch_active_session(
736        &self,
737        ___deadline: zx::MonotonicInstant,
738    ) -> Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error> {
739        let _response = self
740            .client
741            .send_query::<fidl::encoding::EmptyPayload, ActiveSessionWatchActiveSessionResponse>(
742                (),
743                0xc072168d525fff8,
744                fidl::encoding::DynamicFlags::empty(),
745                ___deadline,
746            )?;
747        Ok(_response.session)
748    }
749}
750
751#[derive(Debug, Clone)]
752pub struct ActiveSessionProxy {
753    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
754}
755
756impl fidl::endpoints::Proxy for ActiveSessionProxy {
757    type Protocol = ActiveSessionMarker;
758
759    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
760        Self::new(inner)
761    }
762
763    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
764        self.client.into_channel().map_err(|client| Self { client })
765    }
766
767    fn as_channel(&self) -> &::fidl::AsyncChannel {
768        self.client.as_channel()
769    }
770}
771
772impl ActiveSessionProxy {
773    /// Create a new Proxy for fuchsia.media.sessions2/ActiveSession.
774    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
775        let protocol_name = <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
776        Self { client: fidl::client::Client::new(channel, protocol_name) }
777    }
778
779    /// Get a Stream of events from the remote end of the protocol.
780    ///
781    /// # Panics
782    ///
783    /// Panics if the event stream was already taken.
784    pub fn take_event_stream(&self) -> ActiveSessionEventStream {
785        ActiveSessionEventStream { event_receiver: self.client.take_event_receiver() }
786    }
787
788    /// Watches the active session. The first request will be answered immediately
789    /// with the current active session. Always leave a request hanging to receive
790    /// a reply when the active session changes.
791    pub fn r#watch_active_session(
792        &self,
793    ) -> fidl::client::QueryResponseFut<
794        Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
795        fidl::encoding::DefaultFuchsiaResourceDialect,
796    > {
797        ActiveSessionProxyInterface::r#watch_active_session(self)
798    }
799}
800
801impl ActiveSessionProxyInterface for ActiveSessionProxy {
802    type WatchActiveSessionResponseFut = fidl::client::QueryResponseFut<
803        Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
804        fidl::encoding::DefaultFuchsiaResourceDialect,
805    >;
806    fn r#watch_active_session(&self) -> Self::WatchActiveSessionResponseFut {
807        fn _decode(
808            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
809        ) -> Result<Option<fidl::endpoints::ClientEnd<SessionControlMarker>>, fidl::Error> {
810            let _response = fidl::client::decode_transaction_body::<
811                ActiveSessionWatchActiveSessionResponse,
812                fidl::encoding::DefaultFuchsiaResourceDialect,
813                0xc072168d525fff8,
814            >(_buf?)?;
815            Ok(_response.session)
816        }
817        self.client.send_query_and_decode::<
818            fidl::encoding::EmptyPayload,
819            Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
820        >(
821            (),
822            0xc072168d525fff8,
823            fidl::encoding::DynamicFlags::empty(),
824            _decode,
825        )
826    }
827}
828
829pub struct ActiveSessionEventStream {
830    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
831}
832
833impl std::marker::Unpin for ActiveSessionEventStream {}
834
835impl futures::stream::FusedStream for ActiveSessionEventStream {
836    fn is_terminated(&self) -> bool {
837        self.event_receiver.is_terminated()
838    }
839}
840
841impl futures::Stream for ActiveSessionEventStream {
842    type Item = Result<ActiveSessionEvent, fidl::Error>;
843
844    fn poll_next(
845        mut self: std::pin::Pin<&mut Self>,
846        cx: &mut std::task::Context<'_>,
847    ) -> std::task::Poll<Option<Self::Item>> {
848        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
849            &mut self.event_receiver,
850            cx
851        )?) {
852            Some(buf) => std::task::Poll::Ready(Some(ActiveSessionEvent::decode(buf))),
853            None => std::task::Poll::Ready(None),
854        }
855    }
856}
857
858#[derive(Debug)]
859pub enum ActiveSessionEvent {}
860
861impl ActiveSessionEvent {
862    /// Decodes a message buffer as a [`ActiveSessionEvent`].
863    fn decode(
864        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
865    ) -> Result<ActiveSessionEvent, fidl::Error> {
866        let (bytes, _handles) = buf.split_mut();
867        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
868        debug_assert_eq!(tx_header.tx_id, 0);
869        match tx_header.ordinal {
870            _ => Err(fidl::Error::UnknownOrdinal {
871                ordinal: tx_header.ordinal,
872                protocol_name: <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
873            }),
874        }
875    }
876}
877
878/// A Stream of incoming requests for fuchsia.media.sessions2/ActiveSession.
879pub struct ActiveSessionRequestStream {
880    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
881    is_terminated: bool,
882}
883
884impl std::marker::Unpin for ActiveSessionRequestStream {}
885
886impl futures::stream::FusedStream for ActiveSessionRequestStream {
887    fn is_terminated(&self) -> bool {
888        self.is_terminated
889    }
890}
891
892impl fidl::endpoints::RequestStream for ActiveSessionRequestStream {
893    type Protocol = ActiveSessionMarker;
894    type ControlHandle = ActiveSessionControlHandle;
895
896    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
897        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
898    }
899
900    fn control_handle(&self) -> Self::ControlHandle {
901        ActiveSessionControlHandle { inner: self.inner.clone() }
902    }
903
904    fn into_inner(
905        self,
906    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
907    {
908        (self.inner, self.is_terminated)
909    }
910
911    fn from_inner(
912        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
913        is_terminated: bool,
914    ) -> Self {
915        Self { inner, is_terminated }
916    }
917}
918
919impl futures::Stream for ActiveSessionRequestStream {
920    type Item = Result<ActiveSessionRequest, fidl::Error>;
921
922    fn poll_next(
923        mut self: std::pin::Pin<&mut Self>,
924        cx: &mut std::task::Context<'_>,
925    ) -> std::task::Poll<Option<Self::Item>> {
926        let this = &mut *self;
927        if this.inner.check_shutdown(cx) {
928            this.is_terminated = true;
929            return std::task::Poll::Ready(None);
930        }
931        if this.is_terminated {
932            panic!("polled ActiveSessionRequestStream after completion");
933        }
934        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
935            |bytes, handles| {
936                match this.inner.channel().read_etc(cx, bytes, handles) {
937                    std::task::Poll::Ready(Ok(())) => {}
938                    std::task::Poll::Pending => return std::task::Poll::Pending,
939                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
940                        this.is_terminated = true;
941                        return std::task::Poll::Ready(None);
942                    }
943                    std::task::Poll::Ready(Err(e)) => {
944                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
945                            e.into(),
946                        ))))
947                    }
948                }
949
950                // A message has been received from the channel
951                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
952
953                std::task::Poll::Ready(Some(match header.ordinal {
954                    0xc072168d525fff8 => {
955                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
956                        let mut req = fidl::new_empty!(
957                            fidl::encoding::EmptyPayload,
958                            fidl::encoding::DefaultFuchsiaResourceDialect
959                        );
960                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
961                        let control_handle =
962                            ActiveSessionControlHandle { inner: this.inner.clone() };
963                        Ok(ActiveSessionRequest::WatchActiveSession {
964                            responder: ActiveSessionWatchActiveSessionResponder {
965                                control_handle: std::mem::ManuallyDrop::new(control_handle),
966                                tx_id: header.tx_id,
967                            },
968                        })
969                    }
970                    _ => Err(fidl::Error::UnknownOrdinal {
971                        ordinal: header.ordinal,
972                        protocol_name:
973                            <ActiveSessionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
974                    }),
975                }))
976            },
977        )
978    }
979}
980
981/// A protocol for watching the current active media session on the device.
982///
983/// The currently active media session is the most recent existing media session
984/// to announce a "Playing" state on the local device, even if it is now paused.
985#[derive(Debug)]
986pub enum ActiveSessionRequest {
987    /// Watches the active session. The first request will be answered immediately
988    /// with the current active session. Always leave a request hanging to receive
989    /// a reply when the active session changes.
990    WatchActiveSession { responder: ActiveSessionWatchActiveSessionResponder },
991}
992
993impl ActiveSessionRequest {
994    #[allow(irrefutable_let_patterns)]
995    pub fn into_watch_active_session(self) -> Option<(ActiveSessionWatchActiveSessionResponder)> {
996        if let ActiveSessionRequest::WatchActiveSession { responder } = self {
997            Some((responder))
998        } else {
999            None
1000        }
1001    }
1002
1003    /// Name of the method defined in FIDL
1004    pub fn method_name(&self) -> &'static str {
1005        match *self {
1006            ActiveSessionRequest::WatchActiveSession { .. } => "watch_active_session",
1007        }
1008    }
1009}
1010
1011#[derive(Debug, Clone)]
1012pub struct ActiveSessionControlHandle {
1013    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1014}
1015
1016impl fidl::endpoints::ControlHandle for ActiveSessionControlHandle {
1017    fn shutdown(&self) {
1018        self.inner.shutdown()
1019    }
1020    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1021        self.inner.shutdown_with_epitaph(status)
1022    }
1023
1024    fn is_closed(&self) -> bool {
1025        self.inner.channel().is_closed()
1026    }
1027    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1028        self.inner.channel().on_closed()
1029    }
1030
1031    #[cfg(target_os = "fuchsia")]
1032    fn signal_peer(
1033        &self,
1034        clear_mask: zx::Signals,
1035        set_mask: zx::Signals,
1036    ) -> Result<(), zx_status::Status> {
1037        use fidl::Peered;
1038        self.inner.channel().signal_peer(clear_mask, set_mask)
1039    }
1040}
1041
1042impl ActiveSessionControlHandle {}
1043
1044#[must_use = "FIDL methods require a response to be sent"]
1045#[derive(Debug)]
1046pub struct ActiveSessionWatchActiveSessionResponder {
1047    control_handle: std::mem::ManuallyDrop<ActiveSessionControlHandle>,
1048    tx_id: u32,
1049}
1050
1051/// Set the the channel to be shutdown (see [`ActiveSessionControlHandle::shutdown`])
1052/// if the responder is dropped without sending a response, so that the client
1053/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1054impl std::ops::Drop for ActiveSessionWatchActiveSessionResponder {
1055    fn drop(&mut self) {
1056        self.control_handle.shutdown();
1057        // Safety: drops once, never accessed again
1058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1059    }
1060}
1061
1062impl fidl::endpoints::Responder for ActiveSessionWatchActiveSessionResponder {
1063    type ControlHandle = ActiveSessionControlHandle;
1064
1065    fn control_handle(&self) -> &ActiveSessionControlHandle {
1066        &self.control_handle
1067    }
1068
1069    fn drop_without_shutdown(mut self) {
1070        // Safety: drops once, never accessed again due to mem::forget
1071        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1072        // Prevent Drop from running (which would shut down the channel)
1073        std::mem::forget(self);
1074    }
1075}
1076
1077impl ActiveSessionWatchActiveSessionResponder {
1078    /// Sends a response to the FIDL transaction.
1079    ///
1080    /// Sets the channel to shutdown if an error occurs.
1081    pub fn send(
1082        self,
1083        mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
1084    ) -> Result<(), fidl::Error> {
1085        let _result = self.send_raw(session);
1086        if _result.is_err() {
1087            self.control_handle.shutdown();
1088        }
1089        self.drop_without_shutdown();
1090        _result
1091    }
1092
1093    /// Similar to "send" but does not shutdown the channel if an error occurs.
1094    pub fn send_no_shutdown_on_err(
1095        self,
1096        mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
1097    ) -> Result<(), fidl::Error> {
1098        let _result = self.send_raw(session);
1099        self.drop_without_shutdown();
1100        _result
1101    }
1102
1103    fn send_raw(
1104        &self,
1105        mut session: Option<fidl::endpoints::ClientEnd<SessionControlMarker>>,
1106    ) -> Result<(), fidl::Error> {
1107        self.control_handle.inner.send::<ActiveSessionWatchActiveSessionResponse>(
1108            (session,),
1109            self.tx_id,
1110            0xc072168d525fff8,
1111            fidl::encoding::DynamicFlags::empty(),
1112        )
1113    }
1114}
1115
1116#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1117pub struct DiscoveryMarker;
1118
1119impl fidl::endpoints::ProtocolMarker for DiscoveryMarker {
1120    type Proxy = DiscoveryProxy;
1121    type RequestStream = DiscoveryRequestStream;
1122    #[cfg(target_os = "fuchsia")]
1123    type SynchronousProxy = DiscoverySynchronousProxy;
1124
1125    const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.Discovery";
1126}
1127impl fidl::endpoints::DiscoverableProtocolMarker for DiscoveryMarker {}
1128
1129pub trait DiscoveryProxyInterface: Send + Sync {
1130    fn r#watch_sessions(
1131        &self,
1132        watch_options: &WatchOptions,
1133        session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1134    ) -> Result<(), fidl::Error>;
1135    fn r#connect_to_session(
1136        &self,
1137        session_id: u64,
1138        session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
1139    ) -> Result<(), fidl::Error>;
1140}
1141#[derive(Debug)]
1142#[cfg(target_os = "fuchsia")]
1143pub struct DiscoverySynchronousProxy {
1144    client: fidl::client::sync::Client,
1145}
1146
1147#[cfg(target_os = "fuchsia")]
1148impl fidl::endpoints::SynchronousProxy for DiscoverySynchronousProxy {
1149    type Proxy = DiscoveryProxy;
1150    type Protocol = DiscoveryMarker;
1151
1152    fn from_channel(inner: fidl::Channel) -> Self {
1153        Self::new(inner)
1154    }
1155
1156    fn into_channel(self) -> fidl::Channel {
1157        self.client.into_channel()
1158    }
1159
1160    fn as_channel(&self) -> &fidl::Channel {
1161        self.client.as_channel()
1162    }
1163}
1164
1165#[cfg(target_os = "fuchsia")]
1166impl DiscoverySynchronousProxy {
1167    pub fn new(channel: fidl::Channel) -> Self {
1168        let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1169        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1170    }
1171
1172    pub fn into_channel(self) -> fidl::Channel {
1173        self.client.into_channel()
1174    }
1175
1176    /// Waits until an event arrives and returns it. It is safe for other
1177    /// threads to make concurrent requests while waiting for an event.
1178    pub fn wait_for_event(
1179        &self,
1180        deadline: zx::MonotonicInstant,
1181    ) -> Result<DiscoveryEvent, fidl::Error> {
1182        DiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
1183    }
1184
1185    /// Connects a session watcher configured with the given options.
1186    pub fn r#watch_sessions(
1187        &self,
1188        mut watch_options: &WatchOptions,
1189        mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1190    ) -> Result<(), fidl::Error> {
1191        self.client.send::<DiscoveryWatchSessionsRequest>(
1192            (watch_options, session_watcher),
1193            0x4231b30d98dcd2fe,
1194            fidl::encoding::DynamicFlags::empty(),
1195        )
1196    }
1197
1198    /// Connects to a `SessionControl` for `session_id` if present. Drops the
1199    /// given channel otherwise.
1200    pub fn r#connect_to_session(
1201        &self,
1202        mut session_id: u64,
1203        mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
1204    ) -> Result<(), fidl::Error> {
1205        self.client.send::<DiscoveryConnectToSessionRequest>(
1206            (session_id, session_control_request),
1207            0x37da54e09f63ca3d,
1208            fidl::encoding::DynamicFlags::empty(),
1209        )
1210    }
1211}
1212
1213#[derive(Debug, Clone)]
1214pub struct DiscoveryProxy {
1215    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1216}
1217
1218impl fidl::endpoints::Proxy for DiscoveryProxy {
1219    type Protocol = DiscoveryMarker;
1220
1221    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1222        Self::new(inner)
1223    }
1224
1225    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1226        self.client.into_channel().map_err(|client| Self { client })
1227    }
1228
1229    fn as_channel(&self) -> &::fidl::AsyncChannel {
1230        self.client.as_channel()
1231    }
1232}
1233
1234impl DiscoveryProxy {
1235    /// Create a new Proxy for fuchsia.media.sessions2/Discovery.
1236    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1237        let protocol_name = <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1238        Self { client: fidl::client::Client::new(channel, protocol_name) }
1239    }
1240
1241    /// Get a Stream of events from the remote end of the protocol.
1242    ///
1243    /// # Panics
1244    ///
1245    /// Panics if the event stream was already taken.
1246    pub fn take_event_stream(&self) -> DiscoveryEventStream {
1247        DiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
1248    }
1249
1250    /// Connects a session watcher configured with the given options.
1251    pub fn r#watch_sessions(
1252        &self,
1253        mut watch_options: &WatchOptions,
1254        mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1255    ) -> Result<(), fidl::Error> {
1256        DiscoveryProxyInterface::r#watch_sessions(self, watch_options, session_watcher)
1257    }
1258
1259    /// Connects to a `SessionControl` for `session_id` if present. Drops the
1260    /// given channel otherwise.
1261    pub fn r#connect_to_session(
1262        &self,
1263        mut session_id: u64,
1264        mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
1265    ) -> Result<(), fidl::Error> {
1266        DiscoveryProxyInterface::r#connect_to_session(self, session_id, session_control_request)
1267    }
1268}
1269
1270impl DiscoveryProxyInterface for DiscoveryProxy {
1271    fn r#watch_sessions(
1272        &self,
1273        mut watch_options: &WatchOptions,
1274        mut session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1275    ) -> Result<(), fidl::Error> {
1276        self.client.send::<DiscoveryWatchSessionsRequest>(
1277            (watch_options, session_watcher),
1278            0x4231b30d98dcd2fe,
1279            fidl::encoding::DynamicFlags::empty(),
1280        )
1281    }
1282
1283    fn r#connect_to_session(
1284        &self,
1285        mut session_id: u64,
1286        mut session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
1287    ) -> Result<(), fidl::Error> {
1288        self.client.send::<DiscoveryConnectToSessionRequest>(
1289            (session_id, session_control_request),
1290            0x37da54e09f63ca3d,
1291            fidl::encoding::DynamicFlags::empty(),
1292        )
1293    }
1294}
1295
1296pub struct DiscoveryEventStream {
1297    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1298}
1299
1300impl std::marker::Unpin for DiscoveryEventStream {}
1301
1302impl futures::stream::FusedStream for DiscoveryEventStream {
1303    fn is_terminated(&self) -> bool {
1304        self.event_receiver.is_terminated()
1305    }
1306}
1307
1308impl futures::Stream for DiscoveryEventStream {
1309    type Item = Result<DiscoveryEvent, fidl::Error>;
1310
1311    fn poll_next(
1312        mut self: std::pin::Pin<&mut Self>,
1313        cx: &mut std::task::Context<'_>,
1314    ) -> std::task::Poll<Option<Self::Item>> {
1315        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1316            &mut self.event_receiver,
1317            cx
1318        )?) {
1319            Some(buf) => std::task::Poll::Ready(Some(DiscoveryEvent::decode(buf))),
1320            None => std::task::Poll::Ready(None),
1321        }
1322    }
1323}
1324
1325#[derive(Debug)]
1326pub enum DiscoveryEvent {}
1327
1328impl DiscoveryEvent {
1329    /// Decodes a message buffer as a [`DiscoveryEvent`].
1330    fn decode(
1331        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1332    ) -> Result<DiscoveryEvent, fidl::Error> {
1333        let (bytes, _handles) = buf.split_mut();
1334        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1335        debug_assert_eq!(tx_header.tx_id, 0);
1336        match tx_header.ordinal {
1337            _ => Err(fidl::Error::UnknownOrdinal {
1338                ordinal: tx_header.ordinal,
1339                protocol_name: <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1340            }),
1341        }
1342    }
1343}
1344
1345/// A Stream of incoming requests for fuchsia.media.sessions2/Discovery.
1346pub struct DiscoveryRequestStream {
1347    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1348    is_terminated: bool,
1349}
1350
1351impl std::marker::Unpin for DiscoveryRequestStream {}
1352
1353impl futures::stream::FusedStream for DiscoveryRequestStream {
1354    fn is_terminated(&self) -> bool {
1355        self.is_terminated
1356    }
1357}
1358
1359impl fidl::endpoints::RequestStream for DiscoveryRequestStream {
1360    type Protocol = DiscoveryMarker;
1361    type ControlHandle = DiscoveryControlHandle;
1362
1363    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1364        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1365    }
1366
1367    fn control_handle(&self) -> Self::ControlHandle {
1368        DiscoveryControlHandle { inner: self.inner.clone() }
1369    }
1370
1371    fn into_inner(
1372        self,
1373    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1374    {
1375        (self.inner, self.is_terminated)
1376    }
1377
1378    fn from_inner(
1379        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1380        is_terminated: bool,
1381    ) -> Self {
1382        Self { inner, is_terminated }
1383    }
1384}
1385
1386impl futures::Stream for DiscoveryRequestStream {
1387    type Item = Result<DiscoveryRequest, fidl::Error>;
1388
1389    fn poll_next(
1390        mut self: std::pin::Pin<&mut Self>,
1391        cx: &mut std::task::Context<'_>,
1392    ) -> std::task::Poll<Option<Self::Item>> {
1393        let this = &mut *self;
1394        if this.inner.check_shutdown(cx) {
1395            this.is_terminated = true;
1396            return std::task::Poll::Ready(None);
1397        }
1398        if this.is_terminated {
1399            panic!("polled DiscoveryRequestStream after completion");
1400        }
1401        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1402            |bytes, handles| {
1403                match this.inner.channel().read_etc(cx, bytes, handles) {
1404                    std::task::Poll::Ready(Ok(())) => {}
1405                    std::task::Poll::Pending => return std::task::Poll::Pending,
1406                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1407                        this.is_terminated = true;
1408                        return std::task::Poll::Ready(None);
1409                    }
1410                    std::task::Poll::Ready(Err(e)) => {
1411                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1412                            e.into(),
1413                        ))))
1414                    }
1415                }
1416
1417                // A message has been received from the channel
1418                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1419
1420                std::task::Poll::Ready(Some(match header.ordinal {
1421                    0x4231b30d98dcd2fe => {
1422                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1423                        let mut req = fidl::new_empty!(
1424                            DiscoveryWatchSessionsRequest,
1425                            fidl::encoding::DefaultFuchsiaResourceDialect
1426                        );
1427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryWatchSessionsRequest>(&header, _body_bytes, handles, &mut req)?;
1428                        let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
1429                        Ok(DiscoveryRequest::WatchSessions {
1430                            watch_options: req.watch_options,
1431                            session_watcher: req.session_watcher,
1432
1433                            control_handle,
1434                        })
1435                    }
1436                    0x37da54e09f63ca3d => {
1437                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1438                        let mut req = fidl::new_empty!(
1439                            DiscoveryConnectToSessionRequest,
1440                            fidl::encoding::DefaultFuchsiaResourceDialect
1441                        );
1442                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiscoveryConnectToSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1443                        let control_handle = DiscoveryControlHandle { inner: this.inner.clone() };
1444                        Ok(DiscoveryRequest::ConnectToSession {
1445                            session_id: req.session_id,
1446                            session_control_request: req.session_control_request,
1447
1448                            control_handle,
1449                        })
1450                    }
1451                    _ => Err(fidl::Error::UnknownOrdinal {
1452                        ordinal: header.ordinal,
1453                        protocol_name:
1454                            <DiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1455                    }),
1456                }))
1457            },
1458        )
1459    }
1460}
1461
1462/// `Discovery` observes the collection of published media sessions
1463/// and connects clients to them.
1464#[derive(Debug)]
1465pub enum DiscoveryRequest {
1466    /// Connects a session watcher configured with the given options.
1467    WatchSessions {
1468        watch_options: WatchOptions,
1469        session_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1470        control_handle: DiscoveryControlHandle,
1471    },
1472    /// Connects to a `SessionControl` for `session_id` if present. Drops the
1473    /// given channel otherwise.
1474    ConnectToSession {
1475        session_id: u64,
1476        session_control_request: fidl::endpoints::ServerEnd<SessionControlMarker>,
1477        control_handle: DiscoveryControlHandle,
1478    },
1479}
1480
1481impl DiscoveryRequest {
1482    #[allow(irrefutable_let_patterns)]
1483    pub fn into_watch_sessions(
1484        self,
1485    ) -> Option<(
1486        WatchOptions,
1487        fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1488        DiscoveryControlHandle,
1489    )> {
1490        if let DiscoveryRequest::WatchSessions { watch_options, session_watcher, control_handle } =
1491            self
1492        {
1493            Some((watch_options, session_watcher, control_handle))
1494        } else {
1495            None
1496        }
1497    }
1498
1499    #[allow(irrefutable_let_patterns)]
1500    pub fn into_connect_to_session(
1501        self,
1502    ) -> Option<(u64, fidl::endpoints::ServerEnd<SessionControlMarker>, DiscoveryControlHandle)>
1503    {
1504        if let DiscoveryRequest::ConnectToSession {
1505            session_id,
1506            session_control_request,
1507            control_handle,
1508        } = self
1509        {
1510            Some((session_id, session_control_request, control_handle))
1511        } else {
1512            None
1513        }
1514    }
1515
1516    /// Name of the method defined in FIDL
1517    pub fn method_name(&self) -> &'static str {
1518        match *self {
1519            DiscoveryRequest::WatchSessions { .. } => "watch_sessions",
1520            DiscoveryRequest::ConnectToSession { .. } => "connect_to_session",
1521        }
1522    }
1523}
1524
1525#[derive(Debug, Clone)]
1526pub struct DiscoveryControlHandle {
1527    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1528}
1529
1530impl fidl::endpoints::ControlHandle for DiscoveryControlHandle {
1531    fn shutdown(&self) {
1532        self.inner.shutdown()
1533    }
1534    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1535        self.inner.shutdown_with_epitaph(status)
1536    }
1537
1538    fn is_closed(&self) -> bool {
1539        self.inner.channel().is_closed()
1540    }
1541    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1542        self.inner.channel().on_closed()
1543    }
1544
1545    #[cfg(target_os = "fuchsia")]
1546    fn signal_peer(
1547        &self,
1548        clear_mask: zx::Signals,
1549        set_mask: zx::Signals,
1550    ) -> Result<(), zx_status::Status> {
1551        use fidl::Peered;
1552        self.inner.channel().signal_peer(clear_mask, set_mask)
1553    }
1554}
1555
1556impl DiscoveryControlHandle {}
1557
1558#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1559pub struct ObserverDiscoveryMarker;
1560
1561impl fidl::endpoints::ProtocolMarker for ObserverDiscoveryMarker {
1562    type Proxy = ObserverDiscoveryProxy;
1563    type RequestStream = ObserverDiscoveryRequestStream;
1564    #[cfg(target_os = "fuchsia")]
1565    type SynchronousProxy = ObserverDiscoverySynchronousProxy;
1566
1567    const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.ObserverDiscovery";
1568}
1569impl fidl::endpoints::DiscoverableProtocolMarker for ObserverDiscoveryMarker {}
1570
1571pub trait ObserverDiscoveryProxyInterface: Send + Sync {
1572    fn r#watch_sessions(
1573        &self,
1574        watch_options: &WatchOptions,
1575        sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1576    ) -> Result<(), fidl::Error>;
1577    fn r#connect_to_session(
1578        &self,
1579        session_id: u64,
1580        session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1581    ) -> Result<(), fidl::Error>;
1582}
1583#[derive(Debug)]
1584#[cfg(target_os = "fuchsia")]
1585pub struct ObserverDiscoverySynchronousProxy {
1586    client: fidl::client::sync::Client,
1587}
1588
1589#[cfg(target_os = "fuchsia")]
1590impl fidl::endpoints::SynchronousProxy for ObserverDiscoverySynchronousProxy {
1591    type Proxy = ObserverDiscoveryProxy;
1592    type Protocol = ObserverDiscoveryMarker;
1593
1594    fn from_channel(inner: fidl::Channel) -> Self {
1595        Self::new(inner)
1596    }
1597
1598    fn into_channel(self) -> fidl::Channel {
1599        self.client.into_channel()
1600    }
1601
1602    fn as_channel(&self) -> &fidl::Channel {
1603        self.client.as_channel()
1604    }
1605}
1606
1607#[cfg(target_os = "fuchsia")]
1608impl ObserverDiscoverySynchronousProxy {
1609    pub fn new(channel: fidl::Channel) -> Self {
1610        let protocol_name =
1611            <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1612        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1613    }
1614
1615    pub fn into_channel(self) -> fidl::Channel {
1616        self.client.into_channel()
1617    }
1618
1619    /// Waits until an event arrives and returns it. It is safe for other
1620    /// threads to make concurrent requests while waiting for an event.
1621    pub fn wait_for_event(
1622        &self,
1623        deadline: zx::MonotonicInstant,
1624    ) -> Result<ObserverDiscoveryEvent, fidl::Error> {
1625        ObserverDiscoveryEvent::decode(self.client.wait_for_event(deadline)?)
1626    }
1627
1628    /// Connects a session watcher configured with the given options.
1629    pub fn r#watch_sessions(
1630        &self,
1631        mut watch_options: &WatchOptions,
1632        mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1633    ) -> Result<(), fidl::Error> {
1634        self.client.send::<ObserverDiscoveryWatchSessionsRequest>(
1635            (watch_options, sessions_watcher),
1636            0x3d95eaa20624a1fe,
1637            fidl::encoding::DynamicFlags::empty(),
1638        )
1639    }
1640
1641    /// Connects to a `SessionObserver` for `session_id` if present. Drops the
1642    /// given channel otherwise.
1643    pub fn r#connect_to_session(
1644        &self,
1645        mut session_id: u64,
1646        mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1647    ) -> Result<(), fidl::Error> {
1648        self.client.send::<ObserverDiscoveryConnectToSessionRequest>(
1649            (session_id, session_request),
1650            0x2c9b99aacfaac87a,
1651            fidl::encoding::DynamicFlags::empty(),
1652        )
1653    }
1654}
1655
1656#[derive(Debug, Clone)]
1657pub struct ObserverDiscoveryProxy {
1658    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1659}
1660
1661impl fidl::endpoints::Proxy for ObserverDiscoveryProxy {
1662    type Protocol = ObserverDiscoveryMarker;
1663
1664    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1665        Self::new(inner)
1666    }
1667
1668    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1669        self.client.into_channel().map_err(|client| Self { client })
1670    }
1671
1672    fn as_channel(&self) -> &::fidl::AsyncChannel {
1673        self.client.as_channel()
1674    }
1675}
1676
1677impl ObserverDiscoveryProxy {
1678    /// Create a new Proxy for fuchsia.media.sessions2/ObserverDiscovery.
1679    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1680        let protocol_name =
1681            <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1682        Self { client: fidl::client::Client::new(channel, protocol_name) }
1683    }
1684
1685    /// Get a Stream of events from the remote end of the protocol.
1686    ///
1687    /// # Panics
1688    ///
1689    /// Panics if the event stream was already taken.
1690    pub fn take_event_stream(&self) -> ObserverDiscoveryEventStream {
1691        ObserverDiscoveryEventStream { event_receiver: self.client.take_event_receiver() }
1692    }
1693
1694    /// Connects a session watcher configured with the given options.
1695    pub fn r#watch_sessions(
1696        &self,
1697        mut watch_options: &WatchOptions,
1698        mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1699    ) -> Result<(), fidl::Error> {
1700        ObserverDiscoveryProxyInterface::r#watch_sessions(self, watch_options, sessions_watcher)
1701    }
1702
1703    /// Connects to a `SessionObserver` for `session_id` if present. Drops the
1704    /// given channel otherwise.
1705    pub fn r#connect_to_session(
1706        &self,
1707        mut session_id: u64,
1708        mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1709    ) -> Result<(), fidl::Error> {
1710        ObserverDiscoveryProxyInterface::r#connect_to_session(self, session_id, session_request)
1711    }
1712}
1713
1714impl ObserverDiscoveryProxyInterface for ObserverDiscoveryProxy {
1715    fn r#watch_sessions(
1716        &self,
1717        mut watch_options: &WatchOptions,
1718        mut sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1719    ) -> Result<(), fidl::Error> {
1720        self.client.send::<ObserverDiscoveryWatchSessionsRequest>(
1721            (watch_options, sessions_watcher),
1722            0x3d95eaa20624a1fe,
1723            fidl::encoding::DynamicFlags::empty(),
1724        )
1725    }
1726
1727    fn r#connect_to_session(
1728        &self,
1729        mut session_id: u64,
1730        mut session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1731    ) -> Result<(), fidl::Error> {
1732        self.client.send::<ObserverDiscoveryConnectToSessionRequest>(
1733            (session_id, session_request),
1734            0x2c9b99aacfaac87a,
1735            fidl::encoding::DynamicFlags::empty(),
1736        )
1737    }
1738}
1739
1740pub struct ObserverDiscoveryEventStream {
1741    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1742}
1743
1744impl std::marker::Unpin for ObserverDiscoveryEventStream {}
1745
1746impl futures::stream::FusedStream for ObserverDiscoveryEventStream {
1747    fn is_terminated(&self) -> bool {
1748        self.event_receiver.is_terminated()
1749    }
1750}
1751
1752impl futures::Stream for ObserverDiscoveryEventStream {
1753    type Item = Result<ObserverDiscoveryEvent, fidl::Error>;
1754
1755    fn poll_next(
1756        mut self: std::pin::Pin<&mut Self>,
1757        cx: &mut std::task::Context<'_>,
1758    ) -> std::task::Poll<Option<Self::Item>> {
1759        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1760            &mut self.event_receiver,
1761            cx
1762        )?) {
1763            Some(buf) => std::task::Poll::Ready(Some(ObserverDiscoveryEvent::decode(buf))),
1764            None => std::task::Poll::Ready(None),
1765        }
1766    }
1767}
1768
1769#[derive(Debug)]
1770pub enum ObserverDiscoveryEvent {}
1771
1772impl ObserverDiscoveryEvent {
1773    /// Decodes a message buffer as a [`ObserverDiscoveryEvent`].
1774    fn decode(
1775        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1776    ) -> Result<ObserverDiscoveryEvent, fidl::Error> {
1777        let (bytes, _handles) = buf.split_mut();
1778        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1779        debug_assert_eq!(tx_header.tx_id, 0);
1780        match tx_header.ordinal {
1781            _ => Err(fidl::Error::UnknownOrdinal {
1782                ordinal: tx_header.ordinal,
1783                protocol_name:
1784                    <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1785            }),
1786        }
1787    }
1788}
1789
1790/// A Stream of incoming requests for fuchsia.media.sessions2/ObserverDiscovery.
1791pub struct ObserverDiscoveryRequestStream {
1792    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1793    is_terminated: bool,
1794}
1795
1796impl std::marker::Unpin for ObserverDiscoveryRequestStream {}
1797
1798impl futures::stream::FusedStream for ObserverDiscoveryRequestStream {
1799    fn is_terminated(&self) -> bool {
1800        self.is_terminated
1801    }
1802}
1803
1804impl fidl::endpoints::RequestStream for ObserverDiscoveryRequestStream {
1805    type Protocol = ObserverDiscoveryMarker;
1806    type ControlHandle = ObserverDiscoveryControlHandle;
1807
1808    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1809        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1810    }
1811
1812    fn control_handle(&self) -> Self::ControlHandle {
1813        ObserverDiscoveryControlHandle { inner: self.inner.clone() }
1814    }
1815
1816    fn into_inner(
1817        self,
1818    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1819    {
1820        (self.inner, self.is_terminated)
1821    }
1822
1823    fn from_inner(
1824        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1825        is_terminated: bool,
1826    ) -> Self {
1827        Self { inner, is_terminated }
1828    }
1829}
1830
1831impl futures::Stream for ObserverDiscoveryRequestStream {
1832    type Item = Result<ObserverDiscoveryRequest, fidl::Error>;
1833
1834    fn poll_next(
1835        mut self: std::pin::Pin<&mut Self>,
1836        cx: &mut std::task::Context<'_>,
1837    ) -> std::task::Poll<Option<Self::Item>> {
1838        let this = &mut *self;
1839        if this.inner.check_shutdown(cx) {
1840            this.is_terminated = true;
1841            return std::task::Poll::Ready(None);
1842        }
1843        if this.is_terminated {
1844            panic!("polled ObserverDiscoveryRequestStream after completion");
1845        }
1846        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1847            |bytes, handles| {
1848                match this.inner.channel().read_etc(cx, bytes, handles) {
1849                    std::task::Poll::Ready(Ok(())) => {}
1850                    std::task::Poll::Pending => return std::task::Poll::Pending,
1851                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1852                        this.is_terminated = true;
1853                        return std::task::Poll::Ready(None);
1854                    }
1855                    std::task::Poll::Ready(Err(e)) => {
1856                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1857                            e.into(),
1858                        ))))
1859                    }
1860                }
1861
1862                // A message has been received from the channel
1863                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1864
1865                std::task::Poll::Ready(Some(match header.ordinal {
1866                    0x3d95eaa20624a1fe => {
1867                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1868                        let mut req = fidl::new_empty!(
1869                            ObserverDiscoveryWatchSessionsRequest,
1870                            fidl::encoding::DefaultFuchsiaResourceDialect
1871                        );
1872                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ObserverDiscoveryWatchSessionsRequest>(&header, _body_bytes, handles, &mut req)?;
1873                        let control_handle =
1874                            ObserverDiscoveryControlHandle { inner: this.inner.clone() };
1875                        Ok(ObserverDiscoveryRequest::WatchSessions {
1876                            watch_options: req.watch_options,
1877                            sessions_watcher: req.sessions_watcher,
1878
1879                            control_handle,
1880                        })
1881                    }
1882                    0x2c9b99aacfaac87a => {
1883                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1884                        let mut req = fidl::new_empty!(
1885                            ObserverDiscoveryConnectToSessionRequest,
1886                            fidl::encoding::DefaultFuchsiaResourceDialect
1887                        );
1888                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ObserverDiscoveryConnectToSessionRequest>(&header, _body_bytes, handles, &mut req)?;
1889                        let control_handle =
1890                            ObserverDiscoveryControlHandle { inner: this.inner.clone() };
1891                        Ok(ObserverDiscoveryRequest::ConnectToSession {
1892                            session_id: req.session_id,
1893                            session_request: req.session_request,
1894
1895                            control_handle,
1896                        })
1897                    }
1898                    _ => Err(fidl::Error::UnknownOrdinal {
1899                        ordinal: header.ordinal,
1900                        protocol_name:
1901                            <ObserverDiscoveryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1902                    }),
1903                }))
1904            },
1905        )
1906    }
1907}
1908
1909/// `ObserverDiscovery` observes the collection of published media sessions
1910/// and connects clients to them for observation without playback controls.
1911#[derive(Debug)]
1912pub enum ObserverDiscoveryRequest {
1913    /// Connects a session watcher configured with the given options.
1914    WatchSessions {
1915        watch_options: WatchOptions,
1916        sessions_watcher: fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1917        control_handle: ObserverDiscoveryControlHandle,
1918    },
1919    /// Connects to a `SessionObserver` for `session_id` if present. Drops the
1920    /// given channel otherwise.
1921    ConnectToSession {
1922        session_id: u64,
1923        session_request: fidl::endpoints::ServerEnd<SessionObserverMarker>,
1924        control_handle: ObserverDiscoveryControlHandle,
1925    },
1926}
1927
1928impl ObserverDiscoveryRequest {
1929    #[allow(irrefutable_let_patterns)]
1930    pub fn into_watch_sessions(
1931        self,
1932    ) -> Option<(
1933        WatchOptions,
1934        fidl::endpoints::ClientEnd<SessionsWatcherMarker>,
1935        ObserverDiscoveryControlHandle,
1936    )> {
1937        if let ObserverDiscoveryRequest::WatchSessions {
1938            watch_options,
1939            sessions_watcher,
1940            control_handle,
1941        } = self
1942        {
1943            Some((watch_options, sessions_watcher, control_handle))
1944        } else {
1945            None
1946        }
1947    }
1948
1949    #[allow(irrefutable_let_patterns)]
1950    pub fn into_connect_to_session(
1951        self,
1952    ) -> Option<(
1953        u64,
1954        fidl::endpoints::ServerEnd<SessionObserverMarker>,
1955        ObserverDiscoveryControlHandle,
1956    )> {
1957        if let ObserverDiscoveryRequest::ConnectToSession {
1958            session_id,
1959            session_request,
1960            control_handle,
1961        } = self
1962        {
1963            Some((session_id, session_request, control_handle))
1964        } else {
1965            None
1966        }
1967    }
1968
1969    /// Name of the method defined in FIDL
1970    pub fn method_name(&self) -> &'static str {
1971        match *self {
1972            ObserverDiscoveryRequest::WatchSessions { .. } => "watch_sessions",
1973            ObserverDiscoveryRequest::ConnectToSession { .. } => "connect_to_session",
1974        }
1975    }
1976}
1977
1978#[derive(Debug, Clone)]
1979pub struct ObserverDiscoveryControlHandle {
1980    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1981}
1982
1983impl fidl::endpoints::ControlHandle for ObserverDiscoveryControlHandle {
1984    fn shutdown(&self) {
1985        self.inner.shutdown()
1986    }
1987    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1988        self.inner.shutdown_with_epitaph(status)
1989    }
1990
1991    fn is_closed(&self) -> bool {
1992        self.inner.channel().is_closed()
1993    }
1994    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1995        self.inner.channel().on_closed()
1996    }
1997
1998    #[cfg(target_os = "fuchsia")]
1999    fn signal_peer(
2000        &self,
2001        clear_mask: zx::Signals,
2002        set_mask: zx::Signals,
2003    ) -> Result<(), zx_status::Status> {
2004        use fidl::Peered;
2005        self.inner.channel().signal_peer(clear_mask, set_mask)
2006    }
2007}
2008
2009impl ObserverDiscoveryControlHandle {}
2010
2011#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2012pub struct PlayerMarker;
2013
2014impl fidl::endpoints::ProtocolMarker for PlayerMarker {
2015    type Proxy = PlayerProxy;
2016    type RequestStream = PlayerRequestStream;
2017    #[cfg(target_os = "fuchsia")]
2018    type SynchronousProxy = PlayerSynchronousProxy;
2019
2020    const DEBUG_NAME: &'static str = "(anonymous) Player";
2021}
2022
2023pub trait PlayerProxyInterface: Send + Sync {
2024    fn r#play(&self) -> Result<(), fidl::Error>;
2025    fn r#pause(&self) -> Result<(), fidl::Error>;
2026    fn r#stop(&self) -> Result<(), fidl::Error>;
2027    fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
2028    fn r#skip_forward(&self) -> Result<(), fidl::Error>;
2029    fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
2030    fn r#next_item(&self) -> Result<(), fidl::Error>;
2031    fn r#prev_item(&self) -> Result<(), fidl::Error>;
2032    fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
2033    fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
2034    fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
2035    fn r#bind_volume_control(
2036        &self,
2037        volume_control_request: fidl::endpoints::ServerEnd<
2038            fidl_fuchsia_media_audio::VolumeControlMarker,
2039        >,
2040    ) -> Result<(), fidl::Error>;
2041    type WatchInfoChangeResponseFut: std::future::Future<Output = Result<PlayerInfoDelta, fidl::Error>>
2042        + Send;
2043    fn r#watch_info_change(&self) -> Self::WatchInfoChangeResponseFut;
2044}
2045#[derive(Debug)]
2046#[cfg(target_os = "fuchsia")]
2047pub struct PlayerSynchronousProxy {
2048    client: fidl::client::sync::Client,
2049}
2050
2051#[cfg(target_os = "fuchsia")]
2052impl fidl::endpoints::SynchronousProxy for PlayerSynchronousProxy {
2053    type Proxy = PlayerProxy;
2054    type Protocol = PlayerMarker;
2055
2056    fn from_channel(inner: fidl::Channel) -> Self {
2057        Self::new(inner)
2058    }
2059
2060    fn into_channel(self) -> fidl::Channel {
2061        self.client.into_channel()
2062    }
2063
2064    fn as_channel(&self) -> &fidl::Channel {
2065        self.client.as_channel()
2066    }
2067}
2068
2069#[cfg(target_os = "fuchsia")]
2070impl PlayerSynchronousProxy {
2071    pub fn new(channel: fidl::Channel) -> Self {
2072        let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2073        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2074    }
2075
2076    pub fn into_channel(self) -> fidl::Channel {
2077        self.client.into_channel()
2078    }
2079
2080    /// Waits until an event arrives and returns it. It is safe for other
2081    /// threads to make concurrent requests while waiting for an event.
2082    pub fn wait_for_event(
2083        &self,
2084        deadline: zx::MonotonicInstant,
2085    ) -> Result<PlayerEvent, fidl::Error> {
2086        PlayerEvent::decode(self.client.wait_for_event(deadline)?)
2087    }
2088
2089    /// Plays media. If this method is not supported as indicated by the absence of the `PLAY`
2090    /// flag in `PlayerCapabilities`, this method does nothing.
2091    pub fn r#play(&self) -> Result<(), fidl::Error> {
2092        self.client.send::<fidl::encoding::EmptyPayload>(
2093            (),
2094            0x164120d5bdb26f8e,
2095            fidl::encoding::DynamicFlags::empty(),
2096        )
2097    }
2098
2099    /// Pauses playback and retains position in media. If this method is not supported as indicated
2100    /// by the absence of the `PAUSE` flag in `PlayerCapabilities`, this method does nothing.
2101    pub fn r#pause(&self) -> Result<(), fidl::Error> {
2102        self.client.send::<fidl::encoding::EmptyPayload>(
2103            (),
2104            0x1536d16f202ece1,
2105            fidl::encoding::DynamicFlags::empty(),
2106        )
2107    }
2108
2109    /// Stops playback. The session should close.
2110    pub fn r#stop(&self) -> Result<(), fidl::Error> {
2111        self.client.send::<fidl::encoding::EmptyPayload>(
2112            (),
2113            0x1946e5fc6c2362ae,
2114            fidl::encoding::DynamicFlags::empty(),
2115        )
2116    }
2117
2118    /// Seeks to a specific position in media. Implementations are free to
2119    /// enter an error state if the position is out of bounds. `position`
2120    /// is an offset from the beginning of the media. If this method is not supported as indicated
2121    /// by the absence of the `SEEK` flag in `PlayerCapabilities`, this method does nothing.
2122    pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
2123        self.client.send::<PlayerControlSeekRequest>(
2124            (position,),
2125            0x4e7237d293e22125,
2126            fidl::encoding::DynamicFlags::empty(),
2127        )
2128    }
2129
2130    /// Skips forward in media by the player's default skip amount. If this method is not supported
2131    /// as indicated by the absence of the `SKIP_FORWARD` flag in `PlayerCapabilities`, this method
2132    /// does nothing.
2133    pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
2134        self.client.send::<fidl::encoding::EmptyPayload>(
2135            (),
2136            0x6ee04477076dac1b,
2137            fidl::encoding::DynamicFlags::empty(),
2138        )
2139    }
2140
2141    /// Skips in reverse in media by the player's default skip amount. If this method is not
2142    /// supported as indicated by the absence of the `SKIP_REVERSE` flag in `PlayerCapabilities`,
2143    /// this method does nothing.
2144    pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
2145        self.client.send::<fidl::encoding::EmptyPayload>(
2146            (),
2147            0xa4e05644ce33a28,
2148            fidl::encoding::DynamicFlags::empty(),
2149        )
2150    }
2151
2152    /// Changes media to the next item (e.g. next song in playlist). If this method is not
2153    /// supported as indicated by the absence of the `CHANGE_TO_NEXT_ITEM` flag in
2154    /// `PlayerCapabilities`, this method does nothing.
2155    pub fn r#next_item(&self) -> Result<(), fidl::Error> {
2156        self.client.send::<fidl::encoding::EmptyPayload>(
2157            (),
2158            0x73307b32e35ff260,
2159            fidl::encoding::DynamicFlags::empty(),
2160        )
2161    }
2162
2163    /// Changes media to the previous item. If this method is not
2164    /// supported as indicated by the absence of the `CHANGE_TO_PREV_ITEM` flag in
2165    /// `PlayerCapabilities`, this method does nothing.
2166    pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
2167        self.client.send::<fidl::encoding::EmptyPayload>(
2168            (),
2169            0x680444f03a759a3c,
2170            fidl::encoding::DynamicFlags::empty(),
2171        )
2172    }
2173
2174    /// Sets the playback rate of the media. This will not change the playback mode. If this method
2175    /// is not supported as indicated by the absense of the `SET_PLAYBACK_RATE` flag in
2176    /// `PlayerCapabilities`, this method does nothing.
2177    pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
2178        self.client.send::<PlayerControlSetPlaybackRateRequest>(
2179            (playback_rate,),
2180            0x3831b8b161e1bccf,
2181            fidl::encoding::DynamicFlags::empty(),
2182        )
2183    }
2184
2185    /// Sets repeat mode to any of the supported repeat modes.
2186    /// Whether this method takes effect depends on the `PlayerCapabilities` and `repeat_mode`:
2187    ///   * [`OFF`] is always supported.
2188    ///   * [`GROUP`] requires the `REPEAT_GROUPS` capability, and is otherwise ignored.
2189    ///   * [`SINGLE`] requires the `REPEAT_SINGLE` capability, and is otherwise ignored.
2190    pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
2191        self.client.send::<PlayerControlSetRepeatModeRequest>(
2192            (repeat_mode,),
2193            0x21b9b1b17b7f01c2,
2194            fidl::encoding::DynamicFlags::empty(),
2195        )
2196    }
2197
2198    /// Sets shuffle mode. If this method is not supported as indicated by the absence of the
2199    /// `SHUFFLE` flag in `PlayerCapabilities`, this method does nothing.
2200    pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
2201        self.client.send::<PlayerControlSetShuffleModeRequest>(
2202            (shuffle_on,),
2203            0x7451a349ddb543c,
2204            fidl::encoding::DynamicFlags::empty(),
2205        )
2206    }
2207
2208    /// Binds to the session's volume control for control and notifications. If this method is not
2209    /// supported as indicated by the absence of the `HAS_GAIN_CONTROL` flag in
2210    /// `PlayerCapabilities`, the channel handle passed as `volume_control_request` is closed
2211    /// by the service.
2212    pub fn r#bind_volume_control(
2213        &self,
2214        mut volume_control_request: fidl::endpoints::ServerEnd<
2215            fidl_fuchsia_media_audio::VolumeControlMarker,
2216        >,
2217    ) -> Result<(), fidl::Error> {
2218        self.client.send::<PlayerControlBindVolumeControlRequest>(
2219            (volume_control_request,),
2220            0x11d61e878cf808bc,
2221            fidl::encoding::DynamicFlags::empty(),
2222        )
2223    }
2224
2225    /// Gets the net player info change using the hanging get pattern.
2226    pub fn r#watch_info_change(
2227        &self,
2228        ___deadline: zx::MonotonicInstant,
2229    ) -> Result<PlayerInfoDelta, fidl::Error> {
2230        let _response =
2231            self.client.send_query::<fidl::encoding::EmptyPayload, PlayerWatchInfoChangeResponse>(
2232                (),
2233                0x69196e240c62a732,
2234                fidl::encoding::DynamicFlags::empty(),
2235                ___deadline,
2236            )?;
2237        Ok(_response.player_info_delta)
2238    }
2239}
2240
2241#[derive(Debug, Clone)]
2242pub struct PlayerProxy {
2243    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2244}
2245
2246impl fidl::endpoints::Proxy for PlayerProxy {
2247    type Protocol = PlayerMarker;
2248
2249    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2250        Self::new(inner)
2251    }
2252
2253    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2254        self.client.into_channel().map_err(|client| Self { client })
2255    }
2256
2257    fn as_channel(&self) -> &::fidl::AsyncChannel {
2258        self.client.as_channel()
2259    }
2260}
2261
2262impl PlayerProxy {
2263    /// Create a new Proxy for fuchsia.media.sessions2/Player.
2264    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2265        let protocol_name = <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2266        Self { client: fidl::client::Client::new(channel, protocol_name) }
2267    }
2268
2269    /// Get a Stream of events from the remote end of the protocol.
2270    ///
2271    /// # Panics
2272    ///
2273    /// Panics if the event stream was already taken.
2274    pub fn take_event_stream(&self) -> PlayerEventStream {
2275        PlayerEventStream { event_receiver: self.client.take_event_receiver() }
2276    }
2277
2278    /// Plays media. If this method is not supported as indicated by the absence of the `PLAY`
2279    /// flag in `PlayerCapabilities`, this method does nothing.
2280    pub fn r#play(&self) -> Result<(), fidl::Error> {
2281        PlayerProxyInterface::r#play(self)
2282    }
2283
2284    /// Pauses playback and retains position in media. If this method is not supported as indicated
2285    /// by the absence of the `PAUSE` flag in `PlayerCapabilities`, this method does nothing.
2286    pub fn r#pause(&self) -> Result<(), fidl::Error> {
2287        PlayerProxyInterface::r#pause(self)
2288    }
2289
2290    /// Stops playback. The session should close.
2291    pub fn r#stop(&self) -> Result<(), fidl::Error> {
2292        PlayerProxyInterface::r#stop(self)
2293    }
2294
2295    /// Seeks to a specific position in media. Implementations are free to
2296    /// enter an error state if the position is out of bounds. `position`
2297    /// is an offset from the beginning of the media. If this method is not supported as indicated
2298    /// by the absence of the `SEEK` flag in `PlayerCapabilities`, this method does nothing.
2299    pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
2300        PlayerProxyInterface::r#seek(self, position)
2301    }
2302
2303    /// Skips forward in media by the player's default skip amount. If this method is not supported
2304    /// as indicated by the absence of the `SKIP_FORWARD` flag in `PlayerCapabilities`, this method
2305    /// does nothing.
2306    pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
2307        PlayerProxyInterface::r#skip_forward(self)
2308    }
2309
2310    /// Skips in reverse in media by the player's default skip amount. If this method is not
2311    /// supported as indicated by the absence of the `SKIP_REVERSE` flag in `PlayerCapabilities`,
2312    /// this method does nothing.
2313    pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
2314        PlayerProxyInterface::r#skip_reverse(self)
2315    }
2316
2317    /// Changes media to the next item (e.g. next song in playlist). If this method is not
2318    /// supported as indicated by the absence of the `CHANGE_TO_NEXT_ITEM` flag in
2319    /// `PlayerCapabilities`, this method does nothing.
2320    pub fn r#next_item(&self) -> Result<(), fidl::Error> {
2321        PlayerProxyInterface::r#next_item(self)
2322    }
2323
2324    /// Changes media to the previous item. If this method is not
2325    /// supported as indicated by the absence of the `CHANGE_TO_PREV_ITEM` flag in
2326    /// `PlayerCapabilities`, this method does nothing.
2327    pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
2328        PlayerProxyInterface::r#prev_item(self)
2329    }
2330
2331    /// Sets the playback rate of the media. This will not change the playback mode. If this method
2332    /// is not supported as indicated by the absense of the `SET_PLAYBACK_RATE` flag in
2333    /// `PlayerCapabilities`, this method does nothing.
2334    pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
2335        PlayerProxyInterface::r#set_playback_rate(self, playback_rate)
2336    }
2337
2338    /// Sets repeat mode to any of the supported repeat modes.
2339    /// Whether this method takes effect depends on the `PlayerCapabilities` and `repeat_mode`:
2340    ///   * [`OFF`] is always supported.
2341    ///   * [`GROUP`] requires the `REPEAT_GROUPS` capability, and is otherwise ignored.
2342    ///   * [`SINGLE`] requires the `REPEAT_SINGLE` capability, and is otherwise ignored.
2343    pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
2344        PlayerProxyInterface::r#set_repeat_mode(self, repeat_mode)
2345    }
2346
2347    /// Sets shuffle mode. If this method is not supported as indicated by the absence of the
2348    /// `SHUFFLE` flag in `PlayerCapabilities`, this method does nothing.
2349    pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
2350        PlayerProxyInterface::r#set_shuffle_mode(self, shuffle_on)
2351    }
2352
2353    /// Binds to the session's volume control for control and notifications. If this method is not
2354    /// supported as indicated by the absence of the `HAS_GAIN_CONTROL` flag in
2355    /// `PlayerCapabilities`, the channel handle passed as `volume_control_request` is closed
2356    /// by the service.
2357    pub fn r#bind_volume_control(
2358        &self,
2359        mut volume_control_request: fidl::endpoints::ServerEnd<
2360            fidl_fuchsia_media_audio::VolumeControlMarker,
2361        >,
2362    ) -> Result<(), fidl::Error> {
2363        PlayerProxyInterface::r#bind_volume_control(self, volume_control_request)
2364    }
2365
2366    /// Gets the net player info change using the hanging get pattern.
2367    pub fn r#watch_info_change(
2368        &self,
2369    ) -> fidl::client::QueryResponseFut<
2370        PlayerInfoDelta,
2371        fidl::encoding::DefaultFuchsiaResourceDialect,
2372    > {
2373        PlayerProxyInterface::r#watch_info_change(self)
2374    }
2375}
2376
2377impl PlayerProxyInterface for PlayerProxy {
2378    fn r#play(&self) -> Result<(), fidl::Error> {
2379        self.client.send::<fidl::encoding::EmptyPayload>(
2380            (),
2381            0x164120d5bdb26f8e,
2382            fidl::encoding::DynamicFlags::empty(),
2383        )
2384    }
2385
2386    fn r#pause(&self) -> Result<(), fidl::Error> {
2387        self.client.send::<fidl::encoding::EmptyPayload>(
2388            (),
2389            0x1536d16f202ece1,
2390            fidl::encoding::DynamicFlags::empty(),
2391        )
2392    }
2393
2394    fn r#stop(&self) -> Result<(), fidl::Error> {
2395        self.client.send::<fidl::encoding::EmptyPayload>(
2396            (),
2397            0x1946e5fc6c2362ae,
2398            fidl::encoding::DynamicFlags::empty(),
2399        )
2400    }
2401
2402    fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
2403        self.client.send::<PlayerControlSeekRequest>(
2404            (position,),
2405            0x4e7237d293e22125,
2406            fidl::encoding::DynamicFlags::empty(),
2407        )
2408    }
2409
2410    fn r#skip_forward(&self) -> Result<(), fidl::Error> {
2411        self.client.send::<fidl::encoding::EmptyPayload>(
2412            (),
2413            0x6ee04477076dac1b,
2414            fidl::encoding::DynamicFlags::empty(),
2415        )
2416    }
2417
2418    fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
2419        self.client.send::<fidl::encoding::EmptyPayload>(
2420            (),
2421            0xa4e05644ce33a28,
2422            fidl::encoding::DynamicFlags::empty(),
2423        )
2424    }
2425
2426    fn r#next_item(&self) -> Result<(), fidl::Error> {
2427        self.client.send::<fidl::encoding::EmptyPayload>(
2428            (),
2429            0x73307b32e35ff260,
2430            fidl::encoding::DynamicFlags::empty(),
2431        )
2432    }
2433
2434    fn r#prev_item(&self) -> Result<(), fidl::Error> {
2435        self.client.send::<fidl::encoding::EmptyPayload>(
2436            (),
2437            0x680444f03a759a3c,
2438            fidl::encoding::DynamicFlags::empty(),
2439        )
2440    }
2441
2442    fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
2443        self.client.send::<PlayerControlSetPlaybackRateRequest>(
2444            (playback_rate,),
2445            0x3831b8b161e1bccf,
2446            fidl::encoding::DynamicFlags::empty(),
2447        )
2448    }
2449
2450    fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
2451        self.client.send::<PlayerControlSetRepeatModeRequest>(
2452            (repeat_mode,),
2453            0x21b9b1b17b7f01c2,
2454            fidl::encoding::DynamicFlags::empty(),
2455        )
2456    }
2457
2458    fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
2459        self.client.send::<PlayerControlSetShuffleModeRequest>(
2460            (shuffle_on,),
2461            0x7451a349ddb543c,
2462            fidl::encoding::DynamicFlags::empty(),
2463        )
2464    }
2465
2466    fn r#bind_volume_control(
2467        &self,
2468        mut volume_control_request: fidl::endpoints::ServerEnd<
2469            fidl_fuchsia_media_audio::VolumeControlMarker,
2470        >,
2471    ) -> Result<(), fidl::Error> {
2472        self.client.send::<PlayerControlBindVolumeControlRequest>(
2473            (volume_control_request,),
2474            0x11d61e878cf808bc,
2475            fidl::encoding::DynamicFlags::empty(),
2476        )
2477    }
2478
2479    type WatchInfoChangeResponseFut = fidl::client::QueryResponseFut<
2480        PlayerInfoDelta,
2481        fidl::encoding::DefaultFuchsiaResourceDialect,
2482    >;
2483    fn r#watch_info_change(&self) -> Self::WatchInfoChangeResponseFut {
2484        fn _decode(
2485            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2486        ) -> Result<PlayerInfoDelta, fidl::Error> {
2487            let _response = fidl::client::decode_transaction_body::<
2488                PlayerWatchInfoChangeResponse,
2489                fidl::encoding::DefaultFuchsiaResourceDialect,
2490                0x69196e240c62a732,
2491            >(_buf?)?;
2492            Ok(_response.player_info_delta)
2493        }
2494        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PlayerInfoDelta>(
2495            (),
2496            0x69196e240c62a732,
2497            fidl::encoding::DynamicFlags::empty(),
2498            _decode,
2499        )
2500    }
2501}
2502
2503pub struct PlayerEventStream {
2504    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2505}
2506
2507impl std::marker::Unpin for PlayerEventStream {}
2508
2509impl futures::stream::FusedStream for PlayerEventStream {
2510    fn is_terminated(&self) -> bool {
2511        self.event_receiver.is_terminated()
2512    }
2513}
2514
2515impl futures::Stream for PlayerEventStream {
2516    type Item = Result<PlayerEvent, fidl::Error>;
2517
2518    fn poll_next(
2519        mut self: std::pin::Pin<&mut Self>,
2520        cx: &mut std::task::Context<'_>,
2521    ) -> std::task::Poll<Option<Self::Item>> {
2522        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2523            &mut self.event_receiver,
2524            cx
2525        )?) {
2526            Some(buf) => std::task::Poll::Ready(Some(PlayerEvent::decode(buf))),
2527            None => std::task::Poll::Ready(None),
2528        }
2529    }
2530}
2531
2532#[derive(Debug)]
2533pub enum PlayerEvent {}
2534
2535impl PlayerEvent {
2536    /// Decodes a message buffer as a [`PlayerEvent`].
2537    fn decode(
2538        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2539    ) -> Result<PlayerEvent, fidl::Error> {
2540        let (bytes, _handles) = buf.split_mut();
2541        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2542        debug_assert_eq!(tx_header.tx_id, 0);
2543        match tx_header.ordinal {
2544            _ => Err(fidl::Error::UnknownOrdinal {
2545                ordinal: tx_header.ordinal,
2546                protocol_name: <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2547            }),
2548        }
2549    }
2550}
2551
2552/// A Stream of incoming requests for fuchsia.media.sessions2/Player.
2553pub struct PlayerRequestStream {
2554    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2555    is_terminated: bool,
2556}
2557
2558impl std::marker::Unpin for PlayerRequestStream {}
2559
2560impl futures::stream::FusedStream for PlayerRequestStream {
2561    fn is_terminated(&self) -> bool {
2562        self.is_terminated
2563    }
2564}
2565
2566impl fidl::endpoints::RequestStream for PlayerRequestStream {
2567    type Protocol = PlayerMarker;
2568    type ControlHandle = PlayerControlHandle;
2569
2570    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2571        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2572    }
2573
2574    fn control_handle(&self) -> Self::ControlHandle {
2575        PlayerControlHandle { inner: self.inner.clone() }
2576    }
2577
2578    fn into_inner(
2579        self,
2580    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2581    {
2582        (self.inner, self.is_terminated)
2583    }
2584
2585    fn from_inner(
2586        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2587        is_terminated: bool,
2588    ) -> Self {
2589        Self { inner, is_terminated }
2590    }
2591}
2592
2593impl futures::Stream for PlayerRequestStream {
2594    type Item = Result<PlayerRequest, fidl::Error>;
2595
2596    fn poll_next(
2597        mut self: std::pin::Pin<&mut Self>,
2598        cx: &mut std::task::Context<'_>,
2599    ) -> std::task::Poll<Option<Self::Item>> {
2600        let this = &mut *self;
2601        if this.inner.check_shutdown(cx) {
2602            this.is_terminated = true;
2603            return std::task::Poll::Ready(None);
2604        }
2605        if this.is_terminated {
2606            panic!("polled PlayerRequestStream after completion");
2607        }
2608        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2609            |bytes, handles| {
2610                match this.inner.channel().read_etc(cx, bytes, handles) {
2611                    std::task::Poll::Ready(Ok(())) => {}
2612                    std::task::Poll::Pending => return std::task::Poll::Pending,
2613                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2614                        this.is_terminated = true;
2615                        return std::task::Poll::Ready(None);
2616                    }
2617                    std::task::Poll::Ready(Err(e)) => {
2618                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2619                            e.into(),
2620                        ))))
2621                    }
2622                }
2623
2624                // A message has been received from the channel
2625                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2626
2627                std::task::Poll::Ready(Some(match header.ordinal {
2628                    0x164120d5bdb26f8e => {
2629                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2630                        let mut req = fidl::new_empty!(
2631                            fidl::encoding::EmptyPayload,
2632                            fidl::encoding::DefaultFuchsiaResourceDialect
2633                        );
2634                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2635                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2636                        Ok(PlayerRequest::Play { control_handle })
2637                    }
2638                    0x1536d16f202ece1 => {
2639                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2640                        let mut req = fidl::new_empty!(
2641                            fidl::encoding::EmptyPayload,
2642                            fidl::encoding::DefaultFuchsiaResourceDialect
2643                        );
2644                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2645                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2646                        Ok(PlayerRequest::Pause { control_handle })
2647                    }
2648                    0x1946e5fc6c2362ae => {
2649                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2650                        let mut req = fidl::new_empty!(
2651                            fidl::encoding::EmptyPayload,
2652                            fidl::encoding::DefaultFuchsiaResourceDialect
2653                        );
2654                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2655                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2656                        Ok(PlayerRequest::Stop { control_handle })
2657                    }
2658                    0x4e7237d293e22125 => {
2659                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2660                        let mut req = fidl::new_empty!(
2661                            PlayerControlSeekRequest,
2662                            fidl::encoding::DefaultFuchsiaResourceDialect
2663                        );
2664                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
2665                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2666                        Ok(PlayerRequest::Seek { position: req.position, control_handle })
2667                    }
2668                    0x6ee04477076dac1b => {
2669                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2670                        let mut req = fidl::new_empty!(
2671                            fidl::encoding::EmptyPayload,
2672                            fidl::encoding::DefaultFuchsiaResourceDialect
2673                        );
2674                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2675                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2676                        Ok(PlayerRequest::SkipForward { control_handle })
2677                    }
2678                    0xa4e05644ce33a28 => {
2679                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2680                        let mut req = fidl::new_empty!(
2681                            fidl::encoding::EmptyPayload,
2682                            fidl::encoding::DefaultFuchsiaResourceDialect
2683                        );
2684                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2685                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2686                        Ok(PlayerRequest::SkipReverse { control_handle })
2687                    }
2688                    0x73307b32e35ff260 => {
2689                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2690                        let mut req = fidl::new_empty!(
2691                            fidl::encoding::EmptyPayload,
2692                            fidl::encoding::DefaultFuchsiaResourceDialect
2693                        );
2694                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2695                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2696                        Ok(PlayerRequest::NextItem { control_handle })
2697                    }
2698                    0x680444f03a759a3c => {
2699                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2700                        let mut req = fidl::new_empty!(
2701                            fidl::encoding::EmptyPayload,
2702                            fidl::encoding::DefaultFuchsiaResourceDialect
2703                        );
2704                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2705                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2706                        Ok(PlayerRequest::PrevItem { control_handle })
2707                    }
2708                    0x3831b8b161e1bccf => {
2709                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2710                        let mut req = fidl::new_empty!(
2711                            PlayerControlSetPlaybackRateRequest,
2712                            fidl::encoding::DefaultFuchsiaResourceDialect
2713                        );
2714                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
2715                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2716                        Ok(PlayerRequest::SetPlaybackRate {
2717                            playback_rate: req.playback_rate,
2718
2719                            control_handle,
2720                        })
2721                    }
2722                    0x21b9b1b17b7f01c2 => {
2723                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2724                        let mut req = fidl::new_empty!(
2725                            PlayerControlSetRepeatModeRequest,
2726                            fidl::encoding::DefaultFuchsiaResourceDialect
2727                        );
2728                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
2729                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2730                        Ok(PlayerRequest::SetRepeatMode {
2731                            repeat_mode: req.repeat_mode,
2732
2733                            control_handle,
2734                        })
2735                    }
2736                    0x7451a349ddb543c => {
2737                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2738                        let mut req = fidl::new_empty!(
2739                            PlayerControlSetShuffleModeRequest,
2740                            fidl::encoding::DefaultFuchsiaResourceDialect
2741                        );
2742                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
2743                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2744                        Ok(PlayerRequest::SetShuffleMode {
2745                            shuffle_on: req.shuffle_on,
2746
2747                            control_handle,
2748                        })
2749                    }
2750                    0x11d61e878cf808bc => {
2751                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2752                        let mut req = fidl::new_empty!(
2753                            PlayerControlBindVolumeControlRequest,
2754                            fidl::encoding::DefaultFuchsiaResourceDialect
2755                        );
2756                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
2757                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2758                        Ok(PlayerRequest::BindVolumeControl {
2759                            volume_control_request: req.volume_control_request,
2760
2761                            control_handle,
2762                        })
2763                    }
2764                    0x69196e240c62a732 => {
2765                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2766                        let mut req = fidl::new_empty!(
2767                            fidl::encoding::EmptyPayload,
2768                            fidl::encoding::DefaultFuchsiaResourceDialect
2769                        );
2770                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2771                        let control_handle = PlayerControlHandle { inner: this.inner.clone() };
2772                        Ok(PlayerRequest::WatchInfoChange {
2773                            responder: PlayerWatchInfoChangeResponder {
2774                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2775                                tx_id: header.tx_id,
2776                            },
2777                        })
2778                    }
2779                    _ => Err(fidl::Error::UnknownOrdinal {
2780                        ordinal: header.ordinal,
2781                        protocol_name:
2782                            <PlayerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2783                    }),
2784                }))
2785            },
2786        )
2787    }
2788}
2789
2790/// `Player` is a handle for a media player. Unsupported commands are
2791/// no-ops.  Consult `PlaybackCapabilities`, sent by to learn which
2792/// commands are supported.
2793#[derive(Debug)]
2794pub enum PlayerRequest {
2795    /// Plays media. If this method is not supported as indicated by the absence of the `PLAY`
2796    /// flag in `PlayerCapabilities`, this method does nothing.
2797    Play { control_handle: PlayerControlHandle },
2798    /// Pauses playback and retains position in media. If this method is not supported as indicated
2799    /// by the absence of the `PAUSE` flag in `PlayerCapabilities`, this method does nothing.
2800    Pause { control_handle: PlayerControlHandle },
2801    /// Stops playback. The session should close.
2802    Stop { control_handle: PlayerControlHandle },
2803    /// Seeks to a specific position in media. Implementations are free to
2804    /// enter an error state if the position is out of bounds. `position`
2805    /// is an offset from the beginning of the media. If this method is not supported as indicated
2806    /// by the absence of the `SEEK` flag in `PlayerCapabilities`, this method does nothing.
2807    Seek { position: i64, control_handle: PlayerControlHandle },
2808    /// Skips forward in media by the player's default skip amount. If this method is not supported
2809    /// as indicated by the absence of the `SKIP_FORWARD` flag in `PlayerCapabilities`, this method
2810    /// does nothing.
2811    SkipForward { control_handle: PlayerControlHandle },
2812    /// Skips in reverse in media by the player's default skip amount. If this method is not
2813    /// supported as indicated by the absence of the `SKIP_REVERSE` flag in `PlayerCapabilities`,
2814    /// this method does nothing.
2815    SkipReverse { control_handle: PlayerControlHandle },
2816    /// Changes media to the next item (e.g. next song in playlist). If this method is not
2817    /// supported as indicated by the absence of the `CHANGE_TO_NEXT_ITEM` flag in
2818    /// `PlayerCapabilities`, this method does nothing.
2819    NextItem { control_handle: PlayerControlHandle },
2820    /// Changes media to the previous item. If this method is not
2821    /// supported as indicated by the absence of the `CHANGE_TO_PREV_ITEM` flag in
2822    /// `PlayerCapabilities`, this method does nothing.
2823    PrevItem { control_handle: PlayerControlHandle },
2824    /// Sets the playback rate of the media. This will not change the playback mode. If this method
2825    /// is not supported as indicated by the absense of the `SET_PLAYBACK_RATE` flag in
2826    /// `PlayerCapabilities`, this method does nothing.
2827    SetPlaybackRate { playback_rate: f32, control_handle: PlayerControlHandle },
2828    /// Sets repeat mode to any of the supported repeat modes.
2829    /// Whether this method takes effect depends on the `PlayerCapabilities` and `repeat_mode`:
2830    ///   * [`OFF`] is always supported.
2831    ///   * [`GROUP`] requires the `REPEAT_GROUPS` capability, and is otherwise ignored.
2832    ///   * [`SINGLE`] requires the `REPEAT_SINGLE` capability, and is otherwise ignored.
2833    SetRepeatMode { repeat_mode: RepeatMode, control_handle: PlayerControlHandle },
2834    /// Sets shuffle mode. If this method is not supported as indicated by the absence of the
2835    /// `SHUFFLE` flag in `PlayerCapabilities`, this method does nothing.
2836    SetShuffleMode { shuffle_on: bool, control_handle: PlayerControlHandle },
2837    /// Binds to the session's volume control for control and notifications. If this method is not
2838    /// supported as indicated by the absence of the `HAS_GAIN_CONTROL` flag in
2839    /// `PlayerCapabilities`, the channel handle passed as `volume_control_request` is closed
2840    /// by the service.
2841    BindVolumeControl {
2842        volume_control_request:
2843            fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
2844        control_handle: PlayerControlHandle,
2845    },
2846    /// Gets the net player info change using the hanging get pattern.
2847    WatchInfoChange { responder: PlayerWatchInfoChangeResponder },
2848}
2849
2850impl PlayerRequest {
2851    #[allow(irrefutable_let_patterns)]
2852    pub fn into_play(self) -> Option<(PlayerControlHandle)> {
2853        if let PlayerRequest::Play { control_handle } = self {
2854            Some((control_handle))
2855        } else {
2856            None
2857        }
2858    }
2859
2860    #[allow(irrefutable_let_patterns)]
2861    pub fn into_pause(self) -> Option<(PlayerControlHandle)> {
2862        if let PlayerRequest::Pause { control_handle } = self {
2863            Some((control_handle))
2864        } else {
2865            None
2866        }
2867    }
2868
2869    #[allow(irrefutable_let_patterns)]
2870    pub fn into_stop(self) -> Option<(PlayerControlHandle)> {
2871        if let PlayerRequest::Stop { control_handle } = self {
2872            Some((control_handle))
2873        } else {
2874            None
2875        }
2876    }
2877
2878    #[allow(irrefutable_let_patterns)]
2879    pub fn into_seek(self) -> Option<(i64, PlayerControlHandle)> {
2880        if let PlayerRequest::Seek { position, control_handle } = self {
2881            Some((position, control_handle))
2882        } else {
2883            None
2884        }
2885    }
2886
2887    #[allow(irrefutable_let_patterns)]
2888    pub fn into_skip_forward(self) -> Option<(PlayerControlHandle)> {
2889        if let PlayerRequest::SkipForward { control_handle } = self {
2890            Some((control_handle))
2891        } else {
2892            None
2893        }
2894    }
2895
2896    #[allow(irrefutable_let_patterns)]
2897    pub fn into_skip_reverse(self) -> Option<(PlayerControlHandle)> {
2898        if let PlayerRequest::SkipReverse { control_handle } = self {
2899            Some((control_handle))
2900        } else {
2901            None
2902        }
2903    }
2904
2905    #[allow(irrefutable_let_patterns)]
2906    pub fn into_next_item(self) -> Option<(PlayerControlHandle)> {
2907        if let PlayerRequest::NextItem { control_handle } = self {
2908            Some((control_handle))
2909        } else {
2910            None
2911        }
2912    }
2913
2914    #[allow(irrefutable_let_patterns)]
2915    pub fn into_prev_item(self) -> Option<(PlayerControlHandle)> {
2916        if let PlayerRequest::PrevItem { control_handle } = self {
2917            Some((control_handle))
2918        } else {
2919            None
2920        }
2921    }
2922
2923    #[allow(irrefutable_let_patterns)]
2924    pub fn into_set_playback_rate(self) -> Option<(f32, PlayerControlHandle)> {
2925        if let PlayerRequest::SetPlaybackRate { playback_rate, control_handle } = self {
2926            Some((playback_rate, control_handle))
2927        } else {
2928            None
2929        }
2930    }
2931
2932    #[allow(irrefutable_let_patterns)]
2933    pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, PlayerControlHandle)> {
2934        if let PlayerRequest::SetRepeatMode { repeat_mode, control_handle } = self {
2935            Some((repeat_mode, control_handle))
2936        } else {
2937            None
2938        }
2939    }
2940
2941    #[allow(irrefutable_let_patterns)]
2942    pub fn into_set_shuffle_mode(self) -> Option<(bool, PlayerControlHandle)> {
2943        if let PlayerRequest::SetShuffleMode { shuffle_on, control_handle } = self {
2944            Some((shuffle_on, control_handle))
2945        } else {
2946            None
2947        }
2948    }
2949
2950    #[allow(irrefutable_let_patterns)]
2951    pub fn into_bind_volume_control(
2952        self,
2953    ) -> Option<(
2954        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
2955        PlayerControlHandle,
2956    )> {
2957        if let PlayerRequest::BindVolumeControl { volume_control_request, control_handle } = self {
2958            Some((volume_control_request, control_handle))
2959        } else {
2960            None
2961        }
2962    }
2963
2964    #[allow(irrefutable_let_patterns)]
2965    pub fn into_watch_info_change(self) -> Option<(PlayerWatchInfoChangeResponder)> {
2966        if let PlayerRequest::WatchInfoChange { responder } = self {
2967            Some((responder))
2968        } else {
2969            None
2970        }
2971    }
2972
2973    /// Name of the method defined in FIDL
2974    pub fn method_name(&self) -> &'static str {
2975        match *self {
2976            PlayerRequest::Play { .. } => "play",
2977            PlayerRequest::Pause { .. } => "pause",
2978            PlayerRequest::Stop { .. } => "stop",
2979            PlayerRequest::Seek { .. } => "seek",
2980            PlayerRequest::SkipForward { .. } => "skip_forward",
2981            PlayerRequest::SkipReverse { .. } => "skip_reverse",
2982            PlayerRequest::NextItem { .. } => "next_item",
2983            PlayerRequest::PrevItem { .. } => "prev_item",
2984            PlayerRequest::SetPlaybackRate { .. } => "set_playback_rate",
2985            PlayerRequest::SetRepeatMode { .. } => "set_repeat_mode",
2986            PlayerRequest::SetShuffleMode { .. } => "set_shuffle_mode",
2987            PlayerRequest::BindVolumeControl { .. } => "bind_volume_control",
2988            PlayerRequest::WatchInfoChange { .. } => "watch_info_change",
2989        }
2990    }
2991}
2992
2993#[derive(Debug, Clone)]
2994pub struct PlayerControlHandle {
2995    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2996}
2997
2998impl fidl::endpoints::ControlHandle for PlayerControlHandle {
2999    fn shutdown(&self) {
3000        self.inner.shutdown()
3001    }
3002    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3003        self.inner.shutdown_with_epitaph(status)
3004    }
3005
3006    fn is_closed(&self) -> bool {
3007        self.inner.channel().is_closed()
3008    }
3009    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3010        self.inner.channel().on_closed()
3011    }
3012
3013    #[cfg(target_os = "fuchsia")]
3014    fn signal_peer(
3015        &self,
3016        clear_mask: zx::Signals,
3017        set_mask: zx::Signals,
3018    ) -> Result<(), zx_status::Status> {
3019        use fidl::Peered;
3020        self.inner.channel().signal_peer(clear_mask, set_mask)
3021    }
3022}
3023
3024impl PlayerControlHandle {}
3025
3026#[must_use = "FIDL methods require a response to be sent"]
3027#[derive(Debug)]
3028pub struct PlayerWatchInfoChangeResponder {
3029    control_handle: std::mem::ManuallyDrop<PlayerControlHandle>,
3030    tx_id: u32,
3031}
3032
3033/// Set the the channel to be shutdown (see [`PlayerControlHandle::shutdown`])
3034/// if the responder is dropped without sending a response, so that the client
3035/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3036impl std::ops::Drop for PlayerWatchInfoChangeResponder {
3037    fn drop(&mut self) {
3038        self.control_handle.shutdown();
3039        // Safety: drops once, never accessed again
3040        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3041    }
3042}
3043
3044impl fidl::endpoints::Responder for PlayerWatchInfoChangeResponder {
3045    type ControlHandle = PlayerControlHandle;
3046
3047    fn control_handle(&self) -> &PlayerControlHandle {
3048        &self.control_handle
3049    }
3050
3051    fn drop_without_shutdown(mut self) {
3052        // Safety: drops once, never accessed again due to mem::forget
3053        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3054        // Prevent Drop from running (which would shut down the channel)
3055        std::mem::forget(self);
3056    }
3057}
3058
3059impl PlayerWatchInfoChangeResponder {
3060    /// Sends a response to the FIDL transaction.
3061    ///
3062    /// Sets the channel to shutdown if an error occurs.
3063    pub fn send(self, mut player_info_delta: &PlayerInfoDelta) -> Result<(), fidl::Error> {
3064        let _result = self.send_raw(player_info_delta);
3065        if _result.is_err() {
3066            self.control_handle.shutdown();
3067        }
3068        self.drop_without_shutdown();
3069        _result
3070    }
3071
3072    /// Similar to "send" but does not shutdown the channel if an error occurs.
3073    pub fn send_no_shutdown_on_err(
3074        self,
3075        mut player_info_delta: &PlayerInfoDelta,
3076    ) -> Result<(), fidl::Error> {
3077        let _result = self.send_raw(player_info_delta);
3078        self.drop_without_shutdown();
3079        _result
3080    }
3081
3082    fn send_raw(&self, mut player_info_delta: &PlayerInfoDelta) -> Result<(), fidl::Error> {
3083        self.control_handle.inner.send::<PlayerWatchInfoChangeResponse>(
3084            (player_info_delta,),
3085            self.tx_id,
3086            0x69196e240c62a732,
3087            fidl::encoding::DynamicFlags::empty(),
3088        )
3089    }
3090}
3091
3092#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3093pub struct PlayerControlMarker;
3094
3095impl fidl::endpoints::ProtocolMarker for PlayerControlMarker {
3096    type Proxy = PlayerControlProxy;
3097    type RequestStream = PlayerControlRequestStream;
3098    #[cfg(target_os = "fuchsia")]
3099    type SynchronousProxy = PlayerControlSynchronousProxy;
3100
3101    const DEBUG_NAME: &'static str = "(anonymous) PlayerControl";
3102}
3103
3104pub trait PlayerControlProxyInterface: Send + Sync {
3105    fn r#play(&self) -> Result<(), fidl::Error>;
3106    fn r#pause(&self) -> Result<(), fidl::Error>;
3107    fn r#stop(&self) -> Result<(), fidl::Error>;
3108    fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
3109    fn r#skip_forward(&self) -> Result<(), fidl::Error>;
3110    fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
3111    fn r#next_item(&self) -> Result<(), fidl::Error>;
3112    fn r#prev_item(&self) -> Result<(), fidl::Error>;
3113    fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
3114    fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
3115    fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
3116    fn r#bind_volume_control(
3117        &self,
3118        volume_control_request: fidl::endpoints::ServerEnd<
3119            fidl_fuchsia_media_audio::VolumeControlMarker,
3120        >,
3121    ) -> Result<(), fidl::Error>;
3122}
3123#[derive(Debug)]
3124#[cfg(target_os = "fuchsia")]
3125pub struct PlayerControlSynchronousProxy {
3126    client: fidl::client::sync::Client,
3127}
3128
3129#[cfg(target_os = "fuchsia")]
3130impl fidl::endpoints::SynchronousProxy for PlayerControlSynchronousProxy {
3131    type Proxy = PlayerControlProxy;
3132    type Protocol = PlayerControlMarker;
3133
3134    fn from_channel(inner: fidl::Channel) -> Self {
3135        Self::new(inner)
3136    }
3137
3138    fn into_channel(self) -> fidl::Channel {
3139        self.client.into_channel()
3140    }
3141
3142    fn as_channel(&self) -> &fidl::Channel {
3143        self.client.as_channel()
3144    }
3145}
3146
3147#[cfg(target_os = "fuchsia")]
3148impl PlayerControlSynchronousProxy {
3149    pub fn new(channel: fidl::Channel) -> Self {
3150        let protocol_name = <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3151        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3152    }
3153
3154    pub fn into_channel(self) -> fidl::Channel {
3155        self.client.into_channel()
3156    }
3157
3158    /// Waits until an event arrives and returns it. It is safe for other
3159    /// threads to make concurrent requests while waiting for an event.
3160    pub fn wait_for_event(
3161        &self,
3162        deadline: zx::MonotonicInstant,
3163    ) -> Result<PlayerControlEvent, fidl::Error> {
3164        PlayerControlEvent::decode(self.client.wait_for_event(deadline)?)
3165    }
3166
3167    /// Plays media. If this method is not supported as indicated by the absence of the `PLAY`
3168    /// flag in `PlayerCapabilities`, this method does nothing.
3169    pub fn r#play(&self) -> Result<(), fidl::Error> {
3170        self.client.send::<fidl::encoding::EmptyPayload>(
3171            (),
3172            0x164120d5bdb26f8e,
3173            fidl::encoding::DynamicFlags::empty(),
3174        )
3175    }
3176
3177    /// Pauses playback and retains position in media. If this method is not supported as indicated
3178    /// by the absence of the `PAUSE` flag in `PlayerCapabilities`, this method does nothing.
3179    pub fn r#pause(&self) -> Result<(), fidl::Error> {
3180        self.client.send::<fidl::encoding::EmptyPayload>(
3181            (),
3182            0x1536d16f202ece1,
3183            fidl::encoding::DynamicFlags::empty(),
3184        )
3185    }
3186
3187    /// Stops playback. The session should close.
3188    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3189        self.client.send::<fidl::encoding::EmptyPayload>(
3190            (),
3191            0x1946e5fc6c2362ae,
3192            fidl::encoding::DynamicFlags::empty(),
3193        )
3194    }
3195
3196    /// Seeks to a specific position in media. Implementations are free to
3197    /// enter an error state if the position is out of bounds. `position`
3198    /// is an offset from the beginning of the media. If this method is not supported as indicated
3199    /// by the absence of the `SEEK` flag in `PlayerCapabilities`, this method does nothing.
3200    pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
3201        self.client.send::<PlayerControlSeekRequest>(
3202            (position,),
3203            0x4e7237d293e22125,
3204            fidl::encoding::DynamicFlags::empty(),
3205        )
3206    }
3207
3208    /// Skips forward in media by the player's default skip amount. If this method is not supported
3209    /// as indicated by the absence of the `SKIP_FORWARD` flag in `PlayerCapabilities`, this method
3210    /// does nothing.
3211    pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
3212        self.client.send::<fidl::encoding::EmptyPayload>(
3213            (),
3214            0x6ee04477076dac1b,
3215            fidl::encoding::DynamicFlags::empty(),
3216        )
3217    }
3218
3219    /// Skips in reverse in media by the player's default skip amount. If this method is not
3220    /// supported as indicated by the absence of the `SKIP_REVERSE` flag in `PlayerCapabilities`,
3221    /// this method does nothing.
3222    pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
3223        self.client.send::<fidl::encoding::EmptyPayload>(
3224            (),
3225            0xa4e05644ce33a28,
3226            fidl::encoding::DynamicFlags::empty(),
3227        )
3228    }
3229
3230    /// Changes media to the next item (e.g. next song in playlist). If this method is not
3231    /// supported as indicated by the absence of the `CHANGE_TO_NEXT_ITEM` flag in
3232    /// `PlayerCapabilities`, this method does nothing.
3233    pub fn r#next_item(&self) -> Result<(), fidl::Error> {
3234        self.client.send::<fidl::encoding::EmptyPayload>(
3235            (),
3236            0x73307b32e35ff260,
3237            fidl::encoding::DynamicFlags::empty(),
3238        )
3239    }
3240
3241    /// Changes media to the previous item. If this method is not
3242    /// supported as indicated by the absence of the `CHANGE_TO_PREV_ITEM` flag in
3243    /// `PlayerCapabilities`, this method does nothing.
3244    pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
3245        self.client.send::<fidl::encoding::EmptyPayload>(
3246            (),
3247            0x680444f03a759a3c,
3248            fidl::encoding::DynamicFlags::empty(),
3249        )
3250    }
3251
3252    /// Sets the playback rate of the media. This will not change the playback mode. If this method
3253    /// is not supported as indicated by the absense of the `SET_PLAYBACK_RATE` flag in
3254    /// `PlayerCapabilities`, this method does nothing.
3255    pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
3256        self.client.send::<PlayerControlSetPlaybackRateRequest>(
3257            (playback_rate,),
3258            0x3831b8b161e1bccf,
3259            fidl::encoding::DynamicFlags::empty(),
3260        )
3261    }
3262
3263    /// Sets repeat mode to any of the supported repeat modes.
3264    /// Whether this method takes effect depends on the `PlayerCapabilities` and `repeat_mode`:
3265    ///   * [`OFF`] is always supported.
3266    ///   * [`GROUP`] requires the `REPEAT_GROUPS` capability, and is otherwise ignored.
3267    ///   * [`SINGLE`] requires the `REPEAT_SINGLE` capability, and is otherwise ignored.
3268    pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
3269        self.client.send::<PlayerControlSetRepeatModeRequest>(
3270            (repeat_mode,),
3271            0x21b9b1b17b7f01c2,
3272            fidl::encoding::DynamicFlags::empty(),
3273        )
3274    }
3275
3276    /// Sets shuffle mode. If this method is not supported as indicated by the absence of the
3277    /// `SHUFFLE` flag in `PlayerCapabilities`, this method does nothing.
3278    pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
3279        self.client.send::<PlayerControlSetShuffleModeRequest>(
3280            (shuffle_on,),
3281            0x7451a349ddb543c,
3282            fidl::encoding::DynamicFlags::empty(),
3283        )
3284    }
3285
3286    /// Binds to the session's volume control for control and notifications. If this method is not
3287    /// supported as indicated by the absence of the `HAS_GAIN_CONTROL` flag in
3288    /// `PlayerCapabilities`, the channel handle passed as `volume_control_request` is closed
3289    /// by the service.
3290    pub fn r#bind_volume_control(
3291        &self,
3292        mut volume_control_request: fidl::endpoints::ServerEnd<
3293            fidl_fuchsia_media_audio::VolumeControlMarker,
3294        >,
3295    ) -> Result<(), fidl::Error> {
3296        self.client.send::<PlayerControlBindVolumeControlRequest>(
3297            (volume_control_request,),
3298            0x11d61e878cf808bc,
3299            fidl::encoding::DynamicFlags::empty(),
3300        )
3301    }
3302}
3303
3304#[derive(Debug, Clone)]
3305pub struct PlayerControlProxy {
3306    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3307}
3308
3309impl fidl::endpoints::Proxy for PlayerControlProxy {
3310    type Protocol = PlayerControlMarker;
3311
3312    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3313        Self::new(inner)
3314    }
3315
3316    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3317        self.client.into_channel().map_err(|client| Self { client })
3318    }
3319
3320    fn as_channel(&self) -> &::fidl::AsyncChannel {
3321        self.client.as_channel()
3322    }
3323}
3324
3325impl PlayerControlProxy {
3326    /// Create a new Proxy for fuchsia.media.sessions2/PlayerControl.
3327    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3328        let protocol_name = <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3329        Self { client: fidl::client::Client::new(channel, protocol_name) }
3330    }
3331
3332    /// Get a Stream of events from the remote end of the protocol.
3333    ///
3334    /// # Panics
3335    ///
3336    /// Panics if the event stream was already taken.
3337    pub fn take_event_stream(&self) -> PlayerControlEventStream {
3338        PlayerControlEventStream { event_receiver: self.client.take_event_receiver() }
3339    }
3340
3341    /// Plays media. If this method is not supported as indicated by the absence of the `PLAY`
3342    /// flag in `PlayerCapabilities`, this method does nothing.
3343    pub fn r#play(&self) -> Result<(), fidl::Error> {
3344        PlayerControlProxyInterface::r#play(self)
3345    }
3346
3347    /// Pauses playback and retains position in media. If this method is not supported as indicated
3348    /// by the absence of the `PAUSE` flag in `PlayerCapabilities`, this method does nothing.
3349    pub fn r#pause(&self) -> Result<(), fidl::Error> {
3350        PlayerControlProxyInterface::r#pause(self)
3351    }
3352
3353    /// Stops playback. The session should close.
3354    pub fn r#stop(&self) -> Result<(), fidl::Error> {
3355        PlayerControlProxyInterface::r#stop(self)
3356    }
3357
3358    /// Seeks to a specific position in media. Implementations are free to
3359    /// enter an error state if the position is out of bounds. `position`
3360    /// is an offset from the beginning of the media. If this method is not supported as indicated
3361    /// by the absence of the `SEEK` flag in `PlayerCapabilities`, this method does nothing.
3362    pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
3363        PlayerControlProxyInterface::r#seek(self, position)
3364    }
3365
3366    /// Skips forward in media by the player's default skip amount. If this method is not supported
3367    /// as indicated by the absence of the `SKIP_FORWARD` flag in `PlayerCapabilities`, this method
3368    /// does nothing.
3369    pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
3370        PlayerControlProxyInterface::r#skip_forward(self)
3371    }
3372
3373    /// Skips in reverse in media by the player's default skip amount. If this method is not
3374    /// supported as indicated by the absence of the `SKIP_REVERSE` flag in `PlayerCapabilities`,
3375    /// this method does nothing.
3376    pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
3377        PlayerControlProxyInterface::r#skip_reverse(self)
3378    }
3379
3380    /// Changes media to the next item (e.g. next song in playlist). If this method is not
3381    /// supported as indicated by the absence of the `CHANGE_TO_NEXT_ITEM` flag in
3382    /// `PlayerCapabilities`, this method does nothing.
3383    pub fn r#next_item(&self) -> Result<(), fidl::Error> {
3384        PlayerControlProxyInterface::r#next_item(self)
3385    }
3386
3387    /// Changes media to the previous item. If this method is not
3388    /// supported as indicated by the absence of the `CHANGE_TO_PREV_ITEM` flag in
3389    /// `PlayerCapabilities`, this method does nothing.
3390    pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
3391        PlayerControlProxyInterface::r#prev_item(self)
3392    }
3393
3394    /// Sets the playback rate of the media. This will not change the playback mode. If this method
3395    /// is not supported as indicated by the absense of the `SET_PLAYBACK_RATE` flag in
3396    /// `PlayerCapabilities`, this method does nothing.
3397    pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
3398        PlayerControlProxyInterface::r#set_playback_rate(self, playback_rate)
3399    }
3400
3401    /// Sets repeat mode to any of the supported repeat modes.
3402    /// Whether this method takes effect depends on the `PlayerCapabilities` and `repeat_mode`:
3403    ///   * [`OFF`] is always supported.
3404    ///   * [`GROUP`] requires the `REPEAT_GROUPS` capability, and is otherwise ignored.
3405    ///   * [`SINGLE`] requires the `REPEAT_SINGLE` capability, and is otherwise ignored.
3406    pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
3407        PlayerControlProxyInterface::r#set_repeat_mode(self, repeat_mode)
3408    }
3409
3410    /// Sets shuffle mode. If this method is not supported as indicated by the absence of the
3411    /// `SHUFFLE` flag in `PlayerCapabilities`, this method does nothing.
3412    pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
3413        PlayerControlProxyInterface::r#set_shuffle_mode(self, shuffle_on)
3414    }
3415
3416    /// Binds to the session's volume control for control and notifications. If this method is not
3417    /// supported as indicated by the absence of the `HAS_GAIN_CONTROL` flag in
3418    /// `PlayerCapabilities`, the channel handle passed as `volume_control_request` is closed
3419    /// by the service.
3420    pub fn r#bind_volume_control(
3421        &self,
3422        mut volume_control_request: fidl::endpoints::ServerEnd<
3423            fidl_fuchsia_media_audio::VolumeControlMarker,
3424        >,
3425    ) -> Result<(), fidl::Error> {
3426        PlayerControlProxyInterface::r#bind_volume_control(self, volume_control_request)
3427    }
3428}
3429
3430impl PlayerControlProxyInterface for PlayerControlProxy {
3431    fn r#play(&self) -> Result<(), fidl::Error> {
3432        self.client.send::<fidl::encoding::EmptyPayload>(
3433            (),
3434            0x164120d5bdb26f8e,
3435            fidl::encoding::DynamicFlags::empty(),
3436        )
3437    }
3438
3439    fn r#pause(&self) -> Result<(), fidl::Error> {
3440        self.client.send::<fidl::encoding::EmptyPayload>(
3441            (),
3442            0x1536d16f202ece1,
3443            fidl::encoding::DynamicFlags::empty(),
3444        )
3445    }
3446
3447    fn r#stop(&self) -> Result<(), fidl::Error> {
3448        self.client.send::<fidl::encoding::EmptyPayload>(
3449            (),
3450            0x1946e5fc6c2362ae,
3451            fidl::encoding::DynamicFlags::empty(),
3452        )
3453    }
3454
3455    fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
3456        self.client.send::<PlayerControlSeekRequest>(
3457            (position,),
3458            0x4e7237d293e22125,
3459            fidl::encoding::DynamicFlags::empty(),
3460        )
3461    }
3462
3463    fn r#skip_forward(&self) -> Result<(), fidl::Error> {
3464        self.client.send::<fidl::encoding::EmptyPayload>(
3465            (),
3466            0x6ee04477076dac1b,
3467            fidl::encoding::DynamicFlags::empty(),
3468        )
3469    }
3470
3471    fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
3472        self.client.send::<fidl::encoding::EmptyPayload>(
3473            (),
3474            0xa4e05644ce33a28,
3475            fidl::encoding::DynamicFlags::empty(),
3476        )
3477    }
3478
3479    fn r#next_item(&self) -> Result<(), fidl::Error> {
3480        self.client.send::<fidl::encoding::EmptyPayload>(
3481            (),
3482            0x73307b32e35ff260,
3483            fidl::encoding::DynamicFlags::empty(),
3484        )
3485    }
3486
3487    fn r#prev_item(&self) -> Result<(), fidl::Error> {
3488        self.client.send::<fidl::encoding::EmptyPayload>(
3489            (),
3490            0x680444f03a759a3c,
3491            fidl::encoding::DynamicFlags::empty(),
3492        )
3493    }
3494
3495    fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
3496        self.client.send::<PlayerControlSetPlaybackRateRequest>(
3497            (playback_rate,),
3498            0x3831b8b161e1bccf,
3499            fidl::encoding::DynamicFlags::empty(),
3500        )
3501    }
3502
3503    fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
3504        self.client.send::<PlayerControlSetRepeatModeRequest>(
3505            (repeat_mode,),
3506            0x21b9b1b17b7f01c2,
3507            fidl::encoding::DynamicFlags::empty(),
3508        )
3509    }
3510
3511    fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
3512        self.client.send::<PlayerControlSetShuffleModeRequest>(
3513            (shuffle_on,),
3514            0x7451a349ddb543c,
3515            fidl::encoding::DynamicFlags::empty(),
3516        )
3517    }
3518
3519    fn r#bind_volume_control(
3520        &self,
3521        mut volume_control_request: fidl::endpoints::ServerEnd<
3522            fidl_fuchsia_media_audio::VolumeControlMarker,
3523        >,
3524    ) -> Result<(), fidl::Error> {
3525        self.client.send::<PlayerControlBindVolumeControlRequest>(
3526            (volume_control_request,),
3527            0x11d61e878cf808bc,
3528            fidl::encoding::DynamicFlags::empty(),
3529        )
3530    }
3531}
3532
3533pub struct PlayerControlEventStream {
3534    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3535}
3536
3537impl std::marker::Unpin for PlayerControlEventStream {}
3538
3539impl futures::stream::FusedStream for PlayerControlEventStream {
3540    fn is_terminated(&self) -> bool {
3541        self.event_receiver.is_terminated()
3542    }
3543}
3544
3545impl futures::Stream for PlayerControlEventStream {
3546    type Item = Result<PlayerControlEvent, fidl::Error>;
3547
3548    fn poll_next(
3549        mut self: std::pin::Pin<&mut Self>,
3550        cx: &mut std::task::Context<'_>,
3551    ) -> std::task::Poll<Option<Self::Item>> {
3552        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3553            &mut self.event_receiver,
3554            cx
3555        )?) {
3556            Some(buf) => std::task::Poll::Ready(Some(PlayerControlEvent::decode(buf))),
3557            None => std::task::Poll::Ready(None),
3558        }
3559    }
3560}
3561
3562#[derive(Debug)]
3563pub enum PlayerControlEvent {}
3564
3565impl PlayerControlEvent {
3566    /// Decodes a message buffer as a [`PlayerControlEvent`].
3567    fn decode(
3568        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3569    ) -> Result<PlayerControlEvent, fidl::Error> {
3570        let (bytes, _handles) = buf.split_mut();
3571        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3572        debug_assert_eq!(tx_header.tx_id, 0);
3573        match tx_header.ordinal {
3574            _ => Err(fidl::Error::UnknownOrdinal {
3575                ordinal: tx_header.ordinal,
3576                protocol_name: <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3577            }),
3578        }
3579    }
3580}
3581
3582/// A Stream of incoming requests for fuchsia.media.sessions2/PlayerControl.
3583pub struct PlayerControlRequestStream {
3584    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3585    is_terminated: bool,
3586}
3587
3588impl std::marker::Unpin for PlayerControlRequestStream {}
3589
3590impl futures::stream::FusedStream for PlayerControlRequestStream {
3591    fn is_terminated(&self) -> bool {
3592        self.is_terminated
3593    }
3594}
3595
3596impl fidl::endpoints::RequestStream for PlayerControlRequestStream {
3597    type Protocol = PlayerControlMarker;
3598    type ControlHandle = PlayerControlControlHandle;
3599
3600    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3601        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3602    }
3603
3604    fn control_handle(&self) -> Self::ControlHandle {
3605        PlayerControlControlHandle { inner: self.inner.clone() }
3606    }
3607
3608    fn into_inner(
3609        self,
3610    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3611    {
3612        (self.inner, self.is_terminated)
3613    }
3614
3615    fn from_inner(
3616        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3617        is_terminated: bool,
3618    ) -> Self {
3619        Self { inner, is_terminated }
3620    }
3621}
3622
3623impl futures::Stream for PlayerControlRequestStream {
3624    type Item = Result<PlayerControlRequest, fidl::Error>;
3625
3626    fn poll_next(
3627        mut self: std::pin::Pin<&mut Self>,
3628        cx: &mut std::task::Context<'_>,
3629    ) -> std::task::Poll<Option<Self::Item>> {
3630        let this = &mut *self;
3631        if this.inner.check_shutdown(cx) {
3632            this.is_terminated = true;
3633            return std::task::Poll::Ready(None);
3634        }
3635        if this.is_terminated {
3636            panic!("polled PlayerControlRequestStream after completion");
3637        }
3638        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3639            |bytes, handles| {
3640                match this.inner.channel().read_etc(cx, bytes, handles) {
3641                    std::task::Poll::Ready(Ok(())) => {}
3642                    std::task::Poll::Pending => return std::task::Poll::Pending,
3643                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3644                        this.is_terminated = true;
3645                        return std::task::Poll::Ready(None);
3646                    }
3647                    std::task::Poll::Ready(Err(e)) => {
3648                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3649                            e.into(),
3650                        ))))
3651                    }
3652                }
3653
3654                // A message has been received from the channel
3655                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3656
3657                std::task::Poll::Ready(Some(match header.ordinal {
3658                    0x164120d5bdb26f8e => {
3659                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3660                        let mut req = fidl::new_empty!(
3661                            fidl::encoding::EmptyPayload,
3662                            fidl::encoding::DefaultFuchsiaResourceDialect
3663                        );
3664                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3665                        let control_handle =
3666                            PlayerControlControlHandle { inner: this.inner.clone() };
3667                        Ok(PlayerControlRequest::Play { control_handle })
3668                    }
3669                    0x1536d16f202ece1 => {
3670                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3671                        let mut req = fidl::new_empty!(
3672                            fidl::encoding::EmptyPayload,
3673                            fidl::encoding::DefaultFuchsiaResourceDialect
3674                        );
3675                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3676                        let control_handle =
3677                            PlayerControlControlHandle { inner: this.inner.clone() };
3678                        Ok(PlayerControlRequest::Pause { control_handle })
3679                    }
3680                    0x1946e5fc6c2362ae => {
3681                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3682                        let mut req = fidl::new_empty!(
3683                            fidl::encoding::EmptyPayload,
3684                            fidl::encoding::DefaultFuchsiaResourceDialect
3685                        );
3686                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3687                        let control_handle =
3688                            PlayerControlControlHandle { inner: this.inner.clone() };
3689                        Ok(PlayerControlRequest::Stop { control_handle })
3690                    }
3691                    0x4e7237d293e22125 => {
3692                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3693                        let mut req = fidl::new_empty!(
3694                            PlayerControlSeekRequest,
3695                            fidl::encoding::DefaultFuchsiaResourceDialect
3696                        );
3697                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
3698                        let control_handle =
3699                            PlayerControlControlHandle { inner: this.inner.clone() };
3700                        Ok(PlayerControlRequest::Seek { position: req.position, control_handle })
3701                    }
3702                    0x6ee04477076dac1b => {
3703                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3704                        let mut req = fidl::new_empty!(
3705                            fidl::encoding::EmptyPayload,
3706                            fidl::encoding::DefaultFuchsiaResourceDialect
3707                        );
3708                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3709                        let control_handle =
3710                            PlayerControlControlHandle { inner: this.inner.clone() };
3711                        Ok(PlayerControlRequest::SkipForward { control_handle })
3712                    }
3713                    0xa4e05644ce33a28 => {
3714                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3715                        let mut req = fidl::new_empty!(
3716                            fidl::encoding::EmptyPayload,
3717                            fidl::encoding::DefaultFuchsiaResourceDialect
3718                        );
3719                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3720                        let control_handle =
3721                            PlayerControlControlHandle { inner: this.inner.clone() };
3722                        Ok(PlayerControlRequest::SkipReverse { control_handle })
3723                    }
3724                    0x73307b32e35ff260 => {
3725                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3726                        let mut req = fidl::new_empty!(
3727                            fidl::encoding::EmptyPayload,
3728                            fidl::encoding::DefaultFuchsiaResourceDialect
3729                        );
3730                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3731                        let control_handle =
3732                            PlayerControlControlHandle { inner: this.inner.clone() };
3733                        Ok(PlayerControlRequest::NextItem { control_handle })
3734                    }
3735                    0x680444f03a759a3c => {
3736                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3737                        let mut req = fidl::new_empty!(
3738                            fidl::encoding::EmptyPayload,
3739                            fidl::encoding::DefaultFuchsiaResourceDialect
3740                        );
3741                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3742                        let control_handle =
3743                            PlayerControlControlHandle { inner: this.inner.clone() };
3744                        Ok(PlayerControlRequest::PrevItem { control_handle })
3745                    }
3746                    0x3831b8b161e1bccf => {
3747                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3748                        let mut req = fidl::new_empty!(
3749                            PlayerControlSetPlaybackRateRequest,
3750                            fidl::encoding::DefaultFuchsiaResourceDialect
3751                        );
3752                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
3753                        let control_handle =
3754                            PlayerControlControlHandle { inner: this.inner.clone() };
3755                        Ok(PlayerControlRequest::SetPlaybackRate {
3756                            playback_rate: req.playback_rate,
3757
3758                            control_handle,
3759                        })
3760                    }
3761                    0x21b9b1b17b7f01c2 => {
3762                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3763                        let mut req = fidl::new_empty!(
3764                            PlayerControlSetRepeatModeRequest,
3765                            fidl::encoding::DefaultFuchsiaResourceDialect
3766                        );
3767                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
3768                        let control_handle =
3769                            PlayerControlControlHandle { inner: this.inner.clone() };
3770                        Ok(PlayerControlRequest::SetRepeatMode {
3771                            repeat_mode: req.repeat_mode,
3772
3773                            control_handle,
3774                        })
3775                    }
3776                    0x7451a349ddb543c => {
3777                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3778                        let mut req = fidl::new_empty!(
3779                            PlayerControlSetShuffleModeRequest,
3780                            fidl::encoding::DefaultFuchsiaResourceDialect
3781                        );
3782                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
3783                        let control_handle =
3784                            PlayerControlControlHandle { inner: this.inner.clone() };
3785                        Ok(PlayerControlRequest::SetShuffleMode {
3786                            shuffle_on: req.shuffle_on,
3787
3788                            control_handle,
3789                        })
3790                    }
3791                    0x11d61e878cf808bc => {
3792                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3793                        let mut req = fidl::new_empty!(
3794                            PlayerControlBindVolumeControlRequest,
3795                            fidl::encoding::DefaultFuchsiaResourceDialect
3796                        );
3797                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PlayerControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
3798                        let control_handle =
3799                            PlayerControlControlHandle { inner: this.inner.clone() };
3800                        Ok(PlayerControlRequest::BindVolumeControl {
3801                            volume_control_request: req.volume_control_request,
3802
3803                            control_handle,
3804                        })
3805                    }
3806                    _ => Err(fidl::Error::UnknownOrdinal {
3807                        ordinal: header.ordinal,
3808                        protocol_name:
3809                            <PlayerControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3810                    }),
3811                }))
3812            },
3813        )
3814    }
3815}
3816
3817/// Controls for a media player. `PlayerCapabilities` expresses which of the methods in this
3818/// protocol are supported by the player. Because capabilties are dynamic, and a client cannot
3819/// always know what capabilities will be supported when the method call reaches the service,
3820/// calling a method that is not supported is simply ignored. In general, clients should not
3821/// expect methods to work unless the player indicates sustained support.
3822#[derive(Debug)]
3823pub enum PlayerControlRequest {
3824    /// Plays media. If this method is not supported as indicated by the absence of the `PLAY`
3825    /// flag in `PlayerCapabilities`, this method does nothing.
3826    Play { control_handle: PlayerControlControlHandle },
3827    /// Pauses playback and retains position in media. If this method is not supported as indicated
3828    /// by the absence of the `PAUSE` flag in `PlayerCapabilities`, this method does nothing.
3829    Pause { control_handle: PlayerControlControlHandle },
3830    /// Stops playback. The session should close.
3831    Stop { control_handle: PlayerControlControlHandle },
3832    /// Seeks to a specific position in media. Implementations are free to
3833    /// enter an error state if the position is out of bounds. `position`
3834    /// is an offset from the beginning of the media. If this method is not supported as indicated
3835    /// by the absence of the `SEEK` flag in `PlayerCapabilities`, this method does nothing.
3836    Seek { position: i64, control_handle: PlayerControlControlHandle },
3837    /// Skips forward in media by the player's default skip amount. If this method is not supported
3838    /// as indicated by the absence of the `SKIP_FORWARD` flag in `PlayerCapabilities`, this method
3839    /// does nothing.
3840    SkipForward { control_handle: PlayerControlControlHandle },
3841    /// Skips in reverse in media by the player's default skip amount. If this method is not
3842    /// supported as indicated by the absence of the `SKIP_REVERSE` flag in `PlayerCapabilities`,
3843    /// this method does nothing.
3844    SkipReverse { control_handle: PlayerControlControlHandle },
3845    /// Changes media to the next item (e.g. next song in playlist). If this method is not
3846    /// supported as indicated by the absence of the `CHANGE_TO_NEXT_ITEM` flag in
3847    /// `PlayerCapabilities`, this method does nothing.
3848    NextItem { control_handle: PlayerControlControlHandle },
3849    /// Changes media to the previous item. If this method is not
3850    /// supported as indicated by the absence of the `CHANGE_TO_PREV_ITEM` flag in
3851    /// `PlayerCapabilities`, this method does nothing.
3852    PrevItem { control_handle: PlayerControlControlHandle },
3853    /// Sets the playback rate of the media. This will not change the playback mode. If this method
3854    /// is not supported as indicated by the absense of the `SET_PLAYBACK_RATE` flag in
3855    /// `PlayerCapabilities`, this method does nothing.
3856    SetPlaybackRate { playback_rate: f32, control_handle: PlayerControlControlHandle },
3857    /// Sets repeat mode to any of the supported repeat modes.
3858    /// Whether this method takes effect depends on the `PlayerCapabilities` and `repeat_mode`:
3859    ///   * [`OFF`] is always supported.
3860    ///   * [`GROUP`] requires the `REPEAT_GROUPS` capability, and is otherwise ignored.
3861    ///   * [`SINGLE`] requires the `REPEAT_SINGLE` capability, and is otherwise ignored.
3862    SetRepeatMode { repeat_mode: RepeatMode, control_handle: PlayerControlControlHandle },
3863    /// Sets shuffle mode. If this method is not supported as indicated by the absence of the
3864    /// `SHUFFLE` flag in `PlayerCapabilities`, this method does nothing.
3865    SetShuffleMode { shuffle_on: bool, control_handle: PlayerControlControlHandle },
3866    /// Binds to the session's volume control for control and notifications. If this method is not
3867    /// supported as indicated by the absence of the `HAS_GAIN_CONTROL` flag in
3868    /// `PlayerCapabilities`, the channel handle passed as `volume_control_request` is closed
3869    /// by the service.
3870    BindVolumeControl {
3871        volume_control_request:
3872            fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
3873        control_handle: PlayerControlControlHandle,
3874    },
3875}
3876
3877impl PlayerControlRequest {
3878    #[allow(irrefutable_let_patterns)]
3879    pub fn into_play(self) -> Option<(PlayerControlControlHandle)> {
3880        if let PlayerControlRequest::Play { control_handle } = self {
3881            Some((control_handle))
3882        } else {
3883            None
3884        }
3885    }
3886
3887    #[allow(irrefutable_let_patterns)]
3888    pub fn into_pause(self) -> Option<(PlayerControlControlHandle)> {
3889        if let PlayerControlRequest::Pause { control_handle } = self {
3890            Some((control_handle))
3891        } else {
3892            None
3893        }
3894    }
3895
3896    #[allow(irrefutable_let_patterns)]
3897    pub fn into_stop(self) -> Option<(PlayerControlControlHandle)> {
3898        if let PlayerControlRequest::Stop { control_handle } = self {
3899            Some((control_handle))
3900        } else {
3901            None
3902        }
3903    }
3904
3905    #[allow(irrefutable_let_patterns)]
3906    pub fn into_seek(self) -> Option<(i64, PlayerControlControlHandle)> {
3907        if let PlayerControlRequest::Seek { position, control_handle } = self {
3908            Some((position, control_handle))
3909        } else {
3910            None
3911        }
3912    }
3913
3914    #[allow(irrefutable_let_patterns)]
3915    pub fn into_skip_forward(self) -> Option<(PlayerControlControlHandle)> {
3916        if let PlayerControlRequest::SkipForward { control_handle } = self {
3917            Some((control_handle))
3918        } else {
3919            None
3920        }
3921    }
3922
3923    #[allow(irrefutable_let_patterns)]
3924    pub fn into_skip_reverse(self) -> Option<(PlayerControlControlHandle)> {
3925        if let PlayerControlRequest::SkipReverse { control_handle } = self {
3926            Some((control_handle))
3927        } else {
3928            None
3929        }
3930    }
3931
3932    #[allow(irrefutable_let_patterns)]
3933    pub fn into_next_item(self) -> Option<(PlayerControlControlHandle)> {
3934        if let PlayerControlRequest::NextItem { control_handle } = self {
3935            Some((control_handle))
3936        } else {
3937            None
3938        }
3939    }
3940
3941    #[allow(irrefutable_let_patterns)]
3942    pub fn into_prev_item(self) -> Option<(PlayerControlControlHandle)> {
3943        if let PlayerControlRequest::PrevItem { control_handle } = self {
3944            Some((control_handle))
3945        } else {
3946            None
3947        }
3948    }
3949
3950    #[allow(irrefutable_let_patterns)]
3951    pub fn into_set_playback_rate(self) -> Option<(f32, PlayerControlControlHandle)> {
3952        if let PlayerControlRequest::SetPlaybackRate { playback_rate, control_handle } = self {
3953            Some((playback_rate, control_handle))
3954        } else {
3955            None
3956        }
3957    }
3958
3959    #[allow(irrefutable_let_patterns)]
3960    pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, PlayerControlControlHandle)> {
3961        if let PlayerControlRequest::SetRepeatMode { repeat_mode, control_handle } = self {
3962            Some((repeat_mode, control_handle))
3963        } else {
3964            None
3965        }
3966    }
3967
3968    #[allow(irrefutable_let_patterns)]
3969    pub fn into_set_shuffle_mode(self) -> Option<(bool, PlayerControlControlHandle)> {
3970        if let PlayerControlRequest::SetShuffleMode { shuffle_on, control_handle } = self {
3971            Some((shuffle_on, control_handle))
3972        } else {
3973            None
3974        }
3975    }
3976
3977    #[allow(irrefutable_let_patterns)]
3978    pub fn into_bind_volume_control(
3979        self,
3980    ) -> Option<(
3981        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
3982        PlayerControlControlHandle,
3983    )> {
3984        if let PlayerControlRequest::BindVolumeControl { volume_control_request, control_handle } =
3985            self
3986        {
3987            Some((volume_control_request, control_handle))
3988        } else {
3989            None
3990        }
3991    }
3992
3993    /// Name of the method defined in FIDL
3994    pub fn method_name(&self) -> &'static str {
3995        match *self {
3996            PlayerControlRequest::Play { .. } => "play",
3997            PlayerControlRequest::Pause { .. } => "pause",
3998            PlayerControlRequest::Stop { .. } => "stop",
3999            PlayerControlRequest::Seek { .. } => "seek",
4000            PlayerControlRequest::SkipForward { .. } => "skip_forward",
4001            PlayerControlRequest::SkipReverse { .. } => "skip_reverse",
4002            PlayerControlRequest::NextItem { .. } => "next_item",
4003            PlayerControlRequest::PrevItem { .. } => "prev_item",
4004            PlayerControlRequest::SetPlaybackRate { .. } => "set_playback_rate",
4005            PlayerControlRequest::SetRepeatMode { .. } => "set_repeat_mode",
4006            PlayerControlRequest::SetShuffleMode { .. } => "set_shuffle_mode",
4007            PlayerControlRequest::BindVolumeControl { .. } => "bind_volume_control",
4008        }
4009    }
4010}
4011
4012#[derive(Debug, Clone)]
4013pub struct PlayerControlControlHandle {
4014    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4015}
4016
4017impl fidl::endpoints::ControlHandle for PlayerControlControlHandle {
4018    fn shutdown(&self) {
4019        self.inner.shutdown()
4020    }
4021    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4022        self.inner.shutdown_with_epitaph(status)
4023    }
4024
4025    fn is_closed(&self) -> bool {
4026        self.inner.channel().is_closed()
4027    }
4028    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4029        self.inner.channel().on_closed()
4030    }
4031
4032    #[cfg(target_os = "fuchsia")]
4033    fn signal_peer(
4034        &self,
4035        clear_mask: zx::Signals,
4036        set_mask: zx::Signals,
4037    ) -> Result<(), zx_status::Status> {
4038        use fidl::Peered;
4039        self.inner.channel().signal_peer(clear_mask, set_mask)
4040    }
4041}
4042
4043impl PlayerControlControlHandle {}
4044
4045#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4046pub struct PublisherMarker;
4047
4048impl fidl::endpoints::ProtocolMarker for PublisherMarker {
4049    type Proxy = PublisherProxy;
4050    type RequestStream = PublisherRequestStream;
4051    #[cfg(target_os = "fuchsia")]
4052    type SynchronousProxy = PublisherSynchronousProxy;
4053
4054    const DEBUG_NAME: &'static str = "fuchsia.media.sessions2.Publisher";
4055}
4056impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
4057
4058pub trait PublisherProxyInterface: Send + Sync {
4059    type PublishResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
4060    fn r#publish(
4061        &self,
4062        player: fidl::endpoints::ClientEnd<PlayerMarker>,
4063        registration: &PlayerRegistration,
4064    ) -> Self::PublishResponseFut;
4065}
4066#[derive(Debug)]
4067#[cfg(target_os = "fuchsia")]
4068pub struct PublisherSynchronousProxy {
4069    client: fidl::client::sync::Client,
4070}
4071
4072#[cfg(target_os = "fuchsia")]
4073impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
4074    type Proxy = PublisherProxy;
4075    type Protocol = PublisherMarker;
4076
4077    fn from_channel(inner: fidl::Channel) -> Self {
4078        Self::new(inner)
4079    }
4080
4081    fn into_channel(self) -> fidl::Channel {
4082        self.client.into_channel()
4083    }
4084
4085    fn as_channel(&self) -> &fidl::Channel {
4086        self.client.as_channel()
4087    }
4088}
4089
4090#[cfg(target_os = "fuchsia")]
4091impl PublisherSynchronousProxy {
4092    pub fn new(channel: fidl::Channel) -> Self {
4093        let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4094        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4095    }
4096
4097    pub fn into_channel(self) -> fidl::Channel {
4098        self.client.into_channel()
4099    }
4100
4101    /// Waits until an event arrives and returns it. It is safe for other
4102    /// threads to make concurrent requests while waiting for an event.
4103    pub fn wait_for_event(
4104        &self,
4105        deadline: zx::MonotonicInstant,
4106    ) -> Result<PublisherEvent, fidl::Error> {
4107        PublisherEvent::decode(self.client.wait_for_event(deadline)?)
4108    }
4109
4110    pub fn r#publish(
4111        &self,
4112        mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
4113        mut registration: &PlayerRegistration,
4114        ___deadline: zx::MonotonicInstant,
4115    ) -> Result<u64, fidl::Error> {
4116        let _response =
4117            self.client.send_query::<PublisherPublishRequest, PublisherPublishResponse>(
4118                (player, registration),
4119                0x2e4a501ede5a1ad3,
4120                fidl::encoding::DynamicFlags::empty(),
4121                ___deadline,
4122            )?;
4123        Ok(_response.session_id)
4124    }
4125}
4126
4127#[derive(Debug, Clone)]
4128pub struct PublisherProxy {
4129    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4130}
4131
4132impl fidl::endpoints::Proxy for PublisherProxy {
4133    type Protocol = PublisherMarker;
4134
4135    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4136        Self::new(inner)
4137    }
4138
4139    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4140        self.client.into_channel().map_err(|client| Self { client })
4141    }
4142
4143    fn as_channel(&self) -> &::fidl::AsyncChannel {
4144        self.client.as_channel()
4145    }
4146}
4147
4148impl PublisherProxy {
4149    /// Create a new Proxy for fuchsia.media.sessions2/Publisher.
4150    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4151        let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4152        Self { client: fidl::client::Client::new(channel, protocol_name) }
4153    }
4154
4155    /// Get a Stream of events from the remote end of the protocol.
4156    ///
4157    /// # Panics
4158    ///
4159    /// Panics if the event stream was already taken.
4160    pub fn take_event_stream(&self) -> PublisherEventStream {
4161        PublisherEventStream { event_receiver: self.client.take_event_receiver() }
4162    }
4163
4164    pub fn r#publish(
4165        &self,
4166        mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
4167        mut registration: &PlayerRegistration,
4168    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
4169        PublisherProxyInterface::r#publish(self, player, registration)
4170    }
4171}
4172
4173impl PublisherProxyInterface for PublisherProxy {
4174    type PublishResponseFut =
4175        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
4176    fn r#publish(
4177        &self,
4178        mut player: fidl::endpoints::ClientEnd<PlayerMarker>,
4179        mut registration: &PlayerRegistration,
4180    ) -> Self::PublishResponseFut {
4181        fn _decode(
4182            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4183        ) -> Result<u64, fidl::Error> {
4184            let _response = fidl::client::decode_transaction_body::<
4185                PublisherPublishResponse,
4186                fidl::encoding::DefaultFuchsiaResourceDialect,
4187                0x2e4a501ede5a1ad3,
4188            >(_buf?)?;
4189            Ok(_response.session_id)
4190        }
4191        self.client.send_query_and_decode::<PublisherPublishRequest, u64>(
4192            (player, registration),
4193            0x2e4a501ede5a1ad3,
4194            fidl::encoding::DynamicFlags::empty(),
4195            _decode,
4196        )
4197    }
4198}
4199
4200pub struct PublisherEventStream {
4201    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4202}
4203
4204impl std::marker::Unpin for PublisherEventStream {}
4205
4206impl futures::stream::FusedStream for PublisherEventStream {
4207    fn is_terminated(&self) -> bool {
4208        self.event_receiver.is_terminated()
4209    }
4210}
4211
4212impl futures::Stream for PublisherEventStream {
4213    type Item = Result<PublisherEvent, fidl::Error>;
4214
4215    fn poll_next(
4216        mut self: std::pin::Pin<&mut Self>,
4217        cx: &mut std::task::Context<'_>,
4218    ) -> std::task::Poll<Option<Self::Item>> {
4219        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4220            &mut self.event_receiver,
4221            cx
4222        )?) {
4223            Some(buf) => std::task::Poll::Ready(Some(PublisherEvent::decode(buf))),
4224            None => std::task::Poll::Ready(None),
4225        }
4226    }
4227}
4228
4229#[derive(Debug)]
4230pub enum PublisherEvent {}
4231
4232impl PublisherEvent {
4233    /// Decodes a message buffer as a [`PublisherEvent`].
4234    fn decode(
4235        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4236    ) -> Result<PublisherEvent, fidl::Error> {
4237        let (bytes, _handles) = buf.split_mut();
4238        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4239        debug_assert_eq!(tx_header.tx_id, 0);
4240        match tx_header.ordinal {
4241            _ => Err(fidl::Error::UnknownOrdinal {
4242                ordinal: tx_header.ordinal,
4243                protocol_name: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4244            }),
4245        }
4246    }
4247}
4248
4249/// A Stream of incoming requests for fuchsia.media.sessions2/Publisher.
4250pub struct PublisherRequestStream {
4251    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4252    is_terminated: bool,
4253}
4254
4255impl std::marker::Unpin for PublisherRequestStream {}
4256
4257impl futures::stream::FusedStream for PublisherRequestStream {
4258    fn is_terminated(&self) -> bool {
4259        self.is_terminated
4260    }
4261}
4262
4263impl fidl::endpoints::RequestStream for PublisherRequestStream {
4264    type Protocol = PublisherMarker;
4265    type ControlHandle = PublisherControlHandle;
4266
4267    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4268        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4269    }
4270
4271    fn control_handle(&self) -> Self::ControlHandle {
4272        PublisherControlHandle { inner: self.inner.clone() }
4273    }
4274
4275    fn into_inner(
4276        self,
4277    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4278    {
4279        (self.inner, self.is_terminated)
4280    }
4281
4282    fn from_inner(
4283        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4284        is_terminated: bool,
4285    ) -> Self {
4286        Self { inner, is_terminated }
4287    }
4288}
4289
4290impl futures::Stream for PublisherRequestStream {
4291    type Item = Result<PublisherRequest, fidl::Error>;
4292
4293    fn poll_next(
4294        mut self: std::pin::Pin<&mut Self>,
4295        cx: &mut std::task::Context<'_>,
4296    ) -> std::task::Poll<Option<Self::Item>> {
4297        let this = &mut *self;
4298        if this.inner.check_shutdown(cx) {
4299            this.is_terminated = true;
4300            return std::task::Poll::Ready(None);
4301        }
4302        if this.is_terminated {
4303            panic!("polled PublisherRequestStream after completion");
4304        }
4305        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4306            |bytes, handles| {
4307                match this.inner.channel().read_etc(cx, bytes, handles) {
4308                    std::task::Poll::Ready(Ok(())) => {}
4309                    std::task::Poll::Pending => return std::task::Poll::Pending,
4310                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4311                        this.is_terminated = true;
4312                        return std::task::Poll::Ready(None);
4313                    }
4314                    std::task::Poll::Ready(Err(e)) => {
4315                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4316                            e.into(),
4317                        ))))
4318                    }
4319                }
4320
4321                // A message has been received from the channel
4322                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4323
4324                std::task::Poll::Ready(Some(match header.ordinal {
4325                    0x2e4a501ede5a1ad3 => {
4326                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4327                        let mut req = fidl::new_empty!(
4328                            PublisherPublishRequest,
4329                            fidl::encoding::DefaultFuchsiaResourceDialect
4330                        );
4331                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishRequest>(&header, _body_bytes, handles, &mut req)?;
4332                        let control_handle = PublisherControlHandle { inner: this.inner.clone() };
4333                        Ok(PublisherRequest::Publish {
4334                            player: req.player,
4335                            registration: req.registration,
4336
4337                            responder: PublisherPublishResponder {
4338                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4339                                tx_id: header.tx_id,
4340                            },
4341                        })
4342                    }
4343                    _ => Err(fidl::Error::UnknownOrdinal {
4344                        ordinal: header.ordinal,
4345                        protocol_name:
4346                            <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4347                    }),
4348                }))
4349            },
4350        )
4351    }
4352}
4353
4354/// `Publisher` publishes media players so they may be discovered and
4355/// controlled by clients who have permission to do so.
4356#[derive(Debug)]
4357pub enum PublisherRequest {
4358    Publish {
4359        player: fidl::endpoints::ClientEnd<PlayerMarker>,
4360        registration: PlayerRegistration,
4361        responder: PublisherPublishResponder,
4362    },
4363}
4364
4365impl PublisherRequest {
4366    #[allow(irrefutable_let_patterns)]
4367    pub fn into_publish(
4368        self,
4369    ) -> Option<(
4370        fidl::endpoints::ClientEnd<PlayerMarker>,
4371        PlayerRegistration,
4372        PublisherPublishResponder,
4373    )> {
4374        if let PublisherRequest::Publish { player, registration, responder } = self {
4375            Some((player, registration, responder))
4376        } else {
4377            None
4378        }
4379    }
4380
4381    /// Name of the method defined in FIDL
4382    pub fn method_name(&self) -> &'static str {
4383        match *self {
4384            PublisherRequest::Publish { .. } => "publish",
4385        }
4386    }
4387}
4388
4389#[derive(Debug, Clone)]
4390pub struct PublisherControlHandle {
4391    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4392}
4393
4394impl fidl::endpoints::ControlHandle for PublisherControlHandle {
4395    fn shutdown(&self) {
4396        self.inner.shutdown()
4397    }
4398    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4399        self.inner.shutdown_with_epitaph(status)
4400    }
4401
4402    fn is_closed(&self) -> bool {
4403        self.inner.channel().is_closed()
4404    }
4405    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4406        self.inner.channel().on_closed()
4407    }
4408
4409    #[cfg(target_os = "fuchsia")]
4410    fn signal_peer(
4411        &self,
4412        clear_mask: zx::Signals,
4413        set_mask: zx::Signals,
4414    ) -> Result<(), zx_status::Status> {
4415        use fidl::Peered;
4416        self.inner.channel().signal_peer(clear_mask, set_mask)
4417    }
4418}
4419
4420impl PublisherControlHandle {}
4421
4422#[must_use = "FIDL methods require a response to be sent"]
4423#[derive(Debug)]
4424pub struct PublisherPublishResponder {
4425    control_handle: std::mem::ManuallyDrop<PublisherControlHandle>,
4426    tx_id: u32,
4427}
4428
4429/// Set the the channel to be shutdown (see [`PublisherControlHandle::shutdown`])
4430/// if the responder is dropped without sending a response, so that the client
4431/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4432impl std::ops::Drop for PublisherPublishResponder {
4433    fn drop(&mut self) {
4434        self.control_handle.shutdown();
4435        // Safety: drops once, never accessed again
4436        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4437    }
4438}
4439
4440impl fidl::endpoints::Responder for PublisherPublishResponder {
4441    type ControlHandle = PublisherControlHandle;
4442
4443    fn control_handle(&self) -> &PublisherControlHandle {
4444        &self.control_handle
4445    }
4446
4447    fn drop_without_shutdown(mut self) {
4448        // Safety: drops once, never accessed again due to mem::forget
4449        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4450        // Prevent Drop from running (which would shut down the channel)
4451        std::mem::forget(self);
4452    }
4453}
4454
4455impl PublisherPublishResponder {
4456    /// Sends a response to the FIDL transaction.
4457    ///
4458    /// Sets the channel to shutdown if an error occurs.
4459    pub fn send(self, mut session_id: u64) -> Result<(), fidl::Error> {
4460        let _result = self.send_raw(session_id);
4461        if _result.is_err() {
4462            self.control_handle.shutdown();
4463        }
4464        self.drop_without_shutdown();
4465        _result
4466    }
4467
4468    /// Similar to "send" but does not shutdown the channel if an error occurs.
4469    pub fn send_no_shutdown_on_err(self, mut session_id: u64) -> Result<(), fidl::Error> {
4470        let _result = self.send_raw(session_id);
4471        self.drop_without_shutdown();
4472        _result
4473    }
4474
4475    fn send_raw(&self, mut session_id: u64) -> Result<(), fidl::Error> {
4476        self.control_handle.inner.send::<PublisherPublishResponse>(
4477            (session_id,),
4478            self.tx_id,
4479            0x2e4a501ede5a1ad3,
4480            fidl::encoding::DynamicFlags::empty(),
4481        )
4482    }
4483}
4484
4485#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4486pub struct SessionControlMarker;
4487
4488impl fidl::endpoints::ProtocolMarker for SessionControlMarker {
4489    type Proxy = SessionControlProxy;
4490    type RequestStream = SessionControlRequestStream;
4491    #[cfg(target_os = "fuchsia")]
4492    type SynchronousProxy = SessionControlSynchronousProxy;
4493
4494    const DEBUG_NAME: &'static str = "(anonymous) SessionControl";
4495}
4496
4497pub trait SessionControlProxyInterface: Send + Sync {
4498    fn r#play(&self) -> Result<(), fidl::Error>;
4499    fn r#pause(&self) -> Result<(), fidl::Error>;
4500    fn r#stop(&self) -> Result<(), fidl::Error>;
4501    fn r#seek(&self, position: i64) -> Result<(), fidl::Error>;
4502    fn r#skip_forward(&self) -> Result<(), fidl::Error>;
4503    fn r#skip_reverse(&self) -> Result<(), fidl::Error>;
4504    fn r#next_item(&self) -> Result<(), fidl::Error>;
4505    fn r#prev_item(&self) -> Result<(), fidl::Error>;
4506    fn r#set_playback_rate(&self, playback_rate: f32) -> Result<(), fidl::Error>;
4507    fn r#set_repeat_mode(&self, repeat_mode: RepeatMode) -> Result<(), fidl::Error>;
4508    fn r#set_shuffle_mode(&self, shuffle_on: bool) -> Result<(), fidl::Error>;
4509    fn r#bind_volume_control(
4510        &self,
4511        volume_control_request: fidl::endpoints::ServerEnd<
4512            fidl_fuchsia_media_audio::VolumeControlMarker,
4513        >,
4514    ) -> Result<(), fidl::Error>;
4515    type WatchStatusResponseFut: std::future::Future<Output = Result<SessionInfoDelta, fidl::Error>>
4516        + Send;
4517    fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
4518}
4519#[derive(Debug)]
4520#[cfg(target_os = "fuchsia")]
4521pub struct SessionControlSynchronousProxy {
4522    client: fidl::client::sync::Client,
4523}
4524
4525#[cfg(target_os = "fuchsia")]
4526impl fidl::endpoints::SynchronousProxy for SessionControlSynchronousProxy {
4527    type Proxy = SessionControlProxy;
4528    type Protocol = SessionControlMarker;
4529
4530    fn from_channel(inner: fidl::Channel) -> Self {
4531        Self::new(inner)
4532    }
4533
4534    fn into_channel(self) -> fidl::Channel {
4535        self.client.into_channel()
4536    }
4537
4538    fn as_channel(&self) -> &fidl::Channel {
4539        self.client.as_channel()
4540    }
4541}
4542
4543#[cfg(target_os = "fuchsia")]
4544impl SessionControlSynchronousProxy {
4545    pub fn new(channel: fidl::Channel) -> Self {
4546        let protocol_name = <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4547        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4548    }
4549
4550    pub fn into_channel(self) -> fidl::Channel {
4551        self.client.into_channel()
4552    }
4553
4554    /// Waits until an event arrives and returns it. It is safe for other
4555    /// threads to make concurrent requests while waiting for an event.
4556    pub fn wait_for_event(
4557        &self,
4558        deadline: zx::MonotonicInstant,
4559    ) -> Result<SessionControlEvent, fidl::Error> {
4560        SessionControlEvent::decode(self.client.wait_for_event(deadline)?)
4561    }
4562
4563    /// Plays media.
4564    pub fn r#play(&self) -> Result<(), fidl::Error> {
4565        self.client.send::<fidl::encoding::EmptyPayload>(
4566            (),
4567            0x43c91c558f7b2946,
4568            fidl::encoding::DynamicFlags::empty(),
4569        )
4570    }
4571
4572    /// Pauses playback and retains position in media
4573    pub fn r#pause(&self) -> Result<(), fidl::Error> {
4574        self.client.send::<fidl::encoding::EmptyPayload>(
4575            (),
4576            0x4e2d75c91ff7d22d,
4577            fidl::encoding::DynamicFlags::empty(),
4578        )
4579    }
4580
4581    /// Stops playback. The session should close.
4582    pub fn r#stop(&self) -> Result<(), fidl::Error> {
4583        self.client.send::<fidl::encoding::EmptyPayload>(
4584            (),
4585            0x53da6661beb2e817,
4586            fidl::encoding::DynamicFlags::empty(),
4587        )
4588    }
4589
4590    /// Seeks to a specific position in media. Implementations are free to
4591    /// enter an error state if the position is out of bounds. `position`
4592    /// is an offset from the beginning of the media.
4593    pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
4594        self.client.send::<SessionControlSeekRequest>(
4595            (position,),
4596            0x380280556aba53d4,
4597            fidl::encoding::DynamicFlags::empty(),
4598        )
4599    }
4600
4601    /// Skips forward in media by the player's default skip amount.
4602    pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
4603        self.client.send::<fidl::encoding::EmptyPayload>(
4604            (),
4605            0x3674bb00f0f12079,
4606            fidl::encoding::DynamicFlags::empty(),
4607        )
4608    }
4609
4610    /// Skips in reverse in media by the player's default skip amount.
4611    pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
4612        self.client.send::<fidl::encoding::EmptyPayload>(
4613            (),
4614            0x5edc786c1a6b087c,
4615            fidl::encoding::DynamicFlags::empty(),
4616        )
4617    }
4618
4619    /// Changes media to the next item (e.g. next song in playlist).
4620    pub fn r#next_item(&self) -> Result<(), fidl::Error> {
4621        self.client.send::<fidl::encoding::EmptyPayload>(
4622            (),
4623            0x13cab0e8bc316138,
4624            fidl::encoding::DynamicFlags::empty(),
4625        )
4626    }
4627
4628    /// Changes media to the previous item.
4629    pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
4630        self.client.send::<fidl::encoding::EmptyPayload>(
4631            (),
4632            0x7f7150e8bd6082cc,
4633            fidl::encoding::DynamicFlags::empty(),
4634        )
4635    }
4636
4637    /// Sets the playback rate of the media. This will not change the
4638    /// playback mode.
4639    pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
4640        self.client.send::<SessionControlSetPlaybackRateRequest>(
4641            (playback_rate,),
4642            0x3e382e2b70c5121d,
4643            fidl::encoding::DynamicFlags::empty(),
4644        )
4645    }
4646
4647    /// Sets repeat mode to any of the supported repeat modes.
4648    pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
4649        self.client.send::<SessionControlSetRepeatModeRequest>(
4650            (repeat_mode,),
4651            0x29381bedf7f29e5,
4652            fidl::encoding::DynamicFlags::empty(),
4653        )
4654    }
4655
4656    /// Sets shuffle mode.
4657    pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
4658        self.client.send::<SessionControlSetShuffleModeRequest>(
4659            (shuffle_on,),
4660            0x34d8d4c0f35e89e,
4661            fidl::encoding::DynamicFlags::empty(),
4662        )
4663    }
4664
4665    /// Binds to the session's volume control for control and notifications.
4666    pub fn r#bind_volume_control(
4667        &self,
4668        mut volume_control_request: fidl::endpoints::ServerEnd<
4669            fidl_fuchsia_media_audio::VolumeControlMarker,
4670        >,
4671    ) -> Result<(), fidl::Error> {
4672        self.client.send::<SessionControlBindVolumeControlRequest>(
4673            (volume_control_request,),
4674            0x1e3c091a08e88710,
4675            fidl::encoding::DynamicFlags::empty(),
4676        )
4677    }
4678
4679    /// Watches the session status. Leave a request hanging to receive a reply when
4680    /// the session status changes. The first request will be answered immediately with
4681    /// the current state.
4682    pub fn r#watch_status(
4683        &self,
4684        ___deadline: zx::MonotonicInstant,
4685    ) -> Result<SessionInfoDelta, fidl::Error> {
4686        let _response = self
4687            .client
4688            .send_query::<fidl::encoding::EmptyPayload, SessionControlWatchStatusResponse>(
4689                (),
4690                0x4ce5727251eb4b74,
4691                fidl::encoding::DynamicFlags::empty(),
4692                ___deadline,
4693            )?;
4694        Ok(_response.session_info_delta)
4695    }
4696}
4697
4698#[derive(Debug, Clone)]
4699pub struct SessionControlProxy {
4700    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4701}
4702
4703impl fidl::endpoints::Proxy for SessionControlProxy {
4704    type Protocol = SessionControlMarker;
4705
4706    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4707        Self::new(inner)
4708    }
4709
4710    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4711        self.client.into_channel().map_err(|client| Self { client })
4712    }
4713
4714    fn as_channel(&self) -> &::fidl::AsyncChannel {
4715        self.client.as_channel()
4716    }
4717}
4718
4719impl SessionControlProxy {
4720    /// Create a new Proxy for fuchsia.media.sessions2/SessionControl.
4721    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4722        let protocol_name = <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4723        Self { client: fidl::client::Client::new(channel, protocol_name) }
4724    }
4725
4726    /// Get a Stream of events from the remote end of the protocol.
4727    ///
4728    /// # Panics
4729    ///
4730    /// Panics if the event stream was already taken.
4731    pub fn take_event_stream(&self) -> SessionControlEventStream {
4732        SessionControlEventStream { event_receiver: self.client.take_event_receiver() }
4733    }
4734
4735    /// Plays media.
4736    pub fn r#play(&self) -> Result<(), fidl::Error> {
4737        SessionControlProxyInterface::r#play(self)
4738    }
4739
4740    /// Pauses playback and retains position in media
4741    pub fn r#pause(&self) -> Result<(), fidl::Error> {
4742        SessionControlProxyInterface::r#pause(self)
4743    }
4744
4745    /// Stops playback. The session should close.
4746    pub fn r#stop(&self) -> Result<(), fidl::Error> {
4747        SessionControlProxyInterface::r#stop(self)
4748    }
4749
4750    /// Seeks to a specific position in media. Implementations are free to
4751    /// enter an error state if the position is out of bounds. `position`
4752    /// is an offset from the beginning of the media.
4753    pub fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
4754        SessionControlProxyInterface::r#seek(self, position)
4755    }
4756
4757    /// Skips forward in media by the player's default skip amount.
4758    pub fn r#skip_forward(&self) -> Result<(), fidl::Error> {
4759        SessionControlProxyInterface::r#skip_forward(self)
4760    }
4761
4762    /// Skips in reverse in media by the player's default skip amount.
4763    pub fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
4764        SessionControlProxyInterface::r#skip_reverse(self)
4765    }
4766
4767    /// Changes media to the next item (e.g. next song in playlist).
4768    pub fn r#next_item(&self) -> Result<(), fidl::Error> {
4769        SessionControlProxyInterface::r#next_item(self)
4770    }
4771
4772    /// Changes media to the previous item.
4773    pub fn r#prev_item(&self) -> Result<(), fidl::Error> {
4774        SessionControlProxyInterface::r#prev_item(self)
4775    }
4776
4777    /// Sets the playback rate of the media. This will not change the
4778    /// playback mode.
4779    pub fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
4780        SessionControlProxyInterface::r#set_playback_rate(self, playback_rate)
4781    }
4782
4783    /// Sets repeat mode to any of the supported repeat modes.
4784    pub fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
4785        SessionControlProxyInterface::r#set_repeat_mode(self, repeat_mode)
4786    }
4787
4788    /// Sets shuffle mode.
4789    pub fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
4790        SessionControlProxyInterface::r#set_shuffle_mode(self, shuffle_on)
4791    }
4792
4793    /// Binds to the session's volume control for control and notifications.
4794    pub fn r#bind_volume_control(
4795        &self,
4796        mut volume_control_request: fidl::endpoints::ServerEnd<
4797            fidl_fuchsia_media_audio::VolumeControlMarker,
4798        >,
4799    ) -> Result<(), fidl::Error> {
4800        SessionControlProxyInterface::r#bind_volume_control(self, volume_control_request)
4801    }
4802
4803    /// Watches the session status. Leave a request hanging to receive a reply when
4804    /// the session status changes. The first request will be answered immediately with
4805    /// the current state.
4806    pub fn r#watch_status(
4807        &self,
4808    ) -> fidl::client::QueryResponseFut<
4809        SessionInfoDelta,
4810        fidl::encoding::DefaultFuchsiaResourceDialect,
4811    > {
4812        SessionControlProxyInterface::r#watch_status(self)
4813    }
4814}
4815
4816impl SessionControlProxyInterface for SessionControlProxy {
4817    fn r#play(&self) -> Result<(), fidl::Error> {
4818        self.client.send::<fidl::encoding::EmptyPayload>(
4819            (),
4820            0x43c91c558f7b2946,
4821            fidl::encoding::DynamicFlags::empty(),
4822        )
4823    }
4824
4825    fn r#pause(&self) -> Result<(), fidl::Error> {
4826        self.client.send::<fidl::encoding::EmptyPayload>(
4827            (),
4828            0x4e2d75c91ff7d22d,
4829            fidl::encoding::DynamicFlags::empty(),
4830        )
4831    }
4832
4833    fn r#stop(&self) -> Result<(), fidl::Error> {
4834        self.client.send::<fidl::encoding::EmptyPayload>(
4835            (),
4836            0x53da6661beb2e817,
4837            fidl::encoding::DynamicFlags::empty(),
4838        )
4839    }
4840
4841    fn r#seek(&self, mut position: i64) -> Result<(), fidl::Error> {
4842        self.client.send::<SessionControlSeekRequest>(
4843            (position,),
4844            0x380280556aba53d4,
4845            fidl::encoding::DynamicFlags::empty(),
4846        )
4847    }
4848
4849    fn r#skip_forward(&self) -> Result<(), fidl::Error> {
4850        self.client.send::<fidl::encoding::EmptyPayload>(
4851            (),
4852            0x3674bb00f0f12079,
4853            fidl::encoding::DynamicFlags::empty(),
4854        )
4855    }
4856
4857    fn r#skip_reverse(&self) -> Result<(), fidl::Error> {
4858        self.client.send::<fidl::encoding::EmptyPayload>(
4859            (),
4860            0x5edc786c1a6b087c,
4861            fidl::encoding::DynamicFlags::empty(),
4862        )
4863    }
4864
4865    fn r#next_item(&self) -> Result<(), fidl::Error> {
4866        self.client.send::<fidl::encoding::EmptyPayload>(
4867            (),
4868            0x13cab0e8bc316138,
4869            fidl::encoding::DynamicFlags::empty(),
4870        )
4871    }
4872
4873    fn r#prev_item(&self) -> Result<(), fidl::Error> {
4874        self.client.send::<fidl::encoding::EmptyPayload>(
4875            (),
4876            0x7f7150e8bd6082cc,
4877            fidl::encoding::DynamicFlags::empty(),
4878        )
4879    }
4880
4881    fn r#set_playback_rate(&self, mut playback_rate: f32) -> Result<(), fidl::Error> {
4882        self.client.send::<SessionControlSetPlaybackRateRequest>(
4883            (playback_rate,),
4884            0x3e382e2b70c5121d,
4885            fidl::encoding::DynamicFlags::empty(),
4886        )
4887    }
4888
4889    fn r#set_repeat_mode(&self, mut repeat_mode: RepeatMode) -> Result<(), fidl::Error> {
4890        self.client.send::<SessionControlSetRepeatModeRequest>(
4891            (repeat_mode,),
4892            0x29381bedf7f29e5,
4893            fidl::encoding::DynamicFlags::empty(),
4894        )
4895    }
4896
4897    fn r#set_shuffle_mode(&self, mut shuffle_on: bool) -> Result<(), fidl::Error> {
4898        self.client.send::<SessionControlSetShuffleModeRequest>(
4899            (shuffle_on,),
4900            0x34d8d4c0f35e89e,
4901            fidl::encoding::DynamicFlags::empty(),
4902        )
4903    }
4904
4905    fn r#bind_volume_control(
4906        &self,
4907        mut volume_control_request: fidl::endpoints::ServerEnd<
4908            fidl_fuchsia_media_audio::VolumeControlMarker,
4909        >,
4910    ) -> Result<(), fidl::Error> {
4911        self.client.send::<SessionControlBindVolumeControlRequest>(
4912            (volume_control_request,),
4913            0x1e3c091a08e88710,
4914            fidl::encoding::DynamicFlags::empty(),
4915        )
4916    }
4917
4918    type WatchStatusResponseFut = fidl::client::QueryResponseFut<
4919        SessionInfoDelta,
4920        fidl::encoding::DefaultFuchsiaResourceDialect,
4921    >;
4922    fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
4923        fn _decode(
4924            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4925        ) -> Result<SessionInfoDelta, fidl::Error> {
4926            let _response = fidl::client::decode_transaction_body::<
4927                SessionControlWatchStatusResponse,
4928                fidl::encoding::DefaultFuchsiaResourceDialect,
4929                0x4ce5727251eb4b74,
4930            >(_buf?)?;
4931            Ok(_response.session_info_delta)
4932        }
4933        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionInfoDelta>(
4934            (),
4935            0x4ce5727251eb4b74,
4936            fidl::encoding::DynamicFlags::empty(),
4937            _decode,
4938        )
4939    }
4940}
4941
4942pub struct SessionControlEventStream {
4943    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4944}
4945
4946impl std::marker::Unpin for SessionControlEventStream {}
4947
4948impl futures::stream::FusedStream for SessionControlEventStream {
4949    fn is_terminated(&self) -> bool {
4950        self.event_receiver.is_terminated()
4951    }
4952}
4953
4954impl futures::Stream for SessionControlEventStream {
4955    type Item = Result<SessionControlEvent, fidl::Error>;
4956
4957    fn poll_next(
4958        mut self: std::pin::Pin<&mut Self>,
4959        cx: &mut std::task::Context<'_>,
4960    ) -> std::task::Poll<Option<Self::Item>> {
4961        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4962            &mut self.event_receiver,
4963            cx
4964        )?) {
4965            Some(buf) => std::task::Poll::Ready(Some(SessionControlEvent::decode(buf))),
4966            None => std::task::Poll::Ready(None),
4967        }
4968    }
4969}
4970
4971#[derive(Debug)]
4972pub enum SessionControlEvent {}
4973
4974impl SessionControlEvent {
4975    /// Decodes a message buffer as a [`SessionControlEvent`].
4976    fn decode(
4977        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4978    ) -> Result<SessionControlEvent, fidl::Error> {
4979        let (bytes, _handles) = buf.split_mut();
4980        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4981        debug_assert_eq!(tx_header.tx_id, 0);
4982        match tx_header.ordinal {
4983            _ => Err(fidl::Error::UnknownOrdinal {
4984                ordinal: tx_header.ordinal,
4985                protocol_name:
4986                    <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4987            }),
4988        }
4989    }
4990}
4991
4992/// A Stream of incoming requests for fuchsia.media.sessions2/SessionControl.
4993pub struct SessionControlRequestStream {
4994    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4995    is_terminated: bool,
4996}
4997
4998impl std::marker::Unpin for SessionControlRequestStream {}
4999
5000impl futures::stream::FusedStream for SessionControlRequestStream {
5001    fn is_terminated(&self) -> bool {
5002        self.is_terminated
5003    }
5004}
5005
5006impl fidl::endpoints::RequestStream for SessionControlRequestStream {
5007    type Protocol = SessionControlMarker;
5008    type ControlHandle = SessionControlControlHandle;
5009
5010    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5011        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5012    }
5013
5014    fn control_handle(&self) -> Self::ControlHandle {
5015        SessionControlControlHandle { inner: self.inner.clone() }
5016    }
5017
5018    fn into_inner(
5019        self,
5020    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5021    {
5022        (self.inner, self.is_terminated)
5023    }
5024
5025    fn from_inner(
5026        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5027        is_terminated: bool,
5028    ) -> Self {
5029        Self { inner, is_terminated }
5030    }
5031}
5032
5033impl futures::Stream for SessionControlRequestStream {
5034    type Item = Result<SessionControlRequest, fidl::Error>;
5035
5036    fn poll_next(
5037        mut self: std::pin::Pin<&mut Self>,
5038        cx: &mut std::task::Context<'_>,
5039    ) -> std::task::Poll<Option<Self::Item>> {
5040        let this = &mut *self;
5041        if this.inner.check_shutdown(cx) {
5042            this.is_terminated = true;
5043            return std::task::Poll::Ready(None);
5044        }
5045        if this.is_terminated {
5046            panic!("polled SessionControlRequestStream after completion");
5047        }
5048        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5049            |bytes, handles| {
5050                match this.inner.channel().read_etc(cx, bytes, handles) {
5051                    std::task::Poll::Ready(Ok(())) => {}
5052                    std::task::Poll::Pending => return std::task::Poll::Pending,
5053                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5054                        this.is_terminated = true;
5055                        return std::task::Poll::Ready(None);
5056                    }
5057                    std::task::Poll::Ready(Err(e)) => {
5058                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5059                            e.into(),
5060                        ))))
5061                    }
5062                }
5063
5064                // A message has been received from the channel
5065                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5066
5067                std::task::Poll::Ready(Some(match header.ordinal {
5068                    0x43c91c558f7b2946 => {
5069                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5070                        let mut req = fidl::new_empty!(
5071                            fidl::encoding::EmptyPayload,
5072                            fidl::encoding::DefaultFuchsiaResourceDialect
5073                        );
5074                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5075                        let control_handle =
5076                            SessionControlControlHandle { inner: this.inner.clone() };
5077                        Ok(SessionControlRequest::Play { control_handle })
5078                    }
5079                    0x4e2d75c91ff7d22d => {
5080                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5081                        let mut req = fidl::new_empty!(
5082                            fidl::encoding::EmptyPayload,
5083                            fidl::encoding::DefaultFuchsiaResourceDialect
5084                        );
5085                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5086                        let control_handle =
5087                            SessionControlControlHandle { inner: this.inner.clone() };
5088                        Ok(SessionControlRequest::Pause { control_handle })
5089                    }
5090                    0x53da6661beb2e817 => {
5091                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5092                        let mut req = fidl::new_empty!(
5093                            fidl::encoding::EmptyPayload,
5094                            fidl::encoding::DefaultFuchsiaResourceDialect
5095                        );
5096                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5097                        let control_handle =
5098                            SessionControlControlHandle { inner: this.inner.clone() };
5099                        Ok(SessionControlRequest::Stop { control_handle })
5100                    }
5101                    0x380280556aba53d4 => {
5102                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5103                        let mut req = fidl::new_empty!(
5104                            SessionControlSeekRequest,
5105                            fidl::encoding::DefaultFuchsiaResourceDialect
5106                        );
5107                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSeekRequest>(&header, _body_bytes, handles, &mut req)?;
5108                        let control_handle =
5109                            SessionControlControlHandle { inner: this.inner.clone() };
5110                        Ok(SessionControlRequest::Seek { position: req.position, control_handle })
5111                    }
5112                    0x3674bb00f0f12079 => {
5113                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5114                        let mut req = fidl::new_empty!(
5115                            fidl::encoding::EmptyPayload,
5116                            fidl::encoding::DefaultFuchsiaResourceDialect
5117                        );
5118                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5119                        let control_handle =
5120                            SessionControlControlHandle { inner: this.inner.clone() };
5121                        Ok(SessionControlRequest::SkipForward { control_handle })
5122                    }
5123                    0x5edc786c1a6b087c => {
5124                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5125                        let mut req = fidl::new_empty!(
5126                            fidl::encoding::EmptyPayload,
5127                            fidl::encoding::DefaultFuchsiaResourceDialect
5128                        );
5129                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5130                        let control_handle =
5131                            SessionControlControlHandle { inner: this.inner.clone() };
5132                        Ok(SessionControlRequest::SkipReverse { control_handle })
5133                    }
5134                    0x13cab0e8bc316138 => {
5135                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5136                        let mut req = fidl::new_empty!(
5137                            fidl::encoding::EmptyPayload,
5138                            fidl::encoding::DefaultFuchsiaResourceDialect
5139                        );
5140                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5141                        let control_handle =
5142                            SessionControlControlHandle { inner: this.inner.clone() };
5143                        Ok(SessionControlRequest::NextItem { control_handle })
5144                    }
5145                    0x7f7150e8bd6082cc => {
5146                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5147                        let mut req = fidl::new_empty!(
5148                            fidl::encoding::EmptyPayload,
5149                            fidl::encoding::DefaultFuchsiaResourceDialect
5150                        );
5151                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5152                        let control_handle =
5153                            SessionControlControlHandle { inner: this.inner.clone() };
5154                        Ok(SessionControlRequest::PrevItem { control_handle })
5155                    }
5156                    0x3e382e2b70c5121d => {
5157                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5158                        let mut req = fidl::new_empty!(
5159                            SessionControlSetPlaybackRateRequest,
5160                            fidl::encoding::DefaultFuchsiaResourceDialect
5161                        );
5162                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetPlaybackRateRequest>(&header, _body_bytes, handles, &mut req)?;
5163                        let control_handle =
5164                            SessionControlControlHandle { inner: this.inner.clone() };
5165                        Ok(SessionControlRequest::SetPlaybackRate {
5166                            playback_rate: req.playback_rate,
5167
5168                            control_handle,
5169                        })
5170                    }
5171                    0x29381bedf7f29e5 => {
5172                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5173                        let mut req = fidl::new_empty!(
5174                            SessionControlSetRepeatModeRequest,
5175                            fidl::encoding::DefaultFuchsiaResourceDialect
5176                        );
5177                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetRepeatModeRequest>(&header, _body_bytes, handles, &mut req)?;
5178                        let control_handle =
5179                            SessionControlControlHandle { inner: this.inner.clone() };
5180                        Ok(SessionControlRequest::SetRepeatMode {
5181                            repeat_mode: req.repeat_mode,
5182
5183                            control_handle,
5184                        })
5185                    }
5186                    0x34d8d4c0f35e89e => {
5187                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5188                        let mut req = fidl::new_empty!(
5189                            SessionControlSetShuffleModeRequest,
5190                            fidl::encoding::DefaultFuchsiaResourceDialect
5191                        );
5192                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlSetShuffleModeRequest>(&header, _body_bytes, handles, &mut req)?;
5193                        let control_handle =
5194                            SessionControlControlHandle { inner: this.inner.clone() };
5195                        Ok(SessionControlRequest::SetShuffleMode {
5196                            shuffle_on: req.shuffle_on,
5197
5198                            control_handle,
5199                        })
5200                    }
5201                    0x1e3c091a08e88710 => {
5202                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5203                        let mut req = fidl::new_empty!(
5204                            SessionControlBindVolumeControlRequest,
5205                            fidl::encoding::DefaultFuchsiaResourceDialect
5206                        );
5207                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionControlBindVolumeControlRequest>(&header, _body_bytes, handles, &mut req)?;
5208                        let control_handle =
5209                            SessionControlControlHandle { inner: this.inner.clone() };
5210                        Ok(SessionControlRequest::BindVolumeControl {
5211                            volume_control_request: req.volume_control_request,
5212
5213                            control_handle,
5214                        })
5215                    }
5216                    0x4ce5727251eb4b74 => {
5217                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5218                        let mut req = fidl::new_empty!(
5219                            fidl::encoding::EmptyPayload,
5220                            fidl::encoding::DefaultFuchsiaResourceDialect
5221                        );
5222                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5223                        let control_handle =
5224                            SessionControlControlHandle { inner: this.inner.clone() };
5225                        Ok(SessionControlRequest::WatchStatus {
5226                            responder: SessionControlWatchStatusResponder {
5227                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5228                                tx_id: header.tx_id,
5229                            },
5230                        })
5231                    }
5232                    _ => Err(fidl::Error::UnknownOrdinal {
5233                        ordinal: header.ordinal,
5234                        protocol_name:
5235                            <SessionControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5236                    }),
5237                }))
5238            },
5239        )
5240    }
5241}
5242
5243/// Controls a media session and views its status.
5244///
5245/// The channel will close if the media session is stopped.
5246#[derive(Debug)]
5247pub enum SessionControlRequest {
5248    /// Plays media.
5249    Play { control_handle: SessionControlControlHandle },
5250    /// Pauses playback and retains position in media
5251    Pause { control_handle: SessionControlControlHandle },
5252    /// Stops playback. The session should close.
5253    Stop { control_handle: SessionControlControlHandle },
5254    /// Seeks to a specific position in media. Implementations are free to
5255    /// enter an error state if the position is out of bounds. `position`
5256    /// is an offset from the beginning of the media.
5257    Seek { position: i64, control_handle: SessionControlControlHandle },
5258    /// Skips forward in media by the player's default skip amount.
5259    SkipForward { control_handle: SessionControlControlHandle },
5260    /// Skips in reverse in media by the player's default skip amount.
5261    SkipReverse { control_handle: SessionControlControlHandle },
5262    /// Changes media to the next item (e.g. next song in playlist).
5263    NextItem { control_handle: SessionControlControlHandle },
5264    /// Changes media to the previous item.
5265    PrevItem { control_handle: SessionControlControlHandle },
5266    /// Sets the playback rate of the media. This will not change the
5267    /// playback mode.
5268    SetPlaybackRate { playback_rate: f32, control_handle: SessionControlControlHandle },
5269    /// Sets repeat mode to any of the supported repeat modes.
5270    SetRepeatMode { repeat_mode: RepeatMode, control_handle: SessionControlControlHandle },
5271    /// Sets shuffle mode.
5272    SetShuffleMode { shuffle_on: bool, control_handle: SessionControlControlHandle },
5273    /// Binds to the session's volume control for control and notifications.
5274    BindVolumeControl {
5275        volume_control_request:
5276            fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
5277        control_handle: SessionControlControlHandle,
5278    },
5279    /// Watches the session status. Leave a request hanging to receive a reply when
5280    /// the session status changes. The first request will be answered immediately with
5281    /// the current state.
5282    WatchStatus { responder: SessionControlWatchStatusResponder },
5283}
5284
5285impl SessionControlRequest {
5286    #[allow(irrefutable_let_patterns)]
5287    pub fn into_play(self) -> Option<(SessionControlControlHandle)> {
5288        if let SessionControlRequest::Play { control_handle } = self {
5289            Some((control_handle))
5290        } else {
5291            None
5292        }
5293    }
5294
5295    #[allow(irrefutable_let_patterns)]
5296    pub fn into_pause(self) -> Option<(SessionControlControlHandle)> {
5297        if let SessionControlRequest::Pause { control_handle } = self {
5298            Some((control_handle))
5299        } else {
5300            None
5301        }
5302    }
5303
5304    #[allow(irrefutable_let_patterns)]
5305    pub fn into_stop(self) -> Option<(SessionControlControlHandle)> {
5306        if let SessionControlRequest::Stop { control_handle } = self {
5307            Some((control_handle))
5308        } else {
5309            None
5310        }
5311    }
5312
5313    #[allow(irrefutable_let_patterns)]
5314    pub fn into_seek(self) -> Option<(i64, SessionControlControlHandle)> {
5315        if let SessionControlRequest::Seek { position, control_handle } = self {
5316            Some((position, control_handle))
5317        } else {
5318            None
5319        }
5320    }
5321
5322    #[allow(irrefutable_let_patterns)]
5323    pub fn into_skip_forward(self) -> Option<(SessionControlControlHandle)> {
5324        if let SessionControlRequest::SkipForward { control_handle } = self {
5325            Some((control_handle))
5326        } else {
5327            None
5328        }
5329    }
5330
5331    #[allow(irrefutable_let_patterns)]
5332    pub fn into_skip_reverse(self) -> Option<(SessionControlControlHandle)> {
5333        if let SessionControlRequest::SkipReverse { control_handle } = self {
5334            Some((control_handle))
5335        } else {
5336            None
5337        }
5338    }
5339
5340    #[allow(irrefutable_let_patterns)]
5341    pub fn into_next_item(self) -> Option<(SessionControlControlHandle)> {
5342        if let SessionControlRequest::NextItem { control_handle } = self {
5343            Some((control_handle))
5344        } else {
5345            None
5346        }
5347    }
5348
5349    #[allow(irrefutable_let_patterns)]
5350    pub fn into_prev_item(self) -> Option<(SessionControlControlHandle)> {
5351        if let SessionControlRequest::PrevItem { control_handle } = self {
5352            Some((control_handle))
5353        } else {
5354            None
5355        }
5356    }
5357
5358    #[allow(irrefutable_let_patterns)]
5359    pub fn into_set_playback_rate(self) -> Option<(f32, SessionControlControlHandle)> {
5360        if let SessionControlRequest::SetPlaybackRate { playback_rate, control_handle } = self {
5361            Some((playback_rate, control_handle))
5362        } else {
5363            None
5364        }
5365    }
5366
5367    #[allow(irrefutable_let_patterns)]
5368    pub fn into_set_repeat_mode(self) -> Option<(RepeatMode, SessionControlControlHandle)> {
5369        if let SessionControlRequest::SetRepeatMode { repeat_mode, control_handle } = self {
5370            Some((repeat_mode, control_handle))
5371        } else {
5372            None
5373        }
5374    }
5375
5376    #[allow(irrefutable_let_patterns)]
5377    pub fn into_set_shuffle_mode(self) -> Option<(bool, SessionControlControlHandle)> {
5378        if let SessionControlRequest::SetShuffleMode { shuffle_on, control_handle } = self {
5379            Some((shuffle_on, control_handle))
5380        } else {
5381            None
5382        }
5383    }
5384
5385    #[allow(irrefutable_let_patterns)]
5386    pub fn into_bind_volume_control(
5387        self,
5388    ) -> Option<(
5389        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
5390        SessionControlControlHandle,
5391    )> {
5392        if let SessionControlRequest::BindVolumeControl { volume_control_request, control_handle } =
5393            self
5394        {
5395            Some((volume_control_request, control_handle))
5396        } else {
5397            None
5398        }
5399    }
5400
5401    #[allow(irrefutable_let_patterns)]
5402    pub fn into_watch_status(self) -> Option<(SessionControlWatchStatusResponder)> {
5403        if let SessionControlRequest::WatchStatus { responder } = self {
5404            Some((responder))
5405        } else {
5406            None
5407        }
5408    }
5409
5410    /// Name of the method defined in FIDL
5411    pub fn method_name(&self) -> &'static str {
5412        match *self {
5413            SessionControlRequest::Play { .. } => "play",
5414            SessionControlRequest::Pause { .. } => "pause",
5415            SessionControlRequest::Stop { .. } => "stop",
5416            SessionControlRequest::Seek { .. } => "seek",
5417            SessionControlRequest::SkipForward { .. } => "skip_forward",
5418            SessionControlRequest::SkipReverse { .. } => "skip_reverse",
5419            SessionControlRequest::NextItem { .. } => "next_item",
5420            SessionControlRequest::PrevItem { .. } => "prev_item",
5421            SessionControlRequest::SetPlaybackRate { .. } => "set_playback_rate",
5422            SessionControlRequest::SetRepeatMode { .. } => "set_repeat_mode",
5423            SessionControlRequest::SetShuffleMode { .. } => "set_shuffle_mode",
5424            SessionControlRequest::BindVolumeControl { .. } => "bind_volume_control",
5425            SessionControlRequest::WatchStatus { .. } => "watch_status",
5426        }
5427    }
5428}
5429
5430#[derive(Debug, Clone)]
5431pub struct SessionControlControlHandle {
5432    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5433}
5434
5435impl fidl::endpoints::ControlHandle for SessionControlControlHandle {
5436    fn shutdown(&self) {
5437        self.inner.shutdown()
5438    }
5439    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5440        self.inner.shutdown_with_epitaph(status)
5441    }
5442
5443    fn is_closed(&self) -> bool {
5444        self.inner.channel().is_closed()
5445    }
5446    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5447        self.inner.channel().on_closed()
5448    }
5449
5450    #[cfg(target_os = "fuchsia")]
5451    fn signal_peer(
5452        &self,
5453        clear_mask: zx::Signals,
5454        set_mask: zx::Signals,
5455    ) -> Result<(), zx_status::Status> {
5456        use fidl::Peered;
5457        self.inner.channel().signal_peer(clear_mask, set_mask)
5458    }
5459}
5460
5461impl SessionControlControlHandle {}
5462
5463#[must_use = "FIDL methods require a response to be sent"]
5464#[derive(Debug)]
5465pub struct SessionControlWatchStatusResponder {
5466    control_handle: std::mem::ManuallyDrop<SessionControlControlHandle>,
5467    tx_id: u32,
5468}
5469
5470/// Set the the channel to be shutdown (see [`SessionControlControlHandle::shutdown`])
5471/// if the responder is dropped without sending a response, so that the client
5472/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5473impl std::ops::Drop for SessionControlWatchStatusResponder {
5474    fn drop(&mut self) {
5475        self.control_handle.shutdown();
5476        // Safety: drops once, never accessed again
5477        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5478    }
5479}
5480
5481impl fidl::endpoints::Responder for SessionControlWatchStatusResponder {
5482    type ControlHandle = SessionControlControlHandle;
5483
5484    fn control_handle(&self) -> &SessionControlControlHandle {
5485        &self.control_handle
5486    }
5487
5488    fn drop_without_shutdown(mut self) {
5489        // Safety: drops once, never accessed again due to mem::forget
5490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5491        // Prevent Drop from running (which would shut down the channel)
5492        std::mem::forget(self);
5493    }
5494}
5495
5496impl SessionControlWatchStatusResponder {
5497    /// Sends a response to the FIDL transaction.
5498    ///
5499    /// Sets the channel to shutdown if an error occurs.
5500    pub fn send(self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5501        let _result = self.send_raw(session_info_delta);
5502        if _result.is_err() {
5503            self.control_handle.shutdown();
5504        }
5505        self.drop_without_shutdown();
5506        _result
5507    }
5508
5509    /// Similar to "send" but does not shutdown the channel if an error occurs.
5510    pub fn send_no_shutdown_on_err(
5511        self,
5512        mut session_info_delta: &SessionInfoDelta,
5513    ) -> Result<(), fidl::Error> {
5514        let _result = self.send_raw(session_info_delta);
5515        self.drop_without_shutdown();
5516        _result
5517    }
5518
5519    fn send_raw(&self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5520        self.control_handle.inner.send::<SessionControlWatchStatusResponse>(
5521            (session_info_delta,),
5522            self.tx_id,
5523            0x4ce5727251eb4b74,
5524            fidl::encoding::DynamicFlags::empty(),
5525        )
5526    }
5527}
5528
5529#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5530pub struct SessionObserverMarker;
5531
5532impl fidl::endpoints::ProtocolMarker for SessionObserverMarker {
5533    type Proxy = SessionObserverProxy;
5534    type RequestStream = SessionObserverRequestStream;
5535    #[cfg(target_os = "fuchsia")]
5536    type SynchronousProxy = SessionObserverSynchronousProxy;
5537
5538    const DEBUG_NAME: &'static str = "(anonymous) SessionObserver";
5539}
5540
5541pub trait SessionObserverProxyInterface: Send + Sync {
5542    type WatchStatusResponseFut: std::future::Future<Output = Result<SessionInfoDelta, fidl::Error>>
5543        + Send;
5544    fn r#watch_status(&self) -> Self::WatchStatusResponseFut;
5545}
5546#[derive(Debug)]
5547#[cfg(target_os = "fuchsia")]
5548pub struct SessionObserverSynchronousProxy {
5549    client: fidl::client::sync::Client,
5550}
5551
5552#[cfg(target_os = "fuchsia")]
5553impl fidl::endpoints::SynchronousProxy for SessionObserverSynchronousProxy {
5554    type Proxy = SessionObserverProxy;
5555    type Protocol = SessionObserverMarker;
5556
5557    fn from_channel(inner: fidl::Channel) -> Self {
5558        Self::new(inner)
5559    }
5560
5561    fn into_channel(self) -> fidl::Channel {
5562        self.client.into_channel()
5563    }
5564
5565    fn as_channel(&self) -> &fidl::Channel {
5566        self.client.as_channel()
5567    }
5568}
5569
5570#[cfg(target_os = "fuchsia")]
5571impl SessionObserverSynchronousProxy {
5572    pub fn new(channel: fidl::Channel) -> Self {
5573        let protocol_name = <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5574        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5575    }
5576
5577    pub fn into_channel(self) -> fidl::Channel {
5578        self.client.into_channel()
5579    }
5580
5581    /// Waits until an event arrives and returns it. It is safe for other
5582    /// threads to make concurrent requests while waiting for an event.
5583    pub fn wait_for_event(
5584        &self,
5585        deadline: zx::MonotonicInstant,
5586    ) -> Result<SessionObserverEvent, fidl::Error> {
5587        SessionObserverEvent::decode(self.client.wait_for_event(deadline)?)
5588    }
5589
5590    /// Watches the session status. Leave a request hanging to receive a reply when
5591    /// the session status changes. The first request will be answered immediately with
5592    /// the current state.
5593    pub fn r#watch_status(
5594        &self,
5595        ___deadline: zx::MonotonicInstant,
5596    ) -> Result<SessionInfoDelta, fidl::Error> {
5597        let _response = self
5598            .client
5599            .send_query::<fidl::encoding::EmptyPayload, SessionObserverWatchStatusResponse>(
5600                (),
5601                0x24618b709ca18f4d,
5602                fidl::encoding::DynamicFlags::empty(),
5603                ___deadline,
5604            )?;
5605        Ok(_response.session_info_delta)
5606    }
5607}
5608
5609#[derive(Debug, Clone)]
5610pub struct SessionObserverProxy {
5611    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5612}
5613
5614impl fidl::endpoints::Proxy for SessionObserverProxy {
5615    type Protocol = SessionObserverMarker;
5616
5617    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5618        Self::new(inner)
5619    }
5620
5621    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5622        self.client.into_channel().map_err(|client| Self { client })
5623    }
5624
5625    fn as_channel(&self) -> &::fidl::AsyncChannel {
5626        self.client.as_channel()
5627    }
5628}
5629
5630impl SessionObserverProxy {
5631    /// Create a new Proxy for fuchsia.media.sessions2/SessionObserver.
5632    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5633        let protocol_name = <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5634        Self { client: fidl::client::Client::new(channel, protocol_name) }
5635    }
5636
5637    /// Get a Stream of events from the remote end of the protocol.
5638    ///
5639    /// # Panics
5640    ///
5641    /// Panics if the event stream was already taken.
5642    pub fn take_event_stream(&self) -> SessionObserverEventStream {
5643        SessionObserverEventStream { event_receiver: self.client.take_event_receiver() }
5644    }
5645
5646    /// Watches the session status. Leave a request hanging to receive a reply when
5647    /// the session status changes. The first request will be answered immediately with
5648    /// the current state.
5649    pub fn r#watch_status(
5650        &self,
5651    ) -> fidl::client::QueryResponseFut<
5652        SessionInfoDelta,
5653        fidl::encoding::DefaultFuchsiaResourceDialect,
5654    > {
5655        SessionObserverProxyInterface::r#watch_status(self)
5656    }
5657}
5658
5659impl SessionObserverProxyInterface for SessionObserverProxy {
5660    type WatchStatusResponseFut = fidl::client::QueryResponseFut<
5661        SessionInfoDelta,
5662        fidl::encoding::DefaultFuchsiaResourceDialect,
5663    >;
5664    fn r#watch_status(&self) -> Self::WatchStatusResponseFut {
5665        fn _decode(
5666            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5667        ) -> Result<SessionInfoDelta, fidl::Error> {
5668            let _response = fidl::client::decode_transaction_body::<
5669                SessionObserverWatchStatusResponse,
5670                fidl::encoding::DefaultFuchsiaResourceDialect,
5671                0x24618b709ca18f4d,
5672            >(_buf?)?;
5673            Ok(_response.session_info_delta)
5674        }
5675        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, SessionInfoDelta>(
5676            (),
5677            0x24618b709ca18f4d,
5678            fidl::encoding::DynamicFlags::empty(),
5679            _decode,
5680        )
5681    }
5682}
5683
5684pub struct SessionObserverEventStream {
5685    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5686}
5687
5688impl std::marker::Unpin for SessionObserverEventStream {}
5689
5690impl futures::stream::FusedStream for SessionObserverEventStream {
5691    fn is_terminated(&self) -> bool {
5692        self.event_receiver.is_terminated()
5693    }
5694}
5695
5696impl futures::Stream for SessionObserverEventStream {
5697    type Item = Result<SessionObserverEvent, fidl::Error>;
5698
5699    fn poll_next(
5700        mut self: std::pin::Pin<&mut Self>,
5701        cx: &mut std::task::Context<'_>,
5702    ) -> std::task::Poll<Option<Self::Item>> {
5703        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5704            &mut self.event_receiver,
5705            cx
5706        )?) {
5707            Some(buf) => std::task::Poll::Ready(Some(SessionObserverEvent::decode(buf))),
5708            None => std::task::Poll::Ready(None),
5709        }
5710    }
5711}
5712
5713#[derive(Debug)]
5714pub enum SessionObserverEvent {}
5715
5716impl SessionObserverEvent {
5717    /// Decodes a message buffer as a [`SessionObserverEvent`].
5718    fn decode(
5719        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5720    ) -> Result<SessionObserverEvent, fidl::Error> {
5721        let (bytes, _handles) = buf.split_mut();
5722        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5723        debug_assert_eq!(tx_header.tx_id, 0);
5724        match tx_header.ordinal {
5725            _ => Err(fidl::Error::UnknownOrdinal {
5726                ordinal: tx_header.ordinal,
5727                protocol_name:
5728                    <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5729            }),
5730        }
5731    }
5732}
5733
5734/// A Stream of incoming requests for fuchsia.media.sessions2/SessionObserver.
5735pub struct SessionObserverRequestStream {
5736    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5737    is_terminated: bool,
5738}
5739
5740impl std::marker::Unpin for SessionObserverRequestStream {}
5741
5742impl futures::stream::FusedStream for SessionObserverRequestStream {
5743    fn is_terminated(&self) -> bool {
5744        self.is_terminated
5745    }
5746}
5747
5748impl fidl::endpoints::RequestStream for SessionObserverRequestStream {
5749    type Protocol = SessionObserverMarker;
5750    type ControlHandle = SessionObserverControlHandle;
5751
5752    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5753        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5754    }
5755
5756    fn control_handle(&self) -> Self::ControlHandle {
5757        SessionObserverControlHandle { inner: self.inner.clone() }
5758    }
5759
5760    fn into_inner(
5761        self,
5762    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5763    {
5764        (self.inner, self.is_terminated)
5765    }
5766
5767    fn from_inner(
5768        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5769        is_terminated: bool,
5770    ) -> Self {
5771        Self { inner, is_terminated }
5772    }
5773}
5774
5775impl futures::Stream for SessionObserverRequestStream {
5776    type Item = Result<SessionObserverRequest, fidl::Error>;
5777
5778    fn poll_next(
5779        mut self: std::pin::Pin<&mut Self>,
5780        cx: &mut std::task::Context<'_>,
5781    ) -> std::task::Poll<Option<Self::Item>> {
5782        let this = &mut *self;
5783        if this.inner.check_shutdown(cx) {
5784            this.is_terminated = true;
5785            return std::task::Poll::Ready(None);
5786        }
5787        if this.is_terminated {
5788            panic!("polled SessionObserverRequestStream after completion");
5789        }
5790        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5791            |bytes, handles| {
5792                match this.inner.channel().read_etc(cx, bytes, handles) {
5793                    std::task::Poll::Ready(Ok(())) => {}
5794                    std::task::Poll::Pending => return std::task::Poll::Pending,
5795                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5796                        this.is_terminated = true;
5797                        return std::task::Poll::Ready(None);
5798                    }
5799                    std::task::Poll::Ready(Err(e)) => {
5800                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5801                            e.into(),
5802                        ))))
5803                    }
5804                }
5805
5806                // A message has been received from the channel
5807                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5808
5809                std::task::Poll::Ready(Some(match header.ordinal {
5810                    0x24618b709ca18f4d => {
5811                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5812                        let mut req = fidl::new_empty!(
5813                            fidl::encoding::EmptyPayload,
5814                            fidl::encoding::DefaultFuchsiaResourceDialect
5815                        );
5816                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5817                        let control_handle =
5818                            SessionObserverControlHandle { inner: this.inner.clone() };
5819                        Ok(SessionObserverRequest::WatchStatus {
5820                            responder: SessionObserverWatchStatusResponder {
5821                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5822                                tx_id: header.tx_id,
5823                            },
5824                        })
5825                    }
5826                    _ => Err(fidl::Error::UnknownOrdinal {
5827                        ordinal: header.ordinal,
5828                        protocol_name:
5829                            <SessionObserverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5830                    }),
5831                }))
5832            },
5833        )
5834    }
5835}
5836
5837/// Views a media session's status.
5838///
5839/// The channel will close if the media session is stopped.
5840#[derive(Debug)]
5841pub enum SessionObserverRequest {
5842    /// Watches the session status. Leave a request hanging to receive a reply when
5843    /// the session status changes. The first request will be answered immediately with
5844    /// the current state.
5845    WatchStatus { responder: SessionObserverWatchStatusResponder },
5846}
5847
5848impl SessionObserverRequest {
5849    #[allow(irrefutable_let_patterns)]
5850    pub fn into_watch_status(self) -> Option<(SessionObserverWatchStatusResponder)> {
5851        if let SessionObserverRequest::WatchStatus { responder } = self {
5852            Some((responder))
5853        } else {
5854            None
5855        }
5856    }
5857
5858    /// Name of the method defined in FIDL
5859    pub fn method_name(&self) -> &'static str {
5860        match *self {
5861            SessionObserverRequest::WatchStatus { .. } => "watch_status",
5862        }
5863    }
5864}
5865
5866#[derive(Debug, Clone)]
5867pub struct SessionObserverControlHandle {
5868    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5869}
5870
5871impl fidl::endpoints::ControlHandle for SessionObserverControlHandle {
5872    fn shutdown(&self) {
5873        self.inner.shutdown()
5874    }
5875    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5876        self.inner.shutdown_with_epitaph(status)
5877    }
5878
5879    fn is_closed(&self) -> bool {
5880        self.inner.channel().is_closed()
5881    }
5882    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5883        self.inner.channel().on_closed()
5884    }
5885
5886    #[cfg(target_os = "fuchsia")]
5887    fn signal_peer(
5888        &self,
5889        clear_mask: zx::Signals,
5890        set_mask: zx::Signals,
5891    ) -> Result<(), zx_status::Status> {
5892        use fidl::Peered;
5893        self.inner.channel().signal_peer(clear_mask, set_mask)
5894    }
5895}
5896
5897impl SessionObserverControlHandle {}
5898
5899#[must_use = "FIDL methods require a response to be sent"]
5900#[derive(Debug)]
5901pub struct SessionObserverWatchStatusResponder {
5902    control_handle: std::mem::ManuallyDrop<SessionObserverControlHandle>,
5903    tx_id: u32,
5904}
5905
5906/// Set the the channel to be shutdown (see [`SessionObserverControlHandle::shutdown`])
5907/// if the responder is dropped without sending a response, so that the client
5908/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5909impl std::ops::Drop for SessionObserverWatchStatusResponder {
5910    fn drop(&mut self) {
5911        self.control_handle.shutdown();
5912        // Safety: drops once, never accessed again
5913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5914    }
5915}
5916
5917impl fidl::endpoints::Responder for SessionObserverWatchStatusResponder {
5918    type ControlHandle = SessionObserverControlHandle;
5919
5920    fn control_handle(&self) -> &SessionObserverControlHandle {
5921        &self.control_handle
5922    }
5923
5924    fn drop_without_shutdown(mut self) {
5925        // Safety: drops once, never accessed again due to mem::forget
5926        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5927        // Prevent Drop from running (which would shut down the channel)
5928        std::mem::forget(self);
5929    }
5930}
5931
5932impl SessionObserverWatchStatusResponder {
5933    /// Sends a response to the FIDL transaction.
5934    ///
5935    /// Sets the channel to shutdown if an error occurs.
5936    pub fn send(self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5937        let _result = self.send_raw(session_info_delta);
5938        if _result.is_err() {
5939            self.control_handle.shutdown();
5940        }
5941        self.drop_without_shutdown();
5942        _result
5943    }
5944
5945    /// Similar to "send" but does not shutdown the channel if an error occurs.
5946    pub fn send_no_shutdown_on_err(
5947        self,
5948        mut session_info_delta: &SessionInfoDelta,
5949    ) -> Result<(), fidl::Error> {
5950        let _result = self.send_raw(session_info_delta);
5951        self.drop_without_shutdown();
5952        _result
5953    }
5954
5955    fn send_raw(&self, mut session_info_delta: &SessionInfoDelta) -> Result<(), fidl::Error> {
5956        self.control_handle.inner.send::<SessionObserverWatchStatusResponse>(
5957            (session_info_delta,),
5958            self.tx_id,
5959            0x24618b709ca18f4d,
5960            fidl::encoding::DynamicFlags::empty(),
5961        )
5962    }
5963}
5964
5965#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5966pub struct SessionsWatcherMarker;
5967
5968impl fidl::endpoints::ProtocolMarker for SessionsWatcherMarker {
5969    type Proxy = SessionsWatcherProxy;
5970    type RequestStream = SessionsWatcherRequestStream;
5971    #[cfg(target_os = "fuchsia")]
5972    type SynchronousProxy = SessionsWatcherSynchronousProxy;
5973
5974    const DEBUG_NAME: &'static str = "(anonymous) SessionsWatcher";
5975}
5976
5977pub trait SessionsWatcherProxyInterface: Send + Sync {
5978    type SessionUpdatedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5979    fn r#session_updated(
5980        &self,
5981        session_id: u64,
5982        session_info_delta: &SessionInfoDelta,
5983    ) -> Self::SessionUpdatedResponseFut;
5984    type SessionRemovedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5985    fn r#session_removed(&self, session_id: u64) -> Self::SessionRemovedResponseFut;
5986}
5987#[derive(Debug)]
5988#[cfg(target_os = "fuchsia")]
5989pub struct SessionsWatcherSynchronousProxy {
5990    client: fidl::client::sync::Client,
5991}
5992
5993#[cfg(target_os = "fuchsia")]
5994impl fidl::endpoints::SynchronousProxy for SessionsWatcherSynchronousProxy {
5995    type Proxy = SessionsWatcherProxy;
5996    type Protocol = SessionsWatcherMarker;
5997
5998    fn from_channel(inner: fidl::Channel) -> Self {
5999        Self::new(inner)
6000    }
6001
6002    fn into_channel(self) -> fidl::Channel {
6003        self.client.into_channel()
6004    }
6005
6006    fn as_channel(&self) -> &fidl::Channel {
6007        self.client.as_channel()
6008    }
6009}
6010
6011#[cfg(target_os = "fuchsia")]
6012impl SessionsWatcherSynchronousProxy {
6013    pub fn new(channel: fidl::Channel) -> Self {
6014        let protocol_name = <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6015        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6016    }
6017
6018    pub fn into_channel(self) -> fidl::Channel {
6019        self.client.into_channel()
6020    }
6021
6022    /// Waits until an event arrives and returns it. It is safe for other
6023    /// threads to make concurrent requests while waiting for an event.
6024    pub fn wait_for_event(
6025        &self,
6026        deadline: zx::MonotonicInstant,
6027    ) -> Result<SessionsWatcherEvent, fidl::Error> {
6028        SessionsWatcherEvent::decode(self.client.wait_for_event(deadline)?)
6029    }
6030
6031    /// Called by the registry service when a session is updated. On first connection,
6032    /// this will be called as many times as needed to communicate the state of the
6033    /// world.
6034    ///
6035    /// `SessionsWatcher` must reply to acknowledge receipt of the session info delta.
6036    /// Delinquent watchers who do not reply will eventually be disconnected.
6037    pub fn r#session_updated(
6038        &self,
6039        mut session_id: u64,
6040        mut session_info_delta: &SessionInfoDelta,
6041        ___deadline: zx::MonotonicInstant,
6042    ) -> Result<(), fidl::Error> {
6043        let _response = self
6044            .client
6045            .send_query::<SessionsWatcherSessionUpdatedRequest, fidl::encoding::EmptyPayload>(
6046                (session_id, session_info_delta),
6047                0x47d25ef93c58c2d9,
6048                fidl::encoding::DynamicFlags::empty(),
6049                ___deadline,
6050            )?;
6051        Ok(_response)
6052    }
6053
6054    /// Called by the registry service when a session is removed from the registered
6055    /// collection.
6056    ///
6057    /// `SessionsWatcher` must reply to acknlowledge receipt of the session removal.
6058    /// Delinquent watchers who do not reply will eventually be disconnected.
6059    pub fn r#session_removed(
6060        &self,
6061        mut session_id: u64,
6062        ___deadline: zx::MonotonicInstant,
6063    ) -> Result<(), fidl::Error> {
6064        let _response = self
6065            .client
6066            .send_query::<SessionsWatcherSessionRemovedRequest, fidl::encoding::EmptyPayload>(
6067                (session_id,),
6068                0x407556ecd5a2400e,
6069                fidl::encoding::DynamicFlags::empty(),
6070                ___deadline,
6071            )?;
6072        Ok(_response)
6073    }
6074}
6075
6076#[derive(Debug, Clone)]
6077pub struct SessionsWatcherProxy {
6078    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6079}
6080
6081impl fidl::endpoints::Proxy for SessionsWatcherProxy {
6082    type Protocol = SessionsWatcherMarker;
6083
6084    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6085        Self::new(inner)
6086    }
6087
6088    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6089        self.client.into_channel().map_err(|client| Self { client })
6090    }
6091
6092    fn as_channel(&self) -> &::fidl::AsyncChannel {
6093        self.client.as_channel()
6094    }
6095}
6096
6097impl SessionsWatcherProxy {
6098    /// Create a new Proxy for fuchsia.media.sessions2/SessionsWatcher.
6099    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6100        let protocol_name = <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6101        Self { client: fidl::client::Client::new(channel, protocol_name) }
6102    }
6103
6104    /// Get a Stream of events from the remote end of the protocol.
6105    ///
6106    /// # Panics
6107    ///
6108    /// Panics if the event stream was already taken.
6109    pub fn take_event_stream(&self) -> SessionsWatcherEventStream {
6110        SessionsWatcherEventStream { event_receiver: self.client.take_event_receiver() }
6111    }
6112
6113    /// Called by the registry service when a session is updated. On first connection,
6114    /// this will be called as many times as needed to communicate the state of the
6115    /// world.
6116    ///
6117    /// `SessionsWatcher` must reply to acknowledge receipt of the session info delta.
6118    /// Delinquent watchers who do not reply will eventually be disconnected.
6119    pub fn r#session_updated(
6120        &self,
6121        mut session_id: u64,
6122        mut session_info_delta: &SessionInfoDelta,
6123    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6124        SessionsWatcherProxyInterface::r#session_updated(self, session_id, session_info_delta)
6125    }
6126
6127    /// Called by the registry service when a session is removed from the registered
6128    /// collection.
6129    ///
6130    /// `SessionsWatcher` must reply to acknlowledge receipt of the session removal.
6131    /// Delinquent watchers who do not reply will eventually be disconnected.
6132    pub fn r#session_removed(
6133        &self,
6134        mut session_id: u64,
6135    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6136        SessionsWatcherProxyInterface::r#session_removed(self, session_id)
6137    }
6138}
6139
6140impl SessionsWatcherProxyInterface for SessionsWatcherProxy {
6141    type SessionUpdatedResponseFut =
6142        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6143    fn r#session_updated(
6144        &self,
6145        mut session_id: u64,
6146        mut session_info_delta: &SessionInfoDelta,
6147    ) -> Self::SessionUpdatedResponseFut {
6148        fn _decode(
6149            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6150        ) -> Result<(), fidl::Error> {
6151            let _response = fidl::client::decode_transaction_body::<
6152                fidl::encoding::EmptyPayload,
6153                fidl::encoding::DefaultFuchsiaResourceDialect,
6154                0x47d25ef93c58c2d9,
6155            >(_buf?)?;
6156            Ok(_response)
6157        }
6158        self.client.send_query_and_decode::<SessionsWatcherSessionUpdatedRequest, ()>(
6159            (session_id, session_info_delta),
6160            0x47d25ef93c58c2d9,
6161            fidl::encoding::DynamicFlags::empty(),
6162            _decode,
6163        )
6164    }
6165
6166    type SessionRemovedResponseFut =
6167        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6168    fn r#session_removed(&self, mut session_id: u64) -> Self::SessionRemovedResponseFut {
6169        fn _decode(
6170            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6171        ) -> Result<(), fidl::Error> {
6172            let _response = fidl::client::decode_transaction_body::<
6173                fidl::encoding::EmptyPayload,
6174                fidl::encoding::DefaultFuchsiaResourceDialect,
6175                0x407556ecd5a2400e,
6176            >(_buf?)?;
6177            Ok(_response)
6178        }
6179        self.client.send_query_and_decode::<SessionsWatcherSessionRemovedRequest, ()>(
6180            (session_id,),
6181            0x407556ecd5a2400e,
6182            fidl::encoding::DynamicFlags::empty(),
6183            _decode,
6184        )
6185    }
6186}
6187
6188pub struct SessionsWatcherEventStream {
6189    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6190}
6191
6192impl std::marker::Unpin for SessionsWatcherEventStream {}
6193
6194impl futures::stream::FusedStream for SessionsWatcherEventStream {
6195    fn is_terminated(&self) -> bool {
6196        self.event_receiver.is_terminated()
6197    }
6198}
6199
6200impl futures::Stream for SessionsWatcherEventStream {
6201    type Item = Result<SessionsWatcherEvent, fidl::Error>;
6202
6203    fn poll_next(
6204        mut self: std::pin::Pin<&mut Self>,
6205        cx: &mut std::task::Context<'_>,
6206    ) -> std::task::Poll<Option<Self::Item>> {
6207        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6208            &mut self.event_receiver,
6209            cx
6210        )?) {
6211            Some(buf) => std::task::Poll::Ready(Some(SessionsWatcherEvent::decode(buf))),
6212            None => std::task::Poll::Ready(None),
6213        }
6214    }
6215}
6216
6217#[derive(Debug)]
6218pub enum SessionsWatcherEvent {}
6219
6220impl SessionsWatcherEvent {
6221    /// Decodes a message buffer as a [`SessionsWatcherEvent`].
6222    fn decode(
6223        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6224    ) -> Result<SessionsWatcherEvent, fidl::Error> {
6225        let (bytes, _handles) = buf.split_mut();
6226        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6227        debug_assert_eq!(tx_header.tx_id, 0);
6228        match tx_header.ordinal {
6229            _ => Err(fidl::Error::UnknownOrdinal {
6230                ordinal: tx_header.ordinal,
6231                protocol_name:
6232                    <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6233            }),
6234        }
6235    }
6236}
6237
6238/// A Stream of incoming requests for fuchsia.media.sessions2/SessionsWatcher.
6239pub struct SessionsWatcherRequestStream {
6240    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6241    is_terminated: bool,
6242}
6243
6244impl std::marker::Unpin for SessionsWatcherRequestStream {}
6245
6246impl futures::stream::FusedStream for SessionsWatcherRequestStream {
6247    fn is_terminated(&self) -> bool {
6248        self.is_terminated
6249    }
6250}
6251
6252impl fidl::endpoints::RequestStream for SessionsWatcherRequestStream {
6253    type Protocol = SessionsWatcherMarker;
6254    type ControlHandle = SessionsWatcherControlHandle;
6255
6256    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6257        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6258    }
6259
6260    fn control_handle(&self) -> Self::ControlHandle {
6261        SessionsWatcherControlHandle { inner: self.inner.clone() }
6262    }
6263
6264    fn into_inner(
6265        self,
6266    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6267    {
6268        (self.inner, self.is_terminated)
6269    }
6270
6271    fn from_inner(
6272        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6273        is_terminated: bool,
6274    ) -> Self {
6275        Self { inner, is_terminated }
6276    }
6277}
6278
6279impl futures::Stream for SessionsWatcherRequestStream {
6280    type Item = Result<SessionsWatcherRequest, fidl::Error>;
6281
6282    fn poll_next(
6283        mut self: std::pin::Pin<&mut Self>,
6284        cx: &mut std::task::Context<'_>,
6285    ) -> std::task::Poll<Option<Self::Item>> {
6286        let this = &mut *self;
6287        if this.inner.check_shutdown(cx) {
6288            this.is_terminated = true;
6289            return std::task::Poll::Ready(None);
6290        }
6291        if this.is_terminated {
6292            panic!("polled SessionsWatcherRequestStream after completion");
6293        }
6294        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6295            |bytes, handles| {
6296                match this.inner.channel().read_etc(cx, bytes, handles) {
6297                    std::task::Poll::Ready(Ok(())) => {}
6298                    std::task::Poll::Pending => return std::task::Poll::Pending,
6299                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6300                        this.is_terminated = true;
6301                        return std::task::Poll::Ready(None);
6302                    }
6303                    std::task::Poll::Ready(Err(e)) => {
6304                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6305                            e.into(),
6306                        ))))
6307                    }
6308                }
6309
6310                // A message has been received from the channel
6311                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6312
6313                std::task::Poll::Ready(Some(match header.ordinal {
6314                    0x47d25ef93c58c2d9 => {
6315                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6316                        let mut req = fidl::new_empty!(
6317                            SessionsWatcherSessionUpdatedRequest,
6318                            fidl::encoding::DefaultFuchsiaResourceDialect
6319                        );
6320                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionsWatcherSessionUpdatedRequest>(&header, _body_bytes, handles, &mut req)?;
6321                        let control_handle =
6322                            SessionsWatcherControlHandle { inner: this.inner.clone() };
6323                        Ok(SessionsWatcherRequest::SessionUpdated {
6324                            session_id: req.session_id,
6325                            session_info_delta: req.session_info_delta,
6326
6327                            responder: SessionsWatcherSessionUpdatedResponder {
6328                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6329                                tx_id: header.tx_id,
6330                            },
6331                        })
6332                    }
6333                    0x407556ecd5a2400e => {
6334                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6335                        let mut req = fidl::new_empty!(
6336                            SessionsWatcherSessionRemovedRequest,
6337                            fidl::encoding::DefaultFuchsiaResourceDialect
6338                        );
6339                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SessionsWatcherSessionRemovedRequest>(&header, _body_bytes, handles, &mut req)?;
6340                        let control_handle =
6341                            SessionsWatcherControlHandle { inner: this.inner.clone() };
6342                        Ok(SessionsWatcherRequest::SessionRemoved {
6343                            session_id: req.session_id,
6344
6345                            responder: SessionsWatcherSessionRemovedResponder {
6346                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6347                                tx_id: header.tx_id,
6348                            },
6349                        })
6350                    }
6351                    _ => Err(fidl::Error::UnknownOrdinal {
6352                        ordinal: header.ordinal,
6353                        protocol_name:
6354                            <SessionsWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6355                    }),
6356                }))
6357            },
6358        )
6359    }
6360}
6361
6362/// `SessionsWatcher` watches the collection of published sessions.
6363#[derive(Debug)]
6364pub enum SessionsWatcherRequest {
6365    /// Called by the registry service when a session is updated. On first connection,
6366    /// this will be called as many times as needed to communicate the state of the
6367    /// world.
6368    ///
6369    /// `SessionsWatcher` must reply to acknowledge receipt of the session info delta.
6370    /// Delinquent watchers who do not reply will eventually be disconnected.
6371    SessionUpdated {
6372        session_id: u64,
6373        session_info_delta: SessionInfoDelta,
6374        responder: SessionsWatcherSessionUpdatedResponder,
6375    },
6376    /// Called by the registry service when a session is removed from the registered
6377    /// collection.
6378    ///
6379    /// `SessionsWatcher` must reply to acknlowledge receipt of the session removal.
6380    /// Delinquent watchers who do not reply will eventually be disconnected.
6381    SessionRemoved { session_id: u64, responder: SessionsWatcherSessionRemovedResponder },
6382}
6383
6384impl SessionsWatcherRequest {
6385    #[allow(irrefutable_let_patterns)]
6386    pub fn into_session_updated(
6387        self,
6388    ) -> Option<(u64, SessionInfoDelta, SessionsWatcherSessionUpdatedResponder)> {
6389        if let SessionsWatcherRequest::SessionUpdated {
6390            session_id,
6391            session_info_delta,
6392            responder,
6393        } = self
6394        {
6395            Some((session_id, session_info_delta, responder))
6396        } else {
6397            None
6398        }
6399    }
6400
6401    #[allow(irrefutable_let_patterns)]
6402    pub fn into_session_removed(self) -> Option<(u64, SessionsWatcherSessionRemovedResponder)> {
6403        if let SessionsWatcherRequest::SessionRemoved { session_id, responder } = self {
6404            Some((session_id, responder))
6405        } else {
6406            None
6407        }
6408    }
6409
6410    /// Name of the method defined in FIDL
6411    pub fn method_name(&self) -> &'static str {
6412        match *self {
6413            SessionsWatcherRequest::SessionUpdated { .. } => "session_updated",
6414            SessionsWatcherRequest::SessionRemoved { .. } => "session_removed",
6415        }
6416    }
6417}
6418
6419#[derive(Debug, Clone)]
6420pub struct SessionsWatcherControlHandle {
6421    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6422}
6423
6424impl fidl::endpoints::ControlHandle for SessionsWatcherControlHandle {
6425    fn shutdown(&self) {
6426        self.inner.shutdown()
6427    }
6428    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6429        self.inner.shutdown_with_epitaph(status)
6430    }
6431
6432    fn is_closed(&self) -> bool {
6433        self.inner.channel().is_closed()
6434    }
6435    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6436        self.inner.channel().on_closed()
6437    }
6438
6439    #[cfg(target_os = "fuchsia")]
6440    fn signal_peer(
6441        &self,
6442        clear_mask: zx::Signals,
6443        set_mask: zx::Signals,
6444    ) -> Result<(), zx_status::Status> {
6445        use fidl::Peered;
6446        self.inner.channel().signal_peer(clear_mask, set_mask)
6447    }
6448}
6449
6450impl SessionsWatcherControlHandle {}
6451
6452#[must_use = "FIDL methods require a response to be sent"]
6453#[derive(Debug)]
6454pub struct SessionsWatcherSessionUpdatedResponder {
6455    control_handle: std::mem::ManuallyDrop<SessionsWatcherControlHandle>,
6456    tx_id: u32,
6457}
6458
6459/// Set the the channel to be shutdown (see [`SessionsWatcherControlHandle::shutdown`])
6460/// if the responder is dropped without sending a response, so that the client
6461/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6462impl std::ops::Drop for SessionsWatcherSessionUpdatedResponder {
6463    fn drop(&mut self) {
6464        self.control_handle.shutdown();
6465        // Safety: drops once, never accessed again
6466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6467    }
6468}
6469
6470impl fidl::endpoints::Responder for SessionsWatcherSessionUpdatedResponder {
6471    type ControlHandle = SessionsWatcherControlHandle;
6472
6473    fn control_handle(&self) -> &SessionsWatcherControlHandle {
6474        &self.control_handle
6475    }
6476
6477    fn drop_without_shutdown(mut self) {
6478        // Safety: drops once, never accessed again due to mem::forget
6479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6480        // Prevent Drop from running (which would shut down the channel)
6481        std::mem::forget(self);
6482    }
6483}
6484
6485impl SessionsWatcherSessionUpdatedResponder {
6486    /// Sends a response to the FIDL transaction.
6487    ///
6488    /// Sets the channel to shutdown if an error occurs.
6489    pub fn send(self) -> Result<(), fidl::Error> {
6490        let _result = self.send_raw();
6491        if _result.is_err() {
6492            self.control_handle.shutdown();
6493        }
6494        self.drop_without_shutdown();
6495        _result
6496    }
6497
6498    /// Similar to "send" but does not shutdown the channel if an error occurs.
6499    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6500        let _result = self.send_raw();
6501        self.drop_without_shutdown();
6502        _result
6503    }
6504
6505    fn send_raw(&self) -> Result<(), fidl::Error> {
6506        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6507            (),
6508            self.tx_id,
6509            0x47d25ef93c58c2d9,
6510            fidl::encoding::DynamicFlags::empty(),
6511        )
6512    }
6513}
6514
6515#[must_use = "FIDL methods require a response to be sent"]
6516#[derive(Debug)]
6517pub struct SessionsWatcherSessionRemovedResponder {
6518    control_handle: std::mem::ManuallyDrop<SessionsWatcherControlHandle>,
6519    tx_id: u32,
6520}
6521
6522/// Set the the channel to be shutdown (see [`SessionsWatcherControlHandle::shutdown`])
6523/// if the responder is dropped without sending a response, so that the client
6524/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6525impl std::ops::Drop for SessionsWatcherSessionRemovedResponder {
6526    fn drop(&mut self) {
6527        self.control_handle.shutdown();
6528        // Safety: drops once, never accessed again
6529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6530    }
6531}
6532
6533impl fidl::endpoints::Responder for SessionsWatcherSessionRemovedResponder {
6534    type ControlHandle = SessionsWatcherControlHandle;
6535
6536    fn control_handle(&self) -> &SessionsWatcherControlHandle {
6537        &self.control_handle
6538    }
6539
6540    fn drop_without_shutdown(mut self) {
6541        // Safety: drops once, never accessed again due to mem::forget
6542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6543        // Prevent Drop from running (which would shut down the channel)
6544        std::mem::forget(self);
6545    }
6546}
6547
6548impl SessionsWatcherSessionRemovedResponder {
6549    /// Sends a response to the FIDL transaction.
6550    ///
6551    /// Sets the channel to shutdown if an error occurs.
6552    pub fn send(self) -> Result<(), fidl::Error> {
6553        let _result = self.send_raw();
6554        if _result.is_err() {
6555            self.control_handle.shutdown();
6556        }
6557        self.drop_without_shutdown();
6558        _result
6559    }
6560
6561    /// Similar to "send" but does not shutdown the channel if an error occurs.
6562    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6563        let _result = self.send_raw();
6564        self.drop_without_shutdown();
6565        _result
6566    }
6567
6568    fn send_raw(&self) -> Result<(), fidl::Error> {
6569        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6570            (),
6571            self.tx_id,
6572            0x407556ecd5a2400e,
6573            fidl::encoding::DynamicFlags::empty(),
6574        )
6575    }
6576}
6577
6578mod internal {
6579    use super::*;
6580    unsafe impl fidl::encoding::TypeMarker for PlayerCapabilityFlags {
6581        type Owned = Self;
6582
6583        #[inline(always)]
6584        fn inline_align(_context: fidl::encoding::Context) -> usize {
6585            4
6586        }
6587
6588        #[inline(always)]
6589        fn inline_size(_context: fidl::encoding::Context) -> usize {
6590            4
6591        }
6592    }
6593
6594    impl fidl::encoding::ValueTypeMarker for PlayerCapabilityFlags {
6595        type Borrowed<'a> = Self;
6596        #[inline(always)]
6597        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6598            *value
6599        }
6600    }
6601
6602    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
6603        for PlayerCapabilityFlags
6604    {
6605        #[inline]
6606        unsafe fn encode(
6607            self,
6608            encoder: &mut fidl::encoding::Encoder<'_, D>,
6609            offset: usize,
6610            _depth: fidl::encoding::Depth,
6611        ) -> fidl::Result<()> {
6612            encoder.debug_check_bounds::<Self>(offset);
6613            if self.bits() & Self::all().bits() != self.bits() {
6614                return Err(fidl::Error::InvalidBitsValue);
6615            }
6616            encoder.write_num(self.bits(), offset);
6617            Ok(())
6618        }
6619    }
6620
6621    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilityFlags {
6622        #[inline(always)]
6623        fn new_empty() -> Self {
6624            Self::empty()
6625        }
6626
6627        #[inline]
6628        unsafe fn decode(
6629            &mut self,
6630            decoder: &mut fidl::encoding::Decoder<'_, D>,
6631            offset: usize,
6632            _depth: fidl::encoding::Depth,
6633        ) -> fidl::Result<()> {
6634            decoder.debug_check_bounds::<Self>(offset);
6635            let prim = decoder.read_num::<u32>(offset);
6636            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
6637            Ok(())
6638        }
6639    }
6640    unsafe impl fidl::encoding::TypeMarker for ContentType {
6641        type Owned = Self;
6642
6643        #[inline(always)]
6644        fn inline_align(_context: fidl::encoding::Context) -> usize {
6645            std::mem::align_of::<u32>()
6646        }
6647
6648        #[inline(always)]
6649        fn inline_size(_context: fidl::encoding::Context) -> usize {
6650            std::mem::size_of::<u32>()
6651        }
6652
6653        #[inline(always)]
6654        fn encode_is_copy() -> bool {
6655            true
6656        }
6657
6658        #[inline(always)]
6659        fn decode_is_copy() -> bool {
6660            false
6661        }
6662    }
6663
6664    impl fidl::encoding::ValueTypeMarker for ContentType {
6665        type Borrowed<'a> = Self;
6666        #[inline(always)]
6667        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6668            *value
6669        }
6670    }
6671
6672    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ContentType {
6673        #[inline]
6674        unsafe fn encode(
6675            self,
6676            encoder: &mut fidl::encoding::Encoder<'_, D>,
6677            offset: usize,
6678            _depth: fidl::encoding::Depth,
6679        ) -> fidl::Result<()> {
6680            encoder.debug_check_bounds::<Self>(offset);
6681            encoder.write_num(self.into_primitive(), offset);
6682            Ok(())
6683        }
6684    }
6685
6686    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContentType {
6687        #[inline(always)]
6688        fn new_empty() -> Self {
6689            Self::Other
6690        }
6691
6692        #[inline]
6693        unsafe fn decode(
6694            &mut self,
6695            decoder: &mut fidl::encoding::Decoder<'_, D>,
6696            offset: usize,
6697            _depth: fidl::encoding::Depth,
6698        ) -> fidl::Result<()> {
6699            decoder.debug_check_bounds::<Self>(offset);
6700            let prim = decoder.read_num::<u32>(offset);
6701
6702            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
6703            Ok(())
6704        }
6705    }
6706    unsafe impl fidl::encoding::TypeMarker for Error {
6707        type Owned = Self;
6708
6709        #[inline(always)]
6710        fn inline_align(_context: fidl::encoding::Context) -> usize {
6711            std::mem::align_of::<u32>()
6712        }
6713
6714        #[inline(always)]
6715        fn inline_size(_context: fidl::encoding::Context) -> usize {
6716            std::mem::size_of::<u32>()
6717        }
6718
6719        #[inline(always)]
6720        fn encode_is_copy() -> bool {
6721            true
6722        }
6723
6724        #[inline(always)]
6725        fn decode_is_copy() -> bool {
6726            false
6727        }
6728    }
6729
6730    impl fidl::encoding::ValueTypeMarker for Error {
6731        type Borrowed<'a> = Self;
6732        #[inline(always)]
6733        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6734            *value
6735        }
6736    }
6737
6738    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
6739        #[inline]
6740        unsafe fn encode(
6741            self,
6742            encoder: &mut fidl::encoding::Encoder<'_, D>,
6743            offset: usize,
6744            _depth: fidl::encoding::Depth,
6745        ) -> fidl::Result<()> {
6746            encoder.debug_check_bounds::<Self>(offset);
6747            encoder.write_num(self.into_primitive(), offset);
6748            Ok(())
6749        }
6750    }
6751
6752    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
6753        #[inline(always)]
6754        fn new_empty() -> Self {
6755            Self::Other
6756        }
6757
6758        #[inline]
6759        unsafe fn decode(
6760            &mut self,
6761            decoder: &mut fidl::encoding::Decoder<'_, D>,
6762            offset: usize,
6763            _depth: fidl::encoding::Depth,
6764        ) -> fidl::Result<()> {
6765            decoder.debug_check_bounds::<Self>(offset);
6766            let prim = decoder.read_num::<u32>(offset);
6767
6768            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
6769            Ok(())
6770        }
6771    }
6772    unsafe impl fidl::encoding::TypeMarker for InterruptionBehavior {
6773        type Owned = Self;
6774
6775        #[inline(always)]
6776        fn inline_align(_context: fidl::encoding::Context) -> usize {
6777            std::mem::align_of::<u32>()
6778        }
6779
6780        #[inline(always)]
6781        fn inline_size(_context: fidl::encoding::Context) -> usize {
6782            std::mem::size_of::<u32>()
6783        }
6784
6785        #[inline(always)]
6786        fn encode_is_copy() -> bool {
6787            true
6788        }
6789
6790        #[inline(always)]
6791        fn decode_is_copy() -> bool {
6792            false
6793        }
6794    }
6795
6796    impl fidl::encoding::ValueTypeMarker for InterruptionBehavior {
6797        type Borrowed<'a> = Self;
6798        #[inline(always)]
6799        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6800            *value
6801        }
6802    }
6803
6804    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
6805        for InterruptionBehavior
6806    {
6807        #[inline]
6808        unsafe fn encode(
6809            self,
6810            encoder: &mut fidl::encoding::Encoder<'_, D>,
6811            offset: usize,
6812            _depth: fidl::encoding::Depth,
6813        ) -> fidl::Result<()> {
6814            encoder.debug_check_bounds::<Self>(offset);
6815            encoder.write_num(self.into_primitive(), offset);
6816            Ok(())
6817        }
6818    }
6819
6820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptionBehavior {
6821        #[inline(always)]
6822        fn new_empty() -> Self {
6823            Self::None
6824        }
6825
6826        #[inline]
6827        unsafe fn decode(
6828            &mut self,
6829            decoder: &mut fidl::encoding::Decoder<'_, D>,
6830            offset: usize,
6831            _depth: fidl::encoding::Depth,
6832        ) -> fidl::Result<()> {
6833            decoder.debug_check_bounds::<Self>(offset);
6834            let prim = decoder.read_num::<u32>(offset);
6835
6836            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
6837            Ok(())
6838        }
6839    }
6840    unsafe impl fidl::encoding::TypeMarker for MediaImageType {
6841        type Owned = Self;
6842
6843        #[inline(always)]
6844        fn inline_align(_context: fidl::encoding::Context) -> usize {
6845            std::mem::align_of::<u32>()
6846        }
6847
6848        #[inline(always)]
6849        fn inline_size(_context: fidl::encoding::Context) -> usize {
6850            std::mem::size_of::<u32>()
6851        }
6852
6853        #[inline(always)]
6854        fn encode_is_copy() -> bool {
6855            true
6856        }
6857
6858        #[inline(always)]
6859        fn decode_is_copy() -> bool {
6860            false
6861        }
6862    }
6863
6864    impl fidl::encoding::ValueTypeMarker for MediaImageType {
6865        type Borrowed<'a> = Self;
6866        #[inline(always)]
6867        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6868            *value
6869        }
6870    }
6871
6872    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MediaImageType {
6873        #[inline]
6874        unsafe fn encode(
6875            self,
6876            encoder: &mut fidl::encoding::Encoder<'_, D>,
6877            offset: usize,
6878            _depth: fidl::encoding::Depth,
6879        ) -> fidl::Result<()> {
6880            encoder.debug_check_bounds::<Self>(offset);
6881            encoder.write_num(self.into_primitive(), offset);
6882            Ok(())
6883        }
6884    }
6885
6886    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImageType {
6887        #[inline(always)]
6888        fn new_empty() -> Self {
6889            Self::Artwork
6890        }
6891
6892        #[inline]
6893        unsafe fn decode(
6894            &mut self,
6895            decoder: &mut fidl::encoding::Decoder<'_, D>,
6896            offset: usize,
6897            _depth: fidl::encoding::Depth,
6898        ) -> fidl::Result<()> {
6899            decoder.debug_check_bounds::<Self>(offset);
6900            let prim = decoder.read_num::<u32>(offset);
6901
6902            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
6903            Ok(())
6904        }
6905    }
6906    unsafe impl fidl::encoding::TypeMarker for PlayerState {
6907        type Owned = Self;
6908
6909        #[inline(always)]
6910        fn inline_align(_context: fidl::encoding::Context) -> usize {
6911            std::mem::align_of::<u32>()
6912        }
6913
6914        #[inline(always)]
6915        fn inline_size(_context: fidl::encoding::Context) -> usize {
6916            std::mem::size_of::<u32>()
6917        }
6918
6919        #[inline(always)]
6920        fn encode_is_copy() -> bool {
6921            true
6922        }
6923
6924        #[inline(always)]
6925        fn decode_is_copy() -> bool {
6926            false
6927        }
6928    }
6929
6930    impl fidl::encoding::ValueTypeMarker for PlayerState {
6931        type Borrowed<'a> = Self;
6932        #[inline(always)]
6933        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6934            *value
6935        }
6936    }
6937
6938    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PlayerState {
6939        #[inline]
6940        unsafe fn encode(
6941            self,
6942            encoder: &mut fidl::encoding::Encoder<'_, D>,
6943            offset: usize,
6944            _depth: fidl::encoding::Depth,
6945        ) -> fidl::Result<()> {
6946            encoder.debug_check_bounds::<Self>(offset);
6947            encoder.write_num(self.into_primitive(), offset);
6948            Ok(())
6949        }
6950    }
6951
6952    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerState {
6953        #[inline(always)]
6954        fn new_empty() -> Self {
6955            Self::Idle
6956        }
6957
6958        #[inline]
6959        unsafe fn decode(
6960            &mut self,
6961            decoder: &mut fidl::encoding::Decoder<'_, D>,
6962            offset: usize,
6963            _depth: fidl::encoding::Depth,
6964        ) -> fidl::Result<()> {
6965            decoder.debug_check_bounds::<Self>(offset);
6966            let prim = decoder.read_num::<u32>(offset);
6967
6968            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
6969            Ok(())
6970        }
6971    }
6972    unsafe impl fidl::encoding::TypeMarker for RepeatMode {
6973        type Owned = Self;
6974
6975        #[inline(always)]
6976        fn inline_align(_context: fidl::encoding::Context) -> usize {
6977            std::mem::align_of::<u32>()
6978        }
6979
6980        #[inline(always)]
6981        fn inline_size(_context: fidl::encoding::Context) -> usize {
6982            std::mem::size_of::<u32>()
6983        }
6984
6985        #[inline(always)]
6986        fn encode_is_copy() -> bool {
6987            true
6988        }
6989
6990        #[inline(always)]
6991        fn decode_is_copy() -> bool {
6992            false
6993        }
6994    }
6995
6996    impl fidl::encoding::ValueTypeMarker for RepeatMode {
6997        type Borrowed<'a> = Self;
6998        #[inline(always)]
6999        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7000            *value
7001        }
7002    }
7003
7004    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RepeatMode {
7005        #[inline]
7006        unsafe fn encode(
7007            self,
7008            encoder: &mut fidl::encoding::Encoder<'_, D>,
7009            offset: usize,
7010            _depth: fidl::encoding::Depth,
7011        ) -> fidl::Result<()> {
7012            encoder.debug_check_bounds::<Self>(offset);
7013            encoder.write_num(self.into_primitive(), offset);
7014            Ok(())
7015        }
7016    }
7017
7018    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepeatMode {
7019        #[inline(always)]
7020        fn new_empty() -> Self {
7021            Self::Off
7022        }
7023
7024        #[inline]
7025        unsafe fn decode(
7026            &mut self,
7027            decoder: &mut fidl::encoding::Decoder<'_, D>,
7028            offset: usize,
7029            _depth: fidl::encoding::Depth,
7030        ) -> fidl::Result<()> {
7031            decoder.debug_check_bounds::<Self>(offset);
7032            let prim = decoder.read_num::<u32>(offset);
7033
7034            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
7035            Ok(())
7036        }
7037    }
7038
7039    impl fidl::encoding::ResourceTypeMarker for ActiveSessionWatchActiveSessionResponse {
7040        type Borrowed<'a> = &'a mut Self;
7041        fn take_or_borrow<'a>(
7042            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7043        ) -> Self::Borrowed<'a> {
7044            value
7045        }
7046    }
7047
7048    unsafe impl fidl::encoding::TypeMarker for ActiveSessionWatchActiveSessionResponse {
7049        type Owned = Self;
7050
7051        #[inline(always)]
7052        fn inline_align(_context: fidl::encoding::Context) -> usize {
7053            4
7054        }
7055
7056        #[inline(always)]
7057        fn inline_size(_context: fidl::encoding::Context) -> usize {
7058            4
7059        }
7060    }
7061
7062    unsafe impl
7063        fidl::encoding::Encode<
7064            ActiveSessionWatchActiveSessionResponse,
7065            fidl::encoding::DefaultFuchsiaResourceDialect,
7066        > for &mut ActiveSessionWatchActiveSessionResponse
7067    {
7068        #[inline]
7069        unsafe fn encode(
7070            self,
7071            encoder: &mut fidl::encoding::Encoder<
7072                '_,
7073                fidl::encoding::DefaultFuchsiaResourceDialect,
7074            >,
7075            offset: usize,
7076            _depth: fidl::encoding::Depth,
7077        ) -> fidl::Result<()> {
7078            encoder.debug_check_bounds::<ActiveSessionWatchActiveSessionResponse>(offset);
7079            // Delegate to tuple encoding.
7080            fidl::encoding::Encode::<
7081                ActiveSessionWatchActiveSessionResponse,
7082                fidl::encoding::DefaultFuchsiaResourceDialect,
7083            >::encode(
7084                (<fidl::encoding::Optional<
7085                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
7086                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7087                    &mut self.session
7088                ),),
7089                encoder,
7090                offset,
7091                _depth,
7092            )
7093        }
7094    }
7095    unsafe impl<
7096            T0: fidl::encoding::Encode<
7097                fidl::encoding::Optional<
7098                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
7099                >,
7100                fidl::encoding::DefaultFuchsiaResourceDialect,
7101            >,
7102        >
7103        fidl::encoding::Encode<
7104            ActiveSessionWatchActiveSessionResponse,
7105            fidl::encoding::DefaultFuchsiaResourceDialect,
7106        > for (T0,)
7107    {
7108        #[inline]
7109        unsafe fn encode(
7110            self,
7111            encoder: &mut fidl::encoding::Encoder<
7112                '_,
7113                fidl::encoding::DefaultFuchsiaResourceDialect,
7114            >,
7115            offset: usize,
7116            depth: fidl::encoding::Depth,
7117        ) -> fidl::Result<()> {
7118            encoder.debug_check_bounds::<ActiveSessionWatchActiveSessionResponse>(offset);
7119            // Zero out padding regions. There's no need to apply masks
7120            // because the unmasked parts will be overwritten by fields.
7121            // Write the fields.
7122            self.0.encode(encoder, offset + 0, depth)?;
7123            Ok(())
7124        }
7125    }
7126
7127    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7128        for ActiveSessionWatchActiveSessionResponse
7129    {
7130        #[inline(always)]
7131        fn new_empty() -> Self {
7132            Self {
7133                session: fidl::new_empty!(
7134                    fidl::encoding::Optional<
7135                        fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
7136                    >,
7137                    fidl::encoding::DefaultFuchsiaResourceDialect
7138                ),
7139            }
7140        }
7141
7142        #[inline]
7143        unsafe fn decode(
7144            &mut self,
7145            decoder: &mut fidl::encoding::Decoder<
7146                '_,
7147                fidl::encoding::DefaultFuchsiaResourceDialect,
7148            >,
7149            offset: usize,
7150            _depth: fidl::encoding::Depth,
7151        ) -> fidl::Result<()> {
7152            decoder.debug_check_bounds::<Self>(offset);
7153            // Verify that padding bytes are zero.
7154            fidl::decode!(
7155                fidl::encoding::Optional<
7156                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionControlMarker>>,
7157                >,
7158                fidl::encoding::DefaultFuchsiaResourceDialect,
7159                &mut self.session,
7160                decoder,
7161                offset + 0,
7162                _depth
7163            )?;
7164            Ok(())
7165        }
7166    }
7167
7168    impl fidl::encoding::ResourceTypeMarker for DiscoveryConnectToSessionRequest {
7169        type Borrowed<'a> = &'a mut Self;
7170        fn take_or_borrow<'a>(
7171            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7172        ) -> Self::Borrowed<'a> {
7173            value
7174        }
7175    }
7176
7177    unsafe impl fidl::encoding::TypeMarker for DiscoveryConnectToSessionRequest {
7178        type Owned = Self;
7179
7180        #[inline(always)]
7181        fn inline_align(_context: fidl::encoding::Context) -> usize {
7182            8
7183        }
7184
7185        #[inline(always)]
7186        fn inline_size(_context: fidl::encoding::Context) -> usize {
7187            16
7188        }
7189    }
7190
7191    unsafe impl
7192        fidl::encoding::Encode<
7193            DiscoveryConnectToSessionRequest,
7194            fidl::encoding::DefaultFuchsiaResourceDialect,
7195        > for &mut DiscoveryConnectToSessionRequest
7196    {
7197        #[inline]
7198        unsafe fn encode(
7199            self,
7200            encoder: &mut fidl::encoding::Encoder<
7201                '_,
7202                fidl::encoding::DefaultFuchsiaResourceDialect,
7203            >,
7204            offset: usize,
7205            _depth: fidl::encoding::Depth,
7206        ) -> fidl::Result<()> {
7207            encoder.debug_check_bounds::<DiscoveryConnectToSessionRequest>(offset);
7208            // Delegate to tuple encoding.
7209            fidl::encoding::Encode::<DiscoveryConnectToSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7210                (
7211                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
7212                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_control_request),
7213                ),
7214                encoder, offset, _depth
7215            )
7216        }
7217    }
7218    unsafe impl<
7219            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
7220            T1: fidl::encoding::Encode<
7221                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
7222                fidl::encoding::DefaultFuchsiaResourceDialect,
7223            >,
7224        >
7225        fidl::encoding::Encode<
7226            DiscoveryConnectToSessionRequest,
7227            fidl::encoding::DefaultFuchsiaResourceDialect,
7228        > for (T0, T1)
7229    {
7230        #[inline]
7231        unsafe fn encode(
7232            self,
7233            encoder: &mut fidl::encoding::Encoder<
7234                '_,
7235                fidl::encoding::DefaultFuchsiaResourceDialect,
7236            >,
7237            offset: usize,
7238            depth: fidl::encoding::Depth,
7239        ) -> fidl::Result<()> {
7240            encoder.debug_check_bounds::<DiscoveryConnectToSessionRequest>(offset);
7241            // Zero out padding regions. There's no need to apply masks
7242            // because the unmasked parts will be overwritten by fields.
7243            unsafe {
7244                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
7245                (ptr as *mut u64).write_unaligned(0);
7246            }
7247            // Write the fields.
7248            self.0.encode(encoder, offset + 0, depth)?;
7249            self.1.encode(encoder, offset + 8, depth)?;
7250            Ok(())
7251        }
7252    }
7253
7254    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7255        for DiscoveryConnectToSessionRequest
7256    {
7257        #[inline(always)]
7258        fn new_empty() -> Self {
7259            Self {
7260                session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
7261                session_control_request: fidl::new_empty!(
7262                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
7263                    fidl::encoding::DefaultFuchsiaResourceDialect
7264                ),
7265            }
7266        }
7267
7268        #[inline]
7269        unsafe fn decode(
7270            &mut self,
7271            decoder: &mut fidl::encoding::Decoder<
7272                '_,
7273                fidl::encoding::DefaultFuchsiaResourceDialect,
7274            >,
7275            offset: usize,
7276            _depth: fidl::encoding::Depth,
7277        ) -> fidl::Result<()> {
7278            decoder.debug_check_bounds::<Self>(offset);
7279            // Verify that padding bytes are zero.
7280            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
7281            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7282            let mask = 0xffffffff00000000u64;
7283            let maskedval = padval & mask;
7284            if maskedval != 0 {
7285                return Err(fidl::Error::NonZeroPadding {
7286                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
7287                });
7288            }
7289            fidl::decode!(
7290                u64,
7291                fidl::encoding::DefaultFuchsiaResourceDialect,
7292                &mut self.session_id,
7293                decoder,
7294                offset + 0,
7295                _depth
7296            )?;
7297            fidl::decode!(
7298                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionControlMarker>>,
7299                fidl::encoding::DefaultFuchsiaResourceDialect,
7300                &mut self.session_control_request,
7301                decoder,
7302                offset + 8,
7303                _depth
7304            )?;
7305            Ok(())
7306        }
7307    }
7308
7309    impl fidl::encoding::ResourceTypeMarker for DiscoveryWatchSessionsRequest {
7310        type Borrowed<'a> = &'a mut Self;
7311        fn take_or_borrow<'a>(
7312            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7313        ) -> Self::Borrowed<'a> {
7314            value
7315        }
7316    }
7317
7318    unsafe impl fidl::encoding::TypeMarker for DiscoveryWatchSessionsRequest {
7319        type Owned = Self;
7320
7321        #[inline(always)]
7322        fn inline_align(_context: fidl::encoding::Context) -> usize {
7323            8
7324        }
7325
7326        #[inline(always)]
7327        fn inline_size(_context: fidl::encoding::Context) -> usize {
7328            24
7329        }
7330    }
7331
7332    unsafe impl
7333        fidl::encoding::Encode<
7334            DiscoveryWatchSessionsRequest,
7335            fidl::encoding::DefaultFuchsiaResourceDialect,
7336        > for &mut DiscoveryWatchSessionsRequest
7337    {
7338        #[inline]
7339        unsafe fn encode(
7340            self,
7341            encoder: &mut fidl::encoding::Encoder<
7342                '_,
7343                fidl::encoding::DefaultFuchsiaResourceDialect,
7344            >,
7345            offset: usize,
7346            _depth: fidl::encoding::Depth,
7347        ) -> fidl::Result<()> {
7348            encoder.debug_check_bounds::<DiscoveryWatchSessionsRequest>(offset);
7349            // Delegate to tuple encoding.
7350            fidl::encoding::Encode::<DiscoveryWatchSessionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7351                (
7352                    <WatchOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.watch_options),
7353                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_watcher),
7354                ),
7355                encoder, offset, _depth
7356            )
7357        }
7358    }
7359    unsafe impl<
7360            T0: fidl::encoding::Encode<WatchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
7361            T1: fidl::encoding::Encode<
7362                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
7363                fidl::encoding::DefaultFuchsiaResourceDialect,
7364            >,
7365        >
7366        fidl::encoding::Encode<
7367            DiscoveryWatchSessionsRequest,
7368            fidl::encoding::DefaultFuchsiaResourceDialect,
7369        > for (T0, T1)
7370    {
7371        #[inline]
7372        unsafe fn encode(
7373            self,
7374            encoder: &mut fidl::encoding::Encoder<
7375                '_,
7376                fidl::encoding::DefaultFuchsiaResourceDialect,
7377            >,
7378            offset: usize,
7379            depth: fidl::encoding::Depth,
7380        ) -> fidl::Result<()> {
7381            encoder.debug_check_bounds::<DiscoveryWatchSessionsRequest>(offset);
7382            // Zero out padding regions. There's no need to apply masks
7383            // because the unmasked parts will be overwritten by fields.
7384            unsafe {
7385                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7386                (ptr as *mut u64).write_unaligned(0);
7387            }
7388            // Write the fields.
7389            self.0.encode(encoder, offset + 0, depth)?;
7390            self.1.encode(encoder, offset + 16, depth)?;
7391            Ok(())
7392        }
7393    }
7394
7395    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7396        for DiscoveryWatchSessionsRequest
7397    {
7398        #[inline(always)]
7399        fn new_empty() -> Self {
7400            Self {
7401                watch_options: fidl::new_empty!(
7402                    WatchOptions,
7403                    fidl::encoding::DefaultFuchsiaResourceDialect
7404                ),
7405                session_watcher: fidl::new_empty!(
7406                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
7407                    fidl::encoding::DefaultFuchsiaResourceDialect
7408                ),
7409            }
7410        }
7411
7412        #[inline]
7413        unsafe fn decode(
7414            &mut self,
7415            decoder: &mut fidl::encoding::Decoder<
7416                '_,
7417                fidl::encoding::DefaultFuchsiaResourceDialect,
7418            >,
7419            offset: usize,
7420            _depth: fidl::encoding::Depth,
7421        ) -> fidl::Result<()> {
7422            decoder.debug_check_bounds::<Self>(offset);
7423            // Verify that padding bytes are zero.
7424            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7425            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7426            let mask = 0xffffffff00000000u64;
7427            let maskedval = padval & mask;
7428            if maskedval != 0 {
7429                return Err(fidl::Error::NonZeroPadding {
7430                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7431                });
7432            }
7433            fidl::decode!(
7434                WatchOptions,
7435                fidl::encoding::DefaultFuchsiaResourceDialect,
7436                &mut self.watch_options,
7437                decoder,
7438                offset + 0,
7439                _depth
7440            )?;
7441            fidl::decode!(
7442                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
7443                fidl::encoding::DefaultFuchsiaResourceDialect,
7444                &mut self.session_watcher,
7445                decoder,
7446                offset + 16,
7447                _depth
7448            )?;
7449            Ok(())
7450        }
7451    }
7452
7453    impl fidl::encoding::ValueTypeMarker for ImageSizeVariant {
7454        type Borrowed<'a> = &'a Self;
7455        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7456            value
7457        }
7458    }
7459
7460    unsafe impl fidl::encoding::TypeMarker for ImageSizeVariant {
7461        type Owned = Self;
7462
7463        #[inline(always)]
7464        fn inline_align(_context: fidl::encoding::Context) -> usize {
7465            8
7466        }
7467
7468        #[inline(always)]
7469        fn inline_size(_context: fidl::encoding::Context) -> usize {
7470            24
7471        }
7472    }
7473
7474    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageSizeVariant, D>
7475        for &ImageSizeVariant
7476    {
7477        #[inline]
7478        unsafe fn encode(
7479            self,
7480            encoder: &mut fidl::encoding::Encoder<'_, D>,
7481            offset: usize,
7482            _depth: fidl::encoding::Depth,
7483        ) -> fidl::Result<()> {
7484            encoder.debug_check_bounds::<ImageSizeVariant>(offset);
7485            // Delegate to tuple encoding.
7486            fidl::encoding::Encode::<ImageSizeVariant, D>::encode(
7487                (
7488                    <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
7489                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
7490                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
7491                ),
7492                encoder, offset, _depth
7493            )
7494        }
7495    }
7496    unsafe impl<
7497            D: fidl::encoding::ResourceDialect,
7498            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
7499            T1: fidl::encoding::Encode<u32, D>,
7500            T2: fidl::encoding::Encode<u32, D>,
7501        > fidl::encoding::Encode<ImageSizeVariant, D> for (T0, T1, T2)
7502    {
7503        #[inline]
7504        unsafe fn encode(
7505            self,
7506            encoder: &mut fidl::encoding::Encoder<'_, D>,
7507            offset: usize,
7508            depth: fidl::encoding::Depth,
7509        ) -> fidl::Result<()> {
7510            encoder.debug_check_bounds::<ImageSizeVariant>(offset);
7511            // Zero out padding regions. There's no need to apply masks
7512            // because the unmasked parts will be overwritten by fields.
7513            // Write the fields.
7514            self.0.encode(encoder, offset + 0, depth)?;
7515            self.1.encode(encoder, offset + 16, depth)?;
7516            self.2.encode(encoder, offset + 20, depth)?;
7517            Ok(())
7518        }
7519    }
7520
7521    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageSizeVariant {
7522        #[inline(always)]
7523        fn new_empty() -> Self {
7524            Self {
7525                url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
7526                width: fidl::new_empty!(u32, D),
7527                height: fidl::new_empty!(u32, D),
7528            }
7529        }
7530
7531        #[inline]
7532        unsafe fn decode(
7533            &mut self,
7534            decoder: &mut fidl::encoding::Decoder<'_, D>,
7535            offset: usize,
7536            _depth: fidl::encoding::Depth,
7537        ) -> fidl::Result<()> {
7538            decoder.debug_check_bounds::<Self>(offset);
7539            // Verify that padding bytes are zero.
7540            fidl::decode!(
7541                fidl::encoding::BoundedString<4096>,
7542                D,
7543                &mut self.url,
7544                decoder,
7545                offset + 0,
7546                _depth
7547            )?;
7548            fidl::decode!(u32, D, &mut self.width, decoder, offset + 16, _depth)?;
7549            fidl::decode!(u32, D, &mut self.height, decoder, offset + 20, _depth)?;
7550            Ok(())
7551        }
7552    }
7553
7554    impl fidl::encoding::ResourceTypeMarker for ObserverDiscoveryConnectToSessionRequest {
7555        type Borrowed<'a> = &'a mut Self;
7556        fn take_or_borrow<'a>(
7557            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7558        ) -> Self::Borrowed<'a> {
7559            value
7560        }
7561    }
7562
7563    unsafe impl fidl::encoding::TypeMarker for ObserverDiscoveryConnectToSessionRequest {
7564        type Owned = Self;
7565
7566        #[inline(always)]
7567        fn inline_align(_context: fidl::encoding::Context) -> usize {
7568            8
7569        }
7570
7571        #[inline(always)]
7572        fn inline_size(_context: fidl::encoding::Context) -> usize {
7573            16
7574        }
7575    }
7576
7577    unsafe impl
7578        fidl::encoding::Encode<
7579            ObserverDiscoveryConnectToSessionRequest,
7580            fidl::encoding::DefaultFuchsiaResourceDialect,
7581        > for &mut ObserverDiscoveryConnectToSessionRequest
7582    {
7583        #[inline]
7584        unsafe fn encode(
7585            self,
7586            encoder: &mut fidl::encoding::Encoder<
7587                '_,
7588                fidl::encoding::DefaultFuchsiaResourceDialect,
7589            >,
7590            offset: usize,
7591            _depth: fidl::encoding::Depth,
7592        ) -> fidl::Result<()> {
7593            encoder.debug_check_bounds::<ObserverDiscoveryConnectToSessionRequest>(offset);
7594            // Delegate to tuple encoding.
7595            fidl::encoding::Encode::<ObserverDiscoveryConnectToSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7596                (
7597                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
7598                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session_request),
7599                ),
7600                encoder, offset, _depth
7601            )
7602        }
7603    }
7604    unsafe impl<
7605            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
7606            T1: fidl::encoding::Encode<
7607                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
7608                fidl::encoding::DefaultFuchsiaResourceDialect,
7609            >,
7610        >
7611        fidl::encoding::Encode<
7612            ObserverDiscoveryConnectToSessionRequest,
7613            fidl::encoding::DefaultFuchsiaResourceDialect,
7614        > for (T0, T1)
7615    {
7616        #[inline]
7617        unsafe fn encode(
7618            self,
7619            encoder: &mut fidl::encoding::Encoder<
7620                '_,
7621                fidl::encoding::DefaultFuchsiaResourceDialect,
7622            >,
7623            offset: usize,
7624            depth: fidl::encoding::Depth,
7625        ) -> fidl::Result<()> {
7626            encoder.debug_check_bounds::<ObserverDiscoveryConnectToSessionRequest>(offset);
7627            // Zero out padding regions. There's no need to apply masks
7628            // because the unmasked parts will be overwritten by fields.
7629            unsafe {
7630                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
7631                (ptr as *mut u64).write_unaligned(0);
7632            }
7633            // Write the fields.
7634            self.0.encode(encoder, offset + 0, depth)?;
7635            self.1.encode(encoder, offset + 8, depth)?;
7636            Ok(())
7637        }
7638    }
7639
7640    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7641        for ObserverDiscoveryConnectToSessionRequest
7642    {
7643        #[inline(always)]
7644        fn new_empty() -> Self {
7645            Self {
7646                session_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
7647                session_request: fidl::new_empty!(
7648                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
7649                    fidl::encoding::DefaultFuchsiaResourceDialect
7650                ),
7651            }
7652        }
7653
7654        #[inline]
7655        unsafe fn decode(
7656            &mut self,
7657            decoder: &mut fidl::encoding::Decoder<
7658                '_,
7659                fidl::encoding::DefaultFuchsiaResourceDialect,
7660            >,
7661            offset: usize,
7662            _depth: fidl::encoding::Depth,
7663        ) -> fidl::Result<()> {
7664            decoder.debug_check_bounds::<Self>(offset);
7665            // Verify that padding bytes are zero.
7666            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
7667            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7668            let mask = 0xffffffff00000000u64;
7669            let maskedval = padval & mask;
7670            if maskedval != 0 {
7671                return Err(fidl::Error::NonZeroPadding {
7672                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
7673                });
7674            }
7675            fidl::decode!(
7676                u64,
7677                fidl::encoding::DefaultFuchsiaResourceDialect,
7678                &mut self.session_id,
7679                decoder,
7680                offset + 0,
7681                _depth
7682            )?;
7683            fidl::decode!(
7684                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SessionObserverMarker>>,
7685                fidl::encoding::DefaultFuchsiaResourceDialect,
7686                &mut self.session_request,
7687                decoder,
7688                offset + 8,
7689                _depth
7690            )?;
7691            Ok(())
7692        }
7693    }
7694
7695    impl fidl::encoding::ResourceTypeMarker for ObserverDiscoveryWatchSessionsRequest {
7696        type Borrowed<'a> = &'a mut Self;
7697        fn take_or_borrow<'a>(
7698            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7699        ) -> Self::Borrowed<'a> {
7700            value
7701        }
7702    }
7703
7704    unsafe impl fidl::encoding::TypeMarker for ObserverDiscoveryWatchSessionsRequest {
7705        type Owned = Self;
7706
7707        #[inline(always)]
7708        fn inline_align(_context: fidl::encoding::Context) -> usize {
7709            8
7710        }
7711
7712        #[inline(always)]
7713        fn inline_size(_context: fidl::encoding::Context) -> usize {
7714            24
7715        }
7716    }
7717
7718    unsafe impl
7719        fidl::encoding::Encode<
7720            ObserverDiscoveryWatchSessionsRequest,
7721            fidl::encoding::DefaultFuchsiaResourceDialect,
7722        > for &mut ObserverDiscoveryWatchSessionsRequest
7723    {
7724        #[inline]
7725        unsafe fn encode(
7726            self,
7727            encoder: &mut fidl::encoding::Encoder<
7728                '_,
7729                fidl::encoding::DefaultFuchsiaResourceDialect,
7730            >,
7731            offset: usize,
7732            _depth: fidl::encoding::Depth,
7733        ) -> fidl::Result<()> {
7734            encoder.debug_check_bounds::<ObserverDiscoveryWatchSessionsRequest>(offset);
7735            // Delegate to tuple encoding.
7736            fidl::encoding::Encode::<ObserverDiscoveryWatchSessionsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7737                (
7738                    <WatchOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.watch_options),
7739                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.sessions_watcher),
7740                ),
7741                encoder, offset, _depth
7742            )
7743        }
7744    }
7745    unsafe impl<
7746            T0: fidl::encoding::Encode<WatchOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
7747            T1: fidl::encoding::Encode<
7748                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
7749                fidl::encoding::DefaultFuchsiaResourceDialect,
7750            >,
7751        >
7752        fidl::encoding::Encode<
7753            ObserverDiscoveryWatchSessionsRequest,
7754            fidl::encoding::DefaultFuchsiaResourceDialect,
7755        > for (T0, T1)
7756    {
7757        #[inline]
7758        unsafe fn encode(
7759            self,
7760            encoder: &mut fidl::encoding::Encoder<
7761                '_,
7762                fidl::encoding::DefaultFuchsiaResourceDialect,
7763            >,
7764            offset: usize,
7765            depth: fidl::encoding::Depth,
7766        ) -> fidl::Result<()> {
7767            encoder.debug_check_bounds::<ObserverDiscoveryWatchSessionsRequest>(offset);
7768            // Zero out padding regions. There's no need to apply masks
7769            // because the unmasked parts will be overwritten by fields.
7770            unsafe {
7771                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7772                (ptr as *mut u64).write_unaligned(0);
7773            }
7774            // Write the fields.
7775            self.0.encode(encoder, offset + 0, depth)?;
7776            self.1.encode(encoder, offset + 16, depth)?;
7777            Ok(())
7778        }
7779    }
7780
7781    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7782        for ObserverDiscoveryWatchSessionsRequest
7783    {
7784        #[inline(always)]
7785        fn new_empty() -> Self {
7786            Self {
7787                watch_options: fidl::new_empty!(
7788                    WatchOptions,
7789                    fidl::encoding::DefaultFuchsiaResourceDialect
7790                ),
7791                sessions_watcher: fidl::new_empty!(
7792                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
7793                    fidl::encoding::DefaultFuchsiaResourceDialect
7794                ),
7795            }
7796        }
7797
7798        #[inline]
7799        unsafe fn decode(
7800            &mut self,
7801            decoder: &mut fidl::encoding::Decoder<
7802                '_,
7803                fidl::encoding::DefaultFuchsiaResourceDialect,
7804            >,
7805            offset: usize,
7806            _depth: fidl::encoding::Depth,
7807        ) -> fidl::Result<()> {
7808            decoder.debug_check_bounds::<Self>(offset);
7809            // Verify that padding bytes are zero.
7810            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7811            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7812            let mask = 0xffffffff00000000u64;
7813            let maskedval = padval & mask;
7814            if maskedval != 0 {
7815                return Err(fidl::Error::NonZeroPadding {
7816                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7817                });
7818            }
7819            fidl::decode!(
7820                WatchOptions,
7821                fidl::encoding::DefaultFuchsiaResourceDialect,
7822                &mut self.watch_options,
7823                decoder,
7824                offset + 0,
7825                _depth
7826            )?;
7827            fidl::decode!(
7828                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<SessionsWatcherMarker>>,
7829                fidl::encoding::DefaultFuchsiaResourceDialect,
7830                &mut self.sessions_watcher,
7831                decoder,
7832                offset + 16,
7833                _depth
7834            )?;
7835            Ok(())
7836        }
7837    }
7838
7839    impl fidl::encoding::ResourceTypeMarker for PlayerControlBindVolumeControlRequest {
7840        type Borrowed<'a> = &'a mut Self;
7841        fn take_or_borrow<'a>(
7842            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7843        ) -> Self::Borrowed<'a> {
7844            value
7845        }
7846    }
7847
7848    unsafe impl fidl::encoding::TypeMarker for PlayerControlBindVolumeControlRequest {
7849        type Owned = Self;
7850
7851        #[inline(always)]
7852        fn inline_align(_context: fidl::encoding::Context) -> usize {
7853            4
7854        }
7855
7856        #[inline(always)]
7857        fn inline_size(_context: fidl::encoding::Context) -> usize {
7858            4
7859        }
7860    }
7861
7862    unsafe impl
7863        fidl::encoding::Encode<
7864            PlayerControlBindVolumeControlRequest,
7865            fidl::encoding::DefaultFuchsiaResourceDialect,
7866        > for &mut PlayerControlBindVolumeControlRequest
7867    {
7868        #[inline]
7869        unsafe fn encode(
7870            self,
7871            encoder: &mut fidl::encoding::Encoder<
7872                '_,
7873                fidl::encoding::DefaultFuchsiaResourceDialect,
7874            >,
7875            offset: usize,
7876            _depth: fidl::encoding::Depth,
7877        ) -> fidl::Result<()> {
7878            encoder.debug_check_bounds::<PlayerControlBindVolumeControlRequest>(offset);
7879            // Delegate to tuple encoding.
7880            fidl::encoding::Encode::<
7881                PlayerControlBindVolumeControlRequest,
7882                fidl::encoding::DefaultFuchsiaResourceDialect,
7883            >::encode(
7884                (<fidl::encoding::Endpoint<
7885                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7886                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7887                    &mut self.volume_control_request,
7888                ),),
7889                encoder,
7890                offset,
7891                _depth,
7892            )
7893        }
7894    }
7895    unsafe impl<
7896            T0: fidl::encoding::Encode<
7897                fidl::encoding::Endpoint<
7898                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7899                >,
7900                fidl::encoding::DefaultFuchsiaResourceDialect,
7901            >,
7902        >
7903        fidl::encoding::Encode<
7904            PlayerControlBindVolumeControlRequest,
7905            fidl::encoding::DefaultFuchsiaResourceDialect,
7906        > for (T0,)
7907    {
7908        #[inline]
7909        unsafe fn encode(
7910            self,
7911            encoder: &mut fidl::encoding::Encoder<
7912                '_,
7913                fidl::encoding::DefaultFuchsiaResourceDialect,
7914            >,
7915            offset: usize,
7916            depth: fidl::encoding::Depth,
7917        ) -> fidl::Result<()> {
7918            encoder.debug_check_bounds::<PlayerControlBindVolumeControlRequest>(offset);
7919            // Zero out padding regions. There's no need to apply masks
7920            // because the unmasked parts will be overwritten by fields.
7921            // Write the fields.
7922            self.0.encode(encoder, offset + 0, depth)?;
7923            Ok(())
7924        }
7925    }
7926
7927    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7928        for PlayerControlBindVolumeControlRequest
7929    {
7930        #[inline(always)]
7931        fn new_empty() -> Self {
7932            Self {
7933                volume_control_request: fidl::new_empty!(
7934                    fidl::encoding::Endpoint<
7935                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7936                    >,
7937                    fidl::encoding::DefaultFuchsiaResourceDialect
7938                ),
7939            }
7940        }
7941
7942        #[inline]
7943        unsafe fn decode(
7944            &mut self,
7945            decoder: &mut fidl::encoding::Decoder<
7946                '_,
7947                fidl::encoding::DefaultFuchsiaResourceDialect,
7948            >,
7949            offset: usize,
7950            _depth: fidl::encoding::Depth,
7951        ) -> fidl::Result<()> {
7952            decoder.debug_check_bounds::<Self>(offset);
7953            // Verify that padding bytes are zero.
7954            fidl::decode!(
7955                fidl::encoding::Endpoint<
7956                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
7957                >,
7958                fidl::encoding::DefaultFuchsiaResourceDialect,
7959                &mut self.volume_control_request,
7960                decoder,
7961                offset + 0,
7962                _depth
7963            )?;
7964            Ok(())
7965        }
7966    }
7967
7968    impl fidl::encoding::ValueTypeMarker for PlayerControlSeekRequest {
7969        type Borrowed<'a> = &'a Self;
7970        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7971            value
7972        }
7973    }
7974
7975    unsafe impl fidl::encoding::TypeMarker for PlayerControlSeekRequest {
7976        type Owned = Self;
7977
7978        #[inline(always)]
7979        fn inline_align(_context: fidl::encoding::Context) -> usize {
7980            8
7981        }
7982
7983        #[inline(always)]
7984        fn inline_size(_context: fidl::encoding::Context) -> usize {
7985            8
7986        }
7987        #[inline(always)]
7988        fn encode_is_copy() -> bool {
7989            true
7990        }
7991
7992        #[inline(always)]
7993        fn decode_is_copy() -> bool {
7994            true
7995        }
7996    }
7997
7998    unsafe impl<D: fidl::encoding::ResourceDialect>
7999        fidl::encoding::Encode<PlayerControlSeekRequest, D> for &PlayerControlSeekRequest
8000    {
8001        #[inline]
8002        unsafe fn encode(
8003            self,
8004            encoder: &mut fidl::encoding::Encoder<'_, D>,
8005            offset: usize,
8006            _depth: fidl::encoding::Depth,
8007        ) -> fidl::Result<()> {
8008            encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
8009            unsafe {
8010                // Copy the object into the buffer.
8011                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8012                (buf_ptr as *mut PlayerControlSeekRequest)
8013                    .write_unaligned((self as *const PlayerControlSeekRequest).read());
8014                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8015                // done second because the memcpy will write garbage to these bytes.
8016            }
8017            Ok(())
8018        }
8019    }
8020    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
8021        fidl::encoding::Encode<PlayerControlSeekRequest, D> for (T0,)
8022    {
8023        #[inline]
8024        unsafe fn encode(
8025            self,
8026            encoder: &mut fidl::encoding::Encoder<'_, D>,
8027            offset: usize,
8028            depth: fidl::encoding::Depth,
8029        ) -> fidl::Result<()> {
8030            encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
8031            // Zero out padding regions. There's no need to apply masks
8032            // because the unmasked parts will be overwritten by fields.
8033            // Write the fields.
8034            self.0.encode(encoder, offset + 0, depth)?;
8035            Ok(())
8036        }
8037    }
8038
8039    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8040        for PlayerControlSeekRequest
8041    {
8042        #[inline(always)]
8043        fn new_empty() -> Self {
8044            Self { position: fidl::new_empty!(i64, D) }
8045        }
8046
8047        #[inline]
8048        unsafe fn decode(
8049            &mut self,
8050            decoder: &mut fidl::encoding::Decoder<'_, D>,
8051            offset: usize,
8052            _depth: fidl::encoding::Depth,
8053        ) -> fidl::Result<()> {
8054            decoder.debug_check_bounds::<Self>(offset);
8055            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8056            // Verify that padding bytes are zero.
8057            // Copy from the buffer into the object.
8058            unsafe {
8059                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
8060            }
8061            Ok(())
8062        }
8063    }
8064
8065    impl fidl::encoding::ValueTypeMarker for PlayerControlSetPlaybackRateRequest {
8066        type Borrowed<'a> = &'a Self;
8067        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8068            value
8069        }
8070    }
8071
8072    unsafe impl fidl::encoding::TypeMarker for PlayerControlSetPlaybackRateRequest {
8073        type Owned = Self;
8074
8075        #[inline(always)]
8076        fn inline_align(_context: fidl::encoding::Context) -> usize {
8077            4
8078        }
8079
8080        #[inline(always)]
8081        fn inline_size(_context: fidl::encoding::Context) -> usize {
8082            4
8083        }
8084    }
8085
8086    unsafe impl<D: fidl::encoding::ResourceDialect>
8087        fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D>
8088        for &PlayerControlSetPlaybackRateRequest
8089    {
8090        #[inline]
8091        unsafe fn encode(
8092            self,
8093            encoder: &mut fidl::encoding::Encoder<'_, D>,
8094            offset: usize,
8095            _depth: fidl::encoding::Depth,
8096        ) -> fidl::Result<()> {
8097            encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
8098            // Delegate to tuple encoding.
8099            fidl::encoding::Encode::<PlayerControlSetPlaybackRateRequest, D>::encode(
8100                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
8101                encoder,
8102                offset,
8103                _depth,
8104            )
8105        }
8106    }
8107    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
8108        fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D> for (T0,)
8109    {
8110        #[inline]
8111        unsafe fn encode(
8112            self,
8113            encoder: &mut fidl::encoding::Encoder<'_, D>,
8114            offset: usize,
8115            depth: fidl::encoding::Depth,
8116        ) -> fidl::Result<()> {
8117            encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
8118            // Zero out padding regions. There's no need to apply masks
8119            // because the unmasked parts will be overwritten by fields.
8120            // Write the fields.
8121            self.0.encode(encoder, offset + 0, depth)?;
8122            Ok(())
8123        }
8124    }
8125
8126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8127        for PlayerControlSetPlaybackRateRequest
8128    {
8129        #[inline(always)]
8130        fn new_empty() -> Self {
8131            Self { playback_rate: fidl::new_empty!(f32, D) }
8132        }
8133
8134        #[inline]
8135        unsafe fn decode(
8136            &mut self,
8137            decoder: &mut fidl::encoding::Decoder<'_, D>,
8138            offset: usize,
8139            _depth: fidl::encoding::Depth,
8140        ) -> fidl::Result<()> {
8141            decoder.debug_check_bounds::<Self>(offset);
8142            // Verify that padding bytes are zero.
8143            fidl::decode!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
8144            Ok(())
8145        }
8146    }
8147
8148    impl fidl::encoding::ValueTypeMarker for PlayerControlSetRepeatModeRequest {
8149        type Borrowed<'a> = &'a Self;
8150        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8151            value
8152        }
8153    }
8154
8155    unsafe impl fidl::encoding::TypeMarker for PlayerControlSetRepeatModeRequest {
8156        type Owned = Self;
8157
8158        #[inline(always)]
8159        fn inline_align(_context: fidl::encoding::Context) -> usize {
8160            4
8161        }
8162
8163        #[inline(always)]
8164        fn inline_size(_context: fidl::encoding::Context) -> usize {
8165            4
8166        }
8167    }
8168
8169    unsafe impl<D: fidl::encoding::ResourceDialect>
8170        fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D>
8171        for &PlayerControlSetRepeatModeRequest
8172    {
8173        #[inline]
8174        unsafe fn encode(
8175            self,
8176            encoder: &mut fidl::encoding::Encoder<'_, D>,
8177            offset: usize,
8178            _depth: fidl::encoding::Depth,
8179        ) -> fidl::Result<()> {
8180            encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
8181            // Delegate to tuple encoding.
8182            fidl::encoding::Encode::<PlayerControlSetRepeatModeRequest, D>::encode(
8183                (<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
8184                encoder,
8185                offset,
8186                _depth,
8187            )
8188        }
8189    }
8190    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
8191        fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D> for (T0,)
8192    {
8193        #[inline]
8194        unsafe fn encode(
8195            self,
8196            encoder: &mut fidl::encoding::Encoder<'_, D>,
8197            offset: usize,
8198            depth: fidl::encoding::Depth,
8199        ) -> fidl::Result<()> {
8200            encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
8201            // Zero out padding regions. There's no need to apply masks
8202            // because the unmasked parts will be overwritten by fields.
8203            // Write the fields.
8204            self.0.encode(encoder, offset + 0, depth)?;
8205            Ok(())
8206        }
8207    }
8208
8209    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8210        for PlayerControlSetRepeatModeRequest
8211    {
8212        #[inline(always)]
8213        fn new_empty() -> Self {
8214            Self { repeat_mode: fidl::new_empty!(RepeatMode, D) }
8215        }
8216
8217        #[inline]
8218        unsafe fn decode(
8219            &mut self,
8220            decoder: &mut fidl::encoding::Decoder<'_, D>,
8221            offset: usize,
8222            _depth: fidl::encoding::Depth,
8223        ) -> fidl::Result<()> {
8224            decoder.debug_check_bounds::<Self>(offset);
8225            // Verify that padding bytes are zero.
8226            fidl::decode!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
8227            Ok(())
8228        }
8229    }
8230
8231    impl fidl::encoding::ValueTypeMarker for PlayerControlSetShuffleModeRequest {
8232        type Borrowed<'a> = &'a Self;
8233        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8234            value
8235        }
8236    }
8237
8238    unsafe impl fidl::encoding::TypeMarker for PlayerControlSetShuffleModeRequest {
8239        type Owned = Self;
8240
8241        #[inline(always)]
8242        fn inline_align(_context: fidl::encoding::Context) -> usize {
8243            1
8244        }
8245
8246        #[inline(always)]
8247        fn inline_size(_context: fidl::encoding::Context) -> usize {
8248            1
8249        }
8250    }
8251
8252    unsafe impl<D: fidl::encoding::ResourceDialect>
8253        fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D>
8254        for &PlayerControlSetShuffleModeRequest
8255    {
8256        #[inline]
8257        unsafe fn encode(
8258            self,
8259            encoder: &mut fidl::encoding::Encoder<'_, D>,
8260            offset: usize,
8261            _depth: fidl::encoding::Depth,
8262        ) -> fidl::Result<()> {
8263            encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
8264            // Delegate to tuple encoding.
8265            fidl::encoding::Encode::<PlayerControlSetShuffleModeRequest, D>::encode(
8266                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
8267                encoder,
8268                offset,
8269                _depth,
8270            )
8271        }
8272    }
8273    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
8274        fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D> for (T0,)
8275    {
8276        #[inline]
8277        unsafe fn encode(
8278            self,
8279            encoder: &mut fidl::encoding::Encoder<'_, D>,
8280            offset: usize,
8281            depth: fidl::encoding::Depth,
8282        ) -> fidl::Result<()> {
8283            encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
8284            // Zero out padding regions. There's no need to apply masks
8285            // because the unmasked parts will be overwritten by fields.
8286            // Write the fields.
8287            self.0.encode(encoder, offset + 0, depth)?;
8288            Ok(())
8289        }
8290    }
8291
8292    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8293        for PlayerControlSetShuffleModeRequest
8294    {
8295        #[inline(always)]
8296        fn new_empty() -> Self {
8297            Self { shuffle_on: fidl::new_empty!(bool, D) }
8298        }
8299
8300        #[inline]
8301        unsafe fn decode(
8302            &mut self,
8303            decoder: &mut fidl::encoding::Decoder<'_, D>,
8304            offset: usize,
8305            _depth: fidl::encoding::Depth,
8306        ) -> fidl::Result<()> {
8307            decoder.debug_check_bounds::<Self>(offset);
8308            // Verify that padding bytes are zero.
8309            fidl::decode!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
8310            Ok(())
8311        }
8312    }
8313
8314    impl fidl::encoding::ValueTypeMarker for PlayerWatchInfoChangeResponse {
8315        type Borrowed<'a> = &'a Self;
8316        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8317            value
8318        }
8319    }
8320
8321    unsafe impl fidl::encoding::TypeMarker for PlayerWatchInfoChangeResponse {
8322        type Owned = Self;
8323
8324        #[inline(always)]
8325        fn inline_align(_context: fidl::encoding::Context) -> usize {
8326            8
8327        }
8328
8329        #[inline(always)]
8330        fn inline_size(_context: fidl::encoding::Context) -> usize {
8331            16
8332        }
8333    }
8334
8335    unsafe impl<D: fidl::encoding::ResourceDialect>
8336        fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D>
8337        for &PlayerWatchInfoChangeResponse
8338    {
8339        #[inline]
8340        unsafe fn encode(
8341            self,
8342            encoder: &mut fidl::encoding::Encoder<'_, D>,
8343            offset: usize,
8344            _depth: fidl::encoding::Depth,
8345        ) -> fidl::Result<()> {
8346            encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
8347            // Delegate to tuple encoding.
8348            fidl::encoding::Encode::<PlayerWatchInfoChangeResponse, D>::encode(
8349                (<PlayerInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
8350                    &self.player_info_delta,
8351                ),),
8352                encoder,
8353                offset,
8354                _depth,
8355            )
8356        }
8357    }
8358    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PlayerInfoDelta, D>>
8359        fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D> for (T0,)
8360    {
8361        #[inline]
8362        unsafe fn encode(
8363            self,
8364            encoder: &mut fidl::encoding::Encoder<'_, D>,
8365            offset: usize,
8366            depth: fidl::encoding::Depth,
8367        ) -> fidl::Result<()> {
8368            encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
8369            // Zero out padding regions. There's no need to apply masks
8370            // because the unmasked parts will be overwritten by fields.
8371            // Write the fields.
8372            self.0.encode(encoder, offset + 0, depth)?;
8373            Ok(())
8374        }
8375    }
8376
8377    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8378        for PlayerWatchInfoChangeResponse
8379    {
8380        #[inline(always)]
8381        fn new_empty() -> Self {
8382            Self { player_info_delta: fidl::new_empty!(PlayerInfoDelta, D) }
8383        }
8384
8385        #[inline]
8386        unsafe fn decode(
8387            &mut self,
8388            decoder: &mut fidl::encoding::Decoder<'_, D>,
8389            offset: usize,
8390            _depth: fidl::encoding::Depth,
8391        ) -> fidl::Result<()> {
8392            decoder.debug_check_bounds::<Self>(offset);
8393            // Verify that padding bytes are zero.
8394            fidl::decode!(
8395                PlayerInfoDelta,
8396                D,
8397                &mut self.player_info_delta,
8398                decoder,
8399                offset + 0,
8400                _depth
8401            )?;
8402            Ok(())
8403        }
8404    }
8405
8406    impl fidl::encoding::ResourceTypeMarker for PublisherPublishRequest {
8407        type Borrowed<'a> = &'a mut Self;
8408        fn take_or_borrow<'a>(
8409            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8410        ) -> Self::Borrowed<'a> {
8411            value
8412        }
8413    }
8414
8415    unsafe impl fidl::encoding::TypeMarker for PublisherPublishRequest {
8416        type Owned = Self;
8417
8418        #[inline(always)]
8419        fn inline_align(_context: fidl::encoding::Context) -> usize {
8420            8
8421        }
8422
8423        #[inline(always)]
8424        fn inline_size(_context: fidl::encoding::Context) -> usize {
8425            24
8426        }
8427    }
8428
8429    unsafe impl
8430        fidl::encoding::Encode<
8431            PublisherPublishRequest,
8432            fidl::encoding::DefaultFuchsiaResourceDialect,
8433        > for &mut PublisherPublishRequest
8434    {
8435        #[inline]
8436        unsafe fn encode(
8437            self,
8438            encoder: &mut fidl::encoding::Encoder<
8439                '_,
8440                fidl::encoding::DefaultFuchsiaResourceDialect,
8441            >,
8442            offset: usize,
8443            _depth: fidl::encoding::Depth,
8444        ) -> fidl::Result<()> {
8445            encoder.debug_check_bounds::<PublisherPublishRequest>(offset);
8446            // Delegate to tuple encoding.
8447            fidl::encoding::Encode::<PublisherPublishRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8448                (
8449                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.player),
8450                    <PlayerRegistration as fidl::encoding::ValueTypeMarker>::borrow(&self.registration),
8451                ),
8452                encoder, offset, _depth
8453            )
8454        }
8455    }
8456    unsafe impl<
8457            T0: fidl::encoding::Encode<
8458                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
8459                fidl::encoding::DefaultFuchsiaResourceDialect,
8460            >,
8461            T1: fidl::encoding::Encode<
8462                PlayerRegistration,
8463                fidl::encoding::DefaultFuchsiaResourceDialect,
8464            >,
8465        >
8466        fidl::encoding::Encode<
8467            PublisherPublishRequest,
8468            fidl::encoding::DefaultFuchsiaResourceDialect,
8469        > for (T0, T1)
8470    {
8471        #[inline]
8472        unsafe fn encode(
8473            self,
8474            encoder: &mut fidl::encoding::Encoder<
8475                '_,
8476                fidl::encoding::DefaultFuchsiaResourceDialect,
8477            >,
8478            offset: usize,
8479            depth: fidl::encoding::Depth,
8480        ) -> fidl::Result<()> {
8481            encoder.debug_check_bounds::<PublisherPublishRequest>(offset);
8482            // Zero out padding regions. There's no need to apply masks
8483            // because the unmasked parts will be overwritten by fields.
8484            unsafe {
8485                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8486                (ptr as *mut u64).write_unaligned(0);
8487            }
8488            // Write the fields.
8489            self.0.encode(encoder, offset + 0, depth)?;
8490            self.1.encode(encoder, offset + 8, depth)?;
8491            Ok(())
8492        }
8493    }
8494
8495    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8496        for PublisherPublishRequest
8497    {
8498        #[inline(always)]
8499        fn new_empty() -> Self {
8500            Self {
8501                player: fidl::new_empty!(
8502                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
8503                    fidl::encoding::DefaultFuchsiaResourceDialect
8504                ),
8505                registration: fidl::new_empty!(
8506                    PlayerRegistration,
8507                    fidl::encoding::DefaultFuchsiaResourceDialect
8508                ),
8509            }
8510        }
8511
8512        #[inline]
8513        unsafe fn decode(
8514            &mut self,
8515            decoder: &mut fidl::encoding::Decoder<
8516                '_,
8517                fidl::encoding::DefaultFuchsiaResourceDialect,
8518            >,
8519            offset: usize,
8520            _depth: fidl::encoding::Depth,
8521        ) -> fidl::Result<()> {
8522            decoder.debug_check_bounds::<Self>(offset);
8523            // Verify that padding bytes are zero.
8524            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
8525            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8526            let mask = 0xffffffff00000000u64;
8527            let maskedval = padval & mask;
8528            if maskedval != 0 {
8529                return Err(fidl::Error::NonZeroPadding {
8530                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8531                });
8532            }
8533            fidl::decode!(
8534                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PlayerMarker>>,
8535                fidl::encoding::DefaultFuchsiaResourceDialect,
8536                &mut self.player,
8537                decoder,
8538                offset + 0,
8539                _depth
8540            )?;
8541            fidl::decode!(
8542                PlayerRegistration,
8543                fidl::encoding::DefaultFuchsiaResourceDialect,
8544                &mut self.registration,
8545                decoder,
8546                offset + 8,
8547                _depth
8548            )?;
8549            Ok(())
8550        }
8551    }
8552
8553    impl fidl::encoding::ValueTypeMarker for PublisherPublishResponse {
8554        type Borrowed<'a> = &'a Self;
8555        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8556            value
8557        }
8558    }
8559
8560    unsafe impl fidl::encoding::TypeMarker for PublisherPublishResponse {
8561        type Owned = Self;
8562
8563        #[inline(always)]
8564        fn inline_align(_context: fidl::encoding::Context) -> usize {
8565            8
8566        }
8567
8568        #[inline(always)]
8569        fn inline_size(_context: fidl::encoding::Context) -> usize {
8570            8
8571        }
8572        #[inline(always)]
8573        fn encode_is_copy() -> bool {
8574            true
8575        }
8576
8577        #[inline(always)]
8578        fn decode_is_copy() -> bool {
8579            true
8580        }
8581    }
8582
8583    unsafe impl<D: fidl::encoding::ResourceDialect>
8584        fidl::encoding::Encode<PublisherPublishResponse, D> for &PublisherPublishResponse
8585    {
8586        #[inline]
8587        unsafe fn encode(
8588            self,
8589            encoder: &mut fidl::encoding::Encoder<'_, D>,
8590            offset: usize,
8591            _depth: fidl::encoding::Depth,
8592        ) -> fidl::Result<()> {
8593            encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
8594            unsafe {
8595                // Copy the object into the buffer.
8596                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8597                (buf_ptr as *mut PublisherPublishResponse)
8598                    .write_unaligned((self as *const PublisherPublishResponse).read());
8599                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8600                // done second because the memcpy will write garbage to these bytes.
8601            }
8602            Ok(())
8603        }
8604    }
8605    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
8606        fidl::encoding::Encode<PublisherPublishResponse, D> for (T0,)
8607    {
8608        #[inline]
8609        unsafe fn encode(
8610            self,
8611            encoder: &mut fidl::encoding::Encoder<'_, D>,
8612            offset: usize,
8613            depth: fidl::encoding::Depth,
8614        ) -> fidl::Result<()> {
8615            encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
8616            // Zero out padding regions. There's no need to apply masks
8617            // because the unmasked parts will be overwritten by fields.
8618            // Write the fields.
8619            self.0.encode(encoder, offset + 0, depth)?;
8620            Ok(())
8621        }
8622    }
8623
8624    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8625        for PublisherPublishResponse
8626    {
8627        #[inline(always)]
8628        fn new_empty() -> Self {
8629            Self { session_id: fidl::new_empty!(u64, D) }
8630        }
8631
8632        #[inline]
8633        unsafe fn decode(
8634            &mut self,
8635            decoder: &mut fidl::encoding::Decoder<'_, D>,
8636            offset: usize,
8637            _depth: fidl::encoding::Depth,
8638        ) -> fidl::Result<()> {
8639            decoder.debug_check_bounds::<Self>(offset);
8640            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8641            // Verify that padding bytes are zero.
8642            // Copy from the buffer into the object.
8643            unsafe {
8644                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
8645            }
8646            Ok(())
8647        }
8648    }
8649
8650    impl fidl::encoding::ResourceTypeMarker for SessionControlBindVolumeControlRequest {
8651        type Borrowed<'a> = &'a mut Self;
8652        fn take_or_borrow<'a>(
8653            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8654        ) -> Self::Borrowed<'a> {
8655            value
8656        }
8657    }
8658
8659    unsafe impl fidl::encoding::TypeMarker for SessionControlBindVolumeControlRequest {
8660        type Owned = Self;
8661
8662        #[inline(always)]
8663        fn inline_align(_context: fidl::encoding::Context) -> usize {
8664            4
8665        }
8666
8667        #[inline(always)]
8668        fn inline_size(_context: fidl::encoding::Context) -> usize {
8669            4
8670        }
8671    }
8672
8673    unsafe impl
8674        fidl::encoding::Encode<
8675            SessionControlBindVolumeControlRequest,
8676            fidl::encoding::DefaultFuchsiaResourceDialect,
8677        > for &mut SessionControlBindVolumeControlRequest
8678    {
8679        #[inline]
8680        unsafe fn encode(
8681            self,
8682            encoder: &mut fidl::encoding::Encoder<
8683                '_,
8684                fidl::encoding::DefaultFuchsiaResourceDialect,
8685            >,
8686            offset: usize,
8687            _depth: fidl::encoding::Depth,
8688        ) -> fidl::Result<()> {
8689            encoder.debug_check_bounds::<SessionControlBindVolumeControlRequest>(offset);
8690            // Delegate to tuple encoding.
8691            fidl::encoding::Encode::<
8692                SessionControlBindVolumeControlRequest,
8693                fidl::encoding::DefaultFuchsiaResourceDialect,
8694            >::encode(
8695                (<fidl::encoding::Endpoint<
8696                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
8697                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8698                    &mut self.volume_control_request,
8699                ),),
8700                encoder,
8701                offset,
8702                _depth,
8703            )
8704        }
8705    }
8706    unsafe impl<
8707            T0: fidl::encoding::Encode<
8708                fidl::encoding::Endpoint<
8709                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
8710                >,
8711                fidl::encoding::DefaultFuchsiaResourceDialect,
8712            >,
8713        >
8714        fidl::encoding::Encode<
8715            SessionControlBindVolumeControlRequest,
8716            fidl::encoding::DefaultFuchsiaResourceDialect,
8717        > for (T0,)
8718    {
8719        #[inline]
8720        unsafe fn encode(
8721            self,
8722            encoder: &mut fidl::encoding::Encoder<
8723                '_,
8724                fidl::encoding::DefaultFuchsiaResourceDialect,
8725            >,
8726            offset: usize,
8727            depth: fidl::encoding::Depth,
8728        ) -> fidl::Result<()> {
8729            encoder.debug_check_bounds::<SessionControlBindVolumeControlRequest>(offset);
8730            // Zero out padding regions. There's no need to apply masks
8731            // because the unmasked parts will be overwritten by fields.
8732            // Write the fields.
8733            self.0.encode(encoder, offset + 0, depth)?;
8734            Ok(())
8735        }
8736    }
8737
8738    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8739        for SessionControlBindVolumeControlRequest
8740    {
8741        #[inline(always)]
8742        fn new_empty() -> Self {
8743            Self {
8744                volume_control_request: fidl::new_empty!(
8745                    fidl::encoding::Endpoint<
8746                        fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
8747                    >,
8748                    fidl::encoding::DefaultFuchsiaResourceDialect
8749                ),
8750            }
8751        }
8752
8753        #[inline]
8754        unsafe fn decode(
8755            &mut self,
8756            decoder: &mut fidl::encoding::Decoder<
8757                '_,
8758                fidl::encoding::DefaultFuchsiaResourceDialect,
8759            >,
8760            offset: usize,
8761            _depth: fidl::encoding::Depth,
8762        ) -> fidl::Result<()> {
8763            decoder.debug_check_bounds::<Self>(offset);
8764            // Verify that padding bytes are zero.
8765            fidl::decode!(
8766                fidl::encoding::Endpoint<
8767                    fidl::endpoints::ServerEnd<fidl_fuchsia_media_audio::VolumeControlMarker>,
8768                >,
8769                fidl::encoding::DefaultFuchsiaResourceDialect,
8770                &mut self.volume_control_request,
8771                decoder,
8772                offset + 0,
8773                _depth
8774            )?;
8775            Ok(())
8776        }
8777    }
8778
8779    impl fidl::encoding::ValueTypeMarker for SessionControlSeekRequest {
8780        type Borrowed<'a> = &'a Self;
8781        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8782            value
8783        }
8784    }
8785
8786    unsafe impl fidl::encoding::TypeMarker for SessionControlSeekRequest {
8787        type Owned = Self;
8788
8789        #[inline(always)]
8790        fn inline_align(_context: fidl::encoding::Context) -> usize {
8791            8
8792        }
8793
8794        #[inline(always)]
8795        fn inline_size(_context: fidl::encoding::Context) -> usize {
8796            8
8797        }
8798        #[inline(always)]
8799        fn encode_is_copy() -> bool {
8800            true
8801        }
8802
8803        #[inline(always)]
8804        fn decode_is_copy() -> bool {
8805            true
8806        }
8807    }
8808
8809    unsafe impl<D: fidl::encoding::ResourceDialect>
8810        fidl::encoding::Encode<SessionControlSeekRequest, D> for &SessionControlSeekRequest
8811    {
8812        #[inline]
8813        unsafe fn encode(
8814            self,
8815            encoder: &mut fidl::encoding::Encoder<'_, D>,
8816            offset: usize,
8817            _depth: fidl::encoding::Depth,
8818        ) -> fidl::Result<()> {
8819            encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
8820            unsafe {
8821                // Copy the object into the buffer.
8822                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
8823                (buf_ptr as *mut SessionControlSeekRequest)
8824                    .write_unaligned((self as *const SessionControlSeekRequest).read());
8825                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
8826                // done second because the memcpy will write garbage to these bytes.
8827            }
8828            Ok(())
8829        }
8830    }
8831    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
8832        fidl::encoding::Encode<SessionControlSeekRequest, D> for (T0,)
8833    {
8834        #[inline]
8835        unsafe fn encode(
8836            self,
8837            encoder: &mut fidl::encoding::Encoder<'_, D>,
8838            offset: usize,
8839            depth: fidl::encoding::Depth,
8840        ) -> fidl::Result<()> {
8841            encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
8842            // Zero out padding regions. There's no need to apply masks
8843            // because the unmasked parts will be overwritten by fields.
8844            // Write the fields.
8845            self.0.encode(encoder, offset + 0, depth)?;
8846            Ok(())
8847        }
8848    }
8849
8850    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8851        for SessionControlSeekRequest
8852    {
8853        #[inline(always)]
8854        fn new_empty() -> Self {
8855            Self { position: fidl::new_empty!(i64, D) }
8856        }
8857
8858        #[inline]
8859        unsafe fn decode(
8860            &mut self,
8861            decoder: &mut fidl::encoding::Decoder<'_, D>,
8862            offset: usize,
8863            _depth: fidl::encoding::Depth,
8864        ) -> fidl::Result<()> {
8865            decoder.debug_check_bounds::<Self>(offset);
8866            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
8867            // Verify that padding bytes are zero.
8868            // Copy from the buffer into the object.
8869            unsafe {
8870                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
8871            }
8872            Ok(())
8873        }
8874    }
8875
8876    impl fidl::encoding::ValueTypeMarker for SessionControlSetPlaybackRateRequest {
8877        type Borrowed<'a> = &'a Self;
8878        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8879            value
8880        }
8881    }
8882
8883    unsafe impl fidl::encoding::TypeMarker for SessionControlSetPlaybackRateRequest {
8884        type Owned = Self;
8885
8886        #[inline(always)]
8887        fn inline_align(_context: fidl::encoding::Context) -> usize {
8888            4
8889        }
8890
8891        #[inline(always)]
8892        fn inline_size(_context: fidl::encoding::Context) -> usize {
8893            4
8894        }
8895    }
8896
8897    unsafe impl<D: fidl::encoding::ResourceDialect>
8898        fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D>
8899        for &SessionControlSetPlaybackRateRequest
8900    {
8901        #[inline]
8902        unsafe fn encode(
8903            self,
8904            encoder: &mut fidl::encoding::Encoder<'_, D>,
8905            offset: usize,
8906            _depth: fidl::encoding::Depth,
8907        ) -> fidl::Result<()> {
8908            encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
8909            // Delegate to tuple encoding.
8910            fidl::encoding::Encode::<SessionControlSetPlaybackRateRequest, D>::encode(
8911                (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
8912                encoder,
8913                offset,
8914                _depth,
8915            )
8916        }
8917    }
8918    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
8919        fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D> for (T0,)
8920    {
8921        #[inline]
8922        unsafe fn encode(
8923            self,
8924            encoder: &mut fidl::encoding::Encoder<'_, D>,
8925            offset: usize,
8926            depth: fidl::encoding::Depth,
8927        ) -> fidl::Result<()> {
8928            encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
8929            // Zero out padding regions. There's no need to apply masks
8930            // because the unmasked parts will be overwritten by fields.
8931            // Write the fields.
8932            self.0.encode(encoder, offset + 0, depth)?;
8933            Ok(())
8934        }
8935    }
8936
8937    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8938        for SessionControlSetPlaybackRateRequest
8939    {
8940        #[inline(always)]
8941        fn new_empty() -> Self {
8942            Self { playback_rate: fidl::new_empty!(f32, D) }
8943        }
8944
8945        #[inline]
8946        unsafe fn decode(
8947            &mut self,
8948            decoder: &mut fidl::encoding::Decoder<'_, D>,
8949            offset: usize,
8950            _depth: fidl::encoding::Depth,
8951        ) -> fidl::Result<()> {
8952            decoder.debug_check_bounds::<Self>(offset);
8953            // Verify that padding bytes are zero.
8954            fidl::decode!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
8955            Ok(())
8956        }
8957    }
8958
8959    impl fidl::encoding::ValueTypeMarker for SessionControlSetRepeatModeRequest {
8960        type Borrowed<'a> = &'a Self;
8961        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8962            value
8963        }
8964    }
8965
8966    unsafe impl fidl::encoding::TypeMarker for SessionControlSetRepeatModeRequest {
8967        type Owned = Self;
8968
8969        #[inline(always)]
8970        fn inline_align(_context: fidl::encoding::Context) -> usize {
8971            4
8972        }
8973
8974        #[inline(always)]
8975        fn inline_size(_context: fidl::encoding::Context) -> usize {
8976            4
8977        }
8978    }
8979
8980    unsafe impl<D: fidl::encoding::ResourceDialect>
8981        fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D>
8982        for &SessionControlSetRepeatModeRequest
8983    {
8984        #[inline]
8985        unsafe fn encode(
8986            self,
8987            encoder: &mut fidl::encoding::Encoder<'_, D>,
8988            offset: usize,
8989            _depth: fidl::encoding::Depth,
8990        ) -> fidl::Result<()> {
8991            encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
8992            // Delegate to tuple encoding.
8993            fidl::encoding::Encode::<SessionControlSetRepeatModeRequest, D>::encode(
8994                (<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
8995                encoder,
8996                offset,
8997                _depth,
8998            )
8999        }
9000    }
9001    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
9002        fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D> for (T0,)
9003    {
9004        #[inline]
9005        unsafe fn encode(
9006            self,
9007            encoder: &mut fidl::encoding::Encoder<'_, D>,
9008            offset: usize,
9009            depth: fidl::encoding::Depth,
9010        ) -> fidl::Result<()> {
9011            encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
9012            // Zero out padding regions. There's no need to apply masks
9013            // because the unmasked parts will be overwritten by fields.
9014            // Write the fields.
9015            self.0.encode(encoder, offset + 0, depth)?;
9016            Ok(())
9017        }
9018    }
9019
9020    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9021        for SessionControlSetRepeatModeRequest
9022    {
9023        #[inline(always)]
9024        fn new_empty() -> Self {
9025            Self { repeat_mode: fidl::new_empty!(RepeatMode, D) }
9026        }
9027
9028        #[inline]
9029        unsafe fn decode(
9030            &mut self,
9031            decoder: &mut fidl::encoding::Decoder<'_, D>,
9032            offset: usize,
9033            _depth: fidl::encoding::Depth,
9034        ) -> fidl::Result<()> {
9035            decoder.debug_check_bounds::<Self>(offset);
9036            // Verify that padding bytes are zero.
9037            fidl::decode!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
9038            Ok(())
9039        }
9040    }
9041
9042    impl fidl::encoding::ValueTypeMarker for SessionControlSetShuffleModeRequest {
9043        type Borrowed<'a> = &'a Self;
9044        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9045            value
9046        }
9047    }
9048
9049    unsafe impl fidl::encoding::TypeMarker for SessionControlSetShuffleModeRequest {
9050        type Owned = Self;
9051
9052        #[inline(always)]
9053        fn inline_align(_context: fidl::encoding::Context) -> usize {
9054            1
9055        }
9056
9057        #[inline(always)]
9058        fn inline_size(_context: fidl::encoding::Context) -> usize {
9059            1
9060        }
9061    }
9062
9063    unsafe impl<D: fidl::encoding::ResourceDialect>
9064        fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D>
9065        for &SessionControlSetShuffleModeRequest
9066    {
9067        #[inline]
9068        unsafe fn encode(
9069            self,
9070            encoder: &mut fidl::encoding::Encoder<'_, D>,
9071            offset: usize,
9072            _depth: fidl::encoding::Depth,
9073        ) -> fidl::Result<()> {
9074            encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
9075            // Delegate to tuple encoding.
9076            fidl::encoding::Encode::<SessionControlSetShuffleModeRequest, D>::encode(
9077                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
9078                encoder,
9079                offset,
9080                _depth,
9081            )
9082        }
9083    }
9084    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
9085        fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D> for (T0,)
9086    {
9087        #[inline]
9088        unsafe fn encode(
9089            self,
9090            encoder: &mut fidl::encoding::Encoder<'_, D>,
9091            offset: usize,
9092            depth: fidl::encoding::Depth,
9093        ) -> fidl::Result<()> {
9094            encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
9095            // Zero out padding regions. There's no need to apply masks
9096            // because the unmasked parts will be overwritten by fields.
9097            // Write the fields.
9098            self.0.encode(encoder, offset + 0, depth)?;
9099            Ok(())
9100        }
9101    }
9102
9103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9104        for SessionControlSetShuffleModeRequest
9105    {
9106        #[inline(always)]
9107        fn new_empty() -> Self {
9108            Self { shuffle_on: fidl::new_empty!(bool, D) }
9109        }
9110
9111        #[inline]
9112        unsafe fn decode(
9113            &mut self,
9114            decoder: &mut fidl::encoding::Decoder<'_, D>,
9115            offset: usize,
9116            _depth: fidl::encoding::Depth,
9117        ) -> fidl::Result<()> {
9118            decoder.debug_check_bounds::<Self>(offset);
9119            // Verify that padding bytes are zero.
9120            fidl::decode!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
9121            Ok(())
9122        }
9123    }
9124
9125    impl fidl::encoding::ValueTypeMarker for SessionControlWatchStatusResponse {
9126        type Borrowed<'a> = &'a Self;
9127        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9128            value
9129        }
9130    }
9131
9132    unsafe impl fidl::encoding::TypeMarker for SessionControlWatchStatusResponse {
9133        type Owned = Self;
9134
9135        #[inline(always)]
9136        fn inline_align(_context: fidl::encoding::Context) -> usize {
9137            8
9138        }
9139
9140        #[inline(always)]
9141        fn inline_size(_context: fidl::encoding::Context) -> usize {
9142            16
9143        }
9144    }
9145
9146    unsafe impl<D: fidl::encoding::ResourceDialect>
9147        fidl::encoding::Encode<SessionControlWatchStatusResponse, D>
9148        for &SessionControlWatchStatusResponse
9149    {
9150        #[inline]
9151        unsafe fn encode(
9152            self,
9153            encoder: &mut fidl::encoding::Encoder<'_, D>,
9154            offset: usize,
9155            _depth: fidl::encoding::Depth,
9156        ) -> fidl::Result<()> {
9157            encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
9158            // Delegate to tuple encoding.
9159            fidl::encoding::Encode::<SessionControlWatchStatusResponse, D>::encode(
9160                (<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
9161                    &self.session_info_delta,
9162                ),),
9163                encoder,
9164                offset,
9165                _depth,
9166            )
9167        }
9168    }
9169    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
9170        fidl::encoding::Encode<SessionControlWatchStatusResponse, D> for (T0,)
9171    {
9172        #[inline]
9173        unsafe fn encode(
9174            self,
9175            encoder: &mut fidl::encoding::Encoder<'_, D>,
9176            offset: usize,
9177            depth: fidl::encoding::Depth,
9178        ) -> fidl::Result<()> {
9179            encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
9180            // Zero out padding regions. There's no need to apply masks
9181            // because the unmasked parts will be overwritten by fields.
9182            // Write the fields.
9183            self.0.encode(encoder, offset + 0, depth)?;
9184            Ok(())
9185        }
9186    }
9187
9188    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9189        for SessionControlWatchStatusResponse
9190    {
9191        #[inline(always)]
9192        fn new_empty() -> Self {
9193            Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, D) }
9194        }
9195
9196        #[inline]
9197        unsafe fn decode(
9198            &mut self,
9199            decoder: &mut fidl::encoding::Decoder<'_, D>,
9200            offset: usize,
9201            _depth: fidl::encoding::Depth,
9202        ) -> fidl::Result<()> {
9203            decoder.debug_check_bounds::<Self>(offset);
9204            // Verify that padding bytes are zero.
9205            fidl::decode!(
9206                SessionInfoDelta,
9207                D,
9208                &mut self.session_info_delta,
9209                decoder,
9210                offset + 0,
9211                _depth
9212            )?;
9213            Ok(())
9214        }
9215    }
9216
9217    impl fidl::encoding::ValueTypeMarker for SessionObserverWatchStatusResponse {
9218        type Borrowed<'a> = &'a Self;
9219        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9220            value
9221        }
9222    }
9223
9224    unsafe impl fidl::encoding::TypeMarker for SessionObserverWatchStatusResponse {
9225        type Owned = Self;
9226
9227        #[inline(always)]
9228        fn inline_align(_context: fidl::encoding::Context) -> usize {
9229            8
9230        }
9231
9232        #[inline(always)]
9233        fn inline_size(_context: fidl::encoding::Context) -> usize {
9234            16
9235        }
9236    }
9237
9238    unsafe impl<D: fidl::encoding::ResourceDialect>
9239        fidl::encoding::Encode<SessionObserverWatchStatusResponse, D>
9240        for &SessionObserverWatchStatusResponse
9241    {
9242        #[inline]
9243        unsafe fn encode(
9244            self,
9245            encoder: &mut fidl::encoding::Encoder<'_, D>,
9246            offset: usize,
9247            _depth: fidl::encoding::Depth,
9248        ) -> fidl::Result<()> {
9249            encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
9250            // Delegate to tuple encoding.
9251            fidl::encoding::Encode::<SessionObserverWatchStatusResponse, D>::encode(
9252                (<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
9253                    &self.session_info_delta,
9254                ),),
9255                encoder,
9256                offset,
9257                _depth,
9258            )
9259        }
9260    }
9261    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
9262        fidl::encoding::Encode<SessionObserverWatchStatusResponse, D> for (T0,)
9263    {
9264        #[inline]
9265        unsafe fn encode(
9266            self,
9267            encoder: &mut fidl::encoding::Encoder<'_, D>,
9268            offset: usize,
9269            depth: fidl::encoding::Depth,
9270        ) -> fidl::Result<()> {
9271            encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
9272            // Zero out padding regions. There's no need to apply masks
9273            // because the unmasked parts will be overwritten by fields.
9274            // Write the fields.
9275            self.0.encode(encoder, offset + 0, depth)?;
9276            Ok(())
9277        }
9278    }
9279
9280    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9281        for SessionObserverWatchStatusResponse
9282    {
9283        #[inline(always)]
9284        fn new_empty() -> Self {
9285            Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, D) }
9286        }
9287
9288        #[inline]
9289        unsafe fn decode(
9290            &mut self,
9291            decoder: &mut fidl::encoding::Decoder<'_, D>,
9292            offset: usize,
9293            _depth: fidl::encoding::Depth,
9294        ) -> fidl::Result<()> {
9295            decoder.debug_check_bounds::<Self>(offset);
9296            // Verify that padding bytes are zero.
9297            fidl::decode!(
9298                SessionInfoDelta,
9299                D,
9300                &mut self.session_info_delta,
9301                decoder,
9302                offset + 0,
9303                _depth
9304            )?;
9305            Ok(())
9306        }
9307    }
9308
9309    impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionRemovedRequest {
9310        type Borrowed<'a> = &'a Self;
9311        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9312            value
9313        }
9314    }
9315
9316    unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionRemovedRequest {
9317        type Owned = Self;
9318
9319        #[inline(always)]
9320        fn inline_align(_context: fidl::encoding::Context) -> usize {
9321            8
9322        }
9323
9324        #[inline(always)]
9325        fn inline_size(_context: fidl::encoding::Context) -> usize {
9326            8
9327        }
9328        #[inline(always)]
9329        fn encode_is_copy() -> bool {
9330            true
9331        }
9332
9333        #[inline(always)]
9334        fn decode_is_copy() -> bool {
9335            true
9336        }
9337    }
9338
9339    unsafe impl<D: fidl::encoding::ResourceDialect>
9340        fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, D>
9341        for &SessionsWatcherSessionRemovedRequest
9342    {
9343        #[inline]
9344        unsafe fn encode(
9345            self,
9346            encoder: &mut fidl::encoding::Encoder<'_, D>,
9347            offset: usize,
9348            _depth: fidl::encoding::Depth,
9349        ) -> fidl::Result<()> {
9350            encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
9351            unsafe {
9352                // Copy the object into the buffer.
9353                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9354                (buf_ptr as *mut SessionsWatcherSessionRemovedRequest)
9355                    .write_unaligned((self as *const SessionsWatcherSessionRemovedRequest).read());
9356                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9357                // done second because the memcpy will write garbage to these bytes.
9358            }
9359            Ok(())
9360        }
9361    }
9362    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
9363        fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, D> for (T0,)
9364    {
9365        #[inline]
9366        unsafe fn encode(
9367            self,
9368            encoder: &mut fidl::encoding::Encoder<'_, D>,
9369            offset: usize,
9370            depth: fidl::encoding::Depth,
9371        ) -> fidl::Result<()> {
9372            encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
9373            // Zero out padding regions. There's no need to apply masks
9374            // because the unmasked parts will be overwritten by fields.
9375            // Write the fields.
9376            self.0.encode(encoder, offset + 0, depth)?;
9377            Ok(())
9378        }
9379    }
9380
9381    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9382        for SessionsWatcherSessionRemovedRequest
9383    {
9384        #[inline(always)]
9385        fn new_empty() -> Self {
9386            Self { session_id: fidl::new_empty!(u64, D) }
9387        }
9388
9389        #[inline]
9390        unsafe fn decode(
9391            &mut self,
9392            decoder: &mut fidl::encoding::Decoder<'_, D>,
9393            offset: usize,
9394            _depth: fidl::encoding::Depth,
9395        ) -> fidl::Result<()> {
9396            decoder.debug_check_bounds::<Self>(offset);
9397            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9398            // Verify that padding bytes are zero.
9399            // Copy from the buffer into the object.
9400            unsafe {
9401                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
9402            }
9403            Ok(())
9404        }
9405    }
9406
9407    impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionUpdatedRequest {
9408        type Borrowed<'a> = &'a Self;
9409        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9410            value
9411        }
9412    }
9413
9414    unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionUpdatedRequest {
9415        type Owned = Self;
9416
9417        #[inline(always)]
9418        fn inline_align(_context: fidl::encoding::Context) -> usize {
9419            8
9420        }
9421
9422        #[inline(always)]
9423        fn inline_size(_context: fidl::encoding::Context) -> usize {
9424            24
9425        }
9426    }
9427
9428    unsafe impl<D: fidl::encoding::ResourceDialect>
9429        fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D>
9430        for &SessionsWatcherSessionUpdatedRequest
9431    {
9432        #[inline]
9433        unsafe fn encode(
9434            self,
9435            encoder: &mut fidl::encoding::Encoder<'_, D>,
9436            offset: usize,
9437            _depth: fidl::encoding::Depth,
9438        ) -> fidl::Result<()> {
9439            encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
9440            // Delegate to tuple encoding.
9441            fidl::encoding::Encode::<SessionsWatcherSessionUpdatedRequest, D>::encode(
9442                (
9443                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
9444                    <SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
9445                        &self.session_info_delta,
9446                    ),
9447                ),
9448                encoder,
9449                offset,
9450                _depth,
9451            )
9452        }
9453    }
9454    unsafe impl<
9455            D: fidl::encoding::ResourceDialect,
9456            T0: fidl::encoding::Encode<u64, D>,
9457            T1: fidl::encoding::Encode<SessionInfoDelta, D>,
9458        > fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D> for (T0, T1)
9459    {
9460        #[inline]
9461        unsafe fn encode(
9462            self,
9463            encoder: &mut fidl::encoding::Encoder<'_, D>,
9464            offset: usize,
9465            depth: fidl::encoding::Depth,
9466        ) -> fidl::Result<()> {
9467            encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
9468            // Zero out padding regions. There's no need to apply masks
9469            // because the unmasked parts will be overwritten by fields.
9470            // Write the fields.
9471            self.0.encode(encoder, offset + 0, depth)?;
9472            self.1.encode(encoder, offset + 8, depth)?;
9473            Ok(())
9474        }
9475    }
9476
9477    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9478        for SessionsWatcherSessionUpdatedRequest
9479    {
9480        #[inline(always)]
9481        fn new_empty() -> Self {
9482            Self {
9483                session_id: fidl::new_empty!(u64, D),
9484                session_info_delta: fidl::new_empty!(SessionInfoDelta, D),
9485            }
9486        }
9487
9488        #[inline]
9489        unsafe fn decode(
9490            &mut self,
9491            decoder: &mut fidl::encoding::Decoder<'_, D>,
9492            offset: usize,
9493            _depth: fidl::encoding::Depth,
9494        ) -> fidl::Result<()> {
9495            decoder.debug_check_bounds::<Self>(offset);
9496            // Verify that padding bytes are zero.
9497            fidl::decode!(u64, D, &mut self.session_id, decoder, offset + 0, _depth)?;
9498            fidl::decode!(
9499                SessionInfoDelta,
9500                D,
9501                &mut self.session_info_delta,
9502                decoder,
9503                offset + 8,
9504                _depth
9505            )?;
9506            Ok(())
9507        }
9508    }
9509
9510    impl MediaImage {
9511        #[inline(always)]
9512        fn max_ordinal_present(&self) -> u64 {
9513            if let Some(_) = self.sizes {
9514                return 2;
9515            }
9516            if let Some(_) = self.image_type {
9517                return 1;
9518            }
9519            0
9520        }
9521    }
9522
9523    impl fidl::encoding::ValueTypeMarker for MediaImage {
9524        type Borrowed<'a> = &'a Self;
9525        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9526            value
9527        }
9528    }
9529
9530    unsafe impl fidl::encoding::TypeMarker for MediaImage {
9531        type Owned = Self;
9532
9533        #[inline(always)]
9534        fn inline_align(_context: fidl::encoding::Context) -> usize {
9535            8
9536        }
9537
9538        #[inline(always)]
9539        fn inline_size(_context: fidl::encoding::Context) -> usize {
9540            16
9541        }
9542    }
9543
9544    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaImage, D>
9545        for &MediaImage
9546    {
9547        unsafe fn encode(
9548            self,
9549            encoder: &mut fidl::encoding::Encoder<'_, D>,
9550            offset: usize,
9551            mut depth: fidl::encoding::Depth,
9552        ) -> fidl::Result<()> {
9553            encoder.debug_check_bounds::<MediaImage>(offset);
9554            // Vector header
9555            let max_ordinal: u64 = self.max_ordinal_present();
9556            encoder.write_num(max_ordinal, offset);
9557            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9558            // Calling encoder.out_of_line_offset(0) is not allowed.
9559            if max_ordinal == 0 {
9560                return Ok(());
9561            }
9562            depth.increment()?;
9563            let envelope_size = 8;
9564            let bytes_len = max_ordinal as usize * envelope_size;
9565            #[allow(unused_variables)]
9566            let offset = encoder.out_of_line_offset(bytes_len);
9567            let mut _prev_end_offset: usize = 0;
9568            if 1 > max_ordinal {
9569                return Ok(());
9570            }
9571
9572            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9573            // are envelope_size bytes.
9574            let cur_offset: usize = (1 - 1) * envelope_size;
9575
9576            // Zero reserved fields.
9577            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9578
9579            // Safety:
9580            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9581            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9582            //   envelope_size bytes, there is always sufficient room.
9583            fidl::encoding::encode_in_envelope_optional::<MediaImageType, D>(
9584                self.image_type
9585                    .as_ref()
9586                    .map(<MediaImageType as fidl::encoding::ValueTypeMarker>::borrow),
9587                encoder,
9588                offset + cur_offset,
9589                depth,
9590            )?;
9591
9592            _prev_end_offset = cur_offset + envelope_size;
9593            if 2 > max_ordinal {
9594                return Ok(());
9595            }
9596
9597            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9598            // are envelope_size bytes.
9599            let cur_offset: usize = (2 - 1) * envelope_size;
9600
9601            // Zero reserved fields.
9602            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9603
9604            // Safety:
9605            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9606            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9607            //   envelope_size bytes, there is always sufficient room.
9608            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ImageSizeVariant, 16>, D>(
9609            self.sizes.as_ref().map(<fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::ValueTypeMarker>::borrow),
9610            encoder, offset + cur_offset, depth
9611        )?;
9612
9613            _prev_end_offset = cur_offset + envelope_size;
9614
9615            Ok(())
9616        }
9617    }
9618
9619    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImage {
9620        #[inline(always)]
9621        fn new_empty() -> Self {
9622            Self::default()
9623        }
9624
9625        unsafe fn decode(
9626            &mut self,
9627            decoder: &mut fidl::encoding::Decoder<'_, D>,
9628            offset: usize,
9629            mut depth: fidl::encoding::Depth,
9630        ) -> fidl::Result<()> {
9631            decoder.debug_check_bounds::<Self>(offset);
9632            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9633                None => return Err(fidl::Error::NotNullable),
9634                Some(len) => len,
9635            };
9636            // Calling decoder.out_of_line_offset(0) is not allowed.
9637            if len == 0 {
9638                return Ok(());
9639            };
9640            depth.increment()?;
9641            let envelope_size = 8;
9642            let bytes_len = len * envelope_size;
9643            let offset = decoder.out_of_line_offset(bytes_len)?;
9644            // Decode the envelope for each type.
9645            let mut _next_ordinal_to_read = 0;
9646            let mut next_offset = offset;
9647            let end_offset = offset + bytes_len;
9648            _next_ordinal_to_read += 1;
9649            if next_offset >= end_offset {
9650                return Ok(());
9651            }
9652
9653            // Decode unknown envelopes for gaps in ordinals.
9654            while _next_ordinal_to_read < 1 {
9655                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9656                _next_ordinal_to_read += 1;
9657                next_offset += envelope_size;
9658            }
9659
9660            let next_out_of_line = decoder.next_out_of_line();
9661            let handles_before = decoder.remaining_handles();
9662            if let Some((inlined, num_bytes, num_handles)) =
9663                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9664            {
9665                let member_inline_size =
9666                    <MediaImageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9667                if inlined != (member_inline_size <= 4) {
9668                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9669                }
9670                let inner_offset;
9671                let mut inner_depth = depth.clone();
9672                if inlined {
9673                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9674                    inner_offset = next_offset;
9675                } else {
9676                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9677                    inner_depth.increment()?;
9678                }
9679                let val_ref =
9680                    self.image_type.get_or_insert_with(|| fidl::new_empty!(MediaImageType, D));
9681                fidl::decode!(MediaImageType, D, val_ref, decoder, inner_offset, inner_depth)?;
9682                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9683                {
9684                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9685                }
9686                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9687                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9688                }
9689            }
9690
9691            next_offset += envelope_size;
9692            _next_ordinal_to_read += 1;
9693            if next_offset >= end_offset {
9694                return Ok(());
9695            }
9696
9697            // Decode unknown envelopes for gaps in ordinals.
9698            while _next_ordinal_to_read < 2 {
9699                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9700                _next_ordinal_to_read += 1;
9701                next_offset += envelope_size;
9702            }
9703
9704            let next_out_of_line = decoder.next_out_of_line();
9705            let handles_before = decoder.remaining_handles();
9706            if let Some((inlined, num_bytes, num_handles)) =
9707                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9708            {
9709                let member_inline_size = <fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9710                if inlined != (member_inline_size <= 4) {
9711                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9712                }
9713                let inner_offset;
9714                let mut inner_depth = depth.clone();
9715                if inlined {
9716                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9717                    inner_offset = next_offset;
9718                } else {
9719                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9720                    inner_depth.increment()?;
9721                }
9722                let val_ref = self.sizes.get_or_insert_with(
9723                    || fidl::new_empty!(fidl::encoding::Vector<ImageSizeVariant, 16>, D),
9724                );
9725                fidl::decode!(fidl::encoding::Vector<ImageSizeVariant, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
9726                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9727                {
9728                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9729                }
9730                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9731                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9732                }
9733            }
9734
9735            next_offset += envelope_size;
9736
9737            // Decode the remaining unknown envelopes.
9738            while next_offset < end_offset {
9739                _next_ordinal_to_read += 1;
9740                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9741                next_offset += envelope_size;
9742            }
9743
9744            Ok(())
9745        }
9746    }
9747
9748    impl PlayerCapabilities {
9749        #[inline(always)]
9750        fn max_ordinal_present(&self) -> u64 {
9751            if let Some(_) = self.flags {
9752                return 1;
9753            }
9754            0
9755        }
9756    }
9757
9758    impl fidl::encoding::ValueTypeMarker for PlayerCapabilities {
9759        type Borrowed<'a> = &'a Self;
9760        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9761            value
9762        }
9763    }
9764
9765    unsafe impl fidl::encoding::TypeMarker for PlayerCapabilities {
9766        type Owned = Self;
9767
9768        #[inline(always)]
9769        fn inline_align(_context: fidl::encoding::Context) -> usize {
9770            8
9771        }
9772
9773        #[inline(always)]
9774        fn inline_size(_context: fidl::encoding::Context) -> usize {
9775            16
9776        }
9777    }
9778
9779    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerCapabilities, D>
9780        for &PlayerCapabilities
9781    {
9782        unsafe fn encode(
9783            self,
9784            encoder: &mut fidl::encoding::Encoder<'_, D>,
9785            offset: usize,
9786            mut depth: fidl::encoding::Depth,
9787        ) -> fidl::Result<()> {
9788            encoder.debug_check_bounds::<PlayerCapabilities>(offset);
9789            // Vector header
9790            let max_ordinal: u64 = self.max_ordinal_present();
9791            encoder.write_num(max_ordinal, offset);
9792            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9793            // Calling encoder.out_of_line_offset(0) is not allowed.
9794            if max_ordinal == 0 {
9795                return Ok(());
9796            }
9797            depth.increment()?;
9798            let envelope_size = 8;
9799            let bytes_len = max_ordinal as usize * envelope_size;
9800            #[allow(unused_variables)]
9801            let offset = encoder.out_of_line_offset(bytes_len);
9802            let mut _prev_end_offset: usize = 0;
9803            if 1 > max_ordinal {
9804                return Ok(());
9805            }
9806
9807            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9808            // are envelope_size bytes.
9809            let cur_offset: usize = (1 - 1) * envelope_size;
9810
9811            // Zero reserved fields.
9812            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9813
9814            // Safety:
9815            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9816            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9817            //   envelope_size bytes, there is always sufficient room.
9818            fidl::encoding::encode_in_envelope_optional::<PlayerCapabilityFlags, D>(
9819                self.flags
9820                    .as_ref()
9821                    .map(<PlayerCapabilityFlags as fidl::encoding::ValueTypeMarker>::borrow),
9822                encoder,
9823                offset + cur_offset,
9824                depth,
9825            )?;
9826
9827            _prev_end_offset = cur_offset + envelope_size;
9828
9829            Ok(())
9830        }
9831    }
9832
9833    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilities {
9834        #[inline(always)]
9835        fn new_empty() -> Self {
9836            Self::default()
9837        }
9838
9839        unsafe fn decode(
9840            &mut self,
9841            decoder: &mut fidl::encoding::Decoder<'_, D>,
9842            offset: usize,
9843            mut depth: fidl::encoding::Depth,
9844        ) -> fidl::Result<()> {
9845            decoder.debug_check_bounds::<Self>(offset);
9846            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9847                None => return Err(fidl::Error::NotNullable),
9848                Some(len) => len,
9849            };
9850            // Calling decoder.out_of_line_offset(0) is not allowed.
9851            if len == 0 {
9852                return Ok(());
9853            };
9854            depth.increment()?;
9855            let envelope_size = 8;
9856            let bytes_len = len * envelope_size;
9857            let offset = decoder.out_of_line_offset(bytes_len)?;
9858            // Decode the envelope for each type.
9859            let mut _next_ordinal_to_read = 0;
9860            let mut next_offset = offset;
9861            let end_offset = offset + bytes_len;
9862            _next_ordinal_to_read += 1;
9863            if next_offset >= end_offset {
9864                return Ok(());
9865            }
9866
9867            // Decode unknown envelopes for gaps in ordinals.
9868            while _next_ordinal_to_read < 1 {
9869                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9870                _next_ordinal_to_read += 1;
9871                next_offset += envelope_size;
9872            }
9873
9874            let next_out_of_line = decoder.next_out_of_line();
9875            let handles_before = decoder.remaining_handles();
9876            if let Some((inlined, num_bytes, num_handles)) =
9877                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9878            {
9879                let member_inline_size =
9880                    <PlayerCapabilityFlags as fidl::encoding::TypeMarker>::inline_size(
9881                        decoder.context,
9882                    );
9883                if inlined != (member_inline_size <= 4) {
9884                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9885                }
9886                let inner_offset;
9887                let mut inner_depth = depth.clone();
9888                if inlined {
9889                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9890                    inner_offset = next_offset;
9891                } else {
9892                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9893                    inner_depth.increment()?;
9894                }
9895                let val_ref =
9896                    self.flags.get_or_insert_with(|| fidl::new_empty!(PlayerCapabilityFlags, D));
9897                fidl::decode!(
9898                    PlayerCapabilityFlags,
9899                    D,
9900                    val_ref,
9901                    decoder,
9902                    inner_offset,
9903                    inner_depth
9904                )?;
9905                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9906                {
9907                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9908                }
9909                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9910                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9911                }
9912            }
9913
9914            next_offset += envelope_size;
9915
9916            // Decode the remaining unknown envelopes.
9917            while next_offset < end_offset {
9918                _next_ordinal_to_read += 1;
9919                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9920                next_offset += envelope_size;
9921            }
9922
9923            Ok(())
9924        }
9925    }
9926
9927    impl PlayerInfoDelta {
9928        #[inline(always)]
9929        fn max_ordinal_present(&self) -> u64 {
9930            if let Some(_) = self.interruption_behavior {
9931                return 6;
9932            }
9933            if let Some(_) = self.player_capabilities {
9934                return 5;
9935            }
9936            if let Some(_) = self.media_images {
9937                return 4;
9938            }
9939            if let Some(_) = self.metadata {
9940                return 3;
9941            }
9942            if let Some(_) = self.player_status {
9943                return 2;
9944            }
9945            if let Some(_) = self.local {
9946                return 1;
9947            }
9948            0
9949        }
9950    }
9951
9952    impl fidl::encoding::ValueTypeMarker for PlayerInfoDelta {
9953        type Borrowed<'a> = &'a Self;
9954        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9955            value
9956        }
9957    }
9958
9959    unsafe impl fidl::encoding::TypeMarker for PlayerInfoDelta {
9960        type Owned = Self;
9961
9962        #[inline(always)]
9963        fn inline_align(_context: fidl::encoding::Context) -> usize {
9964            8
9965        }
9966
9967        #[inline(always)]
9968        fn inline_size(_context: fidl::encoding::Context) -> usize {
9969            16
9970        }
9971    }
9972
9973    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerInfoDelta, D>
9974        for &PlayerInfoDelta
9975    {
9976        unsafe fn encode(
9977            self,
9978            encoder: &mut fidl::encoding::Encoder<'_, D>,
9979            offset: usize,
9980            mut depth: fidl::encoding::Depth,
9981        ) -> fidl::Result<()> {
9982            encoder.debug_check_bounds::<PlayerInfoDelta>(offset);
9983            // Vector header
9984            let max_ordinal: u64 = self.max_ordinal_present();
9985            encoder.write_num(max_ordinal, offset);
9986            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9987            // Calling encoder.out_of_line_offset(0) is not allowed.
9988            if max_ordinal == 0 {
9989                return Ok(());
9990            }
9991            depth.increment()?;
9992            let envelope_size = 8;
9993            let bytes_len = max_ordinal as usize * envelope_size;
9994            #[allow(unused_variables)]
9995            let offset = encoder.out_of_line_offset(bytes_len);
9996            let mut _prev_end_offset: usize = 0;
9997            if 1 > max_ordinal {
9998                return Ok(());
9999            }
10000
10001            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10002            // are envelope_size bytes.
10003            let cur_offset: usize = (1 - 1) * envelope_size;
10004
10005            // Zero reserved fields.
10006            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10007
10008            // Safety:
10009            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10010            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10011            //   envelope_size bytes, there is always sufficient room.
10012            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10013                self.local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10014                encoder,
10015                offset + cur_offset,
10016                depth,
10017            )?;
10018
10019            _prev_end_offset = cur_offset + envelope_size;
10020            if 2 > max_ordinal {
10021                return Ok(());
10022            }
10023
10024            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10025            // are envelope_size bytes.
10026            let cur_offset: usize = (2 - 1) * envelope_size;
10027
10028            // Zero reserved fields.
10029            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10030
10031            // Safety:
10032            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10033            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10034            //   envelope_size bytes, there is always sufficient room.
10035            fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
10036                self.player_status
10037                    .as_ref()
10038                    .map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
10039                encoder,
10040                offset + cur_offset,
10041                depth,
10042            )?;
10043
10044            _prev_end_offset = cur_offset + envelope_size;
10045            if 3 > max_ordinal {
10046                return Ok(());
10047            }
10048
10049            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10050            // are envelope_size bytes.
10051            let cur_offset: usize = (3 - 1) * envelope_size;
10052
10053            // Zero reserved fields.
10054            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10055
10056            // Safety:
10057            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10058            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10059            //   envelope_size bytes, there is always sufficient room.
10060            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::Metadata, D>(
10061                self.metadata
10062                    .as_ref()
10063                    .map(<fidl_fuchsia_media::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
10064                encoder,
10065                offset + cur_offset,
10066                depth,
10067            )?;
10068
10069            _prev_end_offset = cur_offset + envelope_size;
10070            if 4 > max_ordinal {
10071                return Ok(());
10072            }
10073
10074            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10075            // are envelope_size bytes.
10076            let cur_offset: usize = (4 - 1) * envelope_size;
10077
10078            // Zero reserved fields.
10079            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10080
10081            // Safety:
10082            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10083            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10084            //   envelope_size bytes, there is always sufficient room.
10085            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MediaImage, 16>, D>(
10086            self.media_images.as_ref().map(<fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::ValueTypeMarker>::borrow),
10087            encoder, offset + cur_offset, depth
10088        )?;
10089
10090            _prev_end_offset = cur_offset + envelope_size;
10091            if 5 > max_ordinal {
10092                return Ok(());
10093            }
10094
10095            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10096            // are envelope_size bytes.
10097            let cur_offset: usize = (5 - 1) * envelope_size;
10098
10099            // Zero reserved fields.
10100            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10101
10102            // Safety:
10103            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10104            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10105            //   envelope_size bytes, there is always sufficient room.
10106            fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
10107                self.player_capabilities
10108                    .as_ref()
10109                    .map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
10110                encoder,
10111                offset + cur_offset,
10112                depth,
10113            )?;
10114
10115            _prev_end_offset = cur_offset + envelope_size;
10116            if 6 > max_ordinal {
10117                return Ok(());
10118            }
10119
10120            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10121            // are envelope_size bytes.
10122            let cur_offset: usize = (6 - 1) * envelope_size;
10123
10124            // Zero reserved fields.
10125            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10126
10127            // Safety:
10128            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10129            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10130            //   envelope_size bytes, there is always sufficient room.
10131            fidl::encoding::encode_in_envelope_optional::<InterruptionBehavior, D>(
10132                self.interruption_behavior
10133                    .as_ref()
10134                    .map(<InterruptionBehavior as fidl::encoding::ValueTypeMarker>::borrow),
10135                encoder,
10136                offset + cur_offset,
10137                depth,
10138            )?;
10139
10140            _prev_end_offset = cur_offset + envelope_size;
10141
10142            Ok(())
10143        }
10144    }
10145
10146    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerInfoDelta {
10147        #[inline(always)]
10148        fn new_empty() -> Self {
10149            Self::default()
10150        }
10151
10152        unsafe fn decode(
10153            &mut self,
10154            decoder: &mut fidl::encoding::Decoder<'_, D>,
10155            offset: usize,
10156            mut depth: fidl::encoding::Depth,
10157        ) -> fidl::Result<()> {
10158            decoder.debug_check_bounds::<Self>(offset);
10159            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10160                None => return Err(fidl::Error::NotNullable),
10161                Some(len) => len,
10162            };
10163            // Calling decoder.out_of_line_offset(0) is not allowed.
10164            if len == 0 {
10165                return Ok(());
10166            };
10167            depth.increment()?;
10168            let envelope_size = 8;
10169            let bytes_len = len * envelope_size;
10170            let offset = decoder.out_of_line_offset(bytes_len)?;
10171            // Decode the envelope for each type.
10172            let mut _next_ordinal_to_read = 0;
10173            let mut next_offset = offset;
10174            let end_offset = offset + bytes_len;
10175            _next_ordinal_to_read += 1;
10176            if next_offset >= end_offset {
10177                return Ok(());
10178            }
10179
10180            // Decode unknown envelopes for gaps in ordinals.
10181            while _next_ordinal_to_read < 1 {
10182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10183                _next_ordinal_to_read += 1;
10184                next_offset += envelope_size;
10185            }
10186
10187            let next_out_of_line = decoder.next_out_of_line();
10188            let handles_before = decoder.remaining_handles();
10189            if let Some((inlined, num_bytes, num_handles)) =
10190                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10191            {
10192                let member_inline_size =
10193                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10194                if inlined != (member_inline_size <= 4) {
10195                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10196                }
10197                let inner_offset;
10198                let mut inner_depth = depth.clone();
10199                if inlined {
10200                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10201                    inner_offset = next_offset;
10202                } else {
10203                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10204                    inner_depth.increment()?;
10205                }
10206                let val_ref = self.local.get_or_insert_with(|| fidl::new_empty!(bool, D));
10207                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10208                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10209                {
10210                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10211                }
10212                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10213                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10214                }
10215            }
10216
10217            next_offset += envelope_size;
10218            _next_ordinal_to_read += 1;
10219            if next_offset >= end_offset {
10220                return Ok(());
10221            }
10222
10223            // Decode unknown envelopes for gaps in ordinals.
10224            while _next_ordinal_to_read < 2 {
10225                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10226                _next_ordinal_to_read += 1;
10227                next_offset += envelope_size;
10228            }
10229
10230            let next_out_of_line = decoder.next_out_of_line();
10231            let handles_before = decoder.remaining_handles();
10232            if let Some((inlined, num_bytes, num_handles)) =
10233                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10234            {
10235                let member_inline_size =
10236                    <PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10237                if inlined != (member_inline_size <= 4) {
10238                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10239                }
10240                let inner_offset;
10241                let mut inner_depth = depth.clone();
10242                if inlined {
10243                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10244                    inner_offset = next_offset;
10245                } else {
10246                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10247                    inner_depth.increment()?;
10248                }
10249                let val_ref =
10250                    self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
10251                fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
10252                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10253                {
10254                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10255                }
10256                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10257                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10258                }
10259            }
10260
10261            next_offset += envelope_size;
10262            _next_ordinal_to_read += 1;
10263            if next_offset >= end_offset {
10264                return Ok(());
10265            }
10266
10267            // Decode unknown envelopes for gaps in ordinals.
10268            while _next_ordinal_to_read < 3 {
10269                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10270                _next_ordinal_to_read += 1;
10271                next_offset += envelope_size;
10272            }
10273
10274            let next_out_of_line = decoder.next_out_of_line();
10275            let handles_before = decoder.remaining_handles();
10276            if let Some((inlined, num_bytes, num_handles)) =
10277                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10278            {
10279                let member_inline_size =
10280                    <fidl_fuchsia_media::Metadata as fidl::encoding::TypeMarker>::inline_size(
10281                        decoder.context,
10282                    );
10283                if inlined != (member_inline_size <= 4) {
10284                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10285                }
10286                let inner_offset;
10287                let mut inner_depth = depth.clone();
10288                if inlined {
10289                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10290                    inner_offset = next_offset;
10291                } else {
10292                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10293                    inner_depth.increment()?;
10294                }
10295                let val_ref = self
10296                    .metadata
10297                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::Metadata, D));
10298                fidl::decode!(
10299                    fidl_fuchsia_media::Metadata,
10300                    D,
10301                    val_ref,
10302                    decoder,
10303                    inner_offset,
10304                    inner_depth
10305                )?;
10306                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10307                {
10308                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10309                }
10310                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10311                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10312                }
10313            }
10314
10315            next_offset += envelope_size;
10316            _next_ordinal_to_read += 1;
10317            if next_offset >= end_offset {
10318                return Ok(());
10319            }
10320
10321            // Decode unknown envelopes for gaps in ordinals.
10322            while _next_ordinal_to_read < 4 {
10323                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10324                _next_ordinal_to_read += 1;
10325                next_offset += envelope_size;
10326            }
10327
10328            let next_out_of_line = decoder.next_out_of_line();
10329            let handles_before = decoder.remaining_handles();
10330            if let Some((inlined, num_bytes, num_handles)) =
10331                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10332            {
10333                let member_inline_size = <fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10334                if inlined != (member_inline_size <= 4) {
10335                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10336                }
10337                let inner_offset;
10338                let mut inner_depth = depth.clone();
10339                if inlined {
10340                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10341                    inner_offset = next_offset;
10342                } else {
10343                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10344                    inner_depth.increment()?;
10345                }
10346                let val_ref = self.media_images.get_or_insert_with(
10347                    || fidl::new_empty!(fidl::encoding::Vector<MediaImage, 16>, D),
10348                );
10349                fidl::decode!(fidl::encoding::Vector<MediaImage, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
10350                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10351                {
10352                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10353                }
10354                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10355                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10356                }
10357            }
10358
10359            next_offset += envelope_size;
10360            _next_ordinal_to_read += 1;
10361            if next_offset >= end_offset {
10362                return Ok(());
10363            }
10364
10365            // Decode unknown envelopes for gaps in ordinals.
10366            while _next_ordinal_to_read < 5 {
10367                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10368                _next_ordinal_to_read += 1;
10369                next_offset += envelope_size;
10370            }
10371
10372            let next_out_of_line = decoder.next_out_of_line();
10373            let handles_before = decoder.remaining_handles();
10374            if let Some((inlined, num_bytes, num_handles)) =
10375                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10376            {
10377                let member_inline_size =
10378                    <PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
10379                        decoder.context,
10380                    );
10381                if inlined != (member_inline_size <= 4) {
10382                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10383                }
10384                let inner_offset;
10385                let mut inner_depth = depth.clone();
10386                if inlined {
10387                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10388                    inner_offset = next_offset;
10389                } else {
10390                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10391                    inner_depth.increment()?;
10392                }
10393                let val_ref = self
10394                    .player_capabilities
10395                    .get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
10396                fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
10397                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10398                {
10399                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10400                }
10401                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10402                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10403                }
10404            }
10405
10406            next_offset += envelope_size;
10407            _next_ordinal_to_read += 1;
10408            if next_offset >= end_offset {
10409                return Ok(());
10410            }
10411
10412            // Decode unknown envelopes for gaps in ordinals.
10413            while _next_ordinal_to_read < 6 {
10414                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10415                _next_ordinal_to_read += 1;
10416                next_offset += envelope_size;
10417            }
10418
10419            let next_out_of_line = decoder.next_out_of_line();
10420            let handles_before = decoder.remaining_handles();
10421            if let Some((inlined, num_bytes, num_handles)) =
10422                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10423            {
10424                let member_inline_size =
10425                    <InterruptionBehavior as fidl::encoding::TypeMarker>::inline_size(
10426                        decoder.context,
10427                    );
10428                if inlined != (member_inline_size <= 4) {
10429                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10430                }
10431                let inner_offset;
10432                let mut inner_depth = depth.clone();
10433                if inlined {
10434                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10435                    inner_offset = next_offset;
10436                } else {
10437                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10438                    inner_depth.increment()?;
10439                }
10440                let val_ref = self
10441                    .interruption_behavior
10442                    .get_or_insert_with(|| fidl::new_empty!(InterruptionBehavior, D));
10443                fidl::decode!(
10444                    InterruptionBehavior,
10445                    D,
10446                    val_ref,
10447                    decoder,
10448                    inner_offset,
10449                    inner_depth
10450                )?;
10451                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10452                {
10453                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10454                }
10455                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10456                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10457                }
10458            }
10459
10460            next_offset += envelope_size;
10461
10462            // Decode the remaining unknown envelopes.
10463            while next_offset < end_offset {
10464                _next_ordinal_to_read += 1;
10465                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10466                next_offset += envelope_size;
10467            }
10468
10469            Ok(())
10470        }
10471    }
10472
10473    impl PlayerRegistration {
10474        #[inline(always)]
10475        fn max_ordinal_present(&self) -> u64 {
10476            if let Some(_) = self.usage2 {
10477                return 3;
10478            }
10479            if let Some(_) = self.usage {
10480                return 2;
10481            }
10482            if let Some(_) = self.domain {
10483                return 1;
10484            }
10485            0
10486        }
10487    }
10488
10489    impl fidl::encoding::ValueTypeMarker for PlayerRegistration {
10490        type Borrowed<'a> = &'a Self;
10491        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10492            value
10493        }
10494    }
10495
10496    unsafe impl fidl::encoding::TypeMarker for PlayerRegistration {
10497        type Owned = Self;
10498
10499        #[inline(always)]
10500        fn inline_align(_context: fidl::encoding::Context) -> usize {
10501            8
10502        }
10503
10504        #[inline(always)]
10505        fn inline_size(_context: fidl::encoding::Context) -> usize {
10506            16
10507        }
10508    }
10509
10510    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerRegistration, D>
10511        for &PlayerRegistration
10512    {
10513        unsafe fn encode(
10514            self,
10515            encoder: &mut fidl::encoding::Encoder<'_, D>,
10516            offset: usize,
10517            mut depth: fidl::encoding::Depth,
10518        ) -> fidl::Result<()> {
10519            encoder.debug_check_bounds::<PlayerRegistration>(offset);
10520            // Vector header
10521            let max_ordinal: u64 = self.max_ordinal_present();
10522            encoder.write_num(max_ordinal, offset);
10523            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10524            // Calling encoder.out_of_line_offset(0) is not allowed.
10525            if max_ordinal == 0 {
10526                return Ok(());
10527            }
10528            depth.increment()?;
10529            let envelope_size = 8;
10530            let bytes_len = max_ordinal as usize * envelope_size;
10531            #[allow(unused_variables)]
10532            let offset = encoder.out_of_line_offset(bytes_len);
10533            let mut _prev_end_offset: usize = 0;
10534            if 1 > max_ordinal {
10535                return Ok(());
10536            }
10537
10538            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10539            // are envelope_size bytes.
10540            let cur_offset: usize = (1 - 1) * envelope_size;
10541
10542            // Zero reserved fields.
10543            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10544
10545            // Safety:
10546            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10547            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10548            //   envelope_size bytes, there is always sufficient room.
10549            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
10550            self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
10551            encoder, offset + cur_offset, depth
10552        )?;
10553
10554            _prev_end_offset = cur_offset + envelope_size;
10555            if 2 > max_ordinal {
10556                return Ok(());
10557            }
10558
10559            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10560            // are envelope_size bytes.
10561            let cur_offset: usize = (2 - 1) * envelope_size;
10562
10563            // Zero reserved fields.
10564            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10565
10566            // Safety:
10567            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10568            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10569            //   envelope_size bytes, there is always sufficient room.
10570            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage, D>(
10571            self.usage.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow),
10572            encoder, offset + cur_offset, depth
10573        )?;
10574
10575            _prev_end_offset = cur_offset + envelope_size;
10576            if 3 > max_ordinal {
10577                return Ok(());
10578            }
10579
10580            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10581            // are envelope_size bytes.
10582            let cur_offset: usize = (3 - 1) * envelope_size;
10583
10584            // Zero reserved fields.
10585            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10586
10587            // Safety:
10588            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10589            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10590            //   envelope_size bytes, there is always sufficient room.
10591            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage2, D>(
10592            self.usage2.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow),
10593            encoder, offset + cur_offset, depth
10594        )?;
10595
10596            _prev_end_offset = cur_offset + envelope_size;
10597
10598            Ok(())
10599        }
10600    }
10601
10602    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerRegistration {
10603        #[inline(always)]
10604        fn new_empty() -> Self {
10605            Self::default()
10606        }
10607
10608        unsafe fn decode(
10609            &mut self,
10610            decoder: &mut fidl::encoding::Decoder<'_, D>,
10611            offset: usize,
10612            mut depth: fidl::encoding::Depth,
10613        ) -> fidl::Result<()> {
10614            decoder.debug_check_bounds::<Self>(offset);
10615            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10616                None => return Err(fidl::Error::NotNullable),
10617                Some(len) => len,
10618            };
10619            // Calling decoder.out_of_line_offset(0) is not allowed.
10620            if len == 0 {
10621                return Ok(());
10622            };
10623            depth.increment()?;
10624            let envelope_size = 8;
10625            let bytes_len = len * envelope_size;
10626            let offset = decoder.out_of_line_offset(bytes_len)?;
10627            // Decode the envelope for each type.
10628            let mut _next_ordinal_to_read = 0;
10629            let mut next_offset = offset;
10630            let end_offset = offset + bytes_len;
10631            _next_ordinal_to_read += 1;
10632            if next_offset >= end_offset {
10633                return Ok(());
10634            }
10635
10636            // Decode unknown envelopes for gaps in ordinals.
10637            while _next_ordinal_to_read < 1 {
10638                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10639                _next_ordinal_to_read += 1;
10640                next_offset += envelope_size;
10641            }
10642
10643            let next_out_of_line = decoder.next_out_of_line();
10644            let handles_before = decoder.remaining_handles();
10645            if let Some((inlined, num_bytes, num_handles)) =
10646                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10647            {
10648                let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10649                if inlined != (member_inline_size <= 4) {
10650                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10651                }
10652                let inner_offset;
10653                let mut inner_depth = depth.clone();
10654                if inlined {
10655                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10656                    inner_offset = next_offset;
10657                } else {
10658                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10659                    inner_depth.increment()?;
10660                }
10661                let val_ref = self.domain.get_or_insert_with(|| {
10662                    fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
10663                });
10664                fidl::decode!(
10665                    fidl::encoding::BoundedString<1000>,
10666                    D,
10667                    val_ref,
10668                    decoder,
10669                    inner_offset,
10670                    inner_depth
10671                )?;
10672                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10673                {
10674                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10675                }
10676                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10677                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10678                }
10679            }
10680
10681            next_offset += envelope_size;
10682            _next_ordinal_to_read += 1;
10683            if next_offset >= end_offset {
10684                return Ok(());
10685            }
10686
10687            // Decode unknown envelopes for gaps in ordinals.
10688            while _next_ordinal_to_read < 2 {
10689                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10690                _next_ordinal_to_read += 1;
10691                next_offset += envelope_size;
10692            }
10693
10694            let next_out_of_line = decoder.next_out_of_line();
10695            let handles_before = decoder.remaining_handles();
10696            if let Some((inlined, num_bytes, num_handles)) =
10697                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10698            {
10699                let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10700                if inlined != (member_inline_size <= 4) {
10701                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10702                }
10703                let inner_offset;
10704                let mut inner_depth = depth.clone();
10705                if inlined {
10706                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10707                    inner_offset = next_offset;
10708                } else {
10709                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10710                    inner_depth.increment()?;
10711                }
10712                let val_ref = self.usage.get_or_insert_with(|| {
10713                    fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D)
10714                });
10715                fidl::decode!(
10716                    fidl_fuchsia_media::AudioRenderUsage,
10717                    D,
10718                    val_ref,
10719                    decoder,
10720                    inner_offset,
10721                    inner_depth
10722                )?;
10723                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10724                {
10725                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10726                }
10727                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10728                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10729                }
10730            }
10731
10732            next_offset += envelope_size;
10733            _next_ordinal_to_read += 1;
10734            if next_offset >= end_offset {
10735                return Ok(());
10736            }
10737
10738            // Decode unknown envelopes for gaps in ordinals.
10739            while _next_ordinal_to_read < 3 {
10740                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10741                _next_ordinal_to_read += 1;
10742                next_offset += envelope_size;
10743            }
10744
10745            let next_out_of_line = decoder.next_out_of_line();
10746            let handles_before = decoder.remaining_handles();
10747            if let Some((inlined, num_bytes, num_handles)) =
10748                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10749            {
10750                let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10751                if inlined != (member_inline_size <= 4) {
10752                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10753                }
10754                let inner_offset;
10755                let mut inner_depth = depth.clone();
10756                if inlined {
10757                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10758                    inner_offset = next_offset;
10759                } else {
10760                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10761                    inner_depth.increment()?;
10762                }
10763                let val_ref = self.usage2.get_or_insert_with(|| {
10764                    fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage2, D)
10765                });
10766                fidl::decode!(
10767                    fidl_fuchsia_media::AudioRenderUsage2,
10768                    D,
10769                    val_ref,
10770                    decoder,
10771                    inner_offset,
10772                    inner_depth
10773                )?;
10774                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10775                {
10776                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10777                }
10778                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10779                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10780                }
10781            }
10782
10783            next_offset += envelope_size;
10784
10785            // Decode the remaining unknown envelopes.
10786            while next_offset < end_offset {
10787                _next_ordinal_to_read += 1;
10788                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10789                next_offset += envelope_size;
10790            }
10791
10792            Ok(())
10793        }
10794    }
10795
10796    impl PlayerStatus {
10797        #[inline(always)]
10798        fn max_ordinal_present(&self) -> u64 {
10799            if let Some(_) = self.is_live {
10800                return 8;
10801            }
10802            if let Some(_) = self.error {
10803                return 7;
10804            }
10805            if let Some(_) = self.content_type {
10806                return 6;
10807            }
10808            if let Some(_) = self.shuffle_on {
10809                return 5;
10810            }
10811            if let Some(_) = self.repeat_mode {
10812                return 4;
10813            }
10814            if let Some(_) = self.timeline_function {
10815                return 3;
10816            }
10817            if let Some(_) = self.player_state {
10818                return 2;
10819            }
10820            if let Some(_) = self.duration {
10821                return 1;
10822            }
10823            0
10824        }
10825    }
10826
10827    impl fidl::encoding::ValueTypeMarker for PlayerStatus {
10828        type Borrowed<'a> = &'a Self;
10829        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10830            value
10831        }
10832    }
10833
10834    unsafe impl fidl::encoding::TypeMarker for PlayerStatus {
10835        type Owned = Self;
10836
10837        #[inline(always)]
10838        fn inline_align(_context: fidl::encoding::Context) -> usize {
10839            8
10840        }
10841
10842        #[inline(always)]
10843        fn inline_size(_context: fidl::encoding::Context) -> usize {
10844            16
10845        }
10846    }
10847
10848    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerStatus, D>
10849        for &PlayerStatus
10850    {
10851        unsafe fn encode(
10852            self,
10853            encoder: &mut fidl::encoding::Encoder<'_, D>,
10854            offset: usize,
10855            mut depth: fidl::encoding::Depth,
10856        ) -> fidl::Result<()> {
10857            encoder.debug_check_bounds::<PlayerStatus>(offset);
10858            // Vector header
10859            let max_ordinal: u64 = self.max_ordinal_present();
10860            encoder.write_num(max_ordinal, offset);
10861            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10862            // Calling encoder.out_of_line_offset(0) is not allowed.
10863            if max_ordinal == 0 {
10864                return Ok(());
10865            }
10866            depth.increment()?;
10867            let envelope_size = 8;
10868            let bytes_len = max_ordinal as usize * envelope_size;
10869            #[allow(unused_variables)]
10870            let offset = encoder.out_of_line_offset(bytes_len);
10871            let mut _prev_end_offset: usize = 0;
10872            if 1 > max_ordinal {
10873                return Ok(());
10874            }
10875
10876            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10877            // are envelope_size bytes.
10878            let cur_offset: usize = (1 - 1) * envelope_size;
10879
10880            // Zero reserved fields.
10881            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10882
10883            // Safety:
10884            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10885            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10886            //   envelope_size bytes, there is always sufficient room.
10887            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10888                self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10889                encoder,
10890                offset + cur_offset,
10891                depth,
10892            )?;
10893
10894            _prev_end_offset = cur_offset + envelope_size;
10895            if 2 > max_ordinal {
10896                return Ok(());
10897            }
10898
10899            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10900            // are envelope_size bytes.
10901            let cur_offset: usize = (2 - 1) * envelope_size;
10902
10903            // Zero reserved fields.
10904            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10905
10906            // Safety:
10907            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10908            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10909            //   envelope_size bytes, there is always sufficient room.
10910            fidl::encoding::encode_in_envelope_optional::<PlayerState, D>(
10911                self.player_state
10912                    .as_ref()
10913                    .map(<PlayerState as fidl::encoding::ValueTypeMarker>::borrow),
10914                encoder,
10915                offset + cur_offset,
10916                depth,
10917            )?;
10918
10919            _prev_end_offset = cur_offset + envelope_size;
10920            if 3 > max_ordinal {
10921                return Ok(());
10922            }
10923
10924            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10925            // are envelope_size bytes.
10926            let cur_offset: usize = (3 - 1) * envelope_size;
10927
10928            // Zero reserved fields.
10929            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10930
10931            // Safety:
10932            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10933            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10934            //   envelope_size bytes, there is always sufficient room.
10935            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::TimelineFunction, D>(
10936            self.timeline_function.as_ref().map(<fidl_fuchsia_media::TimelineFunction as fidl::encoding::ValueTypeMarker>::borrow),
10937            encoder, offset + cur_offset, depth
10938        )?;
10939
10940            _prev_end_offset = cur_offset + envelope_size;
10941            if 4 > max_ordinal {
10942                return Ok(());
10943            }
10944
10945            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10946            // are envelope_size bytes.
10947            let cur_offset: usize = (4 - 1) * envelope_size;
10948
10949            // Zero reserved fields.
10950            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10951
10952            // Safety:
10953            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10954            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10955            //   envelope_size bytes, there is always sufficient room.
10956            fidl::encoding::encode_in_envelope_optional::<RepeatMode, D>(
10957                self.repeat_mode
10958                    .as_ref()
10959                    .map(<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow),
10960                encoder,
10961                offset + cur_offset,
10962                depth,
10963            )?;
10964
10965            _prev_end_offset = cur_offset + envelope_size;
10966            if 5 > max_ordinal {
10967                return Ok(());
10968            }
10969
10970            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10971            // are envelope_size bytes.
10972            let cur_offset: usize = (5 - 1) * envelope_size;
10973
10974            // Zero reserved fields.
10975            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10976
10977            // Safety:
10978            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10979            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10980            //   envelope_size bytes, there is always sufficient room.
10981            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10982                self.shuffle_on.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10983                encoder,
10984                offset + cur_offset,
10985                depth,
10986            )?;
10987
10988            _prev_end_offset = cur_offset + envelope_size;
10989            if 6 > max_ordinal {
10990                return Ok(());
10991            }
10992
10993            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10994            // are envelope_size bytes.
10995            let cur_offset: usize = (6 - 1) * envelope_size;
10996
10997            // Zero reserved fields.
10998            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10999
11000            // Safety:
11001            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11002            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11003            //   envelope_size bytes, there is always sufficient room.
11004            fidl::encoding::encode_in_envelope_optional::<ContentType, D>(
11005                self.content_type
11006                    .as_ref()
11007                    .map(<ContentType as fidl::encoding::ValueTypeMarker>::borrow),
11008                encoder,
11009                offset + cur_offset,
11010                depth,
11011            )?;
11012
11013            _prev_end_offset = cur_offset + envelope_size;
11014            if 7 > max_ordinal {
11015                return Ok(());
11016            }
11017
11018            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11019            // are envelope_size bytes.
11020            let cur_offset: usize = (7 - 1) * envelope_size;
11021
11022            // Zero reserved fields.
11023            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11024
11025            // Safety:
11026            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11027            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11028            //   envelope_size bytes, there is always sufficient room.
11029            fidl::encoding::encode_in_envelope_optional::<Error, D>(
11030                self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
11031                encoder,
11032                offset + cur_offset,
11033                depth,
11034            )?;
11035
11036            _prev_end_offset = cur_offset + envelope_size;
11037            if 8 > max_ordinal {
11038                return Ok(());
11039            }
11040
11041            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11042            // are envelope_size bytes.
11043            let cur_offset: usize = (8 - 1) * envelope_size;
11044
11045            // Zero reserved fields.
11046            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11047
11048            // Safety:
11049            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11050            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11051            //   envelope_size bytes, there is always sufficient room.
11052            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11053                self.is_live.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11054                encoder,
11055                offset + cur_offset,
11056                depth,
11057            )?;
11058
11059            _prev_end_offset = cur_offset + envelope_size;
11060
11061            Ok(())
11062        }
11063    }
11064
11065    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerStatus {
11066        #[inline(always)]
11067        fn new_empty() -> Self {
11068            Self::default()
11069        }
11070
11071        unsafe fn decode(
11072            &mut self,
11073            decoder: &mut fidl::encoding::Decoder<'_, D>,
11074            offset: usize,
11075            mut depth: fidl::encoding::Depth,
11076        ) -> fidl::Result<()> {
11077            decoder.debug_check_bounds::<Self>(offset);
11078            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11079                None => return Err(fidl::Error::NotNullable),
11080                Some(len) => len,
11081            };
11082            // Calling decoder.out_of_line_offset(0) is not allowed.
11083            if len == 0 {
11084                return Ok(());
11085            };
11086            depth.increment()?;
11087            let envelope_size = 8;
11088            let bytes_len = len * envelope_size;
11089            let offset = decoder.out_of_line_offset(bytes_len)?;
11090            // Decode the envelope for each type.
11091            let mut _next_ordinal_to_read = 0;
11092            let mut next_offset = offset;
11093            let end_offset = offset + bytes_len;
11094            _next_ordinal_to_read += 1;
11095            if next_offset >= end_offset {
11096                return Ok(());
11097            }
11098
11099            // Decode unknown envelopes for gaps in ordinals.
11100            while _next_ordinal_to_read < 1 {
11101                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11102                _next_ordinal_to_read += 1;
11103                next_offset += envelope_size;
11104            }
11105
11106            let next_out_of_line = decoder.next_out_of_line();
11107            let handles_before = decoder.remaining_handles();
11108            if let Some((inlined, num_bytes, num_handles)) =
11109                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11110            {
11111                let member_inline_size =
11112                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11113                if inlined != (member_inline_size <= 4) {
11114                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11115                }
11116                let inner_offset;
11117                let mut inner_depth = depth.clone();
11118                if inlined {
11119                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11120                    inner_offset = next_offset;
11121                } else {
11122                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11123                    inner_depth.increment()?;
11124                }
11125                let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
11126                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
11127                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11128                {
11129                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11130                }
11131                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11132                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11133                }
11134            }
11135
11136            next_offset += envelope_size;
11137            _next_ordinal_to_read += 1;
11138            if next_offset >= end_offset {
11139                return Ok(());
11140            }
11141
11142            // Decode unknown envelopes for gaps in ordinals.
11143            while _next_ordinal_to_read < 2 {
11144                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11145                _next_ordinal_to_read += 1;
11146                next_offset += envelope_size;
11147            }
11148
11149            let next_out_of_line = decoder.next_out_of_line();
11150            let handles_before = decoder.remaining_handles();
11151            if let Some((inlined, num_bytes, num_handles)) =
11152                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11153            {
11154                let member_inline_size =
11155                    <PlayerState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11156                if inlined != (member_inline_size <= 4) {
11157                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11158                }
11159                let inner_offset;
11160                let mut inner_depth = depth.clone();
11161                if inlined {
11162                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11163                    inner_offset = next_offset;
11164                } else {
11165                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11166                    inner_depth.increment()?;
11167                }
11168                let val_ref =
11169                    self.player_state.get_or_insert_with(|| fidl::new_empty!(PlayerState, D));
11170                fidl::decode!(PlayerState, D, val_ref, decoder, inner_offset, inner_depth)?;
11171                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11172                {
11173                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11174                }
11175                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11176                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11177                }
11178            }
11179
11180            next_offset += envelope_size;
11181            _next_ordinal_to_read += 1;
11182            if next_offset >= end_offset {
11183                return Ok(());
11184            }
11185
11186            // Decode unknown envelopes for gaps in ordinals.
11187            while _next_ordinal_to_read < 3 {
11188                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11189                _next_ordinal_to_read += 1;
11190                next_offset += envelope_size;
11191            }
11192
11193            let next_out_of_line = decoder.next_out_of_line();
11194            let handles_before = decoder.remaining_handles();
11195            if let Some((inlined, num_bytes, num_handles)) =
11196                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11197            {
11198                let member_inline_size = <fidl_fuchsia_media::TimelineFunction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11199                if inlined != (member_inline_size <= 4) {
11200                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11201                }
11202                let inner_offset;
11203                let mut inner_depth = depth.clone();
11204                if inlined {
11205                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11206                    inner_offset = next_offset;
11207                } else {
11208                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11209                    inner_depth.increment()?;
11210                }
11211                let val_ref = self.timeline_function.get_or_insert_with(|| {
11212                    fidl::new_empty!(fidl_fuchsia_media::TimelineFunction, D)
11213                });
11214                fidl::decode!(
11215                    fidl_fuchsia_media::TimelineFunction,
11216                    D,
11217                    val_ref,
11218                    decoder,
11219                    inner_offset,
11220                    inner_depth
11221                )?;
11222                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11223                {
11224                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11225                }
11226                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11227                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11228                }
11229            }
11230
11231            next_offset += envelope_size;
11232            _next_ordinal_to_read += 1;
11233            if next_offset >= end_offset {
11234                return Ok(());
11235            }
11236
11237            // Decode unknown envelopes for gaps in ordinals.
11238            while _next_ordinal_to_read < 4 {
11239                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11240                _next_ordinal_to_read += 1;
11241                next_offset += envelope_size;
11242            }
11243
11244            let next_out_of_line = decoder.next_out_of_line();
11245            let handles_before = decoder.remaining_handles();
11246            if let Some((inlined, num_bytes, num_handles)) =
11247                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11248            {
11249                let member_inline_size =
11250                    <RepeatMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11251                if inlined != (member_inline_size <= 4) {
11252                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11253                }
11254                let inner_offset;
11255                let mut inner_depth = depth.clone();
11256                if inlined {
11257                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11258                    inner_offset = next_offset;
11259                } else {
11260                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11261                    inner_depth.increment()?;
11262                }
11263                let val_ref =
11264                    self.repeat_mode.get_or_insert_with(|| fidl::new_empty!(RepeatMode, D));
11265                fidl::decode!(RepeatMode, D, val_ref, decoder, inner_offset, inner_depth)?;
11266                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11267                {
11268                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11269                }
11270                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11271                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11272                }
11273            }
11274
11275            next_offset += envelope_size;
11276            _next_ordinal_to_read += 1;
11277            if next_offset >= end_offset {
11278                return Ok(());
11279            }
11280
11281            // Decode unknown envelopes for gaps in ordinals.
11282            while _next_ordinal_to_read < 5 {
11283                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11284                _next_ordinal_to_read += 1;
11285                next_offset += envelope_size;
11286            }
11287
11288            let next_out_of_line = decoder.next_out_of_line();
11289            let handles_before = decoder.remaining_handles();
11290            if let Some((inlined, num_bytes, num_handles)) =
11291                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11292            {
11293                let member_inline_size =
11294                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11295                if inlined != (member_inline_size <= 4) {
11296                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11297                }
11298                let inner_offset;
11299                let mut inner_depth = depth.clone();
11300                if inlined {
11301                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11302                    inner_offset = next_offset;
11303                } else {
11304                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11305                    inner_depth.increment()?;
11306                }
11307                let val_ref = self.shuffle_on.get_or_insert_with(|| fidl::new_empty!(bool, D));
11308                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11309                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11310                {
11311                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11312                }
11313                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11314                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11315                }
11316            }
11317
11318            next_offset += envelope_size;
11319            _next_ordinal_to_read += 1;
11320            if next_offset >= end_offset {
11321                return Ok(());
11322            }
11323
11324            // Decode unknown envelopes for gaps in ordinals.
11325            while _next_ordinal_to_read < 6 {
11326                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11327                _next_ordinal_to_read += 1;
11328                next_offset += envelope_size;
11329            }
11330
11331            let next_out_of_line = decoder.next_out_of_line();
11332            let handles_before = decoder.remaining_handles();
11333            if let Some((inlined, num_bytes, num_handles)) =
11334                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11335            {
11336                let member_inline_size =
11337                    <ContentType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11338                if inlined != (member_inline_size <= 4) {
11339                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11340                }
11341                let inner_offset;
11342                let mut inner_depth = depth.clone();
11343                if inlined {
11344                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11345                    inner_offset = next_offset;
11346                } else {
11347                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11348                    inner_depth.increment()?;
11349                }
11350                let val_ref =
11351                    self.content_type.get_or_insert_with(|| fidl::new_empty!(ContentType, D));
11352                fidl::decode!(ContentType, D, val_ref, decoder, inner_offset, inner_depth)?;
11353                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11354                {
11355                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11356                }
11357                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11358                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11359                }
11360            }
11361
11362            next_offset += envelope_size;
11363            _next_ordinal_to_read += 1;
11364            if next_offset >= end_offset {
11365                return Ok(());
11366            }
11367
11368            // Decode unknown envelopes for gaps in ordinals.
11369            while _next_ordinal_to_read < 7 {
11370                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11371                _next_ordinal_to_read += 1;
11372                next_offset += envelope_size;
11373            }
11374
11375            let next_out_of_line = decoder.next_out_of_line();
11376            let handles_before = decoder.remaining_handles();
11377            if let Some((inlined, num_bytes, num_handles)) =
11378                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11379            {
11380                let member_inline_size =
11381                    <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11382                if inlined != (member_inline_size <= 4) {
11383                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11384                }
11385                let inner_offset;
11386                let mut inner_depth = depth.clone();
11387                if inlined {
11388                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11389                    inner_offset = next_offset;
11390                } else {
11391                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11392                    inner_depth.increment()?;
11393                }
11394                let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
11395                fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
11396                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11397                {
11398                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11399                }
11400                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11401                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11402                }
11403            }
11404
11405            next_offset += envelope_size;
11406            _next_ordinal_to_read += 1;
11407            if next_offset >= end_offset {
11408                return Ok(());
11409            }
11410
11411            // Decode unknown envelopes for gaps in ordinals.
11412            while _next_ordinal_to_read < 8 {
11413                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11414                _next_ordinal_to_read += 1;
11415                next_offset += envelope_size;
11416            }
11417
11418            let next_out_of_line = decoder.next_out_of_line();
11419            let handles_before = decoder.remaining_handles();
11420            if let Some((inlined, num_bytes, num_handles)) =
11421                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11422            {
11423                let member_inline_size =
11424                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11425                if inlined != (member_inline_size <= 4) {
11426                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11427                }
11428                let inner_offset;
11429                let mut inner_depth = depth.clone();
11430                if inlined {
11431                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11432                    inner_offset = next_offset;
11433                } else {
11434                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11435                    inner_depth.increment()?;
11436                }
11437                let val_ref = self.is_live.get_or_insert_with(|| fidl::new_empty!(bool, D));
11438                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11439                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11440                {
11441                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11442                }
11443                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11444                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11445                }
11446            }
11447
11448            next_offset += envelope_size;
11449
11450            // Decode the remaining unknown envelopes.
11451            while next_offset < end_offset {
11452                _next_ordinal_to_read += 1;
11453                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11454                next_offset += envelope_size;
11455            }
11456
11457            Ok(())
11458        }
11459    }
11460
11461    impl SessionInfoDelta {
11462        #[inline(always)]
11463        fn max_ordinal_present(&self) -> u64 {
11464            if let Some(_) = self.player_capabilities {
11465                return 7;
11466            }
11467            if let Some(_) = self.media_images {
11468                return 6;
11469            }
11470            if let Some(_) = self.metadata {
11471                return 5;
11472            }
11473            if let Some(_) = self.player_status {
11474                return 4;
11475            }
11476            if let Some(_) = self.is_locally_active {
11477                return 3;
11478            }
11479            if let Some(_) = self.is_local {
11480                return 2;
11481            }
11482            if let Some(_) = self.domain {
11483                return 1;
11484            }
11485            0
11486        }
11487    }
11488
11489    impl fidl::encoding::ValueTypeMarker for SessionInfoDelta {
11490        type Borrowed<'a> = &'a Self;
11491        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11492            value
11493        }
11494    }
11495
11496    unsafe impl fidl::encoding::TypeMarker for SessionInfoDelta {
11497        type Owned = Self;
11498
11499        #[inline(always)]
11500        fn inline_align(_context: fidl::encoding::Context) -> usize {
11501            8
11502        }
11503
11504        #[inline(always)]
11505        fn inline_size(_context: fidl::encoding::Context) -> usize {
11506            16
11507        }
11508    }
11509
11510    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionInfoDelta, D>
11511        for &SessionInfoDelta
11512    {
11513        unsafe fn encode(
11514            self,
11515            encoder: &mut fidl::encoding::Encoder<'_, D>,
11516            offset: usize,
11517            mut depth: fidl::encoding::Depth,
11518        ) -> fidl::Result<()> {
11519            encoder.debug_check_bounds::<SessionInfoDelta>(offset);
11520            // Vector header
11521            let max_ordinal: u64 = self.max_ordinal_present();
11522            encoder.write_num(max_ordinal, offset);
11523            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11524            // Calling encoder.out_of_line_offset(0) is not allowed.
11525            if max_ordinal == 0 {
11526                return Ok(());
11527            }
11528            depth.increment()?;
11529            let envelope_size = 8;
11530            let bytes_len = max_ordinal as usize * envelope_size;
11531            #[allow(unused_variables)]
11532            let offset = encoder.out_of_line_offset(bytes_len);
11533            let mut _prev_end_offset: usize = 0;
11534            if 1 > max_ordinal {
11535                return Ok(());
11536            }
11537
11538            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11539            // are envelope_size bytes.
11540            let cur_offset: usize = (1 - 1) * envelope_size;
11541
11542            // Zero reserved fields.
11543            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11544
11545            // Safety:
11546            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11547            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11548            //   envelope_size bytes, there is always sufficient room.
11549            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
11550            self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
11551            encoder, offset + cur_offset, depth
11552        )?;
11553
11554            _prev_end_offset = cur_offset + envelope_size;
11555            if 2 > max_ordinal {
11556                return Ok(());
11557            }
11558
11559            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11560            // are envelope_size bytes.
11561            let cur_offset: usize = (2 - 1) * envelope_size;
11562
11563            // Zero reserved fields.
11564            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11565
11566            // Safety:
11567            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11568            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11569            //   envelope_size bytes, there is always sufficient room.
11570            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11571                self.is_local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11572                encoder,
11573                offset + cur_offset,
11574                depth,
11575            )?;
11576
11577            _prev_end_offset = cur_offset + envelope_size;
11578            if 3 > max_ordinal {
11579                return Ok(());
11580            }
11581
11582            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11583            // are envelope_size bytes.
11584            let cur_offset: usize = (3 - 1) * envelope_size;
11585
11586            // Zero reserved fields.
11587            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11588
11589            // Safety:
11590            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11591            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11592            //   envelope_size bytes, there is always sufficient room.
11593            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11594                self.is_locally_active
11595                    .as_ref()
11596                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11597                encoder,
11598                offset + cur_offset,
11599                depth,
11600            )?;
11601
11602            _prev_end_offset = cur_offset + envelope_size;
11603            if 4 > max_ordinal {
11604                return Ok(());
11605            }
11606
11607            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11608            // are envelope_size bytes.
11609            let cur_offset: usize = (4 - 1) * envelope_size;
11610
11611            // Zero reserved fields.
11612            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11613
11614            // Safety:
11615            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11616            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11617            //   envelope_size bytes, there is always sufficient room.
11618            fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
11619                self.player_status
11620                    .as_ref()
11621                    .map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
11622                encoder,
11623                offset + cur_offset,
11624                depth,
11625            )?;
11626
11627            _prev_end_offset = cur_offset + envelope_size;
11628            if 5 > max_ordinal {
11629                return Ok(());
11630            }
11631
11632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11633            // are envelope_size bytes.
11634            let cur_offset: usize = (5 - 1) * envelope_size;
11635
11636            // Zero reserved fields.
11637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11638
11639            // Safety:
11640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11642            //   envelope_size bytes, there is always sufficient room.
11643            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::Metadata, D>(
11644                self.metadata
11645                    .as_ref()
11646                    .map(<fidl_fuchsia_media::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
11647                encoder,
11648                offset + cur_offset,
11649                depth,
11650            )?;
11651
11652            _prev_end_offset = cur_offset + envelope_size;
11653            if 6 > max_ordinal {
11654                return Ok(());
11655            }
11656
11657            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11658            // are envelope_size bytes.
11659            let cur_offset: usize = (6 - 1) * envelope_size;
11660
11661            // Zero reserved fields.
11662            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11663
11664            // Safety:
11665            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11666            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11667            //   envelope_size bytes, there is always sufficient room.
11668            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<MediaImage>, D>(
11669            self.media_images.as_ref().map(<fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::ValueTypeMarker>::borrow),
11670            encoder, offset + cur_offset, depth
11671        )?;
11672
11673            _prev_end_offset = cur_offset + envelope_size;
11674            if 7 > max_ordinal {
11675                return Ok(());
11676            }
11677
11678            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11679            // are envelope_size bytes.
11680            let cur_offset: usize = (7 - 1) * envelope_size;
11681
11682            // Zero reserved fields.
11683            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11684
11685            // Safety:
11686            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11687            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11688            //   envelope_size bytes, there is always sufficient room.
11689            fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
11690                self.player_capabilities
11691                    .as_ref()
11692                    .map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
11693                encoder,
11694                offset + cur_offset,
11695                depth,
11696            )?;
11697
11698            _prev_end_offset = cur_offset + envelope_size;
11699
11700            Ok(())
11701        }
11702    }
11703
11704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionInfoDelta {
11705        #[inline(always)]
11706        fn new_empty() -> Self {
11707            Self::default()
11708        }
11709
11710        unsafe fn decode(
11711            &mut self,
11712            decoder: &mut fidl::encoding::Decoder<'_, D>,
11713            offset: usize,
11714            mut depth: fidl::encoding::Depth,
11715        ) -> fidl::Result<()> {
11716            decoder.debug_check_bounds::<Self>(offset);
11717            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11718                None => return Err(fidl::Error::NotNullable),
11719                Some(len) => len,
11720            };
11721            // Calling decoder.out_of_line_offset(0) is not allowed.
11722            if len == 0 {
11723                return Ok(());
11724            };
11725            depth.increment()?;
11726            let envelope_size = 8;
11727            let bytes_len = len * envelope_size;
11728            let offset = decoder.out_of_line_offset(bytes_len)?;
11729            // Decode the envelope for each type.
11730            let mut _next_ordinal_to_read = 0;
11731            let mut next_offset = offset;
11732            let end_offset = offset + bytes_len;
11733            _next_ordinal_to_read += 1;
11734            if next_offset >= end_offset {
11735                return Ok(());
11736            }
11737
11738            // Decode unknown envelopes for gaps in ordinals.
11739            while _next_ordinal_to_read < 1 {
11740                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11741                _next_ordinal_to_read += 1;
11742                next_offset += envelope_size;
11743            }
11744
11745            let next_out_of_line = decoder.next_out_of_line();
11746            let handles_before = decoder.remaining_handles();
11747            if let Some((inlined, num_bytes, num_handles)) =
11748                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11749            {
11750                let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11751                if inlined != (member_inline_size <= 4) {
11752                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11753                }
11754                let inner_offset;
11755                let mut inner_depth = depth.clone();
11756                if inlined {
11757                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11758                    inner_offset = next_offset;
11759                } else {
11760                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11761                    inner_depth.increment()?;
11762                }
11763                let val_ref = self.domain.get_or_insert_with(|| {
11764                    fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
11765                });
11766                fidl::decode!(
11767                    fidl::encoding::BoundedString<1000>,
11768                    D,
11769                    val_ref,
11770                    decoder,
11771                    inner_offset,
11772                    inner_depth
11773                )?;
11774                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11775                {
11776                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11777                }
11778                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11779                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11780                }
11781            }
11782
11783            next_offset += envelope_size;
11784            _next_ordinal_to_read += 1;
11785            if next_offset >= end_offset {
11786                return Ok(());
11787            }
11788
11789            // Decode unknown envelopes for gaps in ordinals.
11790            while _next_ordinal_to_read < 2 {
11791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11792                _next_ordinal_to_read += 1;
11793                next_offset += envelope_size;
11794            }
11795
11796            let next_out_of_line = decoder.next_out_of_line();
11797            let handles_before = decoder.remaining_handles();
11798            if let Some((inlined, num_bytes, num_handles)) =
11799                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11800            {
11801                let member_inline_size =
11802                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11803                if inlined != (member_inline_size <= 4) {
11804                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11805                }
11806                let inner_offset;
11807                let mut inner_depth = depth.clone();
11808                if inlined {
11809                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11810                    inner_offset = next_offset;
11811                } else {
11812                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11813                    inner_depth.increment()?;
11814                }
11815                let val_ref = self.is_local.get_or_insert_with(|| fidl::new_empty!(bool, D));
11816                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11817                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11818                {
11819                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11820                }
11821                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11822                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11823                }
11824            }
11825
11826            next_offset += envelope_size;
11827            _next_ordinal_to_read += 1;
11828            if next_offset >= end_offset {
11829                return Ok(());
11830            }
11831
11832            // Decode unknown envelopes for gaps in ordinals.
11833            while _next_ordinal_to_read < 3 {
11834                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11835                _next_ordinal_to_read += 1;
11836                next_offset += envelope_size;
11837            }
11838
11839            let next_out_of_line = decoder.next_out_of_line();
11840            let handles_before = decoder.remaining_handles();
11841            if let Some((inlined, num_bytes, num_handles)) =
11842                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11843            {
11844                let member_inline_size =
11845                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11846                if inlined != (member_inline_size <= 4) {
11847                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11848                }
11849                let inner_offset;
11850                let mut inner_depth = depth.clone();
11851                if inlined {
11852                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11853                    inner_offset = next_offset;
11854                } else {
11855                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11856                    inner_depth.increment()?;
11857                }
11858                let val_ref =
11859                    self.is_locally_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
11860                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11861                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11862                {
11863                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11864                }
11865                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11866                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11867                }
11868            }
11869
11870            next_offset += envelope_size;
11871            _next_ordinal_to_read += 1;
11872            if next_offset >= end_offset {
11873                return Ok(());
11874            }
11875
11876            // Decode unknown envelopes for gaps in ordinals.
11877            while _next_ordinal_to_read < 4 {
11878                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11879                _next_ordinal_to_read += 1;
11880                next_offset += envelope_size;
11881            }
11882
11883            let next_out_of_line = decoder.next_out_of_line();
11884            let handles_before = decoder.remaining_handles();
11885            if let Some((inlined, num_bytes, num_handles)) =
11886                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11887            {
11888                let member_inline_size =
11889                    <PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11890                if inlined != (member_inline_size <= 4) {
11891                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11892                }
11893                let inner_offset;
11894                let mut inner_depth = depth.clone();
11895                if inlined {
11896                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11897                    inner_offset = next_offset;
11898                } else {
11899                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11900                    inner_depth.increment()?;
11901                }
11902                let val_ref =
11903                    self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
11904                fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
11905                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11906                {
11907                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11908                }
11909                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11910                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11911                }
11912            }
11913
11914            next_offset += envelope_size;
11915            _next_ordinal_to_read += 1;
11916            if next_offset >= end_offset {
11917                return Ok(());
11918            }
11919
11920            // Decode unknown envelopes for gaps in ordinals.
11921            while _next_ordinal_to_read < 5 {
11922                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11923                _next_ordinal_to_read += 1;
11924                next_offset += envelope_size;
11925            }
11926
11927            let next_out_of_line = decoder.next_out_of_line();
11928            let handles_before = decoder.remaining_handles();
11929            if let Some((inlined, num_bytes, num_handles)) =
11930                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11931            {
11932                let member_inline_size =
11933                    <fidl_fuchsia_media::Metadata as fidl::encoding::TypeMarker>::inline_size(
11934                        decoder.context,
11935                    );
11936                if inlined != (member_inline_size <= 4) {
11937                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11938                }
11939                let inner_offset;
11940                let mut inner_depth = depth.clone();
11941                if inlined {
11942                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11943                    inner_offset = next_offset;
11944                } else {
11945                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11946                    inner_depth.increment()?;
11947                }
11948                let val_ref = self
11949                    .metadata
11950                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::Metadata, D));
11951                fidl::decode!(
11952                    fidl_fuchsia_media::Metadata,
11953                    D,
11954                    val_ref,
11955                    decoder,
11956                    inner_offset,
11957                    inner_depth
11958                )?;
11959                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11960                {
11961                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11962                }
11963                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11964                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11965                }
11966            }
11967
11968            next_offset += envelope_size;
11969            _next_ordinal_to_read += 1;
11970            if next_offset >= end_offset {
11971                return Ok(());
11972            }
11973
11974            // Decode unknown envelopes for gaps in ordinals.
11975            while _next_ordinal_to_read < 6 {
11976                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11977                _next_ordinal_to_read += 1;
11978                next_offset += envelope_size;
11979            }
11980
11981            let next_out_of_line = decoder.next_out_of_line();
11982            let handles_before = decoder.remaining_handles();
11983            if let Some((inlined, num_bytes, num_handles)) =
11984                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11985            {
11986                let member_inline_size = <fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11987                if inlined != (member_inline_size <= 4) {
11988                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11989                }
11990                let inner_offset;
11991                let mut inner_depth = depth.clone();
11992                if inlined {
11993                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11994                    inner_offset = next_offset;
11995                } else {
11996                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11997                    inner_depth.increment()?;
11998                }
11999                let val_ref = self.media_images.get_or_insert_with(|| {
12000                    fidl::new_empty!(fidl::encoding::UnboundedVector<MediaImage>, D)
12001                });
12002                fidl::decode!(
12003                    fidl::encoding::UnboundedVector<MediaImage>,
12004                    D,
12005                    val_ref,
12006                    decoder,
12007                    inner_offset,
12008                    inner_depth
12009                )?;
12010                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12011                {
12012                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12013                }
12014                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12015                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12016                }
12017            }
12018
12019            next_offset += envelope_size;
12020            _next_ordinal_to_read += 1;
12021            if next_offset >= end_offset {
12022                return Ok(());
12023            }
12024
12025            // Decode unknown envelopes for gaps in ordinals.
12026            while _next_ordinal_to_read < 7 {
12027                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12028                _next_ordinal_to_read += 1;
12029                next_offset += envelope_size;
12030            }
12031
12032            let next_out_of_line = decoder.next_out_of_line();
12033            let handles_before = decoder.remaining_handles();
12034            if let Some((inlined, num_bytes, num_handles)) =
12035                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12036            {
12037                let member_inline_size =
12038                    <PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
12039                        decoder.context,
12040                    );
12041                if inlined != (member_inline_size <= 4) {
12042                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12043                }
12044                let inner_offset;
12045                let mut inner_depth = depth.clone();
12046                if inlined {
12047                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12048                    inner_offset = next_offset;
12049                } else {
12050                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12051                    inner_depth.increment()?;
12052                }
12053                let val_ref = self
12054                    .player_capabilities
12055                    .get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
12056                fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
12057                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12058                {
12059                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12060                }
12061                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12062                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12063                }
12064            }
12065
12066            next_offset += envelope_size;
12067
12068            // Decode the remaining unknown envelopes.
12069            while next_offset < end_offset {
12070                _next_ordinal_to_read += 1;
12071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12072                next_offset += envelope_size;
12073            }
12074
12075            Ok(())
12076        }
12077    }
12078
12079    impl WatchOptions {
12080        #[inline(always)]
12081        fn max_ordinal_present(&self) -> u64 {
12082            if let Some(_) = self.allowed_sessions {
12083                return 2;
12084            }
12085            if let Some(_) = self.only_active {
12086                return 1;
12087            }
12088            0
12089        }
12090    }
12091
12092    impl fidl::encoding::ValueTypeMarker for WatchOptions {
12093        type Borrowed<'a> = &'a Self;
12094        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12095            value
12096        }
12097    }
12098
12099    unsafe impl fidl::encoding::TypeMarker for WatchOptions {
12100        type Owned = Self;
12101
12102        #[inline(always)]
12103        fn inline_align(_context: fidl::encoding::Context) -> usize {
12104            8
12105        }
12106
12107        #[inline(always)]
12108        fn inline_size(_context: fidl::encoding::Context) -> usize {
12109            16
12110        }
12111    }
12112
12113    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchOptions, D>
12114        for &WatchOptions
12115    {
12116        unsafe fn encode(
12117            self,
12118            encoder: &mut fidl::encoding::Encoder<'_, D>,
12119            offset: usize,
12120            mut depth: fidl::encoding::Depth,
12121        ) -> fidl::Result<()> {
12122            encoder.debug_check_bounds::<WatchOptions>(offset);
12123            // Vector header
12124            let max_ordinal: u64 = self.max_ordinal_present();
12125            encoder.write_num(max_ordinal, offset);
12126            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12127            // Calling encoder.out_of_line_offset(0) is not allowed.
12128            if max_ordinal == 0 {
12129                return Ok(());
12130            }
12131            depth.increment()?;
12132            let envelope_size = 8;
12133            let bytes_len = max_ordinal as usize * envelope_size;
12134            #[allow(unused_variables)]
12135            let offset = encoder.out_of_line_offset(bytes_len);
12136            let mut _prev_end_offset: usize = 0;
12137            if 1 > max_ordinal {
12138                return Ok(());
12139            }
12140
12141            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12142            // are envelope_size bytes.
12143            let cur_offset: usize = (1 - 1) * envelope_size;
12144
12145            // Zero reserved fields.
12146            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12147
12148            // Safety:
12149            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12150            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12151            //   envelope_size bytes, there is always sufficient room.
12152            fidl::encoding::encode_in_envelope_optional::<bool, D>(
12153                self.only_active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12154                encoder,
12155                offset + cur_offset,
12156                depth,
12157            )?;
12158
12159            _prev_end_offset = cur_offset + envelope_size;
12160            if 2 > max_ordinal {
12161                return Ok(());
12162            }
12163
12164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12165            // are envelope_size bytes.
12166            let cur_offset: usize = (2 - 1) * envelope_size;
12167
12168            // Zero reserved fields.
12169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12170
12171            // Safety:
12172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12174            //   envelope_size bytes, there is always sufficient room.
12175            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u64, 1000>, D>(
12176                self.allowed_sessions.as_ref().map(
12177                    <fidl::encoding::Vector<u64, 1000> as fidl::encoding::ValueTypeMarker>::borrow,
12178                ),
12179                encoder,
12180                offset + cur_offset,
12181                depth,
12182            )?;
12183
12184            _prev_end_offset = cur_offset + envelope_size;
12185
12186            Ok(())
12187        }
12188    }
12189
12190    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchOptions {
12191        #[inline(always)]
12192        fn new_empty() -> Self {
12193            Self::default()
12194        }
12195
12196        unsafe fn decode(
12197            &mut self,
12198            decoder: &mut fidl::encoding::Decoder<'_, D>,
12199            offset: usize,
12200            mut depth: fidl::encoding::Depth,
12201        ) -> fidl::Result<()> {
12202            decoder.debug_check_bounds::<Self>(offset);
12203            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12204                None => return Err(fidl::Error::NotNullable),
12205                Some(len) => len,
12206            };
12207            // Calling decoder.out_of_line_offset(0) is not allowed.
12208            if len == 0 {
12209                return Ok(());
12210            };
12211            depth.increment()?;
12212            let envelope_size = 8;
12213            let bytes_len = len * envelope_size;
12214            let offset = decoder.out_of_line_offset(bytes_len)?;
12215            // Decode the envelope for each type.
12216            let mut _next_ordinal_to_read = 0;
12217            let mut next_offset = offset;
12218            let end_offset = offset + bytes_len;
12219            _next_ordinal_to_read += 1;
12220            if next_offset >= end_offset {
12221                return Ok(());
12222            }
12223
12224            // Decode unknown envelopes for gaps in ordinals.
12225            while _next_ordinal_to_read < 1 {
12226                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12227                _next_ordinal_to_read += 1;
12228                next_offset += envelope_size;
12229            }
12230
12231            let next_out_of_line = decoder.next_out_of_line();
12232            let handles_before = decoder.remaining_handles();
12233            if let Some((inlined, num_bytes, num_handles)) =
12234                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12235            {
12236                let member_inline_size =
12237                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12238                if inlined != (member_inline_size <= 4) {
12239                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12240                }
12241                let inner_offset;
12242                let mut inner_depth = depth.clone();
12243                if inlined {
12244                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12245                    inner_offset = next_offset;
12246                } else {
12247                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12248                    inner_depth.increment()?;
12249                }
12250                let val_ref = self.only_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
12251                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
12252                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12253                {
12254                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12255                }
12256                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12257                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12258                }
12259            }
12260
12261            next_offset += envelope_size;
12262            _next_ordinal_to_read += 1;
12263            if next_offset >= end_offset {
12264                return Ok(());
12265            }
12266
12267            // Decode unknown envelopes for gaps in ordinals.
12268            while _next_ordinal_to_read < 2 {
12269                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12270                _next_ordinal_to_read += 1;
12271                next_offset += envelope_size;
12272            }
12273
12274            let next_out_of_line = decoder.next_out_of_line();
12275            let handles_before = decoder.remaining_handles();
12276            if let Some((inlined, num_bytes, num_handles)) =
12277                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12278            {
12279                let member_inline_size =
12280                    <fidl::encoding::Vector<u64, 1000> as fidl::encoding::TypeMarker>::inline_size(
12281                        decoder.context,
12282                    );
12283                if inlined != (member_inline_size <= 4) {
12284                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12285                }
12286                let inner_offset;
12287                let mut inner_depth = depth.clone();
12288                if inlined {
12289                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12290                    inner_offset = next_offset;
12291                } else {
12292                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12293                    inner_depth.increment()?;
12294                }
12295                let val_ref = self
12296                    .allowed_sessions
12297                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u64, 1000>, D));
12298                fidl::decode!(fidl::encoding::Vector<u64, 1000>, D, val_ref, decoder, inner_offset, inner_depth)?;
12299                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12300                {
12301                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12302                }
12303                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12304                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12305                }
12306            }
12307
12308            next_offset += envelope_size;
12309
12310            // Decode the remaining unknown envelopes.
12311            while next_offset < end_offset {
12312                _next_ordinal_to_read += 1;
12313                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12314                next_offset += envelope_size;
12315            }
12316
12317            Ok(())
12318        }
12319    }
12320}