1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type Domain = String;
19
20pub type SessionId = u64;
21
22bitflags! {
23 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
24 pub struct PlayerCapabilityFlags: u32 {
25 const PLAY = 1;
27 const PAUSE = 4;
29 const SEEK = 8;
31 const SKIP_FORWARD = 16;
33 const SKIP_REVERSE = 32;
35 const SHUFFLE = 64;
37 const CHANGE_TO_NEXT_ITEM = 128;
38 const CHANGE_TO_PREV_ITEM = 256;
39 const HAS_GAIN_CONTROL = 512;
41 const REPEAT_GROUPS = 1024;
43 const REPEAT_SINGLE = 2048;
45 const SET_PLAYBACK_RATE = 4096;
47 }
48}
49
50impl PlayerCapabilityFlags {
51 #[deprecated = "Strict bits should not use `has_unknown_bits`"]
52 #[inline(always)]
53 pub fn has_unknown_bits(&self) -> bool {
54 false
55 }
56
57 #[deprecated = "Strict bits should not use `get_unknown_bits`"]
58 #[inline(always)]
59 pub fn get_unknown_bits(&self) -> u32 {
60 0
61 }
62}
63
64#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
67#[repr(u32)]
68pub enum ContentType {
69 Other = 1,
71 Audio = 2,
73 Video = 3,
75 Music = 4,
77 TvShow = 5,
79 Movie = 6,
81}
82
83impl ContentType {
84 #[inline]
85 pub fn from_primitive(prim: u32) -> Option<Self> {
86 match prim {
87 1 => Some(Self::Other),
88 2 => Some(Self::Audio),
89 3 => Some(Self::Video),
90 4 => Some(Self::Music),
91 5 => Some(Self::TvShow),
92 6 => Some(Self::Movie),
93 _ => None,
94 }
95 }
96
97 #[inline]
98 pub const fn into_primitive(self) -> u32 {
99 self as u32
100 }
101
102 #[deprecated = "Strict enums should not use `is_unknown`"]
103 #[inline]
104 pub fn is_unknown(&self) -> bool {
105 false
106 }
107}
108
109#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
110#[repr(u32)]
111pub enum Error {
112 Other = 1,
113}
114
115impl Error {
116 #[inline]
117 pub fn from_primitive(prim: u32) -> Option<Self> {
118 match prim {
119 1 => Some(Self::Other),
120 _ => None,
121 }
122 }
123
124 #[inline]
125 pub const fn into_primitive(self) -> u32 {
126 self as u32
127 }
128
129 #[deprecated = "Strict enums should not use `is_unknown`"]
130 #[inline]
131 pub fn is_unknown(&self) -> bool {
132 false
133 }
134}
135
136#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
143#[repr(u32)]
144pub enum InterruptionBehavior {
145 None = 0,
148 Pause = 1,
152}
153
154impl InterruptionBehavior {
155 #[inline]
156 pub fn from_primitive(prim: u32) -> Option<Self> {
157 match prim {
158 0 => Some(Self::None),
159 1 => Some(Self::Pause),
160 _ => None,
161 }
162 }
163
164 #[inline]
165 pub const fn into_primitive(self) -> u32 {
166 self as u32
167 }
168
169 #[deprecated = "Strict enums should not use `is_unknown`"]
170 #[inline]
171 pub fn is_unknown(&self) -> bool {
172 false
173 }
174}
175
176#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
177#[repr(u32)]
178pub enum MediaImageType {
179 Artwork = 0,
181 SourceIcon = 1,
184}
185
186impl MediaImageType {
187 #[inline]
188 pub fn from_primitive(prim: u32) -> Option<Self> {
189 match prim {
190 0 => Some(Self::Artwork),
191 1 => Some(Self::SourceIcon),
192 _ => None,
193 }
194 }
195
196 #[inline]
197 pub const fn into_primitive(self) -> u32 {
198 self as u32
199 }
200
201 #[deprecated = "Strict enums should not use `is_unknown`"]
202 #[inline]
203 pub fn is_unknown(&self) -> bool {
204 false
205 }
206}
207
208#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
210#[repr(u32)]
211pub enum PlayerState {
212 Idle = 0,
214 Playing = 1,
216 Paused = 2,
218 Buffering = 3,
220 Error = 4,
222}
223
224impl PlayerState {
225 #[inline]
226 pub fn from_primitive(prim: u32) -> Option<Self> {
227 match prim {
228 0 => Some(Self::Idle),
229 1 => Some(Self::Playing),
230 2 => Some(Self::Paused),
231 3 => Some(Self::Buffering),
232 4 => Some(Self::Error),
233 _ => None,
234 }
235 }
236
237 #[inline]
238 pub const fn into_primitive(self) -> u32 {
239 self as u32
240 }
241
242 #[deprecated = "Strict enums should not use `is_unknown`"]
243 #[inline]
244 pub fn is_unknown(&self) -> bool {
245 false
246 }
247}
248
249#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
251#[repr(u32)]
252pub enum RepeatMode {
253 Off = 0,
255 Group = 1,
257 Single = 2,
259}
260
261impl RepeatMode {
262 #[inline]
263 pub fn from_primitive(prim: u32) -> Option<Self> {
264 match prim {
265 0 => Some(Self::Off),
266 1 => Some(Self::Group),
267 2 => Some(Self::Single),
268 _ => None,
269 }
270 }
271
272 #[inline]
273 pub const fn into_primitive(self) -> u32 {
274 self as u32
275 }
276
277 #[deprecated = "Strict enums should not use `is_unknown`"]
278 #[inline]
279 pub fn is_unknown(&self) -> bool {
280 false
281 }
282}
283
284#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
286pub struct ImageSizeVariant {
287 pub url: String,
288 pub width: u32,
289 pub height: u32,
290}
291
292impl fidl::Persistable for ImageSizeVariant {}
293
294#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
295#[repr(C)]
296pub struct PlayerControlSeekRequest {
297 pub position: i64,
298}
299
300impl fidl::Persistable for PlayerControlSeekRequest {}
301
302#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
303pub struct PlayerControlSetPlaybackRateRequest {
304 pub playback_rate: f32,
305}
306
307impl fidl::Persistable for PlayerControlSetPlaybackRateRequest {}
308
309#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
310pub struct PlayerControlSetRepeatModeRequest {
311 pub repeat_mode: RepeatMode,
312}
313
314impl fidl::Persistable for PlayerControlSetRepeatModeRequest {}
315
316#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
317pub struct PlayerControlSetShuffleModeRequest {
318 pub shuffle_on: bool,
319}
320
321impl fidl::Persistable for PlayerControlSetShuffleModeRequest {}
322
323#[derive(Clone, Debug, PartialEq)]
324pub struct PlayerWatchInfoChangeResponse {
325 pub player_info_delta: PlayerInfoDelta,
326}
327
328impl fidl::Persistable for PlayerWatchInfoChangeResponse {}
329
330#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
331#[repr(C)]
332pub struct PublisherPublishResponse {
333 pub session_id: u64,
334}
335
336impl fidl::Persistable for PublisherPublishResponse {}
337
338#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
339#[repr(C)]
340pub struct SessionControlSeekRequest {
341 pub position: i64,
342}
343
344impl fidl::Persistable for SessionControlSeekRequest {}
345
346#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
347pub struct SessionControlSetPlaybackRateRequest {
348 pub playback_rate: f32,
349}
350
351impl fidl::Persistable for SessionControlSetPlaybackRateRequest {}
352
353#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
354pub struct SessionControlSetRepeatModeRequest {
355 pub repeat_mode: RepeatMode,
356}
357
358impl fidl::Persistable for SessionControlSetRepeatModeRequest {}
359
360#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
361pub struct SessionControlSetShuffleModeRequest {
362 pub shuffle_on: bool,
363}
364
365impl fidl::Persistable for SessionControlSetShuffleModeRequest {}
366
367#[derive(Clone, Debug, PartialEq)]
368pub struct SessionControlWatchStatusResponse {
369 pub session_info_delta: SessionInfoDelta,
370}
371
372impl fidl::Persistable for SessionControlWatchStatusResponse {}
373
374#[derive(Clone, Debug, PartialEq)]
375pub struct SessionObserverWatchStatusResponse {
376 pub session_info_delta: SessionInfoDelta,
377}
378
379impl fidl::Persistable for SessionObserverWatchStatusResponse {}
380
381#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
382#[repr(C)]
383pub struct SessionsWatcherSessionRemovedRequest {
384 pub session_id: u64,
385}
386
387impl fidl::Persistable for SessionsWatcherSessionRemovedRequest {}
388
389#[derive(Clone, Debug, PartialEq)]
390pub struct SessionsWatcherSessionUpdatedRequest {
391 pub session_id: u64,
392 pub session_info_delta: SessionInfoDelta,
393}
394
395impl fidl::Persistable for SessionsWatcherSessionUpdatedRequest {}
396
397#[derive(Clone, Debug, Default, PartialEq)]
399pub struct MediaImage {
400 pub image_type: Option<MediaImageType>,
401 pub sizes: Option<Vec<ImageSizeVariant>>,
403 #[doc(hidden)]
404 pub __source_breaking: fidl::marker::SourceBreaking,
405}
406
407impl fidl::Persistable for MediaImage {}
408
409#[derive(Clone, Debug, Default, PartialEq)]
411pub struct PlayerCapabilities {
412 pub flags: Option<PlayerCapabilityFlags>,
415 #[doc(hidden)]
416 pub __source_breaking: fidl::marker::SourceBreaking,
417}
418
419impl fidl::Persistable for PlayerCapabilities {}
420
421#[derive(Clone, Debug, Default, PartialEq)]
424pub struct PlayerInfoDelta {
425 pub local: Option<bool>,
432 pub player_status: Option<PlayerStatus>,
438 pub metadata: Option<fidl_fuchsia_media::Metadata>,
442 pub media_images: Option<Vec<MediaImage>>,
447 pub player_capabilities: Option<PlayerCapabilities>,
452 pub interruption_behavior: Option<InterruptionBehavior>,
457 #[doc(hidden)]
458 pub __source_breaking: fidl::marker::SourceBreaking,
459}
460
461impl fidl::Persistable for PlayerInfoDelta {}
462
463#[derive(Clone, Debug, Default, PartialEq)]
467pub struct PlayerRegistration {
468 pub domain: Option<String>,
471 pub usage: Option<fidl_fuchsia_media::AudioRenderUsage>,
474 pub usage2: Option<fidl_fuchsia_media::AudioRenderUsage2>,
475 #[doc(hidden)]
476 pub __source_breaking: fidl::marker::SourceBreaking,
477}
478
479impl fidl::Persistable for PlayerRegistration {}
480
481#[derive(Clone, Debug, Default, PartialEq)]
483pub struct PlayerStatus {
484 pub duration: Option<i64>,
489 pub player_state: Option<PlayerState>,
493 pub timeline_function: Option<fidl_fuchsia_media::TimelineFunction>,
499 pub repeat_mode: Option<RepeatMode>,
503 pub shuffle_on: Option<bool>,
507 pub content_type: Option<ContentType>,
511 pub error: Option<Error>,
516 pub is_live: Option<bool>,
520 #[doc(hidden)]
521 pub __source_breaking: fidl::marker::SourceBreaking,
522}
523
524impl fidl::Persistable for PlayerStatus {}
525
526#[derive(Clone, Debug, Default, PartialEq)]
528pub struct SessionInfoDelta {
529 pub domain: Option<String>,
535 pub is_local: Option<bool>,
539 pub is_locally_active: Option<bool>,
546 pub player_status: Option<PlayerStatus>,
550 pub metadata: Option<fidl_fuchsia_media::Metadata>,
554 pub media_images: Option<Vec<MediaImage>>,
558 pub player_capabilities: Option<PlayerCapabilities>,
562 #[doc(hidden)]
563 pub __source_breaking: fidl::marker::SourceBreaking,
564}
565
566impl fidl::Persistable for SessionInfoDelta {}
567
568#[derive(Clone, Debug, Default, PartialEq)]
572pub struct WatchOptions {
573 pub only_active: Option<bool>,
575 pub allowed_sessions: Option<Vec<u64>>,
577 #[doc(hidden)]
578 pub __source_breaking: fidl::marker::SourceBreaking,
579}
580
581impl fidl::Persistable for WatchOptions {}
582
583mod internal {
584 use super::*;
585 unsafe impl fidl::encoding::TypeMarker for PlayerCapabilityFlags {
586 type Owned = Self;
587
588 #[inline(always)]
589 fn inline_align(_context: fidl::encoding::Context) -> usize {
590 4
591 }
592
593 #[inline(always)]
594 fn inline_size(_context: fidl::encoding::Context) -> usize {
595 4
596 }
597 }
598
599 impl fidl::encoding::ValueTypeMarker for PlayerCapabilityFlags {
600 type Borrowed<'a> = Self;
601 #[inline(always)]
602 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
603 *value
604 }
605 }
606
607 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
608 for PlayerCapabilityFlags
609 {
610 #[inline]
611 unsafe fn encode(
612 self,
613 encoder: &mut fidl::encoding::Encoder<'_, D>,
614 offset: usize,
615 _depth: fidl::encoding::Depth,
616 ) -> fidl::Result<()> {
617 encoder.debug_check_bounds::<Self>(offset);
618 if self.bits() & Self::all().bits() != self.bits() {
619 return Err(fidl::Error::InvalidBitsValue);
620 }
621 encoder.write_num(self.bits(), offset);
622 Ok(())
623 }
624 }
625
626 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilityFlags {
627 #[inline(always)]
628 fn new_empty() -> Self {
629 Self::empty()
630 }
631
632 #[inline]
633 unsafe fn decode(
634 &mut self,
635 decoder: &mut fidl::encoding::Decoder<'_, D>,
636 offset: usize,
637 _depth: fidl::encoding::Depth,
638 ) -> fidl::Result<()> {
639 decoder.debug_check_bounds::<Self>(offset);
640 let prim = decoder.read_num::<u32>(offset);
641 *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
642 Ok(())
643 }
644 }
645 unsafe impl fidl::encoding::TypeMarker for ContentType {
646 type Owned = Self;
647
648 #[inline(always)]
649 fn inline_align(_context: fidl::encoding::Context) -> usize {
650 std::mem::align_of::<u32>()
651 }
652
653 #[inline(always)]
654 fn inline_size(_context: fidl::encoding::Context) -> usize {
655 std::mem::size_of::<u32>()
656 }
657
658 #[inline(always)]
659 fn encode_is_copy() -> bool {
660 true
661 }
662
663 #[inline(always)]
664 fn decode_is_copy() -> bool {
665 false
666 }
667 }
668
669 impl fidl::encoding::ValueTypeMarker for ContentType {
670 type Borrowed<'a> = Self;
671 #[inline(always)]
672 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
673 *value
674 }
675 }
676
677 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ContentType {
678 #[inline]
679 unsafe fn encode(
680 self,
681 encoder: &mut fidl::encoding::Encoder<'_, D>,
682 offset: usize,
683 _depth: fidl::encoding::Depth,
684 ) -> fidl::Result<()> {
685 encoder.debug_check_bounds::<Self>(offset);
686 encoder.write_num(self.into_primitive(), offset);
687 Ok(())
688 }
689 }
690
691 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContentType {
692 #[inline(always)]
693 fn new_empty() -> Self {
694 Self::Other
695 }
696
697 #[inline]
698 unsafe fn decode(
699 &mut self,
700 decoder: &mut fidl::encoding::Decoder<'_, D>,
701 offset: usize,
702 _depth: fidl::encoding::Depth,
703 ) -> fidl::Result<()> {
704 decoder.debug_check_bounds::<Self>(offset);
705 let prim = decoder.read_num::<u32>(offset);
706
707 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
708 Ok(())
709 }
710 }
711 unsafe impl fidl::encoding::TypeMarker for Error {
712 type Owned = Self;
713
714 #[inline(always)]
715 fn inline_align(_context: fidl::encoding::Context) -> usize {
716 std::mem::align_of::<u32>()
717 }
718
719 #[inline(always)]
720 fn inline_size(_context: fidl::encoding::Context) -> usize {
721 std::mem::size_of::<u32>()
722 }
723
724 #[inline(always)]
725 fn encode_is_copy() -> bool {
726 true
727 }
728
729 #[inline(always)]
730 fn decode_is_copy() -> bool {
731 false
732 }
733 }
734
735 impl fidl::encoding::ValueTypeMarker for Error {
736 type Borrowed<'a> = Self;
737 #[inline(always)]
738 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
739 *value
740 }
741 }
742
743 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
744 #[inline]
745 unsafe fn encode(
746 self,
747 encoder: &mut fidl::encoding::Encoder<'_, D>,
748 offset: usize,
749 _depth: fidl::encoding::Depth,
750 ) -> fidl::Result<()> {
751 encoder.debug_check_bounds::<Self>(offset);
752 encoder.write_num(self.into_primitive(), offset);
753 Ok(())
754 }
755 }
756
757 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
758 #[inline(always)]
759 fn new_empty() -> Self {
760 Self::Other
761 }
762
763 #[inline]
764 unsafe fn decode(
765 &mut self,
766 decoder: &mut fidl::encoding::Decoder<'_, D>,
767 offset: usize,
768 _depth: fidl::encoding::Depth,
769 ) -> fidl::Result<()> {
770 decoder.debug_check_bounds::<Self>(offset);
771 let prim = decoder.read_num::<u32>(offset);
772
773 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
774 Ok(())
775 }
776 }
777 unsafe impl fidl::encoding::TypeMarker for InterruptionBehavior {
778 type Owned = Self;
779
780 #[inline(always)]
781 fn inline_align(_context: fidl::encoding::Context) -> usize {
782 std::mem::align_of::<u32>()
783 }
784
785 #[inline(always)]
786 fn inline_size(_context: fidl::encoding::Context) -> usize {
787 std::mem::size_of::<u32>()
788 }
789
790 #[inline(always)]
791 fn encode_is_copy() -> bool {
792 true
793 }
794
795 #[inline(always)]
796 fn decode_is_copy() -> bool {
797 false
798 }
799 }
800
801 impl fidl::encoding::ValueTypeMarker for InterruptionBehavior {
802 type Borrowed<'a> = Self;
803 #[inline(always)]
804 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
805 *value
806 }
807 }
808
809 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
810 for InterruptionBehavior
811 {
812 #[inline]
813 unsafe fn encode(
814 self,
815 encoder: &mut fidl::encoding::Encoder<'_, D>,
816 offset: usize,
817 _depth: fidl::encoding::Depth,
818 ) -> fidl::Result<()> {
819 encoder.debug_check_bounds::<Self>(offset);
820 encoder.write_num(self.into_primitive(), offset);
821 Ok(())
822 }
823 }
824
825 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterruptionBehavior {
826 #[inline(always)]
827 fn new_empty() -> Self {
828 Self::None
829 }
830
831 #[inline]
832 unsafe fn decode(
833 &mut self,
834 decoder: &mut fidl::encoding::Decoder<'_, D>,
835 offset: usize,
836 _depth: fidl::encoding::Depth,
837 ) -> fidl::Result<()> {
838 decoder.debug_check_bounds::<Self>(offset);
839 let prim = decoder.read_num::<u32>(offset);
840
841 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
842 Ok(())
843 }
844 }
845 unsafe impl fidl::encoding::TypeMarker for MediaImageType {
846 type Owned = Self;
847
848 #[inline(always)]
849 fn inline_align(_context: fidl::encoding::Context) -> usize {
850 std::mem::align_of::<u32>()
851 }
852
853 #[inline(always)]
854 fn inline_size(_context: fidl::encoding::Context) -> usize {
855 std::mem::size_of::<u32>()
856 }
857
858 #[inline(always)]
859 fn encode_is_copy() -> bool {
860 true
861 }
862
863 #[inline(always)]
864 fn decode_is_copy() -> bool {
865 false
866 }
867 }
868
869 impl fidl::encoding::ValueTypeMarker for MediaImageType {
870 type Borrowed<'a> = Self;
871 #[inline(always)]
872 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
873 *value
874 }
875 }
876
877 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MediaImageType {
878 #[inline]
879 unsafe fn encode(
880 self,
881 encoder: &mut fidl::encoding::Encoder<'_, D>,
882 offset: usize,
883 _depth: fidl::encoding::Depth,
884 ) -> fidl::Result<()> {
885 encoder.debug_check_bounds::<Self>(offset);
886 encoder.write_num(self.into_primitive(), offset);
887 Ok(())
888 }
889 }
890
891 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImageType {
892 #[inline(always)]
893 fn new_empty() -> Self {
894 Self::Artwork
895 }
896
897 #[inline]
898 unsafe fn decode(
899 &mut self,
900 decoder: &mut fidl::encoding::Decoder<'_, D>,
901 offset: usize,
902 _depth: fidl::encoding::Depth,
903 ) -> fidl::Result<()> {
904 decoder.debug_check_bounds::<Self>(offset);
905 let prim = decoder.read_num::<u32>(offset);
906
907 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
908 Ok(())
909 }
910 }
911 unsafe impl fidl::encoding::TypeMarker for PlayerState {
912 type Owned = Self;
913
914 #[inline(always)]
915 fn inline_align(_context: fidl::encoding::Context) -> usize {
916 std::mem::align_of::<u32>()
917 }
918
919 #[inline(always)]
920 fn inline_size(_context: fidl::encoding::Context) -> usize {
921 std::mem::size_of::<u32>()
922 }
923
924 #[inline(always)]
925 fn encode_is_copy() -> bool {
926 true
927 }
928
929 #[inline(always)]
930 fn decode_is_copy() -> bool {
931 false
932 }
933 }
934
935 impl fidl::encoding::ValueTypeMarker for PlayerState {
936 type Borrowed<'a> = Self;
937 #[inline(always)]
938 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
939 *value
940 }
941 }
942
943 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PlayerState {
944 #[inline]
945 unsafe fn encode(
946 self,
947 encoder: &mut fidl::encoding::Encoder<'_, D>,
948 offset: usize,
949 _depth: fidl::encoding::Depth,
950 ) -> fidl::Result<()> {
951 encoder.debug_check_bounds::<Self>(offset);
952 encoder.write_num(self.into_primitive(), offset);
953 Ok(())
954 }
955 }
956
957 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerState {
958 #[inline(always)]
959 fn new_empty() -> Self {
960 Self::Idle
961 }
962
963 #[inline]
964 unsafe fn decode(
965 &mut self,
966 decoder: &mut fidl::encoding::Decoder<'_, D>,
967 offset: usize,
968 _depth: fidl::encoding::Depth,
969 ) -> fidl::Result<()> {
970 decoder.debug_check_bounds::<Self>(offset);
971 let prim = decoder.read_num::<u32>(offset);
972
973 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
974 Ok(())
975 }
976 }
977 unsafe impl fidl::encoding::TypeMarker for RepeatMode {
978 type Owned = Self;
979
980 #[inline(always)]
981 fn inline_align(_context: fidl::encoding::Context) -> usize {
982 std::mem::align_of::<u32>()
983 }
984
985 #[inline(always)]
986 fn inline_size(_context: fidl::encoding::Context) -> usize {
987 std::mem::size_of::<u32>()
988 }
989
990 #[inline(always)]
991 fn encode_is_copy() -> bool {
992 true
993 }
994
995 #[inline(always)]
996 fn decode_is_copy() -> bool {
997 false
998 }
999 }
1000
1001 impl fidl::encoding::ValueTypeMarker for RepeatMode {
1002 type Borrowed<'a> = Self;
1003 #[inline(always)]
1004 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1005 *value
1006 }
1007 }
1008
1009 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RepeatMode {
1010 #[inline]
1011 unsafe fn encode(
1012 self,
1013 encoder: &mut fidl::encoding::Encoder<'_, D>,
1014 offset: usize,
1015 _depth: fidl::encoding::Depth,
1016 ) -> fidl::Result<()> {
1017 encoder.debug_check_bounds::<Self>(offset);
1018 encoder.write_num(self.into_primitive(), offset);
1019 Ok(())
1020 }
1021 }
1022
1023 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RepeatMode {
1024 #[inline(always)]
1025 fn new_empty() -> Self {
1026 Self::Off
1027 }
1028
1029 #[inline]
1030 unsafe fn decode(
1031 &mut self,
1032 decoder: &mut fidl::encoding::Decoder<'_, D>,
1033 offset: usize,
1034 _depth: fidl::encoding::Depth,
1035 ) -> fidl::Result<()> {
1036 decoder.debug_check_bounds::<Self>(offset);
1037 let prim = decoder.read_num::<u32>(offset);
1038
1039 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1040 Ok(())
1041 }
1042 }
1043
1044 impl fidl::encoding::ValueTypeMarker for ImageSizeVariant {
1045 type Borrowed<'a> = &'a Self;
1046 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1047 value
1048 }
1049 }
1050
1051 unsafe impl fidl::encoding::TypeMarker for ImageSizeVariant {
1052 type Owned = Self;
1053
1054 #[inline(always)]
1055 fn inline_align(_context: fidl::encoding::Context) -> usize {
1056 8
1057 }
1058
1059 #[inline(always)]
1060 fn inline_size(_context: fidl::encoding::Context) -> usize {
1061 24
1062 }
1063 }
1064
1065 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageSizeVariant, D>
1066 for &ImageSizeVariant
1067 {
1068 #[inline]
1069 unsafe fn encode(
1070 self,
1071 encoder: &mut fidl::encoding::Encoder<'_, D>,
1072 offset: usize,
1073 _depth: fidl::encoding::Depth,
1074 ) -> fidl::Result<()> {
1075 encoder.debug_check_bounds::<ImageSizeVariant>(offset);
1076 fidl::encoding::Encode::<ImageSizeVariant, D>::encode(
1078 (
1079 <fidl::encoding::BoundedString<4096> as fidl::encoding::ValueTypeMarker>::borrow(&self.url),
1080 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
1081 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
1082 ),
1083 encoder, offset, _depth
1084 )
1085 }
1086 }
1087 unsafe impl<
1088 D: fidl::encoding::ResourceDialect,
1089 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<4096>, D>,
1090 T1: fidl::encoding::Encode<u32, D>,
1091 T2: fidl::encoding::Encode<u32, D>,
1092 > fidl::encoding::Encode<ImageSizeVariant, D> for (T0, T1, T2)
1093 {
1094 #[inline]
1095 unsafe fn encode(
1096 self,
1097 encoder: &mut fidl::encoding::Encoder<'_, D>,
1098 offset: usize,
1099 depth: fidl::encoding::Depth,
1100 ) -> fidl::Result<()> {
1101 encoder.debug_check_bounds::<ImageSizeVariant>(offset);
1102 self.0.encode(encoder, offset + 0, depth)?;
1106 self.1.encode(encoder, offset + 16, depth)?;
1107 self.2.encode(encoder, offset + 20, depth)?;
1108 Ok(())
1109 }
1110 }
1111
1112 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageSizeVariant {
1113 #[inline(always)]
1114 fn new_empty() -> Self {
1115 Self {
1116 url: fidl::new_empty!(fidl::encoding::BoundedString<4096>, D),
1117 width: fidl::new_empty!(u32, D),
1118 height: fidl::new_empty!(u32, D),
1119 }
1120 }
1121
1122 #[inline]
1123 unsafe fn decode(
1124 &mut self,
1125 decoder: &mut fidl::encoding::Decoder<'_, D>,
1126 offset: usize,
1127 _depth: fidl::encoding::Depth,
1128 ) -> fidl::Result<()> {
1129 decoder.debug_check_bounds::<Self>(offset);
1130 fidl::decode!(
1132 fidl::encoding::BoundedString<4096>,
1133 D,
1134 &mut self.url,
1135 decoder,
1136 offset + 0,
1137 _depth
1138 )?;
1139 fidl::decode!(u32, D, &mut self.width, decoder, offset + 16, _depth)?;
1140 fidl::decode!(u32, D, &mut self.height, decoder, offset + 20, _depth)?;
1141 Ok(())
1142 }
1143 }
1144
1145 impl fidl::encoding::ValueTypeMarker for PlayerControlSeekRequest {
1146 type Borrowed<'a> = &'a Self;
1147 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1148 value
1149 }
1150 }
1151
1152 unsafe impl fidl::encoding::TypeMarker for PlayerControlSeekRequest {
1153 type Owned = Self;
1154
1155 #[inline(always)]
1156 fn inline_align(_context: fidl::encoding::Context) -> usize {
1157 8
1158 }
1159
1160 #[inline(always)]
1161 fn inline_size(_context: fidl::encoding::Context) -> usize {
1162 8
1163 }
1164 #[inline(always)]
1165 fn encode_is_copy() -> bool {
1166 true
1167 }
1168
1169 #[inline(always)]
1170 fn decode_is_copy() -> bool {
1171 true
1172 }
1173 }
1174
1175 unsafe impl<D: fidl::encoding::ResourceDialect>
1176 fidl::encoding::Encode<PlayerControlSeekRequest, D> for &PlayerControlSeekRequest
1177 {
1178 #[inline]
1179 unsafe fn encode(
1180 self,
1181 encoder: &mut fidl::encoding::Encoder<'_, D>,
1182 offset: usize,
1183 _depth: fidl::encoding::Depth,
1184 ) -> fidl::Result<()> {
1185 encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
1186 unsafe {
1187 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1189 (buf_ptr as *mut PlayerControlSeekRequest)
1190 .write_unaligned((self as *const PlayerControlSeekRequest).read());
1191 }
1194 Ok(())
1195 }
1196 }
1197 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1198 fidl::encoding::Encode<PlayerControlSeekRequest, D> for (T0,)
1199 {
1200 #[inline]
1201 unsafe fn encode(
1202 self,
1203 encoder: &mut fidl::encoding::Encoder<'_, D>,
1204 offset: usize,
1205 depth: fidl::encoding::Depth,
1206 ) -> fidl::Result<()> {
1207 encoder.debug_check_bounds::<PlayerControlSeekRequest>(offset);
1208 self.0.encode(encoder, offset + 0, depth)?;
1212 Ok(())
1213 }
1214 }
1215
1216 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1217 for PlayerControlSeekRequest
1218 {
1219 #[inline(always)]
1220 fn new_empty() -> Self {
1221 Self { position: fidl::new_empty!(i64, D) }
1222 }
1223
1224 #[inline]
1225 unsafe fn decode(
1226 &mut self,
1227 decoder: &mut fidl::encoding::Decoder<'_, D>,
1228 offset: usize,
1229 _depth: fidl::encoding::Depth,
1230 ) -> fidl::Result<()> {
1231 decoder.debug_check_bounds::<Self>(offset);
1232 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1233 unsafe {
1236 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1237 }
1238 Ok(())
1239 }
1240 }
1241
1242 impl fidl::encoding::ValueTypeMarker for PlayerControlSetPlaybackRateRequest {
1243 type Borrowed<'a> = &'a Self;
1244 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1245 value
1246 }
1247 }
1248
1249 unsafe impl fidl::encoding::TypeMarker for PlayerControlSetPlaybackRateRequest {
1250 type Owned = Self;
1251
1252 #[inline(always)]
1253 fn inline_align(_context: fidl::encoding::Context) -> usize {
1254 4
1255 }
1256
1257 #[inline(always)]
1258 fn inline_size(_context: fidl::encoding::Context) -> usize {
1259 4
1260 }
1261 }
1262
1263 unsafe impl<D: fidl::encoding::ResourceDialect>
1264 fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D>
1265 for &PlayerControlSetPlaybackRateRequest
1266 {
1267 #[inline]
1268 unsafe fn encode(
1269 self,
1270 encoder: &mut fidl::encoding::Encoder<'_, D>,
1271 offset: usize,
1272 _depth: fidl::encoding::Depth,
1273 ) -> fidl::Result<()> {
1274 encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
1275 fidl::encoding::Encode::<PlayerControlSetPlaybackRateRequest, D>::encode(
1277 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
1278 encoder,
1279 offset,
1280 _depth,
1281 )
1282 }
1283 }
1284 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1285 fidl::encoding::Encode<PlayerControlSetPlaybackRateRequest, D> for (T0,)
1286 {
1287 #[inline]
1288 unsafe fn encode(
1289 self,
1290 encoder: &mut fidl::encoding::Encoder<'_, D>,
1291 offset: usize,
1292 depth: fidl::encoding::Depth,
1293 ) -> fidl::Result<()> {
1294 encoder.debug_check_bounds::<PlayerControlSetPlaybackRateRequest>(offset);
1295 self.0.encode(encoder, offset + 0, depth)?;
1299 Ok(())
1300 }
1301 }
1302
1303 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1304 for PlayerControlSetPlaybackRateRequest
1305 {
1306 #[inline(always)]
1307 fn new_empty() -> Self {
1308 Self { playback_rate: fidl::new_empty!(f32, D) }
1309 }
1310
1311 #[inline]
1312 unsafe fn decode(
1313 &mut self,
1314 decoder: &mut fidl::encoding::Decoder<'_, D>,
1315 offset: usize,
1316 _depth: fidl::encoding::Depth,
1317 ) -> fidl::Result<()> {
1318 decoder.debug_check_bounds::<Self>(offset);
1319 fidl::decode!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
1321 Ok(())
1322 }
1323 }
1324
1325 impl fidl::encoding::ValueTypeMarker for PlayerControlSetRepeatModeRequest {
1326 type Borrowed<'a> = &'a Self;
1327 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1328 value
1329 }
1330 }
1331
1332 unsafe impl fidl::encoding::TypeMarker for PlayerControlSetRepeatModeRequest {
1333 type Owned = Self;
1334
1335 #[inline(always)]
1336 fn inline_align(_context: fidl::encoding::Context) -> usize {
1337 4
1338 }
1339
1340 #[inline(always)]
1341 fn inline_size(_context: fidl::encoding::Context) -> usize {
1342 4
1343 }
1344 }
1345
1346 unsafe impl<D: fidl::encoding::ResourceDialect>
1347 fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D>
1348 for &PlayerControlSetRepeatModeRequest
1349 {
1350 #[inline]
1351 unsafe fn encode(
1352 self,
1353 encoder: &mut fidl::encoding::Encoder<'_, D>,
1354 offset: usize,
1355 _depth: fidl::encoding::Depth,
1356 ) -> fidl::Result<()> {
1357 encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
1358 fidl::encoding::Encode::<PlayerControlSetRepeatModeRequest, D>::encode(
1360 (<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
1361 encoder,
1362 offset,
1363 _depth,
1364 )
1365 }
1366 }
1367 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
1368 fidl::encoding::Encode<PlayerControlSetRepeatModeRequest, D> for (T0,)
1369 {
1370 #[inline]
1371 unsafe fn encode(
1372 self,
1373 encoder: &mut fidl::encoding::Encoder<'_, D>,
1374 offset: usize,
1375 depth: fidl::encoding::Depth,
1376 ) -> fidl::Result<()> {
1377 encoder.debug_check_bounds::<PlayerControlSetRepeatModeRequest>(offset);
1378 self.0.encode(encoder, offset + 0, depth)?;
1382 Ok(())
1383 }
1384 }
1385
1386 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1387 for PlayerControlSetRepeatModeRequest
1388 {
1389 #[inline(always)]
1390 fn new_empty() -> Self {
1391 Self { repeat_mode: fidl::new_empty!(RepeatMode, D) }
1392 }
1393
1394 #[inline]
1395 unsafe fn decode(
1396 &mut self,
1397 decoder: &mut fidl::encoding::Decoder<'_, D>,
1398 offset: usize,
1399 _depth: fidl::encoding::Depth,
1400 ) -> fidl::Result<()> {
1401 decoder.debug_check_bounds::<Self>(offset);
1402 fidl::decode!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
1404 Ok(())
1405 }
1406 }
1407
1408 impl fidl::encoding::ValueTypeMarker for PlayerControlSetShuffleModeRequest {
1409 type Borrowed<'a> = &'a Self;
1410 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1411 value
1412 }
1413 }
1414
1415 unsafe impl fidl::encoding::TypeMarker for PlayerControlSetShuffleModeRequest {
1416 type Owned = Self;
1417
1418 #[inline(always)]
1419 fn inline_align(_context: fidl::encoding::Context) -> usize {
1420 1
1421 }
1422
1423 #[inline(always)]
1424 fn inline_size(_context: fidl::encoding::Context) -> usize {
1425 1
1426 }
1427 }
1428
1429 unsafe impl<D: fidl::encoding::ResourceDialect>
1430 fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D>
1431 for &PlayerControlSetShuffleModeRequest
1432 {
1433 #[inline]
1434 unsafe fn encode(
1435 self,
1436 encoder: &mut fidl::encoding::Encoder<'_, D>,
1437 offset: usize,
1438 _depth: fidl::encoding::Depth,
1439 ) -> fidl::Result<()> {
1440 encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
1441 fidl::encoding::Encode::<PlayerControlSetShuffleModeRequest, D>::encode(
1443 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
1444 encoder,
1445 offset,
1446 _depth,
1447 )
1448 }
1449 }
1450 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1451 fidl::encoding::Encode<PlayerControlSetShuffleModeRequest, D> for (T0,)
1452 {
1453 #[inline]
1454 unsafe fn encode(
1455 self,
1456 encoder: &mut fidl::encoding::Encoder<'_, D>,
1457 offset: usize,
1458 depth: fidl::encoding::Depth,
1459 ) -> fidl::Result<()> {
1460 encoder.debug_check_bounds::<PlayerControlSetShuffleModeRequest>(offset);
1461 self.0.encode(encoder, offset + 0, depth)?;
1465 Ok(())
1466 }
1467 }
1468
1469 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1470 for PlayerControlSetShuffleModeRequest
1471 {
1472 #[inline(always)]
1473 fn new_empty() -> Self {
1474 Self { shuffle_on: fidl::new_empty!(bool, D) }
1475 }
1476
1477 #[inline]
1478 unsafe fn decode(
1479 &mut self,
1480 decoder: &mut fidl::encoding::Decoder<'_, D>,
1481 offset: usize,
1482 _depth: fidl::encoding::Depth,
1483 ) -> fidl::Result<()> {
1484 decoder.debug_check_bounds::<Self>(offset);
1485 fidl::decode!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
1487 Ok(())
1488 }
1489 }
1490
1491 impl fidl::encoding::ValueTypeMarker for PlayerWatchInfoChangeResponse {
1492 type Borrowed<'a> = &'a Self;
1493 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1494 value
1495 }
1496 }
1497
1498 unsafe impl fidl::encoding::TypeMarker for PlayerWatchInfoChangeResponse {
1499 type Owned = Self;
1500
1501 #[inline(always)]
1502 fn inline_align(_context: fidl::encoding::Context) -> usize {
1503 8
1504 }
1505
1506 #[inline(always)]
1507 fn inline_size(_context: fidl::encoding::Context) -> usize {
1508 16
1509 }
1510 }
1511
1512 unsafe impl<D: fidl::encoding::ResourceDialect>
1513 fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D>
1514 for &PlayerWatchInfoChangeResponse
1515 {
1516 #[inline]
1517 unsafe fn encode(
1518 self,
1519 encoder: &mut fidl::encoding::Encoder<'_, D>,
1520 offset: usize,
1521 _depth: fidl::encoding::Depth,
1522 ) -> fidl::Result<()> {
1523 encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
1524 fidl::encoding::Encode::<PlayerWatchInfoChangeResponse, D>::encode(
1526 (<PlayerInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
1527 &self.player_info_delta,
1528 ),),
1529 encoder,
1530 offset,
1531 _depth,
1532 )
1533 }
1534 }
1535 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PlayerInfoDelta, D>>
1536 fidl::encoding::Encode<PlayerWatchInfoChangeResponse, D> for (T0,)
1537 {
1538 #[inline]
1539 unsafe fn encode(
1540 self,
1541 encoder: &mut fidl::encoding::Encoder<'_, D>,
1542 offset: usize,
1543 depth: fidl::encoding::Depth,
1544 ) -> fidl::Result<()> {
1545 encoder.debug_check_bounds::<PlayerWatchInfoChangeResponse>(offset);
1546 self.0.encode(encoder, offset + 0, depth)?;
1550 Ok(())
1551 }
1552 }
1553
1554 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1555 for PlayerWatchInfoChangeResponse
1556 {
1557 #[inline(always)]
1558 fn new_empty() -> Self {
1559 Self { player_info_delta: fidl::new_empty!(PlayerInfoDelta, D) }
1560 }
1561
1562 #[inline]
1563 unsafe fn decode(
1564 &mut self,
1565 decoder: &mut fidl::encoding::Decoder<'_, D>,
1566 offset: usize,
1567 _depth: fidl::encoding::Depth,
1568 ) -> fidl::Result<()> {
1569 decoder.debug_check_bounds::<Self>(offset);
1570 fidl::decode!(
1572 PlayerInfoDelta,
1573 D,
1574 &mut self.player_info_delta,
1575 decoder,
1576 offset + 0,
1577 _depth
1578 )?;
1579 Ok(())
1580 }
1581 }
1582
1583 impl fidl::encoding::ValueTypeMarker for PublisherPublishResponse {
1584 type Borrowed<'a> = &'a Self;
1585 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1586 value
1587 }
1588 }
1589
1590 unsafe impl fidl::encoding::TypeMarker for PublisherPublishResponse {
1591 type Owned = Self;
1592
1593 #[inline(always)]
1594 fn inline_align(_context: fidl::encoding::Context) -> usize {
1595 8
1596 }
1597
1598 #[inline(always)]
1599 fn inline_size(_context: fidl::encoding::Context) -> usize {
1600 8
1601 }
1602 #[inline(always)]
1603 fn encode_is_copy() -> bool {
1604 true
1605 }
1606
1607 #[inline(always)]
1608 fn decode_is_copy() -> bool {
1609 true
1610 }
1611 }
1612
1613 unsafe impl<D: fidl::encoding::ResourceDialect>
1614 fidl::encoding::Encode<PublisherPublishResponse, D> for &PublisherPublishResponse
1615 {
1616 #[inline]
1617 unsafe fn encode(
1618 self,
1619 encoder: &mut fidl::encoding::Encoder<'_, D>,
1620 offset: usize,
1621 _depth: fidl::encoding::Depth,
1622 ) -> fidl::Result<()> {
1623 encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
1624 unsafe {
1625 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1627 (buf_ptr as *mut PublisherPublishResponse)
1628 .write_unaligned((self as *const PublisherPublishResponse).read());
1629 }
1632 Ok(())
1633 }
1634 }
1635 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1636 fidl::encoding::Encode<PublisherPublishResponse, D> for (T0,)
1637 {
1638 #[inline]
1639 unsafe fn encode(
1640 self,
1641 encoder: &mut fidl::encoding::Encoder<'_, D>,
1642 offset: usize,
1643 depth: fidl::encoding::Depth,
1644 ) -> fidl::Result<()> {
1645 encoder.debug_check_bounds::<PublisherPublishResponse>(offset);
1646 self.0.encode(encoder, offset + 0, depth)?;
1650 Ok(())
1651 }
1652 }
1653
1654 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1655 for PublisherPublishResponse
1656 {
1657 #[inline(always)]
1658 fn new_empty() -> Self {
1659 Self { session_id: fidl::new_empty!(u64, D) }
1660 }
1661
1662 #[inline]
1663 unsafe fn decode(
1664 &mut self,
1665 decoder: &mut fidl::encoding::Decoder<'_, D>,
1666 offset: usize,
1667 _depth: fidl::encoding::Depth,
1668 ) -> fidl::Result<()> {
1669 decoder.debug_check_bounds::<Self>(offset);
1670 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1671 unsafe {
1674 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1675 }
1676 Ok(())
1677 }
1678 }
1679
1680 impl fidl::encoding::ValueTypeMarker for SessionControlSeekRequest {
1681 type Borrowed<'a> = &'a Self;
1682 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1683 value
1684 }
1685 }
1686
1687 unsafe impl fidl::encoding::TypeMarker for SessionControlSeekRequest {
1688 type Owned = Self;
1689
1690 #[inline(always)]
1691 fn inline_align(_context: fidl::encoding::Context) -> usize {
1692 8
1693 }
1694
1695 #[inline(always)]
1696 fn inline_size(_context: fidl::encoding::Context) -> usize {
1697 8
1698 }
1699 #[inline(always)]
1700 fn encode_is_copy() -> bool {
1701 true
1702 }
1703
1704 #[inline(always)]
1705 fn decode_is_copy() -> bool {
1706 true
1707 }
1708 }
1709
1710 unsafe impl<D: fidl::encoding::ResourceDialect>
1711 fidl::encoding::Encode<SessionControlSeekRequest, D> for &SessionControlSeekRequest
1712 {
1713 #[inline]
1714 unsafe fn encode(
1715 self,
1716 encoder: &mut fidl::encoding::Encoder<'_, D>,
1717 offset: usize,
1718 _depth: fidl::encoding::Depth,
1719 ) -> fidl::Result<()> {
1720 encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
1721 unsafe {
1722 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1724 (buf_ptr as *mut SessionControlSeekRequest)
1725 .write_unaligned((self as *const SessionControlSeekRequest).read());
1726 }
1729 Ok(())
1730 }
1731 }
1732 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i64, D>>
1733 fidl::encoding::Encode<SessionControlSeekRequest, D> for (T0,)
1734 {
1735 #[inline]
1736 unsafe fn encode(
1737 self,
1738 encoder: &mut fidl::encoding::Encoder<'_, D>,
1739 offset: usize,
1740 depth: fidl::encoding::Depth,
1741 ) -> fidl::Result<()> {
1742 encoder.debug_check_bounds::<SessionControlSeekRequest>(offset);
1743 self.0.encode(encoder, offset + 0, depth)?;
1747 Ok(())
1748 }
1749 }
1750
1751 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1752 for SessionControlSeekRequest
1753 {
1754 #[inline(always)]
1755 fn new_empty() -> Self {
1756 Self { position: fidl::new_empty!(i64, D) }
1757 }
1758
1759 #[inline]
1760 unsafe fn decode(
1761 &mut self,
1762 decoder: &mut fidl::encoding::Decoder<'_, D>,
1763 offset: usize,
1764 _depth: fidl::encoding::Depth,
1765 ) -> fidl::Result<()> {
1766 decoder.debug_check_bounds::<Self>(offset);
1767 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1768 unsafe {
1771 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1772 }
1773 Ok(())
1774 }
1775 }
1776
1777 impl fidl::encoding::ValueTypeMarker for SessionControlSetPlaybackRateRequest {
1778 type Borrowed<'a> = &'a Self;
1779 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1780 value
1781 }
1782 }
1783
1784 unsafe impl fidl::encoding::TypeMarker for SessionControlSetPlaybackRateRequest {
1785 type Owned = Self;
1786
1787 #[inline(always)]
1788 fn inline_align(_context: fidl::encoding::Context) -> usize {
1789 4
1790 }
1791
1792 #[inline(always)]
1793 fn inline_size(_context: fidl::encoding::Context) -> usize {
1794 4
1795 }
1796 }
1797
1798 unsafe impl<D: fidl::encoding::ResourceDialect>
1799 fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D>
1800 for &SessionControlSetPlaybackRateRequest
1801 {
1802 #[inline]
1803 unsafe fn encode(
1804 self,
1805 encoder: &mut fidl::encoding::Encoder<'_, D>,
1806 offset: usize,
1807 _depth: fidl::encoding::Depth,
1808 ) -> fidl::Result<()> {
1809 encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
1810 fidl::encoding::Encode::<SessionControlSetPlaybackRateRequest, D>::encode(
1812 (<f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.playback_rate),),
1813 encoder,
1814 offset,
1815 _depth,
1816 )
1817 }
1818 }
1819 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<f32, D>>
1820 fidl::encoding::Encode<SessionControlSetPlaybackRateRequest, D> for (T0,)
1821 {
1822 #[inline]
1823 unsafe fn encode(
1824 self,
1825 encoder: &mut fidl::encoding::Encoder<'_, D>,
1826 offset: usize,
1827 depth: fidl::encoding::Depth,
1828 ) -> fidl::Result<()> {
1829 encoder.debug_check_bounds::<SessionControlSetPlaybackRateRequest>(offset);
1830 self.0.encode(encoder, offset + 0, depth)?;
1834 Ok(())
1835 }
1836 }
1837
1838 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1839 for SessionControlSetPlaybackRateRequest
1840 {
1841 #[inline(always)]
1842 fn new_empty() -> Self {
1843 Self { playback_rate: fidl::new_empty!(f32, D) }
1844 }
1845
1846 #[inline]
1847 unsafe fn decode(
1848 &mut self,
1849 decoder: &mut fidl::encoding::Decoder<'_, D>,
1850 offset: usize,
1851 _depth: fidl::encoding::Depth,
1852 ) -> fidl::Result<()> {
1853 decoder.debug_check_bounds::<Self>(offset);
1854 fidl::decode!(f32, D, &mut self.playback_rate, decoder, offset + 0, _depth)?;
1856 Ok(())
1857 }
1858 }
1859
1860 impl fidl::encoding::ValueTypeMarker for SessionControlSetRepeatModeRequest {
1861 type Borrowed<'a> = &'a Self;
1862 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1863 value
1864 }
1865 }
1866
1867 unsafe impl fidl::encoding::TypeMarker for SessionControlSetRepeatModeRequest {
1868 type Owned = Self;
1869
1870 #[inline(always)]
1871 fn inline_align(_context: fidl::encoding::Context) -> usize {
1872 4
1873 }
1874
1875 #[inline(always)]
1876 fn inline_size(_context: fidl::encoding::Context) -> usize {
1877 4
1878 }
1879 }
1880
1881 unsafe impl<D: fidl::encoding::ResourceDialect>
1882 fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D>
1883 for &SessionControlSetRepeatModeRequest
1884 {
1885 #[inline]
1886 unsafe fn encode(
1887 self,
1888 encoder: &mut fidl::encoding::Encoder<'_, D>,
1889 offset: usize,
1890 _depth: fidl::encoding::Depth,
1891 ) -> fidl::Result<()> {
1892 encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
1893 fidl::encoding::Encode::<SessionControlSetRepeatModeRequest, D>::encode(
1895 (<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow(&self.repeat_mode),),
1896 encoder,
1897 offset,
1898 _depth,
1899 )
1900 }
1901 }
1902 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RepeatMode, D>>
1903 fidl::encoding::Encode<SessionControlSetRepeatModeRequest, D> for (T0,)
1904 {
1905 #[inline]
1906 unsafe fn encode(
1907 self,
1908 encoder: &mut fidl::encoding::Encoder<'_, D>,
1909 offset: usize,
1910 depth: fidl::encoding::Depth,
1911 ) -> fidl::Result<()> {
1912 encoder.debug_check_bounds::<SessionControlSetRepeatModeRequest>(offset);
1913 self.0.encode(encoder, offset + 0, depth)?;
1917 Ok(())
1918 }
1919 }
1920
1921 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1922 for SessionControlSetRepeatModeRequest
1923 {
1924 #[inline(always)]
1925 fn new_empty() -> Self {
1926 Self { repeat_mode: fidl::new_empty!(RepeatMode, D) }
1927 }
1928
1929 #[inline]
1930 unsafe fn decode(
1931 &mut self,
1932 decoder: &mut fidl::encoding::Decoder<'_, D>,
1933 offset: usize,
1934 _depth: fidl::encoding::Depth,
1935 ) -> fidl::Result<()> {
1936 decoder.debug_check_bounds::<Self>(offset);
1937 fidl::decode!(RepeatMode, D, &mut self.repeat_mode, decoder, offset + 0, _depth)?;
1939 Ok(())
1940 }
1941 }
1942
1943 impl fidl::encoding::ValueTypeMarker for SessionControlSetShuffleModeRequest {
1944 type Borrowed<'a> = &'a Self;
1945 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1946 value
1947 }
1948 }
1949
1950 unsafe impl fidl::encoding::TypeMarker for SessionControlSetShuffleModeRequest {
1951 type Owned = Self;
1952
1953 #[inline(always)]
1954 fn inline_align(_context: fidl::encoding::Context) -> usize {
1955 1
1956 }
1957
1958 #[inline(always)]
1959 fn inline_size(_context: fidl::encoding::Context) -> usize {
1960 1
1961 }
1962 }
1963
1964 unsafe impl<D: fidl::encoding::ResourceDialect>
1965 fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D>
1966 for &SessionControlSetShuffleModeRequest
1967 {
1968 #[inline]
1969 unsafe fn encode(
1970 self,
1971 encoder: &mut fidl::encoding::Encoder<'_, D>,
1972 offset: usize,
1973 _depth: fidl::encoding::Depth,
1974 ) -> fidl::Result<()> {
1975 encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
1976 fidl::encoding::Encode::<SessionControlSetShuffleModeRequest, D>::encode(
1978 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.shuffle_on),),
1979 encoder,
1980 offset,
1981 _depth,
1982 )
1983 }
1984 }
1985 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1986 fidl::encoding::Encode<SessionControlSetShuffleModeRequest, D> for (T0,)
1987 {
1988 #[inline]
1989 unsafe fn encode(
1990 self,
1991 encoder: &mut fidl::encoding::Encoder<'_, D>,
1992 offset: usize,
1993 depth: fidl::encoding::Depth,
1994 ) -> fidl::Result<()> {
1995 encoder.debug_check_bounds::<SessionControlSetShuffleModeRequest>(offset);
1996 self.0.encode(encoder, offset + 0, depth)?;
2000 Ok(())
2001 }
2002 }
2003
2004 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2005 for SessionControlSetShuffleModeRequest
2006 {
2007 #[inline(always)]
2008 fn new_empty() -> Self {
2009 Self { shuffle_on: fidl::new_empty!(bool, D) }
2010 }
2011
2012 #[inline]
2013 unsafe fn decode(
2014 &mut self,
2015 decoder: &mut fidl::encoding::Decoder<'_, D>,
2016 offset: usize,
2017 _depth: fidl::encoding::Depth,
2018 ) -> fidl::Result<()> {
2019 decoder.debug_check_bounds::<Self>(offset);
2020 fidl::decode!(bool, D, &mut self.shuffle_on, decoder, offset + 0, _depth)?;
2022 Ok(())
2023 }
2024 }
2025
2026 impl fidl::encoding::ValueTypeMarker for SessionControlWatchStatusResponse {
2027 type Borrowed<'a> = &'a Self;
2028 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2029 value
2030 }
2031 }
2032
2033 unsafe impl fidl::encoding::TypeMarker for SessionControlWatchStatusResponse {
2034 type Owned = Self;
2035
2036 #[inline(always)]
2037 fn inline_align(_context: fidl::encoding::Context) -> usize {
2038 8
2039 }
2040
2041 #[inline(always)]
2042 fn inline_size(_context: fidl::encoding::Context) -> usize {
2043 16
2044 }
2045 }
2046
2047 unsafe impl<D: fidl::encoding::ResourceDialect>
2048 fidl::encoding::Encode<SessionControlWatchStatusResponse, D>
2049 for &SessionControlWatchStatusResponse
2050 {
2051 #[inline]
2052 unsafe fn encode(
2053 self,
2054 encoder: &mut fidl::encoding::Encoder<'_, D>,
2055 offset: usize,
2056 _depth: fidl::encoding::Depth,
2057 ) -> fidl::Result<()> {
2058 encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
2059 fidl::encoding::Encode::<SessionControlWatchStatusResponse, D>::encode(
2061 (<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
2062 &self.session_info_delta,
2063 ),),
2064 encoder,
2065 offset,
2066 _depth,
2067 )
2068 }
2069 }
2070 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
2071 fidl::encoding::Encode<SessionControlWatchStatusResponse, D> for (T0,)
2072 {
2073 #[inline]
2074 unsafe fn encode(
2075 self,
2076 encoder: &mut fidl::encoding::Encoder<'_, D>,
2077 offset: usize,
2078 depth: fidl::encoding::Depth,
2079 ) -> fidl::Result<()> {
2080 encoder.debug_check_bounds::<SessionControlWatchStatusResponse>(offset);
2081 self.0.encode(encoder, offset + 0, depth)?;
2085 Ok(())
2086 }
2087 }
2088
2089 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2090 for SessionControlWatchStatusResponse
2091 {
2092 #[inline(always)]
2093 fn new_empty() -> Self {
2094 Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, D) }
2095 }
2096
2097 #[inline]
2098 unsafe fn decode(
2099 &mut self,
2100 decoder: &mut fidl::encoding::Decoder<'_, D>,
2101 offset: usize,
2102 _depth: fidl::encoding::Depth,
2103 ) -> fidl::Result<()> {
2104 decoder.debug_check_bounds::<Self>(offset);
2105 fidl::decode!(
2107 SessionInfoDelta,
2108 D,
2109 &mut self.session_info_delta,
2110 decoder,
2111 offset + 0,
2112 _depth
2113 )?;
2114 Ok(())
2115 }
2116 }
2117
2118 impl fidl::encoding::ValueTypeMarker for SessionObserverWatchStatusResponse {
2119 type Borrowed<'a> = &'a Self;
2120 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2121 value
2122 }
2123 }
2124
2125 unsafe impl fidl::encoding::TypeMarker for SessionObserverWatchStatusResponse {
2126 type Owned = Self;
2127
2128 #[inline(always)]
2129 fn inline_align(_context: fidl::encoding::Context) -> usize {
2130 8
2131 }
2132
2133 #[inline(always)]
2134 fn inline_size(_context: fidl::encoding::Context) -> usize {
2135 16
2136 }
2137 }
2138
2139 unsafe impl<D: fidl::encoding::ResourceDialect>
2140 fidl::encoding::Encode<SessionObserverWatchStatusResponse, D>
2141 for &SessionObserverWatchStatusResponse
2142 {
2143 #[inline]
2144 unsafe fn encode(
2145 self,
2146 encoder: &mut fidl::encoding::Encoder<'_, D>,
2147 offset: usize,
2148 _depth: fidl::encoding::Depth,
2149 ) -> fidl::Result<()> {
2150 encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
2151 fidl::encoding::Encode::<SessionObserverWatchStatusResponse, D>::encode(
2153 (<SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
2154 &self.session_info_delta,
2155 ),),
2156 encoder,
2157 offset,
2158 _depth,
2159 )
2160 }
2161 }
2162 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SessionInfoDelta, D>>
2163 fidl::encoding::Encode<SessionObserverWatchStatusResponse, D> for (T0,)
2164 {
2165 #[inline]
2166 unsafe fn encode(
2167 self,
2168 encoder: &mut fidl::encoding::Encoder<'_, D>,
2169 offset: usize,
2170 depth: fidl::encoding::Depth,
2171 ) -> fidl::Result<()> {
2172 encoder.debug_check_bounds::<SessionObserverWatchStatusResponse>(offset);
2173 self.0.encode(encoder, offset + 0, depth)?;
2177 Ok(())
2178 }
2179 }
2180
2181 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2182 for SessionObserverWatchStatusResponse
2183 {
2184 #[inline(always)]
2185 fn new_empty() -> Self {
2186 Self { session_info_delta: fidl::new_empty!(SessionInfoDelta, D) }
2187 }
2188
2189 #[inline]
2190 unsafe fn decode(
2191 &mut self,
2192 decoder: &mut fidl::encoding::Decoder<'_, D>,
2193 offset: usize,
2194 _depth: fidl::encoding::Depth,
2195 ) -> fidl::Result<()> {
2196 decoder.debug_check_bounds::<Self>(offset);
2197 fidl::decode!(
2199 SessionInfoDelta,
2200 D,
2201 &mut self.session_info_delta,
2202 decoder,
2203 offset + 0,
2204 _depth
2205 )?;
2206 Ok(())
2207 }
2208 }
2209
2210 impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionRemovedRequest {
2211 type Borrowed<'a> = &'a Self;
2212 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2213 value
2214 }
2215 }
2216
2217 unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionRemovedRequest {
2218 type Owned = Self;
2219
2220 #[inline(always)]
2221 fn inline_align(_context: fidl::encoding::Context) -> usize {
2222 8
2223 }
2224
2225 #[inline(always)]
2226 fn inline_size(_context: fidl::encoding::Context) -> usize {
2227 8
2228 }
2229 #[inline(always)]
2230 fn encode_is_copy() -> bool {
2231 true
2232 }
2233
2234 #[inline(always)]
2235 fn decode_is_copy() -> bool {
2236 true
2237 }
2238 }
2239
2240 unsafe impl<D: fidl::encoding::ResourceDialect>
2241 fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, D>
2242 for &SessionsWatcherSessionRemovedRequest
2243 {
2244 #[inline]
2245 unsafe fn encode(
2246 self,
2247 encoder: &mut fidl::encoding::Encoder<'_, D>,
2248 offset: usize,
2249 _depth: fidl::encoding::Depth,
2250 ) -> fidl::Result<()> {
2251 encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
2252 unsafe {
2253 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2255 (buf_ptr as *mut SessionsWatcherSessionRemovedRequest)
2256 .write_unaligned((self as *const SessionsWatcherSessionRemovedRequest).read());
2257 }
2260 Ok(())
2261 }
2262 }
2263 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2264 fidl::encoding::Encode<SessionsWatcherSessionRemovedRequest, D> for (T0,)
2265 {
2266 #[inline]
2267 unsafe fn encode(
2268 self,
2269 encoder: &mut fidl::encoding::Encoder<'_, D>,
2270 offset: usize,
2271 depth: fidl::encoding::Depth,
2272 ) -> fidl::Result<()> {
2273 encoder.debug_check_bounds::<SessionsWatcherSessionRemovedRequest>(offset);
2274 self.0.encode(encoder, offset + 0, depth)?;
2278 Ok(())
2279 }
2280 }
2281
2282 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2283 for SessionsWatcherSessionRemovedRequest
2284 {
2285 #[inline(always)]
2286 fn new_empty() -> Self {
2287 Self { session_id: fidl::new_empty!(u64, D) }
2288 }
2289
2290 #[inline]
2291 unsafe fn decode(
2292 &mut self,
2293 decoder: &mut fidl::encoding::Decoder<'_, D>,
2294 offset: usize,
2295 _depth: fidl::encoding::Depth,
2296 ) -> fidl::Result<()> {
2297 decoder.debug_check_bounds::<Self>(offset);
2298 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2299 unsafe {
2302 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2303 }
2304 Ok(())
2305 }
2306 }
2307
2308 impl fidl::encoding::ValueTypeMarker for SessionsWatcherSessionUpdatedRequest {
2309 type Borrowed<'a> = &'a Self;
2310 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2311 value
2312 }
2313 }
2314
2315 unsafe impl fidl::encoding::TypeMarker for SessionsWatcherSessionUpdatedRequest {
2316 type Owned = Self;
2317
2318 #[inline(always)]
2319 fn inline_align(_context: fidl::encoding::Context) -> usize {
2320 8
2321 }
2322
2323 #[inline(always)]
2324 fn inline_size(_context: fidl::encoding::Context) -> usize {
2325 24
2326 }
2327 }
2328
2329 unsafe impl<D: fidl::encoding::ResourceDialect>
2330 fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D>
2331 for &SessionsWatcherSessionUpdatedRequest
2332 {
2333 #[inline]
2334 unsafe fn encode(
2335 self,
2336 encoder: &mut fidl::encoding::Encoder<'_, D>,
2337 offset: usize,
2338 _depth: fidl::encoding::Depth,
2339 ) -> fidl::Result<()> {
2340 encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
2341 fidl::encoding::Encode::<SessionsWatcherSessionUpdatedRequest, D>::encode(
2343 (
2344 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.session_id),
2345 <SessionInfoDelta as fidl::encoding::ValueTypeMarker>::borrow(
2346 &self.session_info_delta,
2347 ),
2348 ),
2349 encoder,
2350 offset,
2351 _depth,
2352 )
2353 }
2354 }
2355 unsafe impl<
2356 D: fidl::encoding::ResourceDialect,
2357 T0: fidl::encoding::Encode<u64, D>,
2358 T1: fidl::encoding::Encode<SessionInfoDelta, D>,
2359 > fidl::encoding::Encode<SessionsWatcherSessionUpdatedRequest, D> for (T0, T1)
2360 {
2361 #[inline]
2362 unsafe fn encode(
2363 self,
2364 encoder: &mut fidl::encoding::Encoder<'_, D>,
2365 offset: usize,
2366 depth: fidl::encoding::Depth,
2367 ) -> fidl::Result<()> {
2368 encoder.debug_check_bounds::<SessionsWatcherSessionUpdatedRequest>(offset);
2369 self.0.encode(encoder, offset + 0, depth)?;
2373 self.1.encode(encoder, offset + 8, depth)?;
2374 Ok(())
2375 }
2376 }
2377
2378 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2379 for SessionsWatcherSessionUpdatedRequest
2380 {
2381 #[inline(always)]
2382 fn new_empty() -> Self {
2383 Self {
2384 session_id: fidl::new_empty!(u64, D),
2385 session_info_delta: fidl::new_empty!(SessionInfoDelta, D),
2386 }
2387 }
2388
2389 #[inline]
2390 unsafe fn decode(
2391 &mut self,
2392 decoder: &mut fidl::encoding::Decoder<'_, D>,
2393 offset: usize,
2394 _depth: fidl::encoding::Depth,
2395 ) -> fidl::Result<()> {
2396 decoder.debug_check_bounds::<Self>(offset);
2397 fidl::decode!(u64, D, &mut self.session_id, decoder, offset + 0, _depth)?;
2399 fidl::decode!(
2400 SessionInfoDelta,
2401 D,
2402 &mut self.session_info_delta,
2403 decoder,
2404 offset + 8,
2405 _depth
2406 )?;
2407 Ok(())
2408 }
2409 }
2410
2411 impl MediaImage {
2412 #[inline(always)]
2413 fn max_ordinal_present(&self) -> u64 {
2414 if let Some(_) = self.sizes {
2415 return 2;
2416 }
2417 if let Some(_) = self.image_type {
2418 return 1;
2419 }
2420 0
2421 }
2422 }
2423
2424 impl fidl::encoding::ValueTypeMarker for MediaImage {
2425 type Borrowed<'a> = &'a Self;
2426 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2427 value
2428 }
2429 }
2430
2431 unsafe impl fidl::encoding::TypeMarker for MediaImage {
2432 type Owned = Self;
2433
2434 #[inline(always)]
2435 fn inline_align(_context: fidl::encoding::Context) -> usize {
2436 8
2437 }
2438
2439 #[inline(always)]
2440 fn inline_size(_context: fidl::encoding::Context) -> usize {
2441 16
2442 }
2443 }
2444
2445 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaImage, D>
2446 for &MediaImage
2447 {
2448 unsafe fn encode(
2449 self,
2450 encoder: &mut fidl::encoding::Encoder<'_, D>,
2451 offset: usize,
2452 mut depth: fidl::encoding::Depth,
2453 ) -> fidl::Result<()> {
2454 encoder.debug_check_bounds::<MediaImage>(offset);
2455 let max_ordinal: u64 = self.max_ordinal_present();
2457 encoder.write_num(max_ordinal, offset);
2458 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2459 if max_ordinal == 0 {
2461 return Ok(());
2462 }
2463 depth.increment()?;
2464 let envelope_size = 8;
2465 let bytes_len = max_ordinal as usize * envelope_size;
2466 #[allow(unused_variables)]
2467 let offset = encoder.out_of_line_offset(bytes_len);
2468 let mut _prev_end_offset: usize = 0;
2469 if 1 > max_ordinal {
2470 return Ok(());
2471 }
2472
2473 let cur_offset: usize = (1 - 1) * envelope_size;
2476
2477 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2479
2480 fidl::encoding::encode_in_envelope_optional::<MediaImageType, D>(
2485 self.image_type
2486 .as_ref()
2487 .map(<MediaImageType as fidl::encoding::ValueTypeMarker>::borrow),
2488 encoder,
2489 offset + cur_offset,
2490 depth,
2491 )?;
2492
2493 _prev_end_offset = cur_offset + envelope_size;
2494 if 2 > max_ordinal {
2495 return Ok(());
2496 }
2497
2498 let cur_offset: usize = (2 - 1) * envelope_size;
2501
2502 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2504
2505 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ImageSizeVariant, 16>, D>(
2510 self.sizes.as_ref().map(<fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::ValueTypeMarker>::borrow),
2511 encoder, offset + cur_offset, depth
2512 )?;
2513
2514 _prev_end_offset = cur_offset + envelope_size;
2515
2516 Ok(())
2517 }
2518 }
2519
2520 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaImage {
2521 #[inline(always)]
2522 fn new_empty() -> Self {
2523 Self::default()
2524 }
2525
2526 unsafe fn decode(
2527 &mut self,
2528 decoder: &mut fidl::encoding::Decoder<'_, D>,
2529 offset: usize,
2530 mut depth: fidl::encoding::Depth,
2531 ) -> fidl::Result<()> {
2532 decoder.debug_check_bounds::<Self>(offset);
2533 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2534 None => return Err(fidl::Error::NotNullable),
2535 Some(len) => len,
2536 };
2537 if len == 0 {
2539 return Ok(());
2540 };
2541 depth.increment()?;
2542 let envelope_size = 8;
2543 let bytes_len = len * envelope_size;
2544 let offset = decoder.out_of_line_offset(bytes_len)?;
2545 let mut _next_ordinal_to_read = 0;
2547 let mut next_offset = offset;
2548 let end_offset = offset + bytes_len;
2549 _next_ordinal_to_read += 1;
2550 if next_offset >= end_offset {
2551 return Ok(());
2552 }
2553
2554 while _next_ordinal_to_read < 1 {
2556 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2557 _next_ordinal_to_read += 1;
2558 next_offset += envelope_size;
2559 }
2560
2561 let next_out_of_line = decoder.next_out_of_line();
2562 let handles_before = decoder.remaining_handles();
2563 if let Some((inlined, num_bytes, num_handles)) =
2564 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2565 {
2566 let member_inline_size =
2567 <MediaImageType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2568 if inlined != (member_inline_size <= 4) {
2569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2570 }
2571 let inner_offset;
2572 let mut inner_depth = depth.clone();
2573 if inlined {
2574 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2575 inner_offset = next_offset;
2576 } else {
2577 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2578 inner_depth.increment()?;
2579 }
2580 let val_ref =
2581 self.image_type.get_or_insert_with(|| fidl::new_empty!(MediaImageType, D));
2582 fidl::decode!(MediaImageType, D, val_ref, decoder, inner_offset, inner_depth)?;
2583 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2584 {
2585 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2586 }
2587 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2588 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2589 }
2590 }
2591
2592 next_offset += envelope_size;
2593 _next_ordinal_to_read += 1;
2594 if next_offset >= end_offset {
2595 return Ok(());
2596 }
2597
2598 while _next_ordinal_to_read < 2 {
2600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2601 _next_ordinal_to_read += 1;
2602 next_offset += envelope_size;
2603 }
2604
2605 let next_out_of_line = decoder.next_out_of_line();
2606 let handles_before = decoder.remaining_handles();
2607 if let Some((inlined, num_bytes, num_handles)) =
2608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2609 {
2610 let member_inline_size = <fidl::encoding::Vector<ImageSizeVariant, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2611 if inlined != (member_inline_size <= 4) {
2612 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2613 }
2614 let inner_offset;
2615 let mut inner_depth = depth.clone();
2616 if inlined {
2617 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2618 inner_offset = next_offset;
2619 } else {
2620 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2621 inner_depth.increment()?;
2622 }
2623 let val_ref = self.sizes.get_or_insert_with(
2624 || fidl::new_empty!(fidl::encoding::Vector<ImageSizeVariant, 16>, D),
2625 );
2626 fidl::decode!(fidl::encoding::Vector<ImageSizeVariant, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
2627 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2628 {
2629 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2630 }
2631 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2632 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2633 }
2634 }
2635
2636 next_offset += envelope_size;
2637
2638 while next_offset < end_offset {
2640 _next_ordinal_to_read += 1;
2641 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2642 next_offset += envelope_size;
2643 }
2644
2645 Ok(())
2646 }
2647 }
2648
2649 impl PlayerCapabilities {
2650 #[inline(always)]
2651 fn max_ordinal_present(&self) -> u64 {
2652 if let Some(_) = self.flags {
2653 return 1;
2654 }
2655 0
2656 }
2657 }
2658
2659 impl fidl::encoding::ValueTypeMarker for PlayerCapabilities {
2660 type Borrowed<'a> = &'a Self;
2661 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2662 value
2663 }
2664 }
2665
2666 unsafe impl fidl::encoding::TypeMarker for PlayerCapabilities {
2667 type Owned = Self;
2668
2669 #[inline(always)]
2670 fn inline_align(_context: fidl::encoding::Context) -> usize {
2671 8
2672 }
2673
2674 #[inline(always)]
2675 fn inline_size(_context: fidl::encoding::Context) -> usize {
2676 16
2677 }
2678 }
2679
2680 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerCapabilities, D>
2681 for &PlayerCapabilities
2682 {
2683 unsafe fn encode(
2684 self,
2685 encoder: &mut fidl::encoding::Encoder<'_, D>,
2686 offset: usize,
2687 mut depth: fidl::encoding::Depth,
2688 ) -> fidl::Result<()> {
2689 encoder.debug_check_bounds::<PlayerCapabilities>(offset);
2690 let max_ordinal: u64 = self.max_ordinal_present();
2692 encoder.write_num(max_ordinal, offset);
2693 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2694 if max_ordinal == 0 {
2696 return Ok(());
2697 }
2698 depth.increment()?;
2699 let envelope_size = 8;
2700 let bytes_len = max_ordinal as usize * envelope_size;
2701 #[allow(unused_variables)]
2702 let offset = encoder.out_of_line_offset(bytes_len);
2703 let mut _prev_end_offset: usize = 0;
2704 if 1 > max_ordinal {
2705 return Ok(());
2706 }
2707
2708 let cur_offset: usize = (1 - 1) * envelope_size;
2711
2712 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2714
2715 fidl::encoding::encode_in_envelope_optional::<PlayerCapabilityFlags, D>(
2720 self.flags
2721 .as_ref()
2722 .map(<PlayerCapabilityFlags as fidl::encoding::ValueTypeMarker>::borrow),
2723 encoder,
2724 offset + cur_offset,
2725 depth,
2726 )?;
2727
2728 _prev_end_offset = cur_offset + envelope_size;
2729
2730 Ok(())
2731 }
2732 }
2733
2734 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerCapabilities {
2735 #[inline(always)]
2736 fn new_empty() -> Self {
2737 Self::default()
2738 }
2739
2740 unsafe fn decode(
2741 &mut self,
2742 decoder: &mut fidl::encoding::Decoder<'_, D>,
2743 offset: usize,
2744 mut depth: fidl::encoding::Depth,
2745 ) -> fidl::Result<()> {
2746 decoder.debug_check_bounds::<Self>(offset);
2747 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2748 None => return Err(fidl::Error::NotNullable),
2749 Some(len) => len,
2750 };
2751 if len == 0 {
2753 return Ok(());
2754 };
2755 depth.increment()?;
2756 let envelope_size = 8;
2757 let bytes_len = len * envelope_size;
2758 let offset = decoder.out_of_line_offset(bytes_len)?;
2759 let mut _next_ordinal_to_read = 0;
2761 let mut next_offset = offset;
2762 let end_offset = offset + bytes_len;
2763 _next_ordinal_to_read += 1;
2764 if next_offset >= end_offset {
2765 return Ok(());
2766 }
2767
2768 while _next_ordinal_to_read < 1 {
2770 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2771 _next_ordinal_to_read += 1;
2772 next_offset += envelope_size;
2773 }
2774
2775 let next_out_of_line = decoder.next_out_of_line();
2776 let handles_before = decoder.remaining_handles();
2777 if let Some((inlined, num_bytes, num_handles)) =
2778 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2779 {
2780 let member_inline_size =
2781 <PlayerCapabilityFlags as fidl::encoding::TypeMarker>::inline_size(
2782 decoder.context,
2783 );
2784 if inlined != (member_inline_size <= 4) {
2785 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2786 }
2787 let inner_offset;
2788 let mut inner_depth = depth.clone();
2789 if inlined {
2790 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2791 inner_offset = next_offset;
2792 } else {
2793 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2794 inner_depth.increment()?;
2795 }
2796 let val_ref =
2797 self.flags.get_or_insert_with(|| fidl::new_empty!(PlayerCapabilityFlags, D));
2798 fidl::decode!(
2799 PlayerCapabilityFlags,
2800 D,
2801 val_ref,
2802 decoder,
2803 inner_offset,
2804 inner_depth
2805 )?;
2806 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2807 {
2808 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2809 }
2810 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2811 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2812 }
2813 }
2814
2815 next_offset += envelope_size;
2816
2817 while next_offset < end_offset {
2819 _next_ordinal_to_read += 1;
2820 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2821 next_offset += envelope_size;
2822 }
2823
2824 Ok(())
2825 }
2826 }
2827
2828 impl PlayerInfoDelta {
2829 #[inline(always)]
2830 fn max_ordinal_present(&self) -> u64 {
2831 if let Some(_) = self.interruption_behavior {
2832 return 6;
2833 }
2834 if let Some(_) = self.player_capabilities {
2835 return 5;
2836 }
2837 if let Some(_) = self.media_images {
2838 return 4;
2839 }
2840 if let Some(_) = self.metadata {
2841 return 3;
2842 }
2843 if let Some(_) = self.player_status {
2844 return 2;
2845 }
2846 if let Some(_) = self.local {
2847 return 1;
2848 }
2849 0
2850 }
2851 }
2852
2853 impl fidl::encoding::ValueTypeMarker for PlayerInfoDelta {
2854 type Borrowed<'a> = &'a Self;
2855 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2856 value
2857 }
2858 }
2859
2860 unsafe impl fidl::encoding::TypeMarker for PlayerInfoDelta {
2861 type Owned = Self;
2862
2863 #[inline(always)]
2864 fn inline_align(_context: fidl::encoding::Context) -> usize {
2865 8
2866 }
2867
2868 #[inline(always)]
2869 fn inline_size(_context: fidl::encoding::Context) -> usize {
2870 16
2871 }
2872 }
2873
2874 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerInfoDelta, D>
2875 for &PlayerInfoDelta
2876 {
2877 unsafe fn encode(
2878 self,
2879 encoder: &mut fidl::encoding::Encoder<'_, D>,
2880 offset: usize,
2881 mut depth: fidl::encoding::Depth,
2882 ) -> fidl::Result<()> {
2883 encoder.debug_check_bounds::<PlayerInfoDelta>(offset);
2884 let max_ordinal: u64 = self.max_ordinal_present();
2886 encoder.write_num(max_ordinal, offset);
2887 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2888 if max_ordinal == 0 {
2890 return Ok(());
2891 }
2892 depth.increment()?;
2893 let envelope_size = 8;
2894 let bytes_len = max_ordinal as usize * envelope_size;
2895 #[allow(unused_variables)]
2896 let offset = encoder.out_of_line_offset(bytes_len);
2897 let mut _prev_end_offset: usize = 0;
2898 if 1 > max_ordinal {
2899 return Ok(());
2900 }
2901
2902 let cur_offset: usize = (1 - 1) * envelope_size;
2905
2906 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2908
2909 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2914 self.local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2915 encoder,
2916 offset + cur_offset,
2917 depth,
2918 )?;
2919
2920 _prev_end_offset = cur_offset + envelope_size;
2921 if 2 > max_ordinal {
2922 return Ok(());
2923 }
2924
2925 let cur_offset: usize = (2 - 1) * envelope_size;
2928
2929 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2931
2932 fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
2937 self.player_status
2938 .as_ref()
2939 .map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
2940 encoder,
2941 offset + cur_offset,
2942 depth,
2943 )?;
2944
2945 _prev_end_offset = cur_offset + envelope_size;
2946 if 3 > max_ordinal {
2947 return Ok(());
2948 }
2949
2950 let cur_offset: usize = (3 - 1) * envelope_size;
2953
2954 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2956
2957 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::Metadata, D>(
2962 self.metadata
2963 .as_ref()
2964 .map(<fidl_fuchsia_media::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
2965 encoder,
2966 offset + cur_offset,
2967 depth,
2968 )?;
2969
2970 _prev_end_offset = cur_offset + envelope_size;
2971 if 4 > max_ordinal {
2972 return Ok(());
2973 }
2974
2975 let cur_offset: usize = (4 - 1) * envelope_size;
2978
2979 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2981
2982 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MediaImage, 16>, D>(
2987 self.media_images.as_ref().map(<fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::ValueTypeMarker>::borrow),
2988 encoder, offset + cur_offset, depth
2989 )?;
2990
2991 _prev_end_offset = cur_offset + envelope_size;
2992 if 5 > max_ordinal {
2993 return Ok(());
2994 }
2995
2996 let cur_offset: usize = (5 - 1) * envelope_size;
2999
3000 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3002
3003 fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
3008 self.player_capabilities
3009 .as_ref()
3010 .map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
3011 encoder,
3012 offset + cur_offset,
3013 depth,
3014 )?;
3015
3016 _prev_end_offset = cur_offset + envelope_size;
3017 if 6 > max_ordinal {
3018 return Ok(());
3019 }
3020
3021 let cur_offset: usize = (6 - 1) * envelope_size;
3024
3025 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3027
3028 fidl::encoding::encode_in_envelope_optional::<InterruptionBehavior, D>(
3033 self.interruption_behavior
3034 .as_ref()
3035 .map(<InterruptionBehavior as fidl::encoding::ValueTypeMarker>::borrow),
3036 encoder,
3037 offset + cur_offset,
3038 depth,
3039 )?;
3040
3041 _prev_end_offset = cur_offset + envelope_size;
3042
3043 Ok(())
3044 }
3045 }
3046
3047 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerInfoDelta {
3048 #[inline(always)]
3049 fn new_empty() -> Self {
3050 Self::default()
3051 }
3052
3053 unsafe fn decode(
3054 &mut self,
3055 decoder: &mut fidl::encoding::Decoder<'_, D>,
3056 offset: usize,
3057 mut depth: fidl::encoding::Depth,
3058 ) -> fidl::Result<()> {
3059 decoder.debug_check_bounds::<Self>(offset);
3060 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3061 None => return Err(fidl::Error::NotNullable),
3062 Some(len) => len,
3063 };
3064 if len == 0 {
3066 return Ok(());
3067 };
3068 depth.increment()?;
3069 let envelope_size = 8;
3070 let bytes_len = len * envelope_size;
3071 let offset = decoder.out_of_line_offset(bytes_len)?;
3072 let mut _next_ordinal_to_read = 0;
3074 let mut next_offset = offset;
3075 let end_offset = offset + bytes_len;
3076 _next_ordinal_to_read += 1;
3077 if next_offset >= end_offset {
3078 return Ok(());
3079 }
3080
3081 while _next_ordinal_to_read < 1 {
3083 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3084 _next_ordinal_to_read += 1;
3085 next_offset += envelope_size;
3086 }
3087
3088 let next_out_of_line = decoder.next_out_of_line();
3089 let handles_before = decoder.remaining_handles();
3090 if let Some((inlined, num_bytes, num_handles)) =
3091 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3092 {
3093 let member_inline_size =
3094 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3095 if inlined != (member_inline_size <= 4) {
3096 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3097 }
3098 let inner_offset;
3099 let mut inner_depth = depth.clone();
3100 if inlined {
3101 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3102 inner_offset = next_offset;
3103 } else {
3104 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3105 inner_depth.increment()?;
3106 }
3107 let val_ref = self.local.get_or_insert_with(|| fidl::new_empty!(bool, D));
3108 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3109 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3110 {
3111 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3112 }
3113 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3114 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3115 }
3116 }
3117
3118 next_offset += envelope_size;
3119 _next_ordinal_to_read += 1;
3120 if next_offset >= end_offset {
3121 return Ok(());
3122 }
3123
3124 while _next_ordinal_to_read < 2 {
3126 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3127 _next_ordinal_to_read += 1;
3128 next_offset += envelope_size;
3129 }
3130
3131 let next_out_of_line = decoder.next_out_of_line();
3132 let handles_before = decoder.remaining_handles();
3133 if let Some((inlined, num_bytes, num_handles)) =
3134 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3135 {
3136 let member_inline_size =
3137 <PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3138 if inlined != (member_inline_size <= 4) {
3139 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3140 }
3141 let inner_offset;
3142 let mut inner_depth = depth.clone();
3143 if inlined {
3144 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3145 inner_offset = next_offset;
3146 } else {
3147 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3148 inner_depth.increment()?;
3149 }
3150 let val_ref =
3151 self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
3152 fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
3153 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3154 {
3155 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3156 }
3157 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3158 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3159 }
3160 }
3161
3162 next_offset += envelope_size;
3163 _next_ordinal_to_read += 1;
3164 if next_offset >= end_offset {
3165 return Ok(());
3166 }
3167
3168 while _next_ordinal_to_read < 3 {
3170 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3171 _next_ordinal_to_read += 1;
3172 next_offset += envelope_size;
3173 }
3174
3175 let next_out_of_line = decoder.next_out_of_line();
3176 let handles_before = decoder.remaining_handles();
3177 if let Some((inlined, num_bytes, num_handles)) =
3178 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3179 {
3180 let member_inline_size =
3181 <fidl_fuchsia_media::Metadata as fidl::encoding::TypeMarker>::inline_size(
3182 decoder.context,
3183 );
3184 if inlined != (member_inline_size <= 4) {
3185 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3186 }
3187 let inner_offset;
3188 let mut inner_depth = depth.clone();
3189 if inlined {
3190 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3191 inner_offset = next_offset;
3192 } else {
3193 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3194 inner_depth.increment()?;
3195 }
3196 let val_ref = self
3197 .metadata
3198 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::Metadata, D));
3199 fidl::decode!(
3200 fidl_fuchsia_media::Metadata,
3201 D,
3202 val_ref,
3203 decoder,
3204 inner_offset,
3205 inner_depth
3206 )?;
3207 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3208 {
3209 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3210 }
3211 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3212 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3213 }
3214 }
3215
3216 next_offset += envelope_size;
3217 _next_ordinal_to_read += 1;
3218 if next_offset >= end_offset {
3219 return Ok(());
3220 }
3221
3222 while _next_ordinal_to_read < 4 {
3224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3225 _next_ordinal_to_read += 1;
3226 next_offset += envelope_size;
3227 }
3228
3229 let next_out_of_line = decoder.next_out_of_line();
3230 let handles_before = decoder.remaining_handles();
3231 if let Some((inlined, num_bytes, num_handles)) =
3232 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3233 {
3234 let member_inline_size = <fidl::encoding::Vector<MediaImage, 16> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3235 if inlined != (member_inline_size <= 4) {
3236 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3237 }
3238 let inner_offset;
3239 let mut inner_depth = depth.clone();
3240 if inlined {
3241 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3242 inner_offset = next_offset;
3243 } else {
3244 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3245 inner_depth.increment()?;
3246 }
3247 let val_ref = self.media_images.get_or_insert_with(
3248 || fidl::new_empty!(fidl::encoding::Vector<MediaImage, 16>, D),
3249 );
3250 fidl::decode!(fidl::encoding::Vector<MediaImage, 16>, D, val_ref, decoder, inner_offset, inner_depth)?;
3251 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3252 {
3253 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3254 }
3255 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3256 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3257 }
3258 }
3259
3260 next_offset += envelope_size;
3261 _next_ordinal_to_read += 1;
3262 if next_offset >= end_offset {
3263 return Ok(());
3264 }
3265
3266 while _next_ordinal_to_read < 5 {
3268 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3269 _next_ordinal_to_read += 1;
3270 next_offset += envelope_size;
3271 }
3272
3273 let next_out_of_line = decoder.next_out_of_line();
3274 let handles_before = decoder.remaining_handles();
3275 if let Some((inlined, num_bytes, num_handles)) =
3276 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3277 {
3278 let member_inline_size =
3279 <PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
3280 decoder.context,
3281 );
3282 if inlined != (member_inline_size <= 4) {
3283 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3284 }
3285 let inner_offset;
3286 let mut inner_depth = depth.clone();
3287 if inlined {
3288 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3289 inner_offset = next_offset;
3290 } else {
3291 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3292 inner_depth.increment()?;
3293 }
3294 let val_ref = self
3295 .player_capabilities
3296 .get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
3297 fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
3298 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3299 {
3300 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3301 }
3302 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3303 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3304 }
3305 }
3306
3307 next_offset += envelope_size;
3308 _next_ordinal_to_read += 1;
3309 if next_offset >= end_offset {
3310 return Ok(());
3311 }
3312
3313 while _next_ordinal_to_read < 6 {
3315 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3316 _next_ordinal_to_read += 1;
3317 next_offset += envelope_size;
3318 }
3319
3320 let next_out_of_line = decoder.next_out_of_line();
3321 let handles_before = decoder.remaining_handles();
3322 if let Some((inlined, num_bytes, num_handles)) =
3323 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3324 {
3325 let member_inline_size =
3326 <InterruptionBehavior as fidl::encoding::TypeMarker>::inline_size(
3327 decoder.context,
3328 );
3329 if inlined != (member_inline_size <= 4) {
3330 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3331 }
3332 let inner_offset;
3333 let mut inner_depth = depth.clone();
3334 if inlined {
3335 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3336 inner_offset = next_offset;
3337 } else {
3338 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3339 inner_depth.increment()?;
3340 }
3341 let val_ref = self
3342 .interruption_behavior
3343 .get_or_insert_with(|| fidl::new_empty!(InterruptionBehavior, D));
3344 fidl::decode!(
3345 InterruptionBehavior,
3346 D,
3347 val_ref,
3348 decoder,
3349 inner_offset,
3350 inner_depth
3351 )?;
3352 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3353 {
3354 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3355 }
3356 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3357 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3358 }
3359 }
3360
3361 next_offset += envelope_size;
3362
3363 while next_offset < end_offset {
3365 _next_ordinal_to_read += 1;
3366 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3367 next_offset += envelope_size;
3368 }
3369
3370 Ok(())
3371 }
3372 }
3373
3374 impl PlayerRegistration {
3375 #[inline(always)]
3376 fn max_ordinal_present(&self) -> u64 {
3377 if let Some(_) = self.usage2 {
3378 return 3;
3379 }
3380 if let Some(_) = self.usage {
3381 return 2;
3382 }
3383 if let Some(_) = self.domain {
3384 return 1;
3385 }
3386 0
3387 }
3388 }
3389
3390 impl fidl::encoding::ValueTypeMarker for PlayerRegistration {
3391 type Borrowed<'a> = &'a Self;
3392 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3393 value
3394 }
3395 }
3396
3397 unsafe impl fidl::encoding::TypeMarker for PlayerRegistration {
3398 type Owned = Self;
3399
3400 #[inline(always)]
3401 fn inline_align(_context: fidl::encoding::Context) -> usize {
3402 8
3403 }
3404
3405 #[inline(always)]
3406 fn inline_size(_context: fidl::encoding::Context) -> usize {
3407 16
3408 }
3409 }
3410
3411 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerRegistration, D>
3412 for &PlayerRegistration
3413 {
3414 unsafe fn encode(
3415 self,
3416 encoder: &mut fidl::encoding::Encoder<'_, D>,
3417 offset: usize,
3418 mut depth: fidl::encoding::Depth,
3419 ) -> fidl::Result<()> {
3420 encoder.debug_check_bounds::<PlayerRegistration>(offset);
3421 let max_ordinal: u64 = self.max_ordinal_present();
3423 encoder.write_num(max_ordinal, offset);
3424 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3425 if max_ordinal == 0 {
3427 return Ok(());
3428 }
3429 depth.increment()?;
3430 let envelope_size = 8;
3431 let bytes_len = max_ordinal as usize * envelope_size;
3432 #[allow(unused_variables)]
3433 let offset = encoder.out_of_line_offset(bytes_len);
3434 let mut _prev_end_offset: usize = 0;
3435 if 1 > max_ordinal {
3436 return Ok(());
3437 }
3438
3439 let cur_offset: usize = (1 - 1) * envelope_size;
3442
3443 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3445
3446 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
3451 self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
3452 encoder, offset + cur_offset, depth
3453 )?;
3454
3455 _prev_end_offset = cur_offset + envelope_size;
3456 if 2 > max_ordinal {
3457 return Ok(());
3458 }
3459
3460 let cur_offset: usize = (2 - 1) * envelope_size;
3463
3464 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3466
3467 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage, D>(
3472 self.usage.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow),
3473 encoder, offset + cur_offset, depth
3474 )?;
3475
3476 _prev_end_offset = cur_offset + envelope_size;
3477 if 3 > max_ordinal {
3478 return Ok(());
3479 }
3480
3481 let cur_offset: usize = (3 - 1) * envelope_size;
3484
3485 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3487
3488 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage2, D>(
3493 self.usage2.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow),
3494 encoder, offset + cur_offset, depth
3495 )?;
3496
3497 _prev_end_offset = cur_offset + envelope_size;
3498
3499 Ok(())
3500 }
3501 }
3502
3503 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerRegistration {
3504 #[inline(always)]
3505 fn new_empty() -> Self {
3506 Self::default()
3507 }
3508
3509 unsafe fn decode(
3510 &mut self,
3511 decoder: &mut fidl::encoding::Decoder<'_, D>,
3512 offset: usize,
3513 mut depth: fidl::encoding::Depth,
3514 ) -> fidl::Result<()> {
3515 decoder.debug_check_bounds::<Self>(offset);
3516 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3517 None => return Err(fidl::Error::NotNullable),
3518 Some(len) => len,
3519 };
3520 if len == 0 {
3522 return Ok(());
3523 };
3524 depth.increment()?;
3525 let envelope_size = 8;
3526 let bytes_len = len * envelope_size;
3527 let offset = decoder.out_of_line_offset(bytes_len)?;
3528 let mut _next_ordinal_to_read = 0;
3530 let mut next_offset = offset;
3531 let end_offset = offset + bytes_len;
3532 _next_ordinal_to_read += 1;
3533 if next_offset >= end_offset {
3534 return Ok(());
3535 }
3536
3537 while _next_ordinal_to_read < 1 {
3539 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3540 _next_ordinal_to_read += 1;
3541 next_offset += envelope_size;
3542 }
3543
3544 let next_out_of_line = decoder.next_out_of_line();
3545 let handles_before = decoder.remaining_handles();
3546 if let Some((inlined, num_bytes, num_handles)) =
3547 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3548 {
3549 let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3550 if inlined != (member_inline_size <= 4) {
3551 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3552 }
3553 let inner_offset;
3554 let mut inner_depth = depth.clone();
3555 if inlined {
3556 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3557 inner_offset = next_offset;
3558 } else {
3559 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3560 inner_depth.increment()?;
3561 }
3562 let val_ref = self.domain.get_or_insert_with(|| {
3563 fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
3564 });
3565 fidl::decode!(
3566 fidl::encoding::BoundedString<1000>,
3567 D,
3568 val_ref,
3569 decoder,
3570 inner_offset,
3571 inner_depth
3572 )?;
3573 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3574 {
3575 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3576 }
3577 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3578 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3579 }
3580 }
3581
3582 next_offset += envelope_size;
3583 _next_ordinal_to_read += 1;
3584 if next_offset >= end_offset {
3585 return Ok(());
3586 }
3587
3588 while _next_ordinal_to_read < 2 {
3590 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3591 _next_ordinal_to_read += 1;
3592 next_offset += envelope_size;
3593 }
3594
3595 let next_out_of_line = decoder.next_out_of_line();
3596 let handles_before = decoder.remaining_handles();
3597 if let Some((inlined, num_bytes, num_handles)) =
3598 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3599 {
3600 let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3601 if inlined != (member_inline_size <= 4) {
3602 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3603 }
3604 let inner_offset;
3605 let mut inner_depth = depth.clone();
3606 if inlined {
3607 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3608 inner_offset = next_offset;
3609 } else {
3610 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3611 inner_depth.increment()?;
3612 }
3613 let val_ref = self.usage.get_or_insert_with(|| {
3614 fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D)
3615 });
3616 fidl::decode!(
3617 fidl_fuchsia_media::AudioRenderUsage,
3618 D,
3619 val_ref,
3620 decoder,
3621 inner_offset,
3622 inner_depth
3623 )?;
3624 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3625 {
3626 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3627 }
3628 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3629 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3630 }
3631 }
3632
3633 next_offset += envelope_size;
3634 _next_ordinal_to_read += 1;
3635 if next_offset >= end_offset {
3636 return Ok(());
3637 }
3638
3639 while _next_ordinal_to_read < 3 {
3641 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3642 _next_ordinal_to_read += 1;
3643 next_offset += envelope_size;
3644 }
3645
3646 let next_out_of_line = decoder.next_out_of_line();
3647 let handles_before = decoder.remaining_handles();
3648 if let Some((inlined, num_bytes, num_handles)) =
3649 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3650 {
3651 let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3652 if inlined != (member_inline_size <= 4) {
3653 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3654 }
3655 let inner_offset;
3656 let mut inner_depth = depth.clone();
3657 if inlined {
3658 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3659 inner_offset = next_offset;
3660 } else {
3661 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3662 inner_depth.increment()?;
3663 }
3664 let val_ref = self.usage2.get_or_insert_with(|| {
3665 fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage2, D)
3666 });
3667 fidl::decode!(
3668 fidl_fuchsia_media::AudioRenderUsage2,
3669 D,
3670 val_ref,
3671 decoder,
3672 inner_offset,
3673 inner_depth
3674 )?;
3675 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3676 {
3677 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3678 }
3679 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3680 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3681 }
3682 }
3683
3684 next_offset += envelope_size;
3685
3686 while next_offset < end_offset {
3688 _next_ordinal_to_read += 1;
3689 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3690 next_offset += envelope_size;
3691 }
3692
3693 Ok(())
3694 }
3695 }
3696
3697 impl PlayerStatus {
3698 #[inline(always)]
3699 fn max_ordinal_present(&self) -> u64 {
3700 if let Some(_) = self.is_live {
3701 return 8;
3702 }
3703 if let Some(_) = self.error {
3704 return 7;
3705 }
3706 if let Some(_) = self.content_type {
3707 return 6;
3708 }
3709 if let Some(_) = self.shuffle_on {
3710 return 5;
3711 }
3712 if let Some(_) = self.repeat_mode {
3713 return 4;
3714 }
3715 if let Some(_) = self.timeline_function {
3716 return 3;
3717 }
3718 if let Some(_) = self.player_state {
3719 return 2;
3720 }
3721 if let Some(_) = self.duration {
3722 return 1;
3723 }
3724 0
3725 }
3726 }
3727
3728 impl fidl::encoding::ValueTypeMarker for PlayerStatus {
3729 type Borrowed<'a> = &'a Self;
3730 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3731 value
3732 }
3733 }
3734
3735 unsafe impl fidl::encoding::TypeMarker for PlayerStatus {
3736 type Owned = Self;
3737
3738 #[inline(always)]
3739 fn inline_align(_context: fidl::encoding::Context) -> usize {
3740 8
3741 }
3742
3743 #[inline(always)]
3744 fn inline_size(_context: fidl::encoding::Context) -> usize {
3745 16
3746 }
3747 }
3748
3749 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PlayerStatus, D>
3750 for &PlayerStatus
3751 {
3752 unsafe fn encode(
3753 self,
3754 encoder: &mut fidl::encoding::Encoder<'_, D>,
3755 offset: usize,
3756 mut depth: fidl::encoding::Depth,
3757 ) -> fidl::Result<()> {
3758 encoder.debug_check_bounds::<PlayerStatus>(offset);
3759 let max_ordinal: u64 = self.max_ordinal_present();
3761 encoder.write_num(max_ordinal, offset);
3762 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3763 if max_ordinal == 0 {
3765 return Ok(());
3766 }
3767 depth.increment()?;
3768 let envelope_size = 8;
3769 let bytes_len = max_ordinal as usize * envelope_size;
3770 #[allow(unused_variables)]
3771 let offset = encoder.out_of_line_offset(bytes_len);
3772 let mut _prev_end_offset: usize = 0;
3773 if 1 > max_ordinal {
3774 return Ok(());
3775 }
3776
3777 let cur_offset: usize = (1 - 1) * envelope_size;
3780
3781 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3783
3784 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3789 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3790 encoder,
3791 offset + cur_offset,
3792 depth,
3793 )?;
3794
3795 _prev_end_offset = cur_offset + envelope_size;
3796 if 2 > max_ordinal {
3797 return Ok(());
3798 }
3799
3800 let cur_offset: usize = (2 - 1) * envelope_size;
3803
3804 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3806
3807 fidl::encoding::encode_in_envelope_optional::<PlayerState, D>(
3812 self.player_state
3813 .as_ref()
3814 .map(<PlayerState as fidl::encoding::ValueTypeMarker>::borrow),
3815 encoder,
3816 offset + cur_offset,
3817 depth,
3818 )?;
3819
3820 _prev_end_offset = cur_offset + envelope_size;
3821 if 3 > max_ordinal {
3822 return Ok(());
3823 }
3824
3825 let cur_offset: usize = (3 - 1) * envelope_size;
3828
3829 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3831
3832 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::TimelineFunction, D>(
3837 self.timeline_function.as_ref().map(<fidl_fuchsia_media::TimelineFunction as fidl::encoding::ValueTypeMarker>::borrow),
3838 encoder, offset + cur_offset, depth
3839 )?;
3840
3841 _prev_end_offset = cur_offset + envelope_size;
3842 if 4 > max_ordinal {
3843 return Ok(());
3844 }
3845
3846 let cur_offset: usize = (4 - 1) * envelope_size;
3849
3850 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3852
3853 fidl::encoding::encode_in_envelope_optional::<RepeatMode, D>(
3858 self.repeat_mode
3859 .as_ref()
3860 .map(<RepeatMode as fidl::encoding::ValueTypeMarker>::borrow),
3861 encoder,
3862 offset + cur_offset,
3863 depth,
3864 )?;
3865
3866 _prev_end_offset = cur_offset + envelope_size;
3867 if 5 > max_ordinal {
3868 return Ok(());
3869 }
3870
3871 let cur_offset: usize = (5 - 1) * envelope_size;
3874
3875 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3877
3878 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3883 self.shuffle_on.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3884 encoder,
3885 offset + cur_offset,
3886 depth,
3887 )?;
3888
3889 _prev_end_offset = cur_offset + envelope_size;
3890 if 6 > max_ordinal {
3891 return Ok(());
3892 }
3893
3894 let cur_offset: usize = (6 - 1) * envelope_size;
3897
3898 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3900
3901 fidl::encoding::encode_in_envelope_optional::<ContentType, D>(
3906 self.content_type
3907 .as_ref()
3908 .map(<ContentType as fidl::encoding::ValueTypeMarker>::borrow),
3909 encoder,
3910 offset + cur_offset,
3911 depth,
3912 )?;
3913
3914 _prev_end_offset = cur_offset + envelope_size;
3915 if 7 > max_ordinal {
3916 return Ok(());
3917 }
3918
3919 let cur_offset: usize = (7 - 1) * envelope_size;
3922
3923 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3925
3926 fidl::encoding::encode_in_envelope_optional::<Error, D>(
3931 self.error.as_ref().map(<Error as fidl::encoding::ValueTypeMarker>::borrow),
3932 encoder,
3933 offset + cur_offset,
3934 depth,
3935 )?;
3936
3937 _prev_end_offset = cur_offset + envelope_size;
3938 if 8 > max_ordinal {
3939 return Ok(());
3940 }
3941
3942 let cur_offset: usize = (8 - 1) * envelope_size;
3945
3946 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3948
3949 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3954 self.is_live.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3955 encoder,
3956 offset + cur_offset,
3957 depth,
3958 )?;
3959
3960 _prev_end_offset = cur_offset + envelope_size;
3961
3962 Ok(())
3963 }
3964 }
3965
3966 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PlayerStatus {
3967 #[inline(always)]
3968 fn new_empty() -> Self {
3969 Self::default()
3970 }
3971
3972 unsafe fn decode(
3973 &mut self,
3974 decoder: &mut fidl::encoding::Decoder<'_, D>,
3975 offset: usize,
3976 mut depth: fidl::encoding::Depth,
3977 ) -> fidl::Result<()> {
3978 decoder.debug_check_bounds::<Self>(offset);
3979 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3980 None => return Err(fidl::Error::NotNullable),
3981 Some(len) => len,
3982 };
3983 if len == 0 {
3985 return Ok(());
3986 };
3987 depth.increment()?;
3988 let envelope_size = 8;
3989 let bytes_len = len * envelope_size;
3990 let offset = decoder.out_of_line_offset(bytes_len)?;
3991 let mut _next_ordinal_to_read = 0;
3993 let mut next_offset = offset;
3994 let end_offset = offset + bytes_len;
3995 _next_ordinal_to_read += 1;
3996 if next_offset >= end_offset {
3997 return Ok(());
3998 }
3999
4000 while _next_ordinal_to_read < 1 {
4002 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4003 _next_ordinal_to_read += 1;
4004 next_offset += envelope_size;
4005 }
4006
4007 let next_out_of_line = decoder.next_out_of_line();
4008 let handles_before = decoder.remaining_handles();
4009 if let Some((inlined, num_bytes, num_handles)) =
4010 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4011 {
4012 let member_inline_size =
4013 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4014 if inlined != (member_inline_size <= 4) {
4015 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4016 }
4017 let inner_offset;
4018 let mut inner_depth = depth.clone();
4019 if inlined {
4020 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4021 inner_offset = next_offset;
4022 } else {
4023 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4024 inner_depth.increment()?;
4025 }
4026 let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
4027 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4028 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4029 {
4030 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4031 }
4032 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4033 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4034 }
4035 }
4036
4037 next_offset += envelope_size;
4038 _next_ordinal_to_read += 1;
4039 if next_offset >= end_offset {
4040 return Ok(());
4041 }
4042
4043 while _next_ordinal_to_read < 2 {
4045 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4046 _next_ordinal_to_read += 1;
4047 next_offset += envelope_size;
4048 }
4049
4050 let next_out_of_line = decoder.next_out_of_line();
4051 let handles_before = decoder.remaining_handles();
4052 if let Some((inlined, num_bytes, num_handles)) =
4053 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4054 {
4055 let member_inline_size =
4056 <PlayerState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4057 if inlined != (member_inline_size <= 4) {
4058 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4059 }
4060 let inner_offset;
4061 let mut inner_depth = depth.clone();
4062 if inlined {
4063 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4064 inner_offset = next_offset;
4065 } else {
4066 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4067 inner_depth.increment()?;
4068 }
4069 let val_ref =
4070 self.player_state.get_or_insert_with(|| fidl::new_empty!(PlayerState, D));
4071 fidl::decode!(PlayerState, D, val_ref, decoder, inner_offset, inner_depth)?;
4072 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4073 {
4074 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4075 }
4076 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4077 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4078 }
4079 }
4080
4081 next_offset += envelope_size;
4082 _next_ordinal_to_read += 1;
4083 if next_offset >= end_offset {
4084 return Ok(());
4085 }
4086
4087 while _next_ordinal_to_read < 3 {
4089 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4090 _next_ordinal_to_read += 1;
4091 next_offset += envelope_size;
4092 }
4093
4094 let next_out_of_line = decoder.next_out_of_line();
4095 let handles_before = decoder.remaining_handles();
4096 if let Some((inlined, num_bytes, num_handles)) =
4097 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4098 {
4099 let member_inline_size = <fidl_fuchsia_media::TimelineFunction as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4100 if inlined != (member_inline_size <= 4) {
4101 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4102 }
4103 let inner_offset;
4104 let mut inner_depth = depth.clone();
4105 if inlined {
4106 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4107 inner_offset = next_offset;
4108 } else {
4109 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4110 inner_depth.increment()?;
4111 }
4112 let val_ref = self.timeline_function.get_or_insert_with(|| {
4113 fidl::new_empty!(fidl_fuchsia_media::TimelineFunction, D)
4114 });
4115 fidl::decode!(
4116 fidl_fuchsia_media::TimelineFunction,
4117 D,
4118 val_ref,
4119 decoder,
4120 inner_offset,
4121 inner_depth
4122 )?;
4123 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4124 {
4125 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4126 }
4127 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4128 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4129 }
4130 }
4131
4132 next_offset += envelope_size;
4133 _next_ordinal_to_read += 1;
4134 if next_offset >= end_offset {
4135 return Ok(());
4136 }
4137
4138 while _next_ordinal_to_read < 4 {
4140 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4141 _next_ordinal_to_read += 1;
4142 next_offset += envelope_size;
4143 }
4144
4145 let next_out_of_line = decoder.next_out_of_line();
4146 let handles_before = decoder.remaining_handles();
4147 if let Some((inlined, num_bytes, num_handles)) =
4148 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4149 {
4150 let member_inline_size =
4151 <RepeatMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4152 if inlined != (member_inline_size <= 4) {
4153 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4154 }
4155 let inner_offset;
4156 let mut inner_depth = depth.clone();
4157 if inlined {
4158 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4159 inner_offset = next_offset;
4160 } else {
4161 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4162 inner_depth.increment()?;
4163 }
4164 let val_ref =
4165 self.repeat_mode.get_or_insert_with(|| fidl::new_empty!(RepeatMode, D));
4166 fidl::decode!(RepeatMode, D, val_ref, decoder, inner_offset, inner_depth)?;
4167 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4168 {
4169 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4170 }
4171 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4172 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4173 }
4174 }
4175
4176 next_offset += envelope_size;
4177 _next_ordinal_to_read += 1;
4178 if next_offset >= end_offset {
4179 return Ok(());
4180 }
4181
4182 while _next_ordinal_to_read < 5 {
4184 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4185 _next_ordinal_to_read += 1;
4186 next_offset += envelope_size;
4187 }
4188
4189 let next_out_of_line = decoder.next_out_of_line();
4190 let handles_before = decoder.remaining_handles();
4191 if let Some((inlined, num_bytes, num_handles)) =
4192 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4193 {
4194 let member_inline_size =
4195 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4196 if inlined != (member_inline_size <= 4) {
4197 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4198 }
4199 let inner_offset;
4200 let mut inner_depth = depth.clone();
4201 if inlined {
4202 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4203 inner_offset = next_offset;
4204 } else {
4205 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4206 inner_depth.increment()?;
4207 }
4208 let val_ref = self.shuffle_on.get_or_insert_with(|| fidl::new_empty!(bool, D));
4209 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4210 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4211 {
4212 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4213 }
4214 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4215 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4216 }
4217 }
4218
4219 next_offset += envelope_size;
4220 _next_ordinal_to_read += 1;
4221 if next_offset >= end_offset {
4222 return Ok(());
4223 }
4224
4225 while _next_ordinal_to_read < 6 {
4227 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4228 _next_ordinal_to_read += 1;
4229 next_offset += envelope_size;
4230 }
4231
4232 let next_out_of_line = decoder.next_out_of_line();
4233 let handles_before = decoder.remaining_handles();
4234 if let Some((inlined, num_bytes, num_handles)) =
4235 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4236 {
4237 let member_inline_size =
4238 <ContentType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4239 if inlined != (member_inline_size <= 4) {
4240 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4241 }
4242 let inner_offset;
4243 let mut inner_depth = depth.clone();
4244 if inlined {
4245 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4246 inner_offset = next_offset;
4247 } else {
4248 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4249 inner_depth.increment()?;
4250 }
4251 let val_ref =
4252 self.content_type.get_or_insert_with(|| fidl::new_empty!(ContentType, D));
4253 fidl::decode!(ContentType, D, val_ref, decoder, inner_offset, inner_depth)?;
4254 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4255 {
4256 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4257 }
4258 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4259 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4260 }
4261 }
4262
4263 next_offset += envelope_size;
4264 _next_ordinal_to_read += 1;
4265 if next_offset >= end_offset {
4266 return Ok(());
4267 }
4268
4269 while _next_ordinal_to_read < 7 {
4271 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4272 _next_ordinal_to_read += 1;
4273 next_offset += envelope_size;
4274 }
4275
4276 let next_out_of_line = decoder.next_out_of_line();
4277 let handles_before = decoder.remaining_handles();
4278 if let Some((inlined, num_bytes, num_handles)) =
4279 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4280 {
4281 let member_inline_size =
4282 <Error as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4283 if inlined != (member_inline_size <= 4) {
4284 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4285 }
4286 let inner_offset;
4287 let mut inner_depth = depth.clone();
4288 if inlined {
4289 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4290 inner_offset = next_offset;
4291 } else {
4292 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4293 inner_depth.increment()?;
4294 }
4295 let val_ref = self.error.get_or_insert_with(|| fidl::new_empty!(Error, D));
4296 fidl::decode!(Error, D, val_ref, decoder, inner_offset, inner_depth)?;
4297 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4298 {
4299 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4300 }
4301 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4302 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4303 }
4304 }
4305
4306 next_offset += envelope_size;
4307 _next_ordinal_to_read += 1;
4308 if next_offset >= end_offset {
4309 return Ok(());
4310 }
4311
4312 while _next_ordinal_to_read < 8 {
4314 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4315 _next_ordinal_to_read += 1;
4316 next_offset += envelope_size;
4317 }
4318
4319 let next_out_of_line = decoder.next_out_of_line();
4320 let handles_before = decoder.remaining_handles();
4321 if let Some((inlined, num_bytes, num_handles)) =
4322 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4323 {
4324 let member_inline_size =
4325 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4326 if inlined != (member_inline_size <= 4) {
4327 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4328 }
4329 let inner_offset;
4330 let mut inner_depth = depth.clone();
4331 if inlined {
4332 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4333 inner_offset = next_offset;
4334 } else {
4335 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4336 inner_depth.increment()?;
4337 }
4338 let val_ref = self.is_live.get_or_insert_with(|| fidl::new_empty!(bool, D));
4339 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4340 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4341 {
4342 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4343 }
4344 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4345 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4346 }
4347 }
4348
4349 next_offset += envelope_size;
4350
4351 while next_offset < end_offset {
4353 _next_ordinal_to_read += 1;
4354 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4355 next_offset += envelope_size;
4356 }
4357
4358 Ok(())
4359 }
4360 }
4361
4362 impl SessionInfoDelta {
4363 #[inline(always)]
4364 fn max_ordinal_present(&self) -> u64 {
4365 if let Some(_) = self.player_capabilities {
4366 return 7;
4367 }
4368 if let Some(_) = self.media_images {
4369 return 6;
4370 }
4371 if let Some(_) = self.metadata {
4372 return 5;
4373 }
4374 if let Some(_) = self.player_status {
4375 return 4;
4376 }
4377 if let Some(_) = self.is_locally_active {
4378 return 3;
4379 }
4380 if let Some(_) = self.is_local {
4381 return 2;
4382 }
4383 if let Some(_) = self.domain {
4384 return 1;
4385 }
4386 0
4387 }
4388 }
4389
4390 impl fidl::encoding::ValueTypeMarker for SessionInfoDelta {
4391 type Borrowed<'a> = &'a Self;
4392 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4393 value
4394 }
4395 }
4396
4397 unsafe impl fidl::encoding::TypeMarker for SessionInfoDelta {
4398 type Owned = Self;
4399
4400 #[inline(always)]
4401 fn inline_align(_context: fidl::encoding::Context) -> usize {
4402 8
4403 }
4404
4405 #[inline(always)]
4406 fn inline_size(_context: fidl::encoding::Context) -> usize {
4407 16
4408 }
4409 }
4410
4411 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SessionInfoDelta, D>
4412 for &SessionInfoDelta
4413 {
4414 unsafe fn encode(
4415 self,
4416 encoder: &mut fidl::encoding::Encoder<'_, D>,
4417 offset: usize,
4418 mut depth: fidl::encoding::Depth,
4419 ) -> fidl::Result<()> {
4420 encoder.debug_check_bounds::<SessionInfoDelta>(offset);
4421 let max_ordinal: u64 = self.max_ordinal_present();
4423 encoder.write_num(max_ordinal, offset);
4424 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4425 if max_ordinal == 0 {
4427 return Ok(());
4428 }
4429 depth.increment()?;
4430 let envelope_size = 8;
4431 let bytes_len = max_ordinal as usize * envelope_size;
4432 #[allow(unused_variables)]
4433 let offset = encoder.out_of_line_offset(bytes_len);
4434 let mut _prev_end_offset: usize = 0;
4435 if 1 > max_ordinal {
4436 return Ok(());
4437 }
4438
4439 let cur_offset: usize = (1 - 1) * envelope_size;
4442
4443 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4445
4446 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1000>, D>(
4451 self.domain.as_ref().map(<fidl::encoding::BoundedString<1000> as fidl::encoding::ValueTypeMarker>::borrow),
4452 encoder, offset + cur_offset, depth
4453 )?;
4454
4455 _prev_end_offset = cur_offset + envelope_size;
4456 if 2 > max_ordinal {
4457 return Ok(());
4458 }
4459
4460 let cur_offset: usize = (2 - 1) * envelope_size;
4463
4464 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4466
4467 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4472 self.is_local.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4473 encoder,
4474 offset + cur_offset,
4475 depth,
4476 )?;
4477
4478 _prev_end_offset = cur_offset + envelope_size;
4479 if 3 > max_ordinal {
4480 return Ok(());
4481 }
4482
4483 let cur_offset: usize = (3 - 1) * envelope_size;
4486
4487 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4489
4490 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4495 self.is_locally_active
4496 .as_ref()
4497 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4498 encoder,
4499 offset + cur_offset,
4500 depth,
4501 )?;
4502
4503 _prev_end_offset = cur_offset + envelope_size;
4504 if 4 > max_ordinal {
4505 return Ok(());
4506 }
4507
4508 let cur_offset: usize = (4 - 1) * envelope_size;
4511
4512 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4514
4515 fidl::encoding::encode_in_envelope_optional::<PlayerStatus, D>(
4520 self.player_status
4521 .as_ref()
4522 .map(<PlayerStatus as fidl::encoding::ValueTypeMarker>::borrow),
4523 encoder,
4524 offset + cur_offset,
4525 depth,
4526 )?;
4527
4528 _prev_end_offset = cur_offset + envelope_size;
4529 if 5 > max_ordinal {
4530 return Ok(());
4531 }
4532
4533 let cur_offset: usize = (5 - 1) * envelope_size;
4536
4537 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4539
4540 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::Metadata, D>(
4545 self.metadata
4546 .as_ref()
4547 .map(<fidl_fuchsia_media::Metadata as fidl::encoding::ValueTypeMarker>::borrow),
4548 encoder,
4549 offset + cur_offset,
4550 depth,
4551 )?;
4552
4553 _prev_end_offset = cur_offset + envelope_size;
4554 if 6 > max_ordinal {
4555 return Ok(());
4556 }
4557
4558 let cur_offset: usize = (6 - 1) * envelope_size;
4561
4562 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4564
4565 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<MediaImage>, D>(
4570 self.media_images.as_ref().map(<fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::ValueTypeMarker>::borrow),
4571 encoder, offset + cur_offset, depth
4572 )?;
4573
4574 _prev_end_offset = cur_offset + envelope_size;
4575 if 7 > max_ordinal {
4576 return Ok(());
4577 }
4578
4579 let cur_offset: usize = (7 - 1) * envelope_size;
4582
4583 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4585
4586 fidl::encoding::encode_in_envelope_optional::<PlayerCapabilities, D>(
4591 self.player_capabilities
4592 .as_ref()
4593 .map(<PlayerCapabilities as fidl::encoding::ValueTypeMarker>::borrow),
4594 encoder,
4595 offset + cur_offset,
4596 depth,
4597 )?;
4598
4599 _prev_end_offset = cur_offset + envelope_size;
4600
4601 Ok(())
4602 }
4603 }
4604
4605 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SessionInfoDelta {
4606 #[inline(always)]
4607 fn new_empty() -> Self {
4608 Self::default()
4609 }
4610
4611 unsafe fn decode(
4612 &mut self,
4613 decoder: &mut fidl::encoding::Decoder<'_, D>,
4614 offset: usize,
4615 mut depth: fidl::encoding::Depth,
4616 ) -> fidl::Result<()> {
4617 decoder.debug_check_bounds::<Self>(offset);
4618 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4619 None => return Err(fidl::Error::NotNullable),
4620 Some(len) => len,
4621 };
4622 if len == 0 {
4624 return Ok(());
4625 };
4626 depth.increment()?;
4627 let envelope_size = 8;
4628 let bytes_len = len * envelope_size;
4629 let offset = decoder.out_of_line_offset(bytes_len)?;
4630 let mut _next_ordinal_to_read = 0;
4632 let mut next_offset = offset;
4633 let end_offset = offset + bytes_len;
4634 _next_ordinal_to_read += 1;
4635 if next_offset >= end_offset {
4636 return Ok(());
4637 }
4638
4639 while _next_ordinal_to_read < 1 {
4641 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4642 _next_ordinal_to_read += 1;
4643 next_offset += envelope_size;
4644 }
4645
4646 let next_out_of_line = decoder.next_out_of_line();
4647 let handles_before = decoder.remaining_handles();
4648 if let Some((inlined, num_bytes, num_handles)) =
4649 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4650 {
4651 let member_inline_size = <fidl::encoding::BoundedString<1000> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4652 if inlined != (member_inline_size <= 4) {
4653 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4654 }
4655 let inner_offset;
4656 let mut inner_depth = depth.clone();
4657 if inlined {
4658 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4659 inner_offset = next_offset;
4660 } else {
4661 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4662 inner_depth.increment()?;
4663 }
4664 let val_ref = self.domain.get_or_insert_with(|| {
4665 fidl::new_empty!(fidl::encoding::BoundedString<1000>, D)
4666 });
4667 fidl::decode!(
4668 fidl::encoding::BoundedString<1000>,
4669 D,
4670 val_ref,
4671 decoder,
4672 inner_offset,
4673 inner_depth
4674 )?;
4675 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4676 {
4677 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4678 }
4679 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4680 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4681 }
4682 }
4683
4684 next_offset += envelope_size;
4685 _next_ordinal_to_read += 1;
4686 if next_offset >= end_offset {
4687 return Ok(());
4688 }
4689
4690 while _next_ordinal_to_read < 2 {
4692 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4693 _next_ordinal_to_read += 1;
4694 next_offset += envelope_size;
4695 }
4696
4697 let next_out_of_line = decoder.next_out_of_line();
4698 let handles_before = decoder.remaining_handles();
4699 if let Some((inlined, num_bytes, num_handles)) =
4700 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4701 {
4702 let member_inline_size =
4703 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4704 if inlined != (member_inline_size <= 4) {
4705 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4706 }
4707 let inner_offset;
4708 let mut inner_depth = depth.clone();
4709 if inlined {
4710 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4711 inner_offset = next_offset;
4712 } else {
4713 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4714 inner_depth.increment()?;
4715 }
4716 let val_ref = self.is_local.get_or_insert_with(|| fidl::new_empty!(bool, D));
4717 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4718 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4719 {
4720 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4721 }
4722 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4723 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4724 }
4725 }
4726
4727 next_offset += envelope_size;
4728 _next_ordinal_to_read += 1;
4729 if next_offset >= end_offset {
4730 return Ok(());
4731 }
4732
4733 while _next_ordinal_to_read < 3 {
4735 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4736 _next_ordinal_to_read += 1;
4737 next_offset += envelope_size;
4738 }
4739
4740 let next_out_of_line = decoder.next_out_of_line();
4741 let handles_before = decoder.remaining_handles();
4742 if let Some((inlined, num_bytes, num_handles)) =
4743 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4744 {
4745 let member_inline_size =
4746 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4747 if inlined != (member_inline_size <= 4) {
4748 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4749 }
4750 let inner_offset;
4751 let mut inner_depth = depth.clone();
4752 if inlined {
4753 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4754 inner_offset = next_offset;
4755 } else {
4756 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4757 inner_depth.increment()?;
4758 }
4759 let val_ref =
4760 self.is_locally_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
4761 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4762 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4763 {
4764 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4765 }
4766 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4767 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4768 }
4769 }
4770
4771 next_offset += envelope_size;
4772 _next_ordinal_to_read += 1;
4773 if next_offset >= end_offset {
4774 return Ok(());
4775 }
4776
4777 while _next_ordinal_to_read < 4 {
4779 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4780 _next_ordinal_to_read += 1;
4781 next_offset += envelope_size;
4782 }
4783
4784 let next_out_of_line = decoder.next_out_of_line();
4785 let handles_before = decoder.remaining_handles();
4786 if let Some((inlined, num_bytes, num_handles)) =
4787 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4788 {
4789 let member_inline_size =
4790 <PlayerStatus as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4791 if inlined != (member_inline_size <= 4) {
4792 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4793 }
4794 let inner_offset;
4795 let mut inner_depth = depth.clone();
4796 if inlined {
4797 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4798 inner_offset = next_offset;
4799 } else {
4800 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4801 inner_depth.increment()?;
4802 }
4803 let val_ref =
4804 self.player_status.get_or_insert_with(|| fidl::new_empty!(PlayerStatus, D));
4805 fidl::decode!(PlayerStatus, D, val_ref, decoder, inner_offset, inner_depth)?;
4806 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4807 {
4808 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4809 }
4810 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4811 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4812 }
4813 }
4814
4815 next_offset += envelope_size;
4816 _next_ordinal_to_read += 1;
4817 if next_offset >= end_offset {
4818 return Ok(());
4819 }
4820
4821 while _next_ordinal_to_read < 5 {
4823 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4824 _next_ordinal_to_read += 1;
4825 next_offset += envelope_size;
4826 }
4827
4828 let next_out_of_line = decoder.next_out_of_line();
4829 let handles_before = decoder.remaining_handles();
4830 if let Some((inlined, num_bytes, num_handles)) =
4831 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4832 {
4833 let member_inline_size =
4834 <fidl_fuchsia_media::Metadata as fidl::encoding::TypeMarker>::inline_size(
4835 decoder.context,
4836 );
4837 if inlined != (member_inline_size <= 4) {
4838 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4839 }
4840 let inner_offset;
4841 let mut inner_depth = depth.clone();
4842 if inlined {
4843 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4844 inner_offset = next_offset;
4845 } else {
4846 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4847 inner_depth.increment()?;
4848 }
4849 let val_ref = self
4850 .metadata
4851 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_media::Metadata, D));
4852 fidl::decode!(
4853 fidl_fuchsia_media::Metadata,
4854 D,
4855 val_ref,
4856 decoder,
4857 inner_offset,
4858 inner_depth
4859 )?;
4860 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4861 {
4862 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4863 }
4864 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4865 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4866 }
4867 }
4868
4869 next_offset += envelope_size;
4870 _next_ordinal_to_read += 1;
4871 if next_offset >= end_offset {
4872 return Ok(());
4873 }
4874
4875 while _next_ordinal_to_read < 6 {
4877 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4878 _next_ordinal_to_read += 1;
4879 next_offset += envelope_size;
4880 }
4881
4882 let next_out_of_line = decoder.next_out_of_line();
4883 let handles_before = decoder.remaining_handles();
4884 if let Some((inlined, num_bytes, num_handles)) =
4885 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4886 {
4887 let member_inline_size = <fidl::encoding::UnboundedVector<MediaImage> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4888 if inlined != (member_inline_size <= 4) {
4889 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4890 }
4891 let inner_offset;
4892 let mut inner_depth = depth.clone();
4893 if inlined {
4894 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4895 inner_offset = next_offset;
4896 } else {
4897 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4898 inner_depth.increment()?;
4899 }
4900 let val_ref = self.media_images.get_or_insert_with(|| {
4901 fidl::new_empty!(fidl::encoding::UnboundedVector<MediaImage>, D)
4902 });
4903 fidl::decode!(
4904 fidl::encoding::UnboundedVector<MediaImage>,
4905 D,
4906 val_ref,
4907 decoder,
4908 inner_offset,
4909 inner_depth
4910 )?;
4911 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4912 {
4913 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4914 }
4915 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4916 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4917 }
4918 }
4919
4920 next_offset += envelope_size;
4921 _next_ordinal_to_read += 1;
4922 if next_offset >= end_offset {
4923 return Ok(());
4924 }
4925
4926 while _next_ordinal_to_read < 7 {
4928 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4929 _next_ordinal_to_read += 1;
4930 next_offset += envelope_size;
4931 }
4932
4933 let next_out_of_line = decoder.next_out_of_line();
4934 let handles_before = decoder.remaining_handles();
4935 if let Some((inlined, num_bytes, num_handles)) =
4936 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4937 {
4938 let member_inline_size =
4939 <PlayerCapabilities as fidl::encoding::TypeMarker>::inline_size(
4940 decoder.context,
4941 );
4942 if inlined != (member_inline_size <= 4) {
4943 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4944 }
4945 let inner_offset;
4946 let mut inner_depth = depth.clone();
4947 if inlined {
4948 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4949 inner_offset = next_offset;
4950 } else {
4951 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4952 inner_depth.increment()?;
4953 }
4954 let val_ref = self
4955 .player_capabilities
4956 .get_or_insert_with(|| fidl::new_empty!(PlayerCapabilities, D));
4957 fidl::decode!(PlayerCapabilities, D, val_ref, decoder, inner_offset, inner_depth)?;
4958 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4959 {
4960 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4961 }
4962 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4963 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4964 }
4965 }
4966
4967 next_offset += envelope_size;
4968
4969 while next_offset < end_offset {
4971 _next_ordinal_to_read += 1;
4972 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4973 next_offset += envelope_size;
4974 }
4975
4976 Ok(())
4977 }
4978 }
4979
4980 impl WatchOptions {
4981 #[inline(always)]
4982 fn max_ordinal_present(&self) -> u64 {
4983 if let Some(_) = self.allowed_sessions {
4984 return 2;
4985 }
4986 if let Some(_) = self.only_active {
4987 return 1;
4988 }
4989 0
4990 }
4991 }
4992
4993 impl fidl::encoding::ValueTypeMarker for WatchOptions {
4994 type Borrowed<'a> = &'a Self;
4995 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4996 value
4997 }
4998 }
4999
5000 unsafe impl fidl::encoding::TypeMarker for WatchOptions {
5001 type Owned = Self;
5002
5003 #[inline(always)]
5004 fn inline_align(_context: fidl::encoding::Context) -> usize {
5005 8
5006 }
5007
5008 #[inline(always)]
5009 fn inline_size(_context: fidl::encoding::Context) -> usize {
5010 16
5011 }
5012 }
5013
5014 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchOptions, D>
5015 for &WatchOptions
5016 {
5017 unsafe fn encode(
5018 self,
5019 encoder: &mut fidl::encoding::Encoder<'_, D>,
5020 offset: usize,
5021 mut depth: fidl::encoding::Depth,
5022 ) -> fidl::Result<()> {
5023 encoder.debug_check_bounds::<WatchOptions>(offset);
5024 let max_ordinal: u64 = self.max_ordinal_present();
5026 encoder.write_num(max_ordinal, offset);
5027 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5028 if max_ordinal == 0 {
5030 return Ok(());
5031 }
5032 depth.increment()?;
5033 let envelope_size = 8;
5034 let bytes_len = max_ordinal as usize * envelope_size;
5035 #[allow(unused_variables)]
5036 let offset = encoder.out_of_line_offset(bytes_len);
5037 let mut _prev_end_offset: usize = 0;
5038 if 1 > max_ordinal {
5039 return Ok(());
5040 }
5041
5042 let cur_offset: usize = (1 - 1) * envelope_size;
5045
5046 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5048
5049 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5054 self.only_active.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5055 encoder,
5056 offset + cur_offset,
5057 depth,
5058 )?;
5059
5060 _prev_end_offset = cur_offset + envelope_size;
5061 if 2 > max_ordinal {
5062 return Ok(());
5063 }
5064
5065 let cur_offset: usize = (2 - 1) * envelope_size;
5068
5069 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5071
5072 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u64, 1000>, D>(
5077 self.allowed_sessions.as_ref().map(
5078 <fidl::encoding::Vector<u64, 1000> as fidl::encoding::ValueTypeMarker>::borrow,
5079 ),
5080 encoder,
5081 offset + cur_offset,
5082 depth,
5083 )?;
5084
5085 _prev_end_offset = cur_offset + envelope_size;
5086
5087 Ok(())
5088 }
5089 }
5090
5091 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchOptions {
5092 #[inline(always)]
5093 fn new_empty() -> Self {
5094 Self::default()
5095 }
5096
5097 unsafe fn decode(
5098 &mut self,
5099 decoder: &mut fidl::encoding::Decoder<'_, D>,
5100 offset: usize,
5101 mut depth: fidl::encoding::Depth,
5102 ) -> fidl::Result<()> {
5103 decoder.debug_check_bounds::<Self>(offset);
5104 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5105 None => return Err(fidl::Error::NotNullable),
5106 Some(len) => len,
5107 };
5108 if len == 0 {
5110 return Ok(());
5111 };
5112 depth.increment()?;
5113 let envelope_size = 8;
5114 let bytes_len = len * envelope_size;
5115 let offset = decoder.out_of_line_offset(bytes_len)?;
5116 let mut _next_ordinal_to_read = 0;
5118 let mut next_offset = offset;
5119 let end_offset = offset + bytes_len;
5120 _next_ordinal_to_read += 1;
5121 if next_offset >= end_offset {
5122 return Ok(());
5123 }
5124
5125 while _next_ordinal_to_read < 1 {
5127 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5128 _next_ordinal_to_read += 1;
5129 next_offset += envelope_size;
5130 }
5131
5132 let next_out_of_line = decoder.next_out_of_line();
5133 let handles_before = decoder.remaining_handles();
5134 if let Some((inlined, num_bytes, num_handles)) =
5135 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5136 {
5137 let member_inline_size =
5138 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5139 if inlined != (member_inline_size <= 4) {
5140 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5141 }
5142 let inner_offset;
5143 let mut inner_depth = depth.clone();
5144 if inlined {
5145 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5146 inner_offset = next_offset;
5147 } else {
5148 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5149 inner_depth.increment()?;
5150 }
5151 let val_ref = self.only_active.get_or_insert_with(|| fidl::new_empty!(bool, D));
5152 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5153 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5154 {
5155 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5156 }
5157 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5158 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5159 }
5160 }
5161
5162 next_offset += envelope_size;
5163 _next_ordinal_to_read += 1;
5164 if next_offset >= end_offset {
5165 return Ok(());
5166 }
5167
5168 while _next_ordinal_to_read < 2 {
5170 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5171 _next_ordinal_to_read += 1;
5172 next_offset += envelope_size;
5173 }
5174
5175 let next_out_of_line = decoder.next_out_of_line();
5176 let handles_before = decoder.remaining_handles();
5177 if let Some((inlined, num_bytes, num_handles)) =
5178 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5179 {
5180 let member_inline_size =
5181 <fidl::encoding::Vector<u64, 1000> as fidl::encoding::TypeMarker>::inline_size(
5182 decoder.context,
5183 );
5184 if inlined != (member_inline_size <= 4) {
5185 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5186 }
5187 let inner_offset;
5188 let mut inner_depth = depth.clone();
5189 if inlined {
5190 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5191 inner_offset = next_offset;
5192 } else {
5193 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5194 inner_depth.increment()?;
5195 }
5196 let val_ref = self
5197 .allowed_sessions
5198 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u64, 1000>, D));
5199 fidl::decode!(fidl::encoding::Vector<u64, 1000>, D, val_ref, decoder, inner_offset, inner_depth)?;
5200 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5201 {
5202 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5203 }
5204 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5205 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5206 }
5207 }
5208
5209 next_offset += envelope_size;
5210
5211 while next_offset < end_offset {
5213 _next_ordinal_to_read += 1;
5214 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5215 next_offset += envelope_size;
5216 }
5217
5218 Ok(())
5219 }
5220 }
5221}