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 const FORMAT_MODIFIER_ARM_BCH_BIT: u64 = 2048;
12
13pub const FORMAT_MODIFIER_ARM_SPARSE_BIT: u64 = 64;
14
15pub const FORMAT_MODIFIER_ARM_SPLIT_BLOCK_BIT: u64 = 32;
16
17pub const FORMAT_MODIFIER_ARM_TE_BIT: u64 = 4096;
18
19pub const FORMAT_MODIFIER_ARM_TILED_HEADER_BIT: u64 = 8192;
20
21pub const FORMAT_MODIFIER_ARM_YUV_BIT: u64 = 16;
22
23pub const FORMAT_MODIFIER_INTEL_CCS_BIT: u64 = 16777216;
25
26pub const FORMAT_MODIFIER_VENDOR_ALLWINNER: u64 = 648518346341351424;
27
28pub const FORMAT_MODIFIER_VENDOR_AMD: u64 = 144115188075855872;
29
30pub const FORMAT_MODIFIER_VENDOR_AMLOGIC: u64 = 720575940379279360;
31
32pub const FORMAT_MODIFIER_VENDOR_ARM: u64 = 576460752303423488;
33
34pub const FORMAT_MODIFIER_VENDOR_BROADCOM: u64 = 504403158265495552;
35
36pub const FORMAT_MODIFIER_VENDOR_GOOGLE: u64 = 7421932185906577408;
37
38pub const FORMAT_MODIFIER_VENDOR_INTEL: u64 = 72057594037927936;
39
40pub const FORMAT_MODIFIER_VENDOR_NVIDIA: u64 = 216172782113783808;
41
42pub const FORMAT_MODIFIER_VENDOR_QCOM: u64 = 360287970189639680;
43
44pub const FORMAT_MODIFIER_VENDOR_SAMSUNG: u64 = 288230376151711744;
45
46pub const FORMAT_MODIFIER_VENDOR_VIVANTE: u64 = 432345564227567616;
47
48#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
72pub enum ColorSpace {
73 Invalid,
75 Srgb,
77 Rec601Ntsc,
79 Rec601NtscFullRange,
81 Rec601Pal,
83 Rec601PalFullRange,
85 Rec709,
87 Rec2020,
91 Rec2100,
97 Passthrough,
101 DoNotCare,
104 #[doc(hidden)]
105 __SourceBreaking { unknown_ordinal: u32 },
106}
107
108#[macro_export]
110macro_rules! ColorSpaceUnknown {
111 () => {
112 _
113 };
114}
115
116impl ColorSpace {
117 #[inline]
118 pub fn from_primitive(prim: u32) -> Option<Self> {
119 match prim {
120 0 => Some(Self::Invalid),
121 1 => Some(Self::Srgb),
122 2 => Some(Self::Rec601Ntsc),
123 3 => Some(Self::Rec601NtscFullRange),
124 4 => Some(Self::Rec601Pal),
125 5 => Some(Self::Rec601PalFullRange),
126 6 => Some(Self::Rec709),
127 7 => Some(Self::Rec2020),
128 8 => Some(Self::Rec2100),
129 9 => Some(Self::Passthrough),
130 4294967294 => Some(Self::DoNotCare),
131 _ => None,
132 }
133 }
134
135 #[inline]
136 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
137 match prim {
138 0 => Self::Invalid,
139 1 => Self::Srgb,
140 2 => Self::Rec601Ntsc,
141 3 => Self::Rec601NtscFullRange,
142 4 => Self::Rec601Pal,
143 5 => Self::Rec601PalFullRange,
144 6 => Self::Rec709,
145 7 => Self::Rec2020,
146 8 => Self::Rec2100,
147 9 => Self::Passthrough,
148 4294967294 => Self::DoNotCare,
149 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
150 }
151 }
152
153 #[inline]
154 pub fn unknown() -> Self {
155 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
156 }
157
158 #[inline]
159 pub const fn into_primitive(self) -> u32 {
160 match self {
161 Self::Invalid => 0,
162 Self::Srgb => 1,
163 Self::Rec601Ntsc => 2,
164 Self::Rec601NtscFullRange => 3,
165 Self::Rec601Pal => 4,
166 Self::Rec601PalFullRange => 5,
167 Self::Rec709 => 6,
168 Self::Rec2020 => 7,
169 Self::Rec2100 => 8,
170 Self::Passthrough => 9,
171 Self::DoNotCare => 4294967294,
172 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
173 }
174 }
175
176 #[inline]
177 pub fn is_unknown(&self) -> bool {
178 match self {
179 Self::__SourceBreaking { unknown_ordinal: _ } => true,
180 _ => false,
181 }
182 }
183}
184
185#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
193pub enum PixelFormat {
194 Invalid,
195 R8G8B8A8,
207 R8G8B8X8,
215 B8G8R8A8,
229 B8G8R8X8,
237 I420,
241 M420,
245 Nv12,
249 Yuy2,
253 Mjpeg,
255 Yv12,
262 B8G8R8,
268 R5G6B5,
274 R3G3B2,
280 R2G2B2X2,
294 L8,
300 R8,
304 R8G8,
308 A2R10G10B10,
320 A2B10G10R10,
332 P010,
341 R8G8B8,
345 DoNotCare,
349 #[doc(hidden)]
350 __SourceBreaking {
351 unknown_ordinal: u32,
352 },
353}
354
355#[macro_export]
357macro_rules! PixelFormatUnknown {
358 () => {
359 _
360 };
361}
362
363impl PixelFormat {
364 #[inline]
365 pub fn from_primitive(prim: u32) -> Option<Self> {
366 match prim {
367 0 => Some(Self::Invalid),
368 1 => Some(Self::R8G8B8A8),
369 119 => Some(Self::R8G8B8X8),
370 101 => Some(Self::B8G8R8A8),
371 120 => Some(Self::B8G8R8X8),
372 102 => Some(Self::I420),
373 103 => Some(Self::M420),
374 104 => Some(Self::Nv12),
375 105 => Some(Self::Yuy2),
376 106 => Some(Self::Mjpeg),
377 107 => Some(Self::Yv12),
378 108 => Some(Self::B8G8R8),
379 109 => Some(Self::R5G6B5),
380 110 => Some(Self::R3G3B2),
381 111 => Some(Self::R2G2B2X2),
382 112 => Some(Self::L8),
383 113 => Some(Self::R8),
384 114 => Some(Self::R8G8),
385 115 => Some(Self::A2R10G10B10),
386 116 => Some(Self::A2B10G10R10),
387 117 => Some(Self::P010),
388 118 => Some(Self::R8G8B8),
389 4294967294 => Some(Self::DoNotCare),
390 _ => None,
391 }
392 }
393
394 #[inline]
395 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
396 match prim {
397 0 => Self::Invalid,
398 1 => Self::R8G8B8A8,
399 119 => Self::R8G8B8X8,
400 101 => Self::B8G8R8A8,
401 120 => Self::B8G8R8X8,
402 102 => Self::I420,
403 103 => Self::M420,
404 104 => Self::Nv12,
405 105 => Self::Yuy2,
406 106 => Self::Mjpeg,
407 107 => Self::Yv12,
408 108 => Self::B8G8R8,
409 109 => Self::R5G6B5,
410 110 => Self::R3G3B2,
411 111 => Self::R2G2B2X2,
412 112 => Self::L8,
413 113 => Self::R8,
414 114 => Self::R8G8,
415 115 => Self::A2R10G10B10,
416 116 => Self::A2B10G10R10,
417 117 => Self::P010,
418 118 => Self::R8G8B8,
419 4294967294 => Self::DoNotCare,
420 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
421 }
422 }
423
424 #[inline]
425 pub fn unknown() -> Self {
426 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
427 }
428
429 #[inline]
430 pub const fn into_primitive(self) -> u32 {
431 match self {
432 Self::Invalid => 0,
433 Self::R8G8B8A8 => 1,
434 Self::R8G8B8X8 => 119,
435 Self::B8G8R8A8 => 101,
436 Self::B8G8R8X8 => 120,
437 Self::I420 => 102,
438 Self::M420 => 103,
439 Self::Nv12 => 104,
440 Self::Yuy2 => 105,
441 Self::Mjpeg => 106,
442 Self::Yv12 => 107,
443 Self::B8G8R8 => 108,
444 Self::R5G6B5 => 109,
445 Self::R3G3B2 => 110,
446 Self::R2G2B2X2 => 111,
447 Self::L8 => 112,
448 Self::R8 => 113,
449 Self::R8G8 => 114,
450 Self::A2R10G10B10 => 115,
451 Self::A2B10G10R10 => 116,
452 Self::P010 => 117,
453 Self::R8G8B8 => 118,
454 Self::DoNotCare => 4294967294,
455 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
456 }
457 }
458
459 #[inline]
460 pub fn is_unknown(&self) -> bool {
461 match self {
462 Self::__SourceBreaking { unknown_ordinal: _ } => true,
463 _ => false,
464 }
465 }
466}
467
468#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
503pub enum PixelFormatModifier {
504 DoNotCare,
505 Invalid,
506 Linear,
507 IntelI915XTiled,
508 IntelI915YTiled,
509 IntelI915YfTiled,
510 IntelI915YTiledCcs,
511 IntelI915YfTiledCcs,
512 ArmAfbc16X16,
513 ArmAfbc32X8,
514 ArmLinearTe,
515 ArmAfbc16X16Te,
516 ArmAfbc32X8Te,
517 ArmAfbc16X16YuvTiledHeader,
518 ArmAfbc16X16SplitBlockSparseYuv,
519 ArmAfbc16X16SplitBlockSparseYuvTe,
520 ArmAfbc16X16SplitBlockSparseYuvTiledHeader,
521 ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader,
522 GoogleGoldfishOptimal,
523 #[doc(hidden)]
524 __SourceBreaking {
525 unknown_ordinal: u64,
526 },
527}
528
529#[macro_export]
531macro_rules! PixelFormatModifierUnknown {
532 () => {
533 _
534 };
535}
536
537impl PixelFormatModifier {
538 #[inline]
539 pub fn from_primitive(prim: u64) -> Option<Self> {
540 match prim {
541 72057594037927934 => Some(Self::DoNotCare),
542 72057594037927935 => Some(Self::Invalid),
543 0 => Some(Self::Linear),
544 72057594037927937 => Some(Self::IntelI915XTiled),
545 72057594037927938 => Some(Self::IntelI915YTiled),
546 72057594037927939 => Some(Self::IntelI915YfTiled),
547 72057594054705154 => Some(Self::IntelI915YTiledCcs),
548 72057594054705155 => Some(Self::IntelI915YfTiledCcs),
549 576460752303423489 => Some(Self::ArmAfbc16X16),
550 576460752303423490 => Some(Self::ArmAfbc32X8),
551 576460752303427584 => Some(Self::ArmLinearTe),
552 576460752303427585 => Some(Self::ArmAfbc16X16Te),
553 576460752303427586 => Some(Self::ArmAfbc32X8Te),
554 576460752303431697 => Some(Self::ArmAfbc16X16YuvTiledHeader),
555 576460752303423601 => Some(Self::ArmAfbc16X16SplitBlockSparseYuv),
556 576460752303427697 => Some(Self::ArmAfbc16X16SplitBlockSparseYuvTe),
557 576460752303431793 => Some(Self::ArmAfbc16X16SplitBlockSparseYuvTiledHeader),
558 576460752303435889 => Some(Self::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader),
559 7421932185906577409 => Some(Self::GoogleGoldfishOptimal),
560 _ => None,
561 }
562 }
563
564 #[inline]
565 pub fn from_primitive_allow_unknown(prim: u64) -> Self {
566 match prim {
567 72057594037927934 => Self::DoNotCare,
568 72057594037927935 => Self::Invalid,
569 0 => Self::Linear,
570 72057594037927937 => Self::IntelI915XTiled,
571 72057594037927938 => Self::IntelI915YTiled,
572 72057594037927939 => Self::IntelI915YfTiled,
573 72057594054705154 => Self::IntelI915YTiledCcs,
574 72057594054705155 => Self::IntelI915YfTiledCcs,
575 576460752303423489 => Self::ArmAfbc16X16,
576 576460752303423490 => Self::ArmAfbc32X8,
577 576460752303427584 => Self::ArmLinearTe,
578 576460752303427585 => Self::ArmAfbc16X16Te,
579 576460752303427586 => Self::ArmAfbc32X8Te,
580 576460752303431697 => Self::ArmAfbc16X16YuvTiledHeader,
581 576460752303423601 => Self::ArmAfbc16X16SplitBlockSparseYuv,
582 576460752303427697 => Self::ArmAfbc16X16SplitBlockSparseYuvTe,
583 576460752303431793 => Self::ArmAfbc16X16SplitBlockSparseYuvTiledHeader,
584 576460752303435889 => Self::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader,
585 7421932185906577409 => Self::GoogleGoldfishOptimal,
586 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
587 }
588 }
589
590 #[inline]
591 pub fn unknown() -> Self {
592 Self::__SourceBreaking { unknown_ordinal: 0xffffffffffffffff }
593 }
594
595 #[inline]
596 pub const fn into_primitive(self) -> u64 {
597 match self {
598 Self::DoNotCare => 72057594037927934,
599 Self::Invalid => 72057594037927935,
600 Self::Linear => 0,
601 Self::IntelI915XTiled => 72057594037927937,
602 Self::IntelI915YTiled => 72057594037927938,
603 Self::IntelI915YfTiled => 72057594037927939,
604 Self::IntelI915YTiledCcs => 72057594054705154,
605 Self::IntelI915YfTiledCcs => 72057594054705155,
606 Self::ArmAfbc16X16 => 576460752303423489,
607 Self::ArmAfbc32X8 => 576460752303423490,
608 Self::ArmLinearTe => 576460752303427584,
609 Self::ArmAfbc16X16Te => 576460752303427585,
610 Self::ArmAfbc32X8Te => 576460752303427586,
611 Self::ArmAfbc16X16YuvTiledHeader => 576460752303431697,
612 Self::ArmAfbc16X16SplitBlockSparseYuv => 576460752303423601,
613 Self::ArmAfbc16X16SplitBlockSparseYuvTe => 576460752303427697,
614 Self::ArmAfbc16X16SplitBlockSparseYuvTiledHeader => 576460752303431793,
615 Self::ArmAfbc16X16SplitBlockSparseYuvTeTiledHeader => 576460752303435889,
616 Self::GoogleGoldfishOptimal => 7421932185906577409,
617 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
618 }
619 }
620
621 #[inline]
622 pub fn is_unknown(&self) -> bool {
623 match self {
624 Self::__SourceBreaking { unknown_ordinal: _ } => true,
625 _ => false,
626 }
627 }
628}
629
630#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
637#[repr(C)]
638pub struct RectU {
639 pub x: u32,
641 pub y: u32,
643 pub width: u32,
648 pub height: u32,
653}
654
655impl fidl::Persistable for RectU {}
656
657#[derive(Clone, Debug, Default, PartialEq)]
659pub struct ImageFormat {
660 pub pixel_format: Option<PixelFormat>,
662 pub pixel_format_modifier: Option<PixelFormatModifier>,
664 pub color_space: Option<ColorSpace>,
666 pub size: Option<fidl_fuchsia_math::SizeU>,
678 pub bytes_per_row: Option<u32>,
702 pub display_rect: Option<fidl_fuchsia_math::RectU>,
738 pub valid_size: Option<fidl_fuchsia_math::SizeU>,
759 pub pixel_aspect_ratio: Option<fidl_fuchsia_math::SizeU>,
771 #[doc(hidden)]
772 pub __source_breaking: fidl::marker::SourceBreaking,
773}
774
775impl fidl::Persistable for ImageFormat {}
776
777mod internal {
778 use super::*;
779 unsafe impl fidl::encoding::TypeMarker for ColorSpace {
780 type Owned = Self;
781
782 #[inline(always)]
783 fn inline_align(_context: fidl::encoding::Context) -> usize {
784 std::mem::align_of::<u32>()
785 }
786
787 #[inline(always)]
788 fn inline_size(_context: fidl::encoding::Context) -> usize {
789 std::mem::size_of::<u32>()
790 }
791
792 #[inline(always)]
793 fn encode_is_copy() -> bool {
794 false
795 }
796
797 #[inline(always)]
798 fn decode_is_copy() -> bool {
799 false
800 }
801 }
802
803 impl fidl::encoding::ValueTypeMarker for ColorSpace {
804 type Borrowed<'a> = Self;
805 #[inline(always)]
806 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
807 *value
808 }
809 }
810
811 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ColorSpace {
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 ColorSpace {
826 #[inline(always)]
827 fn new_empty() -> Self {
828 Self::unknown()
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_allow_unknown(prim);
842 Ok(())
843 }
844 }
845 unsafe impl fidl::encoding::TypeMarker for PixelFormat {
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 false
861 }
862
863 #[inline(always)]
864 fn decode_is_copy() -> bool {
865 false
866 }
867 }
868
869 impl fidl::encoding::ValueTypeMarker for PixelFormat {
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 PixelFormat {
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 PixelFormat {
892 #[inline(always)]
893 fn new_empty() -> Self {
894 Self::unknown()
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_allow_unknown(prim);
908 Ok(())
909 }
910 }
911 unsafe impl fidl::encoding::TypeMarker for PixelFormatModifier {
912 type Owned = Self;
913
914 #[inline(always)]
915 fn inline_align(_context: fidl::encoding::Context) -> usize {
916 std::mem::align_of::<u64>()
917 }
918
919 #[inline(always)]
920 fn inline_size(_context: fidl::encoding::Context) -> usize {
921 std::mem::size_of::<u64>()
922 }
923
924 #[inline(always)]
925 fn encode_is_copy() -> bool {
926 false
927 }
928
929 #[inline(always)]
930 fn decode_is_copy() -> bool {
931 false
932 }
933 }
934
935 impl fidl::encoding::ValueTypeMarker for PixelFormatModifier {
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>
944 for PixelFormatModifier
945 {
946 #[inline]
947 unsafe fn encode(
948 self,
949 encoder: &mut fidl::encoding::Encoder<'_, D>,
950 offset: usize,
951 _depth: fidl::encoding::Depth,
952 ) -> fidl::Result<()> {
953 encoder.debug_check_bounds::<Self>(offset);
954 encoder.write_num(self.into_primitive(), offset);
955 Ok(())
956 }
957 }
958
959 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PixelFormatModifier {
960 #[inline(always)]
961 fn new_empty() -> Self {
962 Self::unknown()
963 }
964
965 #[inline]
966 unsafe fn decode(
967 &mut self,
968 decoder: &mut fidl::encoding::Decoder<'_, D>,
969 offset: usize,
970 _depth: fidl::encoding::Depth,
971 ) -> fidl::Result<()> {
972 decoder.debug_check_bounds::<Self>(offset);
973 let prim = decoder.read_num::<u64>(offset);
974
975 *self = Self::from_primitive_allow_unknown(prim);
976 Ok(())
977 }
978 }
979
980 impl fidl::encoding::ValueTypeMarker for RectU {
981 type Borrowed<'a> = &'a Self;
982 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
983 value
984 }
985 }
986
987 unsafe impl fidl::encoding::TypeMarker for RectU {
988 type Owned = Self;
989
990 #[inline(always)]
991 fn inline_align(_context: fidl::encoding::Context) -> usize {
992 4
993 }
994
995 #[inline(always)]
996 fn inline_size(_context: fidl::encoding::Context) -> usize {
997 16
998 }
999 #[inline(always)]
1000 fn encode_is_copy() -> bool {
1001 true
1002 }
1003
1004 #[inline(always)]
1005 fn decode_is_copy() -> bool {
1006 true
1007 }
1008 }
1009
1010 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RectU, D> for &RectU {
1011 #[inline]
1012 unsafe fn encode(
1013 self,
1014 encoder: &mut fidl::encoding::Encoder<'_, D>,
1015 offset: usize,
1016 _depth: fidl::encoding::Depth,
1017 ) -> fidl::Result<()> {
1018 encoder.debug_check_bounds::<RectU>(offset);
1019 unsafe {
1020 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1022 (buf_ptr as *mut RectU).write_unaligned((self as *const RectU).read());
1023 }
1026 Ok(())
1027 }
1028 }
1029 unsafe impl<
1030 D: fidl::encoding::ResourceDialect,
1031 T0: fidl::encoding::Encode<u32, D>,
1032 T1: fidl::encoding::Encode<u32, D>,
1033 T2: fidl::encoding::Encode<u32, D>,
1034 T3: fidl::encoding::Encode<u32, D>,
1035 > fidl::encoding::Encode<RectU, D> for (T0, T1, T2, T3)
1036 {
1037 #[inline]
1038 unsafe fn encode(
1039 self,
1040 encoder: &mut fidl::encoding::Encoder<'_, D>,
1041 offset: usize,
1042 depth: fidl::encoding::Depth,
1043 ) -> fidl::Result<()> {
1044 encoder.debug_check_bounds::<RectU>(offset);
1045 self.0.encode(encoder, offset + 0, depth)?;
1049 self.1.encode(encoder, offset + 4, depth)?;
1050 self.2.encode(encoder, offset + 8, depth)?;
1051 self.3.encode(encoder, offset + 12, depth)?;
1052 Ok(())
1053 }
1054 }
1055
1056 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RectU {
1057 #[inline(always)]
1058 fn new_empty() -> Self {
1059 Self {
1060 x: fidl::new_empty!(u32, D),
1061 y: fidl::new_empty!(u32, D),
1062 width: fidl::new_empty!(u32, D),
1063 height: fidl::new_empty!(u32, D),
1064 }
1065 }
1066
1067 #[inline]
1068 unsafe fn decode(
1069 &mut self,
1070 decoder: &mut fidl::encoding::Decoder<'_, D>,
1071 offset: usize,
1072 _depth: fidl::encoding::Depth,
1073 ) -> fidl::Result<()> {
1074 decoder.debug_check_bounds::<Self>(offset);
1075 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1076 unsafe {
1079 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1080 }
1081 Ok(())
1082 }
1083 }
1084
1085 impl ImageFormat {
1086 #[inline(always)]
1087 fn max_ordinal_present(&self) -> u64 {
1088 if let Some(_) = self.pixel_aspect_ratio {
1089 return 8;
1090 }
1091 if let Some(_) = self.valid_size {
1092 return 7;
1093 }
1094 if let Some(_) = self.display_rect {
1095 return 6;
1096 }
1097 if let Some(_) = self.bytes_per_row {
1098 return 5;
1099 }
1100 if let Some(_) = self.size {
1101 return 4;
1102 }
1103 if let Some(_) = self.color_space {
1104 return 3;
1105 }
1106 if let Some(_) = self.pixel_format_modifier {
1107 return 2;
1108 }
1109 if let Some(_) = self.pixel_format {
1110 return 1;
1111 }
1112 0
1113 }
1114 }
1115
1116 impl fidl::encoding::ValueTypeMarker for ImageFormat {
1117 type Borrowed<'a> = &'a Self;
1118 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1119 value
1120 }
1121 }
1122
1123 unsafe impl fidl::encoding::TypeMarker for ImageFormat {
1124 type Owned = Self;
1125
1126 #[inline(always)]
1127 fn inline_align(_context: fidl::encoding::Context) -> usize {
1128 8
1129 }
1130
1131 #[inline(always)]
1132 fn inline_size(_context: fidl::encoding::Context) -> usize {
1133 16
1134 }
1135 }
1136
1137 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageFormat, D>
1138 for &ImageFormat
1139 {
1140 unsafe fn encode(
1141 self,
1142 encoder: &mut fidl::encoding::Encoder<'_, D>,
1143 offset: usize,
1144 mut depth: fidl::encoding::Depth,
1145 ) -> fidl::Result<()> {
1146 encoder.debug_check_bounds::<ImageFormat>(offset);
1147 let max_ordinal: u64 = self.max_ordinal_present();
1149 encoder.write_num(max_ordinal, offset);
1150 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1151 if max_ordinal == 0 {
1153 return Ok(());
1154 }
1155 depth.increment()?;
1156 let envelope_size = 8;
1157 let bytes_len = max_ordinal as usize * envelope_size;
1158 #[allow(unused_variables)]
1159 let offset = encoder.out_of_line_offset(bytes_len);
1160 let mut _prev_end_offset: usize = 0;
1161 if 1 > max_ordinal {
1162 return Ok(());
1163 }
1164
1165 let cur_offset: usize = (1 - 1) * envelope_size;
1168
1169 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1171
1172 fidl::encoding::encode_in_envelope_optional::<PixelFormat, D>(
1177 self.pixel_format
1178 .as_ref()
1179 .map(<PixelFormat as fidl::encoding::ValueTypeMarker>::borrow),
1180 encoder,
1181 offset + cur_offset,
1182 depth,
1183 )?;
1184
1185 _prev_end_offset = cur_offset + envelope_size;
1186 if 2 > max_ordinal {
1187 return Ok(());
1188 }
1189
1190 let cur_offset: usize = (2 - 1) * envelope_size;
1193
1194 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1196
1197 fidl::encoding::encode_in_envelope_optional::<PixelFormatModifier, D>(
1202 self.pixel_format_modifier
1203 .as_ref()
1204 .map(<PixelFormatModifier as fidl::encoding::ValueTypeMarker>::borrow),
1205 encoder,
1206 offset + cur_offset,
1207 depth,
1208 )?;
1209
1210 _prev_end_offset = cur_offset + envelope_size;
1211 if 3 > max_ordinal {
1212 return Ok(());
1213 }
1214
1215 let cur_offset: usize = (3 - 1) * envelope_size;
1218
1219 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1221
1222 fidl::encoding::encode_in_envelope_optional::<ColorSpace, D>(
1227 self.color_space
1228 .as_ref()
1229 .map(<ColorSpace as fidl::encoding::ValueTypeMarker>::borrow),
1230 encoder,
1231 offset + cur_offset,
1232 depth,
1233 )?;
1234
1235 _prev_end_offset = cur_offset + envelope_size;
1236 if 4 > max_ordinal {
1237 return Ok(());
1238 }
1239
1240 let cur_offset: usize = (4 - 1) * envelope_size;
1243
1244 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1246
1247 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::SizeU, D>(
1252 self.size
1253 .as_ref()
1254 .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
1255 encoder,
1256 offset + cur_offset,
1257 depth,
1258 )?;
1259
1260 _prev_end_offset = cur_offset + envelope_size;
1261 if 5 > max_ordinal {
1262 return Ok(());
1263 }
1264
1265 let cur_offset: usize = (5 - 1) * envelope_size;
1268
1269 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1271
1272 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1277 self.bytes_per_row.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1278 encoder,
1279 offset + cur_offset,
1280 depth,
1281 )?;
1282
1283 _prev_end_offset = cur_offset + envelope_size;
1284 if 6 > max_ordinal {
1285 return Ok(());
1286 }
1287
1288 let cur_offset: usize = (6 - 1) * envelope_size;
1291
1292 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1294
1295 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::RectU, D>(
1300 self.display_rect
1301 .as_ref()
1302 .map(<fidl_fuchsia_math::RectU as fidl::encoding::ValueTypeMarker>::borrow),
1303 encoder,
1304 offset + cur_offset,
1305 depth,
1306 )?;
1307
1308 _prev_end_offset = cur_offset + envelope_size;
1309 if 7 > max_ordinal {
1310 return Ok(());
1311 }
1312
1313 let cur_offset: usize = (7 - 1) * envelope_size;
1316
1317 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1319
1320 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::SizeU, D>(
1325 self.valid_size
1326 .as_ref()
1327 .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
1328 encoder,
1329 offset + cur_offset,
1330 depth,
1331 )?;
1332
1333 _prev_end_offset = cur_offset + envelope_size;
1334 if 8 > max_ordinal {
1335 return Ok(());
1336 }
1337
1338 let cur_offset: usize = (8 - 1) * envelope_size;
1341
1342 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1344
1345 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::SizeU, D>(
1350 self.pixel_aspect_ratio
1351 .as_ref()
1352 .map(<fidl_fuchsia_math::SizeU as fidl::encoding::ValueTypeMarker>::borrow),
1353 encoder,
1354 offset + cur_offset,
1355 depth,
1356 )?;
1357
1358 _prev_end_offset = cur_offset + envelope_size;
1359
1360 Ok(())
1361 }
1362 }
1363
1364 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageFormat {
1365 #[inline(always)]
1366 fn new_empty() -> Self {
1367 Self::default()
1368 }
1369
1370 unsafe fn decode(
1371 &mut self,
1372 decoder: &mut fidl::encoding::Decoder<'_, D>,
1373 offset: usize,
1374 mut depth: fidl::encoding::Depth,
1375 ) -> fidl::Result<()> {
1376 decoder.debug_check_bounds::<Self>(offset);
1377 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1378 None => return Err(fidl::Error::NotNullable),
1379 Some(len) => len,
1380 };
1381 if len == 0 {
1383 return Ok(());
1384 };
1385 depth.increment()?;
1386 let envelope_size = 8;
1387 let bytes_len = len * envelope_size;
1388 let offset = decoder.out_of_line_offset(bytes_len)?;
1389 let mut _next_ordinal_to_read = 0;
1391 let mut next_offset = offset;
1392 let end_offset = offset + bytes_len;
1393 _next_ordinal_to_read += 1;
1394 if next_offset >= end_offset {
1395 return Ok(());
1396 }
1397
1398 while _next_ordinal_to_read < 1 {
1400 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1401 _next_ordinal_to_read += 1;
1402 next_offset += envelope_size;
1403 }
1404
1405 let next_out_of_line = decoder.next_out_of_line();
1406 let handles_before = decoder.remaining_handles();
1407 if let Some((inlined, num_bytes, num_handles)) =
1408 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1409 {
1410 let member_inline_size =
1411 <PixelFormat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1412 if inlined != (member_inline_size <= 4) {
1413 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1414 }
1415 let inner_offset;
1416 let mut inner_depth = depth.clone();
1417 if inlined {
1418 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1419 inner_offset = next_offset;
1420 } else {
1421 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1422 inner_depth.increment()?;
1423 }
1424 let val_ref =
1425 self.pixel_format.get_or_insert_with(|| fidl::new_empty!(PixelFormat, D));
1426 fidl::decode!(PixelFormat, D, val_ref, decoder, inner_offset, inner_depth)?;
1427 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1428 {
1429 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1430 }
1431 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1432 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1433 }
1434 }
1435
1436 next_offset += envelope_size;
1437 _next_ordinal_to_read += 1;
1438 if next_offset >= end_offset {
1439 return Ok(());
1440 }
1441
1442 while _next_ordinal_to_read < 2 {
1444 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1445 _next_ordinal_to_read += 1;
1446 next_offset += envelope_size;
1447 }
1448
1449 let next_out_of_line = decoder.next_out_of_line();
1450 let handles_before = decoder.remaining_handles();
1451 if let Some((inlined, num_bytes, num_handles)) =
1452 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1453 {
1454 let member_inline_size =
1455 <PixelFormatModifier as fidl::encoding::TypeMarker>::inline_size(
1456 decoder.context,
1457 );
1458 if inlined != (member_inline_size <= 4) {
1459 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1460 }
1461 let inner_offset;
1462 let mut inner_depth = depth.clone();
1463 if inlined {
1464 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1465 inner_offset = next_offset;
1466 } else {
1467 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1468 inner_depth.increment()?;
1469 }
1470 let val_ref = self
1471 .pixel_format_modifier
1472 .get_or_insert_with(|| fidl::new_empty!(PixelFormatModifier, D));
1473 fidl::decode!(PixelFormatModifier, D, val_ref, decoder, inner_offset, inner_depth)?;
1474 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1475 {
1476 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1477 }
1478 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1479 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1480 }
1481 }
1482
1483 next_offset += envelope_size;
1484 _next_ordinal_to_read += 1;
1485 if next_offset >= end_offset {
1486 return Ok(());
1487 }
1488
1489 while _next_ordinal_to_read < 3 {
1491 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1492 _next_ordinal_to_read += 1;
1493 next_offset += envelope_size;
1494 }
1495
1496 let next_out_of_line = decoder.next_out_of_line();
1497 let handles_before = decoder.remaining_handles();
1498 if let Some((inlined, num_bytes, num_handles)) =
1499 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1500 {
1501 let member_inline_size =
1502 <ColorSpace as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1503 if inlined != (member_inline_size <= 4) {
1504 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1505 }
1506 let inner_offset;
1507 let mut inner_depth = depth.clone();
1508 if inlined {
1509 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1510 inner_offset = next_offset;
1511 } else {
1512 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1513 inner_depth.increment()?;
1514 }
1515 let val_ref =
1516 self.color_space.get_or_insert_with(|| fidl::new_empty!(ColorSpace, D));
1517 fidl::decode!(ColorSpace, D, val_ref, decoder, inner_offset, inner_depth)?;
1518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1519 {
1520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1521 }
1522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1524 }
1525 }
1526
1527 next_offset += envelope_size;
1528 _next_ordinal_to_read += 1;
1529 if next_offset >= end_offset {
1530 return Ok(());
1531 }
1532
1533 while _next_ordinal_to_read < 4 {
1535 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1536 _next_ordinal_to_read += 1;
1537 next_offset += envelope_size;
1538 }
1539
1540 let next_out_of_line = decoder.next_out_of_line();
1541 let handles_before = decoder.remaining_handles();
1542 if let Some((inlined, num_bytes, num_handles)) =
1543 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1544 {
1545 let member_inline_size =
1546 <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
1547 decoder.context,
1548 );
1549 if inlined != (member_inline_size <= 4) {
1550 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1551 }
1552 let inner_offset;
1553 let mut inner_depth = depth.clone();
1554 if inlined {
1555 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1556 inner_offset = next_offset;
1557 } else {
1558 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1559 inner_depth.increment()?;
1560 }
1561 let val_ref =
1562 self.size.get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::SizeU, D));
1563 fidl::decode!(
1564 fidl_fuchsia_math::SizeU,
1565 D,
1566 val_ref,
1567 decoder,
1568 inner_offset,
1569 inner_depth
1570 )?;
1571 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1572 {
1573 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1574 }
1575 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1576 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1577 }
1578 }
1579
1580 next_offset += envelope_size;
1581 _next_ordinal_to_read += 1;
1582 if next_offset >= end_offset {
1583 return Ok(());
1584 }
1585
1586 while _next_ordinal_to_read < 5 {
1588 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1589 _next_ordinal_to_read += 1;
1590 next_offset += envelope_size;
1591 }
1592
1593 let next_out_of_line = decoder.next_out_of_line();
1594 let handles_before = decoder.remaining_handles();
1595 if let Some((inlined, num_bytes, num_handles)) =
1596 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1597 {
1598 let member_inline_size =
1599 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1600 if inlined != (member_inline_size <= 4) {
1601 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1602 }
1603 let inner_offset;
1604 let mut inner_depth = depth.clone();
1605 if inlined {
1606 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1607 inner_offset = next_offset;
1608 } else {
1609 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1610 inner_depth.increment()?;
1611 }
1612 let val_ref = self.bytes_per_row.get_or_insert_with(|| fidl::new_empty!(u32, D));
1613 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1614 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1615 {
1616 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1617 }
1618 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1619 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1620 }
1621 }
1622
1623 next_offset += envelope_size;
1624 _next_ordinal_to_read += 1;
1625 if next_offset >= end_offset {
1626 return Ok(());
1627 }
1628
1629 while _next_ordinal_to_read < 6 {
1631 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1632 _next_ordinal_to_read += 1;
1633 next_offset += envelope_size;
1634 }
1635
1636 let next_out_of_line = decoder.next_out_of_line();
1637 let handles_before = decoder.remaining_handles();
1638 if let Some((inlined, num_bytes, num_handles)) =
1639 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1640 {
1641 let member_inline_size =
1642 <fidl_fuchsia_math::RectU as fidl::encoding::TypeMarker>::inline_size(
1643 decoder.context,
1644 );
1645 if inlined != (member_inline_size <= 4) {
1646 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1647 }
1648 let inner_offset;
1649 let mut inner_depth = depth.clone();
1650 if inlined {
1651 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1652 inner_offset = next_offset;
1653 } else {
1654 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1655 inner_depth.increment()?;
1656 }
1657 let val_ref = self
1658 .display_rect
1659 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::RectU, D));
1660 fidl::decode!(
1661 fidl_fuchsia_math::RectU,
1662 D,
1663 val_ref,
1664 decoder,
1665 inner_offset,
1666 inner_depth
1667 )?;
1668 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1669 {
1670 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1671 }
1672 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1673 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1674 }
1675 }
1676
1677 next_offset += envelope_size;
1678 _next_ordinal_to_read += 1;
1679 if next_offset >= end_offset {
1680 return Ok(());
1681 }
1682
1683 while _next_ordinal_to_read < 7 {
1685 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1686 _next_ordinal_to_read += 1;
1687 next_offset += envelope_size;
1688 }
1689
1690 let next_out_of_line = decoder.next_out_of_line();
1691 let handles_before = decoder.remaining_handles();
1692 if let Some((inlined, num_bytes, num_handles)) =
1693 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1694 {
1695 let member_inline_size =
1696 <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
1697 decoder.context,
1698 );
1699 if inlined != (member_inline_size <= 4) {
1700 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1701 }
1702 let inner_offset;
1703 let mut inner_depth = depth.clone();
1704 if inlined {
1705 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1706 inner_offset = next_offset;
1707 } else {
1708 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1709 inner_depth.increment()?;
1710 }
1711 let val_ref = self
1712 .valid_size
1713 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::SizeU, D));
1714 fidl::decode!(
1715 fidl_fuchsia_math::SizeU,
1716 D,
1717 val_ref,
1718 decoder,
1719 inner_offset,
1720 inner_depth
1721 )?;
1722 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1723 {
1724 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1725 }
1726 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1727 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1728 }
1729 }
1730
1731 next_offset += envelope_size;
1732 _next_ordinal_to_read += 1;
1733 if next_offset >= end_offset {
1734 return Ok(());
1735 }
1736
1737 while _next_ordinal_to_read < 8 {
1739 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1740 _next_ordinal_to_read += 1;
1741 next_offset += envelope_size;
1742 }
1743
1744 let next_out_of_line = decoder.next_out_of_line();
1745 let handles_before = decoder.remaining_handles();
1746 if let Some((inlined, num_bytes, num_handles)) =
1747 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1748 {
1749 let member_inline_size =
1750 <fidl_fuchsia_math::SizeU as fidl::encoding::TypeMarker>::inline_size(
1751 decoder.context,
1752 );
1753 if inlined != (member_inline_size <= 4) {
1754 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1755 }
1756 let inner_offset;
1757 let mut inner_depth = depth.clone();
1758 if inlined {
1759 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1760 inner_offset = next_offset;
1761 } else {
1762 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1763 inner_depth.increment()?;
1764 }
1765 let val_ref = self
1766 .pixel_aspect_ratio
1767 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::SizeU, D));
1768 fidl::decode!(
1769 fidl_fuchsia_math::SizeU,
1770 D,
1771 val_ref,
1772 decoder,
1773 inner_offset,
1774 inner_depth
1775 )?;
1776 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1777 {
1778 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1779 }
1780 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1781 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1782 }
1783 }
1784
1785 next_offset += envelope_size;
1786
1787 while next_offset < end_offset {
1789 _next_ordinal_to_read += 1;
1790 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1791 next_offset += envelope_size;
1792 }
1793
1794 Ok(())
1795 }
1796 }
1797}