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