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<
1317        D: fidl::encoding::ResourceDialect,
1318        T0: fidl::encoding::Encode<StreamProperties2, D>,
1319    > fidl::encoding::Encode<StreamGetProperties2Response, D> for (T0,)
1320    {
1321        #[inline]
1322        unsafe fn encode(
1323            self,
1324            encoder: &mut fidl::encoding::Encoder<'_, D>,
1325            offset: usize,
1326            depth: fidl::encoding::Depth,
1327        ) -> fidl::Result<()> {
1328            encoder.debug_check_bounds::<StreamGetProperties2Response>(offset);
1329            // Zero out padding regions. There's no need to apply masks
1330            // because the unmasked parts will be overwritten by fields.
1331            // Write the fields.
1332            self.0.encode(encoder, offset + 0, depth)?;
1333            Ok(())
1334        }
1335    }
1336
1337    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1338        for StreamGetProperties2Response
1339    {
1340        #[inline(always)]
1341        fn new_empty() -> Self {
1342            Self { properties: fidl::new_empty!(StreamProperties2, D) }
1343        }
1344
1345        #[inline]
1346        unsafe fn decode(
1347            &mut self,
1348            decoder: &mut fidl::encoding::Decoder<'_, D>,
1349            offset: usize,
1350            _depth: fidl::encoding::Depth,
1351        ) -> fidl::Result<()> {
1352            decoder.debug_check_bounds::<Self>(offset);
1353            // Verify that padding bytes are zero.
1354            fidl::decode!(StreamProperties2, D, &mut self.properties, decoder, offset + 0, _depth)?;
1355            Ok(())
1356        }
1357    }
1358
1359    impl fidl::encoding::ValueTypeMarker for StreamGetPropertiesResponse {
1360        type Borrowed<'a> = &'a Self;
1361        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1362            value
1363        }
1364    }
1365
1366    unsafe impl fidl::encoding::TypeMarker for StreamGetPropertiesResponse {
1367        type Owned = Self;
1368
1369        #[inline(always)]
1370        fn inline_align(_context: fidl::encoding::Context) -> usize {
1371            8
1372        }
1373
1374        #[inline(always)]
1375        fn inline_size(_context: fidl::encoding::Context) -> usize {
1376            72
1377        }
1378    }
1379
1380    unsafe impl<D: fidl::encoding::ResourceDialect>
1381        fidl::encoding::Encode<StreamGetPropertiesResponse, D> for &StreamGetPropertiesResponse
1382    {
1383        #[inline]
1384        unsafe fn encode(
1385            self,
1386            encoder: &mut fidl::encoding::Encoder<'_, D>,
1387            offset: usize,
1388            _depth: fidl::encoding::Depth,
1389        ) -> fidl::Result<()> {
1390            encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1391            // Delegate to tuple encoding.
1392            fidl::encoding::Encode::<StreamGetPropertiesResponse, D>::encode(
1393                (<StreamProperties as fidl::encoding::ValueTypeMarker>::borrow(&self.properties),),
1394                encoder,
1395                offset,
1396                _depth,
1397            )
1398        }
1399    }
1400    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StreamProperties, D>>
1401        fidl::encoding::Encode<StreamGetPropertiesResponse, D> for (T0,)
1402    {
1403        #[inline]
1404        unsafe fn encode(
1405            self,
1406            encoder: &mut fidl::encoding::Encoder<'_, D>,
1407            offset: usize,
1408            depth: fidl::encoding::Depth,
1409        ) -> fidl::Result<()> {
1410            encoder.debug_check_bounds::<StreamGetPropertiesResponse>(offset);
1411            // Zero out padding regions. There's no need to apply masks
1412            // because the unmasked parts will be overwritten by fields.
1413            // Write the fields.
1414            self.0.encode(encoder, offset + 0, depth)?;
1415            Ok(())
1416        }
1417    }
1418
1419    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1420        for StreamGetPropertiesResponse
1421    {
1422        #[inline(always)]
1423        fn new_empty() -> Self {
1424            Self { properties: fidl::new_empty!(StreamProperties, D) }
1425        }
1426
1427        #[inline]
1428        unsafe fn decode(
1429            &mut self,
1430            decoder: &mut fidl::encoding::Decoder<'_, D>,
1431            offset: usize,
1432            _depth: fidl::encoding::Depth,
1433        ) -> fidl::Result<()> {
1434            decoder.debug_check_bounds::<Self>(offset);
1435            // Verify that padding bytes are zero.
1436            fidl::decode!(StreamProperties, D, &mut self.properties, decoder, offset + 0, _depth)?;
1437            Ok(())
1438        }
1439    }
1440
1441    impl fidl::encoding::ValueTypeMarker for StreamProperties {
1442        type Borrowed<'a> = &'a Self;
1443        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1444            value
1445        }
1446    }
1447
1448    unsafe impl fidl::encoding::TypeMarker for StreamProperties {
1449        type Owned = Self;
1450
1451        #[inline(always)]
1452        fn inline_align(_context: fidl::encoding::Context) -> usize {
1453            8
1454        }
1455
1456        #[inline(always)]
1457        fn inline_size(_context: fidl::encoding::Context) -> usize {
1458            72
1459        }
1460    }
1461
1462    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties, D>
1463        for &StreamProperties
1464    {
1465        #[inline]
1466        unsafe fn encode(
1467            self,
1468            encoder: &mut fidl::encoding::Encoder<'_, D>,
1469            offset: usize,
1470            _depth: fidl::encoding::Depth,
1471        ) -> fidl::Result<()> {
1472            encoder.debug_check_bounds::<StreamProperties>(offset);
1473            // Delegate to tuple encoding.
1474            fidl::encoding::Encode::<StreamProperties, D>::encode(
1475                (
1476                    <fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow(&self.image_format),
1477                    <FrameRate as fidl::encoding::ValueTypeMarker>::borrow(&self.frame_rate),
1478                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.supports_crop_region),
1479                ),
1480                encoder, offset, _depth
1481            )
1482        }
1483    }
1484    unsafe impl<
1485        D: fidl::encoding::ResourceDialect,
1486        T0: fidl::encoding::Encode<fidl_fuchsia_sysmem__common::ImageFormat2, D>,
1487        T1: fidl::encoding::Encode<FrameRate, D>,
1488        T2: fidl::encoding::Encode<bool, D>,
1489    > fidl::encoding::Encode<StreamProperties, D> for (T0, T1, T2)
1490    {
1491        #[inline]
1492        unsafe fn encode(
1493            self,
1494            encoder: &mut fidl::encoding::Encoder<'_, D>,
1495            offset: usize,
1496            depth: fidl::encoding::Depth,
1497        ) -> fidl::Result<()> {
1498            encoder.debug_check_bounds::<StreamProperties>(offset);
1499            // Zero out padding regions. There's no need to apply masks
1500            // because the unmasked parts will be overwritten by fields.
1501            unsafe {
1502                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(64);
1503                (ptr as *mut u64).write_unaligned(0);
1504            }
1505            // Write the fields.
1506            self.0.encode(encoder, offset + 0, depth)?;
1507            self.1.encode(encoder, offset + 56, depth)?;
1508            self.2.encode(encoder, offset + 64, depth)?;
1509            Ok(())
1510        }
1511    }
1512
1513    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties {
1514        #[inline(always)]
1515        fn new_empty() -> Self {
1516            Self {
1517                image_format: fidl::new_empty!(fidl_fuchsia_sysmem__common::ImageFormat2, D),
1518                frame_rate: fidl::new_empty!(FrameRate, D),
1519                supports_crop_region: fidl::new_empty!(bool, D),
1520            }
1521        }
1522
1523        #[inline]
1524        unsafe fn decode(
1525            &mut self,
1526            decoder: &mut fidl::encoding::Decoder<'_, D>,
1527            offset: usize,
1528            _depth: fidl::encoding::Depth,
1529        ) -> fidl::Result<()> {
1530            decoder.debug_check_bounds::<Self>(offset);
1531            // Verify that padding bytes are zero.
1532            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(64) };
1533            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1534            let mask = 0xffffffffffffff00u64;
1535            let maskedval = padval & mask;
1536            if maskedval != 0 {
1537                return Err(fidl::Error::NonZeroPadding {
1538                    padding_start: offset + 64 + ((mask as u64).trailing_zeros() / 8) as usize,
1539                });
1540            }
1541            fidl::decode!(
1542                fidl_fuchsia_sysmem__common::ImageFormat2,
1543                D,
1544                &mut self.image_format,
1545                decoder,
1546                offset + 0,
1547                _depth
1548            )?;
1549            fidl::decode!(FrameRate, D, &mut self.frame_rate, decoder, offset + 56, _depth)?;
1550            fidl::decode!(bool, D, &mut self.supports_crop_region, decoder, offset + 64, _depth)?;
1551            Ok(())
1552        }
1553    }
1554
1555    impl fidl::encoding::ValueTypeMarker for StreamSetCropRegionRequest {
1556        type Borrowed<'a> = &'a Self;
1557        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1558            value
1559        }
1560    }
1561
1562    unsafe impl fidl::encoding::TypeMarker for StreamSetCropRegionRequest {
1563        type Owned = Self;
1564
1565        #[inline(always)]
1566        fn inline_align(_context: fidl::encoding::Context) -> usize {
1567            8
1568        }
1569
1570        #[inline(always)]
1571        fn inline_size(_context: fidl::encoding::Context) -> usize {
1572            8
1573        }
1574    }
1575
1576    unsafe impl<D: fidl::encoding::ResourceDialect>
1577        fidl::encoding::Encode<StreamSetCropRegionRequest, D> for &StreamSetCropRegionRequest
1578    {
1579        #[inline]
1580        unsafe fn encode(
1581            self,
1582            encoder: &mut fidl::encoding::Encoder<'_, D>,
1583            offset: usize,
1584            _depth: fidl::encoding::Depth,
1585        ) -> fidl::Result<()> {
1586            encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1587            // Delegate to tuple encoding.
1588            fidl::encoding::Encode::<StreamSetCropRegionRequest, D>::encode(
1589                (
1590                    <fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1591                ),
1592                encoder, offset, _depth
1593            )
1594        }
1595    }
1596    unsafe impl<
1597        D: fidl::encoding::ResourceDialect,
1598        T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>, D>,
1599    > fidl::encoding::Encode<StreamSetCropRegionRequest, D> for (T0,)
1600    {
1601        #[inline]
1602        unsafe fn encode(
1603            self,
1604            encoder: &mut fidl::encoding::Encoder<'_, D>,
1605            offset: usize,
1606            depth: fidl::encoding::Depth,
1607        ) -> fidl::Result<()> {
1608            encoder.debug_check_bounds::<StreamSetCropRegionRequest>(offset);
1609            // Zero out padding regions. There's no need to apply masks
1610            // because the unmasked parts will be overwritten by fields.
1611            // Write the fields.
1612            self.0.encode(encoder, offset + 0, depth)?;
1613            Ok(())
1614        }
1615    }
1616
1617    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1618        for StreamSetCropRegionRequest
1619    {
1620        #[inline(always)]
1621        fn new_empty() -> Self {
1622            Self {
1623                region: fidl::new_empty!(
1624                    fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1625                    D
1626                ),
1627            }
1628        }
1629
1630        #[inline]
1631        unsafe fn decode(
1632            &mut self,
1633            decoder: &mut fidl::encoding::Decoder<'_, D>,
1634            offset: usize,
1635            _depth: fidl::encoding::Depth,
1636        ) -> fidl::Result<()> {
1637            decoder.debug_check_bounds::<Self>(offset);
1638            // Verify that padding bytes are zero.
1639            fidl::decode!(
1640                fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1641                D,
1642                &mut self.region,
1643                decoder,
1644                offset + 0,
1645                _depth
1646            )?;
1647            Ok(())
1648        }
1649    }
1650
1651    impl fidl::encoding::ValueTypeMarker for StreamSetResolutionRequest {
1652        type Borrowed<'a> = &'a Self;
1653        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1654            value
1655        }
1656    }
1657
1658    unsafe impl fidl::encoding::TypeMarker for StreamSetResolutionRequest {
1659        type Owned = Self;
1660
1661        #[inline(always)]
1662        fn inline_align(_context: fidl::encoding::Context) -> usize {
1663            4
1664        }
1665
1666        #[inline(always)]
1667        fn inline_size(_context: fidl::encoding::Context) -> usize {
1668            8
1669        }
1670    }
1671
1672    unsafe impl<D: fidl::encoding::ResourceDialect>
1673        fidl::encoding::Encode<StreamSetResolutionRequest, D> for &StreamSetResolutionRequest
1674    {
1675        #[inline]
1676        unsafe fn encode(
1677            self,
1678            encoder: &mut fidl::encoding::Encoder<'_, D>,
1679            offset: usize,
1680            _depth: fidl::encoding::Depth,
1681        ) -> fidl::Result<()> {
1682            encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1683            // Delegate to tuple encoding.
1684            fidl::encoding::Encode::<StreamSetResolutionRequest, D>::encode(
1685                (<fidl_fuchsia_math__common::Size as fidl::encoding::ValueTypeMarker>::borrow(
1686                    &self.coded_size,
1687                ),),
1688                encoder,
1689                offset,
1690                _depth,
1691            )
1692        }
1693    }
1694    unsafe impl<
1695        D: fidl::encoding::ResourceDialect,
1696        T0: fidl::encoding::Encode<fidl_fuchsia_math__common::Size, D>,
1697    > fidl::encoding::Encode<StreamSetResolutionRequest, D> for (T0,)
1698    {
1699        #[inline]
1700        unsafe fn encode(
1701            self,
1702            encoder: &mut fidl::encoding::Encoder<'_, D>,
1703            offset: usize,
1704            depth: fidl::encoding::Depth,
1705        ) -> fidl::Result<()> {
1706            encoder.debug_check_bounds::<StreamSetResolutionRequest>(offset);
1707            // Zero out padding regions. There's no need to apply masks
1708            // because the unmasked parts will be overwritten by fields.
1709            // Write the fields.
1710            self.0.encode(encoder, offset + 0, depth)?;
1711            Ok(())
1712        }
1713    }
1714
1715    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1716        for StreamSetResolutionRequest
1717    {
1718        #[inline(always)]
1719        fn new_empty() -> Self {
1720            Self { coded_size: fidl::new_empty!(fidl_fuchsia_math__common::Size, D) }
1721        }
1722
1723        #[inline]
1724        unsafe fn decode(
1725            &mut self,
1726            decoder: &mut fidl::encoding::Decoder<'_, D>,
1727            offset: usize,
1728            _depth: fidl::encoding::Depth,
1729        ) -> fidl::Result<()> {
1730            decoder.debug_check_bounds::<Self>(offset);
1731            // Verify that padding bytes are zero.
1732            fidl::decode!(
1733                fidl_fuchsia_math__common::Size,
1734                D,
1735                &mut self.coded_size,
1736                decoder,
1737                offset + 0,
1738                _depth
1739            )?;
1740            Ok(())
1741        }
1742    }
1743
1744    impl fidl::encoding::ValueTypeMarker for StreamWatchCropRegionResponse {
1745        type Borrowed<'a> = &'a Self;
1746        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1747            value
1748        }
1749    }
1750
1751    unsafe impl fidl::encoding::TypeMarker for StreamWatchCropRegionResponse {
1752        type Owned = Self;
1753
1754        #[inline(always)]
1755        fn inline_align(_context: fidl::encoding::Context) -> usize {
1756            8
1757        }
1758
1759        #[inline(always)]
1760        fn inline_size(_context: fidl::encoding::Context) -> usize {
1761            8
1762        }
1763    }
1764
1765    unsafe impl<D: fidl::encoding::ResourceDialect>
1766        fidl::encoding::Encode<StreamWatchCropRegionResponse, D>
1767        for &StreamWatchCropRegionResponse
1768    {
1769        #[inline]
1770        unsafe fn encode(
1771            self,
1772            encoder: &mut fidl::encoding::Encoder<'_, D>,
1773            offset: usize,
1774            _depth: fidl::encoding::Depth,
1775        ) -> fidl::Result<()> {
1776            encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1777            // Delegate to tuple encoding.
1778            fidl::encoding::Encode::<StreamWatchCropRegionResponse, D>::encode(
1779                (
1780                    <fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF> as fidl::encoding::ValueTypeMarker>::borrow(&self.region),
1781                ),
1782                encoder, offset, _depth
1783            )
1784        }
1785    }
1786    unsafe impl<
1787        D: fidl::encoding::ResourceDialect,
1788        T0: fidl::encoding::Encode<fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>, D>,
1789    > fidl::encoding::Encode<StreamWatchCropRegionResponse, D> for (T0,)
1790    {
1791        #[inline]
1792        unsafe fn encode(
1793            self,
1794            encoder: &mut fidl::encoding::Encoder<'_, D>,
1795            offset: usize,
1796            depth: fidl::encoding::Depth,
1797        ) -> fidl::Result<()> {
1798            encoder.debug_check_bounds::<StreamWatchCropRegionResponse>(offset);
1799            // Zero out padding regions. There's no need to apply masks
1800            // because the unmasked parts will be overwritten by fields.
1801            // Write the fields.
1802            self.0.encode(encoder, offset + 0, depth)?;
1803            Ok(())
1804        }
1805    }
1806
1807    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1808        for StreamWatchCropRegionResponse
1809    {
1810        #[inline(always)]
1811        fn new_empty() -> Self {
1812            Self {
1813                region: fidl::new_empty!(
1814                    fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1815                    D
1816                ),
1817            }
1818        }
1819
1820        #[inline]
1821        unsafe fn decode(
1822            &mut self,
1823            decoder: &mut fidl::encoding::Decoder<'_, D>,
1824            offset: usize,
1825            _depth: fidl::encoding::Depth,
1826        ) -> fidl::Result<()> {
1827            decoder.debug_check_bounds::<Self>(offset);
1828            // Verify that padding bytes are zero.
1829            fidl::decode!(
1830                fidl::encoding::Boxed<fidl_fuchsia_math__common::RectF>,
1831                D,
1832                &mut self.region,
1833                decoder,
1834                offset + 0,
1835                _depth
1836            )?;
1837            Ok(())
1838        }
1839    }
1840
1841    impl fidl::encoding::ValueTypeMarker for StreamWatchOrientationResponse {
1842        type Borrowed<'a> = &'a Self;
1843        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1844            value
1845        }
1846    }
1847
1848    unsafe impl fidl::encoding::TypeMarker for StreamWatchOrientationResponse {
1849        type Owned = Self;
1850
1851        #[inline(always)]
1852        fn inline_align(_context: fidl::encoding::Context) -> usize {
1853            4
1854        }
1855
1856        #[inline(always)]
1857        fn inline_size(_context: fidl::encoding::Context) -> usize {
1858            4
1859        }
1860    }
1861
1862    unsafe impl<D: fidl::encoding::ResourceDialect>
1863        fidl::encoding::Encode<StreamWatchOrientationResponse, D>
1864        for &StreamWatchOrientationResponse
1865    {
1866        #[inline]
1867        unsafe fn encode(
1868            self,
1869            encoder: &mut fidl::encoding::Encoder<'_, D>,
1870            offset: usize,
1871            _depth: fidl::encoding::Depth,
1872        ) -> fidl::Result<()> {
1873            encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1874            // Delegate to tuple encoding.
1875            fidl::encoding::Encode::<StreamWatchOrientationResponse, D>::encode(
1876                (<Orientation as fidl::encoding::ValueTypeMarker>::borrow(&self.orientation),),
1877                encoder,
1878                offset,
1879                _depth,
1880            )
1881        }
1882    }
1883    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Orientation, D>>
1884        fidl::encoding::Encode<StreamWatchOrientationResponse, D> for (T0,)
1885    {
1886        #[inline]
1887        unsafe fn encode(
1888            self,
1889            encoder: &mut fidl::encoding::Encoder<'_, D>,
1890            offset: usize,
1891            depth: fidl::encoding::Depth,
1892        ) -> fidl::Result<()> {
1893            encoder.debug_check_bounds::<StreamWatchOrientationResponse>(offset);
1894            // Zero out padding regions. There's no need to apply masks
1895            // because the unmasked parts will be overwritten by fields.
1896            // Write the fields.
1897            self.0.encode(encoder, offset + 0, depth)?;
1898            Ok(())
1899        }
1900    }
1901
1902    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1903        for StreamWatchOrientationResponse
1904    {
1905        #[inline(always)]
1906        fn new_empty() -> Self {
1907            Self { orientation: fidl::new_empty!(Orientation, D) }
1908        }
1909
1910        #[inline]
1911        unsafe fn decode(
1912            &mut self,
1913            decoder: &mut fidl::encoding::Decoder<'_, D>,
1914            offset: usize,
1915            _depth: fidl::encoding::Depth,
1916        ) -> fidl::Result<()> {
1917            decoder.debug_check_bounds::<Self>(offset);
1918            // Verify that padding bytes are zero.
1919            fidl::decode!(Orientation, D, &mut self.orientation, decoder, offset + 0, _depth)?;
1920            Ok(())
1921        }
1922    }
1923
1924    impl fidl::encoding::ValueTypeMarker for StreamWatchResolutionResponse {
1925        type Borrowed<'a> = &'a Self;
1926        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1927            value
1928        }
1929    }
1930
1931    unsafe impl fidl::encoding::TypeMarker for StreamWatchResolutionResponse {
1932        type Owned = Self;
1933
1934        #[inline(always)]
1935        fn inline_align(_context: fidl::encoding::Context) -> usize {
1936            4
1937        }
1938
1939        #[inline(always)]
1940        fn inline_size(_context: fidl::encoding::Context) -> usize {
1941            8
1942        }
1943    }
1944
1945    unsafe impl<D: fidl::encoding::ResourceDialect>
1946        fidl::encoding::Encode<StreamWatchResolutionResponse, D>
1947        for &StreamWatchResolutionResponse
1948    {
1949        #[inline]
1950        unsafe fn encode(
1951            self,
1952            encoder: &mut fidl::encoding::Encoder<'_, D>,
1953            offset: usize,
1954            _depth: fidl::encoding::Depth,
1955        ) -> fidl::Result<()> {
1956            encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1957            // Delegate to tuple encoding.
1958            fidl::encoding::Encode::<StreamWatchResolutionResponse, D>::encode(
1959                (<fidl_fuchsia_math__common::Size as fidl::encoding::ValueTypeMarker>::borrow(
1960                    &self.coded_size,
1961                ),),
1962                encoder,
1963                offset,
1964                _depth,
1965            )
1966        }
1967    }
1968    unsafe impl<
1969        D: fidl::encoding::ResourceDialect,
1970        T0: fidl::encoding::Encode<fidl_fuchsia_math__common::Size, D>,
1971    > fidl::encoding::Encode<StreamWatchResolutionResponse, D> for (T0,)
1972    {
1973        #[inline]
1974        unsafe fn encode(
1975            self,
1976            encoder: &mut fidl::encoding::Encoder<'_, D>,
1977            offset: usize,
1978            depth: fidl::encoding::Depth,
1979        ) -> fidl::Result<()> {
1980            encoder.debug_check_bounds::<StreamWatchResolutionResponse>(offset);
1981            // Zero out padding regions. There's no need to apply masks
1982            // because the unmasked parts will be overwritten by fields.
1983            // Write the fields.
1984            self.0.encode(encoder, offset + 0, depth)?;
1985            Ok(())
1986        }
1987    }
1988
1989    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1990        for StreamWatchResolutionResponse
1991    {
1992        #[inline(always)]
1993        fn new_empty() -> Self {
1994            Self { coded_size: fidl::new_empty!(fidl_fuchsia_math__common::Size, D) }
1995        }
1996
1997        #[inline]
1998        unsafe fn decode(
1999            &mut self,
2000            decoder: &mut fidl::encoding::Decoder<'_, D>,
2001            offset: usize,
2002            _depth: fidl::encoding::Depth,
2003        ) -> fidl::Result<()> {
2004            decoder.debug_check_bounds::<Self>(offset);
2005            // Verify that padding bytes are zero.
2006            fidl::decode!(
2007                fidl_fuchsia_math__common::Size,
2008                D,
2009                &mut self.coded_size,
2010                decoder,
2011                offset + 0,
2012                _depth
2013            )?;
2014            Ok(())
2015        }
2016    }
2017
2018    impl Configuration2 {
2019        #[inline(always)]
2020        fn max_ordinal_present(&self) -> u64 {
2021            if let Some(_) = self.streams {
2022                return 1;
2023            }
2024            0
2025        }
2026    }
2027
2028    impl fidl::encoding::ValueTypeMarker for Configuration2 {
2029        type Borrowed<'a> = &'a Self;
2030        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2031            value
2032        }
2033    }
2034
2035    unsafe impl fidl::encoding::TypeMarker for Configuration2 {
2036        type Owned = Self;
2037
2038        #[inline(always)]
2039        fn inline_align(_context: fidl::encoding::Context) -> usize {
2040            8
2041        }
2042
2043        #[inline(always)]
2044        fn inline_size(_context: fidl::encoding::Context) -> usize {
2045            16
2046        }
2047    }
2048
2049    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Configuration2, D>
2050        for &Configuration2
2051    {
2052        unsafe fn encode(
2053            self,
2054            encoder: &mut fidl::encoding::Encoder<'_, D>,
2055            offset: usize,
2056            mut depth: fidl::encoding::Depth,
2057        ) -> fidl::Result<()> {
2058            encoder.debug_check_bounds::<Configuration2>(offset);
2059            // Vector header
2060            let max_ordinal: u64 = self.max_ordinal_present();
2061            encoder.write_num(max_ordinal, offset);
2062            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2063            // Calling encoder.out_of_line_offset(0) is not allowed.
2064            if max_ordinal == 0 {
2065                return Ok(());
2066            }
2067            depth.increment()?;
2068            let envelope_size = 8;
2069            let bytes_len = max_ordinal as usize * envelope_size;
2070            #[allow(unused_variables)]
2071            let offset = encoder.out_of_line_offset(bytes_len);
2072            let mut _prev_end_offset: usize = 0;
2073            if 1 > max_ordinal {
2074                return Ok(());
2075            }
2076
2077            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2078            // are envelope_size bytes.
2079            let cur_offset: usize = (1 - 1) * envelope_size;
2080
2081            // Zero reserved fields.
2082            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2083
2084            // Safety:
2085            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2086            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2087            //   envelope_size bytes, there is always sufficient room.
2088            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<StreamProperties2, 256>, D>(
2089            self.streams.as_ref().map(<fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2090            encoder, offset + cur_offset, depth
2091        )?;
2092
2093            _prev_end_offset = cur_offset + envelope_size;
2094
2095            Ok(())
2096        }
2097    }
2098
2099    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Configuration2 {
2100        #[inline(always)]
2101        fn new_empty() -> Self {
2102            Self::default()
2103        }
2104
2105        unsafe fn decode(
2106            &mut self,
2107            decoder: &mut fidl::encoding::Decoder<'_, D>,
2108            offset: usize,
2109            mut depth: fidl::encoding::Depth,
2110        ) -> fidl::Result<()> {
2111            decoder.debug_check_bounds::<Self>(offset);
2112            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2113                None => return Err(fidl::Error::NotNullable),
2114                Some(len) => len,
2115            };
2116            // Calling decoder.out_of_line_offset(0) is not allowed.
2117            if len == 0 {
2118                return Ok(());
2119            };
2120            depth.increment()?;
2121            let envelope_size = 8;
2122            let bytes_len = len * envelope_size;
2123            let offset = decoder.out_of_line_offset(bytes_len)?;
2124            // Decode the envelope for each type.
2125            let mut _next_ordinal_to_read = 0;
2126            let mut next_offset = offset;
2127            let end_offset = offset + bytes_len;
2128            _next_ordinal_to_read += 1;
2129            if next_offset >= end_offset {
2130                return Ok(());
2131            }
2132
2133            // Decode unknown envelopes for gaps in ordinals.
2134            while _next_ordinal_to_read < 1 {
2135                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2136                _next_ordinal_to_read += 1;
2137                next_offset += envelope_size;
2138            }
2139
2140            let next_out_of_line = decoder.next_out_of_line();
2141            let handles_before = decoder.remaining_handles();
2142            if let Some((inlined, num_bytes, num_handles)) =
2143                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2144            {
2145                let member_inline_size = <fidl::encoding::Vector<StreamProperties2, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2146                if inlined != (member_inline_size <= 4) {
2147                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2148                }
2149                let inner_offset;
2150                let mut inner_depth = depth.clone();
2151                if inlined {
2152                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2153                    inner_offset = next_offset;
2154                } else {
2155                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2156                    inner_depth.increment()?;
2157                }
2158                let val_ref = self.streams.get_or_insert_with(
2159                    || fidl::new_empty!(fidl::encoding::Vector<StreamProperties2, 256>, D),
2160                );
2161                fidl::decode!(fidl::encoding::Vector<StreamProperties2, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2162                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2163                {
2164                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2165                }
2166                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2167                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2168                }
2169            }
2170
2171            next_offset += envelope_size;
2172
2173            // Decode the remaining unknown envelopes.
2174            while next_offset < end_offset {
2175                _next_ordinal_to_read += 1;
2176                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2177                next_offset += envelope_size;
2178            }
2179
2180            Ok(())
2181        }
2182    }
2183
2184    impl StreamProperties2 {
2185        #[inline(always)]
2186        fn max_ordinal_present(&self) -> u64 {
2187            if let Some(_) = self.supported_resolutions {
2188                return 4;
2189            }
2190            if let Some(_) = self.supports_crop_region {
2191                return 3;
2192            }
2193            if let Some(_) = self.frame_rate {
2194                return 2;
2195            }
2196            if let Some(_) = self.image_format {
2197                return 1;
2198            }
2199            0
2200        }
2201    }
2202
2203    impl fidl::encoding::ValueTypeMarker for StreamProperties2 {
2204        type Borrowed<'a> = &'a Self;
2205        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2206            value
2207        }
2208    }
2209
2210    unsafe impl fidl::encoding::TypeMarker for StreamProperties2 {
2211        type Owned = Self;
2212
2213        #[inline(always)]
2214        fn inline_align(_context: fidl::encoding::Context) -> usize {
2215            8
2216        }
2217
2218        #[inline(always)]
2219        fn inline_size(_context: fidl::encoding::Context) -> usize {
2220            16
2221        }
2222    }
2223
2224    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StreamProperties2, D>
2225        for &StreamProperties2
2226    {
2227        unsafe fn encode(
2228            self,
2229            encoder: &mut fidl::encoding::Encoder<'_, D>,
2230            offset: usize,
2231            mut depth: fidl::encoding::Depth,
2232        ) -> fidl::Result<()> {
2233            encoder.debug_check_bounds::<StreamProperties2>(offset);
2234            // Vector header
2235            let max_ordinal: u64 = self.max_ordinal_present();
2236            encoder.write_num(max_ordinal, offset);
2237            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2238            // Calling encoder.out_of_line_offset(0) is not allowed.
2239            if max_ordinal == 0 {
2240                return Ok(());
2241            }
2242            depth.increment()?;
2243            let envelope_size = 8;
2244            let bytes_len = max_ordinal as usize * envelope_size;
2245            #[allow(unused_variables)]
2246            let offset = encoder.out_of_line_offset(bytes_len);
2247            let mut _prev_end_offset: usize = 0;
2248            if 1 > max_ordinal {
2249                return Ok(());
2250            }
2251
2252            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2253            // are envelope_size bytes.
2254            let cur_offset: usize = (1 - 1) * envelope_size;
2255
2256            // Zero reserved fields.
2257            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2258
2259            // Safety:
2260            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2261            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2262            //   envelope_size bytes, there is always sufficient room.
2263            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_sysmem__common::ImageFormat2, D>(
2264            self.image_format.as_ref().map(<fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::ValueTypeMarker>::borrow),
2265            encoder, offset + cur_offset, depth
2266        )?;
2267
2268            _prev_end_offset = cur_offset + envelope_size;
2269            if 2 > max_ordinal {
2270                return Ok(());
2271            }
2272
2273            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2274            // are envelope_size bytes.
2275            let cur_offset: usize = (2 - 1) * envelope_size;
2276
2277            // Zero reserved fields.
2278            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2279
2280            // Safety:
2281            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2282            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2283            //   envelope_size bytes, there is always sufficient room.
2284            fidl::encoding::encode_in_envelope_optional::<FrameRate, D>(
2285                self.frame_rate
2286                    .as_ref()
2287                    .map(<FrameRate as fidl::encoding::ValueTypeMarker>::borrow),
2288                encoder,
2289                offset + cur_offset,
2290                depth,
2291            )?;
2292
2293            _prev_end_offset = cur_offset + envelope_size;
2294            if 3 > max_ordinal {
2295                return Ok(());
2296            }
2297
2298            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2299            // are envelope_size bytes.
2300            let cur_offset: usize = (3 - 1) * envelope_size;
2301
2302            // Zero reserved fields.
2303            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2304
2305            // Safety:
2306            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2307            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2308            //   envelope_size bytes, there is always sufficient room.
2309            fidl::encoding::encode_in_envelope_optional::<bool, D>(
2310                self.supports_crop_region
2311                    .as_ref()
2312                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2313                encoder,
2314                offset + cur_offset,
2315                depth,
2316            )?;
2317
2318            _prev_end_offset = cur_offset + envelope_size;
2319            if 4 > max_ordinal {
2320                return Ok(());
2321            }
2322
2323            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2324            // are envelope_size bytes.
2325            let cur_offset: usize = (4 - 1) * envelope_size;
2326
2327            // Zero reserved fields.
2328            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2329
2330            // Safety:
2331            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2332            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2333            //   envelope_size bytes, there is always sufficient room.
2334            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256>, D>(
2335            self.supported_resolutions.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256> as fidl::encoding::ValueTypeMarker>::borrow),
2336            encoder, offset + cur_offset, depth
2337        )?;
2338
2339            _prev_end_offset = cur_offset + envelope_size;
2340
2341            Ok(())
2342        }
2343    }
2344
2345    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StreamProperties2 {
2346        #[inline(always)]
2347        fn new_empty() -> Self {
2348            Self::default()
2349        }
2350
2351        unsafe fn decode(
2352            &mut self,
2353            decoder: &mut fidl::encoding::Decoder<'_, D>,
2354            offset: usize,
2355            mut depth: fidl::encoding::Depth,
2356        ) -> fidl::Result<()> {
2357            decoder.debug_check_bounds::<Self>(offset);
2358            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2359                None => return Err(fidl::Error::NotNullable),
2360                Some(len) => len,
2361            };
2362            // Calling decoder.out_of_line_offset(0) is not allowed.
2363            if len == 0 {
2364                return Ok(());
2365            };
2366            depth.increment()?;
2367            let envelope_size = 8;
2368            let bytes_len = len * envelope_size;
2369            let offset = decoder.out_of_line_offset(bytes_len)?;
2370            // Decode the envelope for each type.
2371            let mut _next_ordinal_to_read = 0;
2372            let mut next_offset = offset;
2373            let end_offset = offset + bytes_len;
2374            _next_ordinal_to_read += 1;
2375            if next_offset >= end_offset {
2376                return Ok(());
2377            }
2378
2379            // Decode unknown envelopes for gaps in ordinals.
2380            while _next_ordinal_to_read < 1 {
2381                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2382                _next_ordinal_to_read += 1;
2383                next_offset += envelope_size;
2384            }
2385
2386            let next_out_of_line = decoder.next_out_of_line();
2387            let handles_before = decoder.remaining_handles();
2388            if let Some((inlined, num_bytes, num_handles)) =
2389                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2390            {
2391                let member_inline_size = <fidl_fuchsia_sysmem__common::ImageFormat2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2392                if inlined != (member_inline_size <= 4) {
2393                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2394                }
2395                let inner_offset;
2396                let mut inner_depth = depth.clone();
2397                if inlined {
2398                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2399                    inner_offset = next_offset;
2400                } else {
2401                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2402                    inner_depth.increment()?;
2403                }
2404                let val_ref = self.image_format.get_or_insert_with(|| {
2405                    fidl::new_empty!(fidl_fuchsia_sysmem__common::ImageFormat2, D)
2406                });
2407                fidl::decode!(
2408                    fidl_fuchsia_sysmem__common::ImageFormat2,
2409                    D,
2410                    val_ref,
2411                    decoder,
2412                    inner_offset,
2413                    inner_depth
2414                )?;
2415                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2416                {
2417                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2418                }
2419                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2420                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2421                }
2422            }
2423
2424            next_offset += envelope_size;
2425            _next_ordinal_to_read += 1;
2426            if next_offset >= end_offset {
2427                return Ok(());
2428            }
2429
2430            // Decode unknown envelopes for gaps in ordinals.
2431            while _next_ordinal_to_read < 2 {
2432                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2433                _next_ordinal_to_read += 1;
2434                next_offset += envelope_size;
2435            }
2436
2437            let next_out_of_line = decoder.next_out_of_line();
2438            let handles_before = decoder.remaining_handles();
2439            if let Some((inlined, num_bytes, num_handles)) =
2440                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2441            {
2442                let member_inline_size =
2443                    <FrameRate as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2444                if inlined != (member_inline_size <= 4) {
2445                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2446                }
2447                let inner_offset;
2448                let mut inner_depth = depth.clone();
2449                if inlined {
2450                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2451                    inner_offset = next_offset;
2452                } else {
2453                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2454                    inner_depth.increment()?;
2455                }
2456                let val_ref = self.frame_rate.get_or_insert_with(|| fidl::new_empty!(FrameRate, D));
2457                fidl::decode!(FrameRate, D, val_ref, decoder, inner_offset, inner_depth)?;
2458                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2459                {
2460                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2461                }
2462                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2463                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2464                }
2465            }
2466
2467            next_offset += envelope_size;
2468            _next_ordinal_to_read += 1;
2469            if next_offset >= end_offset {
2470                return Ok(());
2471            }
2472
2473            // Decode unknown envelopes for gaps in ordinals.
2474            while _next_ordinal_to_read < 3 {
2475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2476                _next_ordinal_to_read += 1;
2477                next_offset += envelope_size;
2478            }
2479
2480            let next_out_of_line = decoder.next_out_of_line();
2481            let handles_before = decoder.remaining_handles();
2482            if let Some((inlined, num_bytes, num_handles)) =
2483                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2484            {
2485                let member_inline_size =
2486                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2487                if inlined != (member_inline_size <= 4) {
2488                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2489                }
2490                let inner_offset;
2491                let mut inner_depth = depth.clone();
2492                if inlined {
2493                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2494                    inner_offset = next_offset;
2495                } else {
2496                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2497                    inner_depth.increment()?;
2498                }
2499                let val_ref =
2500                    self.supports_crop_region.get_or_insert_with(|| fidl::new_empty!(bool, D));
2501                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2502                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2503                {
2504                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2505                }
2506                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2507                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2508                }
2509            }
2510
2511            next_offset += envelope_size;
2512            _next_ordinal_to_read += 1;
2513            if next_offset >= end_offset {
2514                return Ok(());
2515            }
2516
2517            // Decode unknown envelopes for gaps in ordinals.
2518            while _next_ordinal_to_read < 4 {
2519                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2520                _next_ordinal_to_read += 1;
2521                next_offset += envelope_size;
2522            }
2523
2524            let next_out_of_line = decoder.next_out_of_line();
2525            let handles_before = decoder.remaining_handles();
2526            if let Some((inlined, num_bytes, num_handles)) =
2527                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2528            {
2529                let member_inline_size = <fidl::encoding::Vector<
2530                    fidl_fuchsia_math__common::Size,
2531                    256,
2532                > as fidl::encoding::TypeMarker>::inline_size(
2533                    decoder.context
2534                );
2535                if inlined != (member_inline_size <= 4) {
2536                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2537                }
2538                let inner_offset;
2539                let mut inner_depth = depth.clone();
2540                if inlined {
2541                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2542                    inner_offset = next_offset;
2543                } else {
2544                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2545                    inner_depth.increment()?;
2546                }
2547                let val_ref =
2548                self.supported_resolutions.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256>, D));
2549                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math__common::Size, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
2550                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2551                {
2552                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2553                }
2554                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2555                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2556                }
2557            }
2558
2559            next_offset += envelope_size;
2560
2561            // Decode the remaining unknown envelopes.
2562            while next_offset < end_offset {
2563                _next_ordinal_to_read += 1;
2564                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2565                next_offset += envelope_size;
2566            }
2567
2568            Ok(())
2569        }
2570    }
2571
2572    impl fidl::encoding::ValueTypeMarker for WatchDevicesEvent {
2573        type Borrowed<'a> = &'a Self;
2574        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2575            value
2576        }
2577    }
2578
2579    unsafe impl fidl::encoding::TypeMarker for WatchDevicesEvent {
2580        type Owned = Self;
2581
2582        #[inline(always)]
2583        fn inline_align(_context: fidl::encoding::Context) -> usize {
2584            8
2585        }
2586
2587        #[inline(always)]
2588        fn inline_size(_context: fidl::encoding::Context) -> usize {
2589            16
2590        }
2591    }
2592
2593    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatchDevicesEvent, D>
2594        for &WatchDevicesEvent
2595    {
2596        #[inline]
2597        unsafe fn encode(
2598            self,
2599            encoder: &mut fidl::encoding::Encoder<'_, D>,
2600            offset: usize,
2601            _depth: fidl::encoding::Depth,
2602        ) -> fidl::Result<()> {
2603            encoder.debug_check_bounds::<WatchDevicesEvent>(offset);
2604            encoder.write_num::<u64>(self.ordinal(), offset);
2605            match self {
2606                WatchDevicesEvent::Existing(ref val) => {
2607                    fidl::encoding::encode_in_envelope::<u64, D>(
2608                        <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2609                        encoder,
2610                        offset + 8,
2611                        _depth,
2612                    )
2613                }
2614                WatchDevicesEvent::Added(ref val) => fidl::encoding::encode_in_envelope::<u64, D>(
2615                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2616                    encoder,
2617                    offset + 8,
2618                    _depth,
2619                ),
2620                WatchDevicesEvent::Removed(ref val) => {
2621                    fidl::encoding::encode_in_envelope::<u64, D>(
2622                        <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2623                        encoder,
2624                        offset + 8,
2625                        _depth,
2626                    )
2627                }
2628            }
2629        }
2630    }
2631
2632    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchDevicesEvent {
2633        #[inline(always)]
2634        fn new_empty() -> Self {
2635            Self::Existing(fidl::new_empty!(u64, D))
2636        }
2637
2638        #[inline]
2639        unsafe fn decode(
2640            &mut self,
2641            decoder: &mut fidl::encoding::Decoder<'_, D>,
2642            offset: usize,
2643            mut depth: fidl::encoding::Depth,
2644        ) -> fidl::Result<()> {
2645            decoder.debug_check_bounds::<Self>(offset);
2646            #[allow(unused_variables)]
2647            let next_out_of_line = decoder.next_out_of_line();
2648            let handles_before = decoder.remaining_handles();
2649            let (ordinal, inlined, num_bytes, num_handles) =
2650                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2651
2652            let member_inline_size = match ordinal {
2653                1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2654                2 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2655                3 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2656                _ => return Err(fidl::Error::UnknownUnionTag),
2657            };
2658
2659            if inlined != (member_inline_size <= 4) {
2660                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2661            }
2662            let _inner_offset;
2663            if inlined {
2664                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2665                _inner_offset = offset + 8;
2666            } else {
2667                depth.increment()?;
2668                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2669            }
2670            match ordinal {
2671                1 => {
2672                    #[allow(irrefutable_let_patterns)]
2673                    if let WatchDevicesEvent::Existing(_) = self {
2674                        // Do nothing, read the value into the object
2675                    } else {
2676                        // Initialize `self` to the right variant
2677                        *self = WatchDevicesEvent::Existing(fidl::new_empty!(u64, D));
2678                    }
2679                    #[allow(irrefutable_let_patterns)]
2680                    if let WatchDevicesEvent::Existing(ref mut val) = self {
2681                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2682                    } else {
2683                        unreachable!()
2684                    }
2685                }
2686                2 => {
2687                    #[allow(irrefutable_let_patterns)]
2688                    if let WatchDevicesEvent::Added(_) = self {
2689                        // Do nothing, read the value into the object
2690                    } else {
2691                        // Initialize `self` to the right variant
2692                        *self = WatchDevicesEvent::Added(fidl::new_empty!(u64, D));
2693                    }
2694                    #[allow(irrefutable_let_patterns)]
2695                    if let WatchDevicesEvent::Added(ref mut val) = self {
2696                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2697                    } else {
2698                        unreachable!()
2699                    }
2700                }
2701                3 => {
2702                    #[allow(irrefutable_let_patterns)]
2703                    if let WatchDevicesEvent::Removed(_) = self {
2704                        // Do nothing, read the value into the object
2705                    } else {
2706                        // Initialize `self` to the right variant
2707                        *self = WatchDevicesEvent::Removed(fidl::new_empty!(u64, D));
2708                    }
2709                    #[allow(irrefutable_let_patterns)]
2710                    if let WatchDevicesEvent::Removed(ref mut val) = self {
2711                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2712                    } else {
2713                        unreachable!()
2714                    }
2715                }
2716                ordinal => panic!("unexpected ordinal {:?}", ordinal),
2717            }
2718            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2719                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2720            }
2721            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2722                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2723            }
2724            Ok(())
2725        }
2726    }
2727}