fidl_fuchsia_images__common/
fidl_fuchsia_images__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_ACQUIRE_RELEASE_FENCE_COUNT: i32 = 16;
12
13/// Specifies how alpha information should be interpreted.
14#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
15#[repr(u32)]
16pub enum AlphaFormat {
17    /// Image is considered to be opaque.  Alpha channel is ignored.
18    /// Blend function is: src.RGB
19    Opaque = 0,
20    /// Color channels have been premultiplied by alpha.
21    /// Blend function is: src.RGB + (dest.RGB * (1 - src.A))
22    Premultiplied = 1,
23    /// Color channels have not been premultiplied by alpha.
24    /// Blend function is: (src.RGB * src.A) + (dest.RGB * (1 - src.A))
25    NonPremultiplied = 2,
26}
27
28impl AlphaFormat {
29    #[inline]
30    pub fn from_primitive(prim: u32) -> Option<Self> {
31        match prim {
32            0 => Some(Self::Opaque),
33            1 => Some(Self::Premultiplied),
34            2 => Some(Self::NonPremultiplied),
35            _ => None,
36        }
37    }
38
39    #[inline]
40    pub const fn into_primitive(self) -> u32 {
41        self as u32
42    }
43}
44
45/// Specifies how pixel color information should be interpreted.
46#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
47#[repr(u32)]
48pub enum ColorSpace {
49    Srgb = 0,
50}
51
52impl ColorSpace {
53    #[inline]
54    pub fn from_primitive(prim: u32) -> Option<Self> {
55        match prim {
56            0 => Some(Self::Srgb),
57            _ => None,
58        }
59    }
60
61    #[inline]
62    pub const fn into_primitive(self) -> u32 {
63        self as u32
64    }
65}
66
67/// Specifies the type of VMO's memory.
68#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
69#[repr(u32)]
70pub enum MemoryType {
71    /// VMO is regular host CPU memory.
72    HostMemory = 0,
73    /// VMO can be imported as a VkDeviceMemory by calling VkAllocateMemory with a
74    /// VkImportMemoryFuchsiaHandleInfoKHR wrapped in a VkMemoryAllocateInfo.
75    VkDeviceMemory = 1,
76}
77
78impl MemoryType {
79    #[inline]
80    pub fn from_primitive(prim: u32) -> Option<Self> {
81        match prim {
82            0 => Some(Self::HostMemory),
83            1 => Some(Self::VkDeviceMemory),
84            _ => None,
85        }
86    }
87
88    #[inline]
89    pub const fn into_primitive(self) -> u32 {
90        self as u32
91    }
92}
93
94/// Specifies how pixels are represented in the image buffer.
95#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
96#[repr(u32)]
97pub enum PixelFormat {
98    /// BGRA_8
99    ///
100    /// A 32-bit four-component unsigned integer format.
101    /// Byte order: B, G, R, A (little-endian ARGB packed 32-bit word).
102    /// Equivalent to Skia `kBGRA_8888_SkColorType` color type.
103    /// Equivalent to Zircon `ARGB_8888` pixel format on little-endian arch.
104    Bgra8 = 0,
105    /// YUY2
106    ///
107    /// 4:2:2 (2x down-sampled UV horizontally; full res UV vertically)
108    ///
109    /// A 32-bit component that contains information for 2 pixels:
110    /// Byte order: Y1, U, Y2, V
111    /// Unpacks to 2 RGB pixels, where RGB1 = func(Y1, U, V)
112    /// and RGB2 = func(Y2, U, V)
113    /// Equivalent to YUV422
114    Yuy2 = 1,
115    /// NV12
116    ///
117    /// 4:2:0 (2x down-sampled UV in both directions)
118    ///
119    /// Offset 0:
120    /// 8 bit per pixel Y plane with bytes YYY.
121    /// Offset height * stride:
122    /// 8 bit UV data interleaved bytes as UVUVUV.
123    ///
124    /// Y plane has line stride >= width.
125    ///
126    /// In this context, both width and height are required to be even.
127    ///
128    /// The UV data is separated into "lines", with each "line" having same byte
129    /// width as a line of Y data, and same "line" stride as Y data's line stride.
130    /// The UV data has height / 2 "lines".
131    ///
132    /// In converting to RGB, the UV data gets up-scaled by 2x in both directions
133    /// overall.  This comment is intentionally silent on exactly how UV up-scaling
134    /// phase/filtering/signal processing works, as it's a complicated topic that
135    /// can vary by implementation, typically trading off speed and quality of the
136    /// up-scaling.  See comments in relevant conversion code for approach taken
137    /// by any given convert path.  The precise relative phase of the UV data is
138    /// not presently conveyed.
139    Nv12 = 2,
140    /// YV12
141    ///
142    /// Like I420, except with V and U swapped.
143    ///
144    /// 4:2:0 (2x down-sampled UV in both directions)
145    ///
146    /// Offset 0:
147    /// 8 bit per pixel Y plane with bytes YYY.
148    /// Offset height * stride:
149    /// 8 bit V data with uv_stride = stride / 2
150    /// Offset height * stride + uv_stride * height / 2:
151    /// 8 bit U data with uv_stride = stride / 2
152    ///
153    /// Y plane has line stride >= width.
154    ///
155    /// Both width and height are required to be even.
156    Yv12 = 3,
157    /// R8G8B8A8
158    ///
159    /// A 32-bit four-component unsigned integer format.
160    /// Byte order: R, G, B, A (little-endian ABGR packed 32-bit word).
161    /// Equivalent to Skia `kRGBA_8888_SkColorType` color type.
162    /// Equivalent to Zircon `ABGR_8888` pixel format on little-endian arch.
163    ///
164    /// This format can only be used with VK_DEVICE_MEMORY.
165    R8G8B8A8 = 4,
166}
167
168impl PixelFormat {
169    #[inline]
170    pub fn from_primitive(prim: u32) -> Option<Self> {
171        match prim {
172            0 => Some(Self::Bgra8),
173            1 => Some(Self::Yuy2),
174            2 => Some(Self::Nv12),
175            3 => Some(Self::Yv12),
176            4 => Some(Self::R8G8B8A8),
177            _ => None,
178        }
179    }
180
181    #[inline]
182    pub const fn into_primitive(self) -> u32 {
183        self as u32
184    }
185}
186
187/// Specifies how pixels are arranged in memory.
188#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
189#[repr(u32)]
190pub enum Tiling {
191    /// Pixels are packed linearly.
192    /// Equivalent to `VK_IMAGE_TILING_LINEAR`.
193    Linear = 0,
194    /// Pixels are packed in a GPU-dependent optimal format.
195    /// Equivalent to `VK_IMAGE_TILING_OPTIMAL`.
196    GpuOptimal = 1,
197}
198
199impl Tiling {
200    #[inline]
201    pub fn from_primitive(prim: u32) -> Option<Self> {
202        match prim {
203            0 => Some(Self::Linear),
204            1 => Some(Self::GpuOptimal),
205            _ => None,
206        }
207    }
208
209    #[inline]
210    pub const fn into_primitive(self) -> u32 {
211        self as u32
212    }
213}
214
215#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
216#[repr(u32)]
217pub enum Transform {
218    /// Pixels are displayed normally.
219    Normal = 0,
220    /// Pixels are mirrored left-right.
221    FlipHorizontal = 1,
222    /// Pixels are flipped vertically.
223    FlipVertical = 2,
224    /// Pixels are flipped vertically and mirrored left-right.
225    FlipVerticalAndHorizontal = 3,
226}
227
228impl Transform {
229    #[inline]
230    pub fn from_primitive(prim: u32) -> Option<Self> {
231        match prim {
232            0 => Some(Self::Normal),
233            1 => Some(Self::FlipHorizontal),
234            2 => Some(Self::FlipVertical),
235            3 => Some(Self::FlipVerticalAndHorizontal),
236            _ => None,
237        }
238    }
239
240    #[inline]
241    pub const fn into_primitive(self) -> u32 {
242        self as u32
243    }
244}
245
246/// Information about a graphical image (texture) including its format and size.
247#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
248pub struct ImageInfo {
249    /// Specifies if the image should be mirrored before displaying.
250    pub transform: Transform,
251    /// The width and height of the image in pixels.
252    pub width: u32,
253    pub height: u32,
254    /// The number of bytes per row in the image buffer.
255    pub stride: u32,
256    /// The pixel format of the image.
257    pub pixel_format: PixelFormat,
258    /// The pixel color space.
259    pub color_space: ColorSpace,
260    /// The pixel arrangement in memory.
261    pub tiling: Tiling,
262    /// Specifies the interpretion of the alpha channel, if one exists.
263    pub alpha_format: AlphaFormat,
264}
265
266impl fidl::Persistable for ImageInfo {}
267
268#[derive(Clone, Debug, PartialEq)]
269pub struct ImagePipe2AddImageRequest {
270    pub image_id: u32,
271    pub buffer_collection_id: u32,
272    pub buffer_collection_index: u32,
273    pub image_format: fidl_fuchsia_sysmem__common::ImageFormat2,
274}
275
276impl fidl::Persistable for ImagePipe2AddImageRequest {}
277
278#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
279#[repr(C)]
280pub struct ImagePipe2PresentImageResponse {
281    pub presentation_info: PresentationInfo,
282}
283
284impl fidl::Persistable for ImagePipe2PresentImageResponse {}
285
286#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
287#[repr(C)]
288pub struct ImagePipe2RemoveBufferCollectionRequest {
289    pub buffer_collection_id: u32,
290}
291
292impl fidl::Persistable for ImagePipe2RemoveBufferCollectionRequest {}
293
294#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
295#[repr(C)]
296pub struct ImagePipe2RemoveImageRequest {
297    pub image_id: u32,
298}
299
300impl fidl::Persistable for ImagePipe2RemoveImageRequest {}
301
302/// Information returned by methods such as `ImagePipe.PresentImage()` and
303/// `Session.Present()`, when the consumer begins preparing the first frame
304/// which includes the presented content.
305#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
306#[repr(C)]
307pub struct PresentationInfo {
308    /// The actual time at which the enqueued operations are anticipated to take
309    /// visible effect, expressed in nanoseconds in the `CLOCK_MONOTONIC`
310    /// timebase.
311    ///
312    /// This value increases monotonically with each new frame, typically in
313    /// increments of the `presentation_interval`.
314    pub presentation_time: u64,
315    /// The nominal amount of time which is anticipated to elapse between
316    /// successively presented frames, expressed in nanoseconds.  When rendering
317    /// to a display, the interval will typically be derived from the display
318    /// refresh rate.
319    ///
320    /// This value is non-zero.  It may vary from time to time, such as when
321    /// changing display modes.
322    pub presentation_interval: u64,
323}
324
325impl fidl::Persistable for PresentationInfo {}
326
327pub mod image_pipe2_ordinals {
328    pub const ADD_BUFFER_COLLECTION2: u64 = 0x181c72c935b0b4ee;
329    pub const ADD_BUFFER_COLLECTION: u64 = 0x663ec76e20c87c05;
330    pub const ADD_IMAGE: u64 = 0x23566808b13af395;
331    pub const REMOVE_BUFFER_COLLECTION: u64 = 0x16bebb759a932299;
332    pub const REMOVE_IMAGE: u64 = 0x16e8edd0f4d50f68;
333    pub const PRESENT_IMAGE: u64 = 0x73cfb50f577c143a;
334}
335
336mod internal {
337    use super::*;
338    unsafe impl fidl::encoding::TypeMarker for AlphaFormat {
339        type Owned = Self;
340
341        #[inline(always)]
342        fn inline_align(_context: fidl::encoding::Context) -> usize {
343            std::mem::align_of::<u32>()
344        }
345
346        #[inline(always)]
347        fn inline_size(_context: fidl::encoding::Context) -> usize {
348            std::mem::size_of::<u32>()
349        }
350
351        #[inline(always)]
352        fn encode_is_copy() -> bool {
353            true
354        }
355
356        #[inline(always)]
357        fn decode_is_copy() -> bool {
358            false
359        }
360    }
361
362    impl fidl::encoding::ValueTypeMarker for AlphaFormat {
363        type Borrowed<'a> = Self;
364        #[inline(always)]
365        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
366            *value
367        }
368    }
369
370    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AlphaFormat {
371        #[inline]
372        unsafe fn encode(
373            self,
374            encoder: &mut fidl::encoding::Encoder<'_, D>,
375            offset: usize,
376            _depth: fidl::encoding::Depth,
377        ) -> fidl::Result<()> {
378            encoder.debug_check_bounds::<Self>(offset);
379            encoder.write_num(self.into_primitive(), offset);
380            Ok(())
381        }
382    }
383
384    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AlphaFormat {
385        #[inline(always)]
386        fn new_empty() -> Self {
387            Self::Opaque
388        }
389
390        #[inline]
391        unsafe fn decode(
392            &mut self,
393            decoder: &mut fidl::encoding::Decoder<'_, D>,
394            offset: usize,
395            _depth: fidl::encoding::Depth,
396        ) -> fidl::Result<()> {
397            decoder.debug_check_bounds::<Self>(offset);
398            let prim = decoder.read_num::<u32>(offset);
399
400            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
401            Ok(())
402        }
403    }
404    unsafe impl fidl::encoding::TypeMarker for ColorSpace {
405        type Owned = Self;
406
407        #[inline(always)]
408        fn inline_align(_context: fidl::encoding::Context) -> usize {
409            std::mem::align_of::<u32>()
410        }
411
412        #[inline(always)]
413        fn inline_size(_context: fidl::encoding::Context) -> usize {
414            std::mem::size_of::<u32>()
415        }
416
417        #[inline(always)]
418        fn encode_is_copy() -> bool {
419            true
420        }
421
422        #[inline(always)]
423        fn decode_is_copy() -> bool {
424            false
425        }
426    }
427
428    impl fidl::encoding::ValueTypeMarker for ColorSpace {
429        type Borrowed<'a> = Self;
430        #[inline(always)]
431        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
432            *value
433        }
434    }
435
436    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ColorSpace {
437        #[inline]
438        unsafe fn encode(
439            self,
440            encoder: &mut fidl::encoding::Encoder<'_, D>,
441            offset: usize,
442            _depth: fidl::encoding::Depth,
443        ) -> fidl::Result<()> {
444            encoder.debug_check_bounds::<Self>(offset);
445            encoder.write_num(self.into_primitive(), offset);
446            Ok(())
447        }
448    }
449
450    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorSpace {
451        #[inline(always)]
452        fn new_empty() -> Self {
453            Self::Srgb
454        }
455
456        #[inline]
457        unsafe fn decode(
458            &mut self,
459            decoder: &mut fidl::encoding::Decoder<'_, D>,
460            offset: usize,
461            _depth: fidl::encoding::Depth,
462        ) -> fidl::Result<()> {
463            decoder.debug_check_bounds::<Self>(offset);
464            let prim = decoder.read_num::<u32>(offset);
465
466            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
467            Ok(())
468        }
469    }
470    unsafe impl fidl::encoding::TypeMarker for MemoryType {
471        type Owned = Self;
472
473        #[inline(always)]
474        fn inline_align(_context: fidl::encoding::Context) -> usize {
475            std::mem::align_of::<u32>()
476        }
477
478        #[inline(always)]
479        fn inline_size(_context: fidl::encoding::Context) -> usize {
480            std::mem::size_of::<u32>()
481        }
482
483        #[inline(always)]
484        fn encode_is_copy() -> bool {
485            true
486        }
487
488        #[inline(always)]
489        fn decode_is_copy() -> bool {
490            false
491        }
492    }
493
494    impl fidl::encoding::ValueTypeMarker for MemoryType {
495        type Borrowed<'a> = Self;
496        #[inline(always)]
497        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
498            *value
499        }
500    }
501
502    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MemoryType {
503        #[inline]
504        unsafe fn encode(
505            self,
506            encoder: &mut fidl::encoding::Encoder<'_, D>,
507            offset: usize,
508            _depth: fidl::encoding::Depth,
509        ) -> fidl::Result<()> {
510            encoder.debug_check_bounds::<Self>(offset);
511            encoder.write_num(self.into_primitive(), offset);
512            Ok(())
513        }
514    }
515
516    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MemoryType {
517        #[inline(always)]
518        fn new_empty() -> Self {
519            Self::HostMemory
520        }
521
522        #[inline]
523        unsafe fn decode(
524            &mut self,
525            decoder: &mut fidl::encoding::Decoder<'_, D>,
526            offset: usize,
527            _depth: fidl::encoding::Depth,
528        ) -> fidl::Result<()> {
529            decoder.debug_check_bounds::<Self>(offset);
530            let prim = decoder.read_num::<u32>(offset);
531
532            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
533            Ok(())
534        }
535    }
536    unsafe impl fidl::encoding::TypeMarker for PixelFormat {
537        type Owned = Self;
538
539        #[inline(always)]
540        fn inline_align(_context: fidl::encoding::Context) -> usize {
541            std::mem::align_of::<u32>()
542        }
543
544        #[inline(always)]
545        fn inline_size(_context: fidl::encoding::Context) -> usize {
546            std::mem::size_of::<u32>()
547        }
548
549        #[inline(always)]
550        fn encode_is_copy() -> bool {
551            true
552        }
553
554        #[inline(always)]
555        fn decode_is_copy() -> bool {
556            false
557        }
558    }
559
560    impl fidl::encoding::ValueTypeMarker for PixelFormat {
561        type Borrowed<'a> = Self;
562        #[inline(always)]
563        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
564            *value
565        }
566    }
567
568    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for PixelFormat {
569        #[inline]
570        unsafe fn encode(
571            self,
572            encoder: &mut fidl::encoding::Encoder<'_, D>,
573            offset: usize,
574            _depth: fidl::encoding::Depth,
575        ) -> fidl::Result<()> {
576            encoder.debug_check_bounds::<Self>(offset);
577            encoder.write_num(self.into_primitive(), offset);
578            Ok(())
579        }
580    }
581
582    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PixelFormat {
583        #[inline(always)]
584        fn new_empty() -> Self {
585            Self::Bgra8
586        }
587
588        #[inline]
589        unsafe fn decode(
590            &mut self,
591            decoder: &mut fidl::encoding::Decoder<'_, D>,
592            offset: usize,
593            _depth: fidl::encoding::Depth,
594        ) -> fidl::Result<()> {
595            decoder.debug_check_bounds::<Self>(offset);
596            let prim = decoder.read_num::<u32>(offset);
597
598            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
599            Ok(())
600        }
601    }
602    unsafe impl fidl::encoding::TypeMarker for Tiling {
603        type Owned = Self;
604
605        #[inline(always)]
606        fn inline_align(_context: fidl::encoding::Context) -> usize {
607            std::mem::align_of::<u32>()
608        }
609
610        #[inline(always)]
611        fn inline_size(_context: fidl::encoding::Context) -> usize {
612            std::mem::size_of::<u32>()
613        }
614
615        #[inline(always)]
616        fn encode_is_copy() -> bool {
617            true
618        }
619
620        #[inline(always)]
621        fn decode_is_copy() -> bool {
622            false
623        }
624    }
625
626    impl fidl::encoding::ValueTypeMarker for Tiling {
627        type Borrowed<'a> = Self;
628        #[inline(always)]
629        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
630            *value
631        }
632    }
633
634    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Tiling {
635        #[inline]
636        unsafe fn encode(
637            self,
638            encoder: &mut fidl::encoding::Encoder<'_, D>,
639            offset: usize,
640            _depth: fidl::encoding::Depth,
641        ) -> fidl::Result<()> {
642            encoder.debug_check_bounds::<Self>(offset);
643            encoder.write_num(self.into_primitive(), offset);
644            Ok(())
645        }
646    }
647
648    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Tiling {
649        #[inline(always)]
650        fn new_empty() -> Self {
651            Self::Linear
652        }
653
654        #[inline]
655        unsafe fn decode(
656            &mut self,
657            decoder: &mut fidl::encoding::Decoder<'_, D>,
658            offset: usize,
659            _depth: fidl::encoding::Depth,
660        ) -> fidl::Result<()> {
661            decoder.debug_check_bounds::<Self>(offset);
662            let prim = decoder.read_num::<u32>(offset);
663
664            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
665            Ok(())
666        }
667    }
668    unsafe impl fidl::encoding::TypeMarker for Transform {
669        type Owned = Self;
670
671        #[inline(always)]
672        fn inline_align(_context: fidl::encoding::Context) -> usize {
673            std::mem::align_of::<u32>()
674        }
675
676        #[inline(always)]
677        fn inline_size(_context: fidl::encoding::Context) -> usize {
678            std::mem::size_of::<u32>()
679        }
680
681        #[inline(always)]
682        fn encode_is_copy() -> bool {
683            true
684        }
685
686        #[inline(always)]
687        fn decode_is_copy() -> bool {
688            false
689        }
690    }
691
692    impl fidl::encoding::ValueTypeMarker for Transform {
693        type Borrowed<'a> = Self;
694        #[inline(always)]
695        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
696            *value
697        }
698    }
699
700    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Transform {
701        #[inline]
702        unsafe fn encode(
703            self,
704            encoder: &mut fidl::encoding::Encoder<'_, D>,
705            offset: usize,
706            _depth: fidl::encoding::Depth,
707        ) -> fidl::Result<()> {
708            encoder.debug_check_bounds::<Self>(offset);
709            encoder.write_num(self.into_primitive(), offset);
710            Ok(())
711        }
712    }
713
714    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Transform {
715        #[inline(always)]
716        fn new_empty() -> Self {
717            Self::Normal
718        }
719
720        #[inline]
721        unsafe fn decode(
722            &mut self,
723            decoder: &mut fidl::encoding::Decoder<'_, D>,
724            offset: usize,
725            _depth: fidl::encoding::Depth,
726        ) -> fidl::Result<()> {
727            decoder.debug_check_bounds::<Self>(offset);
728            let prim = decoder.read_num::<u32>(offset);
729
730            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
731            Ok(())
732        }
733    }
734
735    impl fidl::encoding::ValueTypeMarker for ImageInfo {
736        type Borrowed<'a> = &'a Self;
737        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
738            value
739        }
740    }
741
742    unsafe impl fidl::encoding::TypeMarker for ImageInfo {
743        type Owned = Self;
744
745        #[inline(always)]
746        fn inline_align(_context: fidl::encoding::Context) -> usize {
747            4
748        }
749
750        #[inline(always)]
751        fn inline_size(_context: fidl::encoding::Context) -> usize {
752            32
753        }
754    }
755
756    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ImageInfo, D>
757        for &ImageInfo
758    {
759        #[inline]
760        unsafe fn encode(
761            self,
762            encoder: &mut fidl::encoding::Encoder<'_, D>,
763            offset: usize,
764            _depth: fidl::encoding::Depth,
765        ) -> fidl::Result<()> {
766            encoder.debug_check_bounds::<ImageInfo>(offset);
767            // Delegate to tuple encoding.
768            fidl::encoding::Encode::<ImageInfo, D>::encode(
769                (
770                    <Transform as fidl::encoding::ValueTypeMarker>::borrow(&self.transform),
771                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.width),
772                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.height),
773                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.stride),
774                    <PixelFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.pixel_format),
775                    <ColorSpace as fidl::encoding::ValueTypeMarker>::borrow(&self.color_space),
776                    <Tiling as fidl::encoding::ValueTypeMarker>::borrow(&self.tiling),
777                    <AlphaFormat as fidl::encoding::ValueTypeMarker>::borrow(&self.alpha_format),
778                ),
779                encoder,
780                offset,
781                _depth,
782            )
783        }
784    }
785    unsafe impl<
786            D: fidl::encoding::ResourceDialect,
787            T0: fidl::encoding::Encode<Transform, D>,
788            T1: fidl::encoding::Encode<u32, D>,
789            T2: fidl::encoding::Encode<u32, D>,
790            T3: fidl::encoding::Encode<u32, D>,
791            T4: fidl::encoding::Encode<PixelFormat, D>,
792            T5: fidl::encoding::Encode<ColorSpace, D>,
793            T6: fidl::encoding::Encode<Tiling, D>,
794            T7: fidl::encoding::Encode<AlphaFormat, D>,
795        > fidl::encoding::Encode<ImageInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
796    {
797        #[inline]
798        unsafe fn encode(
799            self,
800            encoder: &mut fidl::encoding::Encoder<'_, D>,
801            offset: usize,
802            depth: fidl::encoding::Depth,
803        ) -> fidl::Result<()> {
804            encoder.debug_check_bounds::<ImageInfo>(offset);
805            // Zero out padding regions. There's no need to apply masks
806            // because the unmasked parts will be overwritten by fields.
807            // Write the fields.
808            self.0.encode(encoder, offset + 0, depth)?;
809            self.1.encode(encoder, offset + 4, depth)?;
810            self.2.encode(encoder, offset + 8, depth)?;
811            self.3.encode(encoder, offset + 12, depth)?;
812            self.4.encode(encoder, offset + 16, depth)?;
813            self.5.encode(encoder, offset + 20, depth)?;
814            self.6.encode(encoder, offset + 24, depth)?;
815            self.7.encode(encoder, offset + 28, depth)?;
816            Ok(())
817        }
818    }
819
820    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ImageInfo {
821        #[inline(always)]
822        fn new_empty() -> Self {
823            Self {
824                transform: fidl::new_empty!(Transform, D),
825                width: fidl::new_empty!(u32, D),
826                height: fidl::new_empty!(u32, D),
827                stride: fidl::new_empty!(u32, D),
828                pixel_format: fidl::new_empty!(PixelFormat, D),
829                color_space: fidl::new_empty!(ColorSpace, D),
830                tiling: fidl::new_empty!(Tiling, D),
831                alpha_format: fidl::new_empty!(AlphaFormat, D),
832            }
833        }
834
835        #[inline]
836        unsafe fn decode(
837            &mut self,
838            decoder: &mut fidl::encoding::Decoder<'_, D>,
839            offset: usize,
840            _depth: fidl::encoding::Depth,
841        ) -> fidl::Result<()> {
842            decoder.debug_check_bounds::<Self>(offset);
843            // Verify that padding bytes are zero.
844            fidl::decode!(Transform, D, &mut self.transform, decoder, offset + 0, _depth)?;
845            fidl::decode!(u32, D, &mut self.width, decoder, offset + 4, _depth)?;
846            fidl::decode!(u32, D, &mut self.height, decoder, offset + 8, _depth)?;
847            fidl::decode!(u32, D, &mut self.stride, decoder, offset + 12, _depth)?;
848            fidl::decode!(PixelFormat, D, &mut self.pixel_format, decoder, offset + 16, _depth)?;
849            fidl::decode!(ColorSpace, D, &mut self.color_space, decoder, offset + 20, _depth)?;
850            fidl::decode!(Tiling, D, &mut self.tiling, decoder, offset + 24, _depth)?;
851            fidl::decode!(AlphaFormat, D, &mut self.alpha_format, decoder, offset + 28, _depth)?;
852            Ok(())
853        }
854    }
855
856    impl fidl::encoding::ValueTypeMarker for ImagePipe2AddImageRequest {
857        type Borrowed<'a> = &'a Self;
858        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
859            value
860        }
861    }
862
863    unsafe impl fidl::encoding::TypeMarker for ImagePipe2AddImageRequest {
864        type Owned = Self;
865
866        #[inline(always)]
867        fn inline_align(_context: fidl::encoding::Context) -> usize {
868            8
869        }
870
871        #[inline(always)]
872        fn inline_size(_context: fidl::encoding::Context) -> usize {
873            72
874        }
875    }
876
877    unsafe impl<D: fidl::encoding::ResourceDialect>
878        fidl::encoding::Encode<ImagePipe2AddImageRequest, D> for &ImagePipe2AddImageRequest
879    {
880        #[inline]
881        unsafe fn encode(
882            self,
883            encoder: &mut fidl::encoding::Encoder<'_, D>,
884            offset: usize,
885            _depth: fidl::encoding::Depth,
886        ) -> fidl::Result<()> {
887            encoder.debug_check_bounds::<ImagePipe2AddImageRequest>(offset);
888            // Delegate to tuple encoding.
889            fidl::encoding::Encode::<ImagePipe2AddImageRequest, D>::encode(
890                (
891                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_id),
892                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_id),
893                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buffer_collection_index),
894                    <fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format),
895                ),
896                encoder, offset, _depth
897            )
898        }
899    }
900    unsafe impl<
901            D: fidl::encoding::ResourceDialect,
902            T0: fidl::encoding::Encode<u32, D>,
903            T1: fidl::encoding::Encode<u32, D>,
904            T2: fidl::encoding::Encode<u32, D>,
905            T3: fidl::encoding::Encode<fidl_fuchsia_sysmem__common::ImageFormat2, D>,
906        > fidl::encoding::Encode<ImagePipe2AddImageRequest, D> for (T0, T1, T2, T3)
907    {
908        #[inline]
909        unsafe fn encode(
910            self,
911            encoder: &mut fidl::encoding::Encoder<'_, D>,
912            offset: usize,
913            depth: fidl::encoding::Depth,
914        ) -> fidl::Result<()> {
915            encoder.debug_check_bounds::<ImagePipe2AddImageRequest>(offset);
916            // Zero out padding regions. There's no need to apply masks
917            // because the unmasked parts will be overwritten by fields.
918            unsafe {
919                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
920                (ptr as *mut u64).write_unaligned(0);
921            }
922            // Write the fields.
923            self.0.encode(encoder, offset + 0, depth)?;
924            self.1.encode(encoder, offset + 4, depth)?;
925            self.2.encode(encoder, offset + 8, depth)?;
926            self.3.encode(encoder, offset + 16, depth)?;
927            Ok(())
928        }
929    }
930
931    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
932        for ImagePipe2AddImageRequest
933    {
934        #[inline(always)]
935        fn new_empty() -> Self {
936            Self {
937                image_id: fidl::new_empty!(u32, D),
938                buffer_collection_id: fidl::new_empty!(u32, D),
939                buffer_collection_index: fidl::new_empty!(u32, D),
940                image_format: fidl::new_empty!(fidl_fuchsia_sysmem__common::ImageFormat2, D),
941            }
942        }
943
944        #[inline]
945        unsafe fn decode(
946            &mut self,
947            decoder: &mut fidl::encoding::Decoder<'_, D>,
948            offset: usize,
949            _depth: fidl::encoding::Depth,
950        ) -> fidl::Result<()> {
951            decoder.debug_check_bounds::<Self>(offset);
952            // Verify that padding bytes are zero.
953            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
954            let padval = unsafe { (ptr as *const u64).read_unaligned() };
955            let mask = 0xffffffff00000000u64;
956            let maskedval = padval & mask;
957            if maskedval != 0 {
958                return Err(fidl::Error::NonZeroPadding {
959                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
960                });
961            }
962            fidl::decode!(u32, D, &mut self.image_id, decoder, offset + 0, _depth)?;
963            fidl::decode!(u32, D, &mut self.buffer_collection_id, decoder, offset + 4, _depth)?;
964            fidl::decode!(u32, D, &mut self.buffer_collection_index, decoder, offset + 8, _depth)?;
965            fidl::decode!(
966                fidl_fuchsia_sysmem__common::ImageFormat2,
967                D,
968                &mut self.image_format,
969                decoder,
970                offset + 16,
971                _depth
972            )?;
973            Ok(())
974        }
975    }
976
977    impl fidl::encoding::ValueTypeMarker for ImagePipe2PresentImageResponse {
978        type Borrowed<'a> = &'a Self;
979        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
980            value
981        }
982    }
983
984    unsafe impl fidl::encoding::TypeMarker for ImagePipe2PresentImageResponse {
985        type Owned = Self;
986
987        #[inline(always)]
988        fn inline_align(_context: fidl::encoding::Context) -> usize {
989            8
990        }
991
992        #[inline(always)]
993        fn inline_size(_context: fidl::encoding::Context) -> usize {
994            16
995        }
996        #[inline(always)]
997        fn encode_is_copy() -> bool {
998            true
999        }
1000
1001        #[inline(always)]
1002        fn decode_is_copy() -> bool {
1003            true
1004        }
1005    }
1006
1007    unsafe impl<D: fidl::encoding::ResourceDialect>
1008        fidl::encoding::Encode<ImagePipe2PresentImageResponse, D>
1009        for &ImagePipe2PresentImageResponse
1010    {
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::<ImagePipe2PresentImageResponse>(offset);
1019            unsafe {
1020                // Copy the object into the buffer.
1021                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1022                (buf_ptr as *mut ImagePipe2PresentImageResponse)
1023                    .write_unaligned((self as *const ImagePipe2PresentImageResponse).read());
1024                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1025                // done second because the memcpy will write garbage to these bytes.
1026            }
1027            Ok(())
1028        }
1029    }
1030    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PresentationInfo, D>>
1031        fidl::encoding::Encode<ImagePipe2PresentImageResponse, D> for (T0,)
1032    {
1033        #[inline]
1034        unsafe fn encode(
1035            self,
1036            encoder: &mut fidl::encoding::Encoder<'_, D>,
1037            offset: usize,
1038            depth: fidl::encoding::Depth,
1039        ) -> fidl::Result<()> {
1040            encoder.debug_check_bounds::<ImagePipe2PresentImageResponse>(offset);
1041            // Zero out padding regions. There's no need to apply masks
1042            // because the unmasked parts will be overwritten by fields.
1043            // Write the fields.
1044            self.0.encode(encoder, offset + 0, depth)?;
1045            Ok(())
1046        }
1047    }
1048
1049    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1050        for ImagePipe2PresentImageResponse
1051    {
1052        #[inline(always)]
1053        fn new_empty() -> Self {
1054            Self { presentation_info: fidl::new_empty!(PresentationInfo, D) }
1055        }
1056
1057        #[inline]
1058        unsafe fn decode(
1059            &mut self,
1060            decoder: &mut fidl::encoding::Decoder<'_, D>,
1061            offset: usize,
1062            _depth: fidl::encoding::Depth,
1063        ) -> fidl::Result<()> {
1064            decoder.debug_check_bounds::<Self>(offset);
1065            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1066            // Verify that padding bytes are zero.
1067            // Copy from the buffer into the object.
1068            unsafe {
1069                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1070            }
1071            Ok(())
1072        }
1073    }
1074
1075    impl fidl::encoding::ValueTypeMarker for ImagePipe2RemoveBufferCollectionRequest {
1076        type Borrowed<'a> = &'a Self;
1077        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1078            value
1079        }
1080    }
1081
1082    unsafe impl fidl::encoding::TypeMarker for ImagePipe2RemoveBufferCollectionRequest {
1083        type Owned = Self;
1084
1085        #[inline(always)]
1086        fn inline_align(_context: fidl::encoding::Context) -> usize {
1087            4
1088        }
1089
1090        #[inline(always)]
1091        fn inline_size(_context: fidl::encoding::Context) -> usize {
1092            4
1093        }
1094        #[inline(always)]
1095        fn encode_is_copy() -> bool {
1096            true
1097        }
1098
1099        #[inline(always)]
1100        fn decode_is_copy() -> bool {
1101            true
1102        }
1103    }
1104
1105    unsafe impl<D: fidl::encoding::ResourceDialect>
1106        fidl::encoding::Encode<ImagePipe2RemoveBufferCollectionRequest, D>
1107        for &ImagePipe2RemoveBufferCollectionRequest
1108    {
1109        #[inline]
1110        unsafe fn encode(
1111            self,
1112            encoder: &mut fidl::encoding::Encoder<'_, D>,
1113            offset: usize,
1114            _depth: fidl::encoding::Depth,
1115        ) -> fidl::Result<()> {
1116            encoder.debug_check_bounds::<ImagePipe2RemoveBufferCollectionRequest>(offset);
1117            unsafe {
1118                // Copy the object into the buffer.
1119                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1120                (buf_ptr as *mut ImagePipe2RemoveBufferCollectionRequest).write_unaligned(
1121                    (self as *const ImagePipe2RemoveBufferCollectionRequest).read(),
1122                );
1123                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1124                // done second because the memcpy will write garbage to these bytes.
1125            }
1126            Ok(())
1127        }
1128    }
1129    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1130        fidl::encoding::Encode<ImagePipe2RemoveBufferCollectionRequest, D> for (T0,)
1131    {
1132        #[inline]
1133        unsafe fn encode(
1134            self,
1135            encoder: &mut fidl::encoding::Encoder<'_, D>,
1136            offset: usize,
1137            depth: fidl::encoding::Depth,
1138        ) -> fidl::Result<()> {
1139            encoder.debug_check_bounds::<ImagePipe2RemoveBufferCollectionRequest>(offset);
1140            // Zero out padding regions. There's no need to apply masks
1141            // because the unmasked parts will be overwritten by fields.
1142            // Write the fields.
1143            self.0.encode(encoder, offset + 0, depth)?;
1144            Ok(())
1145        }
1146    }
1147
1148    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1149        for ImagePipe2RemoveBufferCollectionRequest
1150    {
1151        #[inline(always)]
1152        fn new_empty() -> Self {
1153            Self { buffer_collection_id: fidl::new_empty!(u32, D) }
1154        }
1155
1156        #[inline]
1157        unsafe fn decode(
1158            &mut self,
1159            decoder: &mut fidl::encoding::Decoder<'_, D>,
1160            offset: usize,
1161            _depth: fidl::encoding::Depth,
1162        ) -> fidl::Result<()> {
1163            decoder.debug_check_bounds::<Self>(offset);
1164            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1165            // Verify that padding bytes are zero.
1166            // Copy from the buffer into the object.
1167            unsafe {
1168                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1169            }
1170            Ok(())
1171        }
1172    }
1173
1174    impl fidl::encoding::ValueTypeMarker for ImagePipe2RemoveImageRequest {
1175        type Borrowed<'a> = &'a Self;
1176        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1177            value
1178        }
1179    }
1180
1181    unsafe impl fidl::encoding::TypeMarker for ImagePipe2RemoveImageRequest {
1182        type Owned = Self;
1183
1184        #[inline(always)]
1185        fn inline_align(_context: fidl::encoding::Context) -> usize {
1186            4
1187        }
1188
1189        #[inline(always)]
1190        fn inline_size(_context: fidl::encoding::Context) -> usize {
1191            4
1192        }
1193        #[inline(always)]
1194        fn encode_is_copy() -> bool {
1195            true
1196        }
1197
1198        #[inline(always)]
1199        fn decode_is_copy() -> bool {
1200            true
1201        }
1202    }
1203
1204    unsafe impl<D: fidl::encoding::ResourceDialect>
1205        fidl::encoding::Encode<ImagePipe2RemoveImageRequest, D> for &ImagePipe2RemoveImageRequest
1206    {
1207        #[inline]
1208        unsafe fn encode(
1209            self,
1210            encoder: &mut fidl::encoding::Encoder<'_, D>,
1211            offset: usize,
1212            _depth: fidl::encoding::Depth,
1213        ) -> fidl::Result<()> {
1214            encoder.debug_check_bounds::<ImagePipe2RemoveImageRequest>(offset);
1215            unsafe {
1216                // Copy the object into the buffer.
1217                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1218                (buf_ptr as *mut ImagePipe2RemoveImageRequest)
1219                    .write_unaligned((self as *const ImagePipe2RemoveImageRequest).read());
1220                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1221                // done second because the memcpy will write garbage to these bytes.
1222            }
1223            Ok(())
1224        }
1225    }
1226    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1227        fidl::encoding::Encode<ImagePipe2RemoveImageRequest, D> for (T0,)
1228    {
1229        #[inline]
1230        unsafe fn encode(
1231            self,
1232            encoder: &mut fidl::encoding::Encoder<'_, D>,
1233            offset: usize,
1234            depth: fidl::encoding::Depth,
1235        ) -> fidl::Result<()> {
1236            encoder.debug_check_bounds::<ImagePipe2RemoveImageRequest>(offset);
1237            // Zero out padding regions. There's no need to apply masks
1238            // because the unmasked parts will be overwritten by fields.
1239            // Write the fields.
1240            self.0.encode(encoder, offset + 0, depth)?;
1241            Ok(())
1242        }
1243    }
1244
1245    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1246        for ImagePipe2RemoveImageRequest
1247    {
1248        #[inline(always)]
1249        fn new_empty() -> Self {
1250            Self { image_id: fidl::new_empty!(u32, D) }
1251        }
1252
1253        #[inline]
1254        unsafe fn decode(
1255            &mut self,
1256            decoder: &mut fidl::encoding::Decoder<'_, D>,
1257            offset: usize,
1258            _depth: fidl::encoding::Depth,
1259        ) -> fidl::Result<()> {
1260            decoder.debug_check_bounds::<Self>(offset);
1261            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1262            // Verify that padding bytes are zero.
1263            // Copy from the buffer into the object.
1264            unsafe {
1265                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1266            }
1267            Ok(())
1268        }
1269    }
1270
1271    impl fidl::encoding::ValueTypeMarker for PresentationInfo {
1272        type Borrowed<'a> = &'a Self;
1273        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1274            value
1275        }
1276    }
1277
1278    unsafe impl fidl::encoding::TypeMarker for PresentationInfo {
1279        type Owned = Self;
1280
1281        #[inline(always)]
1282        fn inline_align(_context: fidl::encoding::Context) -> usize {
1283            8
1284        }
1285
1286        #[inline(always)]
1287        fn inline_size(_context: fidl::encoding::Context) -> usize {
1288            16
1289        }
1290        #[inline(always)]
1291        fn encode_is_copy() -> bool {
1292            true
1293        }
1294
1295        #[inline(always)]
1296        fn decode_is_copy() -> bool {
1297            true
1298        }
1299    }
1300
1301    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PresentationInfo, D>
1302        for &PresentationInfo
1303    {
1304        #[inline]
1305        unsafe fn encode(
1306            self,
1307            encoder: &mut fidl::encoding::Encoder<'_, D>,
1308            offset: usize,
1309            _depth: fidl::encoding::Depth,
1310        ) -> fidl::Result<()> {
1311            encoder.debug_check_bounds::<PresentationInfo>(offset);
1312            unsafe {
1313                // Copy the object into the buffer.
1314                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1315                (buf_ptr as *mut PresentationInfo)
1316                    .write_unaligned((self as *const PresentationInfo).read());
1317                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1318                // done second because the memcpy will write garbage to these bytes.
1319            }
1320            Ok(())
1321        }
1322    }
1323    unsafe impl<
1324            D: fidl::encoding::ResourceDialect,
1325            T0: fidl::encoding::Encode<u64, D>,
1326            T1: fidl::encoding::Encode<u64, D>,
1327        > fidl::encoding::Encode<PresentationInfo, D> for (T0, T1)
1328    {
1329        #[inline]
1330        unsafe fn encode(
1331            self,
1332            encoder: &mut fidl::encoding::Encoder<'_, D>,
1333            offset: usize,
1334            depth: fidl::encoding::Depth,
1335        ) -> fidl::Result<()> {
1336            encoder.debug_check_bounds::<PresentationInfo>(offset);
1337            // Zero out padding regions. There's no need to apply masks
1338            // because the unmasked parts will be overwritten by fields.
1339            // Write the fields.
1340            self.0.encode(encoder, offset + 0, depth)?;
1341            self.1.encode(encoder, offset + 8, depth)?;
1342            Ok(())
1343        }
1344    }
1345
1346    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PresentationInfo {
1347        #[inline(always)]
1348        fn new_empty() -> Self {
1349            Self {
1350                presentation_time: fidl::new_empty!(u64, D),
1351                presentation_interval: fidl::new_empty!(u64, D),
1352            }
1353        }
1354
1355        #[inline]
1356        unsafe fn decode(
1357            &mut self,
1358            decoder: &mut fidl::encoding::Decoder<'_, D>,
1359            offset: usize,
1360            _depth: fidl::encoding::Depth,
1361        ) -> fidl::Result<()> {
1362            decoder.debug_check_bounds::<Self>(offset);
1363            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1364            // Verify that padding bytes are zero.
1365            // Copy from the buffer into the object.
1366            unsafe {
1367                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1368            }
1369            Ok(())
1370        }
1371    }
1372}