fidl_fuchsia_camera3__common/
fidl_fuchsia_camera3__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 type DeviceId = u64;
12
13pub const MAX_CONFIGURATIONS_PER_CAMERA: u32 = 256;
14
15pub const MAX_IDENTIFIER_LENGTH: u32 = 256;
16
17pub const MAX_RESOLUTIONS_PER_STREAM: u32 = 256;
18
19pub const MAX_STREAMS_PER_CONFIGURATION: u32 = 256;
20
21pub const MAX_WATCH_DEVICES_EVENTS: u32 = 256;
22
23/// Describes the intended orientation of a given stream relative to its encoded data. For clarity,
24/// the documentation for each enum value is accompanied by an orientation of the chiral '⮬' symbol
25/// illustrating the orientation of the stream's encoded data.
26#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
27#[repr(u32)]
28pub enum Orientation {
29    /// ⮬: The content is already in the correct orientation.
30    Up = 1,
31    /// ⮯: The content must be rotated 180 degrees to appear correct.
32    Down = 2,
33    /// ⮫: The content must be rotated 90 degrees left (counter-clockwise) to appear correct.
34    Left = 3,
35    /// ⮨: The content must be rotated 90 degrees right (clockwise) to appear correct.
36    Right = 4,
37    /// ⮭: The content must be flipped horizontally to appear correct.
38    UpFlipped = 5,
39    /// ⮮: The content must be flipped horizontally then rotated 180 degrees to appear correct.
40    DownFlipped = 6,
41    /// ⮪: The content must be flipped horizontally then rotated 90 degrees left (counter-clockwise) to appear correct.
42    LeftFlipped = 7,
43    /// ⮩: The content must be flipped horizontally then rotated 90 degrees right (clockwise) to appear correct.
44    RightFlipped = 8,
45}
46
47impl Orientation {
48    #[inline]
49    pub fn from_primitive(prim: u32) -> Option<Self> {
50        match prim {
51            1 => Some(Self::Up),
52            2 => Some(Self::Down),
53            3 => Some(Self::Left),
54            4 => Some(Self::Right),
55            5 => Some(Self::UpFlipped),
56            6 => Some(Self::DownFlipped),
57            7 => Some(Self::LeftFlipped),
58            8 => Some(Self::RightFlipped),
59            _ => None,
60        }
61    }
62
63    #[inline]
64    pub const fn into_primitive(self) -> u32 {
65        self as u32
66    }
67}
68
69/// Describes a distinct configuration for the camera.
70#[derive(Clone, Debug, PartialEq)]
71pub struct Configuration {
72    /// Descriptions of streams that are concurrently available in the configuration.
73    pub streams: Vec<StreamProperties>,
74}
75
76impl fidl::Persistable for Configuration {}
77
78#[derive(Clone, Debug, PartialEq)]
79pub struct DeviceGetConfigurations2Response {
80    pub configurations: Vec<Configuration2>,
81}
82
83impl fidl::Persistable for DeviceGetConfigurations2Response {}
84
85#[derive(Clone, Debug, PartialEq)]
86pub struct DeviceGetConfigurationsResponse {
87    pub configurations: Vec<Configuration>,
88}
89
90impl fidl::Persistable for DeviceGetConfigurationsResponse {}
91
92#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
93pub struct DeviceGetIdentifierResponse {
94    pub identifier: Option<String>,
95}
96
97impl fidl::Persistable for DeviceGetIdentifierResponse {}
98
99#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
100#[repr(C)]
101pub struct DeviceSetCurrentConfigurationRequest {
102    pub index: u32,
103}
104
105impl fidl::Persistable for DeviceSetCurrentConfigurationRequest {}
106
107#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
108pub struct DeviceSetSoftwareMuteStateRequest {
109    pub muted: bool,
110}
111
112impl fidl::Persistable for DeviceSetSoftwareMuteStateRequest {}
113
114#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
115#[repr(C)]
116pub struct DeviceWatchCurrentConfigurationResponse {
117    pub index: u32,
118}
119
120impl fidl::Persistable for DeviceWatchCurrentConfigurationResponse {}
121
122#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct DeviceWatchMuteStateResponse {
124    pub software_muted: bool,
125    pub hardware_muted: bool,
126}
127
128impl fidl::Persistable for DeviceWatchMuteStateResponse {}
129
130#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
131pub struct DeviceWatcherWatchDevicesResponse {
132    pub events: Vec<WatchDevicesEvent>,
133}
134
135impl fidl::Persistable for DeviceWatcherWatchDevicesResponse {}
136
137/// The frequency at which a Stream produces frames. The value is `numerator` / `denominator`, with
138/// units of frames-per-second (Hz). The representation is not necessarily an irreducible fraction.
139#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
140#[repr(C)]
141pub struct FrameRate {
142    /// Fraction numerator.
143    pub numerator: u32,
144    /// Fraction denominator. This value will not be zero.
145    pub denominator: u32,
146}
147
148impl fidl::Persistable for FrameRate {}
149
150#[derive(Clone, Debug, PartialEq)]
151pub struct StreamGetProperties2Response {
152    pub properties: StreamProperties2,
153}
154
155impl fidl::Persistable for StreamGetProperties2Response {}
156
157#[derive(Clone, Debug, PartialEq)]
158pub struct StreamGetPropertiesResponse {
159    pub properties: StreamProperties,
160}
161
162impl fidl::Persistable for StreamGetPropertiesResponse {}
163
164/// Describes the properties of a given stream.
165#[derive(Clone, Debug, PartialEq)]
166pub struct StreamProperties {
167    /// Describes the native image format used by a stream.
168    pub image_format: fidl_fuchsia_sysmem__common::ImageFormat2,
169    /// Describes the framerate used by a stream.
170    pub frame_rate: FrameRate,
171    /// Indicates whether a stream supports the SetCropRegion method.
172    pub supports_crop_region: bool,
173}
174
175impl fidl::Persistable for StreamProperties {}
176
177#[derive(Clone, Debug, PartialEq)]
178pub struct StreamSetCropRegionRequest {
179    pub region: Option<Box<fidl_fuchsia_math__common::RectF>>,
180}
181
182impl fidl::Persistable for StreamSetCropRegionRequest {}
183
184#[derive(Clone, Debug, PartialEq)]
185pub struct StreamSetResolutionRequest {
186    pub coded_size: fidl_fuchsia_math__common::Size,
187}
188
189impl fidl::Persistable for StreamSetResolutionRequest {}
190
191#[derive(Clone, Debug, PartialEq)]
192pub struct StreamWatchCropRegionResponse {
193    pub region: Option<Box<fidl_fuchsia_math__common::RectF>>,
194}
195
196impl fidl::Persistable for StreamWatchCropRegionResponse {}
197
198#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199pub struct StreamWatchOrientationResponse {
200    pub orientation: Orientation,
201}
202
203impl fidl::Persistable for StreamWatchOrientationResponse {}
204
205#[derive(Clone, Debug, PartialEq)]
206pub struct StreamWatchResolutionResponse {
207    pub coded_size: fidl_fuchsia_math__common::Size,
208}
209
210impl fidl::Persistable for StreamWatchResolutionResponse {}
211
212/// Describes a distinct configuration for the camera.
213#[derive(Clone, Debug, Default, PartialEq)]
214pub struct Configuration2 {
215    /// Descriptions of streams that are concurrently available in the configuration.
216    pub streams: Option<Vec<StreamProperties2>>,
217    #[doc(hidden)]
218    pub __source_breaking: fidl::marker::SourceBreaking,
219}
220
221impl fidl::Persistable for Configuration2 {}
222
223/// Describes the properties of a given stream.
224#[derive(Clone, Debug, Default, PartialEq)]
225pub struct StreamProperties2 {
226    /// Describes the native image format used by a stream.
227    pub image_format: Option<fidl_fuchsia_sysmem__common::ImageFormat2>,
228    /// Describes the framerate used by a stream.
229    pub frame_rate: Option<FrameRate>,
230    /// Indicates whether a stream supports the SetCropRegion method.
231    pub supports_crop_region: Option<bool>,
232    /// Describes the precise resolutions supported by a stream, i.e. those for which SetResolution
233    /// results in a WatchResolution callback of the same value. If empty, it indicates that the
234    /// stream supports arbitrary resolutions. If non-empty, the list contains at least one element
235    /// reflecting the native resolution specified by |image_format|.
236    pub supported_resolutions: Option<Vec<fidl_fuchsia_math__common::Size>>,
237    #[doc(hidden)]
238    pub __source_breaking: fidl::marker::SourceBreaking,
239}
240
241impl fidl::Persistable for StreamProperties2 {}
242
243#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
244pub enum WatchDevicesEvent {
245    /// Indicates an existing camera with the provided ID is still available.
246    Existing(u64),
247    /// Indicates a new camera with the provided ID is now available.
248    Added(u64),
249    /// Indicates an existing camera with the provided ID is no longer available.
250    Removed(u64),
251}
252
253impl WatchDevicesEvent {
254    #[inline]
255    pub fn ordinal(&self) -> u64 {
256        match *self {
257            Self::Existing(_) => 1,
258            Self::Added(_) => 2,
259            Self::Removed(_) => 3,
260        }
261    }
262}
263
264impl fidl::Persistable for WatchDevicesEvent {}
265
266pub mod device_ordinals {
267    pub const GET_IDENTIFIER: u64 = 0x1417d1af92667e47;
268    pub const GET_CONFIGURATIONS: u64 = 0x26c7a180d8eef786;
269    pub const GET_CONFIGURATIONS2: u64 = 0x2667155e740fb9ff;
270    pub const WATCH_CURRENT_CONFIGURATION: u64 = 0x7a82832a127834b7;
271    pub const SET_CURRENT_CONFIGURATION: u64 = 0x11d65c8f92593b87;
272    pub const WATCH_MUTE_STATE: u64 = 0x2bafd68e6e7ef2fb;
273    pub const SET_SOFTWARE_MUTE_STATE: u64 = 0x6bb19cb687f560a5;
274    pub const CONNECT_TO_STREAM: u64 = 0x290a86763174c4c3;
275    pub const REBIND: u64 = 0x24811b7cee5c51c3;
276}
277
278pub mod device_watcher_ordinals {
279    pub const WATCH_DEVICES: u64 = 0x5f38542e295e8575;
280    pub const CONNECT_TO_DEVICE: u64 = 0x5f175a8283b26b2d;
281}
282
283pub mod stream__ordinals {
284    pub const GET_PROPERTIES: u64 = 0x13662921504b55f7;
285    pub const GET_PROPERTIES2: u64 = 0x70346d69a8cbc391;
286    pub const SET_CROP_REGION: u64 = 0x72dde73bf7a94302;
287    pub const WATCH_CROP_REGION: u64 = 0x4c28250035dbbb90;
288    pub const SET_RESOLUTION: u64 = 0x6ef2c207ff2b74e3;
289    pub const WATCH_RESOLUTION: u64 = 0x6c7b28be2b72ea7f;
290    pub const SET_BUFFER_COLLECTION2: u64 = 0x6691d2eed219c8e6;
291    pub const SET_BUFFER_COLLECTION: u64 = 0x730ab5c4ee023c6d;
292    pub const WATCH_BUFFER_COLLECTION2: u64 = 0x60c9daa36b3d2cf1;
293    pub const WATCH_BUFFER_COLLECTION: u64 = 0x35d855a45e19e5d6;
294    pub const WATCH_ORIENTATION: u64 = 0x1f0d1cd93daa1dd4;
295    pub const GET_NEXT_FRAME: u64 = 0x4b06b8dfbcbdc658;
296    pub const GET_NEXT_FRAME2: u64 = 0x7142a7a6aa6a6f10;
297    pub const REBIND: u64 = 0x75b84fa09b68dbef;
298}
299
300mod internal {
301    use super::*;
302    unsafe impl fidl::encoding::TypeMarker for Orientation {
303        type Owned = Self;
304
305        #[inline(always)]
306        fn inline_align(_context: fidl::encoding::Context) -> usize {
307            std::mem::align_of::<u32>()
308        }
309
310        #[inline(always)]
311        fn inline_size(_context: fidl::encoding::Context) -> usize {
312            std::mem::size_of::<u32>()
313        }
314
315        #[inline(always)]
316        fn encode_is_copy() -> bool {
317            true
318        }
319
320        #[inline(always)]
321        fn decode_is_copy() -> bool {
322            false
323        }
324    }
325
326    impl fidl::encoding::ValueTypeMarker for Orientation {
327        type Borrowed<'a> = Self;
328        #[inline(always)]
329        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
330            *value
331        }
332    }
333
334    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Orientation {
335        #[inline]
336        unsafe fn encode(
337            self,
338            encoder: &mut fidl::encoding::Encoder<'_, D>,
339            offset: usize,
340            _depth: fidl::encoding::Depth,
341        ) -> fidl::Result<()> {
342            encoder.debug_check_bounds::<Self>(offset);
343            encoder.write_num(self.into_primitive(), offset);
344            Ok(())
345        }
346    }
347
348    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Orientation {
349        #[inline(always)]
350        fn new_empty() -> Self {
351            Self::Up
352        }
353
354        #[inline]
355        unsafe fn decode(
356            &mut self,
357            decoder: &mut fidl::encoding::Decoder<'_, D>,
358            offset: usize,
359            _depth: fidl::encoding::Depth,
360        ) -> fidl::Result<()> {
361            decoder.debug_check_bounds::<Self>(offset);
362            let prim = decoder.read_num::<u32>(offset);
363
364            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
365            Ok(())
366        }
367    }
368
369    impl fidl::encoding::ValueTypeMarker for Configuration {
370        type Borrowed<'a> = &'a Self;
371        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
372            value
373        }
374    }
375
376    unsafe impl fidl::encoding::TypeMarker for Configuration {
377        type Owned = Self;
378
379        #[inline(always)]
380        fn inline_align(_context: fidl::encoding::Context) -> usize {
381            8
382        }
383
384        #[inline(always)]
385        fn inline_size(_context: fidl::encoding::Context) -> usize {
386            16
387        }
388    }
389
390    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Configuration, D>
391        for &Configuration
392    {
393        #[inline]
394        unsafe fn encode(
395            self,
396            encoder: &mut fidl::encoding::Encoder<'_, D>,
397            offset: usize,
398            _depth: fidl::encoding::Depth,
399        ) -> fidl::Result<()> {
400            encoder.debug_check_bounds::<Configuration>(offset);
401            // Delegate to tuple encoding.
402            fidl::encoding::Encode::<Configuration, D>::encode(
403                (
404                    <fidl::encoding::Vector<StreamProperties, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.streams),
405                ),
406                encoder, offset, _depth
407            )
408        }
409    }
410    unsafe impl<
411            D: fidl::encoding::ResourceDialect,
412            T0: fidl::encoding::Encode<fidl::encoding::Vector<StreamProperties, 256>, D>,
413        > fidl::encoding::Encode<Configuration, D> for (T0,)
414    {
415        #[inline]
416        unsafe fn encode(
417            self,
418            encoder: &mut fidl::encoding::Encoder<'_, D>,
419            offset: usize,
420            depth: fidl::encoding::Depth,
421        ) -> fidl::Result<()> {
422            encoder.debug_check_bounds::<Configuration>(offset);
423            // Zero out padding regions. There's no need to apply masks
424            // because the unmasked parts will be overwritten by fields.
425            // Write the fields.
426            self.0.encode(encoder, offset + 0, depth)?;
427            Ok(())
428        }
429    }
430
431    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration {
432        #[inline(always)]
433        fn new_empty() -> Self {
434            Self { streams: fidl::new_empty!(fidl::encoding::Vector<StreamProperties, 256>, D) }
435        }
436
437        #[inline]
438        unsafe fn decode(
439            &mut self,
440            decoder: &mut fidl::encoding::Decoder<'_, D>,
441            offset: usize,
442            _depth: fidl::encoding::Depth,
443        ) -> fidl::Result<()> {
444            decoder.debug_check_bounds::<Self>(offset);
445            // Verify that padding bytes are zero.
446            fidl::decode!(fidl::encoding::Vector<StreamProperties, 256>, D, &mut self.streams, decoder, offset + 0, _depth)?;
447            Ok(())
448        }
449    }
450
451    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurations2Response {
452        type Borrowed<'a> = &'a Self;
453        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
454            value
455        }
456    }
457
458    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurations2Response {
459        type Owned = Self;
460
461        #[inline(always)]
462        fn inline_align(_context: fidl::encoding::Context) -> usize {
463            8
464        }
465
466        #[inline(always)]
467        fn inline_size(_context: fidl::encoding::Context) -> usize {
468            16
469        }
470    }
471
472    unsafe impl<D: fidl::encoding::ResourceDialect>
473        fidl::encoding::Encode<DeviceGetConfigurations2Response, D>
474        for &DeviceGetConfigurations2Response
475    {
476        #[inline]
477        unsafe fn encode(
478            self,
479            encoder: &mut fidl::encoding::Encoder<'_, D>,
480            offset: usize,
481            _depth: fidl::encoding::Depth,
482        ) -> fidl::Result<()> {
483            encoder.debug_check_bounds::<DeviceGetConfigurations2Response>(offset);
484            // Delegate to tuple encoding.
485            fidl::encoding::Encode::<DeviceGetConfigurations2Response, D>::encode(
486                (
487                    <fidl::encoding::Vector<Configuration2, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.configurations),
488                ),
489                encoder, offset, _depth
490            )
491        }
492    }
493    unsafe impl<
494            D: fidl::encoding::ResourceDialect,
495            T0: fidl::encoding::Encode<fidl::encoding::Vector<Configuration2, 256>, D>,
496        > fidl::encoding::Encode<DeviceGetConfigurations2Response, D> for (T0,)
497    {
498        #[inline]
499        unsafe fn encode(
500            self,
501            encoder: &mut fidl::encoding::Encoder<'_, D>,
502            offset: usize,
503            depth: fidl::encoding::Depth,
504        ) -> fidl::Result<()> {
505            encoder.debug_check_bounds::<DeviceGetConfigurations2Response>(offset);
506            // Zero out padding regions. There's no need to apply masks
507            // because the unmasked parts will be overwritten by fields.
508            // Write the fields.
509            self.0.encode(encoder, offset + 0, depth)?;
510            Ok(())
511        }
512    }
513
514    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
515        for DeviceGetConfigurations2Response
516    {
517        #[inline(always)]
518        fn new_empty() -> Self {
519            Self {
520                configurations: fidl::new_empty!(fidl::encoding::Vector<Configuration2, 256>, D),
521            }
522        }
523
524        #[inline]
525        unsafe fn decode(
526            &mut self,
527            decoder: &mut fidl::encoding::Decoder<'_, D>,
528            offset: usize,
529            _depth: fidl::encoding::Depth,
530        ) -> fidl::Result<()> {
531            decoder.debug_check_bounds::<Self>(offset);
532            // Verify that padding bytes are zero.
533            fidl::decode!(fidl::encoding::Vector<Configuration2, 256>, D, &mut self.configurations, decoder, offset + 0, _depth)?;
534            Ok(())
535        }
536    }
537
538    impl fidl::encoding::ValueTypeMarker for DeviceGetConfigurationsResponse {
539        type Borrowed<'a> = &'a Self;
540        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
541            value
542        }
543    }
544
545    unsafe impl fidl::encoding::TypeMarker for DeviceGetConfigurationsResponse {
546        type Owned = Self;
547
548        #[inline(always)]
549        fn inline_align(_context: fidl::encoding::Context) -> usize {
550            8
551        }
552
553        #[inline(always)]
554        fn inline_size(_context: fidl::encoding::Context) -> usize {
555            16
556        }
557    }
558
559    unsafe impl<D: fidl::encoding::ResourceDialect>
560        fidl::encoding::Encode<DeviceGetConfigurationsResponse, D>
561        for &DeviceGetConfigurationsResponse
562    {
563        #[inline]
564        unsafe fn encode(
565            self,
566            encoder: &mut fidl::encoding::Encoder<'_, D>,
567            offset: usize,
568            _depth: fidl::encoding::Depth,
569        ) -> fidl::Result<()> {
570            encoder.debug_check_bounds::<DeviceGetConfigurationsResponse>(offset);
571            // Delegate to tuple encoding.
572            fidl::encoding::Encode::<DeviceGetConfigurationsResponse, D>::encode(
573                (
574                    <fidl::encoding::Vector<Configuration, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.configurations),
575                ),
576                encoder, offset, _depth
577            )
578        }
579    }
580    unsafe impl<
581            D: fidl::encoding::ResourceDialect,
582            T0: fidl::encoding::Encode<fidl::encoding::Vector<Configuration, 256>, D>,
583        > fidl::encoding::Encode<DeviceGetConfigurationsResponse, D> for (T0,)
584    {
585        #[inline]
586        unsafe fn encode(
587            self,
588            encoder: &mut fidl::encoding::Encoder<'_, D>,
589            offset: usize,
590            depth: fidl::encoding::Depth,
591        ) -> fidl::Result<()> {
592            encoder.debug_check_bounds::<DeviceGetConfigurationsResponse>(offset);
593            // Zero out padding regions. There's no need to apply masks
594            // because the unmasked parts will be overwritten by fields.
595            // Write the fields.
596            self.0.encode(encoder, offset + 0, depth)?;
597            Ok(())
598        }
599    }
600
601    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
602        for DeviceGetConfigurationsResponse
603    {
604        #[inline(always)]
605        fn new_empty() -> Self {
606            Self { configurations: fidl::new_empty!(fidl::encoding::Vector<Configuration, 256>, D) }
607        }
608
609        #[inline]
610        unsafe fn decode(
611            &mut self,
612            decoder: &mut fidl::encoding::Decoder<'_, D>,
613            offset: usize,
614            _depth: fidl::encoding::Depth,
615        ) -> fidl::Result<()> {
616            decoder.debug_check_bounds::<Self>(offset);
617            // Verify that padding bytes are zero.
618            fidl::decode!(fidl::encoding::Vector<Configuration, 256>, D, &mut self.configurations, decoder, offset + 0, _depth)?;
619            Ok(())
620        }
621    }
622
623    impl fidl::encoding::ValueTypeMarker for DeviceGetIdentifierResponse {
624        type Borrowed<'a> = &'a Self;
625        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
626            value
627        }
628    }
629
630    unsafe impl fidl::encoding::TypeMarker for DeviceGetIdentifierResponse {
631        type Owned = Self;
632
633        #[inline(always)]
634        fn inline_align(_context: fidl::encoding::Context) -> usize {
635            8
636        }
637
638        #[inline(always)]
639        fn inline_size(_context: fidl::encoding::Context) -> usize {
640            16
641        }
642    }
643
644    unsafe impl<D: fidl::encoding::ResourceDialect>
645        fidl::encoding::Encode<DeviceGetIdentifierResponse, D> for &DeviceGetIdentifierResponse
646    {
647        #[inline]
648        unsafe fn encode(
649            self,
650            encoder: &mut fidl::encoding::Encoder<'_, D>,
651            offset: usize,
652            _depth: fidl::encoding::Depth,
653        ) -> fidl::Result<()> {
654            encoder.debug_check_bounds::<DeviceGetIdentifierResponse>(offset);
655            // Delegate to tuple encoding.
656            fidl::encoding::Encode::<DeviceGetIdentifierResponse, D>::encode(
657                (
658                    <fidl::encoding::Optional<fidl::encoding::BoundedString<256>> as fidl::encoding::ValueTypeMarker>::borrow(&self.identifier),
659                ),
660                encoder, offset, _depth
661            )
662        }
663    }
664    unsafe impl<
665            D: fidl::encoding::ResourceDialect,
666            T0: fidl::encoding::Encode<fidl::encoding::Optional<fidl::encoding::BoundedString<256>>, D>,
667        > fidl::encoding::Encode<DeviceGetIdentifierResponse, D> for (T0,)
668    {
669        #[inline]
670        unsafe fn encode(
671            self,
672            encoder: &mut fidl::encoding::Encoder<'_, D>,
673            offset: usize,
674            depth: fidl::encoding::Depth,
675        ) -> fidl::Result<()> {
676            encoder.debug_check_bounds::<DeviceGetIdentifierResponse>(offset);
677            // Zero out padding regions. There's no need to apply masks
678            // because the unmasked parts will be overwritten by fields.
679            // Write the fields.
680            self.0.encode(encoder, offset + 0, depth)?;
681            Ok(())
682        }
683    }
684
685    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
686        for DeviceGetIdentifierResponse
687    {
688        #[inline(always)]
689        fn new_empty() -> Self {
690            Self {
691                identifier: fidl::new_empty!(
692                    fidl::encoding::Optional<fidl::encoding::BoundedString<256>>,
693                    D
694                ),
695            }
696        }
697
698        #[inline]
699        unsafe fn decode(
700            &mut self,
701            decoder: &mut fidl::encoding::Decoder<'_, D>,
702            offset: usize,
703            _depth: fidl::encoding::Depth,
704        ) -> fidl::Result<()> {
705            decoder.debug_check_bounds::<Self>(offset);
706            // Verify that padding bytes are zero.
707            fidl::decode!(
708                fidl::encoding::Optional<fidl::encoding::BoundedString<256>>,
709                D,
710                &mut self.identifier,
711                decoder,
712                offset + 0,
713                _depth
714            )?;
715            Ok(())
716        }
717    }
718
719    impl fidl::encoding::ValueTypeMarker for DeviceSetCurrentConfigurationRequest {
720        type Borrowed<'a> = &'a Self;
721        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
722            value
723        }
724    }
725
726    unsafe impl fidl::encoding::TypeMarker for DeviceSetCurrentConfigurationRequest {
727        type Owned = Self;
728
729        #[inline(always)]
730        fn inline_align(_context: fidl::encoding::Context) -> usize {
731            4
732        }
733
734        #[inline(always)]
735        fn inline_size(_context: fidl::encoding::Context) -> usize {
736            4
737        }
738        #[inline(always)]
739        fn encode_is_copy() -> bool {
740            true
741        }
742
743        #[inline(always)]
744        fn decode_is_copy() -> bool {
745            true
746        }
747    }
748
749    unsafe impl<D: fidl::encoding::ResourceDialect>
750        fidl::encoding::Encode<DeviceSetCurrentConfigurationRequest, D>
751        for &DeviceSetCurrentConfigurationRequest
752    {
753        #[inline]
754        unsafe fn encode(
755            self,
756            encoder: &mut fidl::encoding::Encoder<'_, D>,
757            offset: usize,
758            _depth: fidl::encoding::Depth,
759        ) -> fidl::Result<()> {
760            encoder.debug_check_bounds::<DeviceSetCurrentConfigurationRequest>(offset);
761            unsafe {
762                // Copy the object into the buffer.
763                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
764                (buf_ptr as *mut DeviceSetCurrentConfigurationRequest)
765                    .write_unaligned((self as *const DeviceSetCurrentConfigurationRequest).read());
766                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
767                // done second because the memcpy will write garbage to these bytes.
768            }
769            Ok(())
770        }
771    }
772    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
773        fidl::encoding::Encode<DeviceSetCurrentConfigurationRequest, D> for (T0,)
774    {
775        #[inline]
776        unsafe fn encode(
777            self,
778            encoder: &mut fidl::encoding::Encoder<'_, D>,
779            offset: usize,
780            depth: fidl::encoding::Depth,
781        ) -> fidl::Result<()> {
782            encoder.debug_check_bounds::<DeviceSetCurrentConfigurationRequest>(offset);
783            // Zero out padding regions. There's no need to apply masks
784            // because the unmasked parts will be overwritten by fields.
785            // Write the fields.
786            self.0.encode(encoder, offset + 0, depth)?;
787            Ok(())
788        }
789    }
790
791    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
792        for DeviceSetCurrentConfigurationRequest
793    {
794        #[inline(always)]
795        fn new_empty() -> Self {
796            Self { index: fidl::new_empty!(u32, D) }
797        }
798
799        #[inline]
800        unsafe fn decode(
801            &mut self,
802            decoder: &mut fidl::encoding::Decoder<'_, D>,
803            offset: usize,
804            _depth: fidl::encoding::Depth,
805        ) -> fidl::Result<()> {
806            decoder.debug_check_bounds::<Self>(offset);
807            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
808            // Verify that padding bytes are zero.
809            // Copy from the buffer into the object.
810            unsafe {
811                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
812            }
813            Ok(())
814        }
815    }
816
817    impl fidl::encoding::ValueTypeMarker for DeviceSetSoftwareMuteStateRequest {
818        type Borrowed<'a> = &'a Self;
819        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
820            value
821        }
822    }
823
824    unsafe impl fidl::encoding::TypeMarker for DeviceSetSoftwareMuteStateRequest {
825        type Owned = Self;
826
827        #[inline(always)]
828        fn inline_align(_context: fidl::encoding::Context) -> usize {
829            1
830        }
831
832        #[inline(always)]
833        fn inline_size(_context: fidl::encoding::Context) -> usize {
834            1
835        }
836    }
837
838    unsafe impl<D: fidl::encoding::ResourceDialect>
839        fidl::encoding::Encode<DeviceSetSoftwareMuteStateRequest, D>
840        for &DeviceSetSoftwareMuteStateRequest
841    {
842        #[inline]
843        unsafe fn encode(
844            self,
845            encoder: &mut fidl::encoding::Encoder<'_, D>,
846            offset: usize,
847            _depth: fidl::encoding::Depth,
848        ) -> fidl::Result<()> {
849            encoder.debug_check_bounds::<DeviceSetSoftwareMuteStateRequest>(offset);
850            // Delegate to tuple encoding.
851            fidl::encoding::Encode::<DeviceSetSoftwareMuteStateRequest, D>::encode(
852                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.muted),),
853                encoder,
854                offset,
855                _depth,
856            )
857        }
858    }
859    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
860        fidl::encoding::Encode<DeviceSetSoftwareMuteStateRequest, D> for (T0,)
861    {
862        #[inline]
863        unsafe fn encode(
864            self,
865            encoder: &mut fidl::encoding::Encoder<'_, D>,
866            offset: usize,
867            depth: fidl::encoding::Depth,
868        ) -> fidl::Result<()> {
869            encoder.debug_check_bounds::<DeviceSetSoftwareMuteStateRequest>(offset);
870            // Zero out padding regions. There's no need to apply masks
871            // because the unmasked parts will be overwritten by fields.
872            // Write the fields.
873            self.0.encode(encoder, offset + 0, depth)?;
874            Ok(())
875        }
876    }
877
878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
879        for DeviceSetSoftwareMuteStateRequest
880    {
881        #[inline(always)]
882        fn new_empty() -> Self {
883            Self { muted: fidl::new_empty!(bool, D) }
884        }
885
886        #[inline]
887        unsafe fn decode(
888            &mut self,
889            decoder: &mut fidl::encoding::Decoder<'_, D>,
890            offset: usize,
891            _depth: fidl::encoding::Depth,
892        ) -> fidl::Result<()> {
893            decoder.debug_check_bounds::<Self>(offset);
894            // Verify that padding bytes are zero.
895            fidl::decode!(bool, D, &mut self.muted, decoder, offset + 0, _depth)?;
896            Ok(())
897        }
898    }
899
900    impl fidl::encoding::ValueTypeMarker for DeviceWatchCurrentConfigurationResponse {
901        type Borrowed<'a> = &'a Self;
902        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
903            value
904        }
905    }
906
907    unsafe impl fidl::encoding::TypeMarker for DeviceWatchCurrentConfigurationResponse {
908        type Owned = Self;
909
910        #[inline(always)]
911        fn inline_align(_context: fidl::encoding::Context) -> usize {
912            4
913        }
914
915        #[inline(always)]
916        fn inline_size(_context: fidl::encoding::Context) -> usize {
917            4
918        }
919        #[inline(always)]
920        fn encode_is_copy() -> bool {
921            true
922        }
923
924        #[inline(always)]
925        fn decode_is_copy() -> bool {
926            true
927        }
928    }
929
930    unsafe impl<D: fidl::encoding::ResourceDialect>
931        fidl::encoding::Encode<DeviceWatchCurrentConfigurationResponse, D>
932        for &DeviceWatchCurrentConfigurationResponse
933    {
934        #[inline]
935        unsafe fn encode(
936            self,
937            encoder: &mut fidl::encoding::Encoder<'_, D>,
938            offset: usize,
939            _depth: fidl::encoding::Depth,
940        ) -> fidl::Result<()> {
941            encoder.debug_check_bounds::<DeviceWatchCurrentConfigurationResponse>(offset);
942            unsafe {
943                // Copy the object into the buffer.
944                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
945                (buf_ptr as *mut DeviceWatchCurrentConfigurationResponse).write_unaligned(
946                    (self as *const DeviceWatchCurrentConfigurationResponse).read(),
947                );
948                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
949                // done second because the memcpy will write garbage to these bytes.
950            }
951            Ok(())
952        }
953    }
954    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
955        fidl::encoding::Encode<DeviceWatchCurrentConfigurationResponse, D> for (T0,)
956    {
957        #[inline]
958        unsafe fn encode(
959            self,
960            encoder: &mut fidl::encoding::Encoder<'_, D>,
961            offset: usize,
962            depth: fidl::encoding::Depth,
963        ) -> fidl::Result<()> {
964            encoder.debug_check_bounds::<DeviceWatchCurrentConfigurationResponse>(offset);
965            // Zero out padding regions. There's no need to apply masks
966            // because the unmasked parts will be overwritten by fields.
967            // Write the fields.
968            self.0.encode(encoder, offset + 0, depth)?;
969            Ok(())
970        }
971    }
972
973    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
974        for DeviceWatchCurrentConfigurationResponse
975    {
976        #[inline(always)]
977        fn new_empty() -> Self {
978            Self { index: fidl::new_empty!(u32, D) }
979        }
980
981        #[inline]
982        unsafe fn decode(
983            &mut self,
984            decoder: &mut fidl::encoding::Decoder<'_, D>,
985            offset: usize,
986            _depth: fidl::encoding::Depth,
987        ) -> fidl::Result<()> {
988            decoder.debug_check_bounds::<Self>(offset);
989            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
990            // Verify that padding bytes are zero.
991            // Copy from the buffer into the object.
992            unsafe {
993                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
994            }
995            Ok(())
996        }
997    }
998
999    impl fidl::encoding::ValueTypeMarker for DeviceWatchMuteStateResponse {
1000        type Borrowed<'a> = &'a Self;
1001        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1002            value
1003        }
1004    }
1005
1006    unsafe impl fidl::encoding::TypeMarker for DeviceWatchMuteStateResponse {
1007        type Owned = Self;
1008
1009        #[inline(always)]
1010        fn inline_align(_context: fidl::encoding::Context) -> usize {
1011            1
1012        }
1013
1014        #[inline(always)]
1015        fn inline_size(_context: fidl::encoding::Context) -> usize {
1016            2
1017        }
1018    }
1019
1020    unsafe impl<D: fidl::encoding::ResourceDialect>
1021        fidl::encoding::Encode<DeviceWatchMuteStateResponse, D> for &DeviceWatchMuteStateResponse
1022    {
1023        #[inline]
1024        unsafe fn encode(
1025            self,
1026            encoder: &mut fidl::encoding::Encoder<'_, D>,
1027            offset: usize,
1028            _depth: fidl::encoding::Depth,
1029        ) -> fidl::Result<()> {
1030            encoder.debug_check_bounds::<DeviceWatchMuteStateResponse>(offset);
1031            // Delegate to tuple encoding.
1032            fidl::encoding::Encode::<DeviceWatchMuteStateResponse, D>::encode(
1033                (
1034                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.software_muted),
1035                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.hardware_muted),
1036                ),
1037                encoder,
1038                offset,
1039                _depth,
1040            )
1041        }
1042    }
1043    unsafe impl<
1044            D: fidl::encoding::ResourceDialect,
1045            T0: fidl::encoding::Encode<bool, D>,
1046            T1: fidl::encoding::Encode<bool, D>,
1047        > fidl::encoding::Encode<DeviceWatchMuteStateResponse, D> for (T0, T1)
1048    {
1049        #[inline]
1050        unsafe fn encode(
1051            self,
1052            encoder: &mut fidl::encoding::Encoder<'_, D>,
1053            offset: usize,
1054            depth: fidl::encoding::Depth,
1055        ) -> fidl::Result<()> {
1056            encoder.debug_check_bounds::<DeviceWatchMuteStateResponse>(offset);
1057            // Zero out padding regions. There's no need to apply masks
1058            // because the unmasked parts will be overwritten by fields.
1059            // Write the fields.
1060            self.0.encode(encoder, offset + 0, depth)?;
1061            self.1.encode(encoder, offset + 1, depth)?;
1062            Ok(())
1063        }
1064    }
1065
1066    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1067        for DeviceWatchMuteStateResponse
1068    {
1069        #[inline(always)]
1070        fn new_empty() -> Self {
1071            Self {
1072                software_muted: fidl::new_empty!(bool, D),
1073                hardware_muted: fidl::new_empty!(bool, D),
1074            }
1075        }
1076
1077        #[inline]
1078        unsafe fn decode(
1079            &mut self,
1080            decoder: &mut fidl::encoding::Decoder<'_, D>,
1081            offset: usize,
1082            _depth: fidl::encoding::Depth,
1083        ) -> fidl::Result<()> {
1084            decoder.debug_check_bounds::<Self>(offset);
1085            // Verify that padding bytes are zero.
1086            fidl::decode!(bool, D, &mut self.software_muted, decoder, offset + 0, _depth)?;
1087            fidl::decode!(bool, D, &mut self.hardware_muted, decoder, offset + 1, _depth)?;
1088            Ok(())
1089        }
1090    }
1091
1092    impl fidl::encoding::ValueTypeMarker for DeviceWatcherWatchDevicesResponse {
1093        type Borrowed<'a> = &'a Self;
1094        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1095            value
1096        }
1097    }
1098
1099    unsafe impl fidl::encoding::TypeMarker for DeviceWatcherWatchDevicesResponse {
1100        type Owned = Self;
1101
1102        #[inline(always)]
1103        fn inline_align(_context: fidl::encoding::Context) -> usize {
1104            8
1105        }
1106
1107        #[inline(always)]
1108        fn inline_size(_context: fidl::encoding::Context) -> usize {
1109            16
1110        }
1111    }
1112
1113    unsafe impl<D: fidl::encoding::ResourceDialect>
1114        fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D>
1115        for &DeviceWatcherWatchDevicesResponse
1116    {
1117        #[inline]
1118        unsafe fn encode(
1119            self,
1120            encoder: &mut fidl::encoding::Encoder<'_, D>,
1121            offset: usize,
1122            _depth: fidl::encoding::Depth,
1123        ) -> fidl::Result<()> {
1124            encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
1125            // Delegate to tuple encoding.
1126            fidl::encoding::Encode::<DeviceWatcherWatchDevicesResponse, D>::encode(
1127                (
1128                    <fidl::encoding::Vector<WatchDevicesEvent, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
1129                ),
1130                encoder, offset, _depth
1131            )
1132        }
1133    }
1134    unsafe impl<
1135            D: fidl::encoding::ResourceDialect,
1136            T0: fidl::encoding::Encode<fidl::encoding::Vector<WatchDevicesEvent, 256>, D>,
1137        > fidl::encoding::Encode<DeviceWatcherWatchDevicesResponse, D> for (T0,)
1138    {
1139        #[inline]
1140        unsafe fn encode(
1141            self,
1142            encoder: &mut fidl::encoding::Encoder<'_, D>,
1143            offset: usize,
1144            depth: fidl::encoding::Depth,
1145        ) -> fidl::Result<()> {
1146            encoder.debug_check_bounds::<DeviceWatcherWatchDevicesResponse>(offset);
1147            // Zero out padding regions. There's no need to apply masks
1148            // because the unmasked parts will be overwritten by fields.
1149            // Write the fields.
1150            self.0.encode(encoder, offset + 0, depth)?;
1151            Ok(())
1152        }
1153    }
1154
1155    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1156        for DeviceWatcherWatchDevicesResponse
1157    {
1158        #[inline(always)]
1159        fn new_empty() -> Self {
1160            Self { events: fidl::new_empty!(fidl::encoding::Vector<WatchDevicesEvent, 256>, D) }
1161        }
1162
1163        #[inline]
1164        unsafe fn decode(
1165            &mut self,
1166            decoder: &mut fidl::encoding::Decoder<'_, D>,
1167            offset: usize,
1168            _depth: fidl::encoding::Depth,
1169        ) -> fidl::Result<()> {
1170            decoder.debug_check_bounds::<Self>(offset);
1171            // Verify that padding bytes are zero.
1172            fidl::decode!(fidl::encoding::Vector<WatchDevicesEvent, 256>, D, &mut self.events, decoder, offset + 0, _depth)?;
1173            Ok(())
1174        }
1175    }
1176
1177    impl fidl::encoding::ValueTypeMarker for FrameRate {
1178        type Borrowed<'a> = &'a Self;
1179        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1180            value
1181        }
1182    }
1183
1184    unsafe impl fidl::encoding::TypeMarker for FrameRate {
1185        type Owned = Self;
1186
1187        #[inline(always)]
1188        fn inline_align(_context: fidl::encoding::Context) -> usize {
1189            4
1190        }
1191
1192        #[inline(always)]
1193        fn inline_size(_context: fidl::encoding::Context) -> usize {
1194            8
1195        }
1196        #[inline(always)]
1197        fn encode_is_copy() -> bool {
1198            true
1199        }
1200
1201        #[inline(always)]
1202        fn decode_is_copy() -> bool {
1203            true
1204        }
1205    }
1206
1207    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FrameRate, D>
1208        for &FrameRate
1209    {
1210        #[inline]
1211        unsafe fn encode(
1212            self,
1213            encoder: &mut fidl::encoding::Encoder<'_, D>,
1214            offset: usize,
1215            _depth: fidl::encoding::Depth,
1216        ) -> fidl::Result<()> {
1217            encoder.debug_check_bounds::<FrameRate>(offset);
1218            unsafe {
1219                // Copy the object into the buffer.
1220                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1221                (buf_ptr as *mut FrameRate).write_unaligned((self as *const FrameRate).read());
1222                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1223                // done second because the memcpy will write garbage to these bytes.
1224            }
1225            Ok(())
1226        }
1227    }
1228    unsafe impl<
1229            D: fidl::encoding::ResourceDialect,
1230            T0: fidl::encoding::Encode<u32, D>,
1231            T1: fidl::encoding::Encode<u32, D>,
1232        > fidl::encoding::Encode<FrameRate, D> for (T0, T1)
1233    {
1234        #[inline]
1235        unsafe fn encode(
1236            self,
1237            encoder: &mut fidl::encoding::Encoder<'_, D>,
1238            offset: usize,
1239            depth: fidl::encoding::Depth,
1240        ) -> fidl::Result<()> {
1241            encoder.debug_check_bounds::<FrameRate>(offset);
1242            // Zero out padding regions. There's no need to apply masks
1243            // because the unmasked parts will be overwritten by fields.
1244            // Write the fields.
1245            self.0.encode(encoder, offset + 0, depth)?;
1246            self.1.encode(encoder, offset + 4, depth)?;
1247            Ok(())
1248        }
1249    }
1250
1251    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FrameRate {
1252        #[inline(always)]
1253        fn new_empty() -> Self {
1254            Self { numerator: fidl::new_empty!(u32, D), denominator: fidl::new_empty!(u32, D) }
1255        }
1256
1257        #[inline]
1258        unsafe fn decode(
1259            &mut self,
1260            decoder: &mut fidl::encoding::Decoder<'_, D>,
1261            offset: usize,
1262            _depth: fidl::encoding::Depth,
1263        ) -> fidl::Result<()> {
1264            decoder.debug_check_bounds::<Self>(offset);
1265            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1266            // Verify that padding bytes are zero.
1267            // Copy from the buffer into the object.
1268            unsafe {
1269                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1270            }
1271            Ok(())
1272        }
1273    }
1274
1275    impl fidl::encoding::ValueTypeMarker for StreamGetProperties2Response {
1276        type Borrowed<'a> = &'a Self;
1277        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1278            value
1279        }
1280    }
1281
1282    unsafe impl fidl::encoding::TypeMarker for StreamGetProperties2Response {
1283        type Owned = Self;
1284
1285        #[inline(always)]
1286        fn inline_align(_context: fidl::encoding::Context) -> usize {
1287            8
1288        }
1289
1290        #[inline(always)]
1291        fn inline_size(_context: fidl::encoding::Context) -> usize {
1292            16
1293        }
1294    }
1295
1296    unsafe impl<D: fidl::encoding::ResourceDialect>
1297        fidl::encoding::Encode<StreamGetProperties2Response, D> for &StreamGetProperties2Response
1298    {
1299        #[inline]
1300        unsafe fn encode(
1301            self,
1302            encoder: &mut fidl::encoding::Encoder<'_, D>,
1303            offset: usize,
1304            _depth: fidl::encoding::Depth,
1305        ) -> fidl::Result<()> {
1306            encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1307            // Delegate to tuple encoding.
1308            fidl::encoding::Encode::<StreamGetProperties2Response, D>::encode(
1309                (<StreamProperties2 as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1310                encoder,
1311                offset,
1312                _depth,
1313            )
1314        }
1315    }
1316    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties2, D>>
1317        fidl::encoding::Encode<StreamGetProperties2Response, D> for (T0,)
1318    {
1319        #[inline]
1320        unsafe fn encode(
1321            self,
1322            encoder: &mut fidl::encoding::Encoder<'_, D>,
1323            offset: usize,
1324            depth: fidl::encoding::Depth,
1325        ) -> fidl::Result<()> {
1326            encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1327            // Zero out padding regions. There's no need to apply masks
1328            // because the unmasked parts will be overwritten by fields.
1329            // Write the fields.
1330            self.0.encode(encoder, offset + 0, depth)?;
1331            Ok(())
1332        }
1333    }
1334
1335    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1336        for StreamGetProperties2Response
1337    {
1338        #[inline(always)]
1339        fn new_empty() -> Self {
1340            Self { properties: fidl::new_empty!(StreamProperties2, D) }
1341        }
1342
1343        #[inline]
1344        unsafe fn decode(
1345            &mut self,
1346            decoder: &mut fidl::encoding::Decoder<'_, D>,
1347            offset: usize,
1348            _depth: fidl::encoding::Depth,
1349        ) -> fidl::Result<()> {
1350            decoder.debug_check_bounds::<Self>(offset);
1351            // Verify that padding bytes are zero.
1352            fidl::decode!(StreamProperties2, D, &mut self.properties, decoder, offset + 0, _depth)?;
1353            Ok(())
1354        }
1355    }
1356
1357    impl fidl::encoding::ValueTypeMarker for StreamGetPropertiesResponse {
1358        type Borrowed<'a> = &'a Self;
1359        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1360            value
1361        }
1362    }
1363
1364    unsafe impl fidl::encoding::TypeMarker for StreamGetPropertiesResponse {
1365        type Owned = Self;
1366
1367        #[inline(always)]
1368        fn inline_align(_context: fidl::encoding::Context) -> usize {
1369            8
1370        }
1371
1372        #[inline(always)]
1373        fn inline_size(_context: fidl::encoding::Context) -> usize {
1374            72
1375        }
1376    }
1377
1378    unsafe impl<D: fidl::encoding::ResourceDialect>
1379        fidl::encoding::Encode<StreamGetPropertiesResponse, D> for &StreamGetPropertiesResponse
1380    {
1381        #[inline]
1382        unsafe fn encode(
1383            self,
1384            encoder: &mut fidl::encoding::Encoder<'_, D>,
1385            offset: usize,
1386            _depth: fidl::encoding::Depth,
1387        ) -> fidl::Result<()> {
1388            encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1389            // Delegate to tuple encoding.
1390            fidl::encoding::Encode::<StreamGetPropertiesResponse, D>::encode(
1391                (<StreamProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1392                encoder,
1393                offset,
1394                _depth,
1395            )
1396        }
1397    }
1398    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties, D>>
1399        fidl::encoding::Encode<StreamGetPropertiesResponse, D> for (T0,)
1400    {
1401        #[inline]
1402        unsafe fn encode(
1403            self,
1404            encoder: &mut fidl::encoding::Encoder<'_, D>,
1405            offset: usize,
1406            depth: fidl::encoding::Depth,
1407        ) -> fidl::Result<()> {
1408            encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1409            // Zero out padding regions. There's no need to apply masks
1410            // because the unmasked parts will be overwritten by fields.
1411            // Write the fields.
1412            self.0.encode(encoder, offset + 0, depth)?;
1413            Ok(())
1414        }
1415    }
1416
1417    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1418        for StreamGetPropertiesResponse
1419    {
1420        #[inline(always)]
1421        fn new_empty() -> Self {
1422            Self { properties: fidl::new_empty!(StreamProperties, D) }
1423        }
1424
1425        #[inline]
1426        unsafe fn decode(
1427            &mut self,
1428            decoder: &mut fidl::encoding::Decoder<'_, D>,
1429            offset: usize,
1430            _depth: fidl::encoding::Depth,
1431        ) -> fidl::Result<()> {
1432            decoder.debug_check_bounds::<Self>(offset);
1433            // Verify that padding bytes are zero.
1434            fidl::decode!(StreamProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
1435            Ok(())
1436        }
1437    }
1438
1439    impl fidl::encoding::ValueTypeMarker for StreamProperties {
1440        type Borrowed<'a> = &'a Self;
1441        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1442            value
1443        }
1444    }
1445
1446    unsafe impl fidl::encoding::TypeMarker for StreamProperties {
1447        type Owned = Self;
1448
1449        #[inline(always)]
1450        fn inline_align(_context: fidl::encoding::Context) -> usize {
1451            8
1452        }
1453
1454        #[inline(always)]
1455        fn inline_size(_context: fidl::encoding::Context) -> usize {
1456            72
1457        }
1458    }
1459
1460    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties, D>
1461        for &StreamProperties
1462    {
1463        #[inline]
1464        unsafe fn encode(
1465            self,
1466            encoder: &mut fidl::encoding::Encoder<'_, D>,
1467            offset: usize,
1468            _depth: fidl::encoding::Depth,
1469        ) -> fidl::Result<()> {
1470            encoder.debug_check_bounds::<StreamProperties>(offset);
1471            // Delegate to tuple encoding.
1472            fidl::encoding::Encode::<StreamProperties, D>::encode(
1473                (
1474                    <fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format),
1475                    <FrameRate as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rate),
1476                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_crop_region),
1477                ),
1478                encoder, offset, _depth
1479            )
1480        }
1481    }
1482    unsafe impl<
1483            D: fidl::encoding::ResourceDialect,
1484            T0: fidl::encoding::Encode<fidl_fuchsia_sysmem__common::ImageFormat2, D>,
1485            T1: fidl::encoding::Encode<FrameRate, D>,
1486            T2: fidl::encoding::Encode<bool, D>,
1487        > fidl::encoding::Encode<StreamProperties, D> for (T0, T1, T2)
1488    {
1489        #[inline]
1490        unsafe fn encode(
1491            self,
1492            encoder: &mut fidl::encoding::Encoder<'_, D>,
1493            offset: usize,
1494            depth: fidl::encoding::Depth,
1495        ) -> fidl::Result<()> {
1496            encoder.debug_check_bounds::<StreamProperties>(offset);
1497            // Zero out padding regions. There's no need to apply masks
1498            // because the unmasked parts will be overwritten by fields.
1499            unsafe {
1500                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
1501                (ptr as *mut u64).write_unaligned(0);
1502            }
1503            // Write the fields.
1504            self.0.encode(encoder, offset + 0, depth)?;
1505            self.1.encode(encoder, offset + 56, depth)?;
1506            self.2.encode(encoder, offset + 64, depth)?;
1507            Ok(())
1508        }
1509    }
1510
1511    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties {
1512        #[inline(always)]
1513        fn new_empty() -> Self {
1514            Self {
1515                image_format: fidl::new_empty!(fidl_fuchsia_sysmem__common::ImageFormat2, D),
1516                frame_rate: fidl::new_empty!(FrameRate, D),
1517                supports_crop_region: fidl::new_empty!(bool, D),
1518            }
1519        }
1520
1521        #[inline]
1522        unsafe fn decode(
1523            &mut self,
1524            decoder: &mut fidl::encoding::Decoder<'_, D>,
1525            offset: usize,
1526            _depth: fidl::encoding::Depth,
1527        ) -> fidl::Result<()> {
1528            decoder.debug_check_bounds::<Self>(offset);
1529            // Verify that padding bytes are zero.
1530            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
1531            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1532            let mask = 0xffffffffffffff00u64;
1533            let maskedval = padval & mask;
1534            if maskedval != 0 {
1535                return Err(fidl::Error::NonZeroPadding {
1536                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
1537                });
1538            }
1539            fidl::decode!(
1540                fidl_fuchsia_sysmem__common::ImageFormat2,
1541                D,
1542                &mut self.image_format,
1543                decoder,
1544                offset + 0,
1545                _depth
1546            )?;
1547            fidl::decode!(FrameRate, D, &mut self.frame_rate, decoder, offset + 56, _depth)?;
1548            fidl::decode!(bool, D, &mut self.supports_crop_region, decoder, offset + 64, _depth)?;
1549            Ok(())
1550        }
1551    }
1552
1553    impl fidl::encoding::ValueTypeMarker for StreamSetCropRegionRequest {
1554        type Borrowed<'a> = &'a Self;
1555        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1556            value
1557        }
1558    }
1559
1560    unsafe impl fidl::encoding::TypeMarker for StreamSetCropRegionRequest {
1561        type Owned = Self;
1562
1563        #[inline(always)]
1564        fn inline_align(_context: fidl::encoding::Context) -> usize {
1565            8
1566        }
1567
1568        #[inline(always)]
1569        fn inline_size(_context: fidl::encoding::Context) -> usize {
1570            8
1571        }
1572    }
1573
1574    unsafe impl<D: fidl::encoding::ResourceDialect>
1575        fidl::encoding::Encode<StreamSetCropRegionRequest, D> for &StreamSetCropRegionRequest
1576    {
1577        #[inline]
1578        unsafe fn encode(
1579            self,
1580            encoder: &mut fidl::encoding::Encoder<'_, D>,
1581            offset: usize,
1582            _depth: fidl::encoding::Depth,
1583        ) -> fidl::Result<()> {
1584            encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1585            // Delegate to tuple encoding.
1586            fidl::encoding::Encode::<StreamSetCropRegionRequest, D>::encode(
1587                (
1588                    <fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1589                ),
1590                encoder, offset, _depth
1591            )
1592        }
1593    }
1594    unsafe impl<
1595            D: fidl::encoding::ResourceDialect,
1596            T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>, D>,
1597        > fidl::encoding::Encode<StreamSetCropRegionRequest, D> for (T0,)
1598    {
1599        #[inline]
1600        unsafe fn encode(
1601            self,
1602            encoder: &mut fidl::encoding::Encoder<'_, D>,
1603            offset: usize,
1604            depth: fidl::encoding::Depth,
1605        ) -> fidl::Result<()> {
1606            encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1607            // Zero out padding regions. There's no need to apply masks
1608            // because the unmasked parts will be overwritten by fields.
1609            // Write the fields.
1610            self.0.encode(encoder, offset + 0, depth)?;
1611            Ok(())
1612        }
1613    }
1614
1615    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1616        for StreamSetCropRegionRequest
1617    {
1618        #[inline(always)]
1619        fn new_empty() -> Self {
1620            Self {
1621                region: fidl::new_empty!(
1622                    fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1623                    D
1624                ),
1625            }
1626        }
1627
1628        #[inline]
1629        unsafe fn decode(
1630            &mut self,
1631            decoder: &mut fidl::encoding::Decoder<'_, D>,
1632            offset: usize,
1633            _depth: fidl::encoding::Depth,
1634        ) -> fidl::Result<()> {
1635            decoder.debug_check_bounds::<Self>(offset);
1636            // Verify that padding bytes are zero.
1637            fidl::decode!(
1638                fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1639                D,
1640                &mut self.region,
1641                decoder,
1642                offset + 0,
1643                _depth
1644            )?;
1645            Ok(())
1646        }
1647    }
1648
1649    impl fidl::encoding::ValueTypeMarker for StreamSetResolutionRequest {
1650        type Borrowed<'a> = &'a Self;
1651        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1652            value
1653        }
1654    }
1655
1656    unsafe impl fidl::encoding::TypeMarker for StreamSetResolutionRequest {
1657        type Owned = Self;
1658
1659        #[inline(always)]
1660        fn inline_align(_context: fidl::encoding::Context) -> usize {
1661            4
1662        }
1663
1664        #[inline(always)]
1665        fn inline_size(_context: fidl::encoding::Context) -> usize {
1666            8
1667        }
1668    }
1669
1670    unsafe impl<D: fidl::encoding::ResourceDialect>
1671        fidl::encoding::Encode<StreamSetResolutionRequest, D> for &StreamSetResolutionRequest
1672    {
1673        #[inline]
1674        unsafe fn encode(
1675            self,
1676            encoder: &mut fidl::encoding::Encoder<'_, D>,
1677            offset: usize,
1678            _depth: fidl::encoding::Depth,
1679        ) -> fidl::Result<()> {
1680            encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1681            // Delegate to tuple encoding.
1682            fidl::encoding::Encode::<StreamSetResolutionRequest, D>::encode(
1683                (<fidl_fuchsia_math__common::Size as fidl::encoding::ValueTypeMarker>::borrow(
1684                    &self.coded_size,
1685                ),),
1686                encoder,
1687                offset,
1688                _depth,
1689            )
1690        }
1691    }
1692    unsafe impl<
1693            D: fidl::encoding::ResourceDialect,
1694            T0: fidl::encoding::Encode<fidl_fuchsia_math__common::Size, D>,
1695        > fidl::encoding::Encode<StreamSetResolutionRequest, D> for (T0,)
1696    {
1697        #[inline]
1698        unsafe fn encode(
1699            self,
1700            encoder: &mut fidl::encoding::Encoder<'_, D>,
1701            offset: usize,
1702            depth: fidl::encoding::Depth,
1703        ) -> fidl::Result<()> {
1704            encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1705            // Zero out padding regions. There's no need to apply masks
1706            // because the unmasked parts will be overwritten by fields.
1707            // Write the fields.
1708            self.0.encode(encoder, offset + 0, depth)?;
1709            Ok(())
1710        }
1711    }
1712
1713    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1714        for StreamSetResolutionRequest
1715    {
1716        #[inline(always)]
1717        fn new_empty() -> Self {
1718            Self { coded_size: fidl::new_empty!(fidl_fuchsia_math__common::Size, D) }
1719        }
1720
1721        #[inline]
1722        unsafe fn decode(
1723            &mut self,
1724            decoder: &mut fidl::encoding::Decoder<'_, D>,
1725            offset: usize,
1726            _depth: fidl::encoding::Depth,
1727        ) -> fidl::Result<()> {
1728            decoder.debug_check_bounds::<Self>(offset);
1729            // Verify that padding bytes are zero.
1730            fidl::decode!(
1731                fidl_fuchsia_math__common::Size,
1732                D,
1733                &mut self.coded_size,
1734                decoder,
1735                offset + 0,
1736                _depth
1737            )?;
1738            Ok(())
1739        }
1740    }
1741
1742    impl fidl::encoding::ValueTypeMarker for StreamWatchCropRegionResponse {
1743        type Borrowed<'a> = &'a Self;
1744        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1745            value
1746        }
1747    }
1748
1749    unsafe impl fidl::encoding::TypeMarker for StreamWatchCropRegionResponse {
1750        type Owned = Self;
1751
1752        #[inline(always)]
1753        fn inline_align(_context: fidl::encoding::Context) -> usize {
1754            8
1755        }
1756
1757        #[inline(always)]
1758        fn inline_size(_context: fidl::encoding::Context) -> usize {
1759            8
1760        }
1761    }
1762
1763    unsafe impl<D: fidl::encoding::ResourceDialect>
1764        fidl::encoding::Encode<StreamWatchCropRegionResponse, D>
1765        for &StreamWatchCropRegionResponse
1766    {
1767        #[inline]
1768        unsafe fn encode(
1769            self,
1770            encoder: &mut fidl::encoding::Encoder<'_, D>,
1771            offset: usize,
1772            _depth: fidl::encoding::Depth,
1773        ) -> fidl::Result<()> {
1774            encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1775            // Delegate to tuple encoding.
1776            fidl::encoding::Encode::<StreamWatchCropRegionResponse, D>::encode(
1777                (
1778                    <fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1779                ),
1780                encoder, offset, _depth
1781            )
1782        }
1783    }
1784    unsafe impl<
1785            D: fidl::encoding::ResourceDialect,
1786            T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>, D>,
1787        > fidl::encoding::Encode<StreamWatchCropRegionResponse, D> for (T0,)
1788    {
1789        #[inline]
1790        unsafe fn encode(
1791            self,
1792            encoder: &mut fidl::encoding::Encoder<'_, D>,
1793            offset: usize,
1794            depth: fidl::encoding::Depth,
1795        ) -> fidl::Result<()> {
1796            encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1797            // Zero out padding regions. There's no need to apply masks
1798            // because the unmasked parts will be overwritten by fields.
1799            // Write the fields.
1800            self.0.encode(encoder, offset + 0, depth)?;
1801            Ok(())
1802        }
1803    }
1804
1805    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1806        for StreamWatchCropRegionResponse
1807    {
1808        #[inline(always)]
1809        fn new_empty() -> Self {
1810            Self {
1811                region: fidl::new_empty!(
1812                    fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1813                    D
1814                ),
1815            }
1816        }
1817
1818        #[inline]
1819        unsafe fn decode(
1820            &mut self,
1821            decoder: &mut fidl::encoding::Decoder<'_, D>,
1822            offset: usize,
1823            _depth: fidl::encoding::Depth,
1824        ) -> fidl::Result<()> {
1825            decoder.debug_check_bounds::<Self>(offset);
1826            // Verify that padding bytes are zero.
1827            fidl::decode!(
1828                fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1829                D,
1830                &mut self.region,
1831                decoder,
1832                offset + 0,
1833                _depth
1834            )?;
1835            Ok(())
1836        }
1837    }
1838
1839    impl fidl::encoding::ValueTypeMarker for StreamWatchOrientationResponse {
1840        type Borrowed<'a> = &'a Self;
1841        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1842            value
1843        }
1844    }
1845
1846    unsafe impl fidl::encoding::TypeMarker for StreamWatchOrientationResponse {
1847        type Owned = Self;
1848
1849        #[inline(always)]
1850        fn inline_align(_context: fidl::encoding::Context) -> usize {
1851            4
1852        }
1853
1854        #[inline(always)]
1855        fn inline_size(_context: fidl::encoding::Context) -> usize {
1856            4
1857        }
1858    }
1859
1860    unsafe impl<D: fidl::encoding::ResourceDialect>
1861        fidl::encoding::Encode<StreamWatchOrientationResponse, D>
1862        for &StreamWatchOrientationResponse
1863    {
1864        #[inline]
1865        unsafe fn encode(
1866            self,
1867            encoder: &mut fidl::encoding::Encoder<'_, D>,
1868            offset: usize,
1869            _depth: fidl::encoding::Depth,
1870        ) -> fidl::Result<()> {
1871            encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1872            // Delegate to tuple encoding.
1873            fidl::encoding::Encode::<StreamWatchOrientationResponse, D>::encode(
1874                (<Orientation as fidl::encoding::ValueTypeMarker>::borrow(&self.orientation),),
1875                encoder,
1876                offset,
1877                _depth,
1878            )
1879        }
1880    }
1881    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Orientation, D>>
1882        fidl::encoding::Encode<StreamWatchOrientationResponse, D> for (T0,)
1883    {
1884        #[inline]
1885        unsafe fn encode(
1886            self,
1887            encoder: &mut fidl::encoding::Encoder<'_, D>,
1888            offset: usize,
1889            depth: fidl::encoding::Depth,
1890        ) -> fidl::Result<()> {
1891            encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1892            // Zero out padding regions. There's no need to apply masks
1893            // because the unmasked parts will be overwritten by fields.
1894            // Write the fields.
1895            self.0.encode(encoder, offset + 0, depth)?;
1896            Ok(())
1897        }
1898    }
1899
1900    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1901        for StreamWatchOrientationResponse
1902    {
1903        #[inline(always)]
1904        fn new_empty() -> Self {
1905            Self { orientation: fidl::new_empty!(Orientation, D) }
1906        }
1907
1908        #[inline]
1909        unsafe fn decode(
1910            &mut self,
1911            decoder: &mut fidl::encoding::Decoder<'_, D>,
1912            offset: usize,
1913            _depth: fidl::encoding::Depth,
1914        ) -> fidl::Result<()> {
1915            decoder.debug_check_bounds::<Self>(offset);
1916            // Verify that padding bytes are zero.
1917            fidl::decode!(Orientation, D, &mut self.orientation, decoder, offset + 0, _depth)?;
1918            Ok(())
1919        }
1920    }
1921
1922    impl fidl::encoding::ValueTypeMarker for StreamWatchResolutionResponse {
1923        type Borrowed<'a> = &'a Self;
1924        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1925            value
1926        }
1927    }
1928
1929    unsafe impl fidl::encoding::TypeMarker for StreamWatchResolutionResponse {
1930        type Owned = Self;
1931
1932        #[inline(always)]
1933        fn inline_align(_context: fidl::encoding::Context) -> usize {
1934            4
1935        }
1936
1937        #[inline(always)]
1938        fn inline_size(_context: fidl::encoding::Context) -> usize {
1939            8
1940        }
1941    }
1942
1943    unsafe impl<D: fidl::encoding::ResourceDialect>
1944        fidl::encoding::Encode<StreamWatchResolutionResponse, D>
1945        for &StreamWatchResolutionResponse
1946    {
1947        #[inline]
1948        unsafe fn encode(
1949            self,
1950            encoder: &mut fidl::encoding::Encoder<'_, D>,
1951            offset: usize,
1952            _depth: fidl::encoding::Depth,
1953        ) -> fidl::Result<()> {
1954            encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1955            // Delegate to tuple encoding.
1956            fidl::encoding::Encode::<StreamWatchResolutionResponse, D>::encode(
1957                (<fidl_fuchsia_math__common::Size as fidl::encoding::ValueTypeMarker>::borrow(
1958                    &self.coded_size,
1959                ),),
1960                encoder,
1961                offset,
1962                _depth,
1963            )
1964        }
1965    }
1966    unsafe impl<
1967            D: fidl::encoding::ResourceDialect,
1968            T0: fidl::encoding::Encode<fidl_fuchsia_math__common::Size, D>,
1969        > fidl::encoding::Encode<StreamWatchResolutionResponse, D> for (T0,)
1970    {
1971        #[inline]
1972        unsafe fn encode(
1973            self,
1974            encoder: &mut fidl::encoding::Encoder<'_, D>,
1975            offset: usize,
1976            depth: fidl::encoding::Depth,
1977        ) -> fidl::Result<()> {
1978            encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1979            // Zero out padding regions. There's no need to apply masks
1980            // because the unmasked parts will be overwritten by fields.
1981            // Write the fields.
1982            self.0.encode(encoder, offset + 0, depth)?;
1983            Ok(())
1984        }
1985    }
1986
1987    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1988        for StreamWatchResolutionResponse
1989    {
1990        #[inline(always)]
1991        fn new_empty() -> Self {
1992            Self { coded_size: fidl::new_empty!(fidl_fuchsia_math__common::Size, D) }
1993        }
1994
1995        #[inline]
1996        unsafe fn decode(
1997            &mut self,
1998            decoder: &mut fidl::encoding::Decoder<'_, D>,
1999            offset: usize,
2000            _depth: fidl::encoding::Depth,
2001        ) -> fidl::Result<()> {
2002            decoder.debug_check_bounds::<Self>(offset);
2003            // Verify that padding bytes are zero.
2004            fidl::decode!(
2005                fidl_fuchsia_math__common::Size,
2006                D,
2007                &mut self.coded_size,
2008                decoder,
2009                offset + 0,
2010                _depth
2011            )?;
2012            Ok(())
2013        }
2014    }
2015
2016    impl Configuration2 {
2017        #[inline(always)]
2018        fn max_ordinal_present(&self) -> u64 {
2019            if let Some(_) = self.streams {
2020                return 1;
2021            }
2022            0
2023        }
2024    }
2025
2026    impl fidl::encoding::ValueTypeMarker for Configuration2 {
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 Configuration2 {
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> fidl::encoding::Encode<Configuration2, D>
2048        for &Configuration2
2049    {
2050        unsafe fn encode(
2051            self,
2052            encoder: &mut fidl::encoding::Encoder<'_, D>,
2053            offset: usize,
2054            mut depth: fidl::encoding::Depth,
2055        ) -> fidl::Result<()> {
2056            encoder.debug_check_bounds::<Configuration2>(offset);
2057            // Vector header
2058            let max_ordinal: u64 = self.max_ordinal_present();
2059            encoder.write_num(max_ordinal, offset);
2060            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2061            // Calling encoder.out_of_line_offset(0) is not allowed.
2062            if max_ordinal == 0 {
2063                return Ok(());
2064            }
2065            depth.increment()?;
2066            let envelope_size = 8;
2067            let bytes_len = max_ordinal as usize * envelope_size;
2068            #[allow(unused_variables)]
2069            let offset = encoder.out_of_line_offset(bytes_len);
2070            let mut _prev_end_offset: usize = 0;
2071            if 1 > max_ordinal {
2072                return Ok(());
2073            }
2074
2075            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2076            // are envelope_size bytes.
2077            let cur_offset: usize = (1 - 1) * envelope_size;
2078
2079            // Zero reserved fields.
2080            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2081
2082            // Safety:
2083            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2084            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2085            //   envelope_size bytes, there is always sufficient room.
2086            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<StreamProperties2, 256>, D>(
2087            self.streams.as_ref().map(<fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2088            encoder, offset + cur_offset, depth
2089        )?;
2090
2091            _prev_end_offset = cur_offset + envelope_size;
2092
2093            Ok(())
2094        }
2095    }
2096
2097    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration2 {
2098        #[inline(always)]
2099        fn new_empty() -> Self {
2100            Self::default()
2101        }
2102
2103        unsafe fn decode(
2104            &mut self,
2105            decoder: &mut fidl::encoding::Decoder<'_, D>,
2106            offset: usize,
2107            mut depth: fidl::encoding::Depth,
2108        ) -> fidl::Result<()> {
2109            decoder.debug_check_bounds::<Self>(offset);
2110            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2111                None => return Err(fidl::Error::NotNullable),
2112                Some(len) => len,
2113            };
2114            // Calling decoder.out_of_line_offset(0) is not allowed.
2115            if len == 0 {
2116                return Ok(());
2117            };
2118            depth.increment()?;
2119            let envelope_size = 8;
2120            let bytes_len = len * envelope_size;
2121            let offset = decoder.out_of_line_offset(bytes_len)?;
2122            // Decode the envelope for each type.
2123            let mut _next_ordinal_to_read = 0;
2124            let mut next_offset = offset;
2125            let end_offset = offset + bytes_len;
2126            _next_ordinal_to_read += 1;
2127            if next_offset >= end_offset {
2128                return Ok(());
2129            }
2130
2131            // Decode unknown envelopes for gaps in ordinals.
2132            while _next_ordinal_to_read < 1 {
2133                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2134                _next_ordinal_to_read += 1;
2135                next_offset += envelope_size;
2136            }
2137
2138            let next_out_of_line = decoder.next_out_of_line();
2139            let handles_before = decoder.remaining_handles();
2140            if let Some((inlined, num_bytes, num_handles)) =
2141                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2142            {
2143                let member_inline_size = <fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2144                if inlined != (member_inline_size <= 4) {
2145                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2146                }
2147                let inner_offset;
2148                let mut inner_depth = depth.clone();
2149                if inlined {
2150                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2151                    inner_offset = next_offset;
2152                } else {
2153                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2154                    inner_depth.increment()?;
2155                }
2156                let val_ref = self.streams.get_or_insert_with(
2157                    || fidl::new_empty!(fidl::encoding::Vector<StreamProperties2, 256>, D),
2158                );
2159                fidl::decode!(fidl::encoding::Vector<StreamProperties2, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2160                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2161                {
2162                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2163                }
2164                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2165                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2166                }
2167            }
2168
2169            next_offset += envelope_size;
2170
2171            // Decode the remaining unknown envelopes.
2172            while next_offset < end_offset {
2173                _next_ordinal_to_read += 1;
2174                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2175                next_offset += envelope_size;
2176            }
2177
2178            Ok(())
2179        }
2180    }
2181
2182    impl StreamProperties2 {
2183        #[inline(always)]
2184        fn max_ordinal_present(&self) -> u64 {
2185            if let Some(_) = self.supported_resolutions {
2186                return 4;
2187            }
2188            if let Some(_) = self.supports_crop_region {
2189                return 3;
2190            }
2191            if let Some(_) = self.frame_rate {
2192                return 2;
2193            }
2194            if let Some(_) = self.image_format {
2195                return 1;
2196            }
2197            0
2198        }
2199    }
2200
2201    impl fidl::encoding::ValueTypeMarker for StreamProperties2 {
2202        type Borrowed<'a> = &'a Self;
2203        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2204            value
2205        }
2206    }
2207
2208    unsafe impl fidl::encoding::TypeMarker for StreamProperties2 {
2209        type Owned = Self;
2210
2211        #[inline(always)]
2212        fn inline_align(_context: fidl::encoding::Context) -> usize {
2213            8
2214        }
2215
2216        #[inline(always)]
2217        fn inline_size(_context: fidl::encoding::Context) -> usize {
2218            16
2219        }
2220    }
2221
2222    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties2, D>
2223        for &StreamProperties2
2224    {
2225        unsafe fn encode(
2226            self,
2227            encoder: &mut fidl::encoding::Encoder<'_, D>,
2228            offset: usize,
2229            mut depth: fidl::encoding::Depth,
2230        ) -> fidl::Result<()> {
2231            encoder.debug_check_bounds::<StreamProperties2>(offset);
2232            // Vector header
2233            let max_ordinal: u64 = self.max_ordinal_present();
2234            encoder.write_num(max_ordinal, offset);
2235            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2236            // Calling encoder.out_of_line_offset(0) is not allowed.
2237            if max_ordinal == 0 {
2238                return Ok(());
2239            }
2240            depth.increment()?;
2241            let envelope_size = 8;
2242            let bytes_len = max_ordinal as usize * envelope_size;
2243            #[allow(unused_variables)]
2244            let offset = encoder.out_of_line_offset(bytes_len);
2245            let mut _prev_end_offset: usize = 0;
2246            if 1 > max_ordinal {
2247                return Ok(());
2248            }
2249
2250            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2251            // are envelope_size bytes.
2252            let cur_offset: usize = (1 - 1) * envelope_size;
2253
2254            // Zero reserved fields.
2255            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2256
2257            // Safety:
2258            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2259            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2260            //   envelope_size bytes, there is always sufficient room.
2261            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_sysmem__common::ImageFormat2, D>(
2262            self.image_format.as_ref().map(<fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow),
2263            encoder, offset + cur_offset, depth
2264        )?;
2265
2266            _prev_end_offset = cur_offset + envelope_size;
2267            if 2 > max_ordinal {
2268                return Ok(());
2269            }
2270
2271            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2272            // are envelope_size bytes.
2273            let cur_offset: usize = (2 - 1) * envelope_size;
2274
2275            // Zero reserved fields.
2276            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2277
2278            // Safety:
2279            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2280            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2281            //   envelope_size bytes, there is always sufficient room.
2282            fidl::encoding::encode_in_envelope_optional::<FrameRate, D>(
2283                self.frame_rate
2284                    .as_ref()
2285                    .map(<FrameRate as fidl::encoding::ValueTypeMarker>::borrow),
2286                encoder,
2287                offset + cur_offset,
2288                depth,
2289            )?;
2290
2291            _prev_end_offset = cur_offset + envelope_size;
2292            if 3 > max_ordinal {
2293                return Ok(());
2294            }
2295
2296            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2297            // are envelope_size bytes.
2298            let cur_offset: usize = (3 - 1) * envelope_size;
2299
2300            // Zero reserved fields.
2301            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2302
2303            // Safety:
2304            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2305            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2306            //   envelope_size bytes, there is always sufficient room.
2307            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2308                self.supports_crop_region
2309                    .as_ref()
2310                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2311                encoder,
2312                offset + cur_offset,
2313                depth,
2314            )?;
2315
2316            _prev_end_offset = cur_offset + envelope_size;
2317            if 4 > max_ordinal {
2318                return Ok(());
2319            }
2320
2321            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2322            // are envelope_size bytes.
2323            let cur_offset: usize = (4 - 1) * envelope_size;
2324
2325            // Zero reserved fields.
2326            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2327
2328            // Safety:
2329            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2330            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2331            //   envelope_size bytes, there is always sufficient room.
2332            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256>, D>(
2333            self.supported_resolutions.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2334            encoder, offset + cur_offset, depth
2335        )?;
2336
2337            _prev_end_offset = cur_offset + envelope_size;
2338
2339            Ok(())
2340        }
2341    }
2342
2343    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties2 {
2344        #[inline(always)]
2345        fn new_empty() -> Self {
2346            Self::default()
2347        }
2348
2349        unsafe fn decode(
2350            &mut self,
2351            decoder: &mut fidl::encoding::Decoder<'_, D>,
2352            offset: usize,
2353            mut depth: fidl::encoding::Depth,
2354        ) -> fidl::Result<()> {
2355            decoder.debug_check_bounds::<Self>(offset);
2356            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2357                None => return Err(fidl::Error::NotNullable),
2358                Some(len) => len,
2359            };
2360            // Calling decoder.out_of_line_offset(0) is not allowed.
2361            if len == 0 {
2362                return Ok(());
2363            };
2364            depth.increment()?;
2365            let envelope_size = 8;
2366            let bytes_len = len * envelope_size;
2367            let offset = decoder.out_of_line_offset(bytes_len)?;
2368            // Decode the envelope for each type.
2369            let mut _next_ordinal_to_read = 0;
2370            let mut next_offset = offset;
2371            let end_offset = offset + bytes_len;
2372            _next_ordinal_to_read += 1;
2373            if next_offset >= end_offset {
2374                return Ok(());
2375            }
2376
2377            // Decode unknown envelopes for gaps in ordinals.
2378            while _next_ordinal_to_read < 1 {
2379                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2380                _next_ordinal_to_read += 1;
2381                next_offset += envelope_size;
2382            }
2383
2384            let next_out_of_line = decoder.next_out_of_line();
2385            let handles_before = decoder.remaining_handles();
2386            if let Some((inlined, num_bytes, num_handles)) =
2387                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2388            {
2389                let member_inline_size = <fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2390                if inlined != (member_inline_size <= 4) {
2391                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2392                }
2393                let inner_offset;
2394                let mut inner_depth = depth.clone();
2395                if inlined {
2396                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2397                    inner_offset = next_offset;
2398                } else {
2399                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2400                    inner_depth.increment()?;
2401                }
2402                let val_ref = self.image_format.get_or_insert_with(|| {
2403                    fidl::new_empty!(fidl_fuchsia_sysmem__common::ImageFormat2, D)
2404                });
2405                fidl::decode!(
2406                    fidl_fuchsia_sysmem__common::ImageFormat2,
2407                    D,
2408                    val_ref,
2409                    decoder,
2410                    inner_offset,
2411                    inner_depth
2412                )?;
2413                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2414                {
2415                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2416                }
2417                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2418                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2419                }
2420            }
2421
2422            next_offset += envelope_size;
2423            _next_ordinal_to_read += 1;
2424            if next_offset >= end_offset {
2425                return Ok(());
2426            }
2427
2428            // Decode unknown envelopes for gaps in ordinals.
2429            while _next_ordinal_to_read < 2 {
2430                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2431                _next_ordinal_to_read += 1;
2432                next_offset += envelope_size;
2433            }
2434
2435            let next_out_of_line = decoder.next_out_of_line();
2436            let handles_before = decoder.remaining_handles();
2437            if let Some((inlined, num_bytes, num_handles)) =
2438                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2439            {
2440                let member_inline_size =
2441                    <FrameRate as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2442                if inlined != (member_inline_size <= 4) {
2443                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2444                }
2445                let inner_offset;
2446                let mut inner_depth = depth.clone();
2447                if inlined {
2448                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2449                    inner_offset = next_offset;
2450                } else {
2451                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2452                    inner_depth.increment()?;
2453                }
2454                let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(FrameRate, D));
2455                fidl::decode!(FrameRate, D, val_ref, decoder, inner_offset, inner_depth)?;
2456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2457                {
2458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2459                }
2460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2462                }
2463            }
2464
2465            next_offset += envelope_size;
2466            _next_ordinal_to_read += 1;
2467            if next_offset >= end_offset {
2468                return Ok(());
2469            }
2470
2471            // Decode unknown envelopes for gaps in ordinals.
2472            while _next_ordinal_to_read < 3 {
2473                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2474                _next_ordinal_to_read += 1;
2475                next_offset += envelope_size;
2476            }
2477
2478            let next_out_of_line = decoder.next_out_of_line();
2479            let handles_before = decoder.remaining_handles();
2480            if let Some((inlined, num_bytes, num_handles)) =
2481                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2482            {
2483                let member_inline_size =
2484                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2485                if inlined != (member_inline_size <= 4) {
2486                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2487                }
2488                let inner_offset;
2489                let mut inner_depth = depth.clone();
2490                if inlined {
2491                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2492                    inner_offset = next_offset;
2493                } else {
2494                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2495                    inner_depth.increment()?;
2496                }
2497                let val_ref =
2498                    self.supports_crop_region.get_or_insert_with(|| fidl::new_empty!(bool, D));
2499                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2500                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2501                {
2502                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2503                }
2504                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2505                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2506                }
2507            }
2508
2509            next_offset += envelope_size;
2510            _next_ordinal_to_read += 1;
2511            if next_offset >= end_offset {
2512                return Ok(());
2513            }
2514
2515            // Decode unknown envelopes for gaps in ordinals.
2516            while _next_ordinal_to_read < 4 {
2517                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2518                _next_ordinal_to_read += 1;
2519                next_offset += envelope_size;
2520            }
2521
2522            let next_out_of_line = decoder.next_out_of_line();
2523            let handles_before = decoder.remaining_handles();
2524            if let Some((inlined, num_bytes, num_handles)) =
2525                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2526            {
2527                let member_inline_size = <fidl::encoding::Vector<
2528                    fidl_fuchsia_math__common::Size,
2529                    256,
2530                > as fidl::encoding::TypeMarker>::inline_size(
2531                    decoder.context
2532                );
2533                if inlined != (member_inline_size <= 4) {
2534                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2535                }
2536                let inner_offset;
2537                let mut inner_depth = depth.clone();
2538                if inlined {
2539                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2540                    inner_offset = next_offset;
2541                } else {
2542                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2543                    inner_depth.increment()?;
2544                }
2545                let val_ref =
2546                self.supported_resolutions.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256>, D));
2547                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2549                {
2550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2551                }
2552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2554                }
2555            }
2556
2557            next_offset += envelope_size;
2558
2559            // Decode the remaining unknown envelopes.
2560            while next_offset < end_offset {
2561                _next_ordinal_to_read += 1;
2562                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2563                next_offset += envelope_size;
2564            }
2565
2566            Ok(())
2567        }
2568    }
2569
2570    impl fidl::encoding::ValueTypeMarker for WatchDevicesEvent {
2571        type Borrowed<'a> = &'a Self;
2572        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2573            value
2574        }
2575    }
2576
2577    unsafe impl fidl::encoding::TypeMarker for WatchDevicesEvent {
2578        type Owned = Self;
2579
2580        #[inline(always)]
2581        fn inline_align(_context: fidl::encoding::Context) -> usize {
2582            8
2583        }
2584
2585        #[inline(always)]
2586        fn inline_size(_context: fidl::encoding::Context) -> usize {
2587            16
2588        }
2589    }
2590
2591    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchDevicesEvent, D>
2592        for &WatchDevicesEvent
2593    {
2594        #[inline]
2595        unsafe fn encode(
2596            self,
2597            encoder: &mut fidl::encoding::Encoder<'_, D>,
2598            offset: usize,
2599            _depth: fidl::encoding::Depth,
2600        ) -> fidl::Result<()> {
2601            encoder.debug_check_bounds::<WatchDevicesEvent>(offset);
2602            encoder.write_num::<u64>(self.ordinal(), offset);
2603            match self {
2604                WatchDevicesEvent::Existing(ref val) => {
2605                    fidl::encoding::encode_in_envelope::<u64, D>(
2606                        <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2607                        encoder,
2608                        offset + 8,
2609                        _depth,
2610                    )
2611                }
2612                WatchDevicesEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
2613                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2614                    encoder,
2615                    offset + 8,
2616                    _depth,
2617                ),
2618                WatchDevicesEvent::Removed(ref val) => {
2619                    fidl::encoding::encode_in_envelope::<u64, D>(
2620                        <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2621                        encoder,
2622                        offset + 8,
2623                        _depth,
2624                    )
2625                }
2626            }
2627        }
2628    }
2629
2630    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchDevicesEvent {
2631        #[inline(always)]
2632        fn new_empty() -> Self {
2633            Self::Existing(fidl::new_empty!(u64, D))
2634        }
2635
2636        #[inline]
2637        unsafe fn decode(
2638            &mut self,
2639            decoder: &mut fidl::encoding::Decoder<'_, D>,
2640            offset: usize,
2641            mut depth: fidl::encoding::Depth,
2642        ) -> fidl::Result<()> {
2643            decoder.debug_check_bounds::<Self>(offset);
2644            #[allow(unused_variables)]
2645            let next_out_of_line = decoder.next_out_of_line();
2646            let handles_before = decoder.remaining_handles();
2647            let (ordinal, inlined, num_bytes, num_handles) =
2648                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2649
2650            let member_inline_size = match ordinal {
2651                1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2652                2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2653                3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2654                _ => return Err(fidl::Error::UnknownUnionTag),
2655            };
2656
2657            if inlined != (member_inline_size <= 4) {
2658                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2659            }
2660            let _inner_offset;
2661            if inlined {
2662                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2663                _inner_offset = offset + 8;
2664            } else {
2665                depth.increment()?;
2666                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2667            }
2668            match ordinal {
2669                1 => {
2670                    #[allow(irrefutable_let_patterns)]
2671                    if let WatchDevicesEvent::Existing(_) = self {
2672                        // Do nothing, read the value into the object
2673                    } else {
2674                        // Initialize `self` to the right variant
2675                        *self = WatchDevicesEvent::Existing(fidl::new_empty!(u64, D));
2676                    }
2677                    #[allow(irrefutable_let_patterns)]
2678                    if let WatchDevicesEvent::Existing(ref mut val) = self {
2679                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2680                    } else {
2681                        unreachable!()
2682                    }
2683                }
2684                2 => {
2685                    #[allow(irrefutable_let_patterns)]
2686                    if let WatchDevicesEvent::Added(_) = self {
2687                        // Do nothing, read the value into the object
2688                    } else {
2689                        // Initialize `self` to the right variant
2690                        *self = WatchDevicesEvent::Added(fidl::new_empty!(u64, D));
2691                    }
2692                    #[allow(irrefutable_let_patterns)]
2693                    if let WatchDevicesEvent::Added(ref mut val) = self {
2694                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2695                    } else {
2696                        unreachable!()
2697                    }
2698                }
2699                3 => {
2700                    #[allow(irrefutable_let_patterns)]
2701                    if let WatchDevicesEvent::Removed(_) = self {
2702                        // Do nothing, read the value into the object
2703                    } else {
2704                        // Initialize `self` to the right variant
2705                        *self = WatchDevicesEvent::Removed(fidl::new_empty!(u64, D));
2706                    }
2707                    #[allow(irrefutable_let_patterns)]
2708                    if let WatchDevicesEvent::Removed(ref mut val) = self {
2709                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2710                    } else {
2711                        unreachable!()
2712                    }
2713                }
2714                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2715            }
2716            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2717                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2718            }
2719            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2720                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2721            }
2722            Ok(())
2723        }
2724    }
2725}