fidl_fuchsia_settings_common/
fidl_fuchsia_settings_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_LIGHT_NAME_LENGTH: u8 = 32;
12
13bitflags! {
14    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
15    pub struct ConfigurationInterfaces: u32 {
16        const ETHERNET = 1;
17        const WIFI = 2;
18    }
19}
20
21impl ConfigurationInterfaces {}
22
23bitflags! {
24    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
25    pub struct ThemeMode: u32 {
26        /// Product can choose a theme based on ambient cues.
27        const AUTO = 1;
28    }
29}
30
31impl ThemeMode {}
32
33bitflags! {
34    /// A series of flags determining the state of an input device mute toggle.
35    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
36    pub struct ToggleStateFlags: u64 {
37        /// The input device exists and is neither muted nor disabled.
38        const AVAILABLE = 1;
39        /// The input device is being used.
40        const ACTIVE = 2;
41        /// The input device could be available if it was enabled, but it is muted.
42        const MUTED = 4;
43        /// The input device is permanently disabled, e.g. by policy.
44        const DISABLED = 8;
45        /// The state cannot be determined.
46        const ERROR = 16;
47    }
48}
49
50impl ToggleStateFlags {}
51
52/// The source of the volume settings. The volume is set according to the source.
53#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
54#[repr(u32)]
55pub enum AudioStreamSettingSource {
56    /// The volume is set by the user. When the `source` in AudioStreamSettings is
57    /// set to this, the audio volume is set to `user_volume`.
58    User = 0,
59    /// The system takes control of the volume. This is used when the system constantly
60    /// calculates and changes the volume. The volume is not stored for this source.
61    System = 1,
62    /// The system takes control of the volume. This is used when the system changes
63    /// the volume, but we still want to play feedback sounds for these changes. The
64    /// volume is not stored for this source.
65    SystemWithFeedback = 2,
66}
67
68impl AudioStreamSettingSource {
69    #[inline]
70    pub fn from_primitive(prim: u32) -> Option<Self> {
71        match prim {
72            0 => Some(Self::User),
73            1 => Some(Self::System),
74            2 => Some(Self::SystemWithFeedback),
75            _ => None,
76        }
77    }
78
79    #[inline]
80    pub const fn into_primitive(self) -> u32 {
81        self as u32
82    }
83}
84
85/// Font family groups for closed captions, specified by 47 CFR §79.102(k).
86#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
87#[repr(u32)]
88pub enum CaptionFontFamily {
89    Unknown = 0,
90    MonospacedSerif = 1,
91    ProportionalSerif = 2,
92    MonospacedSansSerif = 3,
93    ProportionalSansSerif = 4,
94    Casual = 5,
95    Cursive = 6,
96    SmallCapitals = 7,
97}
98
99impl CaptionFontFamily {
100    #[inline]
101    pub fn from_primitive(prim: u32) -> Option<Self> {
102        match prim {
103            0 => Some(Self::Unknown),
104            1 => Some(Self::MonospacedSerif),
105            2 => Some(Self::ProportionalSerif),
106            3 => Some(Self::MonospacedSansSerif),
107            4 => Some(Self::ProportionalSansSerif),
108            5 => Some(Self::Casual),
109            6 => Some(Self::Cursive),
110            7 => Some(Self::SmallCapitals),
111            _ => None,
112        }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        self as u32
118    }
119}
120
121#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
122#[repr(u32)]
123pub enum ColorBlindnessType {
124    /// No color blindness.
125    None = 0,
126    /// Red-green color blindness due to reduced sensitivity to red light.
127    Protanomaly = 1,
128    /// Red-green color blindness due to reduced sensitivity to green light.
129    Deuteranomaly = 2,
130    /// Blue-yellow color blindness. It is due to reduced sensitivity to blue
131    /// light.
132    Tritanomaly = 3,
133}
134
135impl ColorBlindnessType {
136    #[inline]
137    pub fn from_primitive(prim: u32) -> Option<Self> {
138        match prim {
139            0 => Some(Self::None),
140            1 => Some(Self::Protanomaly),
141            2 => Some(Self::Deuteranomaly),
142            3 => Some(Self::Tritanomaly),
143            _ => None,
144        }
145    }
146
147    #[inline]
148    pub const fn into_primitive(self) -> u32 {
149        self as u32
150    }
151}
152
153#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
154#[repr(u32)]
155pub enum DeviceStateSource {
156    Hardware = 1,
157    Software = 2,
158}
159
160impl DeviceStateSource {
161    #[inline]
162    pub fn from_primitive(prim: u32) -> Option<Self> {
163        match prim {
164            1 => Some(Self::Hardware),
165            2 => Some(Self::Software),
166            _ => None,
167        }
168    }
169
170    #[inline]
171    pub const fn into_primitive(self) -> u32 {
172        self as u32
173    }
174}
175
176#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
177#[repr(u32)]
178pub enum DeviceType {
179    Microphone = 1,
180    Camera = 2,
181}
182
183impl DeviceType {
184    #[inline]
185    pub fn from_primitive(prim: u32) -> Option<Self> {
186        match prim {
187            1 => Some(Self::Microphone),
188            2 => Some(Self::Camera),
189            _ => None,
190        }
191    }
192
193    #[inline]
194    pub const fn into_primitive(self) -> u32 {
195        self as u32
196    }
197}
198
199/// Edge style for fonts as specified in 47 CFR §79.103(c)(7)
200#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
201#[repr(u32)]
202pub enum EdgeStyle {
203    /// No border around fonts.
204    None = 0,
205    /// A shadow "behind" and slightly offset from each edge.
206    DropShadow = 1,
207    /// A bevel that mimics a 3D raised effect.
208    Raised = 2,
209    /// A bevel that mimics a 3D depressed effect.
210    Depressed = 3,
211    /// A plain border around each shapes.
212    Outline = 4,
213}
214
215impl EdgeStyle {
216    #[inline]
217    pub fn from_primitive(prim: u32) -> Option<Self> {
218        match prim {
219            0 => Some(Self::None),
220            1 => Some(Self::DropShadow),
221            2 => Some(Self::Raised),
222            3 => Some(Self::Depressed),
223            4 => Some(Self::Outline),
224            _ => None,
225        }
226    }
227
228    #[inline]
229    pub const fn into_primitive(self) -> u32 {
230        self as u32
231    }
232}
233
234/// Common error code used across different settings.
235#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
236#[repr(u32)]
237pub enum Error {
238    Failed = 1,
239    Unsupported = 2,
240}
241
242impl Error {
243    #[inline]
244    pub fn from_primitive(prim: u32) -> Option<Self> {
245        match prim {
246            1 => Some(Self::Failed),
247            2 => Some(Self::Unsupported),
248            _ => None,
249        }
250    }
251
252    #[inline]
253    pub const fn into_primitive(self) -> u32 {
254        self as u32
255    }
256}
257
258/// Whether if the time format should be using 12 hour or 24 hour clock. H indicates the
259/// maximum number that the hour indicator will ever show.
260#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
261#[repr(u32)]
262pub enum HourCycle {
263    Unknown = 0,
264    /// 12-hour clock, 0:10am after midnight.
265    H11 = 1,
266    /// 12-hour clock, 12:10am after midnight.
267    H12 = 2,
268    /// 24-hour clock, 0:10 after midnight.
269    H23 = 3,
270    /// 24-hour clock, 24:10 after midnight.
271    H24 = 4,
272}
273
274impl HourCycle {
275    #[inline]
276    pub fn from_primitive(prim: u32) -> Option<Self> {
277        match prim {
278            0 => Some(Self::Unknown),
279            1 => Some(Self::H11),
280            2 => Some(Self::H12),
281            3 => Some(Self::H23),
282            4 => Some(Self::H24),
283            _ => None,
284        }
285    }
286
287    #[inline]
288    pub const fn into_primitive(self) -> u32 {
289        self as u32
290    }
291}
292
293#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
294#[repr(u32)]
295pub enum LightError {
296    /// Call failed for unspecified reasons.
297    Failed = 1,
298    /// Call not supported, this setting may not be present on this .
299    Unsupported = 2,
300    /// An invalid/unknown light group name was provided.
301    InvalidName = 3,
302    /// An invalid LightValue was provided that did not match the light group's
303    /// LightType or did not match the requirements for the value type.
304    InvalidValue = 4,
305}
306
307impl LightError {
308    #[inline]
309    pub fn from_primitive(prim: u32) -> Option<Self> {
310        match prim {
311            1 => Some(Self::Failed),
312            2 => Some(Self::Unsupported),
313            3 => Some(Self::InvalidName),
314            4 => Some(Self::InvalidValue),
315            _ => None,
316        }
317    }
318
319    #[inline]
320    pub const fn into_primitive(self) -> u32 {
321        self as u32
322    }
323}
324
325/// Enum describing the possible types of values for controlling a light.
326#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
327#[repr(u32)]
328pub enum LightType {
329    /// This type of light supports setting brightness to a uint8_t value.
330    Brightness = 1,
331    /// This type of light supports setting an RGB value.
332    Rgb = 2,
333    /// Light can only be turned on or off.
334    Simple = 3,
335}
336
337impl LightType {
338    #[inline]
339    pub fn from_primitive(prim: u32) -> Option<Self> {
340        match prim {
341            1 => Some(Self::Brightness),
342            2 => Some(Self::Rgb),
343            3 => Some(Self::Simple),
344            _ => None,
345        }
346    }
347
348    #[inline]
349    pub const fn into_primitive(self) -> u32 {
350        self as u32
351    }
352}
353
354#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
355#[repr(u32)]
356pub enum LowLightMode {
357    /// Device should not be in low-light mode.
358    Disable = 0,
359    /// Device should not be in low-light mode and should transition
360    /// out of it immediately.
361    DisableImmediately = 1,
362    /// Device should be in low-light mode.
363    Enable = 2,
364}
365
366impl LowLightMode {
367    #[inline]
368    pub fn from_primitive(prim: u32) -> Option<Self> {
369        match prim {
370            0 => Some(Self::Disable),
371            1 => Some(Self::DisableImmediately),
372            2 => Some(Self::Enable),
373            _ => None,
374        }
375    }
376
377    #[inline]
378    pub const fn into_primitive(self) -> u32 {
379        self as u32
380    }
381}
382
383/// Common epitaph messages used across different settings.
384#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
385#[repr(u32)]
386pub enum SettingsEpitaph {
387    RequestNotSupported = 1,
388    InternalServiceError = 2,
389    PersistentStorageError = 3,
390    FileReadError = 4,
391}
392
393impl SettingsEpitaph {
394    #[inline]
395    pub fn from_primitive(prim: u32) -> Option<Self> {
396        match prim {
397            1 => Some(Self::RequestNotSupported),
398            2 => Some(Self::InternalServiceError),
399            3 => Some(Self::PersistentStorageError),
400            4 => Some(Self::FileReadError),
401            _ => None,
402        }
403    }
404
405    #[inline]
406    pub const fn into_primitive(self) -> u32 {
407        self as u32
408    }
409}
410
411#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
412#[repr(u32)]
413pub enum ThemeType {
414    /// When `ThemeType` is set to `DEFAULT` it is up to the specific
415    /// [product](https://fuchsia.dev/fuchsia-src/concepts/build_system/boards_and_products#products)
416    /// to determine what that actually means.
417    Default = 0,
418    Light = 1,
419    Dark = 2,
420}
421
422impl ThemeType {
423    #[inline]
424    pub fn from_primitive(prim: u32) -> Option<Self> {
425        match prim {
426            0 => Some(Self::Default),
427            1 => Some(Self::Light),
428            2 => Some(Self::Dark),
429            _ => None,
430        }
431    }
432
433    #[inline]
434    pub const fn into_primitive(self) -> u32 {
435        self as u32
436    }
437}
438
439#[derive(Clone, Debug, PartialEq)]
440pub struct AccessibilitySetRequest {
441    pub settings: AccessibilitySettings,
442}
443
444impl fidl::Persistable for AccessibilitySetRequest {}
445
446#[derive(Clone, Debug, PartialEq)]
447pub struct AccessibilityWatchResponse {
448    pub settings: AccessibilitySettings,
449}
450
451impl fidl::Persistable for AccessibilityWatchResponse {}
452
453#[derive(Clone, Debug, PartialEq)]
454pub struct AudioSet2Request {
455    pub settings: AudioSettings2,
456}
457
458impl fidl::Persistable for AudioSet2Request {}
459
460#[derive(Clone, Debug, PartialEq)]
461pub struct AudioSetRequest {
462    pub settings: AudioSettings,
463}
464
465impl fidl::Persistable for AudioSetRequest {}
466
467#[derive(Clone, Debug, PartialEq)]
468pub struct AudioWatchResponse {
469    pub settings: AudioSettings,
470}
471
472impl fidl::Persistable for AudioWatchResponse {}
473
474#[derive(Clone, Debug, PartialEq)]
475pub struct AudioWatch2Response {
476    pub settings: AudioSettings2,
477}
478
479impl fidl::Persistable for AudioWatch2Response {}
480
481#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
482#[repr(C)]
483pub struct Autorepeat {
484    /// The duration between key actuation and autorepeat actuation.
485    pub delay: i64,
486    /// The duration between two successive autorepeat actuations (1/rate). Rate is defined as
487    /// once the autorepeat kicks in, the frequency at which repeated key actuations are
488    /// generated per second.
489    pub period: i64,
490}
491
492impl fidl::Persistable for Autorepeat {}
493
494#[derive(Clone, Debug, PartialEq)]
495pub struct DisplaySetRequest {
496    pub settings: DisplaySettings,
497}
498
499impl fidl::Persistable for DisplaySetRequest {}
500
501#[derive(Clone, Debug, PartialEq)]
502pub struct DisplayWatchResponse {
503    pub settings: DisplaySettings,
504}
505
506impl fidl::Persistable for DisplayWatchResponse {}
507
508#[derive(Clone, Debug, PartialEq)]
509pub struct DoNotDisturbSetRequest {
510    pub settings: DoNotDisturbSettings,
511}
512
513impl fidl::Persistable for DoNotDisturbSetRequest {}
514
515#[derive(Clone, Debug, PartialEq)]
516pub struct DoNotDisturbWatchResponse {
517    pub settings: DoNotDisturbSettings,
518}
519
520impl fidl::Persistable for DoNotDisturbWatchResponse {}
521
522#[derive(Clone, Debug, PartialEq)]
523pub struct FactoryResetSetRequest {
524    pub settings: FactoryResetSettings,
525}
526
527impl fidl::Persistable for FactoryResetSetRequest {}
528
529#[derive(Clone, Debug, PartialEq)]
530pub struct FactoryResetWatchResponse {
531    pub settings: FactoryResetSettings,
532}
533
534impl fidl::Persistable for FactoryResetWatchResponse {}
535
536#[derive(Clone, Debug, PartialEq)]
537pub struct InputSetRequest {
538    pub input_states: Vec<InputState>,
539}
540
541impl fidl::Persistable for InputSetRequest {}
542
543#[derive(Clone, Debug, PartialEq)]
544pub struct InputWatchResponse {
545    pub settings: InputSettings,
546}
547
548impl fidl::Persistable for InputWatchResponse {}
549
550#[derive(Clone, Debug, PartialEq)]
551pub struct IntlSetRequest {
552    pub settings: IntlSettings,
553}
554
555impl fidl::Persistable for IntlSetRequest {}
556
557#[derive(Clone, Debug, PartialEq)]
558pub struct IntlWatchResponse {
559    pub settings: IntlSettings,
560}
561
562impl fidl::Persistable for IntlWatchResponse {}
563
564#[derive(Clone, Debug, PartialEq)]
565pub struct KeyboardSetSetRequest {
566    pub settings: KeyboardSettings,
567}
568
569impl fidl::Persistable for KeyboardSetSetRequest {}
570
571#[derive(Clone, Debug, PartialEq)]
572pub struct KeyboardWatchWatchResponse {
573    pub settings: KeyboardSettings,
574}
575
576impl fidl::Persistable for KeyboardWatchWatchResponse {}
577
578#[derive(Clone, Debug, PartialEq)]
579pub struct LightSetLightGroupValuesRequest {
580    pub name: String,
581    pub state: Vec<LightState>,
582}
583
584impl fidl::Persistable for LightSetLightGroupValuesRequest {}
585
586#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
587pub struct LightWatchLightGroupRequest {
588    pub name: String,
589}
590
591impl fidl::Persistable for LightWatchLightGroupRequest {}
592
593#[derive(Clone, Debug, PartialEq)]
594pub struct LightWatchLightGroupResponse {
595    pub group: LightGroup,
596}
597
598impl fidl::Persistable for LightWatchLightGroupResponse {}
599
600#[derive(Clone, Debug, PartialEq)]
601pub struct LightWatchLightGroupsResponse {
602    pub groups: Vec<LightGroup>,
603}
604
605impl fidl::Persistable for LightWatchLightGroupsResponse {}
606
607#[derive(Clone, Debug, PartialEq)]
608pub struct NightModeSetRequest {
609    pub settings: NightModeSettings,
610}
611
612impl fidl::Persistable for NightModeSetRequest {}
613
614#[derive(Clone, Debug, PartialEq)]
615pub struct NightModeWatchResponse {
616    pub settings: NightModeSettings,
617}
618
619impl fidl::Persistable for NightModeWatchResponse {}
620
621#[derive(Clone, Debug, PartialEq)]
622pub struct PrivacySetRequest {
623    pub settings: PrivacySettings,
624}
625
626impl fidl::Persistable for PrivacySetRequest {}
627
628#[derive(Clone, Debug, PartialEq)]
629pub struct PrivacyWatchResponse {
630    pub settings: PrivacySettings,
631}
632
633impl fidl::Persistable for PrivacyWatchResponse {}
634
635#[derive(Clone, Debug, PartialEq)]
636pub struct SetupSetRequest {
637    pub settings: SetupSettings,
638    pub reboot_device: bool,
639}
640
641impl fidl::Persistable for SetupSetRequest {}
642
643#[derive(Clone, Debug, PartialEq)]
644pub struct SetupWatchResponse {
645    pub settings: SetupSettings,
646}
647
648impl fidl::Persistable for SetupWatchResponse {}
649
650/// Supported accessibility settings.
651#[derive(Clone, Debug, Default, PartialEq)]
652pub struct AccessibilitySettings {
653    /// For videos, use an alternative audio track (akin to changing languages)
654    /// that explains what is happening visually while there is no dialogue.
655    pub audio_description: Option<bool>,
656    /// Read aloud elements of the screen selected by the user.
657    pub screen_reader: Option<bool>,
658    /// Invert colors on the screen.
659    pub color_inversion: Option<bool>,
660    /// Interpret triple-tap on the touchscreen as a command to zoom in.
661    pub enable_magnification: Option<bool>,
662    /// What type of color-blindness, if any, to correct for.
663    pub color_correction: Option<ColorBlindnessType>,
664    /// What kind of sources get closed captions, and how they look.
665    pub captions_settings: Option<CaptionsSettings>,
666    #[doc(hidden)]
667    pub __source_breaking: fidl::marker::SourceBreaking,
668}
669
670impl fidl::Persistable for AccessibilitySettings {}
671
672#[derive(Clone, Debug, Default, PartialEq)]
673pub struct AudioSettings {
674    /// Contains the volume setting for 'legacy' audio stream settings (those in AudioRenderUsage).
675    /// There should only be one AudioStreamSettings for each fuchsia.media.AudioRenderUsage.
676    pub streams: Option<Vec<AudioStreamSettings>>,
677    #[doc(hidden)]
678    pub __source_breaking: fidl::marker::SourceBreaking,
679}
680
681impl fidl::Persistable for AudioSettings {}
682
683#[derive(Clone, Debug, Default, PartialEq)]
684pub struct AudioSettings2 {
685    /// Contains the volume setting for all audio stream settings. There should only be
686    /// one AudioStreamSettings for each fuchsia.media.AudioRenderUsage2.
687    pub streams: Option<Vec<AudioStreamSettings2>>,
688    #[doc(hidden)]
689    pub __source_breaking: fidl::marker::SourceBreaking,
690}
691
692impl fidl::Persistable for AudioSettings2 {}
693
694#[derive(Clone, Debug, Default, PartialEq)]
695pub struct AudioStreamSettings {
696    /// The audio stream which the settings are applying to.
697    pub stream: Option<fidl_fuchsia_media::AudioRenderUsage>,
698    /// The volume of `stream` is set according to the volume settings from `source`.
699    pub source: Option<AudioStreamSettingSource>,
700    /// User level volume setting. If the `source` is USER, then the volume is set to
701    /// `user_volume`.
702    pub user_volume: Option<Volume>,
703    #[doc(hidden)]
704    pub __source_breaking: fidl::marker::SourceBreaking,
705}
706
707impl fidl::Persistable for AudioStreamSettings {}
708
709#[derive(Clone, Debug, Default, PartialEq)]
710pub struct AudioStreamSettings2 {
711    /// The audio stream which the settings are applying to.
712    pub stream: Option<fidl_fuchsia_media::AudioRenderUsage2>,
713    /// The volume of `stream` is set according to the volume settings from `source`.
714    pub source: Option<AudioStreamSettingSource>,
715    /// User level volume setting. If the `source` is USER, then the volume is set to
716    /// `user_volume`.
717    pub user_volume: Option<Volume>,
718    #[doc(hidden)]
719    pub __source_breaking: fidl::marker::SourceBreaking,
720}
721
722impl fidl::Persistable for AudioStreamSettings2 {}
723
724/// Font, size, and color of closed captions text.
725#[derive(Clone, Debug, Default, PartialEq)]
726pub struct CaptionFontStyle {
727    pub family: Option<CaptionFontFamily>,
728    /// 47 CFR §79.103(c)(2) requires at least 3-bit RGB for user override of
729    /// closed-captions color.
730    ///
731    /// Each color channel should be a finite number otherwise will cause
732    /// SetAccessibilityInfo to fail with INVALID_VALUE.
733    pub color: Option<fidl_fuchsia_ui_types::ColorRgba>,
734    /// Size of closed captions text relative to the default captions size. A
735    /// range of [0.5, 2] is guaranteed to be supported (as 47 CFR §79.103(c)(4)
736    /// establishes). Size should be a finite number.
737    pub relative_size: Option<f32>,
738    pub char_edge_style: Option<EdgeStyle>,
739    #[doc(hidden)]
740    pub __source_breaking: fidl::marker::SourceBreaking,
741}
742
743impl fidl::Persistable for CaptionFontStyle {}
744
745/// What kind of sources get closed captions, and how they look.
746#[derive(Clone, Debug, Default, PartialEq)]
747pub struct CaptionsSettings {
748    /// Closed captions enabled for media sources of audio.
749    pub for_media: Option<bool>,
750    /// Closed captions enabled for Text-To-Speech sources of audio.
751    pub for_tts: Option<bool>,
752    /// Font style and color used for the closed captions text.
753    pub font_style: Option<CaptionFontStyle>,
754    /// Border color used around the closed captions window.
755    ///
756    /// Each color channel should be a finite number otherwise will cause
757    /// SetAccessibilityInfo to fail with INVALID_VALUE.
758    pub window_color: Option<fidl_fuchsia_ui_types::ColorRgba>,
759    /// Background color of the closed captions window.
760    ///
761    /// Each color channel should be a finite number otherwise will cause
762    /// SetAccessibilityInfo to fail with INVALID_VALUE.
763    pub background_color: Option<fidl_fuchsia_ui_types::ColorRgba>,
764    #[doc(hidden)]
765    pub __source_breaking: fidl::marker::SourceBreaking,
766}
767
768impl fidl::Persistable for CaptionsSettings {}
769
770/// Holds the state for an |InputDevice|.
771#[derive(Clone, Debug, Default, PartialEq)]
772pub struct DeviceState {
773    /// Controls the on/off state of the input device.
774    pub toggle_flags: Option<ToggleStateFlags>,
775    #[doc(hidden)]
776    pub __source_breaking: fidl::marker::SourceBreaking,
777}
778
779impl fidl::Persistable for DeviceState {}
780
781/// DisplaySettings are used to determine the output state of the display.
782/// The display can be toggled between two modes, auto-brightness on and
783/// auto-brightness off.
784///
785/// Adjusted_auto_brightness is used to set a specific brightness level for the
786/// current lighting conditions. Auto-brightness will continue to make the
787/// screen darker and brighter as the surrounding light changes.
788///
789/// Brightness_value is used in manual mode to set a specific brightness level
790/// for the screen. This level will be maintained while in manual mode.
791#[derive(Clone, Debug, Default, PartialEq)]
792pub struct DisplaySettings {
793    /// Auto brightness enabled.
794    pub auto_brightness: Option<bool>,
795    /// Manually set brightness value [0.0 - 1.0]. Not a number, infinity or
796    /// negative infinity will cause SetDisplayInfo to fail with INVALID_VALUE.
797    pub brightness_value: Option<f32>,
798    /// The low light mode state of the device.
799    pub low_light_mode: Option<LowLightMode>,
800    /// Whether the screen is enabled.
801    pub screen_enabled: Option<bool>,
802    /// Theme to be used for the device's user interface.
803    pub theme: Option<Theme>,
804    /// Brightness value to adjust auto-brightness to [0.0 - 1.0].
805    pub adjusted_auto_brightness: Option<f32>,
806    #[doc(hidden)]
807    pub __source_breaking: fidl::marker::SourceBreaking,
808}
809
810impl fidl::Persistable for DisplaySettings {}
811
812/// Settings related to do-not-disturb (DND) mode.
813#[derive(Clone, Debug, Default, PartialEq)]
814pub struct DoNotDisturbSettings {
815    /// If true, the device is in do-not-disturb (DND) mode. Change this value
816    /// if you're directly responding to a user-initiated event.
817    ///
818    /// Note that the device could still be in DND mode even if this is set to
819    /// `false`, as [`night_mode_initiated_do_not_disturb`] might be `true`. To
820    /// actually disable DND mode, set both fields to `false`.
821    ///
822    /// To know whether DND is enabled, you need to do a boolean OR of both
823    /// fields.
824    pub user_initiated_do_not_disturb: Option<bool>,
825    /// If true, the device is in do-not-disturb (DND) mode. Change this value
826    /// if you're trying to enable or disable DND based on a nightly schedule.
827    ///
828    /// Note that the device could still be in DND mode even if this is set to
829    /// `false`, as [`user_initiated_do_not_disturb`] might be `true`. Do not
830    /// set that field to `false` unless you're directly responding to a
831    /// user-initiated event.
832    ///
833    /// To know whether DND is enabled, you need to do a boolean OR of both
834    /// fields.
835    pub night_mode_initiated_do_not_disturb: Option<bool>,
836    #[doc(hidden)]
837    pub __source_breaking: fidl::marker::SourceBreaking,
838}
839
840impl fidl::Persistable for DoNotDisturbSettings {}
841
842/// Information about the factory reset settings.
843#[derive(Clone, Debug, Default, PartialEq)]
844pub struct FactoryResetSettings {
845    /// When set to true, a user is able to physically perform a factory reset.
846    /// When false, that functionality is disabled.
847    pub is_local_reset_allowed: Option<bool>,
848    #[doc(hidden)]
849    pub __source_breaking: fidl::marker::SourceBreaking,
850}
851
852impl fidl::Persistable for FactoryResetSettings {}
853
854/// Contains the information for an input device. The device is uniquely identified
855/// by the combination of device_name and device_type.
856#[derive(Clone, Debug, Default, PartialEq)]
857pub struct InputDevice {
858    /// Uniquely identifies a device within a device type.
859    pub device_name: Option<String>,
860    /// The type of input device (e.g. camera, microphone).
861    pub device_type: Option<DeviceType>,
862    /// The state for each individual [DeviceStateSource].
863    pub source_states: Option<Vec<SourceState>>,
864    /// The software toggle states which are allowed to be changed for a device.
865    pub mutable_toggle_state: Option<ToggleStateFlags>,
866    /// The overall state of the device, considering the combination
867    /// of the source states.
868    pub state: Option<DeviceState>,
869    #[doc(hidden)]
870    pub __source_breaking: fidl::marker::SourceBreaking,
871}
872
873impl fidl::Persistable for InputDevice {}
874
875/// Settings related to device input. New format for InputDeviceSettings.
876///
877/// InputSettings contains a list of input devices, e.g. Microphone and Camera
878/// devices. There may be multiple devices of each type. If so, they will be
879/// differentiated by the device_name. If there is only one device of a certain
880/// [DeviceType], then the name defaults to the same as the device type, e.g.
881/// DeviceType::Microphone -> "microphone".
882#[derive(Clone, Debug, Default, PartialEq)]
883pub struct InputSettings {
884    pub devices: Option<Vec<InputDevice>>,
885    #[doc(hidden)]
886    pub __source_breaking: fidl::marker::SourceBreaking,
887}
888
889impl fidl::Persistable for InputSettings {}
890
891/// A subset of |DeviceState|'s properties that clients may pass to change the
892/// software state of an InputDevice.
893#[derive(Clone, Debug, Default, PartialEq)]
894pub struct InputState {
895    pub name: Option<String>,
896    pub device_type: Option<DeviceType>,
897    pub state: Option<DeviceState>,
898    #[doc(hidden)]
899    pub __source_breaking: fidl::marker::SourceBreaking,
900}
901
902impl fidl::Persistable for InputState {}
903
904/// Collection of internationalization-related settings.
905#[derive(Clone, Debug, Default, PartialEq)]
906pub struct IntlSettings {
907    /// An ordered list of preferred locales.
908    pub locales: Option<Vec<fidl_fuchsia_intl::LocaleId>>,
909    /// The preferred temperature unit.
910    pub temperature_unit: Option<fidl_fuchsia_intl::TemperatureUnit>,
911    /// The currently set time zone.
912    pub time_zone_id: Option<fidl_fuchsia_intl::TimeZoneId>,
913    /// The preferred hour cycle.
914    pub hour_cycle: Option<HourCycle>,
915    #[doc(hidden)]
916    pub __source_breaking: fidl::marker::SourceBreaking,
917}
918
919impl fidl::Persistable for IntlSettings {}
920
921/// The various keyboard settings.
922#[derive(Clone, Debug, Default, PartialEq)]
923pub struct KeyboardSettings {
924    pub keymap: Option<fidl_fuchsia_input::KeymapId>,
925    pub autorepeat: Option<Autorepeat>,
926    #[doc(hidden)]
927    pub __source_breaking: fidl::marker::SourceBreaking,
928}
929
930impl fidl::Persistable for KeyboardSettings {}
931
932/// Information about a controllable light group. A group may have one or more
933/// lights.
934#[derive(Clone, Debug, Default, PartialEq)]
935pub struct LightGroup {
936    /// Identifier for this light group, clients should pass this back into the
937    /// service to set the group's light values.
938    pub name: Option<String>,
939    /// True if the light group is enabled and changes will be visible to the
940    /// user. False if the light group is forced off by hardware. If the light
941    /// group is disabled, its value can still be set, but the change may not be
942    /// visible until the light group is back on.
943    pub enabled: Option<bool>,
944    /// Defines the acceptable value type for controlling this light group.
945    pub type_: Option<LightType>,
946    /// States of the lights in this group.
947    pub lights: Option<Vec<LightState>>,
948    #[doc(hidden)]
949    pub __source_breaking: fidl::marker::SourceBreaking,
950}
951
952impl fidl::Persistable for LightGroup {}
953
954/// State of a given light.
955#[derive(Clone, Debug, Default, PartialEq)]
956pub struct LightState {
957    pub value: Option<LightValue>,
958    #[doc(hidden)]
959    pub __source_breaking: fidl::marker::SourceBreaking,
960}
961
962impl fidl::Persistable for LightState {}
963
964/// Settings related to Night mode.
965#[derive(Clone, Debug, Default, PartialEq)]
966pub struct NightModeSettings {
967    /// If true, the device/user have opted in for NightMode routine.
968    pub night_mode_enabled: Option<bool>,
969    #[doc(hidden)]
970    pub __source_breaking: fidl::marker::SourceBreaking,
971}
972
973impl fidl::Persistable for NightModeSettings {}
974
975#[derive(Clone, Debug, Default, PartialEq)]
976pub struct PrivacySettings {
977    /// Reflects the user consent to have their user data shared with the product owner, e.g., for
978    /// metrics collection and crash reporting.
979    pub user_data_sharing_consent: Option<bool>,
980    #[doc(hidden)]
981    pub __source_breaking: fidl::marker::SourceBreaking,
982}
983
984impl fidl::Persistable for PrivacySettings {}
985
986#[derive(Clone, Debug, Default, PartialEq)]
987pub struct SetupSettings {
988    /// Specifies the network interfaces that the device can be configured
989    /// over during setup.
990    pub enabled_configuration_interfaces: Option<ConfigurationInterfaces>,
991    #[doc(hidden)]
992    pub __source_breaking: fidl::marker::SourceBreaking,
993}
994
995impl fidl::Persistable for SetupSettings {}
996
997/// Describes what the |source|'s |state| is.
998#[derive(Clone, Debug, Default, PartialEq)]
999pub struct SourceState {
1000    pub source: Option<DeviceStateSource>,
1001    pub state: Option<DeviceState>,
1002    #[doc(hidden)]
1003    pub __source_breaking: fidl::marker::SourceBreaking,
1004}
1005
1006impl fidl::Persistable for SourceState {}
1007
1008#[derive(Clone, Debug, Default, PartialEq)]
1009pub struct Theme {
1010    pub theme_type: Option<ThemeType>,
1011    pub theme_mode: Option<ThemeMode>,
1012    #[doc(hidden)]
1013    pub __source_breaking: fidl::marker::SourceBreaking,
1014}
1015
1016impl fidl::Persistable for Theme {}
1017
1018#[derive(Clone, Debug, Default, PartialEq)]
1019pub struct Volume {
1020    /// The volume level ranged [0.0, 1.0]. The level maps to a dbfs value from a volume
1021    /// curve in the setting service. Not a number (NaN), infinity or negative infinity
1022    /// will cause SetVolume to fail with INVALID_VALUE.
1023    pub level: Option<f32>,
1024    /// True if the volume should be muted. If this is true, then the volume is silent,
1025    /// regardless of `level`.
1026    pub muted: Option<bool>,
1027    #[doc(hidden)]
1028    pub __source_breaking: fidl::marker::SourceBreaking,
1029}
1030
1031impl fidl::Persistable for Volume {}
1032
1033/// Value of a light. Only one of the three values in the union will be present,
1034/// depending on the light's LightType.
1035#[derive(Clone, Debug, PartialEq)]
1036pub enum LightValue {
1037    /// Lights with LightType.SIMPLE will have this value.
1038    On(bool),
1039    /// Lights with LightType.BRIGHTNESS will have this value, a floating point
1040    /// value 0.0 to 1.0 inclusive, where 0.0 means the light is off. Not a
1041    /// number (NaN), infinity or negative infinity will cause SetLightGroup to
1042    /// fail with INVALID_VALUE.
1043    Brightness(f64),
1044    /// Lights with LightType.RGB will have this value.
1045    ///
1046    /// Each color channel should be a value between 0.0 and 1.0 inclusive.
1047    /// Values outside this range will cause SetLightGroup to fail with
1048    /// INVALID_VALUE.
1049    Color(fidl_fuchsia_ui_types::ColorRgb),
1050}
1051
1052impl LightValue {
1053    #[inline]
1054    pub fn ordinal(&self) -> u64 {
1055        match *self {
1056            Self::On(_) => 1,
1057            Self::Brightness(_) => 2,
1058            Self::Color(_) => 3,
1059        }
1060    }
1061}
1062
1063impl fidl::Persistable for LightValue {}
1064
1065mod internal {
1066    use super::*;
1067    unsafe impl fidl::encoding::TypeMarker for ConfigurationInterfaces {
1068        type Owned = Self;
1069
1070        #[inline(always)]
1071        fn inline_align(_context: fidl::encoding::Context) -> usize {
1072            4
1073        }
1074
1075        #[inline(always)]
1076        fn inline_size(_context: fidl::encoding::Context) -> usize {
1077            4
1078        }
1079    }
1080
1081    impl fidl::encoding::ValueTypeMarker for ConfigurationInterfaces {
1082        type Borrowed<'a> = Self;
1083        #[inline(always)]
1084        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1085            *value
1086        }
1087    }
1088
1089    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1090        for ConfigurationInterfaces
1091    {
1092        #[inline]
1093        unsafe fn encode(
1094            self,
1095            encoder: &mut fidl::encoding::Encoder<'_, D>,
1096            offset: usize,
1097            _depth: fidl::encoding::Depth,
1098        ) -> fidl::Result<()> {
1099            encoder.debug_check_bounds::<Self>(offset);
1100            if self.bits() & Self::all().bits() != self.bits() {
1101                return Err(fidl::Error::InvalidBitsValue);
1102            }
1103            encoder.write_num(self.bits(), offset);
1104            Ok(())
1105        }
1106    }
1107
1108    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1109        for ConfigurationInterfaces
1110    {
1111        #[inline(always)]
1112        fn new_empty() -> Self {
1113            Self::empty()
1114        }
1115
1116        #[inline]
1117        unsafe fn decode(
1118            &mut self,
1119            decoder: &mut fidl::encoding::Decoder<'_, D>,
1120            offset: usize,
1121            _depth: fidl::encoding::Depth,
1122        ) -> fidl::Result<()> {
1123            decoder.debug_check_bounds::<Self>(offset);
1124            let prim = decoder.read_num::<u32>(offset);
1125            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1126            Ok(())
1127        }
1128    }
1129    unsafe impl fidl::encoding::TypeMarker for ThemeMode {
1130        type Owned = Self;
1131
1132        #[inline(always)]
1133        fn inline_align(_context: fidl::encoding::Context) -> usize {
1134            4
1135        }
1136
1137        #[inline(always)]
1138        fn inline_size(_context: fidl::encoding::Context) -> usize {
1139            4
1140        }
1141    }
1142
1143    impl fidl::encoding::ValueTypeMarker for ThemeMode {
1144        type Borrowed<'a> = Self;
1145        #[inline(always)]
1146        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1147            *value
1148        }
1149    }
1150
1151    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ThemeMode {
1152        #[inline]
1153        unsafe fn encode(
1154            self,
1155            encoder: &mut fidl::encoding::Encoder<'_, D>,
1156            offset: usize,
1157            _depth: fidl::encoding::Depth,
1158        ) -> fidl::Result<()> {
1159            encoder.debug_check_bounds::<Self>(offset);
1160            if self.bits() & Self::all().bits() != self.bits() {
1161                return Err(fidl::Error::InvalidBitsValue);
1162            }
1163            encoder.write_num(self.bits(), offset);
1164            Ok(())
1165        }
1166    }
1167
1168    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ThemeMode {
1169        #[inline(always)]
1170        fn new_empty() -> Self {
1171            Self::empty()
1172        }
1173
1174        #[inline]
1175        unsafe fn decode(
1176            &mut self,
1177            decoder: &mut fidl::encoding::Decoder<'_, D>,
1178            offset: usize,
1179            _depth: fidl::encoding::Depth,
1180        ) -> fidl::Result<()> {
1181            decoder.debug_check_bounds::<Self>(offset);
1182            let prim = decoder.read_num::<u32>(offset);
1183            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1184            Ok(())
1185        }
1186    }
1187    unsafe impl fidl::encoding::TypeMarker for ToggleStateFlags {
1188        type Owned = Self;
1189
1190        #[inline(always)]
1191        fn inline_align(_context: fidl::encoding::Context) -> usize {
1192            8
1193        }
1194
1195        #[inline(always)]
1196        fn inline_size(_context: fidl::encoding::Context) -> usize {
1197            8
1198        }
1199    }
1200
1201    impl fidl::encoding::ValueTypeMarker for ToggleStateFlags {
1202        type Borrowed<'a> = Self;
1203        #[inline(always)]
1204        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1205            *value
1206        }
1207    }
1208
1209    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1210        for ToggleStateFlags
1211    {
1212        #[inline]
1213        unsafe fn encode(
1214            self,
1215            encoder: &mut fidl::encoding::Encoder<'_, D>,
1216            offset: usize,
1217            _depth: fidl::encoding::Depth,
1218        ) -> fidl::Result<()> {
1219            encoder.debug_check_bounds::<Self>(offset);
1220            if self.bits() & Self::all().bits() != self.bits() {
1221                return Err(fidl::Error::InvalidBitsValue);
1222            }
1223            encoder.write_num(self.bits(), offset);
1224            Ok(())
1225        }
1226    }
1227
1228    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ToggleStateFlags {
1229        #[inline(always)]
1230        fn new_empty() -> Self {
1231            Self::empty()
1232        }
1233
1234        #[inline]
1235        unsafe fn decode(
1236            &mut self,
1237            decoder: &mut fidl::encoding::Decoder<'_, D>,
1238            offset: usize,
1239            _depth: fidl::encoding::Depth,
1240        ) -> fidl::Result<()> {
1241            decoder.debug_check_bounds::<Self>(offset);
1242            let prim = decoder.read_num::<u64>(offset);
1243            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1244            Ok(())
1245        }
1246    }
1247    unsafe impl fidl::encoding::TypeMarker for AudioStreamSettingSource {
1248        type Owned = Self;
1249
1250        #[inline(always)]
1251        fn inline_align(_context: fidl::encoding::Context) -> usize {
1252            std::mem::align_of::<u32>()
1253        }
1254
1255        #[inline(always)]
1256        fn inline_size(_context: fidl::encoding::Context) -> usize {
1257            std::mem::size_of::<u32>()
1258        }
1259
1260        #[inline(always)]
1261        fn encode_is_copy() -> bool {
1262            true
1263        }
1264
1265        #[inline(always)]
1266        fn decode_is_copy() -> bool {
1267            false
1268        }
1269    }
1270
1271    impl fidl::encoding::ValueTypeMarker for AudioStreamSettingSource {
1272        type Borrowed<'a> = Self;
1273        #[inline(always)]
1274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1275            *value
1276        }
1277    }
1278
1279    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1280        for AudioStreamSettingSource
1281    {
1282        #[inline]
1283        unsafe fn encode(
1284            self,
1285            encoder: &mut fidl::encoding::Encoder<'_, D>,
1286            offset: usize,
1287            _depth: fidl::encoding::Depth,
1288        ) -> fidl::Result<()> {
1289            encoder.debug_check_bounds::<Self>(offset);
1290            encoder.write_num(self.into_primitive(), offset);
1291            Ok(())
1292        }
1293    }
1294
1295    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1296        for AudioStreamSettingSource
1297    {
1298        #[inline(always)]
1299        fn new_empty() -> Self {
1300            Self::User
1301        }
1302
1303        #[inline]
1304        unsafe fn decode(
1305            &mut self,
1306            decoder: &mut fidl::encoding::Decoder<'_, D>,
1307            offset: usize,
1308            _depth: fidl::encoding::Depth,
1309        ) -> fidl::Result<()> {
1310            decoder.debug_check_bounds::<Self>(offset);
1311            let prim = decoder.read_num::<u32>(offset);
1312
1313            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1314            Ok(())
1315        }
1316    }
1317    unsafe impl fidl::encoding::TypeMarker for CaptionFontFamily {
1318        type Owned = Self;
1319
1320        #[inline(always)]
1321        fn inline_align(_context: fidl::encoding::Context) -> usize {
1322            std::mem::align_of::<u32>()
1323        }
1324
1325        #[inline(always)]
1326        fn inline_size(_context: fidl::encoding::Context) -> usize {
1327            std::mem::size_of::<u32>()
1328        }
1329
1330        #[inline(always)]
1331        fn encode_is_copy() -> bool {
1332            true
1333        }
1334
1335        #[inline(always)]
1336        fn decode_is_copy() -> bool {
1337            false
1338        }
1339    }
1340
1341    impl fidl::encoding::ValueTypeMarker for CaptionFontFamily {
1342        type Borrowed<'a> = Self;
1343        #[inline(always)]
1344        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1345            *value
1346        }
1347    }
1348
1349    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1350        for CaptionFontFamily
1351    {
1352        #[inline]
1353        unsafe fn encode(
1354            self,
1355            encoder: &mut fidl::encoding::Encoder<'_, D>,
1356            offset: usize,
1357            _depth: fidl::encoding::Depth,
1358        ) -> fidl::Result<()> {
1359            encoder.debug_check_bounds::<Self>(offset);
1360            encoder.write_num(self.into_primitive(), offset);
1361            Ok(())
1362        }
1363    }
1364
1365    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CaptionFontFamily {
1366        #[inline(always)]
1367        fn new_empty() -> Self {
1368            Self::Unknown
1369        }
1370
1371        #[inline]
1372        unsafe fn decode(
1373            &mut self,
1374            decoder: &mut fidl::encoding::Decoder<'_, D>,
1375            offset: usize,
1376            _depth: fidl::encoding::Depth,
1377        ) -> fidl::Result<()> {
1378            decoder.debug_check_bounds::<Self>(offset);
1379            let prim = decoder.read_num::<u32>(offset);
1380
1381            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1382            Ok(())
1383        }
1384    }
1385    unsafe impl fidl::encoding::TypeMarker for ColorBlindnessType {
1386        type Owned = Self;
1387
1388        #[inline(always)]
1389        fn inline_align(_context: fidl::encoding::Context) -> usize {
1390            std::mem::align_of::<u32>()
1391        }
1392
1393        #[inline(always)]
1394        fn inline_size(_context: fidl::encoding::Context) -> usize {
1395            std::mem::size_of::<u32>()
1396        }
1397
1398        #[inline(always)]
1399        fn encode_is_copy() -> bool {
1400            true
1401        }
1402
1403        #[inline(always)]
1404        fn decode_is_copy() -> bool {
1405            false
1406        }
1407    }
1408
1409    impl fidl::encoding::ValueTypeMarker for ColorBlindnessType {
1410        type Borrowed<'a> = Self;
1411        #[inline(always)]
1412        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1413            *value
1414        }
1415    }
1416
1417    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1418        for ColorBlindnessType
1419    {
1420        #[inline]
1421        unsafe fn encode(
1422            self,
1423            encoder: &mut fidl::encoding::Encoder<'_, D>,
1424            offset: usize,
1425            _depth: fidl::encoding::Depth,
1426        ) -> fidl::Result<()> {
1427            encoder.debug_check_bounds::<Self>(offset);
1428            encoder.write_num(self.into_primitive(), offset);
1429            Ok(())
1430        }
1431    }
1432
1433    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ColorBlindnessType {
1434        #[inline(always)]
1435        fn new_empty() -> Self {
1436            Self::None
1437        }
1438
1439        #[inline]
1440        unsafe fn decode(
1441            &mut self,
1442            decoder: &mut fidl::encoding::Decoder<'_, D>,
1443            offset: usize,
1444            _depth: fidl::encoding::Depth,
1445        ) -> fidl::Result<()> {
1446            decoder.debug_check_bounds::<Self>(offset);
1447            let prim = decoder.read_num::<u32>(offset);
1448
1449            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1450            Ok(())
1451        }
1452    }
1453    unsafe impl fidl::encoding::TypeMarker for DeviceStateSource {
1454        type Owned = Self;
1455
1456        #[inline(always)]
1457        fn inline_align(_context: fidl::encoding::Context) -> usize {
1458            std::mem::align_of::<u32>()
1459        }
1460
1461        #[inline(always)]
1462        fn inline_size(_context: fidl::encoding::Context) -> usize {
1463            std::mem::size_of::<u32>()
1464        }
1465
1466        #[inline(always)]
1467        fn encode_is_copy() -> bool {
1468            true
1469        }
1470
1471        #[inline(always)]
1472        fn decode_is_copy() -> bool {
1473            false
1474        }
1475    }
1476
1477    impl fidl::encoding::ValueTypeMarker for DeviceStateSource {
1478        type Borrowed<'a> = Self;
1479        #[inline(always)]
1480        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1481            *value
1482        }
1483    }
1484
1485    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1486        for DeviceStateSource
1487    {
1488        #[inline]
1489        unsafe fn encode(
1490            self,
1491            encoder: &mut fidl::encoding::Encoder<'_, D>,
1492            offset: usize,
1493            _depth: fidl::encoding::Depth,
1494        ) -> fidl::Result<()> {
1495            encoder.debug_check_bounds::<Self>(offset);
1496            encoder.write_num(self.into_primitive(), offset);
1497            Ok(())
1498        }
1499    }
1500
1501    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceStateSource {
1502        #[inline(always)]
1503        fn new_empty() -> Self {
1504            Self::Hardware
1505        }
1506
1507        #[inline]
1508        unsafe fn decode(
1509            &mut self,
1510            decoder: &mut fidl::encoding::Decoder<'_, D>,
1511            offset: usize,
1512            _depth: fidl::encoding::Depth,
1513        ) -> fidl::Result<()> {
1514            decoder.debug_check_bounds::<Self>(offset);
1515            let prim = decoder.read_num::<u32>(offset);
1516
1517            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1518            Ok(())
1519        }
1520    }
1521    unsafe impl fidl::encoding::TypeMarker for DeviceType {
1522        type Owned = Self;
1523
1524        #[inline(always)]
1525        fn inline_align(_context: fidl::encoding::Context) -> usize {
1526            std::mem::align_of::<u32>()
1527        }
1528
1529        #[inline(always)]
1530        fn inline_size(_context: fidl::encoding::Context) -> usize {
1531            std::mem::size_of::<u32>()
1532        }
1533
1534        #[inline(always)]
1535        fn encode_is_copy() -> bool {
1536            true
1537        }
1538
1539        #[inline(always)]
1540        fn decode_is_copy() -> bool {
1541            false
1542        }
1543    }
1544
1545    impl fidl::encoding::ValueTypeMarker for DeviceType {
1546        type Borrowed<'a> = Self;
1547        #[inline(always)]
1548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1549            *value
1550        }
1551    }
1552
1553    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
1554        #[inline]
1555        unsafe fn encode(
1556            self,
1557            encoder: &mut fidl::encoding::Encoder<'_, D>,
1558            offset: usize,
1559            _depth: fidl::encoding::Depth,
1560        ) -> fidl::Result<()> {
1561            encoder.debug_check_bounds::<Self>(offset);
1562            encoder.write_num(self.into_primitive(), offset);
1563            Ok(())
1564        }
1565    }
1566
1567    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
1568        #[inline(always)]
1569        fn new_empty() -> Self {
1570            Self::Microphone
1571        }
1572
1573        #[inline]
1574        unsafe fn decode(
1575            &mut self,
1576            decoder: &mut fidl::encoding::Decoder<'_, D>,
1577            offset: usize,
1578            _depth: fidl::encoding::Depth,
1579        ) -> fidl::Result<()> {
1580            decoder.debug_check_bounds::<Self>(offset);
1581            let prim = decoder.read_num::<u32>(offset);
1582
1583            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1584            Ok(())
1585        }
1586    }
1587    unsafe impl fidl::encoding::TypeMarker for EdgeStyle {
1588        type Owned = Self;
1589
1590        #[inline(always)]
1591        fn inline_align(_context: fidl::encoding::Context) -> usize {
1592            std::mem::align_of::<u32>()
1593        }
1594
1595        #[inline(always)]
1596        fn inline_size(_context: fidl::encoding::Context) -> usize {
1597            std::mem::size_of::<u32>()
1598        }
1599
1600        #[inline(always)]
1601        fn encode_is_copy() -> bool {
1602            true
1603        }
1604
1605        #[inline(always)]
1606        fn decode_is_copy() -> bool {
1607            false
1608        }
1609    }
1610
1611    impl fidl::encoding::ValueTypeMarker for EdgeStyle {
1612        type Borrowed<'a> = Self;
1613        #[inline(always)]
1614        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1615            *value
1616        }
1617    }
1618
1619    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EdgeStyle {
1620        #[inline]
1621        unsafe fn encode(
1622            self,
1623            encoder: &mut fidl::encoding::Encoder<'_, D>,
1624            offset: usize,
1625            _depth: fidl::encoding::Depth,
1626        ) -> fidl::Result<()> {
1627            encoder.debug_check_bounds::<Self>(offset);
1628            encoder.write_num(self.into_primitive(), offset);
1629            Ok(())
1630        }
1631    }
1632
1633    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EdgeStyle {
1634        #[inline(always)]
1635        fn new_empty() -> Self {
1636            Self::None
1637        }
1638
1639        #[inline]
1640        unsafe fn decode(
1641            &mut self,
1642            decoder: &mut fidl::encoding::Decoder<'_, D>,
1643            offset: usize,
1644            _depth: fidl::encoding::Depth,
1645        ) -> fidl::Result<()> {
1646            decoder.debug_check_bounds::<Self>(offset);
1647            let prim = decoder.read_num::<u32>(offset);
1648
1649            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1650            Ok(())
1651        }
1652    }
1653    unsafe impl fidl::encoding::TypeMarker for Error {
1654        type Owned = Self;
1655
1656        #[inline(always)]
1657        fn inline_align(_context: fidl::encoding::Context) -> usize {
1658            std::mem::align_of::<u32>()
1659        }
1660
1661        #[inline(always)]
1662        fn inline_size(_context: fidl::encoding::Context) -> usize {
1663            std::mem::size_of::<u32>()
1664        }
1665
1666        #[inline(always)]
1667        fn encode_is_copy() -> bool {
1668            true
1669        }
1670
1671        #[inline(always)]
1672        fn decode_is_copy() -> bool {
1673            false
1674        }
1675    }
1676
1677    impl fidl::encoding::ValueTypeMarker for Error {
1678        type Borrowed<'a> = Self;
1679        #[inline(always)]
1680        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1681            *value
1682        }
1683    }
1684
1685    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
1686        #[inline]
1687        unsafe fn encode(
1688            self,
1689            encoder: &mut fidl::encoding::Encoder<'_, D>,
1690            offset: usize,
1691            _depth: fidl::encoding::Depth,
1692        ) -> fidl::Result<()> {
1693            encoder.debug_check_bounds::<Self>(offset);
1694            encoder.write_num(self.into_primitive(), offset);
1695            Ok(())
1696        }
1697    }
1698
1699    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
1700        #[inline(always)]
1701        fn new_empty() -> Self {
1702            Self::Failed
1703        }
1704
1705        #[inline]
1706        unsafe fn decode(
1707            &mut self,
1708            decoder: &mut fidl::encoding::Decoder<'_, D>,
1709            offset: usize,
1710            _depth: fidl::encoding::Depth,
1711        ) -> fidl::Result<()> {
1712            decoder.debug_check_bounds::<Self>(offset);
1713            let prim = decoder.read_num::<u32>(offset);
1714
1715            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1716            Ok(())
1717        }
1718    }
1719    unsafe impl fidl::encoding::TypeMarker for HourCycle {
1720        type Owned = Self;
1721
1722        #[inline(always)]
1723        fn inline_align(_context: fidl::encoding::Context) -> usize {
1724            std::mem::align_of::<u32>()
1725        }
1726
1727        #[inline(always)]
1728        fn inline_size(_context: fidl::encoding::Context) -> usize {
1729            std::mem::size_of::<u32>()
1730        }
1731
1732        #[inline(always)]
1733        fn encode_is_copy() -> bool {
1734            true
1735        }
1736
1737        #[inline(always)]
1738        fn decode_is_copy() -> bool {
1739            false
1740        }
1741    }
1742
1743    impl fidl::encoding::ValueTypeMarker for HourCycle {
1744        type Borrowed<'a> = Self;
1745        #[inline(always)]
1746        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1747            *value
1748        }
1749    }
1750
1751    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for HourCycle {
1752        #[inline]
1753        unsafe fn encode(
1754            self,
1755            encoder: &mut fidl::encoding::Encoder<'_, D>,
1756            offset: usize,
1757            _depth: fidl::encoding::Depth,
1758        ) -> fidl::Result<()> {
1759            encoder.debug_check_bounds::<Self>(offset);
1760            encoder.write_num(self.into_primitive(), offset);
1761            Ok(())
1762        }
1763    }
1764
1765    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HourCycle {
1766        #[inline(always)]
1767        fn new_empty() -> Self {
1768            Self::Unknown
1769        }
1770
1771        #[inline]
1772        unsafe fn decode(
1773            &mut self,
1774            decoder: &mut fidl::encoding::Decoder<'_, D>,
1775            offset: usize,
1776            _depth: fidl::encoding::Depth,
1777        ) -> fidl::Result<()> {
1778            decoder.debug_check_bounds::<Self>(offset);
1779            let prim = decoder.read_num::<u32>(offset);
1780
1781            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1782            Ok(())
1783        }
1784    }
1785    unsafe impl fidl::encoding::TypeMarker for LightError {
1786        type Owned = Self;
1787
1788        #[inline(always)]
1789        fn inline_align(_context: fidl::encoding::Context) -> usize {
1790            std::mem::align_of::<u32>()
1791        }
1792
1793        #[inline(always)]
1794        fn inline_size(_context: fidl::encoding::Context) -> usize {
1795            std::mem::size_of::<u32>()
1796        }
1797
1798        #[inline(always)]
1799        fn encode_is_copy() -> bool {
1800            true
1801        }
1802
1803        #[inline(always)]
1804        fn decode_is_copy() -> bool {
1805            false
1806        }
1807    }
1808
1809    impl fidl::encoding::ValueTypeMarker for LightError {
1810        type Borrowed<'a> = Self;
1811        #[inline(always)]
1812        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1813            *value
1814        }
1815    }
1816
1817    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LightError {
1818        #[inline]
1819        unsafe fn encode(
1820            self,
1821            encoder: &mut fidl::encoding::Encoder<'_, D>,
1822            offset: usize,
1823            _depth: fidl::encoding::Depth,
1824        ) -> fidl::Result<()> {
1825            encoder.debug_check_bounds::<Self>(offset);
1826            encoder.write_num(self.into_primitive(), offset);
1827            Ok(())
1828        }
1829    }
1830
1831    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightError {
1832        #[inline(always)]
1833        fn new_empty() -> Self {
1834            Self::Failed
1835        }
1836
1837        #[inline]
1838        unsafe fn decode(
1839            &mut self,
1840            decoder: &mut fidl::encoding::Decoder<'_, D>,
1841            offset: usize,
1842            _depth: fidl::encoding::Depth,
1843        ) -> fidl::Result<()> {
1844            decoder.debug_check_bounds::<Self>(offset);
1845            let prim = decoder.read_num::<u32>(offset);
1846
1847            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1848            Ok(())
1849        }
1850    }
1851    unsafe impl fidl::encoding::TypeMarker for LightType {
1852        type Owned = Self;
1853
1854        #[inline(always)]
1855        fn inline_align(_context: fidl::encoding::Context) -> usize {
1856            std::mem::align_of::<u32>()
1857        }
1858
1859        #[inline(always)]
1860        fn inline_size(_context: fidl::encoding::Context) -> usize {
1861            std::mem::size_of::<u32>()
1862        }
1863
1864        #[inline(always)]
1865        fn encode_is_copy() -> bool {
1866            true
1867        }
1868
1869        #[inline(always)]
1870        fn decode_is_copy() -> bool {
1871            false
1872        }
1873    }
1874
1875    impl fidl::encoding::ValueTypeMarker for LightType {
1876        type Borrowed<'a> = Self;
1877        #[inline(always)]
1878        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1879            *value
1880        }
1881    }
1882
1883    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LightType {
1884        #[inline]
1885        unsafe fn encode(
1886            self,
1887            encoder: &mut fidl::encoding::Encoder<'_, D>,
1888            offset: usize,
1889            _depth: fidl::encoding::Depth,
1890        ) -> fidl::Result<()> {
1891            encoder.debug_check_bounds::<Self>(offset);
1892            encoder.write_num(self.into_primitive(), offset);
1893            Ok(())
1894        }
1895    }
1896
1897    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightType {
1898        #[inline(always)]
1899        fn new_empty() -> Self {
1900            Self::Brightness
1901        }
1902
1903        #[inline]
1904        unsafe fn decode(
1905            &mut self,
1906            decoder: &mut fidl::encoding::Decoder<'_, D>,
1907            offset: usize,
1908            _depth: fidl::encoding::Depth,
1909        ) -> fidl::Result<()> {
1910            decoder.debug_check_bounds::<Self>(offset);
1911            let prim = decoder.read_num::<u32>(offset);
1912
1913            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1914            Ok(())
1915        }
1916    }
1917    unsafe impl fidl::encoding::TypeMarker for LowLightMode {
1918        type Owned = Self;
1919
1920        #[inline(always)]
1921        fn inline_align(_context: fidl::encoding::Context) -> usize {
1922            std::mem::align_of::<u32>()
1923        }
1924
1925        #[inline(always)]
1926        fn inline_size(_context: fidl::encoding::Context) -> usize {
1927            std::mem::size_of::<u32>()
1928        }
1929
1930        #[inline(always)]
1931        fn encode_is_copy() -> bool {
1932            true
1933        }
1934
1935        #[inline(always)]
1936        fn decode_is_copy() -> bool {
1937            false
1938        }
1939    }
1940
1941    impl fidl::encoding::ValueTypeMarker for LowLightMode {
1942        type Borrowed<'a> = Self;
1943        #[inline(always)]
1944        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1945            *value
1946        }
1947    }
1948
1949    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LowLightMode {
1950        #[inline]
1951        unsafe fn encode(
1952            self,
1953            encoder: &mut fidl::encoding::Encoder<'_, D>,
1954            offset: usize,
1955            _depth: fidl::encoding::Depth,
1956        ) -> fidl::Result<()> {
1957            encoder.debug_check_bounds::<Self>(offset);
1958            encoder.write_num(self.into_primitive(), offset);
1959            Ok(())
1960        }
1961    }
1962
1963    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LowLightMode {
1964        #[inline(always)]
1965        fn new_empty() -> Self {
1966            Self::Disable
1967        }
1968
1969        #[inline]
1970        unsafe fn decode(
1971            &mut self,
1972            decoder: &mut fidl::encoding::Decoder<'_, D>,
1973            offset: usize,
1974            _depth: fidl::encoding::Depth,
1975        ) -> fidl::Result<()> {
1976            decoder.debug_check_bounds::<Self>(offset);
1977            let prim = decoder.read_num::<u32>(offset);
1978
1979            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1980            Ok(())
1981        }
1982    }
1983    unsafe impl fidl::encoding::TypeMarker for SettingsEpitaph {
1984        type Owned = Self;
1985
1986        #[inline(always)]
1987        fn inline_align(_context: fidl::encoding::Context) -> usize {
1988            std::mem::align_of::<u32>()
1989        }
1990
1991        #[inline(always)]
1992        fn inline_size(_context: fidl::encoding::Context) -> usize {
1993            std::mem::size_of::<u32>()
1994        }
1995
1996        #[inline(always)]
1997        fn encode_is_copy() -> bool {
1998            true
1999        }
2000
2001        #[inline(always)]
2002        fn decode_is_copy() -> bool {
2003            false
2004        }
2005    }
2006
2007    impl fidl::encoding::ValueTypeMarker for SettingsEpitaph {
2008        type Borrowed<'a> = Self;
2009        #[inline(always)]
2010        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2011            *value
2012        }
2013    }
2014
2015    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2016        for SettingsEpitaph
2017    {
2018        #[inline]
2019        unsafe fn encode(
2020            self,
2021            encoder: &mut fidl::encoding::Encoder<'_, D>,
2022            offset: usize,
2023            _depth: fidl::encoding::Depth,
2024        ) -> fidl::Result<()> {
2025            encoder.debug_check_bounds::<Self>(offset);
2026            encoder.write_num(self.into_primitive(), offset);
2027            Ok(())
2028        }
2029    }
2030
2031    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SettingsEpitaph {
2032        #[inline(always)]
2033        fn new_empty() -> Self {
2034            Self::RequestNotSupported
2035        }
2036
2037        #[inline]
2038        unsafe fn decode(
2039            &mut self,
2040            decoder: &mut fidl::encoding::Decoder<'_, D>,
2041            offset: usize,
2042            _depth: fidl::encoding::Depth,
2043        ) -> fidl::Result<()> {
2044            decoder.debug_check_bounds::<Self>(offset);
2045            let prim = decoder.read_num::<u32>(offset);
2046
2047            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2048            Ok(())
2049        }
2050    }
2051    unsafe impl fidl::encoding::TypeMarker for ThemeType {
2052        type Owned = Self;
2053
2054        #[inline(always)]
2055        fn inline_align(_context: fidl::encoding::Context) -> usize {
2056            std::mem::align_of::<u32>()
2057        }
2058
2059        #[inline(always)]
2060        fn inline_size(_context: fidl::encoding::Context) -> usize {
2061            std::mem::size_of::<u32>()
2062        }
2063
2064        #[inline(always)]
2065        fn encode_is_copy() -> bool {
2066            true
2067        }
2068
2069        #[inline(always)]
2070        fn decode_is_copy() -> bool {
2071            false
2072        }
2073    }
2074
2075    impl fidl::encoding::ValueTypeMarker for ThemeType {
2076        type Borrowed<'a> = Self;
2077        #[inline(always)]
2078        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2079            *value
2080        }
2081    }
2082
2083    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ThemeType {
2084        #[inline]
2085        unsafe fn encode(
2086            self,
2087            encoder: &mut fidl::encoding::Encoder<'_, D>,
2088            offset: usize,
2089            _depth: fidl::encoding::Depth,
2090        ) -> fidl::Result<()> {
2091            encoder.debug_check_bounds::<Self>(offset);
2092            encoder.write_num(self.into_primitive(), offset);
2093            Ok(())
2094        }
2095    }
2096
2097    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ThemeType {
2098        #[inline(always)]
2099        fn new_empty() -> Self {
2100            Self::Default
2101        }
2102
2103        #[inline]
2104        unsafe fn decode(
2105            &mut self,
2106            decoder: &mut fidl::encoding::Decoder<'_, D>,
2107            offset: usize,
2108            _depth: fidl::encoding::Depth,
2109        ) -> fidl::Result<()> {
2110            decoder.debug_check_bounds::<Self>(offset);
2111            let prim = decoder.read_num::<u32>(offset);
2112
2113            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2114            Ok(())
2115        }
2116    }
2117
2118    impl fidl::encoding::ValueTypeMarker for AccessibilitySetRequest {
2119        type Borrowed<'a> = &'a Self;
2120        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2121            value
2122        }
2123    }
2124
2125    unsafe impl fidl::encoding::TypeMarker for AccessibilitySetRequest {
2126        type Owned = Self;
2127
2128        #[inline(always)]
2129        fn inline_align(_context: fidl::encoding::Context) -> usize {
2130            8
2131        }
2132
2133        #[inline(always)]
2134        fn inline_size(_context: fidl::encoding::Context) -> usize {
2135            16
2136        }
2137    }
2138
2139    unsafe impl<D: fidl::encoding::ResourceDialect>
2140        fidl::encoding::Encode<AccessibilitySetRequest, D> for &AccessibilitySetRequest
2141    {
2142        #[inline]
2143        unsafe fn encode(
2144            self,
2145            encoder: &mut fidl::encoding::Encoder<'_, D>,
2146            offset: usize,
2147            _depth: fidl::encoding::Depth,
2148        ) -> fidl::Result<()> {
2149            encoder.debug_check_bounds::<AccessibilitySetRequest>(offset);
2150            // Delegate to tuple encoding.
2151            fidl::encoding::Encode::<AccessibilitySetRequest, D>::encode(
2152                (<AccessibilitySettings as fidl::encoding::ValueTypeMarker>::borrow(
2153                    &self.settings,
2154                ),),
2155                encoder,
2156                offset,
2157                _depth,
2158            )
2159        }
2160    }
2161    unsafe impl<
2162            D: fidl::encoding::ResourceDialect,
2163            T0: fidl::encoding::Encode<AccessibilitySettings, D>,
2164        > fidl::encoding::Encode<AccessibilitySetRequest, D> for (T0,)
2165    {
2166        #[inline]
2167        unsafe fn encode(
2168            self,
2169            encoder: &mut fidl::encoding::Encoder<'_, D>,
2170            offset: usize,
2171            depth: fidl::encoding::Depth,
2172        ) -> fidl::Result<()> {
2173            encoder.debug_check_bounds::<AccessibilitySetRequest>(offset);
2174            // Zero out padding regions. There's no need to apply masks
2175            // because the unmasked parts will be overwritten by fields.
2176            // Write the fields.
2177            self.0.encode(encoder, offset + 0, depth)?;
2178            Ok(())
2179        }
2180    }
2181
2182    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2183        for AccessibilitySetRequest
2184    {
2185        #[inline(always)]
2186        fn new_empty() -> Self {
2187            Self { settings: fidl::new_empty!(AccessibilitySettings, D) }
2188        }
2189
2190        #[inline]
2191        unsafe fn decode(
2192            &mut self,
2193            decoder: &mut fidl::encoding::Decoder<'_, D>,
2194            offset: usize,
2195            _depth: fidl::encoding::Depth,
2196        ) -> fidl::Result<()> {
2197            decoder.debug_check_bounds::<Self>(offset);
2198            // Verify that padding bytes are zero.
2199            fidl::decode!(
2200                AccessibilitySettings,
2201                D,
2202                &mut self.settings,
2203                decoder,
2204                offset + 0,
2205                _depth
2206            )?;
2207            Ok(())
2208        }
2209    }
2210
2211    impl fidl::encoding::ValueTypeMarker for AccessibilityWatchResponse {
2212        type Borrowed<'a> = &'a Self;
2213        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2214            value
2215        }
2216    }
2217
2218    unsafe impl fidl::encoding::TypeMarker for AccessibilityWatchResponse {
2219        type Owned = Self;
2220
2221        #[inline(always)]
2222        fn inline_align(_context: fidl::encoding::Context) -> usize {
2223            8
2224        }
2225
2226        #[inline(always)]
2227        fn inline_size(_context: fidl::encoding::Context) -> usize {
2228            16
2229        }
2230    }
2231
2232    unsafe impl<D: fidl::encoding::ResourceDialect>
2233        fidl::encoding::Encode<AccessibilityWatchResponse, D> for &AccessibilityWatchResponse
2234    {
2235        #[inline]
2236        unsafe fn encode(
2237            self,
2238            encoder: &mut fidl::encoding::Encoder<'_, D>,
2239            offset: usize,
2240            _depth: fidl::encoding::Depth,
2241        ) -> fidl::Result<()> {
2242            encoder.debug_check_bounds::<AccessibilityWatchResponse>(offset);
2243            // Delegate to tuple encoding.
2244            fidl::encoding::Encode::<AccessibilityWatchResponse, D>::encode(
2245                (<AccessibilitySettings as fidl::encoding::ValueTypeMarker>::borrow(
2246                    &self.settings,
2247                ),),
2248                encoder,
2249                offset,
2250                _depth,
2251            )
2252        }
2253    }
2254    unsafe impl<
2255            D: fidl::encoding::ResourceDialect,
2256            T0: fidl::encoding::Encode<AccessibilitySettings, D>,
2257        > fidl::encoding::Encode<AccessibilityWatchResponse, D> for (T0,)
2258    {
2259        #[inline]
2260        unsafe fn encode(
2261            self,
2262            encoder: &mut fidl::encoding::Encoder<'_, D>,
2263            offset: usize,
2264            depth: fidl::encoding::Depth,
2265        ) -> fidl::Result<()> {
2266            encoder.debug_check_bounds::<AccessibilityWatchResponse>(offset);
2267            // Zero out padding regions. There's no need to apply masks
2268            // because the unmasked parts will be overwritten by fields.
2269            // Write the fields.
2270            self.0.encode(encoder, offset + 0, depth)?;
2271            Ok(())
2272        }
2273    }
2274
2275    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2276        for AccessibilityWatchResponse
2277    {
2278        #[inline(always)]
2279        fn new_empty() -> Self {
2280            Self { settings: fidl::new_empty!(AccessibilitySettings, D) }
2281        }
2282
2283        #[inline]
2284        unsafe fn decode(
2285            &mut self,
2286            decoder: &mut fidl::encoding::Decoder<'_, D>,
2287            offset: usize,
2288            _depth: fidl::encoding::Depth,
2289        ) -> fidl::Result<()> {
2290            decoder.debug_check_bounds::<Self>(offset);
2291            // Verify that padding bytes are zero.
2292            fidl::decode!(
2293                AccessibilitySettings,
2294                D,
2295                &mut self.settings,
2296                decoder,
2297                offset + 0,
2298                _depth
2299            )?;
2300            Ok(())
2301        }
2302    }
2303
2304    impl fidl::encoding::ValueTypeMarker for AudioSet2Request {
2305        type Borrowed<'a> = &'a Self;
2306        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2307            value
2308        }
2309    }
2310
2311    unsafe impl fidl::encoding::TypeMarker for AudioSet2Request {
2312        type Owned = Self;
2313
2314        #[inline(always)]
2315        fn inline_align(_context: fidl::encoding::Context) -> usize {
2316            8
2317        }
2318
2319        #[inline(always)]
2320        fn inline_size(_context: fidl::encoding::Context) -> usize {
2321            16
2322        }
2323    }
2324
2325    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioSet2Request, D>
2326        for &AudioSet2Request
2327    {
2328        #[inline]
2329        unsafe fn encode(
2330            self,
2331            encoder: &mut fidl::encoding::Encoder<'_, D>,
2332            offset: usize,
2333            _depth: fidl::encoding::Depth,
2334        ) -> fidl::Result<()> {
2335            encoder.debug_check_bounds::<AudioSet2Request>(offset);
2336            // Delegate to tuple encoding.
2337            fidl::encoding::Encode::<AudioSet2Request, D>::encode(
2338                (<AudioSettings2 as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2339                encoder,
2340                offset,
2341                _depth,
2342            )
2343        }
2344    }
2345    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioSettings2, D>>
2346        fidl::encoding::Encode<AudioSet2Request, D> for (T0,)
2347    {
2348        #[inline]
2349        unsafe fn encode(
2350            self,
2351            encoder: &mut fidl::encoding::Encoder<'_, D>,
2352            offset: usize,
2353            depth: fidl::encoding::Depth,
2354        ) -> fidl::Result<()> {
2355            encoder.debug_check_bounds::<AudioSet2Request>(offset);
2356            // Zero out padding regions. There's no need to apply masks
2357            // because the unmasked parts will be overwritten by fields.
2358            // Write the fields.
2359            self.0.encode(encoder, offset + 0, depth)?;
2360            Ok(())
2361        }
2362    }
2363
2364    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioSet2Request {
2365        #[inline(always)]
2366        fn new_empty() -> Self {
2367            Self { settings: fidl::new_empty!(AudioSettings2, D) }
2368        }
2369
2370        #[inline]
2371        unsafe fn decode(
2372            &mut self,
2373            decoder: &mut fidl::encoding::Decoder<'_, D>,
2374            offset: usize,
2375            _depth: fidl::encoding::Depth,
2376        ) -> fidl::Result<()> {
2377            decoder.debug_check_bounds::<Self>(offset);
2378            // Verify that padding bytes are zero.
2379            fidl::decode!(AudioSettings2, D, &mut self.settings, decoder, offset + 0, _depth)?;
2380            Ok(())
2381        }
2382    }
2383
2384    impl fidl::encoding::ValueTypeMarker for AudioSetRequest {
2385        type Borrowed<'a> = &'a Self;
2386        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2387            value
2388        }
2389    }
2390
2391    unsafe impl fidl::encoding::TypeMarker for AudioSetRequest {
2392        type Owned = Self;
2393
2394        #[inline(always)]
2395        fn inline_align(_context: fidl::encoding::Context) -> usize {
2396            8
2397        }
2398
2399        #[inline(always)]
2400        fn inline_size(_context: fidl::encoding::Context) -> usize {
2401            16
2402        }
2403    }
2404
2405    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioSetRequest, D>
2406        for &AudioSetRequest
2407    {
2408        #[inline]
2409        unsafe fn encode(
2410            self,
2411            encoder: &mut fidl::encoding::Encoder<'_, D>,
2412            offset: usize,
2413            _depth: fidl::encoding::Depth,
2414        ) -> fidl::Result<()> {
2415            encoder.debug_check_bounds::<AudioSetRequest>(offset);
2416            // Delegate to tuple encoding.
2417            fidl::encoding::Encode::<AudioSetRequest, D>::encode(
2418                (<AudioSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2419                encoder,
2420                offset,
2421                _depth,
2422            )
2423        }
2424    }
2425    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioSettings, D>>
2426        fidl::encoding::Encode<AudioSetRequest, D> for (T0,)
2427    {
2428        #[inline]
2429        unsafe fn encode(
2430            self,
2431            encoder: &mut fidl::encoding::Encoder<'_, D>,
2432            offset: usize,
2433            depth: fidl::encoding::Depth,
2434        ) -> fidl::Result<()> {
2435            encoder.debug_check_bounds::<AudioSetRequest>(offset);
2436            // Zero out padding regions. There's no need to apply masks
2437            // because the unmasked parts will be overwritten by fields.
2438            // Write the fields.
2439            self.0.encode(encoder, offset + 0, depth)?;
2440            Ok(())
2441        }
2442    }
2443
2444    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioSetRequest {
2445        #[inline(always)]
2446        fn new_empty() -> Self {
2447            Self { settings: fidl::new_empty!(AudioSettings, D) }
2448        }
2449
2450        #[inline]
2451        unsafe fn decode(
2452            &mut self,
2453            decoder: &mut fidl::encoding::Decoder<'_, D>,
2454            offset: usize,
2455            _depth: fidl::encoding::Depth,
2456        ) -> fidl::Result<()> {
2457            decoder.debug_check_bounds::<Self>(offset);
2458            // Verify that padding bytes are zero.
2459            fidl::decode!(AudioSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2460            Ok(())
2461        }
2462    }
2463
2464    impl fidl::encoding::ValueTypeMarker for AudioWatchResponse {
2465        type Borrowed<'a> = &'a Self;
2466        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2467            value
2468        }
2469    }
2470
2471    unsafe impl fidl::encoding::TypeMarker for AudioWatchResponse {
2472        type Owned = Self;
2473
2474        #[inline(always)]
2475        fn inline_align(_context: fidl::encoding::Context) -> usize {
2476            8
2477        }
2478
2479        #[inline(always)]
2480        fn inline_size(_context: fidl::encoding::Context) -> usize {
2481            16
2482        }
2483    }
2484
2485    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioWatchResponse, D>
2486        for &AudioWatchResponse
2487    {
2488        #[inline]
2489        unsafe fn encode(
2490            self,
2491            encoder: &mut fidl::encoding::Encoder<'_, D>,
2492            offset: usize,
2493            _depth: fidl::encoding::Depth,
2494        ) -> fidl::Result<()> {
2495            encoder.debug_check_bounds::<AudioWatchResponse>(offset);
2496            // Delegate to tuple encoding.
2497            fidl::encoding::Encode::<AudioWatchResponse, D>::encode(
2498                (<AudioSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2499                encoder,
2500                offset,
2501                _depth,
2502            )
2503        }
2504    }
2505    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioSettings, D>>
2506        fidl::encoding::Encode<AudioWatchResponse, D> for (T0,)
2507    {
2508        #[inline]
2509        unsafe fn encode(
2510            self,
2511            encoder: &mut fidl::encoding::Encoder<'_, D>,
2512            offset: usize,
2513            depth: fidl::encoding::Depth,
2514        ) -> fidl::Result<()> {
2515            encoder.debug_check_bounds::<AudioWatchResponse>(offset);
2516            // Zero out padding regions. There's no need to apply masks
2517            // because the unmasked parts will be overwritten by fields.
2518            // Write the fields.
2519            self.0.encode(encoder, offset + 0, depth)?;
2520            Ok(())
2521        }
2522    }
2523
2524    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioWatchResponse {
2525        #[inline(always)]
2526        fn new_empty() -> Self {
2527            Self { settings: fidl::new_empty!(AudioSettings, D) }
2528        }
2529
2530        #[inline]
2531        unsafe fn decode(
2532            &mut self,
2533            decoder: &mut fidl::encoding::Decoder<'_, D>,
2534            offset: usize,
2535            _depth: fidl::encoding::Depth,
2536        ) -> fidl::Result<()> {
2537            decoder.debug_check_bounds::<Self>(offset);
2538            // Verify that padding bytes are zero.
2539            fidl::decode!(AudioSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2540            Ok(())
2541        }
2542    }
2543
2544    impl fidl::encoding::ValueTypeMarker for AudioWatch2Response {
2545        type Borrowed<'a> = &'a Self;
2546        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2547            value
2548        }
2549    }
2550
2551    unsafe impl fidl::encoding::TypeMarker for AudioWatch2Response {
2552        type Owned = Self;
2553
2554        #[inline(always)]
2555        fn inline_align(_context: fidl::encoding::Context) -> usize {
2556            8
2557        }
2558
2559        #[inline(always)]
2560        fn inline_size(_context: fidl::encoding::Context) -> usize {
2561            16
2562        }
2563    }
2564
2565    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioWatch2Response, D>
2566        for &AudioWatch2Response
2567    {
2568        #[inline]
2569        unsafe fn encode(
2570            self,
2571            encoder: &mut fidl::encoding::Encoder<'_, D>,
2572            offset: usize,
2573            _depth: fidl::encoding::Depth,
2574        ) -> fidl::Result<()> {
2575            encoder.debug_check_bounds::<AudioWatch2Response>(offset);
2576            // Delegate to tuple encoding.
2577            fidl::encoding::Encode::<AudioWatch2Response, D>::encode(
2578                (<AudioSettings2 as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2579                encoder,
2580                offset,
2581                _depth,
2582            )
2583        }
2584    }
2585    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<AudioSettings2, D>>
2586        fidl::encoding::Encode<AudioWatch2Response, D> for (T0,)
2587    {
2588        #[inline]
2589        unsafe fn encode(
2590            self,
2591            encoder: &mut fidl::encoding::Encoder<'_, D>,
2592            offset: usize,
2593            depth: fidl::encoding::Depth,
2594        ) -> fidl::Result<()> {
2595            encoder.debug_check_bounds::<AudioWatch2Response>(offset);
2596            // Zero out padding regions. There's no need to apply masks
2597            // because the unmasked parts will be overwritten by fields.
2598            // Write the fields.
2599            self.0.encode(encoder, offset + 0, depth)?;
2600            Ok(())
2601        }
2602    }
2603
2604    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioWatch2Response {
2605        #[inline(always)]
2606        fn new_empty() -> Self {
2607            Self { settings: fidl::new_empty!(AudioSettings2, D) }
2608        }
2609
2610        #[inline]
2611        unsafe fn decode(
2612            &mut self,
2613            decoder: &mut fidl::encoding::Decoder<'_, D>,
2614            offset: usize,
2615            _depth: fidl::encoding::Depth,
2616        ) -> fidl::Result<()> {
2617            decoder.debug_check_bounds::<Self>(offset);
2618            // Verify that padding bytes are zero.
2619            fidl::decode!(AudioSettings2, D, &mut self.settings, decoder, offset + 0, _depth)?;
2620            Ok(())
2621        }
2622    }
2623
2624    impl fidl::encoding::ValueTypeMarker for Autorepeat {
2625        type Borrowed<'a> = &'a Self;
2626        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2627            value
2628        }
2629    }
2630
2631    unsafe impl fidl::encoding::TypeMarker for Autorepeat {
2632        type Owned = Self;
2633
2634        #[inline(always)]
2635        fn inline_align(_context: fidl::encoding::Context) -> usize {
2636            8
2637        }
2638
2639        #[inline(always)]
2640        fn inline_size(_context: fidl::encoding::Context) -> usize {
2641            16
2642        }
2643        #[inline(always)]
2644        fn encode_is_copy() -> bool {
2645            true
2646        }
2647
2648        #[inline(always)]
2649        fn decode_is_copy() -> bool {
2650            true
2651        }
2652    }
2653
2654    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Autorepeat, D>
2655        for &Autorepeat
2656    {
2657        #[inline]
2658        unsafe fn encode(
2659            self,
2660            encoder: &mut fidl::encoding::Encoder<'_, D>,
2661            offset: usize,
2662            _depth: fidl::encoding::Depth,
2663        ) -> fidl::Result<()> {
2664            encoder.debug_check_bounds::<Autorepeat>(offset);
2665            unsafe {
2666                // Copy the object into the buffer.
2667                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2668                (buf_ptr as *mut Autorepeat).write_unaligned((self as *const Autorepeat).read());
2669                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2670                // done second because the memcpy will write garbage to these bytes.
2671            }
2672            Ok(())
2673        }
2674    }
2675    unsafe impl<
2676            D: fidl::encoding::ResourceDialect,
2677            T0: fidl::encoding::Encode<i64, D>,
2678            T1: fidl::encoding::Encode<i64, D>,
2679        > fidl::encoding::Encode<Autorepeat, D> for (T0, T1)
2680    {
2681        #[inline]
2682        unsafe fn encode(
2683            self,
2684            encoder: &mut fidl::encoding::Encoder<'_, D>,
2685            offset: usize,
2686            depth: fidl::encoding::Depth,
2687        ) -> fidl::Result<()> {
2688            encoder.debug_check_bounds::<Autorepeat>(offset);
2689            // Zero out padding regions. There's no need to apply masks
2690            // because the unmasked parts will be overwritten by fields.
2691            // Write the fields.
2692            self.0.encode(encoder, offset + 0, depth)?;
2693            self.1.encode(encoder, offset + 8, depth)?;
2694            Ok(())
2695        }
2696    }
2697
2698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Autorepeat {
2699        #[inline(always)]
2700        fn new_empty() -> Self {
2701            Self { delay: fidl::new_empty!(i64, D), period: fidl::new_empty!(i64, D) }
2702        }
2703
2704        #[inline]
2705        unsafe fn decode(
2706            &mut self,
2707            decoder: &mut fidl::encoding::Decoder<'_, D>,
2708            offset: usize,
2709            _depth: fidl::encoding::Depth,
2710        ) -> fidl::Result<()> {
2711            decoder.debug_check_bounds::<Self>(offset);
2712            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2713            // Verify that padding bytes are zero.
2714            // Copy from the buffer into the object.
2715            unsafe {
2716                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2717            }
2718            Ok(())
2719        }
2720    }
2721
2722    impl fidl::encoding::ValueTypeMarker for DisplaySetRequest {
2723        type Borrowed<'a> = &'a Self;
2724        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2725            value
2726        }
2727    }
2728
2729    unsafe impl fidl::encoding::TypeMarker for DisplaySetRequest {
2730        type Owned = Self;
2731
2732        #[inline(always)]
2733        fn inline_align(_context: fidl::encoding::Context) -> usize {
2734            8
2735        }
2736
2737        #[inline(always)]
2738        fn inline_size(_context: fidl::encoding::Context) -> usize {
2739            16
2740        }
2741    }
2742
2743    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisplaySetRequest, D>
2744        for &DisplaySetRequest
2745    {
2746        #[inline]
2747        unsafe fn encode(
2748            self,
2749            encoder: &mut fidl::encoding::Encoder<'_, D>,
2750            offset: usize,
2751            _depth: fidl::encoding::Depth,
2752        ) -> fidl::Result<()> {
2753            encoder.debug_check_bounds::<DisplaySetRequest>(offset);
2754            // Delegate to tuple encoding.
2755            fidl::encoding::Encode::<DisplaySetRequest, D>::encode(
2756                (<DisplaySettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2757                encoder,
2758                offset,
2759                _depth,
2760            )
2761        }
2762    }
2763    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DisplaySettings, D>>
2764        fidl::encoding::Encode<DisplaySetRequest, D> for (T0,)
2765    {
2766        #[inline]
2767        unsafe fn encode(
2768            self,
2769            encoder: &mut fidl::encoding::Encoder<'_, D>,
2770            offset: usize,
2771            depth: fidl::encoding::Depth,
2772        ) -> fidl::Result<()> {
2773            encoder.debug_check_bounds::<DisplaySetRequest>(offset);
2774            // Zero out padding regions. There's no need to apply masks
2775            // because the unmasked parts will be overwritten by fields.
2776            // Write the fields.
2777            self.0.encode(encoder, offset + 0, depth)?;
2778            Ok(())
2779        }
2780    }
2781
2782    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisplaySetRequest {
2783        #[inline(always)]
2784        fn new_empty() -> Self {
2785            Self { settings: fidl::new_empty!(DisplaySettings, D) }
2786        }
2787
2788        #[inline]
2789        unsafe fn decode(
2790            &mut self,
2791            decoder: &mut fidl::encoding::Decoder<'_, D>,
2792            offset: usize,
2793            _depth: fidl::encoding::Depth,
2794        ) -> fidl::Result<()> {
2795            decoder.debug_check_bounds::<Self>(offset);
2796            // Verify that padding bytes are zero.
2797            fidl::decode!(DisplaySettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2798            Ok(())
2799        }
2800    }
2801
2802    impl fidl::encoding::ValueTypeMarker for DisplayWatchResponse {
2803        type Borrowed<'a> = &'a Self;
2804        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2805            value
2806        }
2807    }
2808
2809    unsafe impl fidl::encoding::TypeMarker for DisplayWatchResponse {
2810        type Owned = Self;
2811
2812        #[inline(always)]
2813        fn inline_align(_context: fidl::encoding::Context) -> usize {
2814            8
2815        }
2816
2817        #[inline(always)]
2818        fn inline_size(_context: fidl::encoding::Context) -> usize {
2819            16
2820        }
2821    }
2822
2823    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisplayWatchResponse, D>
2824        for &DisplayWatchResponse
2825    {
2826        #[inline]
2827        unsafe fn encode(
2828            self,
2829            encoder: &mut fidl::encoding::Encoder<'_, D>,
2830            offset: usize,
2831            _depth: fidl::encoding::Depth,
2832        ) -> fidl::Result<()> {
2833            encoder.debug_check_bounds::<DisplayWatchResponse>(offset);
2834            // Delegate to tuple encoding.
2835            fidl::encoding::Encode::<DisplayWatchResponse, D>::encode(
2836                (<DisplaySettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2837                encoder,
2838                offset,
2839                _depth,
2840            )
2841        }
2842    }
2843    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DisplaySettings, D>>
2844        fidl::encoding::Encode<DisplayWatchResponse, D> for (T0,)
2845    {
2846        #[inline]
2847        unsafe fn encode(
2848            self,
2849            encoder: &mut fidl::encoding::Encoder<'_, D>,
2850            offset: usize,
2851            depth: fidl::encoding::Depth,
2852        ) -> fidl::Result<()> {
2853            encoder.debug_check_bounds::<DisplayWatchResponse>(offset);
2854            // Zero out padding regions. There's no need to apply masks
2855            // because the unmasked parts will be overwritten by fields.
2856            // Write the fields.
2857            self.0.encode(encoder, offset + 0, depth)?;
2858            Ok(())
2859        }
2860    }
2861
2862    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisplayWatchResponse {
2863        #[inline(always)]
2864        fn new_empty() -> Self {
2865            Self { settings: fidl::new_empty!(DisplaySettings, D) }
2866        }
2867
2868        #[inline]
2869        unsafe fn decode(
2870            &mut self,
2871            decoder: &mut fidl::encoding::Decoder<'_, D>,
2872            offset: usize,
2873            _depth: fidl::encoding::Depth,
2874        ) -> fidl::Result<()> {
2875            decoder.debug_check_bounds::<Self>(offset);
2876            // Verify that padding bytes are zero.
2877            fidl::decode!(DisplaySettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
2878            Ok(())
2879        }
2880    }
2881
2882    impl fidl::encoding::ValueTypeMarker for DoNotDisturbSetRequest {
2883        type Borrowed<'a> = &'a Self;
2884        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2885            value
2886        }
2887    }
2888
2889    unsafe impl fidl::encoding::TypeMarker for DoNotDisturbSetRequest {
2890        type Owned = Self;
2891
2892        #[inline(always)]
2893        fn inline_align(_context: fidl::encoding::Context) -> usize {
2894            8
2895        }
2896
2897        #[inline(always)]
2898        fn inline_size(_context: fidl::encoding::Context) -> usize {
2899            16
2900        }
2901    }
2902
2903    unsafe impl<D: fidl::encoding::ResourceDialect>
2904        fidl::encoding::Encode<DoNotDisturbSetRequest, D> for &DoNotDisturbSetRequest
2905    {
2906        #[inline]
2907        unsafe fn encode(
2908            self,
2909            encoder: &mut fidl::encoding::Encoder<'_, D>,
2910            offset: usize,
2911            _depth: fidl::encoding::Depth,
2912        ) -> fidl::Result<()> {
2913            encoder.debug_check_bounds::<DoNotDisturbSetRequest>(offset);
2914            // Delegate to tuple encoding.
2915            fidl::encoding::Encode::<DoNotDisturbSetRequest, D>::encode(
2916                (<DoNotDisturbSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
2917                encoder,
2918                offset,
2919                _depth,
2920            )
2921        }
2922    }
2923    unsafe impl<
2924            D: fidl::encoding::ResourceDialect,
2925            T0: fidl::encoding::Encode<DoNotDisturbSettings, D>,
2926        > fidl::encoding::Encode<DoNotDisturbSetRequest, D> for (T0,)
2927    {
2928        #[inline]
2929        unsafe fn encode(
2930            self,
2931            encoder: &mut fidl::encoding::Encoder<'_, D>,
2932            offset: usize,
2933            depth: fidl::encoding::Depth,
2934        ) -> fidl::Result<()> {
2935            encoder.debug_check_bounds::<DoNotDisturbSetRequest>(offset);
2936            // Zero out padding regions. There's no need to apply masks
2937            // because the unmasked parts will be overwritten by fields.
2938            // Write the fields.
2939            self.0.encode(encoder, offset + 0, depth)?;
2940            Ok(())
2941        }
2942    }
2943
2944    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2945        for DoNotDisturbSetRequest
2946    {
2947        #[inline(always)]
2948        fn new_empty() -> Self {
2949            Self { settings: fidl::new_empty!(DoNotDisturbSettings, D) }
2950        }
2951
2952        #[inline]
2953        unsafe fn decode(
2954            &mut self,
2955            decoder: &mut fidl::encoding::Decoder<'_, D>,
2956            offset: usize,
2957            _depth: fidl::encoding::Depth,
2958        ) -> fidl::Result<()> {
2959            decoder.debug_check_bounds::<Self>(offset);
2960            // Verify that padding bytes are zero.
2961            fidl::decode!(
2962                DoNotDisturbSettings,
2963                D,
2964                &mut self.settings,
2965                decoder,
2966                offset + 0,
2967                _depth
2968            )?;
2969            Ok(())
2970        }
2971    }
2972
2973    impl fidl::encoding::ValueTypeMarker for DoNotDisturbWatchResponse {
2974        type Borrowed<'a> = &'a Self;
2975        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2976            value
2977        }
2978    }
2979
2980    unsafe impl fidl::encoding::TypeMarker for DoNotDisturbWatchResponse {
2981        type Owned = Self;
2982
2983        #[inline(always)]
2984        fn inline_align(_context: fidl::encoding::Context) -> usize {
2985            8
2986        }
2987
2988        #[inline(always)]
2989        fn inline_size(_context: fidl::encoding::Context) -> usize {
2990            16
2991        }
2992    }
2993
2994    unsafe impl<D: fidl::encoding::ResourceDialect>
2995        fidl::encoding::Encode<DoNotDisturbWatchResponse, D> for &DoNotDisturbWatchResponse
2996    {
2997        #[inline]
2998        unsafe fn encode(
2999            self,
3000            encoder: &mut fidl::encoding::Encoder<'_, D>,
3001            offset: usize,
3002            _depth: fidl::encoding::Depth,
3003        ) -> fidl::Result<()> {
3004            encoder.debug_check_bounds::<DoNotDisturbWatchResponse>(offset);
3005            // Delegate to tuple encoding.
3006            fidl::encoding::Encode::<DoNotDisturbWatchResponse, D>::encode(
3007                (<DoNotDisturbSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3008                encoder,
3009                offset,
3010                _depth,
3011            )
3012        }
3013    }
3014    unsafe impl<
3015            D: fidl::encoding::ResourceDialect,
3016            T0: fidl::encoding::Encode<DoNotDisturbSettings, D>,
3017        > fidl::encoding::Encode<DoNotDisturbWatchResponse, D> for (T0,)
3018    {
3019        #[inline]
3020        unsafe fn encode(
3021            self,
3022            encoder: &mut fidl::encoding::Encoder<'_, D>,
3023            offset: usize,
3024            depth: fidl::encoding::Depth,
3025        ) -> fidl::Result<()> {
3026            encoder.debug_check_bounds::<DoNotDisturbWatchResponse>(offset);
3027            // Zero out padding regions. There's no need to apply masks
3028            // because the unmasked parts will be overwritten by fields.
3029            // Write the fields.
3030            self.0.encode(encoder, offset + 0, depth)?;
3031            Ok(())
3032        }
3033    }
3034
3035    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3036        for DoNotDisturbWatchResponse
3037    {
3038        #[inline(always)]
3039        fn new_empty() -> Self {
3040            Self { settings: fidl::new_empty!(DoNotDisturbSettings, D) }
3041        }
3042
3043        #[inline]
3044        unsafe fn decode(
3045            &mut self,
3046            decoder: &mut fidl::encoding::Decoder<'_, D>,
3047            offset: usize,
3048            _depth: fidl::encoding::Depth,
3049        ) -> fidl::Result<()> {
3050            decoder.debug_check_bounds::<Self>(offset);
3051            // Verify that padding bytes are zero.
3052            fidl::decode!(
3053                DoNotDisturbSettings,
3054                D,
3055                &mut self.settings,
3056                decoder,
3057                offset + 0,
3058                _depth
3059            )?;
3060            Ok(())
3061        }
3062    }
3063
3064    impl fidl::encoding::ValueTypeMarker for FactoryResetSetRequest {
3065        type Borrowed<'a> = &'a Self;
3066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3067            value
3068        }
3069    }
3070
3071    unsafe impl fidl::encoding::TypeMarker for FactoryResetSetRequest {
3072        type Owned = Self;
3073
3074        #[inline(always)]
3075        fn inline_align(_context: fidl::encoding::Context) -> usize {
3076            8
3077        }
3078
3079        #[inline(always)]
3080        fn inline_size(_context: fidl::encoding::Context) -> usize {
3081            16
3082        }
3083    }
3084
3085    unsafe impl<D: fidl::encoding::ResourceDialect>
3086        fidl::encoding::Encode<FactoryResetSetRequest, D> for &FactoryResetSetRequest
3087    {
3088        #[inline]
3089        unsafe fn encode(
3090            self,
3091            encoder: &mut fidl::encoding::Encoder<'_, D>,
3092            offset: usize,
3093            _depth: fidl::encoding::Depth,
3094        ) -> fidl::Result<()> {
3095            encoder.debug_check_bounds::<FactoryResetSetRequest>(offset);
3096            // Delegate to tuple encoding.
3097            fidl::encoding::Encode::<FactoryResetSetRequest, D>::encode(
3098                (<FactoryResetSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3099                encoder,
3100                offset,
3101                _depth,
3102            )
3103        }
3104    }
3105    unsafe impl<
3106            D: fidl::encoding::ResourceDialect,
3107            T0: fidl::encoding::Encode<FactoryResetSettings, D>,
3108        > fidl::encoding::Encode<FactoryResetSetRequest, D> for (T0,)
3109    {
3110        #[inline]
3111        unsafe fn encode(
3112            self,
3113            encoder: &mut fidl::encoding::Encoder<'_, D>,
3114            offset: usize,
3115            depth: fidl::encoding::Depth,
3116        ) -> fidl::Result<()> {
3117            encoder.debug_check_bounds::<FactoryResetSetRequest>(offset);
3118            // Zero out padding regions. There's no need to apply masks
3119            // because the unmasked parts will be overwritten by fields.
3120            // Write the fields.
3121            self.0.encode(encoder, offset + 0, depth)?;
3122            Ok(())
3123        }
3124    }
3125
3126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3127        for FactoryResetSetRequest
3128    {
3129        #[inline(always)]
3130        fn new_empty() -> Self {
3131            Self { settings: fidl::new_empty!(FactoryResetSettings, D) }
3132        }
3133
3134        #[inline]
3135        unsafe fn decode(
3136            &mut self,
3137            decoder: &mut fidl::encoding::Decoder<'_, D>,
3138            offset: usize,
3139            _depth: fidl::encoding::Depth,
3140        ) -> fidl::Result<()> {
3141            decoder.debug_check_bounds::<Self>(offset);
3142            // Verify that padding bytes are zero.
3143            fidl::decode!(
3144                FactoryResetSettings,
3145                D,
3146                &mut self.settings,
3147                decoder,
3148                offset + 0,
3149                _depth
3150            )?;
3151            Ok(())
3152        }
3153    }
3154
3155    impl fidl::encoding::ValueTypeMarker for FactoryResetWatchResponse {
3156        type Borrowed<'a> = &'a Self;
3157        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3158            value
3159        }
3160    }
3161
3162    unsafe impl fidl::encoding::TypeMarker for FactoryResetWatchResponse {
3163        type Owned = Self;
3164
3165        #[inline(always)]
3166        fn inline_align(_context: fidl::encoding::Context) -> usize {
3167            8
3168        }
3169
3170        #[inline(always)]
3171        fn inline_size(_context: fidl::encoding::Context) -> usize {
3172            16
3173        }
3174    }
3175
3176    unsafe impl<D: fidl::encoding::ResourceDialect>
3177        fidl::encoding::Encode<FactoryResetWatchResponse, D> for &FactoryResetWatchResponse
3178    {
3179        #[inline]
3180        unsafe fn encode(
3181            self,
3182            encoder: &mut fidl::encoding::Encoder<'_, D>,
3183            offset: usize,
3184            _depth: fidl::encoding::Depth,
3185        ) -> fidl::Result<()> {
3186            encoder.debug_check_bounds::<FactoryResetWatchResponse>(offset);
3187            // Delegate to tuple encoding.
3188            fidl::encoding::Encode::<FactoryResetWatchResponse, D>::encode(
3189                (<FactoryResetSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3190                encoder,
3191                offset,
3192                _depth,
3193            )
3194        }
3195    }
3196    unsafe impl<
3197            D: fidl::encoding::ResourceDialect,
3198            T0: fidl::encoding::Encode<FactoryResetSettings, D>,
3199        > fidl::encoding::Encode<FactoryResetWatchResponse, D> for (T0,)
3200    {
3201        #[inline]
3202        unsafe fn encode(
3203            self,
3204            encoder: &mut fidl::encoding::Encoder<'_, D>,
3205            offset: usize,
3206            depth: fidl::encoding::Depth,
3207        ) -> fidl::Result<()> {
3208            encoder.debug_check_bounds::<FactoryResetWatchResponse>(offset);
3209            // Zero out padding regions. There's no need to apply masks
3210            // because the unmasked parts will be overwritten by fields.
3211            // Write the fields.
3212            self.0.encode(encoder, offset + 0, depth)?;
3213            Ok(())
3214        }
3215    }
3216
3217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3218        for FactoryResetWatchResponse
3219    {
3220        #[inline(always)]
3221        fn new_empty() -> Self {
3222            Self { settings: fidl::new_empty!(FactoryResetSettings, D) }
3223        }
3224
3225        #[inline]
3226        unsafe fn decode(
3227            &mut self,
3228            decoder: &mut fidl::encoding::Decoder<'_, D>,
3229            offset: usize,
3230            _depth: fidl::encoding::Depth,
3231        ) -> fidl::Result<()> {
3232            decoder.debug_check_bounds::<Self>(offset);
3233            // Verify that padding bytes are zero.
3234            fidl::decode!(
3235                FactoryResetSettings,
3236                D,
3237                &mut self.settings,
3238                decoder,
3239                offset + 0,
3240                _depth
3241            )?;
3242            Ok(())
3243        }
3244    }
3245
3246    impl fidl::encoding::ValueTypeMarker for InputSetRequest {
3247        type Borrowed<'a> = &'a Self;
3248        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3249            value
3250        }
3251    }
3252
3253    unsafe impl fidl::encoding::TypeMarker for InputSetRequest {
3254        type Owned = Self;
3255
3256        #[inline(always)]
3257        fn inline_align(_context: fidl::encoding::Context) -> usize {
3258            8
3259        }
3260
3261        #[inline(always)]
3262        fn inline_size(_context: fidl::encoding::Context) -> usize {
3263            16
3264        }
3265    }
3266
3267    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputSetRequest, D>
3268        for &InputSetRequest
3269    {
3270        #[inline]
3271        unsafe fn encode(
3272            self,
3273            encoder: &mut fidl::encoding::Encoder<'_, D>,
3274            offset: usize,
3275            _depth: fidl::encoding::Depth,
3276        ) -> fidl::Result<()> {
3277            encoder.debug_check_bounds::<InputSetRequest>(offset);
3278            // Delegate to tuple encoding.
3279            fidl::encoding::Encode::<InputSetRequest, D>::encode(
3280                (
3281                    <fidl::encoding::UnboundedVector<InputState> as fidl::encoding::ValueTypeMarker>::borrow(&self.input_states),
3282                ),
3283                encoder, offset, _depth
3284            )
3285        }
3286    }
3287    unsafe impl<
3288            D: fidl::encoding::ResourceDialect,
3289            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<InputState>, D>,
3290        > fidl::encoding::Encode<InputSetRequest, D> for (T0,)
3291    {
3292        #[inline]
3293        unsafe fn encode(
3294            self,
3295            encoder: &mut fidl::encoding::Encoder<'_, D>,
3296            offset: usize,
3297            depth: fidl::encoding::Depth,
3298        ) -> fidl::Result<()> {
3299            encoder.debug_check_bounds::<InputSetRequest>(offset);
3300            // Zero out padding regions. There's no need to apply masks
3301            // because the unmasked parts will be overwritten by fields.
3302            // Write the fields.
3303            self.0.encode(encoder, offset + 0, depth)?;
3304            Ok(())
3305        }
3306    }
3307
3308    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputSetRequest {
3309        #[inline(always)]
3310        fn new_empty() -> Self {
3311            Self { input_states: fidl::new_empty!(fidl::encoding::UnboundedVector<InputState>, D) }
3312        }
3313
3314        #[inline]
3315        unsafe fn decode(
3316            &mut self,
3317            decoder: &mut fidl::encoding::Decoder<'_, D>,
3318            offset: usize,
3319            _depth: fidl::encoding::Depth,
3320        ) -> fidl::Result<()> {
3321            decoder.debug_check_bounds::<Self>(offset);
3322            // Verify that padding bytes are zero.
3323            fidl::decode!(
3324                fidl::encoding::UnboundedVector<InputState>,
3325                D,
3326                &mut self.input_states,
3327                decoder,
3328                offset + 0,
3329                _depth
3330            )?;
3331            Ok(())
3332        }
3333    }
3334
3335    impl fidl::encoding::ValueTypeMarker for InputWatchResponse {
3336        type Borrowed<'a> = &'a Self;
3337        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3338            value
3339        }
3340    }
3341
3342    unsafe impl fidl::encoding::TypeMarker for InputWatchResponse {
3343        type Owned = Self;
3344
3345        #[inline(always)]
3346        fn inline_align(_context: fidl::encoding::Context) -> usize {
3347            8
3348        }
3349
3350        #[inline(always)]
3351        fn inline_size(_context: fidl::encoding::Context) -> usize {
3352            16
3353        }
3354    }
3355
3356    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputWatchResponse, D>
3357        for &InputWatchResponse
3358    {
3359        #[inline]
3360        unsafe fn encode(
3361            self,
3362            encoder: &mut fidl::encoding::Encoder<'_, D>,
3363            offset: usize,
3364            _depth: fidl::encoding::Depth,
3365        ) -> fidl::Result<()> {
3366            encoder.debug_check_bounds::<InputWatchResponse>(offset);
3367            // Delegate to tuple encoding.
3368            fidl::encoding::Encode::<InputWatchResponse, D>::encode(
3369                (<InputSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3370                encoder,
3371                offset,
3372                _depth,
3373            )
3374        }
3375    }
3376    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputSettings, D>>
3377        fidl::encoding::Encode<InputWatchResponse, D> for (T0,)
3378    {
3379        #[inline]
3380        unsafe fn encode(
3381            self,
3382            encoder: &mut fidl::encoding::Encoder<'_, D>,
3383            offset: usize,
3384            depth: fidl::encoding::Depth,
3385        ) -> fidl::Result<()> {
3386            encoder.debug_check_bounds::<InputWatchResponse>(offset);
3387            // Zero out padding regions. There's no need to apply masks
3388            // because the unmasked parts will be overwritten by fields.
3389            // Write the fields.
3390            self.0.encode(encoder, offset + 0, depth)?;
3391            Ok(())
3392        }
3393    }
3394
3395    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputWatchResponse {
3396        #[inline(always)]
3397        fn new_empty() -> Self {
3398            Self { settings: fidl::new_empty!(InputSettings, D) }
3399        }
3400
3401        #[inline]
3402        unsafe fn decode(
3403            &mut self,
3404            decoder: &mut fidl::encoding::Decoder<'_, D>,
3405            offset: usize,
3406            _depth: fidl::encoding::Depth,
3407        ) -> fidl::Result<()> {
3408            decoder.debug_check_bounds::<Self>(offset);
3409            // Verify that padding bytes are zero.
3410            fidl::decode!(InputSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
3411            Ok(())
3412        }
3413    }
3414
3415    impl fidl::encoding::ValueTypeMarker for IntlSetRequest {
3416        type Borrowed<'a> = &'a Self;
3417        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3418            value
3419        }
3420    }
3421
3422    unsafe impl fidl::encoding::TypeMarker for IntlSetRequest {
3423        type Owned = Self;
3424
3425        #[inline(always)]
3426        fn inline_align(_context: fidl::encoding::Context) -> usize {
3427            8
3428        }
3429
3430        #[inline(always)]
3431        fn inline_size(_context: fidl::encoding::Context) -> usize {
3432            16
3433        }
3434    }
3435
3436    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IntlSetRequest, D>
3437        for &IntlSetRequest
3438    {
3439        #[inline]
3440        unsafe fn encode(
3441            self,
3442            encoder: &mut fidl::encoding::Encoder<'_, D>,
3443            offset: usize,
3444            _depth: fidl::encoding::Depth,
3445        ) -> fidl::Result<()> {
3446            encoder.debug_check_bounds::<IntlSetRequest>(offset);
3447            // Delegate to tuple encoding.
3448            fidl::encoding::Encode::<IntlSetRequest, D>::encode(
3449                (<IntlSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3450                encoder,
3451                offset,
3452                _depth,
3453            )
3454        }
3455    }
3456    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<IntlSettings, D>>
3457        fidl::encoding::Encode<IntlSetRequest, D> for (T0,)
3458    {
3459        #[inline]
3460        unsafe fn encode(
3461            self,
3462            encoder: &mut fidl::encoding::Encoder<'_, D>,
3463            offset: usize,
3464            depth: fidl::encoding::Depth,
3465        ) -> fidl::Result<()> {
3466            encoder.debug_check_bounds::<IntlSetRequest>(offset);
3467            // Zero out padding regions. There's no need to apply masks
3468            // because the unmasked parts will be overwritten by fields.
3469            // Write the fields.
3470            self.0.encode(encoder, offset + 0, depth)?;
3471            Ok(())
3472        }
3473    }
3474
3475    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IntlSetRequest {
3476        #[inline(always)]
3477        fn new_empty() -> Self {
3478            Self { settings: fidl::new_empty!(IntlSettings, D) }
3479        }
3480
3481        #[inline]
3482        unsafe fn decode(
3483            &mut self,
3484            decoder: &mut fidl::encoding::Decoder<'_, D>,
3485            offset: usize,
3486            _depth: fidl::encoding::Depth,
3487        ) -> fidl::Result<()> {
3488            decoder.debug_check_bounds::<Self>(offset);
3489            // Verify that padding bytes are zero.
3490            fidl::decode!(IntlSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
3491            Ok(())
3492        }
3493    }
3494
3495    impl fidl::encoding::ValueTypeMarker for IntlWatchResponse {
3496        type Borrowed<'a> = &'a Self;
3497        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3498            value
3499        }
3500    }
3501
3502    unsafe impl fidl::encoding::TypeMarker for IntlWatchResponse {
3503        type Owned = Self;
3504
3505        #[inline(always)]
3506        fn inline_align(_context: fidl::encoding::Context) -> usize {
3507            8
3508        }
3509
3510        #[inline(always)]
3511        fn inline_size(_context: fidl::encoding::Context) -> usize {
3512            16
3513        }
3514    }
3515
3516    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IntlWatchResponse, D>
3517        for &IntlWatchResponse
3518    {
3519        #[inline]
3520        unsafe fn encode(
3521            self,
3522            encoder: &mut fidl::encoding::Encoder<'_, D>,
3523            offset: usize,
3524            _depth: fidl::encoding::Depth,
3525        ) -> fidl::Result<()> {
3526            encoder.debug_check_bounds::<IntlWatchResponse>(offset);
3527            // Delegate to tuple encoding.
3528            fidl::encoding::Encode::<IntlWatchResponse, D>::encode(
3529                (<IntlSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3530                encoder,
3531                offset,
3532                _depth,
3533            )
3534        }
3535    }
3536    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<IntlSettings, D>>
3537        fidl::encoding::Encode<IntlWatchResponse, D> for (T0,)
3538    {
3539        #[inline]
3540        unsafe fn encode(
3541            self,
3542            encoder: &mut fidl::encoding::Encoder<'_, D>,
3543            offset: usize,
3544            depth: fidl::encoding::Depth,
3545        ) -> fidl::Result<()> {
3546            encoder.debug_check_bounds::<IntlWatchResponse>(offset);
3547            // Zero out padding regions. There's no need to apply masks
3548            // because the unmasked parts will be overwritten by fields.
3549            // Write the fields.
3550            self.0.encode(encoder, offset + 0, depth)?;
3551            Ok(())
3552        }
3553    }
3554
3555    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IntlWatchResponse {
3556        #[inline(always)]
3557        fn new_empty() -> Self {
3558            Self { settings: fidl::new_empty!(IntlSettings, D) }
3559        }
3560
3561        #[inline]
3562        unsafe fn decode(
3563            &mut self,
3564            decoder: &mut fidl::encoding::Decoder<'_, D>,
3565            offset: usize,
3566            _depth: fidl::encoding::Depth,
3567        ) -> fidl::Result<()> {
3568            decoder.debug_check_bounds::<Self>(offset);
3569            // Verify that padding bytes are zero.
3570            fidl::decode!(IntlSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
3571            Ok(())
3572        }
3573    }
3574
3575    impl fidl::encoding::ValueTypeMarker for KeyboardSetSetRequest {
3576        type Borrowed<'a> = &'a Self;
3577        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3578            value
3579        }
3580    }
3581
3582    unsafe impl fidl::encoding::TypeMarker for KeyboardSetSetRequest {
3583        type Owned = Self;
3584
3585        #[inline(always)]
3586        fn inline_align(_context: fidl::encoding::Context) -> usize {
3587            8
3588        }
3589
3590        #[inline(always)]
3591        fn inline_size(_context: fidl::encoding::Context) -> usize {
3592            16
3593        }
3594    }
3595
3596    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardSetSetRequest, D>
3597        for &KeyboardSetSetRequest
3598    {
3599        #[inline]
3600        unsafe fn encode(
3601            self,
3602            encoder: &mut fidl::encoding::Encoder<'_, D>,
3603            offset: usize,
3604            _depth: fidl::encoding::Depth,
3605        ) -> fidl::Result<()> {
3606            encoder.debug_check_bounds::<KeyboardSetSetRequest>(offset);
3607            // Delegate to tuple encoding.
3608            fidl::encoding::Encode::<KeyboardSetSetRequest, D>::encode(
3609                (<KeyboardSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3610                encoder,
3611                offset,
3612                _depth,
3613            )
3614        }
3615    }
3616    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardSettings, D>>
3617        fidl::encoding::Encode<KeyboardSetSetRequest, D> for (T0,)
3618    {
3619        #[inline]
3620        unsafe fn encode(
3621            self,
3622            encoder: &mut fidl::encoding::Encoder<'_, D>,
3623            offset: usize,
3624            depth: fidl::encoding::Depth,
3625        ) -> fidl::Result<()> {
3626            encoder.debug_check_bounds::<KeyboardSetSetRequest>(offset);
3627            // Zero out padding regions. There's no need to apply masks
3628            // because the unmasked parts will be overwritten by fields.
3629            // Write the fields.
3630            self.0.encode(encoder, offset + 0, depth)?;
3631            Ok(())
3632        }
3633    }
3634
3635    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardSetSetRequest {
3636        #[inline(always)]
3637        fn new_empty() -> Self {
3638            Self { settings: fidl::new_empty!(KeyboardSettings, D) }
3639        }
3640
3641        #[inline]
3642        unsafe fn decode(
3643            &mut self,
3644            decoder: &mut fidl::encoding::Decoder<'_, D>,
3645            offset: usize,
3646            _depth: fidl::encoding::Depth,
3647        ) -> fidl::Result<()> {
3648            decoder.debug_check_bounds::<Self>(offset);
3649            // Verify that padding bytes are zero.
3650            fidl::decode!(KeyboardSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
3651            Ok(())
3652        }
3653    }
3654
3655    impl fidl::encoding::ValueTypeMarker for KeyboardWatchWatchResponse {
3656        type Borrowed<'a> = &'a Self;
3657        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3658            value
3659        }
3660    }
3661
3662    unsafe impl fidl::encoding::TypeMarker for KeyboardWatchWatchResponse {
3663        type Owned = Self;
3664
3665        #[inline(always)]
3666        fn inline_align(_context: fidl::encoding::Context) -> usize {
3667            8
3668        }
3669
3670        #[inline(always)]
3671        fn inline_size(_context: fidl::encoding::Context) -> usize {
3672            16
3673        }
3674    }
3675
3676    unsafe impl<D: fidl::encoding::ResourceDialect>
3677        fidl::encoding::Encode<KeyboardWatchWatchResponse, D> for &KeyboardWatchWatchResponse
3678    {
3679        #[inline]
3680        unsafe fn encode(
3681            self,
3682            encoder: &mut fidl::encoding::Encoder<'_, D>,
3683            offset: usize,
3684            _depth: fidl::encoding::Depth,
3685        ) -> fidl::Result<()> {
3686            encoder.debug_check_bounds::<KeyboardWatchWatchResponse>(offset);
3687            // Delegate to tuple encoding.
3688            fidl::encoding::Encode::<KeyboardWatchWatchResponse, D>::encode(
3689                (<KeyboardSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
3690                encoder,
3691                offset,
3692                _depth,
3693            )
3694        }
3695    }
3696    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardSettings, D>>
3697        fidl::encoding::Encode<KeyboardWatchWatchResponse, D> for (T0,)
3698    {
3699        #[inline]
3700        unsafe fn encode(
3701            self,
3702            encoder: &mut fidl::encoding::Encoder<'_, D>,
3703            offset: usize,
3704            depth: fidl::encoding::Depth,
3705        ) -> fidl::Result<()> {
3706            encoder.debug_check_bounds::<KeyboardWatchWatchResponse>(offset);
3707            // Zero out padding regions. There's no need to apply masks
3708            // because the unmasked parts will be overwritten by fields.
3709            // Write the fields.
3710            self.0.encode(encoder, offset + 0, depth)?;
3711            Ok(())
3712        }
3713    }
3714
3715    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3716        for KeyboardWatchWatchResponse
3717    {
3718        #[inline(always)]
3719        fn new_empty() -> Self {
3720            Self { settings: fidl::new_empty!(KeyboardSettings, D) }
3721        }
3722
3723        #[inline]
3724        unsafe fn decode(
3725            &mut self,
3726            decoder: &mut fidl::encoding::Decoder<'_, D>,
3727            offset: usize,
3728            _depth: fidl::encoding::Depth,
3729        ) -> fidl::Result<()> {
3730            decoder.debug_check_bounds::<Self>(offset);
3731            // Verify that padding bytes are zero.
3732            fidl::decode!(KeyboardSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
3733            Ok(())
3734        }
3735    }
3736
3737    impl fidl::encoding::ValueTypeMarker for LightSetLightGroupValuesRequest {
3738        type Borrowed<'a> = &'a Self;
3739        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3740            value
3741        }
3742    }
3743
3744    unsafe impl fidl::encoding::TypeMarker for LightSetLightGroupValuesRequest {
3745        type Owned = Self;
3746
3747        #[inline(always)]
3748        fn inline_align(_context: fidl::encoding::Context) -> usize {
3749            8
3750        }
3751
3752        #[inline(always)]
3753        fn inline_size(_context: fidl::encoding::Context) -> usize {
3754            32
3755        }
3756    }
3757
3758    unsafe impl<D: fidl::encoding::ResourceDialect>
3759        fidl::encoding::Encode<LightSetLightGroupValuesRequest, D>
3760        for &LightSetLightGroupValuesRequest
3761    {
3762        #[inline]
3763        unsafe fn encode(
3764            self,
3765            encoder: &mut fidl::encoding::Encoder<'_, D>,
3766            offset: usize,
3767            _depth: fidl::encoding::Depth,
3768        ) -> fidl::Result<()> {
3769            encoder.debug_check_bounds::<LightSetLightGroupValuesRequest>(offset);
3770            // Delegate to tuple encoding.
3771            fidl::encoding::Encode::<LightSetLightGroupValuesRequest, D>::encode(
3772                (
3773                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
3774                    <fidl::encoding::UnboundedVector<LightState> as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
3775                ),
3776                encoder, offset, _depth
3777            )
3778        }
3779    }
3780    unsafe impl<
3781            D: fidl::encoding::ResourceDialect,
3782            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
3783            T1: fidl::encoding::Encode<fidl::encoding::UnboundedVector<LightState>, D>,
3784        > fidl::encoding::Encode<LightSetLightGroupValuesRequest, D> for (T0, T1)
3785    {
3786        #[inline]
3787        unsafe fn encode(
3788            self,
3789            encoder: &mut fidl::encoding::Encoder<'_, D>,
3790            offset: usize,
3791            depth: fidl::encoding::Depth,
3792        ) -> fidl::Result<()> {
3793            encoder.debug_check_bounds::<LightSetLightGroupValuesRequest>(offset);
3794            // Zero out padding regions. There's no need to apply masks
3795            // because the unmasked parts will be overwritten by fields.
3796            // Write the fields.
3797            self.0.encode(encoder, offset + 0, depth)?;
3798            self.1.encode(encoder, offset + 16, depth)?;
3799            Ok(())
3800        }
3801    }
3802
3803    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3804        for LightSetLightGroupValuesRequest
3805    {
3806        #[inline(always)]
3807        fn new_empty() -> Self {
3808            Self {
3809                name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D),
3810                state: fidl::new_empty!(fidl::encoding::UnboundedVector<LightState>, D),
3811            }
3812        }
3813
3814        #[inline]
3815        unsafe fn decode(
3816            &mut self,
3817            decoder: &mut fidl::encoding::Decoder<'_, D>,
3818            offset: usize,
3819            _depth: fidl::encoding::Depth,
3820        ) -> fidl::Result<()> {
3821            decoder.debug_check_bounds::<Self>(offset);
3822            // Verify that padding bytes are zero.
3823            fidl::decode!(
3824                fidl::encoding::BoundedString<32>,
3825                D,
3826                &mut self.name,
3827                decoder,
3828                offset + 0,
3829                _depth
3830            )?;
3831            fidl::decode!(
3832                fidl::encoding::UnboundedVector<LightState>,
3833                D,
3834                &mut self.state,
3835                decoder,
3836                offset + 16,
3837                _depth
3838            )?;
3839            Ok(())
3840        }
3841    }
3842
3843    impl fidl::encoding::ValueTypeMarker for LightWatchLightGroupRequest {
3844        type Borrowed<'a> = &'a Self;
3845        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3846            value
3847        }
3848    }
3849
3850    unsafe impl fidl::encoding::TypeMarker for LightWatchLightGroupRequest {
3851        type Owned = Self;
3852
3853        #[inline(always)]
3854        fn inline_align(_context: fidl::encoding::Context) -> usize {
3855            8
3856        }
3857
3858        #[inline(always)]
3859        fn inline_size(_context: fidl::encoding::Context) -> usize {
3860            16
3861        }
3862    }
3863
3864    unsafe impl<D: fidl::encoding::ResourceDialect>
3865        fidl::encoding::Encode<LightWatchLightGroupRequest, D> for &LightWatchLightGroupRequest
3866    {
3867        #[inline]
3868        unsafe fn encode(
3869            self,
3870            encoder: &mut fidl::encoding::Encoder<'_, D>,
3871            offset: usize,
3872            _depth: fidl::encoding::Depth,
3873        ) -> fidl::Result<()> {
3874            encoder.debug_check_bounds::<LightWatchLightGroupRequest>(offset);
3875            // Delegate to tuple encoding.
3876            fidl::encoding::Encode::<LightWatchLightGroupRequest, D>::encode(
3877                (<fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(
3878                    &self.name,
3879                ),),
3880                encoder,
3881                offset,
3882                _depth,
3883            )
3884        }
3885    }
3886    unsafe impl<
3887            D: fidl::encoding::ResourceDialect,
3888            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
3889        > fidl::encoding::Encode<LightWatchLightGroupRequest, D> for (T0,)
3890    {
3891        #[inline]
3892        unsafe fn encode(
3893            self,
3894            encoder: &mut fidl::encoding::Encoder<'_, D>,
3895            offset: usize,
3896            depth: fidl::encoding::Depth,
3897        ) -> fidl::Result<()> {
3898            encoder.debug_check_bounds::<LightWatchLightGroupRequest>(offset);
3899            // Zero out padding regions. There's no need to apply masks
3900            // because the unmasked parts will be overwritten by fields.
3901            // Write the fields.
3902            self.0.encode(encoder, offset + 0, depth)?;
3903            Ok(())
3904        }
3905    }
3906
3907    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3908        for LightWatchLightGroupRequest
3909    {
3910        #[inline(always)]
3911        fn new_empty() -> Self {
3912            Self { name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D) }
3913        }
3914
3915        #[inline]
3916        unsafe fn decode(
3917            &mut self,
3918            decoder: &mut fidl::encoding::Decoder<'_, D>,
3919            offset: usize,
3920            _depth: fidl::encoding::Depth,
3921        ) -> fidl::Result<()> {
3922            decoder.debug_check_bounds::<Self>(offset);
3923            // Verify that padding bytes are zero.
3924            fidl::decode!(
3925                fidl::encoding::BoundedString<32>,
3926                D,
3927                &mut self.name,
3928                decoder,
3929                offset + 0,
3930                _depth
3931            )?;
3932            Ok(())
3933        }
3934    }
3935
3936    impl fidl::encoding::ValueTypeMarker for LightWatchLightGroupResponse {
3937        type Borrowed<'a> = &'a Self;
3938        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3939            value
3940        }
3941    }
3942
3943    unsafe impl fidl::encoding::TypeMarker for LightWatchLightGroupResponse {
3944        type Owned = Self;
3945
3946        #[inline(always)]
3947        fn inline_align(_context: fidl::encoding::Context) -> usize {
3948            8
3949        }
3950
3951        #[inline(always)]
3952        fn inline_size(_context: fidl::encoding::Context) -> usize {
3953            16
3954        }
3955    }
3956
3957    unsafe impl<D: fidl::encoding::ResourceDialect>
3958        fidl::encoding::Encode<LightWatchLightGroupResponse, D> for &LightWatchLightGroupResponse
3959    {
3960        #[inline]
3961        unsafe fn encode(
3962            self,
3963            encoder: &mut fidl::encoding::Encoder<'_, D>,
3964            offset: usize,
3965            _depth: fidl::encoding::Depth,
3966        ) -> fidl::Result<()> {
3967            encoder.debug_check_bounds::<LightWatchLightGroupResponse>(offset);
3968            // Delegate to tuple encoding.
3969            fidl::encoding::Encode::<LightWatchLightGroupResponse, D>::encode(
3970                (<LightGroup as fidl::encoding::ValueTypeMarker>::borrow(&self.group),),
3971                encoder,
3972                offset,
3973                _depth,
3974            )
3975        }
3976    }
3977    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LightGroup, D>>
3978        fidl::encoding::Encode<LightWatchLightGroupResponse, D> for (T0,)
3979    {
3980        #[inline]
3981        unsafe fn encode(
3982            self,
3983            encoder: &mut fidl::encoding::Encoder<'_, D>,
3984            offset: usize,
3985            depth: fidl::encoding::Depth,
3986        ) -> fidl::Result<()> {
3987            encoder.debug_check_bounds::<LightWatchLightGroupResponse>(offset);
3988            // Zero out padding regions. There's no need to apply masks
3989            // because the unmasked parts will be overwritten by fields.
3990            // Write the fields.
3991            self.0.encode(encoder, offset + 0, depth)?;
3992            Ok(())
3993        }
3994    }
3995
3996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3997        for LightWatchLightGroupResponse
3998    {
3999        #[inline(always)]
4000        fn new_empty() -> Self {
4001            Self { group: fidl::new_empty!(LightGroup, D) }
4002        }
4003
4004        #[inline]
4005        unsafe fn decode(
4006            &mut self,
4007            decoder: &mut fidl::encoding::Decoder<'_, D>,
4008            offset: usize,
4009            _depth: fidl::encoding::Depth,
4010        ) -> fidl::Result<()> {
4011            decoder.debug_check_bounds::<Self>(offset);
4012            // Verify that padding bytes are zero.
4013            fidl::decode!(LightGroup, D, &mut self.group, decoder, offset + 0, _depth)?;
4014            Ok(())
4015        }
4016    }
4017
4018    impl fidl::encoding::ValueTypeMarker for LightWatchLightGroupsResponse {
4019        type Borrowed<'a> = &'a Self;
4020        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4021            value
4022        }
4023    }
4024
4025    unsafe impl fidl::encoding::TypeMarker for LightWatchLightGroupsResponse {
4026        type Owned = Self;
4027
4028        #[inline(always)]
4029        fn inline_align(_context: fidl::encoding::Context) -> usize {
4030            8
4031        }
4032
4033        #[inline(always)]
4034        fn inline_size(_context: fidl::encoding::Context) -> usize {
4035            16
4036        }
4037    }
4038
4039    unsafe impl<D: fidl::encoding::ResourceDialect>
4040        fidl::encoding::Encode<LightWatchLightGroupsResponse, D>
4041        for &LightWatchLightGroupsResponse
4042    {
4043        #[inline]
4044        unsafe fn encode(
4045            self,
4046            encoder: &mut fidl::encoding::Encoder<'_, D>,
4047            offset: usize,
4048            _depth: fidl::encoding::Depth,
4049        ) -> fidl::Result<()> {
4050            encoder.debug_check_bounds::<LightWatchLightGroupsResponse>(offset);
4051            // Delegate to tuple encoding.
4052            fidl::encoding::Encode::<LightWatchLightGroupsResponse, D>::encode(
4053                (
4054                    <fidl::encoding::UnboundedVector<LightGroup> as fidl::encoding::ValueTypeMarker>::borrow(&self.groups),
4055                ),
4056                encoder, offset, _depth
4057            )
4058        }
4059    }
4060    unsafe impl<
4061            D: fidl::encoding::ResourceDialect,
4062            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<LightGroup>, D>,
4063        > fidl::encoding::Encode<LightWatchLightGroupsResponse, D> for (T0,)
4064    {
4065        #[inline]
4066        unsafe fn encode(
4067            self,
4068            encoder: &mut fidl::encoding::Encoder<'_, D>,
4069            offset: usize,
4070            depth: fidl::encoding::Depth,
4071        ) -> fidl::Result<()> {
4072            encoder.debug_check_bounds::<LightWatchLightGroupsResponse>(offset);
4073            // Zero out padding regions. There's no need to apply masks
4074            // because the unmasked parts will be overwritten by fields.
4075            // Write the fields.
4076            self.0.encode(encoder, offset + 0, depth)?;
4077            Ok(())
4078        }
4079    }
4080
4081    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4082        for LightWatchLightGroupsResponse
4083    {
4084        #[inline(always)]
4085        fn new_empty() -> Self {
4086            Self { groups: fidl::new_empty!(fidl::encoding::UnboundedVector<LightGroup>, D) }
4087        }
4088
4089        #[inline]
4090        unsafe fn decode(
4091            &mut self,
4092            decoder: &mut fidl::encoding::Decoder<'_, D>,
4093            offset: usize,
4094            _depth: fidl::encoding::Depth,
4095        ) -> fidl::Result<()> {
4096            decoder.debug_check_bounds::<Self>(offset);
4097            // Verify that padding bytes are zero.
4098            fidl::decode!(
4099                fidl::encoding::UnboundedVector<LightGroup>,
4100                D,
4101                &mut self.groups,
4102                decoder,
4103                offset + 0,
4104                _depth
4105            )?;
4106            Ok(())
4107        }
4108    }
4109
4110    impl fidl::encoding::ValueTypeMarker for NightModeSetRequest {
4111        type Borrowed<'a> = &'a Self;
4112        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4113            value
4114        }
4115    }
4116
4117    unsafe impl fidl::encoding::TypeMarker for NightModeSetRequest {
4118        type Owned = Self;
4119
4120        #[inline(always)]
4121        fn inline_align(_context: fidl::encoding::Context) -> usize {
4122            8
4123        }
4124
4125        #[inline(always)]
4126        fn inline_size(_context: fidl::encoding::Context) -> usize {
4127            16
4128        }
4129    }
4130
4131    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NightModeSetRequest, D>
4132        for &NightModeSetRequest
4133    {
4134        #[inline]
4135        unsafe fn encode(
4136            self,
4137            encoder: &mut fidl::encoding::Encoder<'_, D>,
4138            offset: usize,
4139            _depth: fidl::encoding::Depth,
4140        ) -> fidl::Result<()> {
4141            encoder.debug_check_bounds::<NightModeSetRequest>(offset);
4142            // Delegate to tuple encoding.
4143            fidl::encoding::Encode::<NightModeSetRequest, D>::encode(
4144                (<NightModeSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
4145                encoder,
4146                offset,
4147                _depth,
4148            )
4149        }
4150    }
4151    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NightModeSettings, D>>
4152        fidl::encoding::Encode<NightModeSetRequest, D> for (T0,)
4153    {
4154        #[inline]
4155        unsafe fn encode(
4156            self,
4157            encoder: &mut fidl::encoding::Encoder<'_, D>,
4158            offset: usize,
4159            depth: fidl::encoding::Depth,
4160        ) -> fidl::Result<()> {
4161            encoder.debug_check_bounds::<NightModeSetRequest>(offset);
4162            // Zero out padding regions. There's no need to apply masks
4163            // because the unmasked parts will be overwritten by fields.
4164            // Write the fields.
4165            self.0.encode(encoder, offset + 0, depth)?;
4166            Ok(())
4167        }
4168    }
4169
4170    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NightModeSetRequest {
4171        #[inline(always)]
4172        fn new_empty() -> Self {
4173            Self { settings: fidl::new_empty!(NightModeSettings, D) }
4174        }
4175
4176        #[inline]
4177        unsafe fn decode(
4178            &mut self,
4179            decoder: &mut fidl::encoding::Decoder<'_, D>,
4180            offset: usize,
4181            _depth: fidl::encoding::Depth,
4182        ) -> fidl::Result<()> {
4183            decoder.debug_check_bounds::<Self>(offset);
4184            // Verify that padding bytes are zero.
4185            fidl::decode!(NightModeSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
4186            Ok(())
4187        }
4188    }
4189
4190    impl fidl::encoding::ValueTypeMarker for NightModeWatchResponse {
4191        type Borrowed<'a> = &'a Self;
4192        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4193            value
4194        }
4195    }
4196
4197    unsafe impl fidl::encoding::TypeMarker for NightModeWatchResponse {
4198        type Owned = Self;
4199
4200        #[inline(always)]
4201        fn inline_align(_context: fidl::encoding::Context) -> usize {
4202            8
4203        }
4204
4205        #[inline(always)]
4206        fn inline_size(_context: fidl::encoding::Context) -> usize {
4207            16
4208        }
4209    }
4210
4211    unsafe impl<D: fidl::encoding::ResourceDialect>
4212        fidl::encoding::Encode<NightModeWatchResponse, D> for &NightModeWatchResponse
4213    {
4214        #[inline]
4215        unsafe fn encode(
4216            self,
4217            encoder: &mut fidl::encoding::Encoder<'_, D>,
4218            offset: usize,
4219            _depth: fidl::encoding::Depth,
4220        ) -> fidl::Result<()> {
4221            encoder.debug_check_bounds::<NightModeWatchResponse>(offset);
4222            // Delegate to tuple encoding.
4223            fidl::encoding::Encode::<NightModeWatchResponse, D>::encode(
4224                (<NightModeSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
4225                encoder,
4226                offset,
4227                _depth,
4228            )
4229        }
4230    }
4231    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<NightModeSettings, D>>
4232        fidl::encoding::Encode<NightModeWatchResponse, D> for (T0,)
4233    {
4234        #[inline]
4235        unsafe fn encode(
4236            self,
4237            encoder: &mut fidl::encoding::Encoder<'_, D>,
4238            offset: usize,
4239            depth: fidl::encoding::Depth,
4240        ) -> fidl::Result<()> {
4241            encoder.debug_check_bounds::<NightModeWatchResponse>(offset);
4242            // Zero out padding regions. There's no need to apply masks
4243            // because the unmasked parts will be overwritten by fields.
4244            // Write the fields.
4245            self.0.encode(encoder, offset + 0, depth)?;
4246            Ok(())
4247        }
4248    }
4249
4250    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4251        for NightModeWatchResponse
4252    {
4253        #[inline(always)]
4254        fn new_empty() -> Self {
4255            Self { settings: fidl::new_empty!(NightModeSettings, D) }
4256        }
4257
4258        #[inline]
4259        unsafe fn decode(
4260            &mut self,
4261            decoder: &mut fidl::encoding::Decoder<'_, D>,
4262            offset: usize,
4263            _depth: fidl::encoding::Depth,
4264        ) -> fidl::Result<()> {
4265            decoder.debug_check_bounds::<Self>(offset);
4266            // Verify that padding bytes are zero.
4267            fidl::decode!(NightModeSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
4268            Ok(())
4269        }
4270    }
4271
4272    impl fidl::encoding::ValueTypeMarker for PrivacySetRequest {
4273        type Borrowed<'a> = &'a Self;
4274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4275            value
4276        }
4277    }
4278
4279    unsafe impl fidl::encoding::TypeMarker for PrivacySetRequest {
4280        type Owned = Self;
4281
4282        #[inline(always)]
4283        fn inline_align(_context: fidl::encoding::Context) -> usize {
4284            8
4285        }
4286
4287        #[inline(always)]
4288        fn inline_size(_context: fidl::encoding::Context) -> usize {
4289            16
4290        }
4291    }
4292
4293    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrivacySetRequest, D>
4294        for &PrivacySetRequest
4295    {
4296        #[inline]
4297        unsafe fn encode(
4298            self,
4299            encoder: &mut fidl::encoding::Encoder<'_, D>,
4300            offset: usize,
4301            _depth: fidl::encoding::Depth,
4302        ) -> fidl::Result<()> {
4303            encoder.debug_check_bounds::<PrivacySetRequest>(offset);
4304            // Delegate to tuple encoding.
4305            fidl::encoding::Encode::<PrivacySetRequest, D>::encode(
4306                (<PrivacySettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
4307                encoder,
4308                offset,
4309                _depth,
4310            )
4311        }
4312    }
4313    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PrivacySettings, D>>
4314        fidl::encoding::Encode<PrivacySetRequest, D> for (T0,)
4315    {
4316        #[inline]
4317        unsafe fn encode(
4318            self,
4319            encoder: &mut fidl::encoding::Encoder<'_, D>,
4320            offset: usize,
4321            depth: fidl::encoding::Depth,
4322        ) -> fidl::Result<()> {
4323            encoder.debug_check_bounds::<PrivacySetRequest>(offset);
4324            // Zero out padding regions. There's no need to apply masks
4325            // because the unmasked parts will be overwritten by fields.
4326            // Write the fields.
4327            self.0.encode(encoder, offset + 0, depth)?;
4328            Ok(())
4329        }
4330    }
4331
4332    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrivacySetRequest {
4333        #[inline(always)]
4334        fn new_empty() -> Self {
4335            Self { settings: fidl::new_empty!(PrivacySettings, D) }
4336        }
4337
4338        #[inline]
4339        unsafe fn decode(
4340            &mut self,
4341            decoder: &mut fidl::encoding::Decoder<'_, D>,
4342            offset: usize,
4343            _depth: fidl::encoding::Depth,
4344        ) -> fidl::Result<()> {
4345            decoder.debug_check_bounds::<Self>(offset);
4346            // Verify that padding bytes are zero.
4347            fidl::decode!(PrivacySettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
4348            Ok(())
4349        }
4350    }
4351
4352    impl fidl::encoding::ValueTypeMarker for PrivacyWatchResponse {
4353        type Borrowed<'a> = &'a Self;
4354        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4355            value
4356        }
4357    }
4358
4359    unsafe impl fidl::encoding::TypeMarker for PrivacyWatchResponse {
4360        type Owned = Self;
4361
4362        #[inline(always)]
4363        fn inline_align(_context: fidl::encoding::Context) -> usize {
4364            8
4365        }
4366
4367        #[inline(always)]
4368        fn inline_size(_context: fidl::encoding::Context) -> usize {
4369            16
4370        }
4371    }
4372
4373    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrivacyWatchResponse, D>
4374        for &PrivacyWatchResponse
4375    {
4376        #[inline]
4377        unsafe fn encode(
4378            self,
4379            encoder: &mut fidl::encoding::Encoder<'_, D>,
4380            offset: usize,
4381            _depth: fidl::encoding::Depth,
4382        ) -> fidl::Result<()> {
4383            encoder.debug_check_bounds::<PrivacyWatchResponse>(offset);
4384            // Delegate to tuple encoding.
4385            fidl::encoding::Encode::<PrivacyWatchResponse, D>::encode(
4386                (<PrivacySettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
4387                encoder,
4388                offset,
4389                _depth,
4390            )
4391        }
4392    }
4393    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PrivacySettings, D>>
4394        fidl::encoding::Encode<PrivacyWatchResponse, D> for (T0,)
4395    {
4396        #[inline]
4397        unsafe fn encode(
4398            self,
4399            encoder: &mut fidl::encoding::Encoder<'_, D>,
4400            offset: usize,
4401            depth: fidl::encoding::Depth,
4402        ) -> fidl::Result<()> {
4403            encoder.debug_check_bounds::<PrivacyWatchResponse>(offset);
4404            // Zero out padding regions. There's no need to apply masks
4405            // because the unmasked parts will be overwritten by fields.
4406            // Write the fields.
4407            self.0.encode(encoder, offset + 0, depth)?;
4408            Ok(())
4409        }
4410    }
4411
4412    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrivacyWatchResponse {
4413        #[inline(always)]
4414        fn new_empty() -> Self {
4415            Self { settings: fidl::new_empty!(PrivacySettings, D) }
4416        }
4417
4418        #[inline]
4419        unsafe fn decode(
4420            &mut self,
4421            decoder: &mut fidl::encoding::Decoder<'_, D>,
4422            offset: usize,
4423            _depth: fidl::encoding::Depth,
4424        ) -> fidl::Result<()> {
4425            decoder.debug_check_bounds::<Self>(offset);
4426            // Verify that padding bytes are zero.
4427            fidl::decode!(PrivacySettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
4428            Ok(())
4429        }
4430    }
4431
4432    impl fidl::encoding::ValueTypeMarker for SetupSetRequest {
4433        type Borrowed<'a> = &'a Self;
4434        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4435            value
4436        }
4437    }
4438
4439    unsafe impl fidl::encoding::TypeMarker for SetupSetRequest {
4440        type Owned = Self;
4441
4442        #[inline(always)]
4443        fn inline_align(_context: fidl::encoding::Context) -> usize {
4444            8
4445        }
4446
4447        #[inline(always)]
4448        fn inline_size(_context: fidl::encoding::Context) -> usize {
4449            24
4450        }
4451    }
4452
4453    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetupSetRequest, D>
4454        for &SetupSetRequest
4455    {
4456        #[inline]
4457        unsafe fn encode(
4458            self,
4459            encoder: &mut fidl::encoding::Encoder<'_, D>,
4460            offset: usize,
4461            _depth: fidl::encoding::Depth,
4462        ) -> fidl::Result<()> {
4463            encoder.debug_check_bounds::<SetupSetRequest>(offset);
4464            // Delegate to tuple encoding.
4465            fidl::encoding::Encode::<SetupSetRequest, D>::encode(
4466                (
4467                    <SetupSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),
4468                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reboot_device),
4469                ),
4470                encoder,
4471                offset,
4472                _depth,
4473            )
4474        }
4475    }
4476    unsafe impl<
4477            D: fidl::encoding::ResourceDialect,
4478            T0: fidl::encoding::Encode<SetupSettings, D>,
4479            T1: fidl::encoding::Encode<bool, D>,
4480        > fidl::encoding::Encode<SetupSetRequest, D> for (T0, T1)
4481    {
4482        #[inline]
4483        unsafe fn encode(
4484            self,
4485            encoder: &mut fidl::encoding::Encoder<'_, D>,
4486            offset: usize,
4487            depth: fidl::encoding::Depth,
4488        ) -> fidl::Result<()> {
4489            encoder.debug_check_bounds::<SetupSetRequest>(offset);
4490            // Zero out padding regions. There's no need to apply masks
4491            // because the unmasked parts will be overwritten by fields.
4492            unsafe {
4493                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4494                (ptr as *mut u64).write_unaligned(0);
4495            }
4496            // Write the fields.
4497            self.0.encode(encoder, offset + 0, depth)?;
4498            self.1.encode(encoder, offset + 16, depth)?;
4499            Ok(())
4500        }
4501    }
4502
4503    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetupSetRequest {
4504        #[inline(always)]
4505        fn new_empty() -> Self {
4506            Self {
4507                settings: fidl::new_empty!(SetupSettings, D),
4508                reboot_device: fidl::new_empty!(bool, D),
4509            }
4510        }
4511
4512        #[inline]
4513        unsafe fn decode(
4514            &mut self,
4515            decoder: &mut fidl::encoding::Decoder<'_, D>,
4516            offset: usize,
4517            _depth: fidl::encoding::Depth,
4518        ) -> fidl::Result<()> {
4519            decoder.debug_check_bounds::<Self>(offset);
4520            // Verify that padding bytes are zero.
4521            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4522            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4523            let mask = 0xffffffffffffff00u64;
4524            let maskedval = padval & mask;
4525            if maskedval != 0 {
4526                return Err(fidl::Error::NonZeroPadding {
4527                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4528                });
4529            }
4530            fidl::decode!(SetupSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
4531            fidl::decode!(bool, D, &mut self.reboot_device, decoder, offset + 16, _depth)?;
4532            Ok(())
4533        }
4534    }
4535
4536    impl fidl::encoding::ValueTypeMarker for SetupWatchResponse {
4537        type Borrowed<'a> = &'a Self;
4538        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4539            value
4540        }
4541    }
4542
4543    unsafe impl fidl::encoding::TypeMarker for SetupWatchResponse {
4544        type Owned = Self;
4545
4546        #[inline(always)]
4547        fn inline_align(_context: fidl::encoding::Context) -> usize {
4548            8
4549        }
4550
4551        #[inline(always)]
4552        fn inline_size(_context: fidl::encoding::Context) -> usize {
4553            16
4554        }
4555    }
4556
4557    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetupWatchResponse, D>
4558        for &SetupWatchResponse
4559    {
4560        #[inline]
4561        unsafe fn encode(
4562            self,
4563            encoder: &mut fidl::encoding::Encoder<'_, D>,
4564            offset: usize,
4565            _depth: fidl::encoding::Depth,
4566        ) -> fidl::Result<()> {
4567            encoder.debug_check_bounds::<SetupWatchResponse>(offset);
4568            // Delegate to tuple encoding.
4569            fidl::encoding::Encode::<SetupWatchResponse, D>::encode(
4570                (<SetupSettings as fidl::encoding::ValueTypeMarker>::borrow(&self.settings),),
4571                encoder,
4572                offset,
4573                _depth,
4574            )
4575        }
4576    }
4577    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SetupSettings, D>>
4578        fidl::encoding::Encode<SetupWatchResponse, D> for (T0,)
4579    {
4580        #[inline]
4581        unsafe fn encode(
4582            self,
4583            encoder: &mut fidl::encoding::Encoder<'_, D>,
4584            offset: usize,
4585            depth: fidl::encoding::Depth,
4586        ) -> fidl::Result<()> {
4587            encoder.debug_check_bounds::<SetupWatchResponse>(offset);
4588            // Zero out padding regions. There's no need to apply masks
4589            // because the unmasked parts will be overwritten by fields.
4590            // Write the fields.
4591            self.0.encode(encoder, offset + 0, depth)?;
4592            Ok(())
4593        }
4594    }
4595
4596    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetupWatchResponse {
4597        #[inline(always)]
4598        fn new_empty() -> Self {
4599            Self { settings: fidl::new_empty!(SetupSettings, D) }
4600        }
4601
4602        #[inline]
4603        unsafe fn decode(
4604            &mut self,
4605            decoder: &mut fidl::encoding::Decoder<'_, D>,
4606            offset: usize,
4607            _depth: fidl::encoding::Depth,
4608        ) -> fidl::Result<()> {
4609            decoder.debug_check_bounds::<Self>(offset);
4610            // Verify that padding bytes are zero.
4611            fidl::decode!(SetupSettings, D, &mut self.settings, decoder, offset + 0, _depth)?;
4612            Ok(())
4613        }
4614    }
4615
4616    impl AccessibilitySettings {
4617        #[inline(always)]
4618        fn max_ordinal_present(&self) -> u64 {
4619            if let Some(_) = self.captions_settings {
4620                return 6;
4621            }
4622            if let Some(_) = self.color_correction {
4623                return 5;
4624            }
4625            if let Some(_) = self.enable_magnification {
4626                return 4;
4627            }
4628            if let Some(_) = self.color_inversion {
4629                return 3;
4630            }
4631            if let Some(_) = self.screen_reader {
4632                return 2;
4633            }
4634            if let Some(_) = self.audio_description {
4635                return 1;
4636            }
4637            0
4638        }
4639    }
4640
4641    impl fidl::encoding::ValueTypeMarker for AccessibilitySettings {
4642        type Borrowed<'a> = &'a Self;
4643        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4644            value
4645        }
4646    }
4647
4648    unsafe impl fidl::encoding::TypeMarker for AccessibilitySettings {
4649        type Owned = Self;
4650
4651        #[inline(always)]
4652        fn inline_align(_context: fidl::encoding::Context) -> usize {
4653            8
4654        }
4655
4656        #[inline(always)]
4657        fn inline_size(_context: fidl::encoding::Context) -> usize {
4658            16
4659        }
4660    }
4661
4662    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AccessibilitySettings, D>
4663        for &AccessibilitySettings
4664    {
4665        unsafe fn encode(
4666            self,
4667            encoder: &mut fidl::encoding::Encoder<'_, D>,
4668            offset: usize,
4669            mut depth: fidl::encoding::Depth,
4670        ) -> fidl::Result<()> {
4671            encoder.debug_check_bounds::<AccessibilitySettings>(offset);
4672            // Vector header
4673            let max_ordinal: u64 = self.max_ordinal_present();
4674            encoder.write_num(max_ordinal, offset);
4675            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4676            // Calling encoder.out_of_line_offset(0) is not allowed.
4677            if max_ordinal == 0 {
4678                return Ok(());
4679            }
4680            depth.increment()?;
4681            let envelope_size = 8;
4682            let bytes_len = max_ordinal as usize * envelope_size;
4683            #[allow(unused_variables)]
4684            let offset = encoder.out_of_line_offset(bytes_len);
4685            let mut _prev_end_offset: usize = 0;
4686            if 1 > max_ordinal {
4687                return Ok(());
4688            }
4689
4690            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4691            // are envelope_size bytes.
4692            let cur_offset: usize = (1 - 1) * envelope_size;
4693
4694            // Zero reserved fields.
4695            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4696
4697            // Safety:
4698            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4699            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4700            //   envelope_size bytes, there is always sufficient room.
4701            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4702                self.audio_description
4703                    .as_ref()
4704                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4705                encoder,
4706                offset + cur_offset,
4707                depth,
4708            )?;
4709
4710            _prev_end_offset = cur_offset + envelope_size;
4711            if 2 > max_ordinal {
4712                return Ok(());
4713            }
4714
4715            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4716            // are envelope_size bytes.
4717            let cur_offset: usize = (2 - 1) * envelope_size;
4718
4719            // Zero reserved fields.
4720            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4721
4722            // Safety:
4723            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4724            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4725            //   envelope_size bytes, there is always sufficient room.
4726            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4727                self.screen_reader.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4728                encoder,
4729                offset + cur_offset,
4730                depth,
4731            )?;
4732
4733            _prev_end_offset = cur_offset + envelope_size;
4734            if 3 > max_ordinal {
4735                return Ok(());
4736            }
4737
4738            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4739            // are envelope_size bytes.
4740            let cur_offset: usize = (3 - 1) * envelope_size;
4741
4742            // Zero reserved fields.
4743            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4744
4745            // Safety:
4746            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4747            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4748            //   envelope_size bytes, there is always sufficient room.
4749            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4750                self.color_inversion
4751                    .as_ref()
4752                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4753                encoder,
4754                offset + cur_offset,
4755                depth,
4756            )?;
4757
4758            _prev_end_offset = cur_offset + envelope_size;
4759            if 4 > max_ordinal {
4760                return Ok(());
4761            }
4762
4763            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4764            // are envelope_size bytes.
4765            let cur_offset: usize = (4 - 1) * envelope_size;
4766
4767            // Zero reserved fields.
4768            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4769
4770            // Safety:
4771            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4772            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4773            //   envelope_size bytes, there is always sufficient room.
4774            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4775                self.enable_magnification
4776                    .as_ref()
4777                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4778                encoder,
4779                offset + cur_offset,
4780                depth,
4781            )?;
4782
4783            _prev_end_offset = cur_offset + envelope_size;
4784            if 5 > max_ordinal {
4785                return Ok(());
4786            }
4787
4788            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4789            // are envelope_size bytes.
4790            let cur_offset: usize = (5 - 1) * envelope_size;
4791
4792            // Zero reserved fields.
4793            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4794
4795            // Safety:
4796            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4797            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4798            //   envelope_size bytes, there is always sufficient room.
4799            fidl::encoding::encode_in_envelope_optional::<ColorBlindnessType, D>(
4800                self.color_correction
4801                    .as_ref()
4802                    .map(<ColorBlindnessType as fidl::encoding::ValueTypeMarker>::borrow),
4803                encoder,
4804                offset + cur_offset,
4805                depth,
4806            )?;
4807
4808            _prev_end_offset = cur_offset + envelope_size;
4809            if 6 > max_ordinal {
4810                return Ok(());
4811            }
4812
4813            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4814            // are envelope_size bytes.
4815            let cur_offset: usize = (6 - 1) * envelope_size;
4816
4817            // Zero reserved fields.
4818            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4819
4820            // Safety:
4821            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4822            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4823            //   envelope_size bytes, there is always sufficient room.
4824            fidl::encoding::encode_in_envelope_optional::<CaptionsSettings, D>(
4825                self.captions_settings
4826                    .as_ref()
4827                    .map(<CaptionsSettings as fidl::encoding::ValueTypeMarker>::borrow),
4828                encoder,
4829                offset + cur_offset,
4830                depth,
4831            )?;
4832
4833            _prev_end_offset = cur_offset + envelope_size;
4834
4835            Ok(())
4836        }
4837    }
4838
4839    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AccessibilitySettings {
4840        #[inline(always)]
4841        fn new_empty() -> Self {
4842            Self::default()
4843        }
4844
4845        unsafe fn decode(
4846            &mut self,
4847            decoder: &mut fidl::encoding::Decoder<'_, D>,
4848            offset: usize,
4849            mut depth: fidl::encoding::Depth,
4850        ) -> fidl::Result<()> {
4851            decoder.debug_check_bounds::<Self>(offset);
4852            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4853                None => return Err(fidl::Error::NotNullable),
4854                Some(len) => len,
4855            };
4856            // Calling decoder.out_of_line_offset(0) is not allowed.
4857            if len == 0 {
4858                return Ok(());
4859            };
4860            depth.increment()?;
4861            let envelope_size = 8;
4862            let bytes_len = len * envelope_size;
4863            let offset = decoder.out_of_line_offset(bytes_len)?;
4864            // Decode the envelope for each type.
4865            let mut _next_ordinal_to_read = 0;
4866            let mut next_offset = offset;
4867            let end_offset = offset + bytes_len;
4868            _next_ordinal_to_read += 1;
4869            if next_offset >= end_offset {
4870                return Ok(());
4871            }
4872
4873            // Decode unknown envelopes for gaps in ordinals.
4874            while _next_ordinal_to_read < 1 {
4875                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4876                _next_ordinal_to_read += 1;
4877                next_offset += envelope_size;
4878            }
4879
4880            let next_out_of_line = decoder.next_out_of_line();
4881            let handles_before = decoder.remaining_handles();
4882            if let Some((inlined, num_bytes, num_handles)) =
4883                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4884            {
4885                let member_inline_size =
4886                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4887                if inlined != (member_inline_size <= 4) {
4888                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4889                }
4890                let inner_offset;
4891                let mut inner_depth = depth.clone();
4892                if inlined {
4893                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4894                    inner_offset = next_offset;
4895                } else {
4896                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4897                    inner_depth.increment()?;
4898                }
4899                let val_ref =
4900                    self.audio_description.get_or_insert_with(|| fidl::new_empty!(bool, D));
4901                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4902                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4903                {
4904                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4905                }
4906                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4907                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4908                }
4909            }
4910
4911            next_offset += envelope_size;
4912            _next_ordinal_to_read += 1;
4913            if next_offset >= end_offset {
4914                return Ok(());
4915            }
4916
4917            // Decode unknown envelopes for gaps in ordinals.
4918            while _next_ordinal_to_read < 2 {
4919                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4920                _next_ordinal_to_read += 1;
4921                next_offset += envelope_size;
4922            }
4923
4924            let next_out_of_line = decoder.next_out_of_line();
4925            let handles_before = decoder.remaining_handles();
4926            if let Some((inlined, num_bytes, num_handles)) =
4927                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4928            {
4929                let member_inline_size =
4930                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4931                if inlined != (member_inline_size <= 4) {
4932                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4933                }
4934                let inner_offset;
4935                let mut inner_depth = depth.clone();
4936                if inlined {
4937                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4938                    inner_offset = next_offset;
4939                } else {
4940                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4941                    inner_depth.increment()?;
4942                }
4943                let val_ref = self.screen_reader.get_or_insert_with(|| fidl::new_empty!(bool, D));
4944                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4945                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4946                {
4947                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4948                }
4949                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4950                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4951                }
4952            }
4953
4954            next_offset += envelope_size;
4955            _next_ordinal_to_read += 1;
4956            if next_offset >= end_offset {
4957                return Ok(());
4958            }
4959
4960            // Decode unknown envelopes for gaps in ordinals.
4961            while _next_ordinal_to_read < 3 {
4962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4963                _next_ordinal_to_read += 1;
4964                next_offset += envelope_size;
4965            }
4966
4967            let next_out_of_line = decoder.next_out_of_line();
4968            let handles_before = decoder.remaining_handles();
4969            if let Some((inlined, num_bytes, num_handles)) =
4970                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4971            {
4972                let member_inline_size =
4973                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4974                if inlined != (member_inline_size <= 4) {
4975                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4976                }
4977                let inner_offset;
4978                let mut inner_depth = depth.clone();
4979                if inlined {
4980                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4981                    inner_offset = next_offset;
4982                } else {
4983                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4984                    inner_depth.increment()?;
4985                }
4986                let val_ref = self.color_inversion.get_or_insert_with(|| fidl::new_empty!(bool, D));
4987                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4988                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4989                {
4990                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4991                }
4992                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4993                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4994                }
4995            }
4996
4997            next_offset += envelope_size;
4998            _next_ordinal_to_read += 1;
4999            if next_offset >= end_offset {
5000                return Ok(());
5001            }
5002
5003            // Decode unknown envelopes for gaps in ordinals.
5004            while _next_ordinal_to_read < 4 {
5005                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5006                _next_ordinal_to_read += 1;
5007                next_offset += envelope_size;
5008            }
5009
5010            let next_out_of_line = decoder.next_out_of_line();
5011            let handles_before = decoder.remaining_handles();
5012            if let Some((inlined, num_bytes, num_handles)) =
5013                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5014            {
5015                let member_inline_size =
5016                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5017                if inlined != (member_inline_size <= 4) {
5018                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5019                }
5020                let inner_offset;
5021                let mut inner_depth = depth.clone();
5022                if inlined {
5023                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5024                    inner_offset = next_offset;
5025                } else {
5026                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5027                    inner_depth.increment()?;
5028                }
5029                let val_ref =
5030                    self.enable_magnification.get_or_insert_with(|| fidl::new_empty!(bool, D));
5031                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5032                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5033                {
5034                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5035                }
5036                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5037                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5038                }
5039            }
5040
5041            next_offset += envelope_size;
5042            _next_ordinal_to_read += 1;
5043            if next_offset >= end_offset {
5044                return Ok(());
5045            }
5046
5047            // Decode unknown envelopes for gaps in ordinals.
5048            while _next_ordinal_to_read < 5 {
5049                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5050                _next_ordinal_to_read += 1;
5051                next_offset += envelope_size;
5052            }
5053
5054            let next_out_of_line = decoder.next_out_of_line();
5055            let handles_before = decoder.remaining_handles();
5056            if let Some((inlined, num_bytes, num_handles)) =
5057                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5058            {
5059                let member_inline_size =
5060                    <ColorBlindnessType as fidl::encoding::TypeMarker>::inline_size(
5061                        decoder.context,
5062                    );
5063                if inlined != (member_inline_size <= 4) {
5064                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5065                }
5066                let inner_offset;
5067                let mut inner_depth = depth.clone();
5068                if inlined {
5069                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5070                    inner_offset = next_offset;
5071                } else {
5072                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5073                    inner_depth.increment()?;
5074                }
5075                let val_ref = self
5076                    .color_correction
5077                    .get_or_insert_with(|| fidl::new_empty!(ColorBlindnessType, D));
5078                fidl::decode!(ColorBlindnessType, D, val_ref, decoder, inner_offset, inner_depth)?;
5079                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5080                {
5081                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5082                }
5083                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5084                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5085                }
5086            }
5087
5088            next_offset += envelope_size;
5089            _next_ordinal_to_read += 1;
5090            if next_offset >= end_offset {
5091                return Ok(());
5092            }
5093
5094            // Decode unknown envelopes for gaps in ordinals.
5095            while _next_ordinal_to_read < 6 {
5096                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5097                _next_ordinal_to_read += 1;
5098                next_offset += envelope_size;
5099            }
5100
5101            let next_out_of_line = decoder.next_out_of_line();
5102            let handles_before = decoder.remaining_handles();
5103            if let Some((inlined, num_bytes, num_handles)) =
5104                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5105            {
5106                let member_inline_size =
5107                    <CaptionsSettings as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5108                if inlined != (member_inline_size <= 4) {
5109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5110                }
5111                let inner_offset;
5112                let mut inner_depth = depth.clone();
5113                if inlined {
5114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5115                    inner_offset = next_offset;
5116                } else {
5117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5118                    inner_depth.increment()?;
5119                }
5120                let val_ref = self
5121                    .captions_settings
5122                    .get_or_insert_with(|| fidl::new_empty!(CaptionsSettings, D));
5123                fidl::decode!(CaptionsSettings, D, val_ref, decoder, inner_offset, inner_depth)?;
5124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5125                {
5126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5127                }
5128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5130                }
5131            }
5132
5133            next_offset += envelope_size;
5134
5135            // Decode the remaining unknown envelopes.
5136            while next_offset < end_offset {
5137                _next_ordinal_to_read += 1;
5138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5139                next_offset += envelope_size;
5140            }
5141
5142            Ok(())
5143        }
5144    }
5145
5146    impl AudioSettings {
5147        #[inline(always)]
5148        fn max_ordinal_present(&self) -> u64 {
5149            if let Some(_) = self.streams {
5150                return 1;
5151            }
5152            0
5153        }
5154    }
5155
5156    impl fidl::encoding::ValueTypeMarker for AudioSettings {
5157        type Borrowed<'a> = &'a Self;
5158        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5159            value
5160        }
5161    }
5162
5163    unsafe impl fidl::encoding::TypeMarker for AudioSettings {
5164        type Owned = Self;
5165
5166        #[inline(always)]
5167        fn inline_align(_context: fidl::encoding::Context) -> usize {
5168            8
5169        }
5170
5171        #[inline(always)]
5172        fn inline_size(_context: fidl::encoding::Context) -> usize {
5173            16
5174        }
5175    }
5176
5177    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioSettings, D>
5178        for &AudioSettings
5179    {
5180        unsafe fn encode(
5181            self,
5182            encoder: &mut fidl::encoding::Encoder<'_, D>,
5183            offset: usize,
5184            mut depth: fidl::encoding::Depth,
5185        ) -> fidl::Result<()> {
5186            encoder.debug_check_bounds::<AudioSettings>(offset);
5187            // Vector header
5188            let max_ordinal: u64 = self.max_ordinal_present();
5189            encoder.write_num(max_ordinal, offset);
5190            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5191            // Calling encoder.out_of_line_offset(0) is not allowed.
5192            if max_ordinal == 0 {
5193                return Ok(());
5194            }
5195            depth.increment()?;
5196            let envelope_size = 8;
5197            let bytes_len = max_ordinal as usize * envelope_size;
5198            #[allow(unused_variables)]
5199            let offset = encoder.out_of_line_offset(bytes_len);
5200            let mut _prev_end_offset: usize = 0;
5201            if 1 > max_ordinal {
5202                return Ok(());
5203            }
5204
5205            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5206            // are envelope_size bytes.
5207            let cur_offset: usize = (1 - 1) * envelope_size;
5208
5209            // Zero reserved fields.
5210            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5211
5212            // Safety:
5213            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5214            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5215            //   envelope_size bytes, there is always sufficient room.
5216            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<AudioStreamSettings, 5>, D>(
5217            self.streams.as_ref().map(<fidl::encoding::Vector<AudioStreamSettings, 5> as fidl::encoding::ValueTypeMarker>::borrow),
5218            encoder, offset + cur_offset, depth
5219        )?;
5220
5221            _prev_end_offset = cur_offset + envelope_size;
5222
5223            Ok(())
5224        }
5225    }
5226
5227    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioSettings {
5228        #[inline(always)]
5229        fn new_empty() -> Self {
5230            Self::default()
5231        }
5232
5233        unsafe fn decode(
5234            &mut self,
5235            decoder: &mut fidl::encoding::Decoder<'_, D>,
5236            offset: usize,
5237            mut depth: fidl::encoding::Depth,
5238        ) -> fidl::Result<()> {
5239            decoder.debug_check_bounds::<Self>(offset);
5240            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5241                None => return Err(fidl::Error::NotNullable),
5242                Some(len) => len,
5243            };
5244            // Calling decoder.out_of_line_offset(0) is not allowed.
5245            if len == 0 {
5246                return Ok(());
5247            };
5248            depth.increment()?;
5249            let envelope_size = 8;
5250            let bytes_len = len * envelope_size;
5251            let offset = decoder.out_of_line_offset(bytes_len)?;
5252            // Decode the envelope for each type.
5253            let mut _next_ordinal_to_read = 0;
5254            let mut next_offset = offset;
5255            let end_offset = offset + bytes_len;
5256            _next_ordinal_to_read += 1;
5257            if next_offset >= end_offset {
5258                return Ok(());
5259            }
5260
5261            // Decode unknown envelopes for gaps in ordinals.
5262            while _next_ordinal_to_read < 1 {
5263                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5264                _next_ordinal_to_read += 1;
5265                next_offset += envelope_size;
5266            }
5267
5268            let next_out_of_line = decoder.next_out_of_line();
5269            let handles_before = decoder.remaining_handles();
5270            if let Some((inlined, num_bytes, num_handles)) =
5271                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5272            {
5273                let member_inline_size = <fidl::encoding::Vector<AudioStreamSettings, 5> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5274                if inlined != (member_inline_size <= 4) {
5275                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5276                }
5277                let inner_offset;
5278                let mut inner_depth = depth.clone();
5279                if inlined {
5280                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5281                    inner_offset = next_offset;
5282                } else {
5283                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5284                    inner_depth.increment()?;
5285                }
5286                let val_ref = self.streams.get_or_insert_with(
5287                    || fidl::new_empty!(fidl::encoding::Vector<AudioStreamSettings, 5>, D),
5288                );
5289                fidl::decode!(fidl::encoding::Vector<AudioStreamSettings, 5>, D, val_ref, decoder, inner_offset, inner_depth)?;
5290                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5291                {
5292                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5293                }
5294                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5295                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5296                }
5297            }
5298
5299            next_offset += envelope_size;
5300
5301            // Decode the remaining unknown envelopes.
5302            while next_offset < end_offset {
5303                _next_ordinal_to_read += 1;
5304                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5305                next_offset += envelope_size;
5306            }
5307
5308            Ok(())
5309        }
5310    }
5311
5312    impl AudioSettings2 {
5313        #[inline(always)]
5314        fn max_ordinal_present(&self) -> u64 {
5315            if let Some(_) = self.streams {
5316                return 1;
5317            }
5318            0
5319        }
5320    }
5321
5322    impl fidl::encoding::ValueTypeMarker for AudioSettings2 {
5323        type Borrowed<'a> = &'a Self;
5324        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5325            value
5326        }
5327    }
5328
5329    unsafe impl fidl::encoding::TypeMarker for AudioSettings2 {
5330        type Owned = Self;
5331
5332        #[inline(always)]
5333        fn inline_align(_context: fidl::encoding::Context) -> usize {
5334            8
5335        }
5336
5337        #[inline(always)]
5338        fn inline_size(_context: fidl::encoding::Context) -> usize {
5339            16
5340        }
5341    }
5342
5343    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioSettings2, D>
5344        for &AudioSettings2
5345    {
5346        unsafe fn encode(
5347            self,
5348            encoder: &mut fidl::encoding::Encoder<'_, D>,
5349            offset: usize,
5350            mut depth: fidl::encoding::Depth,
5351        ) -> fidl::Result<()> {
5352            encoder.debug_check_bounds::<AudioSettings2>(offset);
5353            // Vector header
5354            let max_ordinal: u64 = self.max_ordinal_present();
5355            encoder.write_num(max_ordinal, offset);
5356            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5357            // Calling encoder.out_of_line_offset(0) is not allowed.
5358            if max_ordinal == 0 {
5359                return Ok(());
5360            }
5361            depth.increment()?;
5362            let envelope_size = 8;
5363            let bytes_len = max_ordinal as usize * envelope_size;
5364            #[allow(unused_variables)]
5365            let offset = encoder.out_of_line_offset(bytes_len);
5366            let mut _prev_end_offset: usize = 0;
5367            if 1 > max_ordinal {
5368                return Ok(());
5369            }
5370
5371            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5372            // are envelope_size bytes.
5373            let cur_offset: usize = (1 - 1) * envelope_size;
5374
5375            // Zero reserved fields.
5376            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5377
5378            // Safety:
5379            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5380            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5381            //   envelope_size bytes, there is always sufficient room.
5382            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<AudioStreamSettings2, 8>, D>(
5383            self.streams.as_ref().map(<fidl::encoding::Vector<AudioStreamSettings2, 8> as fidl::encoding::ValueTypeMarker>::borrow),
5384            encoder, offset + cur_offset, depth
5385        )?;
5386
5387            _prev_end_offset = cur_offset + envelope_size;
5388
5389            Ok(())
5390        }
5391    }
5392
5393    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioSettings2 {
5394        #[inline(always)]
5395        fn new_empty() -> Self {
5396            Self::default()
5397        }
5398
5399        unsafe fn decode(
5400            &mut self,
5401            decoder: &mut fidl::encoding::Decoder<'_, D>,
5402            offset: usize,
5403            mut depth: fidl::encoding::Depth,
5404        ) -> fidl::Result<()> {
5405            decoder.debug_check_bounds::<Self>(offset);
5406            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5407                None => return Err(fidl::Error::NotNullable),
5408                Some(len) => len,
5409            };
5410            // Calling decoder.out_of_line_offset(0) is not allowed.
5411            if len == 0 {
5412                return Ok(());
5413            };
5414            depth.increment()?;
5415            let envelope_size = 8;
5416            let bytes_len = len * envelope_size;
5417            let offset = decoder.out_of_line_offset(bytes_len)?;
5418            // Decode the envelope for each type.
5419            let mut _next_ordinal_to_read = 0;
5420            let mut next_offset = offset;
5421            let end_offset = offset + bytes_len;
5422            _next_ordinal_to_read += 1;
5423            if next_offset >= end_offset {
5424                return Ok(());
5425            }
5426
5427            // Decode unknown envelopes for gaps in ordinals.
5428            while _next_ordinal_to_read < 1 {
5429                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5430                _next_ordinal_to_read += 1;
5431                next_offset += envelope_size;
5432            }
5433
5434            let next_out_of_line = decoder.next_out_of_line();
5435            let handles_before = decoder.remaining_handles();
5436            if let Some((inlined, num_bytes, num_handles)) =
5437                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5438            {
5439                let member_inline_size = <fidl::encoding::Vector<AudioStreamSettings2, 8> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5440                if inlined != (member_inline_size <= 4) {
5441                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5442                }
5443                let inner_offset;
5444                let mut inner_depth = depth.clone();
5445                if inlined {
5446                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5447                    inner_offset = next_offset;
5448                } else {
5449                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5450                    inner_depth.increment()?;
5451                }
5452                let val_ref = self.streams.get_or_insert_with(
5453                    || fidl::new_empty!(fidl::encoding::Vector<AudioStreamSettings2, 8>, D),
5454                );
5455                fidl::decode!(fidl::encoding::Vector<AudioStreamSettings2, 8>, D, val_ref, decoder, inner_offset, inner_depth)?;
5456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5457                {
5458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5459                }
5460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5462                }
5463            }
5464
5465            next_offset += envelope_size;
5466
5467            // Decode the remaining unknown envelopes.
5468            while next_offset < end_offset {
5469                _next_ordinal_to_read += 1;
5470                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5471                next_offset += envelope_size;
5472            }
5473
5474            Ok(())
5475        }
5476    }
5477
5478    impl AudioStreamSettings {
5479        #[inline(always)]
5480        fn max_ordinal_present(&self) -> u64 {
5481            if let Some(_) = self.user_volume {
5482                return 3;
5483            }
5484            if let Some(_) = self.source {
5485                return 2;
5486            }
5487            if let Some(_) = self.stream {
5488                return 1;
5489            }
5490            0
5491        }
5492    }
5493
5494    impl fidl::encoding::ValueTypeMarker for AudioStreamSettings {
5495        type Borrowed<'a> = &'a Self;
5496        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5497            value
5498        }
5499    }
5500
5501    unsafe impl fidl::encoding::TypeMarker for AudioStreamSettings {
5502        type Owned = Self;
5503
5504        #[inline(always)]
5505        fn inline_align(_context: fidl::encoding::Context) -> usize {
5506            8
5507        }
5508
5509        #[inline(always)]
5510        fn inline_size(_context: fidl::encoding::Context) -> usize {
5511            16
5512        }
5513    }
5514
5515    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioStreamSettings, D>
5516        for &AudioStreamSettings
5517    {
5518        unsafe fn encode(
5519            self,
5520            encoder: &mut fidl::encoding::Encoder<'_, D>,
5521            offset: usize,
5522            mut depth: fidl::encoding::Depth,
5523        ) -> fidl::Result<()> {
5524            encoder.debug_check_bounds::<AudioStreamSettings>(offset);
5525            // Vector header
5526            let max_ordinal: u64 = self.max_ordinal_present();
5527            encoder.write_num(max_ordinal, offset);
5528            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5529            // Calling encoder.out_of_line_offset(0) is not allowed.
5530            if max_ordinal == 0 {
5531                return Ok(());
5532            }
5533            depth.increment()?;
5534            let envelope_size = 8;
5535            let bytes_len = max_ordinal as usize * envelope_size;
5536            #[allow(unused_variables)]
5537            let offset = encoder.out_of_line_offset(bytes_len);
5538            let mut _prev_end_offset: usize = 0;
5539            if 1 > max_ordinal {
5540                return Ok(());
5541            }
5542
5543            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5544            // are envelope_size bytes.
5545            let cur_offset: usize = (1 - 1) * envelope_size;
5546
5547            // Zero reserved fields.
5548            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5549
5550            // Safety:
5551            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5552            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5553            //   envelope_size bytes, there is always sufficient room.
5554            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage, D>(
5555            self.stream.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::ValueTypeMarker>::borrow),
5556            encoder, offset + cur_offset, depth
5557        )?;
5558
5559            _prev_end_offset = cur_offset + envelope_size;
5560            if 2 > max_ordinal {
5561                return Ok(());
5562            }
5563
5564            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5565            // are envelope_size bytes.
5566            let cur_offset: usize = (2 - 1) * envelope_size;
5567
5568            // Zero reserved fields.
5569            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5570
5571            // Safety:
5572            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5573            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5574            //   envelope_size bytes, there is always sufficient room.
5575            fidl::encoding::encode_in_envelope_optional::<AudioStreamSettingSource, D>(
5576                self.source
5577                    .as_ref()
5578                    .map(<AudioStreamSettingSource as fidl::encoding::ValueTypeMarker>::borrow),
5579                encoder,
5580                offset + cur_offset,
5581                depth,
5582            )?;
5583
5584            _prev_end_offset = cur_offset + envelope_size;
5585            if 3 > max_ordinal {
5586                return Ok(());
5587            }
5588
5589            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5590            // are envelope_size bytes.
5591            let cur_offset: usize = (3 - 1) * envelope_size;
5592
5593            // Zero reserved fields.
5594            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5595
5596            // Safety:
5597            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5598            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5599            //   envelope_size bytes, there is always sufficient room.
5600            fidl::encoding::encode_in_envelope_optional::<Volume, D>(
5601                self.user_volume.as_ref().map(<Volume as fidl::encoding::ValueTypeMarker>::borrow),
5602                encoder,
5603                offset + cur_offset,
5604                depth,
5605            )?;
5606
5607            _prev_end_offset = cur_offset + envelope_size;
5608
5609            Ok(())
5610        }
5611    }
5612
5613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioStreamSettings {
5614        #[inline(always)]
5615        fn new_empty() -> Self {
5616            Self::default()
5617        }
5618
5619        unsafe fn decode(
5620            &mut self,
5621            decoder: &mut fidl::encoding::Decoder<'_, D>,
5622            offset: usize,
5623            mut depth: fidl::encoding::Depth,
5624        ) -> fidl::Result<()> {
5625            decoder.debug_check_bounds::<Self>(offset);
5626            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5627                None => return Err(fidl::Error::NotNullable),
5628                Some(len) => len,
5629            };
5630            // Calling decoder.out_of_line_offset(0) is not allowed.
5631            if len == 0 {
5632                return Ok(());
5633            };
5634            depth.increment()?;
5635            let envelope_size = 8;
5636            let bytes_len = len * envelope_size;
5637            let offset = decoder.out_of_line_offset(bytes_len)?;
5638            // Decode the envelope for each type.
5639            let mut _next_ordinal_to_read = 0;
5640            let mut next_offset = offset;
5641            let end_offset = offset + bytes_len;
5642            _next_ordinal_to_read += 1;
5643            if next_offset >= end_offset {
5644                return Ok(());
5645            }
5646
5647            // Decode unknown envelopes for gaps in ordinals.
5648            while _next_ordinal_to_read < 1 {
5649                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5650                _next_ordinal_to_read += 1;
5651                next_offset += envelope_size;
5652            }
5653
5654            let next_out_of_line = decoder.next_out_of_line();
5655            let handles_before = decoder.remaining_handles();
5656            if let Some((inlined, num_bytes, num_handles)) =
5657                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5658            {
5659                let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5660                if inlined != (member_inline_size <= 4) {
5661                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5662                }
5663                let inner_offset;
5664                let mut inner_depth = depth.clone();
5665                if inlined {
5666                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5667                    inner_offset = next_offset;
5668                } else {
5669                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5670                    inner_depth.increment()?;
5671                }
5672                let val_ref = self.stream.get_or_insert_with(|| {
5673                    fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage, D)
5674                });
5675                fidl::decode!(
5676                    fidl_fuchsia_media::AudioRenderUsage,
5677                    D,
5678                    val_ref,
5679                    decoder,
5680                    inner_offset,
5681                    inner_depth
5682                )?;
5683                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5684                {
5685                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5686                }
5687                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5688                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5689                }
5690            }
5691
5692            next_offset += envelope_size;
5693            _next_ordinal_to_read += 1;
5694            if next_offset >= end_offset {
5695                return Ok(());
5696            }
5697
5698            // Decode unknown envelopes for gaps in ordinals.
5699            while _next_ordinal_to_read < 2 {
5700                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5701                _next_ordinal_to_read += 1;
5702                next_offset += envelope_size;
5703            }
5704
5705            let next_out_of_line = decoder.next_out_of_line();
5706            let handles_before = decoder.remaining_handles();
5707            if let Some((inlined, num_bytes, num_handles)) =
5708                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5709            {
5710                let member_inline_size =
5711                    <AudioStreamSettingSource as fidl::encoding::TypeMarker>::inline_size(
5712                        decoder.context,
5713                    );
5714                if inlined != (member_inline_size <= 4) {
5715                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5716                }
5717                let inner_offset;
5718                let mut inner_depth = depth.clone();
5719                if inlined {
5720                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5721                    inner_offset = next_offset;
5722                } else {
5723                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5724                    inner_depth.increment()?;
5725                }
5726                let val_ref = self
5727                    .source
5728                    .get_or_insert_with(|| fidl::new_empty!(AudioStreamSettingSource, D));
5729                fidl::decode!(
5730                    AudioStreamSettingSource,
5731                    D,
5732                    val_ref,
5733                    decoder,
5734                    inner_offset,
5735                    inner_depth
5736                )?;
5737                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5738                {
5739                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5740                }
5741                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5742                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5743                }
5744            }
5745
5746            next_offset += envelope_size;
5747            _next_ordinal_to_read += 1;
5748            if next_offset >= end_offset {
5749                return Ok(());
5750            }
5751
5752            // Decode unknown envelopes for gaps in ordinals.
5753            while _next_ordinal_to_read < 3 {
5754                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5755                _next_ordinal_to_read += 1;
5756                next_offset += envelope_size;
5757            }
5758
5759            let next_out_of_line = decoder.next_out_of_line();
5760            let handles_before = decoder.remaining_handles();
5761            if let Some((inlined, num_bytes, num_handles)) =
5762                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5763            {
5764                let member_inline_size =
5765                    <Volume as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5766                if inlined != (member_inline_size <= 4) {
5767                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5768                }
5769                let inner_offset;
5770                let mut inner_depth = depth.clone();
5771                if inlined {
5772                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5773                    inner_offset = next_offset;
5774                } else {
5775                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5776                    inner_depth.increment()?;
5777                }
5778                let val_ref = self.user_volume.get_or_insert_with(|| fidl::new_empty!(Volume, D));
5779                fidl::decode!(Volume, D, val_ref, decoder, inner_offset, inner_depth)?;
5780                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5781                {
5782                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5783                }
5784                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5785                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5786                }
5787            }
5788
5789            next_offset += envelope_size;
5790
5791            // Decode the remaining unknown envelopes.
5792            while next_offset < end_offset {
5793                _next_ordinal_to_read += 1;
5794                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5795                next_offset += envelope_size;
5796            }
5797
5798            Ok(())
5799        }
5800    }
5801
5802    impl AudioStreamSettings2 {
5803        #[inline(always)]
5804        fn max_ordinal_present(&self) -> u64 {
5805            if let Some(_) = self.user_volume {
5806                return 3;
5807            }
5808            if let Some(_) = self.source {
5809                return 2;
5810            }
5811            if let Some(_) = self.stream {
5812                return 1;
5813            }
5814            0
5815        }
5816    }
5817
5818    impl fidl::encoding::ValueTypeMarker for AudioStreamSettings2 {
5819        type Borrowed<'a> = &'a Self;
5820        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5821            value
5822        }
5823    }
5824
5825    unsafe impl fidl::encoding::TypeMarker for AudioStreamSettings2 {
5826        type Owned = Self;
5827
5828        #[inline(always)]
5829        fn inline_align(_context: fidl::encoding::Context) -> usize {
5830            8
5831        }
5832
5833        #[inline(always)]
5834        fn inline_size(_context: fidl::encoding::Context) -> usize {
5835            16
5836        }
5837    }
5838
5839    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AudioStreamSettings2, D>
5840        for &AudioStreamSettings2
5841    {
5842        unsafe fn encode(
5843            self,
5844            encoder: &mut fidl::encoding::Encoder<'_, D>,
5845            offset: usize,
5846            mut depth: fidl::encoding::Depth,
5847        ) -> fidl::Result<()> {
5848            encoder.debug_check_bounds::<AudioStreamSettings2>(offset);
5849            // Vector header
5850            let max_ordinal: u64 = self.max_ordinal_present();
5851            encoder.write_num(max_ordinal, offset);
5852            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5853            // Calling encoder.out_of_line_offset(0) is not allowed.
5854            if max_ordinal == 0 {
5855                return Ok(());
5856            }
5857            depth.increment()?;
5858            let envelope_size = 8;
5859            let bytes_len = max_ordinal as usize * envelope_size;
5860            #[allow(unused_variables)]
5861            let offset = encoder.out_of_line_offset(bytes_len);
5862            let mut _prev_end_offset: usize = 0;
5863            if 1 > max_ordinal {
5864                return Ok(());
5865            }
5866
5867            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5868            // are envelope_size bytes.
5869            let cur_offset: usize = (1 - 1) * envelope_size;
5870
5871            // Zero reserved fields.
5872            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5873
5874            // Safety:
5875            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5876            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5877            //   envelope_size bytes, there is always sufficient room.
5878            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_media::AudioRenderUsage2, D>(
5879            self.stream.as_ref().map(<fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::ValueTypeMarker>::borrow),
5880            encoder, offset + cur_offset, depth
5881        )?;
5882
5883            _prev_end_offset = cur_offset + envelope_size;
5884            if 2 > max_ordinal {
5885                return Ok(());
5886            }
5887
5888            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5889            // are envelope_size bytes.
5890            let cur_offset: usize = (2 - 1) * envelope_size;
5891
5892            // Zero reserved fields.
5893            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5894
5895            // Safety:
5896            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5897            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5898            //   envelope_size bytes, there is always sufficient room.
5899            fidl::encoding::encode_in_envelope_optional::<AudioStreamSettingSource, D>(
5900                self.source
5901                    .as_ref()
5902                    .map(<AudioStreamSettingSource as fidl::encoding::ValueTypeMarker>::borrow),
5903                encoder,
5904                offset + cur_offset,
5905                depth,
5906            )?;
5907
5908            _prev_end_offset = cur_offset + envelope_size;
5909            if 3 > max_ordinal {
5910                return Ok(());
5911            }
5912
5913            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5914            // are envelope_size bytes.
5915            let cur_offset: usize = (3 - 1) * envelope_size;
5916
5917            // Zero reserved fields.
5918            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5919
5920            // Safety:
5921            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5922            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5923            //   envelope_size bytes, there is always sufficient room.
5924            fidl::encoding::encode_in_envelope_optional::<Volume, D>(
5925                self.user_volume.as_ref().map(<Volume as fidl::encoding::ValueTypeMarker>::borrow),
5926                encoder,
5927                offset + cur_offset,
5928                depth,
5929            )?;
5930
5931            _prev_end_offset = cur_offset + envelope_size;
5932
5933            Ok(())
5934        }
5935    }
5936
5937    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AudioStreamSettings2 {
5938        #[inline(always)]
5939        fn new_empty() -> Self {
5940            Self::default()
5941        }
5942
5943        unsafe fn decode(
5944            &mut self,
5945            decoder: &mut fidl::encoding::Decoder<'_, D>,
5946            offset: usize,
5947            mut depth: fidl::encoding::Depth,
5948        ) -> fidl::Result<()> {
5949            decoder.debug_check_bounds::<Self>(offset);
5950            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5951                None => return Err(fidl::Error::NotNullable),
5952                Some(len) => len,
5953            };
5954            // Calling decoder.out_of_line_offset(0) is not allowed.
5955            if len == 0 {
5956                return Ok(());
5957            };
5958            depth.increment()?;
5959            let envelope_size = 8;
5960            let bytes_len = len * envelope_size;
5961            let offset = decoder.out_of_line_offset(bytes_len)?;
5962            // Decode the envelope for each type.
5963            let mut _next_ordinal_to_read = 0;
5964            let mut next_offset = offset;
5965            let end_offset = offset + bytes_len;
5966            _next_ordinal_to_read += 1;
5967            if next_offset >= end_offset {
5968                return Ok(());
5969            }
5970
5971            // Decode unknown envelopes for gaps in ordinals.
5972            while _next_ordinal_to_read < 1 {
5973                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5974                _next_ordinal_to_read += 1;
5975                next_offset += envelope_size;
5976            }
5977
5978            let next_out_of_line = decoder.next_out_of_line();
5979            let handles_before = decoder.remaining_handles();
5980            if let Some((inlined, num_bytes, num_handles)) =
5981                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5982            {
5983                let member_inline_size = <fidl_fuchsia_media::AudioRenderUsage2 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5984                if inlined != (member_inline_size <= 4) {
5985                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5986                }
5987                let inner_offset;
5988                let mut inner_depth = depth.clone();
5989                if inlined {
5990                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5991                    inner_offset = next_offset;
5992                } else {
5993                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5994                    inner_depth.increment()?;
5995                }
5996                let val_ref = self.stream.get_or_insert_with(|| {
5997                    fidl::new_empty!(fidl_fuchsia_media::AudioRenderUsage2, D)
5998                });
5999                fidl::decode!(
6000                    fidl_fuchsia_media::AudioRenderUsage2,
6001                    D,
6002                    val_ref,
6003                    decoder,
6004                    inner_offset,
6005                    inner_depth
6006                )?;
6007                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6008                {
6009                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6010                }
6011                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6012                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6013                }
6014            }
6015
6016            next_offset += envelope_size;
6017            _next_ordinal_to_read += 1;
6018            if next_offset >= end_offset {
6019                return Ok(());
6020            }
6021
6022            // Decode unknown envelopes for gaps in ordinals.
6023            while _next_ordinal_to_read < 2 {
6024                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6025                _next_ordinal_to_read += 1;
6026                next_offset += envelope_size;
6027            }
6028
6029            let next_out_of_line = decoder.next_out_of_line();
6030            let handles_before = decoder.remaining_handles();
6031            if let Some((inlined, num_bytes, num_handles)) =
6032                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6033            {
6034                let member_inline_size =
6035                    <AudioStreamSettingSource as fidl::encoding::TypeMarker>::inline_size(
6036                        decoder.context,
6037                    );
6038                if inlined != (member_inline_size <= 4) {
6039                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6040                }
6041                let inner_offset;
6042                let mut inner_depth = depth.clone();
6043                if inlined {
6044                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6045                    inner_offset = next_offset;
6046                } else {
6047                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6048                    inner_depth.increment()?;
6049                }
6050                let val_ref = self
6051                    .source
6052                    .get_or_insert_with(|| fidl::new_empty!(AudioStreamSettingSource, D));
6053                fidl::decode!(
6054                    AudioStreamSettingSource,
6055                    D,
6056                    val_ref,
6057                    decoder,
6058                    inner_offset,
6059                    inner_depth
6060                )?;
6061                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6062                {
6063                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6064                }
6065                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6066                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6067                }
6068            }
6069
6070            next_offset += envelope_size;
6071            _next_ordinal_to_read += 1;
6072            if next_offset >= end_offset {
6073                return Ok(());
6074            }
6075
6076            // Decode unknown envelopes for gaps in ordinals.
6077            while _next_ordinal_to_read < 3 {
6078                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6079                _next_ordinal_to_read += 1;
6080                next_offset += envelope_size;
6081            }
6082
6083            let next_out_of_line = decoder.next_out_of_line();
6084            let handles_before = decoder.remaining_handles();
6085            if let Some((inlined, num_bytes, num_handles)) =
6086                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6087            {
6088                let member_inline_size =
6089                    <Volume as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6090                if inlined != (member_inline_size <= 4) {
6091                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6092                }
6093                let inner_offset;
6094                let mut inner_depth = depth.clone();
6095                if inlined {
6096                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6097                    inner_offset = next_offset;
6098                } else {
6099                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6100                    inner_depth.increment()?;
6101                }
6102                let val_ref = self.user_volume.get_or_insert_with(|| fidl::new_empty!(Volume, D));
6103                fidl::decode!(Volume, D, val_ref, decoder, inner_offset, inner_depth)?;
6104                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6105                {
6106                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6107                }
6108                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6109                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6110                }
6111            }
6112
6113            next_offset += envelope_size;
6114
6115            // Decode the remaining unknown envelopes.
6116            while next_offset < end_offset {
6117                _next_ordinal_to_read += 1;
6118                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6119                next_offset += envelope_size;
6120            }
6121
6122            Ok(())
6123        }
6124    }
6125
6126    impl CaptionFontStyle {
6127        #[inline(always)]
6128        fn max_ordinal_present(&self) -> u64 {
6129            if let Some(_) = self.char_edge_style {
6130                return 4;
6131            }
6132            if let Some(_) = self.relative_size {
6133                return 3;
6134            }
6135            if let Some(_) = self.color {
6136                return 2;
6137            }
6138            if let Some(_) = self.family {
6139                return 1;
6140            }
6141            0
6142        }
6143    }
6144
6145    impl fidl::encoding::ValueTypeMarker for CaptionFontStyle {
6146        type Borrowed<'a> = &'a Self;
6147        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6148            value
6149        }
6150    }
6151
6152    unsafe impl fidl::encoding::TypeMarker for CaptionFontStyle {
6153        type Owned = Self;
6154
6155        #[inline(always)]
6156        fn inline_align(_context: fidl::encoding::Context) -> usize {
6157            8
6158        }
6159
6160        #[inline(always)]
6161        fn inline_size(_context: fidl::encoding::Context) -> usize {
6162            16
6163        }
6164    }
6165
6166    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CaptionFontStyle, D>
6167        for &CaptionFontStyle
6168    {
6169        unsafe fn encode(
6170            self,
6171            encoder: &mut fidl::encoding::Encoder<'_, D>,
6172            offset: usize,
6173            mut depth: fidl::encoding::Depth,
6174        ) -> fidl::Result<()> {
6175            encoder.debug_check_bounds::<CaptionFontStyle>(offset);
6176            // Vector header
6177            let max_ordinal: u64 = self.max_ordinal_present();
6178            encoder.write_num(max_ordinal, offset);
6179            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6180            // Calling encoder.out_of_line_offset(0) is not allowed.
6181            if max_ordinal == 0 {
6182                return Ok(());
6183            }
6184            depth.increment()?;
6185            let envelope_size = 8;
6186            let bytes_len = max_ordinal as usize * envelope_size;
6187            #[allow(unused_variables)]
6188            let offset = encoder.out_of_line_offset(bytes_len);
6189            let mut _prev_end_offset: usize = 0;
6190            if 1 > max_ordinal {
6191                return Ok(());
6192            }
6193
6194            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6195            // are envelope_size bytes.
6196            let cur_offset: usize = (1 - 1) * envelope_size;
6197
6198            // Zero reserved fields.
6199            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6200
6201            // Safety:
6202            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6203            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6204            //   envelope_size bytes, there is always sufficient room.
6205            fidl::encoding::encode_in_envelope_optional::<CaptionFontFamily, D>(
6206                self.family
6207                    .as_ref()
6208                    .map(<CaptionFontFamily as fidl::encoding::ValueTypeMarker>::borrow),
6209                encoder,
6210                offset + cur_offset,
6211                depth,
6212            )?;
6213
6214            _prev_end_offset = cur_offset + envelope_size;
6215            if 2 > max_ordinal {
6216                return Ok(());
6217            }
6218
6219            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6220            // are envelope_size bytes.
6221            let cur_offset: usize = (2 - 1) * envelope_size;
6222
6223            // Zero reserved fields.
6224            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6225
6226            // Safety:
6227            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6228            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6229            //   envelope_size bytes, there is always sufficient room.
6230            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_types::ColorRgba, D>(
6231                self.color.as_ref().map(
6232                    <fidl_fuchsia_ui_types::ColorRgba as fidl::encoding::ValueTypeMarker>::borrow,
6233                ),
6234                encoder,
6235                offset + cur_offset,
6236                depth,
6237            )?;
6238
6239            _prev_end_offset = cur_offset + envelope_size;
6240            if 3 > max_ordinal {
6241                return Ok(());
6242            }
6243
6244            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6245            // are envelope_size bytes.
6246            let cur_offset: usize = (3 - 1) * envelope_size;
6247
6248            // Zero reserved fields.
6249            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6250
6251            // Safety:
6252            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6253            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6254            //   envelope_size bytes, there is always sufficient room.
6255            fidl::encoding::encode_in_envelope_optional::<f32, D>(
6256                self.relative_size.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
6257                encoder,
6258                offset + cur_offset,
6259                depth,
6260            )?;
6261
6262            _prev_end_offset = cur_offset + envelope_size;
6263            if 4 > max_ordinal {
6264                return Ok(());
6265            }
6266
6267            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6268            // are envelope_size bytes.
6269            let cur_offset: usize = (4 - 1) * envelope_size;
6270
6271            // Zero reserved fields.
6272            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6273
6274            // Safety:
6275            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6276            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6277            //   envelope_size bytes, there is always sufficient room.
6278            fidl::encoding::encode_in_envelope_optional::<EdgeStyle, D>(
6279                self.char_edge_style
6280                    .as_ref()
6281                    .map(<EdgeStyle as fidl::encoding::ValueTypeMarker>::borrow),
6282                encoder,
6283                offset + cur_offset,
6284                depth,
6285            )?;
6286
6287            _prev_end_offset = cur_offset + envelope_size;
6288
6289            Ok(())
6290        }
6291    }
6292
6293    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CaptionFontStyle {
6294        #[inline(always)]
6295        fn new_empty() -> Self {
6296            Self::default()
6297        }
6298
6299        unsafe fn decode(
6300            &mut self,
6301            decoder: &mut fidl::encoding::Decoder<'_, D>,
6302            offset: usize,
6303            mut depth: fidl::encoding::Depth,
6304        ) -> fidl::Result<()> {
6305            decoder.debug_check_bounds::<Self>(offset);
6306            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6307                None => return Err(fidl::Error::NotNullable),
6308                Some(len) => len,
6309            };
6310            // Calling decoder.out_of_line_offset(0) is not allowed.
6311            if len == 0 {
6312                return Ok(());
6313            };
6314            depth.increment()?;
6315            let envelope_size = 8;
6316            let bytes_len = len * envelope_size;
6317            let offset = decoder.out_of_line_offset(bytes_len)?;
6318            // Decode the envelope for each type.
6319            let mut _next_ordinal_to_read = 0;
6320            let mut next_offset = offset;
6321            let end_offset = offset + bytes_len;
6322            _next_ordinal_to_read += 1;
6323            if next_offset >= end_offset {
6324                return Ok(());
6325            }
6326
6327            // Decode unknown envelopes for gaps in ordinals.
6328            while _next_ordinal_to_read < 1 {
6329                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6330                _next_ordinal_to_read += 1;
6331                next_offset += envelope_size;
6332            }
6333
6334            let next_out_of_line = decoder.next_out_of_line();
6335            let handles_before = decoder.remaining_handles();
6336            if let Some((inlined, num_bytes, num_handles)) =
6337                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6338            {
6339                let member_inline_size =
6340                    <CaptionFontFamily as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6341                if inlined != (member_inline_size <= 4) {
6342                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6343                }
6344                let inner_offset;
6345                let mut inner_depth = depth.clone();
6346                if inlined {
6347                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6348                    inner_offset = next_offset;
6349                } else {
6350                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6351                    inner_depth.increment()?;
6352                }
6353                let val_ref =
6354                    self.family.get_or_insert_with(|| fidl::new_empty!(CaptionFontFamily, D));
6355                fidl::decode!(CaptionFontFamily, D, val_ref, decoder, inner_offset, inner_depth)?;
6356                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6357                {
6358                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6359                }
6360                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6361                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6362                }
6363            }
6364
6365            next_offset += envelope_size;
6366            _next_ordinal_to_read += 1;
6367            if next_offset >= end_offset {
6368                return Ok(());
6369            }
6370
6371            // Decode unknown envelopes for gaps in ordinals.
6372            while _next_ordinal_to_read < 2 {
6373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6374                _next_ordinal_to_read += 1;
6375                next_offset += envelope_size;
6376            }
6377
6378            let next_out_of_line = decoder.next_out_of_line();
6379            let handles_before = decoder.remaining_handles();
6380            if let Some((inlined, num_bytes, num_handles)) =
6381                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6382            {
6383                let member_inline_size =
6384                    <fidl_fuchsia_ui_types::ColorRgba as fidl::encoding::TypeMarker>::inline_size(
6385                        decoder.context,
6386                    );
6387                if inlined != (member_inline_size <= 4) {
6388                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6389                }
6390                let inner_offset;
6391                let mut inner_depth = depth.clone();
6392                if inlined {
6393                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6394                    inner_offset = next_offset;
6395                } else {
6396                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6397                    inner_depth.increment()?;
6398                }
6399                let val_ref = self
6400                    .color
6401                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_ui_types::ColorRgba, D));
6402                fidl::decode!(
6403                    fidl_fuchsia_ui_types::ColorRgba,
6404                    D,
6405                    val_ref,
6406                    decoder,
6407                    inner_offset,
6408                    inner_depth
6409                )?;
6410                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6411                {
6412                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6413                }
6414                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6415                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6416                }
6417            }
6418
6419            next_offset += envelope_size;
6420            _next_ordinal_to_read += 1;
6421            if next_offset >= end_offset {
6422                return Ok(());
6423            }
6424
6425            // Decode unknown envelopes for gaps in ordinals.
6426            while _next_ordinal_to_read < 3 {
6427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6428                _next_ordinal_to_read += 1;
6429                next_offset += envelope_size;
6430            }
6431
6432            let next_out_of_line = decoder.next_out_of_line();
6433            let handles_before = decoder.remaining_handles();
6434            if let Some((inlined, num_bytes, num_handles)) =
6435                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6436            {
6437                let member_inline_size =
6438                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6439                if inlined != (member_inline_size <= 4) {
6440                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6441                }
6442                let inner_offset;
6443                let mut inner_depth = depth.clone();
6444                if inlined {
6445                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6446                    inner_offset = next_offset;
6447                } else {
6448                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6449                    inner_depth.increment()?;
6450                }
6451                let val_ref = self.relative_size.get_or_insert_with(|| fidl::new_empty!(f32, D));
6452                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
6453                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6454                {
6455                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6456                }
6457                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6458                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6459                }
6460            }
6461
6462            next_offset += envelope_size;
6463            _next_ordinal_to_read += 1;
6464            if next_offset >= end_offset {
6465                return Ok(());
6466            }
6467
6468            // Decode unknown envelopes for gaps in ordinals.
6469            while _next_ordinal_to_read < 4 {
6470                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6471                _next_ordinal_to_read += 1;
6472                next_offset += envelope_size;
6473            }
6474
6475            let next_out_of_line = decoder.next_out_of_line();
6476            let handles_before = decoder.remaining_handles();
6477            if let Some((inlined, num_bytes, num_handles)) =
6478                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6479            {
6480                let member_inline_size =
6481                    <EdgeStyle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6482                if inlined != (member_inline_size <= 4) {
6483                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6484                }
6485                let inner_offset;
6486                let mut inner_depth = depth.clone();
6487                if inlined {
6488                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6489                    inner_offset = next_offset;
6490                } else {
6491                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6492                    inner_depth.increment()?;
6493                }
6494                let val_ref =
6495                    self.char_edge_style.get_or_insert_with(|| fidl::new_empty!(EdgeStyle, D));
6496                fidl::decode!(EdgeStyle, D, val_ref, decoder, inner_offset, inner_depth)?;
6497                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6498                {
6499                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6500                }
6501                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6502                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6503                }
6504            }
6505
6506            next_offset += envelope_size;
6507
6508            // Decode the remaining unknown envelopes.
6509            while next_offset < end_offset {
6510                _next_ordinal_to_read += 1;
6511                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6512                next_offset += envelope_size;
6513            }
6514
6515            Ok(())
6516        }
6517    }
6518
6519    impl CaptionsSettings {
6520        #[inline(always)]
6521        fn max_ordinal_present(&self) -> u64 {
6522            if let Some(_) = self.background_color {
6523                return 5;
6524            }
6525            if let Some(_) = self.window_color {
6526                return 4;
6527            }
6528            if let Some(_) = self.font_style {
6529                return 3;
6530            }
6531            if let Some(_) = self.for_tts {
6532                return 2;
6533            }
6534            if let Some(_) = self.for_media {
6535                return 1;
6536            }
6537            0
6538        }
6539    }
6540
6541    impl fidl::encoding::ValueTypeMarker for CaptionsSettings {
6542        type Borrowed<'a> = &'a Self;
6543        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6544            value
6545        }
6546    }
6547
6548    unsafe impl fidl::encoding::TypeMarker for CaptionsSettings {
6549        type Owned = Self;
6550
6551        #[inline(always)]
6552        fn inline_align(_context: fidl::encoding::Context) -> usize {
6553            8
6554        }
6555
6556        #[inline(always)]
6557        fn inline_size(_context: fidl::encoding::Context) -> usize {
6558            16
6559        }
6560    }
6561
6562    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CaptionsSettings, D>
6563        for &CaptionsSettings
6564    {
6565        unsafe fn encode(
6566            self,
6567            encoder: &mut fidl::encoding::Encoder<'_, D>,
6568            offset: usize,
6569            mut depth: fidl::encoding::Depth,
6570        ) -> fidl::Result<()> {
6571            encoder.debug_check_bounds::<CaptionsSettings>(offset);
6572            // Vector header
6573            let max_ordinal: u64 = self.max_ordinal_present();
6574            encoder.write_num(max_ordinal, offset);
6575            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6576            // Calling encoder.out_of_line_offset(0) is not allowed.
6577            if max_ordinal == 0 {
6578                return Ok(());
6579            }
6580            depth.increment()?;
6581            let envelope_size = 8;
6582            let bytes_len = max_ordinal as usize * envelope_size;
6583            #[allow(unused_variables)]
6584            let offset = encoder.out_of_line_offset(bytes_len);
6585            let mut _prev_end_offset: usize = 0;
6586            if 1 > max_ordinal {
6587                return Ok(());
6588            }
6589
6590            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6591            // are envelope_size bytes.
6592            let cur_offset: usize = (1 - 1) * envelope_size;
6593
6594            // Zero reserved fields.
6595            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6596
6597            // Safety:
6598            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6599            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6600            //   envelope_size bytes, there is always sufficient room.
6601            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6602                self.for_media.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6603                encoder,
6604                offset + cur_offset,
6605                depth,
6606            )?;
6607
6608            _prev_end_offset = cur_offset + envelope_size;
6609            if 2 > max_ordinal {
6610                return Ok(());
6611            }
6612
6613            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6614            // are envelope_size bytes.
6615            let cur_offset: usize = (2 - 1) * envelope_size;
6616
6617            // Zero reserved fields.
6618            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6619
6620            // Safety:
6621            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6622            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6623            //   envelope_size bytes, there is always sufficient room.
6624            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6625                self.for_tts.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6626                encoder,
6627                offset + cur_offset,
6628                depth,
6629            )?;
6630
6631            _prev_end_offset = cur_offset + envelope_size;
6632            if 3 > max_ordinal {
6633                return Ok(());
6634            }
6635
6636            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6637            // are envelope_size bytes.
6638            let cur_offset: usize = (3 - 1) * envelope_size;
6639
6640            // Zero reserved fields.
6641            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6642
6643            // Safety:
6644            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6645            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6646            //   envelope_size bytes, there is always sufficient room.
6647            fidl::encoding::encode_in_envelope_optional::<CaptionFontStyle, D>(
6648                self.font_style
6649                    .as_ref()
6650                    .map(<CaptionFontStyle as fidl::encoding::ValueTypeMarker>::borrow),
6651                encoder,
6652                offset + cur_offset,
6653                depth,
6654            )?;
6655
6656            _prev_end_offset = cur_offset + envelope_size;
6657            if 4 > max_ordinal {
6658                return Ok(());
6659            }
6660
6661            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6662            // are envelope_size bytes.
6663            let cur_offset: usize = (4 - 1) * envelope_size;
6664
6665            // Zero reserved fields.
6666            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6667
6668            // Safety:
6669            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6670            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6671            //   envelope_size bytes, there is always sufficient room.
6672            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_types::ColorRgba, D>(
6673                self.window_color.as_ref().map(
6674                    <fidl_fuchsia_ui_types::ColorRgba as fidl::encoding::ValueTypeMarker>::borrow,
6675                ),
6676                encoder,
6677                offset + cur_offset,
6678                depth,
6679            )?;
6680
6681            _prev_end_offset = cur_offset + envelope_size;
6682            if 5 > max_ordinal {
6683                return Ok(());
6684            }
6685
6686            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6687            // are envelope_size bytes.
6688            let cur_offset: usize = (5 - 1) * envelope_size;
6689
6690            // Zero reserved fields.
6691            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6692
6693            // Safety:
6694            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6695            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6696            //   envelope_size bytes, there is always sufficient room.
6697            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_types::ColorRgba, D>(
6698                self.background_color.as_ref().map(
6699                    <fidl_fuchsia_ui_types::ColorRgba as fidl::encoding::ValueTypeMarker>::borrow,
6700                ),
6701                encoder,
6702                offset + cur_offset,
6703                depth,
6704            )?;
6705
6706            _prev_end_offset = cur_offset + envelope_size;
6707
6708            Ok(())
6709        }
6710    }
6711
6712    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CaptionsSettings {
6713        #[inline(always)]
6714        fn new_empty() -> Self {
6715            Self::default()
6716        }
6717
6718        unsafe fn decode(
6719            &mut self,
6720            decoder: &mut fidl::encoding::Decoder<'_, D>,
6721            offset: usize,
6722            mut depth: fidl::encoding::Depth,
6723        ) -> fidl::Result<()> {
6724            decoder.debug_check_bounds::<Self>(offset);
6725            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6726                None => return Err(fidl::Error::NotNullable),
6727                Some(len) => len,
6728            };
6729            // Calling decoder.out_of_line_offset(0) is not allowed.
6730            if len == 0 {
6731                return Ok(());
6732            };
6733            depth.increment()?;
6734            let envelope_size = 8;
6735            let bytes_len = len * envelope_size;
6736            let offset = decoder.out_of_line_offset(bytes_len)?;
6737            // Decode the envelope for each type.
6738            let mut _next_ordinal_to_read = 0;
6739            let mut next_offset = offset;
6740            let end_offset = offset + bytes_len;
6741            _next_ordinal_to_read += 1;
6742            if next_offset >= end_offset {
6743                return Ok(());
6744            }
6745
6746            // Decode unknown envelopes for gaps in ordinals.
6747            while _next_ordinal_to_read < 1 {
6748                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6749                _next_ordinal_to_read += 1;
6750                next_offset += envelope_size;
6751            }
6752
6753            let next_out_of_line = decoder.next_out_of_line();
6754            let handles_before = decoder.remaining_handles();
6755            if let Some((inlined, num_bytes, num_handles)) =
6756                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6757            {
6758                let member_inline_size =
6759                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6760                if inlined != (member_inline_size <= 4) {
6761                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6762                }
6763                let inner_offset;
6764                let mut inner_depth = depth.clone();
6765                if inlined {
6766                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6767                    inner_offset = next_offset;
6768                } else {
6769                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6770                    inner_depth.increment()?;
6771                }
6772                let val_ref = self.for_media.get_or_insert_with(|| fidl::new_empty!(bool, D));
6773                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6774                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6775                {
6776                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6777                }
6778                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6779                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6780                }
6781            }
6782
6783            next_offset += envelope_size;
6784            _next_ordinal_to_read += 1;
6785            if next_offset >= end_offset {
6786                return Ok(());
6787            }
6788
6789            // Decode unknown envelopes for gaps in ordinals.
6790            while _next_ordinal_to_read < 2 {
6791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6792                _next_ordinal_to_read += 1;
6793                next_offset += envelope_size;
6794            }
6795
6796            let next_out_of_line = decoder.next_out_of_line();
6797            let handles_before = decoder.remaining_handles();
6798            if let Some((inlined, num_bytes, num_handles)) =
6799                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6800            {
6801                let member_inline_size =
6802                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6803                if inlined != (member_inline_size <= 4) {
6804                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6805                }
6806                let inner_offset;
6807                let mut inner_depth = depth.clone();
6808                if inlined {
6809                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6810                    inner_offset = next_offset;
6811                } else {
6812                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6813                    inner_depth.increment()?;
6814                }
6815                let val_ref = self.for_tts.get_or_insert_with(|| fidl::new_empty!(bool, D));
6816                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6817                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6818                {
6819                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6820                }
6821                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6822                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6823                }
6824            }
6825
6826            next_offset += envelope_size;
6827            _next_ordinal_to_read += 1;
6828            if next_offset >= end_offset {
6829                return Ok(());
6830            }
6831
6832            // Decode unknown envelopes for gaps in ordinals.
6833            while _next_ordinal_to_read < 3 {
6834                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6835                _next_ordinal_to_read += 1;
6836                next_offset += envelope_size;
6837            }
6838
6839            let next_out_of_line = decoder.next_out_of_line();
6840            let handles_before = decoder.remaining_handles();
6841            if let Some((inlined, num_bytes, num_handles)) =
6842                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6843            {
6844                let member_inline_size =
6845                    <CaptionFontStyle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6846                if inlined != (member_inline_size <= 4) {
6847                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6848                }
6849                let inner_offset;
6850                let mut inner_depth = depth.clone();
6851                if inlined {
6852                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6853                    inner_offset = next_offset;
6854                } else {
6855                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6856                    inner_depth.increment()?;
6857                }
6858                let val_ref =
6859                    self.font_style.get_or_insert_with(|| fidl::new_empty!(CaptionFontStyle, D));
6860                fidl::decode!(CaptionFontStyle, D, val_ref, decoder, inner_offset, inner_depth)?;
6861                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6862                {
6863                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6864                }
6865                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6866                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6867                }
6868            }
6869
6870            next_offset += envelope_size;
6871            _next_ordinal_to_read += 1;
6872            if next_offset >= end_offset {
6873                return Ok(());
6874            }
6875
6876            // Decode unknown envelopes for gaps in ordinals.
6877            while _next_ordinal_to_read < 4 {
6878                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6879                _next_ordinal_to_read += 1;
6880                next_offset += envelope_size;
6881            }
6882
6883            let next_out_of_line = decoder.next_out_of_line();
6884            let handles_before = decoder.remaining_handles();
6885            if let Some((inlined, num_bytes, num_handles)) =
6886                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6887            {
6888                let member_inline_size =
6889                    <fidl_fuchsia_ui_types::ColorRgba as fidl::encoding::TypeMarker>::inline_size(
6890                        decoder.context,
6891                    );
6892                if inlined != (member_inline_size <= 4) {
6893                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6894                }
6895                let inner_offset;
6896                let mut inner_depth = depth.clone();
6897                if inlined {
6898                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6899                    inner_offset = next_offset;
6900                } else {
6901                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6902                    inner_depth.increment()?;
6903                }
6904                let val_ref = self
6905                    .window_color
6906                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_ui_types::ColorRgba, D));
6907                fidl::decode!(
6908                    fidl_fuchsia_ui_types::ColorRgba,
6909                    D,
6910                    val_ref,
6911                    decoder,
6912                    inner_offset,
6913                    inner_depth
6914                )?;
6915                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6916                {
6917                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6918                }
6919                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6920                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6921                }
6922            }
6923
6924            next_offset += envelope_size;
6925            _next_ordinal_to_read += 1;
6926            if next_offset >= end_offset {
6927                return Ok(());
6928            }
6929
6930            // Decode unknown envelopes for gaps in ordinals.
6931            while _next_ordinal_to_read < 5 {
6932                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6933                _next_ordinal_to_read += 1;
6934                next_offset += envelope_size;
6935            }
6936
6937            let next_out_of_line = decoder.next_out_of_line();
6938            let handles_before = decoder.remaining_handles();
6939            if let Some((inlined, num_bytes, num_handles)) =
6940                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6941            {
6942                let member_inline_size =
6943                    <fidl_fuchsia_ui_types::ColorRgba as fidl::encoding::TypeMarker>::inline_size(
6944                        decoder.context,
6945                    );
6946                if inlined != (member_inline_size <= 4) {
6947                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6948                }
6949                let inner_offset;
6950                let mut inner_depth = depth.clone();
6951                if inlined {
6952                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6953                    inner_offset = next_offset;
6954                } else {
6955                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6956                    inner_depth.increment()?;
6957                }
6958                let val_ref = self
6959                    .background_color
6960                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_ui_types::ColorRgba, D));
6961                fidl::decode!(
6962                    fidl_fuchsia_ui_types::ColorRgba,
6963                    D,
6964                    val_ref,
6965                    decoder,
6966                    inner_offset,
6967                    inner_depth
6968                )?;
6969                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6970                {
6971                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6972                }
6973                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6974                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6975                }
6976            }
6977
6978            next_offset += envelope_size;
6979
6980            // Decode the remaining unknown envelopes.
6981            while next_offset < end_offset {
6982                _next_ordinal_to_read += 1;
6983                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6984                next_offset += envelope_size;
6985            }
6986
6987            Ok(())
6988        }
6989    }
6990
6991    impl DeviceState {
6992        #[inline(always)]
6993        fn max_ordinal_present(&self) -> u64 {
6994            if let Some(_) = self.toggle_flags {
6995                return 1;
6996            }
6997            0
6998        }
6999    }
7000
7001    impl fidl::encoding::ValueTypeMarker for DeviceState {
7002        type Borrowed<'a> = &'a Self;
7003        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7004            value
7005        }
7006    }
7007
7008    unsafe impl fidl::encoding::TypeMarker for DeviceState {
7009        type Owned = Self;
7010
7011        #[inline(always)]
7012        fn inline_align(_context: fidl::encoding::Context) -> usize {
7013            8
7014        }
7015
7016        #[inline(always)]
7017        fn inline_size(_context: fidl::encoding::Context) -> usize {
7018            16
7019        }
7020    }
7021
7022    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceState, D>
7023        for &DeviceState
7024    {
7025        unsafe fn encode(
7026            self,
7027            encoder: &mut fidl::encoding::Encoder<'_, D>,
7028            offset: usize,
7029            mut depth: fidl::encoding::Depth,
7030        ) -> fidl::Result<()> {
7031            encoder.debug_check_bounds::<DeviceState>(offset);
7032            // Vector header
7033            let max_ordinal: u64 = self.max_ordinal_present();
7034            encoder.write_num(max_ordinal, offset);
7035            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7036            // Calling encoder.out_of_line_offset(0) is not allowed.
7037            if max_ordinal == 0 {
7038                return Ok(());
7039            }
7040            depth.increment()?;
7041            let envelope_size = 8;
7042            let bytes_len = max_ordinal as usize * envelope_size;
7043            #[allow(unused_variables)]
7044            let offset = encoder.out_of_line_offset(bytes_len);
7045            let mut _prev_end_offset: usize = 0;
7046            if 1 > max_ordinal {
7047                return Ok(());
7048            }
7049
7050            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7051            // are envelope_size bytes.
7052            let cur_offset: usize = (1 - 1) * envelope_size;
7053
7054            // Zero reserved fields.
7055            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7056
7057            // Safety:
7058            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7059            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7060            //   envelope_size bytes, there is always sufficient room.
7061            fidl::encoding::encode_in_envelope_optional::<ToggleStateFlags, D>(
7062                self.toggle_flags
7063                    .as_ref()
7064                    .map(<ToggleStateFlags as fidl::encoding::ValueTypeMarker>::borrow),
7065                encoder,
7066                offset + cur_offset,
7067                depth,
7068            )?;
7069
7070            _prev_end_offset = cur_offset + envelope_size;
7071
7072            Ok(())
7073        }
7074    }
7075
7076    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceState {
7077        #[inline(always)]
7078        fn new_empty() -> Self {
7079            Self::default()
7080        }
7081
7082        unsafe fn decode(
7083            &mut self,
7084            decoder: &mut fidl::encoding::Decoder<'_, D>,
7085            offset: usize,
7086            mut depth: fidl::encoding::Depth,
7087        ) -> fidl::Result<()> {
7088            decoder.debug_check_bounds::<Self>(offset);
7089            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7090                None => return Err(fidl::Error::NotNullable),
7091                Some(len) => len,
7092            };
7093            // Calling decoder.out_of_line_offset(0) is not allowed.
7094            if len == 0 {
7095                return Ok(());
7096            };
7097            depth.increment()?;
7098            let envelope_size = 8;
7099            let bytes_len = len * envelope_size;
7100            let offset = decoder.out_of_line_offset(bytes_len)?;
7101            // Decode the envelope for each type.
7102            let mut _next_ordinal_to_read = 0;
7103            let mut next_offset = offset;
7104            let end_offset = offset + bytes_len;
7105            _next_ordinal_to_read += 1;
7106            if next_offset >= end_offset {
7107                return Ok(());
7108            }
7109
7110            // Decode unknown envelopes for gaps in ordinals.
7111            while _next_ordinal_to_read < 1 {
7112                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7113                _next_ordinal_to_read += 1;
7114                next_offset += envelope_size;
7115            }
7116
7117            let next_out_of_line = decoder.next_out_of_line();
7118            let handles_before = decoder.remaining_handles();
7119            if let Some((inlined, num_bytes, num_handles)) =
7120                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7121            {
7122                let member_inline_size =
7123                    <ToggleStateFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7124                if inlined != (member_inline_size <= 4) {
7125                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7126                }
7127                let inner_offset;
7128                let mut inner_depth = depth.clone();
7129                if inlined {
7130                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7131                    inner_offset = next_offset;
7132                } else {
7133                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7134                    inner_depth.increment()?;
7135                }
7136                let val_ref =
7137                    self.toggle_flags.get_or_insert_with(|| fidl::new_empty!(ToggleStateFlags, D));
7138                fidl::decode!(ToggleStateFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
7139                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7140                {
7141                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7142                }
7143                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7144                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7145                }
7146            }
7147
7148            next_offset += envelope_size;
7149
7150            // Decode the remaining unknown envelopes.
7151            while next_offset < end_offset {
7152                _next_ordinal_to_read += 1;
7153                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7154                next_offset += envelope_size;
7155            }
7156
7157            Ok(())
7158        }
7159    }
7160
7161    impl DisplaySettings {
7162        #[inline(always)]
7163        fn max_ordinal_present(&self) -> u64 {
7164            if let Some(_) = self.adjusted_auto_brightness {
7165                return 7;
7166            }
7167            if let Some(_) = self.theme {
7168                return 6;
7169            }
7170            if let Some(_) = self.screen_enabled {
7171                return 5;
7172            }
7173            if let Some(_) = self.low_light_mode {
7174                return 4;
7175            }
7176            if let Some(_) = self.brightness_value {
7177                return 2;
7178            }
7179            if let Some(_) = self.auto_brightness {
7180                return 1;
7181            }
7182            0
7183        }
7184    }
7185
7186    impl fidl::encoding::ValueTypeMarker for DisplaySettings {
7187        type Borrowed<'a> = &'a Self;
7188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7189            value
7190        }
7191    }
7192
7193    unsafe impl fidl::encoding::TypeMarker for DisplaySettings {
7194        type Owned = Self;
7195
7196        #[inline(always)]
7197        fn inline_align(_context: fidl::encoding::Context) -> usize {
7198            8
7199        }
7200
7201        #[inline(always)]
7202        fn inline_size(_context: fidl::encoding::Context) -> usize {
7203            16
7204        }
7205    }
7206
7207    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisplaySettings, D>
7208        for &DisplaySettings
7209    {
7210        unsafe fn encode(
7211            self,
7212            encoder: &mut fidl::encoding::Encoder<'_, D>,
7213            offset: usize,
7214            mut depth: fidl::encoding::Depth,
7215        ) -> fidl::Result<()> {
7216            encoder.debug_check_bounds::<DisplaySettings>(offset);
7217            // Vector header
7218            let max_ordinal: u64 = self.max_ordinal_present();
7219            encoder.write_num(max_ordinal, offset);
7220            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7221            // Calling encoder.out_of_line_offset(0) is not allowed.
7222            if max_ordinal == 0 {
7223                return Ok(());
7224            }
7225            depth.increment()?;
7226            let envelope_size = 8;
7227            let bytes_len = max_ordinal as usize * envelope_size;
7228            #[allow(unused_variables)]
7229            let offset = encoder.out_of_line_offset(bytes_len);
7230            let mut _prev_end_offset: usize = 0;
7231            if 1 > max_ordinal {
7232                return Ok(());
7233            }
7234
7235            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7236            // are envelope_size bytes.
7237            let cur_offset: usize = (1 - 1) * envelope_size;
7238
7239            // Zero reserved fields.
7240            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7241
7242            // Safety:
7243            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7244            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7245            //   envelope_size bytes, there is always sufficient room.
7246            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7247                self.auto_brightness
7248                    .as_ref()
7249                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7250                encoder,
7251                offset + cur_offset,
7252                depth,
7253            )?;
7254
7255            _prev_end_offset = cur_offset + envelope_size;
7256            if 2 > max_ordinal {
7257                return Ok(());
7258            }
7259
7260            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7261            // are envelope_size bytes.
7262            let cur_offset: usize = (2 - 1) * envelope_size;
7263
7264            // Zero reserved fields.
7265            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7266
7267            // Safety:
7268            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7269            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7270            //   envelope_size bytes, there is always sufficient room.
7271            fidl::encoding::encode_in_envelope_optional::<f32, D>(
7272                self.brightness_value
7273                    .as_ref()
7274                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
7275                encoder,
7276                offset + cur_offset,
7277                depth,
7278            )?;
7279
7280            _prev_end_offset = cur_offset + envelope_size;
7281            if 4 > max_ordinal {
7282                return Ok(());
7283            }
7284
7285            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7286            // are envelope_size bytes.
7287            let cur_offset: usize = (4 - 1) * envelope_size;
7288
7289            // Zero reserved fields.
7290            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7291
7292            // Safety:
7293            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7294            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7295            //   envelope_size bytes, there is always sufficient room.
7296            fidl::encoding::encode_in_envelope_optional::<LowLightMode, D>(
7297                self.low_light_mode
7298                    .as_ref()
7299                    .map(<LowLightMode as fidl::encoding::ValueTypeMarker>::borrow),
7300                encoder,
7301                offset + cur_offset,
7302                depth,
7303            )?;
7304
7305            _prev_end_offset = cur_offset + envelope_size;
7306            if 5 > max_ordinal {
7307                return Ok(());
7308            }
7309
7310            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7311            // are envelope_size bytes.
7312            let cur_offset: usize = (5 - 1) * envelope_size;
7313
7314            // Zero reserved fields.
7315            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7316
7317            // Safety:
7318            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7319            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7320            //   envelope_size bytes, there is always sufficient room.
7321            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7322                self.screen_enabled.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7323                encoder,
7324                offset + cur_offset,
7325                depth,
7326            )?;
7327
7328            _prev_end_offset = cur_offset + envelope_size;
7329            if 6 > max_ordinal {
7330                return Ok(());
7331            }
7332
7333            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7334            // are envelope_size bytes.
7335            let cur_offset: usize = (6 - 1) * envelope_size;
7336
7337            // Zero reserved fields.
7338            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7339
7340            // Safety:
7341            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7342            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7343            //   envelope_size bytes, there is always sufficient room.
7344            fidl::encoding::encode_in_envelope_optional::<Theme, D>(
7345                self.theme.as_ref().map(<Theme as fidl::encoding::ValueTypeMarker>::borrow),
7346                encoder,
7347                offset + cur_offset,
7348                depth,
7349            )?;
7350
7351            _prev_end_offset = cur_offset + envelope_size;
7352            if 7 > max_ordinal {
7353                return Ok(());
7354            }
7355
7356            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7357            // are envelope_size bytes.
7358            let cur_offset: usize = (7 - 1) * envelope_size;
7359
7360            // Zero reserved fields.
7361            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7362
7363            // Safety:
7364            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7365            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7366            //   envelope_size bytes, there is always sufficient room.
7367            fidl::encoding::encode_in_envelope_optional::<f32, D>(
7368                self.adjusted_auto_brightness
7369                    .as_ref()
7370                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
7371                encoder,
7372                offset + cur_offset,
7373                depth,
7374            )?;
7375
7376            _prev_end_offset = cur_offset + envelope_size;
7377
7378            Ok(())
7379        }
7380    }
7381
7382    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisplaySettings {
7383        #[inline(always)]
7384        fn new_empty() -> Self {
7385            Self::default()
7386        }
7387
7388        unsafe fn decode(
7389            &mut self,
7390            decoder: &mut fidl::encoding::Decoder<'_, D>,
7391            offset: usize,
7392            mut depth: fidl::encoding::Depth,
7393        ) -> fidl::Result<()> {
7394            decoder.debug_check_bounds::<Self>(offset);
7395            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7396                None => return Err(fidl::Error::NotNullable),
7397                Some(len) => len,
7398            };
7399            // Calling decoder.out_of_line_offset(0) is not allowed.
7400            if len == 0 {
7401                return Ok(());
7402            };
7403            depth.increment()?;
7404            let envelope_size = 8;
7405            let bytes_len = len * envelope_size;
7406            let offset = decoder.out_of_line_offset(bytes_len)?;
7407            // Decode the envelope for each type.
7408            let mut _next_ordinal_to_read = 0;
7409            let mut next_offset = offset;
7410            let end_offset = offset + bytes_len;
7411            _next_ordinal_to_read += 1;
7412            if next_offset >= end_offset {
7413                return Ok(());
7414            }
7415
7416            // Decode unknown envelopes for gaps in ordinals.
7417            while _next_ordinal_to_read < 1 {
7418                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7419                _next_ordinal_to_read += 1;
7420                next_offset += envelope_size;
7421            }
7422
7423            let next_out_of_line = decoder.next_out_of_line();
7424            let handles_before = decoder.remaining_handles();
7425            if let Some((inlined, num_bytes, num_handles)) =
7426                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7427            {
7428                let member_inline_size =
7429                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7430                if inlined != (member_inline_size <= 4) {
7431                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7432                }
7433                let inner_offset;
7434                let mut inner_depth = depth.clone();
7435                if inlined {
7436                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7437                    inner_offset = next_offset;
7438                } else {
7439                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7440                    inner_depth.increment()?;
7441                }
7442                let val_ref = self.auto_brightness.get_or_insert_with(|| fidl::new_empty!(bool, D));
7443                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7444                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7445                {
7446                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7447                }
7448                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7449                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7450                }
7451            }
7452
7453            next_offset += envelope_size;
7454            _next_ordinal_to_read += 1;
7455            if next_offset >= end_offset {
7456                return Ok(());
7457            }
7458
7459            // Decode unknown envelopes for gaps in ordinals.
7460            while _next_ordinal_to_read < 2 {
7461                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7462                _next_ordinal_to_read += 1;
7463                next_offset += envelope_size;
7464            }
7465
7466            let next_out_of_line = decoder.next_out_of_line();
7467            let handles_before = decoder.remaining_handles();
7468            if let Some((inlined, num_bytes, num_handles)) =
7469                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7470            {
7471                let member_inline_size =
7472                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7473                if inlined != (member_inline_size <= 4) {
7474                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7475                }
7476                let inner_offset;
7477                let mut inner_depth = depth.clone();
7478                if inlined {
7479                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7480                    inner_offset = next_offset;
7481                } else {
7482                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7483                    inner_depth.increment()?;
7484                }
7485                let val_ref = self.brightness_value.get_or_insert_with(|| fidl::new_empty!(f32, D));
7486                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
7487                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7488                {
7489                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7490                }
7491                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7492                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7493                }
7494            }
7495
7496            next_offset += envelope_size;
7497            _next_ordinal_to_read += 1;
7498            if next_offset >= end_offset {
7499                return Ok(());
7500            }
7501
7502            // Decode unknown envelopes for gaps in ordinals.
7503            while _next_ordinal_to_read < 4 {
7504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7505                _next_ordinal_to_read += 1;
7506                next_offset += envelope_size;
7507            }
7508
7509            let next_out_of_line = decoder.next_out_of_line();
7510            let handles_before = decoder.remaining_handles();
7511            if let Some((inlined, num_bytes, num_handles)) =
7512                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7513            {
7514                let member_inline_size =
7515                    <LowLightMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7516                if inlined != (member_inline_size <= 4) {
7517                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7518                }
7519                let inner_offset;
7520                let mut inner_depth = depth.clone();
7521                if inlined {
7522                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7523                    inner_offset = next_offset;
7524                } else {
7525                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7526                    inner_depth.increment()?;
7527                }
7528                let val_ref =
7529                    self.low_light_mode.get_or_insert_with(|| fidl::new_empty!(LowLightMode, D));
7530                fidl::decode!(LowLightMode, D, val_ref, decoder, inner_offset, inner_depth)?;
7531                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7532                {
7533                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7534                }
7535                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7536                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7537                }
7538            }
7539
7540            next_offset += envelope_size;
7541            _next_ordinal_to_read += 1;
7542            if next_offset >= end_offset {
7543                return Ok(());
7544            }
7545
7546            // Decode unknown envelopes for gaps in ordinals.
7547            while _next_ordinal_to_read < 5 {
7548                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7549                _next_ordinal_to_read += 1;
7550                next_offset += envelope_size;
7551            }
7552
7553            let next_out_of_line = decoder.next_out_of_line();
7554            let handles_before = decoder.remaining_handles();
7555            if let Some((inlined, num_bytes, num_handles)) =
7556                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7557            {
7558                let member_inline_size =
7559                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7560                if inlined != (member_inline_size <= 4) {
7561                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7562                }
7563                let inner_offset;
7564                let mut inner_depth = depth.clone();
7565                if inlined {
7566                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7567                    inner_offset = next_offset;
7568                } else {
7569                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7570                    inner_depth.increment()?;
7571                }
7572                let val_ref = self.screen_enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
7573                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7574                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7575                {
7576                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7577                }
7578                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7579                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7580                }
7581            }
7582
7583            next_offset += envelope_size;
7584            _next_ordinal_to_read += 1;
7585            if next_offset >= end_offset {
7586                return Ok(());
7587            }
7588
7589            // Decode unknown envelopes for gaps in ordinals.
7590            while _next_ordinal_to_read < 6 {
7591                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7592                _next_ordinal_to_read += 1;
7593                next_offset += envelope_size;
7594            }
7595
7596            let next_out_of_line = decoder.next_out_of_line();
7597            let handles_before = decoder.remaining_handles();
7598            if let Some((inlined, num_bytes, num_handles)) =
7599                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7600            {
7601                let member_inline_size =
7602                    <Theme as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7603                if inlined != (member_inline_size <= 4) {
7604                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7605                }
7606                let inner_offset;
7607                let mut inner_depth = depth.clone();
7608                if inlined {
7609                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7610                    inner_offset = next_offset;
7611                } else {
7612                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7613                    inner_depth.increment()?;
7614                }
7615                let val_ref = self.theme.get_or_insert_with(|| fidl::new_empty!(Theme, D));
7616                fidl::decode!(Theme, D, val_ref, decoder, inner_offset, inner_depth)?;
7617                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7618                {
7619                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7620                }
7621                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7622                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7623                }
7624            }
7625
7626            next_offset += envelope_size;
7627            _next_ordinal_to_read += 1;
7628            if next_offset >= end_offset {
7629                return Ok(());
7630            }
7631
7632            // Decode unknown envelopes for gaps in ordinals.
7633            while _next_ordinal_to_read < 7 {
7634                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7635                _next_ordinal_to_read += 1;
7636                next_offset += envelope_size;
7637            }
7638
7639            let next_out_of_line = decoder.next_out_of_line();
7640            let handles_before = decoder.remaining_handles();
7641            if let Some((inlined, num_bytes, num_handles)) =
7642                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7643            {
7644                let member_inline_size =
7645                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7646                if inlined != (member_inline_size <= 4) {
7647                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7648                }
7649                let inner_offset;
7650                let mut inner_depth = depth.clone();
7651                if inlined {
7652                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7653                    inner_offset = next_offset;
7654                } else {
7655                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7656                    inner_depth.increment()?;
7657                }
7658                let val_ref =
7659                    self.adjusted_auto_brightness.get_or_insert_with(|| fidl::new_empty!(f32, D));
7660                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
7661                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7662                {
7663                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7664                }
7665                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7666                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7667                }
7668            }
7669
7670            next_offset += envelope_size;
7671
7672            // Decode the remaining unknown envelopes.
7673            while next_offset < end_offset {
7674                _next_ordinal_to_read += 1;
7675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7676                next_offset += envelope_size;
7677            }
7678
7679            Ok(())
7680        }
7681    }
7682
7683    impl DoNotDisturbSettings {
7684        #[inline(always)]
7685        fn max_ordinal_present(&self) -> u64 {
7686            if let Some(_) = self.night_mode_initiated_do_not_disturb {
7687                return 2;
7688            }
7689            if let Some(_) = self.user_initiated_do_not_disturb {
7690                return 1;
7691            }
7692            0
7693        }
7694    }
7695
7696    impl fidl::encoding::ValueTypeMarker for DoNotDisturbSettings {
7697        type Borrowed<'a> = &'a Self;
7698        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7699            value
7700        }
7701    }
7702
7703    unsafe impl fidl::encoding::TypeMarker for DoNotDisturbSettings {
7704        type Owned = Self;
7705
7706        #[inline(always)]
7707        fn inline_align(_context: fidl::encoding::Context) -> usize {
7708            8
7709        }
7710
7711        #[inline(always)]
7712        fn inline_size(_context: fidl::encoding::Context) -> usize {
7713            16
7714        }
7715    }
7716
7717    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DoNotDisturbSettings, D>
7718        for &DoNotDisturbSettings
7719    {
7720        unsafe fn encode(
7721            self,
7722            encoder: &mut fidl::encoding::Encoder<'_, D>,
7723            offset: usize,
7724            mut depth: fidl::encoding::Depth,
7725        ) -> fidl::Result<()> {
7726            encoder.debug_check_bounds::<DoNotDisturbSettings>(offset);
7727            // Vector header
7728            let max_ordinal: u64 = self.max_ordinal_present();
7729            encoder.write_num(max_ordinal, offset);
7730            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7731            // Calling encoder.out_of_line_offset(0) is not allowed.
7732            if max_ordinal == 0 {
7733                return Ok(());
7734            }
7735            depth.increment()?;
7736            let envelope_size = 8;
7737            let bytes_len = max_ordinal as usize * envelope_size;
7738            #[allow(unused_variables)]
7739            let offset = encoder.out_of_line_offset(bytes_len);
7740            let mut _prev_end_offset: usize = 0;
7741            if 1 > max_ordinal {
7742                return Ok(());
7743            }
7744
7745            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7746            // are envelope_size bytes.
7747            let cur_offset: usize = (1 - 1) * envelope_size;
7748
7749            // Zero reserved fields.
7750            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7751
7752            // Safety:
7753            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7754            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7755            //   envelope_size bytes, there is always sufficient room.
7756            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7757                self.user_initiated_do_not_disturb
7758                    .as_ref()
7759                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7760                encoder,
7761                offset + cur_offset,
7762                depth,
7763            )?;
7764
7765            _prev_end_offset = cur_offset + envelope_size;
7766            if 2 > max_ordinal {
7767                return Ok(());
7768            }
7769
7770            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7771            // are envelope_size bytes.
7772            let cur_offset: usize = (2 - 1) * envelope_size;
7773
7774            // Zero reserved fields.
7775            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7776
7777            // Safety:
7778            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7779            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7780            //   envelope_size bytes, there is always sufficient room.
7781            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7782                self.night_mode_initiated_do_not_disturb
7783                    .as_ref()
7784                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7785                encoder,
7786                offset + cur_offset,
7787                depth,
7788            )?;
7789
7790            _prev_end_offset = cur_offset + envelope_size;
7791
7792            Ok(())
7793        }
7794    }
7795
7796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DoNotDisturbSettings {
7797        #[inline(always)]
7798        fn new_empty() -> Self {
7799            Self::default()
7800        }
7801
7802        unsafe fn decode(
7803            &mut self,
7804            decoder: &mut fidl::encoding::Decoder<'_, D>,
7805            offset: usize,
7806            mut depth: fidl::encoding::Depth,
7807        ) -> fidl::Result<()> {
7808            decoder.debug_check_bounds::<Self>(offset);
7809            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7810                None => return Err(fidl::Error::NotNullable),
7811                Some(len) => len,
7812            };
7813            // Calling decoder.out_of_line_offset(0) is not allowed.
7814            if len == 0 {
7815                return Ok(());
7816            };
7817            depth.increment()?;
7818            let envelope_size = 8;
7819            let bytes_len = len * envelope_size;
7820            let offset = decoder.out_of_line_offset(bytes_len)?;
7821            // Decode the envelope for each type.
7822            let mut _next_ordinal_to_read = 0;
7823            let mut next_offset = offset;
7824            let end_offset = offset + bytes_len;
7825            _next_ordinal_to_read += 1;
7826            if next_offset >= end_offset {
7827                return Ok(());
7828            }
7829
7830            // Decode unknown envelopes for gaps in ordinals.
7831            while _next_ordinal_to_read < 1 {
7832                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7833                _next_ordinal_to_read += 1;
7834                next_offset += envelope_size;
7835            }
7836
7837            let next_out_of_line = decoder.next_out_of_line();
7838            let handles_before = decoder.remaining_handles();
7839            if let Some((inlined, num_bytes, num_handles)) =
7840                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7841            {
7842                let member_inline_size =
7843                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7844                if inlined != (member_inline_size <= 4) {
7845                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7846                }
7847                let inner_offset;
7848                let mut inner_depth = depth.clone();
7849                if inlined {
7850                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7851                    inner_offset = next_offset;
7852                } else {
7853                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7854                    inner_depth.increment()?;
7855                }
7856                let val_ref = self
7857                    .user_initiated_do_not_disturb
7858                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
7859                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7860                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7861                {
7862                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7863                }
7864                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7865                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7866                }
7867            }
7868
7869            next_offset += envelope_size;
7870            _next_ordinal_to_read += 1;
7871            if next_offset >= end_offset {
7872                return Ok(());
7873            }
7874
7875            // Decode unknown envelopes for gaps in ordinals.
7876            while _next_ordinal_to_read < 2 {
7877                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7878                _next_ordinal_to_read += 1;
7879                next_offset += envelope_size;
7880            }
7881
7882            let next_out_of_line = decoder.next_out_of_line();
7883            let handles_before = decoder.remaining_handles();
7884            if let Some((inlined, num_bytes, num_handles)) =
7885                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7886            {
7887                let member_inline_size =
7888                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7889                if inlined != (member_inline_size <= 4) {
7890                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7891                }
7892                let inner_offset;
7893                let mut inner_depth = depth.clone();
7894                if inlined {
7895                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7896                    inner_offset = next_offset;
7897                } else {
7898                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7899                    inner_depth.increment()?;
7900                }
7901                let val_ref = self
7902                    .night_mode_initiated_do_not_disturb
7903                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
7904                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7905                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7906                {
7907                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7908                }
7909                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7910                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7911                }
7912            }
7913
7914            next_offset += envelope_size;
7915
7916            // Decode the remaining unknown envelopes.
7917            while next_offset < end_offset {
7918                _next_ordinal_to_read += 1;
7919                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7920                next_offset += envelope_size;
7921            }
7922
7923            Ok(())
7924        }
7925    }
7926
7927    impl FactoryResetSettings {
7928        #[inline(always)]
7929        fn max_ordinal_present(&self) -> u64 {
7930            if let Some(_) = self.is_local_reset_allowed {
7931                return 1;
7932            }
7933            0
7934        }
7935    }
7936
7937    impl fidl::encoding::ValueTypeMarker for FactoryResetSettings {
7938        type Borrowed<'a> = &'a Self;
7939        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7940            value
7941        }
7942    }
7943
7944    unsafe impl fidl::encoding::TypeMarker for FactoryResetSettings {
7945        type Owned = Self;
7946
7947        #[inline(always)]
7948        fn inline_align(_context: fidl::encoding::Context) -> usize {
7949            8
7950        }
7951
7952        #[inline(always)]
7953        fn inline_size(_context: fidl::encoding::Context) -> usize {
7954            16
7955        }
7956    }
7957
7958    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FactoryResetSettings, D>
7959        for &FactoryResetSettings
7960    {
7961        unsafe fn encode(
7962            self,
7963            encoder: &mut fidl::encoding::Encoder<'_, D>,
7964            offset: usize,
7965            mut depth: fidl::encoding::Depth,
7966        ) -> fidl::Result<()> {
7967            encoder.debug_check_bounds::<FactoryResetSettings>(offset);
7968            // Vector header
7969            let max_ordinal: u64 = self.max_ordinal_present();
7970            encoder.write_num(max_ordinal, offset);
7971            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7972            // Calling encoder.out_of_line_offset(0) is not allowed.
7973            if max_ordinal == 0 {
7974                return Ok(());
7975            }
7976            depth.increment()?;
7977            let envelope_size = 8;
7978            let bytes_len = max_ordinal as usize * envelope_size;
7979            #[allow(unused_variables)]
7980            let offset = encoder.out_of_line_offset(bytes_len);
7981            let mut _prev_end_offset: usize = 0;
7982            if 1 > max_ordinal {
7983                return Ok(());
7984            }
7985
7986            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7987            // are envelope_size bytes.
7988            let cur_offset: usize = (1 - 1) * envelope_size;
7989
7990            // Zero reserved fields.
7991            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7992
7993            // Safety:
7994            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7995            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7996            //   envelope_size bytes, there is always sufficient room.
7997            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7998                self.is_local_reset_allowed
7999                    .as_ref()
8000                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
8001                encoder,
8002                offset + cur_offset,
8003                depth,
8004            )?;
8005
8006            _prev_end_offset = cur_offset + envelope_size;
8007
8008            Ok(())
8009        }
8010    }
8011
8012    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FactoryResetSettings {
8013        #[inline(always)]
8014        fn new_empty() -> Self {
8015            Self::default()
8016        }
8017
8018        unsafe fn decode(
8019            &mut self,
8020            decoder: &mut fidl::encoding::Decoder<'_, D>,
8021            offset: usize,
8022            mut depth: fidl::encoding::Depth,
8023        ) -> fidl::Result<()> {
8024            decoder.debug_check_bounds::<Self>(offset);
8025            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8026                None => return Err(fidl::Error::NotNullable),
8027                Some(len) => len,
8028            };
8029            // Calling decoder.out_of_line_offset(0) is not allowed.
8030            if len == 0 {
8031                return Ok(());
8032            };
8033            depth.increment()?;
8034            let envelope_size = 8;
8035            let bytes_len = len * envelope_size;
8036            let offset = decoder.out_of_line_offset(bytes_len)?;
8037            // Decode the envelope for each type.
8038            let mut _next_ordinal_to_read = 0;
8039            let mut next_offset = offset;
8040            let end_offset = offset + bytes_len;
8041            _next_ordinal_to_read += 1;
8042            if next_offset >= end_offset {
8043                return Ok(());
8044            }
8045
8046            // Decode unknown envelopes for gaps in ordinals.
8047            while _next_ordinal_to_read < 1 {
8048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8049                _next_ordinal_to_read += 1;
8050                next_offset += envelope_size;
8051            }
8052
8053            let next_out_of_line = decoder.next_out_of_line();
8054            let handles_before = decoder.remaining_handles();
8055            if let Some((inlined, num_bytes, num_handles)) =
8056                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8057            {
8058                let member_inline_size =
8059                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8060                if inlined != (member_inline_size <= 4) {
8061                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8062                }
8063                let inner_offset;
8064                let mut inner_depth = depth.clone();
8065                if inlined {
8066                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8067                    inner_offset = next_offset;
8068                } else {
8069                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8070                    inner_depth.increment()?;
8071                }
8072                let val_ref =
8073                    self.is_local_reset_allowed.get_or_insert_with(|| fidl::new_empty!(bool, D));
8074                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8075                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8076                {
8077                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8078                }
8079                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8080                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8081                }
8082            }
8083
8084            next_offset += envelope_size;
8085
8086            // Decode the remaining unknown envelopes.
8087            while next_offset < end_offset {
8088                _next_ordinal_to_read += 1;
8089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8090                next_offset += envelope_size;
8091            }
8092
8093            Ok(())
8094        }
8095    }
8096
8097    impl InputDevice {
8098        #[inline(always)]
8099        fn max_ordinal_present(&self) -> u64 {
8100            if let Some(_) = self.state {
8101                return 5;
8102            }
8103            if let Some(_) = self.mutable_toggle_state {
8104                return 4;
8105            }
8106            if let Some(_) = self.source_states {
8107                return 3;
8108            }
8109            if let Some(_) = self.device_type {
8110                return 2;
8111            }
8112            if let Some(_) = self.device_name {
8113                return 1;
8114            }
8115            0
8116        }
8117    }
8118
8119    impl fidl::encoding::ValueTypeMarker for InputDevice {
8120        type Borrowed<'a> = &'a Self;
8121        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8122            value
8123        }
8124    }
8125
8126    unsafe impl fidl::encoding::TypeMarker for InputDevice {
8127        type Owned = Self;
8128
8129        #[inline(always)]
8130        fn inline_align(_context: fidl::encoding::Context) -> usize {
8131            8
8132        }
8133
8134        #[inline(always)]
8135        fn inline_size(_context: fidl::encoding::Context) -> usize {
8136            16
8137        }
8138    }
8139
8140    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputDevice, D>
8141        for &InputDevice
8142    {
8143        unsafe fn encode(
8144            self,
8145            encoder: &mut fidl::encoding::Encoder<'_, D>,
8146            offset: usize,
8147            mut depth: fidl::encoding::Depth,
8148        ) -> fidl::Result<()> {
8149            encoder.debug_check_bounds::<InputDevice>(offset);
8150            // Vector header
8151            let max_ordinal: u64 = self.max_ordinal_present();
8152            encoder.write_num(max_ordinal, offset);
8153            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8154            // Calling encoder.out_of_line_offset(0) is not allowed.
8155            if max_ordinal == 0 {
8156                return Ok(());
8157            }
8158            depth.increment()?;
8159            let envelope_size = 8;
8160            let bytes_len = max_ordinal as usize * envelope_size;
8161            #[allow(unused_variables)]
8162            let offset = encoder.out_of_line_offset(bytes_len);
8163            let mut _prev_end_offset: usize = 0;
8164            if 1 > max_ordinal {
8165                return Ok(());
8166            }
8167
8168            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8169            // are envelope_size bytes.
8170            let cur_offset: usize = (1 - 1) * envelope_size;
8171
8172            // Zero reserved fields.
8173            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8174
8175            // Safety:
8176            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8177            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8178            //   envelope_size bytes, there is always sufficient room.
8179            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
8180                self.device_name.as_ref().map(
8181                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
8182                ),
8183                encoder,
8184                offset + cur_offset,
8185                depth,
8186            )?;
8187
8188            _prev_end_offset = cur_offset + envelope_size;
8189            if 2 > max_ordinal {
8190                return Ok(());
8191            }
8192
8193            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8194            // are envelope_size bytes.
8195            let cur_offset: usize = (2 - 1) * envelope_size;
8196
8197            // Zero reserved fields.
8198            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8199
8200            // Safety:
8201            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8202            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8203            //   envelope_size bytes, there is always sufficient room.
8204            fidl::encoding::encode_in_envelope_optional::<DeviceType, D>(
8205                self.device_type
8206                    .as_ref()
8207                    .map(<DeviceType as fidl::encoding::ValueTypeMarker>::borrow),
8208                encoder,
8209                offset + cur_offset,
8210                depth,
8211            )?;
8212
8213            _prev_end_offset = cur_offset + envelope_size;
8214            if 3 > max_ordinal {
8215                return Ok(());
8216            }
8217
8218            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8219            // are envelope_size bytes.
8220            let cur_offset: usize = (3 - 1) * envelope_size;
8221
8222            // Zero reserved fields.
8223            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8224
8225            // Safety:
8226            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8227            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8228            //   envelope_size bytes, there is always sufficient room.
8229            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<SourceState>, D>(
8230            self.source_states.as_ref().map(<fidl::encoding::UnboundedVector<SourceState> as fidl::encoding::ValueTypeMarker>::borrow),
8231            encoder, offset + cur_offset, depth
8232        )?;
8233
8234            _prev_end_offset = cur_offset + envelope_size;
8235            if 4 > max_ordinal {
8236                return Ok(());
8237            }
8238
8239            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8240            // are envelope_size bytes.
8241            let cur_offset: usize = (4 - 1) * envelope_size;
8242
8243            // Zero reserved fields.
8244            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8245
8246            // Safety:
8247            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8248            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8249            //   envelope_size bytes, there is always sufficient room.
8250            fidl::encoding::encode_in_envelope_optional::<ToggleStateFlags, D>(
8251                self.mutable_toggle_state
8252                    .as_ref()
8253                    .map(<ToggleStateFlags as fidl::encoding::ValueTypeMarker>::borrow),
8254                encoder,
8255                offset + cur_offset,
8256                depth,
8257            )?;
8258
8259            _prev_end_offset = cur_offset + envelope_size;
8260            if 5 > max_ordinal {
8261                return Ok(());
8262            }
8263
8264            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8265            // are envelope_size bytes.
8266            let cur_offset: usize = (5 - 1) * envelope_size;
8267
8268            // Zero reserved fields.
8269            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8270
8271            // Safety:
8272            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8273            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8274            //   envelope_size bytes, there is always sufficient room.
8275            fidl::encoding::encode_in_envelope_optional::<DeviceState, D>(
8276                self.state.as_ref().map(<DeviceState as fidl::encoding::ValueTypeMarker>::borrow),
8277                encoder,
8278                offset + cur_offset,
8279                depth,
8280            )?;
8281
8282            _prev_end_offset = cur_offset + envelope_size;
8283
8284            Ok(())
8285        }
8286    }
8287
8288    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputDevice {
8289        #[inline(always)]
8290        fn new_empty() -> Self {
8291            Self::default()
8292        }
8293
8294        unsafe fn decode(
8295            &mut self,
8296            decoder: &mut fidl::encoding::Decoder<'_, D>,
8297            offset: usize,
8298            mut depth: fidl::encoding::Depth,
8299        ) -> fidl::Result<()> {
8300            decoder.debug_check_bounds::<Self>(offset);
8301            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8302                None => return Err(fidl::Error::NotNullable),
8303                Some(len) => len,
8304            };
8305            // Calling decoder.out_of_line_offset(0) is not allowed.
8306            if len == 0 {
8307                return Ok(());
8308            };
8309            depth.increment()?;
8310            let envelope_size = 8;
8311            let bytes_len = len * envelope_size;
8312            let offset = decoder.out_of_line_offset(bytes_len)?;
8313            // Decode the envelope for each type.
8314            let mut _next_ordinal_to_read = 0;
8315            let mut next_offset = offset;
8316            let end_offset = offset + bytes_len;
8317            _next_ordinal_to_read += 1;
8318            if next_offset >= end_offset {
8319                return Ok(());
8320            }
8321
8322            // Decode unknown envelopes for gaps in ordinals.
8323            while _next_ordinal_to_read < 1 {
8324                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8325                _next_ordinal_to_read += 1;
8326                next_offset += envelope_size;
8327            }
8328
8329            let next_out_of_line = decoder.next_out_of_line();
8330            let handles_before = decoder.remaining_handles();
8331            if let Some((inlined, num_bytes, num_handles)) =
8332                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8333            {
8334                let member_inline_size =
8335                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
8336                        decoder.context,
8337                    );
8338                if inlined != (member_inline_size <= 4) {
8339                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8340                }
8341                let inner_offset;
8342                let mut inner_depth = depth.clone();
8343                if inlined {
8344                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8345                    inner_offset = next_offset;
8346                } else {
8347                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8348                    inner_depth.increment()?;
8349                }
8350                let val_ref = self
8351                    .device_name
8352                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
8353                fidl::decode!(
8354                    fidl::encoding::UnboundedString,
8355                    D,
8356                    val_ref,
8357                    decoder,
8358                    inner_offset,
8359                    inner_depth
8360                )?;
8361                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8362                {
8363                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8364                }
8365                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8366                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8367                }
8368            }
8369
8370            next_offset += envelope_size;
8371            _next_ordinal_to_read += 1;
8372            if next_offset >= end_offset {
8373                return Ok(());
8374            }
8375
8376            // Decode unknown envelopes for gaps in ordinals.
8377            while _next_ordinal_to_read < 2 {
8378                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8379                _next_ordinal_to_read += 1;
8380                next_offset += envelope_size;
8381            }
8382
8383            let next_out_of_line = decoder.next_out_of_line();
8384            let handles_before = decoder.remaining_handles();
8385            if let Some((inlined, num_bytes, num_handles)) =
8386                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8387            {
8388                let member_inline_size =
8389                    <DeviceType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8390                if inlined != (member_inline_size <= 4) {
8391                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8392                }
8393                let inner_offset;
8394                let mut inner_depth = depth.clone();
8395                if inlined {
8396                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8397                    inner_offset = next_offset;
8398                } else {
8399                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8400                    inner_depth.increment()?;
8401                }
8402                let val_ref =
8403                    self.device_type.get_or_insert_with(|| fidl::new_empty!(DeviceType, D));
8404                fidl::decode!(DeviceType, D, val_ref, decoder, inner_offset, inner_depth)?;
8405                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8406                {
8407                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8408                }
8409                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8410                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8411                }
8412            }
8413
8414            next_offset += envelope_size;
8415            _next_ordinal_to_read += 1;
8416            if next_offset >= end_offset {
8417                return Ok(());
8418            }
8419
8420            // Decode unknown envelopes for gaps in ordinals.
8421            while _next_ordinal_to_read < 3 {
8422                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8423                _next_ordinal_to_read += 1;
8424                next_offset += envelope_size;
8425            }
8426
8427            let next_out_of_line = decoder.next_out_of_line();
8428            let handles_before = decoder.remaining_handles();
8429            if let Some((inlined, num_bytes, num_handles)) =
8430                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8431            {
8432                let member_inline_size = <fidl::encoding::UnboundedVector<SourceState> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8433                if inlined != (member_inline_size <= 4) {
8434                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8435                }
8436                let inner_offset;
8437                let mut inner_depth = depth.clone();
8438                if inlined {
8439                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8440                    inner_offset = next_offset;
8441                } else {
8442                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8443                    inner_depth.increment()?;
8444                }
8445                let val_ref = self.source_states.get_or_insert_with(|| {
8446                    fidl::new_empty!(fidl::encoding::UnboundedVector<SourceState>, D)
8447                });
8448                fidl::decode!(
8449                    fidl::encoding::UnboundedVector<SourceState>,
8450                    D,
8451                    val_ref,
8452                    decoder,
8453                    inner_offset,
8454                    inner_depth
8455                )?;
8456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8457                {
8458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8459                }
8460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8462                }
8463            }
8464
8465            next_offset += envelope_size;
8466            _next_ordinal_to_read += 1;
8467            if next_offset >= end_offset {
8468                return Ok(());
8469            }
8470
8471            // Decode unknown envelopes for gaps in ordinals.
8472            while _next_ordinal_to_read < 4 {
8473                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8474                _next_ordinal_to_read += 1;
8475                next_offset += envelope_size;
8476            }
8477
8478            let next_out_of_line = decoder.next_out_of_line();
8479            let handles_before = decoder.remaining_handles();
8480            if let Some((inlined, num_bytes, num_handles)) =
8481                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8482            {
8483                let member_inline_size =
8484                    <ToggleStateFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8485                if inlined != (member_inline_size <= 4) {
8486                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8487                }
8488                let inner_offset;
8489                let mut inner_depth = depth.clone();
8490                if inlined {
8491                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8492                    inner_offset = next_offset;
8493                } else {
8494                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8495                    inner_depth.increment()?;
8496                }
8497                let val_ref = self
8498                    .mutable_toggle_state
8499                    .get_or_insert_with(|| fidl::new_empty!(ToggleStateFlags, D));
8500                fidl::decode!(ToggleStateFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
8501                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8502                {
8503                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8504                }
8505                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8506                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8507                }
8508            }
8509
8510            next_offset += envelope_size;
8511            _next_ordinal_to_read += 1;
8512            if next_offset >= end_offset {
8513                return Ok(());
8514            }
8515
8516            // Decode unknown envelopes for gaps in ordinals.
8517            while _next_ordinal_to_read < 5 {
8518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8519                _next_ordinal_to_read += 1;
8520                next_offset += envelope_size;
8521            }
8522
8523            let next_out_of_line = decoder.next_out_of_line();
8524            let handles_before = decoder.remaining_handles();
8525            if let Some((inlined, num_bytes, num_handles)) =
8526                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8527            {
8528                let member_inline_size =
8529                    <DeviceState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8530                if inlined != (member_inline_size <= 4) {
8531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8532                }
8533                let inner_offset;
8534                let mut inner_depth = depth.clone();
8535                if inlined {
8536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8537                    inner_offset = next_offset;
8538                } else {
8539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8540                    inner_depth.increment()?;
8541                }
8542                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(DeviceState, D));
8543                fidl::decode!(DeviceState, D, val_ref, decoder, inner_offset, inner_depth)?;
8544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8545                {
8546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8547                }
8548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8550                }
8551            }
8552
8553            next_offset += envelope_size;
8554
8555            // Decode the remaining unknown envelopes.
8556            while next_offset < end_offset {
8557                _next_ordinal_to_read += 1;
8558                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8559                next_offset += envelope_size;
8560            }
8561
8562            Ok(())
8563        }
8564    }
8565
8566    impl InputSettings {
8567        #[inline(always)]
8568        fn max_ordinal_present(&self) -> u64 {
8569            if let Some(_) = self.devices {
8570                return 1;
8571            }
8572            0
8573        }
8574    }
8575
8576    impl fidl::encoding::ValueTypeMarker for InputSettings {
8577        type Borrowed<'a> = &'a Self;
8578        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8579            value
8580        }
8581    }
8582
8583    unsafe impl fidl::encoding::TypeMarker for InputSettings {
8584        type Owned = Self;
8585
8586        #[inline(always)]
8587        fn inline_align(_context: fidl::encoding::Context) -> usize {
8588            8
8589        }
8590
8591        #[inline(always)]
8592        fn inline_size(_context: fidl::encoding::Context) -> usize {
8593            16
8594        }
8595    }
8596
8597    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputSettings, D>
8598        for &InputSettings
8599    {
8600        unsafe fn encode(
8601            self,
8602            encoder: &mut fidl::encoding::Encoder<'_, D>,
8603            offset: usize,
8604            mut depth: fidl::encoding::Depth,
8605        ) -> fidl::Result<()> {
8606            encoder.debug_check_bounds::<InputSettings>(offset);
8607            // Vector header
8608            let max_ordinal: u64 = self.max_ordinal_present();
8609            encoder.write_num(max_ordinal, offset);
8610            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8611            // Calling encoder.out_of_line_offset(0) is not allowed.
8612            if max_ordinal == 0 {
8613                return Ok(());
8614            }
8615            depth.increment()?;
8616            let envelope_size = 8;
8617            let bytes_len = max_ordinal as usize * envelope_size;
8618            #[allow(unused_variables)]
8619            let offset = encoder.out_of_line_offset(bytes_len);
8620            let mut _prev_end_offset: usize = 0;
8621            if 1 > max_ordinal {
8622                return Ok(());
8623            }
8624
8625            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8626            // are envelope_size bytes.
8627            let cur_offset: usize = (1 - 1) * envelope_size;
8628
8629            // Zero reserved fields.
8630            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8631
8632            // Safety:
8633            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8634            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8635            //   envelope_size bytes, there is always sufficient room.
8636            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<InputDevice>, D>(
8637            self.devices.as_ref().map(<fidl::encoding::UnboundedVector<InputDevice> as fidl::encoding::ValueTypeMarker>::borrow),
8638            encoder, offset + cur_offset, depth
8639        )?;
8640
8641            _prev_end_offset = cur_offset + envelope_size;
8642
8643            Ok(())
8644        }
8645    }
8646
8647    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputSettings {
8648        #[inline(always)]
8649        fn new_empty() -> Self {
8650            Self::default()
8651        }
8652
8653        unsafe fn decode(
8654            &mut self,
8655            decoder: &mut fidl::encoding::Decoder<'_, D>,
8656            offset: usize,
8657            mut depth: fidl::encoding::Depth,
8658        ) -> fidl::Result<()> {
8659            decoder.debug_check_bounds::<Self>(offset);
8660            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8661                None => return Err(fidl::Error::NotNullable),
8662                Some(len) => len,
8663            };
8664            // Calling decoder.out_of_line_offset(0) is not allowed.
8665            if len == 0 {
8666                return Ok(());
8667            };
8668            depth.increment()?;
8669            let envelope_size = 8;
8670            let bytes_len = len * envelope_size;
8671            let offset = decoder.out_of_line_offset(bytes_len)?;
8672            // Decode the envelope for each type.
8673            let mut _next_ordinal_to_read = 0;
8674            let mut next_offset = offset;
8675            let end_offset = offset + bytes_len;
8676            _next_ordinal_to_read += 1;
8677            if next_offset >= end_offset {
8678                return Ok(());
8679            }
8680
8681            // Decode unknown envelopes for gaps in ordinals.
8682            while _next_ordinal_to_read < 1 {
8683                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8684                _next_ordinal_to_read += 1;
8685                next_offset += envelope_size;
8686            }
8687
8688            let next_out_of_line = decoder.next_out_of_line();
8689            let handles_before = decoder.remaining_handles();
8690            if let Some((inlined, num_bytes, num_handles)) =
8691                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8692            {
8693                let member_inline_size = <fidl::encoding::UnboundedVector<InputDevice> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8694                if inlined != (member_inline_size <= 4) {
8695                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8696                }
8697                let inner_offset;
8698                let mut inner_depth = depth.clone();
8699                if inlined {
8700                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8701                    inner_offset = next_offset;
8702                } else {
8703                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8704                    inner_depth.increment()?;
8705                }
8706                let val_ref = self.devices.get_or_insert_with(|| {
8707                    fidl::new_empty!(fidl::encoding::UnboundedVector<InputDevice>, D)
8708                });
8709                fidl::decode!(
8710                    fidl::encoding::UnboundedVector<InputDevice>,
8711                    D,
8712                    val_ref,
8713                    decoder,
8714                    inner_offset,
8715                    inner_depth
8716                )?;
8717                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8718                {
8719                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8720                }
8721                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8722                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8723                }
8724            }
8725
8726            next_offset += envelope_size;
8727
8728            // Decode the remaining unknown envelopes.
8729            while next_offset < end_offset {
8730                _next_ordinal_to_read += 1;
8731                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8732                next_offset += envelope_size;
8733            }
8734
8735            Ok(())
8736        }
8737    }
8738
8739    impl InputState {
8740        #[inline(always)]
8741        fn max_ordinal_present(&self) -> u64 {
8742            if let Some(_) = self.state {
8743                return 3;
8744            }
8745            if let Some(_) = self.device_type {
8746                return 2;
8747            }
8748            if let Some(_) = self.name {
8749                return 1;
8750            }
8751            0
8752        }
8753    }
8754
8755    impl fidl::encoding::ValueTypeMarker for InputState {
8756        type Borrowed<'a> = &'a Self;
8757        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8758            value
8759        }
8760    }
8761
8762    unsafe impl fidl::encoding::TypeMarker for InputState {
8763        type Owned = Self;
8764
8765        #[inline(always)]
8766        fn inline_align(_context: fidl::encoding::Context) -> usize {
8767            8
8768        }
8769
8770        #[inline(always)]
8771        fn inline_size(_context: fidl::encoding::Context) -> usize {
8772            16
8773        }
8774    }
8775
8776    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputState, D>
8777        for &InputState
8778    {
8779        unsafe fn encode(
8780            self,
8781            encoder: &mut fidl::encoding::Encoder<'_, D>,
8782            offset: usize,
8783            mut depth: fidl::encoding::Depth,
8784        ) -> fidl::Result<()> {
8785            encoder.debug_check_bounds::<InputState>(offset);
8786            // Vector header
8787            let max_ordinal: u64 = self.max_ordinal_present();
8788            encoder.write_num(max_ordinal, offset);
8789            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8790            // Calling encoder.out_of_line_offset(0) is not allowed.
8791            if max_ordinal == 0 {
8792                return Ok(());
8793            }
8794            depth.increment()?;
8795            let envelope_size = 8;
8796            let bytes_len = max_ordinal as usize * envelope_size;
8797            #[allow(unused_variables)]
8798            let offset = encoder.out_of_line_offset(bytes_len);
8799            let mut _prev_end_offset: usize = 0;
8800            if 1 > max_ordinal {
8801                return Ok(());
8802            }
8803
8804            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8805            // are envelope_size bytes.
8806            let cur_offset: usize = (1 - 1) * envelope_size;
8807
8808            // Zero reserved fields.
8809            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8810
8811            // Safety:
8812            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8813            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8814            //   envelope_size bytes, there is always sufficient room.
8815            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
8816                self.name.as_ref().map(
8817                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
8818                ),
8819                encoder,
8820                offset + cur_offset,
8821                depth,
8822            )?;
8823
8824            _prev_end_offset = cur_offset + envelope_size;
8825            if 2 > max_ordinal {
8826                return Ok(());
8827            }
8828
8829            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8830            // are envelope_size bytes.
8831            let cur_offset: usize = (2 - 1) * envelope_size;
8832
8833            // Zero reserved fields.
8834            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8835
8836            // Safety:
8837            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8838            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8839            //   envelope_size bytes, there is always sufficient room.
8840            fidl::encoding::encode_in_envelope_optional::<DeviceType, D>(
8841                self.device_type
8842                    .as_ref()
8843                    .map(<DeviceType as fidl::encoding::ValueTypeMarker>::borrow),
8844                encoder,
8845                offset + cur_offset,
8846                depth,
8847            )?;
8848
8849            _prev_end_offset = cur_offset + envelope_size;
8850            if 3 > max_ordinal {
8851                return Ok(());
8852            }
8853
8854            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8855            // are envelope_size bytes.
8856            let cur_offset: usize = (3 - 1) * envelope_size;
8857
8858            // Zero reserved fields.
8859            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8860
8861            // Safety:
8862            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8863            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8864            //   envelope_size bytes, there is always sufficient room.
8865            fidl::encoding::encode_in_envelope_optional::<DeviceState, D>(
8866                self.state.as_ref().map(<DeviceState as fidl::encoding::ValueTypeMarker>::borrow),
8867                encoder,
8868                offset + cur_offset,
8869                depth,
8870            )?;
8871
8872            _prev_end_offset = cur_offset + envelope_size;
8873
8874            Ok(())
8875        }
8876    }
8877
8878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputState {
8879        #[inline(always)]
8880        fn new_empty() -> Self {
8881            Self::default()
8882        }
8883
8884        unsafe fn decode(
8885            &mut self,
8886            decoder: &mut fidl::encoding::Decoder<'_, D>,
8887            offset: usize,
8888            mut depth: fidl::encoding::Depth,
8889        ) -> fidl::Result<()> {
8890            decoder.debug_check_bounds::<Self>(offset);
8891            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8892                None => return Err(fidl::Error::NotNullable),
8893                Some(len) => len,
8894            };
8895            // Calling decoder.out_of_line_offset(0) is not allowed.
8896            if len == 0 {
8897                return Ok(());
8898            };
8899            depth.increment()?;
8900            let envelope_size = 8;
8901            let bytes_len = len * envelope_size;
8902            let offset = decoder.out_of_line_offset(bytes_len)?;
8903            // Decode the envelope for each type.
8904            let mut _next_ordinal_to_read = 0;
8905            let mut next_offset = offset;
8906            let end_offset = offset + bytes_len;
8907            _next_ordinal_to_read += 1;
8908            if next_offset >= end_offset {
8909                return Ok(());
8910            }
8911
8912            // Decode unknown envelopes for gaps in ordinals.
8913            while _next_ordinal_to_read < 1 {
8914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8915                _next_ordinal_to_read += 1;
8916                next_offset += envelope_size;
8917            }
8918
8919            let next_out_of_line = decoder.next_out_of_line();
8920            let handles_before = decoder.remaining_handles();
8921            if let Some((inlined, num_bytes, num_handles)) =
8922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8923            {
8924                let member_inline_size =
8925                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
8926                        decoder.context,
8927                    );
8928                if inlined != (member_inline_size <= 4) {
8929                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8930                }
8931                let inner_offset;
8932                let mut inner_depth = depth.clone();
8933                if inlined {
8934                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8935                    inner_offset = next_offset;
8936                } else {
8937                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8938                    inner_depth.increment()?;
8939                }
8940                let val_ref = self
8941                    .name
8942                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
8943                fidl::decode!(
8944                    fidl::encoding::UnboundedString,
8945                    D,
8946                    val_ref,
8947                    decoder,
8948                    inner_offset,
8949                    inner_depth
8950                )?;
8951                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8952                {
8953                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8954                }
8955                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8956                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8957                }
8958            }
8959
8960            next_offset += envelope_size;
8961            _next_ordinal_to_read += 1;
8962            if next_offset >= end_offset {
8963                return Ok(());
8964            }
8965
8966            // Decode unknown envelopes for gaps in ordinals.
8967            while _next_ordinal_to_read < 2 {
8968                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8969                _next_ordinal_to_read += 1;
8970                next_offset += envelope_size;
8971            }
8972
8973            let next_out_of_line = decoder.next_out_of_line();
8974            let handles_before = decoder.remaining_handles();
8975            if let Some((inlined, num_bytes, num_handles)) =
8976                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8977            {
8978                let member_inline_size =
8979                    <DeviceType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8980                if inlined != (member_inline_size <= 4) {
8981                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8982                }
8983                let inner_offset;
8984                let mut inner_depth = depth.clone();
8985                if inlined {
8986                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8987                    inner_offset = next_offset;
8988                } else {
8989                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8990                    inner_depth.increment()?;
8991                }
8992                let val_ref =
8993                    self.device_type.get_or_insert_with(|| fidl::new_empty!(DeviceType, D));
8994                fidl::decode!(DeviceType, D, val_ref, decoder, inner_offset, inner_depth)?;
8995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8996                {
8997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8998                }
8999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9001                }
9002            }
9003
9004            next_offset += envelope_size;
9005            _next_ordinal_to_read += 1;
9006            if next_offset >= end_offset {
9007                return Ok(());
9008            }
9009
9010            // Decode unknown envelopes for gaps in ordinals.
9011            while _next_ordinal_to_read < 3 {
9012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9013                _next_ordinal_to_read += 1;
9014                next_offset += envelope_size;
9015            }
9016
9017            let next_out_of_line = decoder.next_out_of_line();
9018            let handles_before = decoder.remaining_handles();
9019            if let Some((inlined, num_bytes, num_handles)) =
9020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9021            {
9022                let member_inline_size =
9023                    <DeviceState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9024                if inlined != (member_inline_size <= 4) {
9025                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9026                }
9027                let inner_offset;
9028                let mut inner_depth = depth.clone();
9029                if inlined {
9030                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9031                    inner_offset = next_offset;
9032                } else {
9033                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9034                    inner_depth.increment()?;
9035                }
9036                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(DeviceState, D));
9037                fidl::decode!(DeviceState, D, val_ref, decoder, inner_offset, inner_depth)?;
9038                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9039                {
9040                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9041                }
9042                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9043                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9044                }
9045            }
9046
9047            next_offset += envelope_size;
9048
9049            // Decode the remaining unknown envelopes.
9050            while next_offset < end_offset {
9051                _next_ordinal_to_read += 1;
9052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9053                next_offset += envelope_size;
9054            }
9055
9056            Ok(())
9057        }
9058    }
9059
9060    impl IntlSettings {
9061        #[inline(always)]
9062        fn max_ordinal_present(&self) -> u64 {
9063            if let Some(_) = self.hour_cycle {
9064                return 4;
9065            }
9066            if let Some(_) = self.time_zone_id {
9067                return 3;
9068            }
9069            if let Some(_) = self.temperature_unit {
9070                return 2;
9071            }
9072            if let Some(_) = self.locales {
9073                return 1;
9074            }
9075            0
9076        }
9077    }
9078
9079    impl fidl::encoding::ValueTypeMarker for IntlSettings {
9080        type Borrowed<'a> = &'a Self;
9081        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9082            value
9083        }
9084    }
9085
9086    unsafe impl fidl::encoding::TypeMarker for IntlSettings {
9087        type Owned = Self;
9088
9089        #[inline(always)]
9090        fn inline_align(_context: fidl::encoding::Context) -> usize {
9091            8
9092        }
9093
9094        #[inline(always)]
9095        fn inline_size(_context: fidl::encoding::Context) -> usize {
9096            16
9097        }
9098    }
9099
9100    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IntlSettings, D>
9101        for &IntlSettings
9102    {
9103        unsafe fn encode(
9104            self,
9105            encoder: &mut fidl::encoding::Encoder<'_, D>,
9106            offset: usize,
9107            mut depth: fidl::encoding::Depth,
9108        ) -> fidl::Result<()> {
9109            encoder.debug_check_bounds::<IntlSettings>(offset);
9110            // Vector header
9111            let max_ordinal: u64 = self.max_ordinal_present();
9112            encoder.write_num(max_ordinal, offset);
9113            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9114            // Calling encoder.out_of_line_offset(0) is not allowed.
9115            if max_ordinal == 0 {
9116                return Ok(());
9117            }
9118            depth.increment()?;
9119            let envelope_size = 8;
9120            let bytes_len = max_ordinal as usize * envelope_size;
9121            #[allow(unused_variables)]
9122            let offset = encoder.out_of_line_offset(bytes_len);
9123            let mut _prev_end_offset: usize = 0;
9124            if 1 > max_ordinal {
9125                return Ok(());
9126            }
9127
9128            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9129            // are envelope_size bytes.
9130            let cur_offset: usize = (1 - 1) * envelope_size;
9131
9132            // Zero reserved fields.
9133            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9134
9135            // Safety:
9136            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9137            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9138            //   envelope_size bytes, there is always sufficient room.
9139            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 10>, D>(
9140            self.locales.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 10> as fidl::encoding::ValueTypeMarker>::borrow),
9141            encoder, offset + cur_offset, depth
9142        )?;
9143
9144            _prev_end_offset = cur_offset + envelope_size;
9145            if 2 > max_ordinal {
9146                return Ok(());
9147            }
9148
9149            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9150            // are envelope_size bytes.
9151            let cur_offset: usize = (2 - 1) * envelope_size;
9152
9153            // Zero reserved fields.
9154            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9155
9156            // Safety:
9157            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9158            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9159            //   envelope_size bytes, there is always sufficient room.
9160            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_intl::TemperatureUnit, D>(
9161                self.temperature_unit.as_ref().map(
9162                    <fidl_fuchsia_intl::TemperatureUnit as fidl::encoding::ValueTypeMarker>::borrow,
9163                ),
9164                encoder,
9165                offset + cur_offset,
9166                depth,
9167            )?;
9168
9169            _prev_end_offset = cur_offset + envelope_size;
9170            if 3 > max_ordinal {
9171                return Ok(());
9172            }
9173
9174            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9175            // are envelope_size bytes.
9176            let cur_offset: usize = (3 - 1) * envelope_size;
9177
9178            // Zero reserved fields.
9179            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9180
9181            // Safety:
9182            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9183            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9184            //   envelope_size bytes, there is always sufficient room.
9185            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_intl::TimeZoneId, D>(
9186                self.time_zone_id.as_ref().map(
9187                    <fidl_fuchsia_intl::TimeZoneId as fidl::encoding::ValueTypeMarker>::borrow,
9188                ),
9189                encoder,
9190                offset + cur_offset,
9191                depth,
9192            )?;
9193
9194            _prev_end_offset = cur_offset + envelope_size;
9195            if 4 > max_ordinal {
9196                return Ok(());
9197            }
9198
9199            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9200            // are envelope_size bytes.
9201            let cur_offset: usize = (4 - 1) * envelope_size;
9202
9203            // Zero reserved fields.
9204            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9205
9206            // Safety:
9207            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9208            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9209            //   envelope_size bytes, there is always sufficient room.
9210            fidl::encoding::encode_in_envelope_optional::<HourCycle, D>(
9211                self.hour_cycle
9212                    .as_ref()
9213                    .map(<HourCycle as fidl::encoding::ValueTypeMarker>::borrow),
9214                encoder,
9215                offset + cur_offset,
9216                depth,
9217            )?;
9218
9219            _prev_end_offset = cur_offset + envelope_size;
9220
9221            Ok(())
9222        }
9223    }
9224
9225    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IntlSettings {
9226        #[inline(always)]
9227        fn new_empty() -> Self {
9228            Self::default()
9229        }
9230
9231        unsafe fn decode(
9232            &mut self,
9233            decoder: &mut fidl::encoding::Decoder<'_, D>,
9234            offset: usize,
9235            mut depth: fidl::encoding::Depth,
9236        ) -> fidl::Result<()> {
9237            decoder.debug_check_bounds::<Self>(offset);
9238            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9239                None => return Err(fidl::Error::NotNullable),
9240                Some(len) => len,
9241            };
9242            // Calling decoder.out_of_line_offset(0) is not allowed.
9243            if len == 0 {
9244                return Ok(());
9245            };
9246            depth.increment()?;
9247            let envelope_size = 8;
9248            let bytes_len = len * envelope_size;
9249            let offset = decoder.out_of_line_offset(bytes_len)?;
9250            // Decode the envelope for each type.
9251            let mut _next_ordinal_to_read = 0;
9252            let mut next_offset = offset;
9253            let end_offset = offset + bytes_len;
9254            _next_ordinal_to_read += 1;
9255            if next_offset >= end_offset {
9256                return Ok(());
9257            }
9258
9259            // Decode unknown envelopes for gaps in ordinals.
9260            while _next_ordinal_to_read < 1 {
9261                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9262                _next_ordinal_to_read += 1;
9263                next_offset += envelope_size;
9264            }
9265
9266            let next_out_of_line = decoder.next_out_of_line();
9267            let handles_before = decoder.remaining_handles();
9268            if let Some((inlined, num_bytes, num_handles)) =
9269                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9270            {
9271                let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9272                if inlined != (member_inline_size <= 4) {
9273                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9274                }
9275                let inner_offset;
9276                let mut inner_depth = depth.clone();
9277                if inlined {
9278                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9279                    inner_offset = next_offset;
9280                } else {
9281                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9282                    inner_depth.increment()?;
9283                }
9284                let val_ref = self.locales.get_or_insert_with(
9285                    || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 10>, D),
9286                );
9287                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_intl::LocaleId, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
9288                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9289                {
9290                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9291                }
9292                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9293                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9294                }
9295            }
9296
9297            next_offset += envelope_size;
9298            _next_ordinal_to_read += 1;
9299            if next_offset >= end_offset {
9300                return Ok(());
9301            }
9302
9303            // Decode unknown envelopes for gaps in ordinals.
9304            while _next_ordinal_to_read < 2 {
9305                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9306                _next_ordinal_to_read += 1;
9307                next_offset += envelope_size;
9308            }
9309
9310            let next_out_of_line = decoder.next_out_of_line();
9311            let handles_before = decoder.remaining_handles();
9312            if let Some((inlined, num_bytes, num_handles)) =
9313                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9314            {
9315                let member_inline_size =
9316                    <fidl_fuchsia_intl::TemperatureUnit as fidl::encoding::TypeMarker>::inline_size(
9317                        decoder.context,
9318                    );
9319                if inlined != (member_inline_size <= 4) {
9320                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9321                }
9322                let inner_offset;
9323                let mut inner_depth = depth.clone();
9324                if inlined {
9325                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9326                    inner_offset = next_offset;
9327                } else {
9328                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9329                    inner_depth.increment()?;
9330                }
9331                let val_ref = self
9332                    .temperature_unit
9333                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_intl::TemperatureUnit, D));
9334                fidl::decode!(
9335                    fidl_fuchsia_intl::TemperatureUnit,
9336                    D,
9337                    val_ref,
9338                    decoder,
9339                    inner_offset,
9340                    inner_depth
9341                )?;
9342                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9343                {
9344                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9345                }
9346                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9347                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9348                }
9349            }
9350
9351            next_offset += envelope_size;
9352            _next_ordinal_to_read += 1;
9353            if next_offset >= end_offset {
9354                return Ok(());
9355            }
9356
9357            // Decode unknown envelopes for gaps in ordinals.
9358            while _next_ordinal_to_read < 3 {
9359                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9360                _next_ordinal_to_read += 1;
9361                next_offset += envelope_size;
9362            }
9363
9364            let next_out_of_line = decoder.next_out_of_line();
9365            let handles_before = decoder.remaining_handles();
9366            if let Some((inlined, num_bytes, num_handles)) =
9367                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9368            {
9369                let member_inline_size =
9370                    <fidl_fuchsia_intl::TimeZoneId as fidl::encoding::TypeMarker>::inline_size(
9371                        decoder.context,
9372                    );
9373                if inlined != (member_inline_size <= 4) {
9374                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9375                }
9376                let inner_offset;
9377                let mut inner_depth = depth.clone();
9378                if inlined {
9379                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9380                    inner_offset = next_offset;
9381                } else {
9382                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9383                    inner_depth.increment()?;
9384                }
9385                let val_ref = self
9386                    .time_zone_id
9387                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_intl::TimeZoneId, D));
9388                fidl::decode!(
9389                    fidl_fuchsia_intl::TimeZoneId,
9390                    D,
9391                    val_ref,
9392                    decoder,
9393                    inner_offset,
9394                    inner_depth
9395                )?;
9396                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9397                {
9398                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9399                }
9400                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9401                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9402                }
9403            }
9404
9405            next_offset += envelope_size;
9406            _next_ordinal_to_read += 1;
9407            if next_offset >= end_offset {
9408                return Ok(());
9409            }
9410
9411            // Decode unknown envelopes for gaps in ordinals.
9412            while _next_ordinal_to_read < 4 {
9413                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9414                _next_ordinal_to_read += 1;
9415                next_offset += envelope_size;
9416            }
9417
9418            let next_out_of_line = decoder.next_out_of_line();
9419            let handles_before = decoder.remaining_handles();
9420            if let Some((inlined, num_bytes, num_handles)) =
9421                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9422            {
9423                let member_inline_size =
9424                    <HourCycle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9425                if inlined != (member_inline_size <= 4) {
9426                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9427                }
9428                let inner_offset;
9429                let mut inner_depth = depth.clone();
9430                if inlined {
9431                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9432                    inner_offset = next_offset;
9433                } else {
9434                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9435                    inner_depth.increment()?;
9436                }
9437                let val_ref = self.hour_cycle.get_or_insert_with(|| fidl::new_empty!(HourCycle, D));
9438                fidl::decode!(HourCycle, D, val_ref, decoder, inner_offset, inner_depth)?;
9439                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9440                {
9441                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9442                }
9443                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9444                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9445                }
9446            }
9447
9448            next_offset += envelope_size;
9449
9450            // Decode the remaining unknown envelopes.
9451            while next_offset < end_offset {
9452                _next_ordinal_to_read += 1;
9453                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9454                next_offset += envelope_size;
9455            }
9456
9457            Ok(())
9458        }
9459    }
9460
9461    impl KeyboardSettings {
9462        #[inline(always)]
9463        fn max_ordinal_present(&self) -> u64 {
9464            if let Some(_) = self.autorepeat {
9465                return 2;
9466            }
9467            if let Some(_) = self.keymap {
9468                return 1;
9469            }
9470            0
9471        }
9472    }
9473
9474    impl fidl::encoding::ValueTypeMarker for KeyboardSettings {
9475        type Borrowed<'a> = &'a Self;
9476        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9477            value
9478        }
9479    }
9480
9481    unsafe impl fidl::encoding::TypeMarker for KeyboardSettings {
9482        type Owned = Self;
9483
9484        #[inline(always)]
9485        fn inline_align(_context: fidl::encoding::Context) -> usize {
9486            8
9487        }
9488
9489        #[inline(always)]
9490        fn inline_size(_context: fidl::encoding::Context) -> usize {
9491            16
9492        }
9493    }
9494
9495    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardSettings, D>
9496        for &KeyboardSettings
9497    {
9498        unsafe fn encode(
9499            self,
9500            encoder: &mut fidl::encoding::Encoder<'_, D>,
9501            offset: usize,
9502            mut depth: fidl::encoding::Depth,
9503        ) -> fidl::Result<()> {
9504            encoder.debug_check_bounds::<KeyboardSettings>(offset);
9505            // Vector header
9506            let max_ordinal: u64 = self.max_ordinal_present();
9507            encoder.write_num(max_ordinal, offset);
9508            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9509            // Calling encoder.out_of_line_offset(0) is not allowed.
9510            if max_ordinal == 0 {
9511                return Ok(());
9512            }
9513            depth.increment()?;
9514            let envelope_size = 8;
9515            let bytes_len = max_ordinal as usize * envelope_size;
9516            #[allow(unused_variables)]
9517            let offset = encoder.out_of_line_offset(bytes_len);
9518            let mut _prev_end_offset: usize = 0;
9519            if 1 > max_ordinal {
9520                return Ok(());
9521            }
9522
9523            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9524            // are envelope_size bytes.
9525            let cur_offset: usize = (1 - 1) * envelope_size;
9526
9527            // Zero reserved fields.
9528            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9529
9530            // Safety:
9531            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9532            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9533            //   envelope_size bytes, there is always sufficient room.
9534            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input::KeymapId, D>(
9535                self.keymap
9536                    .as_ref()
9537                    .map(<fidl_fuchsia_input::KeymapId as fidl::encoding::ValueTypeMarker>::borrow),
9538                encoder,
9539                offset + cur_offset,
9540                depth,
9541            )?;
9542
9543            _prev_end_offset = cur_offset + envelope_size;
9544            if 2 > max_ordinal {
9545                return Ok(());
9546            }
9547
9548            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9549            // are envelope_size bytes.
9550            let cur_offset: usize = (2 - 1) * envelope_size;
9551
9552            // Zero reserved fields.
9553            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9554
9555            // Safety:
9556            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9557            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9558            //   envelope_size bytes, there is always sufficient room.
9559            fidl::encoding::encode_in_envelope_optional::<Autorepeat, D>(
9560                self.autorepeat
9561                    .as_ref()
9562                    .map(<Autorepeat as fidl::encoding::ValueTypeMarker>::borrow),
9563                encoder,
9564                offset + cur_offset,
9565                depth,
9566            )?;
9567
9568            _prev_end_offset = cur_offset + envelope_size;
9569
9570            Ok(())
9571        }
9572    }
9573
9574    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardSettings {
9575        #[inline(always)]
9576        fn new_empty() -> Self {
9577            Self::default()
9578        }
9579
9580        unsafe fn decode(
9581            &mut self,
9582            decoder: &mut fidl::encoding::Decoder<'_, D>,
9583            offset: usize,
9584            mut depth: fidl::encoding::Depth,
9585        ) -> fidl::Result<()> {
9586            decoder.debug_check_bounds::<Self>(offset);
9587            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9588                None => return Err(fidl::Error::NotNullable),
9589                Some(len) => len,
9590            };
9591            // Calling decoder.out_of_line_offset(0) is not allowed.
9592            if len == 0 {
9593                return Ok(());
9594            };
9595            depth.increment()?;
9596            let envelope_size = 8;
9597            let bytes_len = len * envelope_size;
9598            let offset = decoder.out_of_line_offset(bytes_len)?;
9599            // Decode the envelope for each type.
9600            let mut _next_ordinal_to_read = 0;
9601            let mut next_offset = offset;
9602            let end_offset = offset + bytes_len;
9603            _next_ordinal_to_read += 1;
9604            if next_offset >= end_offset {
9605                return Ok(());
9606            }
9607
9608            // Decode unknown envelopes for gaps in ordinals.
9609            while _next_ordinal_to_read < 1 {
9610                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9611                _next_ordinal_to_read += 1;
9612                next_offset += envelope_size;
9613            }
9614
9615            let next_out_of_line = decoder.next_out_of_line();
9616            let handles_before = decoder.remaining_handles();
9617            if let Some((inlined, num_bytes, num_handles)) =
9618                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9619            {
9620                let member_inline_size =
9621                    <fidl_fuchsia_input::KeymapId as fidl::encoding::TypeMarker>::inline_size(
9622                        decoder.context,
9623                    );
9624                if inlined != (member_inline_size <= 4) {
9625                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9626                }
9627                let inner_offset;
9628                let mut inner_depth = depth.clone();
9629                if inlined {
9630                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9631                    inner_offset = next_offset;
9632                } else {
9633                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9634                    inner_depth.increment()?;
9635                }
9636                let val_ref = self
9637                    .keymap
9638                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input::KeymapId, D));
9639                fidl::decode!(
9640                    fidl_fuchsia_input::KeymapId,
9641                    D,
9642                    val_ref,
9643                    decoder,
9644                    inner_offset,
9645                    inner_depth
9646                )?;
9647                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9648                {
9649                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9650                }
9651                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9652                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9653                }
9654            }
9655
9656            next_offset += envelope_size;
9657            _next_ordinal_to_read += 1;
9658            if next_offset >= end_offset {
9659                return Ok(());
9660            }
9661
9662            // Decode unknown envelopes for gaps in ordinals.
9663            while _next_ordinal_to_read < 2 {
9664                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9665                _next_ordinal_to_read += 1;
9666                next_offset += envelope_size;
9667            }
9668
9669            let next_out_of_line = decoder.next_out_of_line();
9670            let handles_before = decoder.remaining_handles();
9671            if let Some((inlined, num_bytes, num_handles)) =
9672                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9673            {
9674                let member_inline_size =
9675                    <Autorepeat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9676                if inlined != (member_inline_size <= 4) {
9677                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9678                }
9679                let inner_offset;
9680                let mut inner_depth = depth.clone();
9681                if inlined {
9682                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9683                    inner_offset = next_offset;
9684                } else {
9685                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9686                    inner_depth.increment()?;
9687                }
9688                let val_ref =
9689                    self.autorepeat.get_or_insert_with(|| fidl::new_empty!(Autorepeat, D));
9690                fidl::decode!(Autorepeat, D, val_ref, decoder, inner_offset, inner_depth)?;
9691                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9692                {
9693                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9694                }
9695                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9696                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9697                }
9698            }
9699
9700            next_offset += envelope_size;
9701
9702            // Decode the remaining unknown envelopes.
9703            while next_offset < end_offset {
9704                _next_ordinal_to_read += 1;
9705                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9706                next_offset += envelope_size;
9707            }
9708
9709            Ok(())
9710        }
9711    }
9712
9713    impl LightGroup {
9714        #[inline(always)]
9715        fn max_ordinal_present(&self) -> u64 {
9716            if let Some(_) = self.lights {
9717                return 4;
9718            }
9719            if let Some(_) = self.type_ {
9720                return 3;
9721            }
9722            if let Some(_) = self.enabled {
9723                return 2;
9724            }
9725            if let Some(_) = self.name {
9726                return 1;
9727            }
9728            0
9729        }
9730    }
9731
9732    impl fidl::encoding::ValueTypeMarker for LightGroup {
9733        type Borrowed<'a> = &'a Self;
9734        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9735            value
9736        }
9737    }
9738
9739    unsafe impl fidl::encoding::TypeMarker for LightGroup {
9740        type Owned = Self;
9741
9742        #[inline(always)]
9743        fn inline_align(_context: fidl::encoding::Context) -> usize {
9744            8
9745        }
9746
9747        #[inline(always)]
9748        fn inline_size(_context: fidl::encoding::Context) -> usize {
9749            16
9750        }
9751    }
9752
9753    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightGroup, D>
9754        for &LightGroup
9755    {
9756        unsafe fn encode(
9757            self,
9758            encoder: &mut fidl::encoding::Encoder<'_, D>,
9759            offset: usize,
9760            mut depth: fidl::encoding::Depth,
9761        ) -> fidl::Result<()> {
9762            encoder.debug_check_bounds::<LightGroup>(offset);
9763            // Vector header
9764            let max_ordinal: u64 = self.max_ordinal_present();
9765            encoder.write_num(max_ordinal, offset);
9766            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9767            // Calling encoder.out_of_line_offset(0) is not allowed.
9768            if max_ordinal == 0 {
9769                return Ok(());
9770            }
9771            depth.increment()?;
9772            let envelope_size = 8;
9773            let bytes_len = max_ordinal as usize * envelope_size;
9774            #[allow(unused_variables)]
9775            let offset = encoder.out_of_line_offset(bytes_len);
9776            let mut _prev_end_offset: usize = 0;
9777            if 1 > max_ordinal {
9778                return Ok(());
9779            }
9780
9781            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9782            // are envelope_size bytes.
9783            let cur_offset: usize = (1 - 1) * envelope_size;
9784
9785            // Zero reserved fields.
9786            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9787
9788            // Safety:
9789            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9790            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9791            //   envelope_size bytes, there is always sufficient room.
9792            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<32>, D>(
9793                self.name.as_ref().map(
9794                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
9795                ),
9796                encoder,
9797                offset + cur_offset,
9798                depth,
9799            )?;
9800
9801            _prev_end_offset = cur_offset + envelope_size;
9802            if 2 > max_ordinal {
9803                return Ok(());
9804            }
9805
9806            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9807            // are envelope_size bytes.
9808            let cur_offset: usize = (2 - 1) * envelope_size;
9809
9810            // Zero reserved fields.
9811            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9812
9813            // Safety:
9814            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9815            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9816            //   envelope_size bytes, there is always sufficient room.
9817            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9818                self.enabled.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9819                encoder,
9820                offset + cur_offset,
9821                depth,
9822            )?;
9823
9824            _prev_end_offset = cur_offset + envelope_size;
9825            if 3 > max_ordinal {
9826                return Ok(());
9827            }
9828
9829            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9830            // are envelope_size bytes.
9831            let cur_offset: usize = (3 - 1) * envelope_size;
9832
9833            // Zero reserved fields.
9834            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9835
9836            // Safety:
9837            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9838            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9839            //   envelope_size bytes, there is always sufficient room.
9840            fidl::encoding::encode_in_envelope_optional::<LightType, D>(
9841                self.type_.as_ref().map(<LightType as fidl::encoding::ValueTypeMarker>::borrow),
9842                encoder,
9843                offset + cur_offset,
9844                depth,
9845            )?;
9846
9847            _prev_end_offset = cur_offset + envelope_size;
9848            if 4 > max_ordinal {
9849                return Ok(());
9850            }
9851
9852            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9853            // are envelope_size bytes.
9854            let cur_offset: usize = (4 - 1) * envelope_size;
9855
9856            // Zero reserved fields.
9857            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9858
9859            // Safety:
9860            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9861            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9862            //   envelope_size bytes, there is always sufficient room.
9863            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<LightState>, D>(
9864            self.lights.as_ref().map(<fidl::encoding::UnboundedVector<LightState> as fidl::encoding::ValueTypeMarker>::borrow),
9865            encoder, offset + cur_offset, depth
9866        )?;
9867
9868            _prev_end_offset = cur_offset + envelope_size;
9869
9870            Ok(())
9871        }
9872    }
9873
9874    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightGroup {
9875        #[inline(always)]
9876        fn new_empty() -> Self {
9877            Self::default()
9878        }
9879
9880        unsafe fn decode(
9881            &mut self,
9882            decoder: &mut fidl::encoding::Decoder<'_, D>,
9883            offset: usize,
9884            mut depth: fidl::encoding::Depth,
9885        ) -> fidl::Result<()> {
9886            decoder.debug_check_bounds::<Self>(offset);
9887            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9888                None => return Err(fidl::Error::NotNullable),
9889                Some(len) => len,
9890            };
9891            // Calling decoder.out_of_line_offset(0) is not allowed.
9892            if len == 0 {
9893                return Ok(());
9894            };
9895            depth.increment()?;
9896            let envelope_size = 8;
9897            let bytes_len = len * envelope_size;
9898            let offset = decoder.out_of_line_offset(bytes_len)?;
9899            // Decode the envelope for each type.
9900            let mut _next_ordinal_to_read = 0;
9901            let mut next_offset = offset;
9902            let end_offset = offset + bytes_len;
9903            _next_ordinal_to_read += 1;
9904            if next_offset >= end_offset {
9905                return Ok(());
9906            }
9907
9908            // Decode unknown envelopes for gaps in ordinals.
9909            while _next_ordinal_to_read < 1 {
9910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9911                _next_ordinal_to_read += 1;
9912                next_offset += envelope_size;
9913            }
9914
9915            let next_out_of_line = decoder.next_out_of_line();
9916            let handles_before = decoder.remaining_handles();
9917            if let Some((inlined, num_bytes, num_handles)) =
9918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9919            {
9920                let member_inline_size =
9921                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
9922                        decoder.context,
9923                    );
9924                if inlined != (member_inline_size <= 4) {
9925                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9926                }
9927                let inner_offset;
9928                let mut inner_depth = depth.clone();
9929                if inlined {
9930                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9931                    inner_offset = next_offset;
9932                } else {
9933                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9934                    inner_depth.increment()?;
9935                }
9936                let val_ref = self
9937                    .name
9938                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<32>, D));
9939                fidl::decode!(
9940                    fidl::encoding::BoundedString<32>,
9941                    D,
9942                    val_ref,
9943                    decoder,
9944                    inner_offset,
9945                    inner_depth
9946                )?;
9947                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9948                {
9949                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9950                }
9951                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9952                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9953                }
9954            }
9955
9956            next_offset += envelope_size;
9957            _next_ordinal_to_read += 1;
9958            if next_offset >= end_offset {
9959                return Ok(());
9960            }
9961
9962            // Decode unknown envelopes for gaps in ordinals.
9963            while _next_ordinal_to_read < 2 {
9964                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9965                _next_ordinal_to_read += 1;
9966                next_offset += envelope_size;
9967            }
9968
9969            let next_out_of_line = decoder.next_out_of_line();
9970            let handles_before = decoder.remaining_handles();
9971            if let Some((inlined, num_bytes, num_handles)) =
9972                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9973            {
9974                let member_inline_size =
9975                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9976                if inlined != (member_inline_size <= 4) {
9977                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9978                }
9979                let inner_offset;
9980                let mut inner_depth = depth.clone();
9981                if inlined {
9982                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9983                    inner_offset = next_offset;
9984                } else {
9985                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9986                    inner_depth.increment()?;
9987                }
9988                let val_ref = self.enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
9989                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9990                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9991                {
9992                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9993                }
9994                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9995                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9996                }
9997            }
9998
9999            next_offset += envelope_size;
10000            _next_ordinal_to_read += 1;
10001            if next_offset >= end_offset {
10002                return Ok(());
10003            }
10004
10005            // Decode unknown envelopes for gaps in ordinals.
10006            while _next_ordinal_to_read < 3 {
10007                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10008                _next_ordinal_to_read += 1;
10009                next_offset += envelope_size;
10010            }
10011
10012            let next_out_of_line = decoder.next_out_of_line();
10013            let handles_before = decoder.remaining_handles();
10014            if let Some((inlined, num_bytes, num_handles)) =
10015                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10016            {
10017                let member_inline_size =
10018                    <LightType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10019                if inlined != (member_inline_size <= 4) {
10020                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10021                }
10022                let inner_offset;
10023                let mut inner_depth = depth.clone();
10024                if inlined {
10025                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10026                    inner_offset = next_offset;
10027                } else {
10028                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10029                    inner_depth.increment()?;
10030                }
10031                let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(LightType, D));
10032                fidl::decode!(LightType, D, val_ref, decoder, inner_offset, inner_depth)?;
10033                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10034                {
10035                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10036                }
10037                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10038                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10039                }
10040            }
10041
10042            next_offset += envelope_size;
10043            _next_ordinal_to_read += 1;
10044            if next_offset >= end_offset {
10045                return Ok(());
10046            }
10047
10048            // Decode unknown envelopes for gaps in ordinals.
10049            while _next_ordinal_to_read < 4 {
10050                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10051                _next_ordinal_to_read += 1;
10052                next_offset += envelope_size;
10053            }
10054
10055            let next_out_of_line = decoder.next_out_of_line();
10056            let handles_before = decoder.remaining_handles();
10057            if let Some((inlined, num_bytes, num_handles)) =
10058                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10059            {
10060                let member_inline_size = <fidl::encoding::UnboundedVector<LightState> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10061                if inlined != (member_inline_size <= 4) {
10062                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10063                }
10064                let inner_offset;
10065                let mut inner_depth = depth.clone();
10066                if inlined {
10067                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10068                    inner_offset = next_offset;
10069                } else {
10070                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10071                    inner_depth.increment()?;
10072                }
10073                let val_ref = self.lights.get_or_insert_with(|| {
10074                    fidl::new_empty!(fidl::encoding::UnboundedVector<LightState>, D)
10075                });
10076                fidl::decode!(
10077                    fidl::encoding::UnboundedVector<LightState>,
10078                    D,
10079                    val_ref,
10080                    decoder,
10081                    inner_offset,
10082                    inner_depth
10083                )?;
10084                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10085                {
10086                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10087                }
10088                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10089                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10090                }
10091            }
10092
10093            next_offset += envelope_size;
10094
10095            // Decode the remaining unknown envelopes.
10096            while next_offset < end_offset {
10097                _next_ordinal_to_read += 1;
10098                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10099                next_offset += envelope_size;
10100            }
10101
10102            Ok(())
10103        }
10104    }
10105
10106    impl LightState {
10107        #[inline(always)]
10108        fn max_ordinal_present(&self) -> u64 {
10109            if let Some(_) = self.value {
10110                return 1;
10111            }
10112            0
10113        }
10114    }
10115
10116    impl fidl::encoding::ValueTypeMarker for LightState {
10117        type Borrowed<'a> = &'a Self;
10118        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10119            value
10120        }
10121    }
10122
10123    unsafe impl fidl::encoding::TypeMarker for LightState {
10124        type Owned = Self;
10125
10126        #[inline(always)]
10127        fn inline_align(_context: fidl::encoding::Context) -> usize {
10128            8
10129        }
10130
10131        #[inline(always)]
10132        fn inline_size(_context: fidl::encoding::Context) -> usize {
10133            16
10134        }
10135    }
10136
10137    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightState, D>
10138        for &LightState
10139    {
10140        unsafe fn encode(
10141            self,
10142            encoder: &mut fidl::encoding::Encoder<'_, D>,
10143            offset: usize,
10144            mut depth: fidl::encoding::Depth,
10145        ) -> fidl::Result<()> {
10146            encoder.debug_check_bounds::<LightState>(offset);
10147            // Vector header
10148            let max_ordinal: u64 = self.max_ordinal_present();
10149            encoder.write_num(max_ordinal, offset);
10150            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10151            // Calling encoder.out_of_line_offset(0) is not allowed.
10152            if max_ordinal == 0 {
10153                return Ok(());
10154            }
10155            depth.increment()?;
10156            let envelope_size = 8;
10157            let bytes_len = max_ordinal as usize * envelope_size;
10158            #[allow(unused_variables)]
10159            let offset = encoder.out_of_line_offset(bytes_len);
10160            let mut _prev_end_offset: usize = 0;
10161            if 1 > max_ordinal {
10162                return Ok(());
10163            }
10164
10165            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10166            // are envelope_size bytes.
10167            let cur_offset: usize = (1 - 1) * envelope_size;
10168
10169            // Zero reserved fields.
10170            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10171
10172            // Safety:
10173            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10174            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10175            //   envelope_size bytes, there is always sufficient room.
10176            fidl::encoding::encode_in_envelope_optional::<LightValue, D>(
10177                self.value.as_ref().map(<LightValue as fidl::encoding::ValueTypeMarker>::borrow),
10178                encoder,
10179                offset + cur_offset,
10180                depth,
10181            )?;
10182
10183            _prev_end_offset = cur_offset + envelope_size;
10184
10185            Ok(())
10186        }
10187    }
10188
10189    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightState {
10190        #[inline(always)]
10191        fn new_empty() -> Self {
10192            Self::default()
10193        }
10194
10195        unsafe fn decode(
10196            &mut self,
10197            decoder: &mut fidl::encoding::Decoder<'_, D>,
10198            offset: usize,
10199            mut depth: fidl::encoding::Depth,
10200        ) -> fidl::Result<()> {
10201            decoder.debug_check_bounds::<Self>(offset);
10202            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10203                None => return Err(fidl::Error::NotNullable),
10204                Some(len) => len,
10205            };
10206            // Calling decoder.out_of_line_offset(0) is not allowed.
10207            if len == 0 {
10208                return Ok(());
10209            };
10210            depth.increment()?;
10211            let envelope_size = 8;
10212            let bytes_len = len * envelope_size;
10213            let offset = decoder.out_of_line_offset(bytes_len)?;
10214            // Decode the envelope for each type.
10215            let mut _next_ordinal_to_read = 0;
10216            let mut next_offset = offset;
10217            let end_offset = offset + bytes_len;
10218            _next_ordinal_to_read += 1;
10219            if next_offset >= end_offset {
10220                return Ok(());
10221            }
10222
10223            // Decode unknown envelopes for gaps in ordinals.
10224            while _next_ordinal_to_read < 1 {
10225                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10226                _next_ordinal_to_read += 1;
10227                next_offset += envelope_size;
10228            }
10229
10230            let next_out_of_line = decoder.next_out_of_line();
10231            let handles_before = decoder.remaining_handles();
10232            if let Some((inlined, num_bytes, num_handles)) =
10233                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10234            {
10235                let member_inline_size =
10236                    <LightValue as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10237                if inlined != (member_inline_size <= 4) {
10238                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10239                }
10240                let inner_offset;
10241                let mut inner_depth = depth.clone();
10242                if inlined {
10243                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10244                    inner_offset = next_offset;
10245                } else {
10246                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10247                    inner_depth.increment()?;
10248                }
10249                let val_ref = self.value.get_or_insert_with(|| fidl::new_empty!(LightValue, D));
10250                fidl::decode!(LightValue, D, val_ref, decoder, inner_offset, inner_depth)?;
10251                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10252                {
10253                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10254                }
10255                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10256                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10257                }
10258            }
10259
10260            next_offset += envelope_size;
10261
10262            // Decode the remaining unknown envelopes.
10263            while next_offset < end_offset {
10264                _next_ordinal_to_read += 1;
10265                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10266                next_offset += envelope_size;
10267            }
10268
10269            Ok(())
10270        }
10271    }
10272
10273    impl NightModeSettings {
10274        #[inline(always)]
10275        fn max_ordinal_present(&self) -> u64 {
10276            if let Some(_) = self.night_mode_enabled {
10277                return 1;
10278            }
10279            0
10280        }
10281    }
10282
10283    impl fidl::encoding::ValueTypeMarker for NightModeSettings {
10284        type Borrowed<'a> = &'a Self;
10285        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10286            value
10287        }
10288    }
10289
10290    unsafe impl fidl::encoding::TypeMarker for NightModeSettings {
10291        type Owned = Self;
10292
10293        #[inline(always)]
10294        fn inline_align(_context: fidl::encoding::Context) -> usize {
10295            8
10296        }
10297
10298        #[inline(always)]
10299        fn inline_size(_context: fidl::encoding::Context) -> usize {
10300            16
10301        }
10302    }
10303
10304    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NightModeSettings, D>
10305        for &NightModeSettings
10306    {
10307        unsafe fn encode(
10308            self,
10309            encoder: &mut fidl::encoding::Encoder<'_, D>,
10310            offset: usize,
10311            mut depth: fidl::encoding::Depth,
10312        ) -> fidl::Result<()> {
10313            encoder.debug_check_bounds::<NightModeSettings>(offset);
10314            // Vector header
10315            let max_ordinal: u64 = self.max_ordinal_present();
10316            encoder.write_num(max_ordinal, offset);
10317            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10318            // Calling encoder.out_of_line_offset(0) is not allowed.
10319            if max_ordinal == 0 {
10320                return Ok(());
10321            }
10322            depth.increment()?;
10323            let envelope_size = 8;
10324            let bytes_len = max_ordinal as usize * envelope_size;
10325            #[allow(unused_variables)]
10326            let offset = encoder.out_of_line_offset(bytes_len);
10327            let mut _prev_end_offset: usize = 0;
10328            if 1 > max_ordinal {
10329                return Ok(());
10330            }
10331
10332            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10333            // are envelope_size bytes.
10334            let cur_offset: usize = (1 - 1) * envelope_size;
10335
10336            // Zero reserved fields.
10337            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10338
10339            // Safety:
10340            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10341            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10342            //   envelope_size bytes, there is always sufficient room.
10343            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10344                self.night_mode_enabled
10345                    .as_ref()
10346                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10347                encoder,
10348                offset + cur_offset,
10349                depth,
10350            )?;
10351
10352            _prev_end_offset = cur_offset + envelope_size;
10353
10354            Ok(())
10355        }
10356    }
10357
10358    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NightModeSettings {
10359        #[inline(always)]
10360        fn new_empty() -> Self {
10361            Self::default()
10362        }
10363
10364        unsafe fn decode(
10365            &mut self,
10366            decoder: &mut fidl::encoding::Decoder<'_, D>,
10367            offset: usize,
10368            mut depth: fidl::encoding::Depth,
10369        ) -> fidl::Result<()> {
10370            decoder.debug_check_bounds::<Self>(offset);
10371            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10372                None => return Err(fidl::Error::NotNullable),
10373                Some(len) => len,
10374            };
10375            // Calling decoder.out_of_line_offset(0) is not allowed.
10376            if len == 0 {
10377                return Ok(());
10378            };
10379            depth.increment()?;
10380            let envelope_size = 8;
10381            let bytes_len = len * envelope_size;
10382            let offset = decoder.out_of_line_offset(bytes_len)?;
10383            // Decode the envelope for each type.
10384            let mut _next_ordinal_to_read = 0;
10385            let mut next_offset = offset;
10386            let end_offset = offset + bytes_len;
10387            _next_ordinal_to_read += 1;
10388            if next_offset >= end_offset {
10389                return Ok(());
10390            }
10391
10392            // Decode unknown envelopes for gaps in ordinals.
10393            while _next_ordinal_to_read < 1 {
10394                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10395                _next_ordinal_to_read += 1;
10396                next_offset += envelope_size;
10397            }
10398
10399            let next_out_of_line = decoder.next_out_of_line();
10400            let handles_before = decoder.remaining_handles();
10401            if let Some((inlined, num_bytes, num_handles)) =
10402                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10403            {
10404                let member_inline_size =
10405                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10406                if inlined != (member_inline_size <= 4) {
10407                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10408                }
10409                let inner_offset;
10410                let mut inner_depth = depth.clone();
10411                if inlined {
10412                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10413                    inner_offset = next_offset;
10414                } else {
10415                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10416                    inner_depth.increment()?;
10417                }
10418                let val_ref =
10419                    self.night_mode_enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
10420                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10421                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10422                {
10423                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10424                }
10425                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10426                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10427                }
10428            }
10429
10430            next_offset += envelope_size;
10431
10432            // Decode the remaining unknown envelopes.
10433            while next_offset < end_offset {
10434                _next_ordinal_to_read += 1;
10435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10436                next_offset += envelope_size;
10437            }
10438
10439            Ok(())
10440        }
10441    }
10442
10443    impl PrivacySettings {
10444        #[inline(always)]
10445        fn max_ordinal_present(&self) -> u64 {
10446            if let Some(_) = self.user_data_sharing_consent {
10447                return 1;
10448            }
10449            0
10450        }
10451    }
10452
10453    impl fidl::encoding::ValueTypeMarker for PrivacySettings {
10454        type Borrowed<'a> = &'a Self;
10455        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10456            value
10457        }
10458    }
10459
10460    unsafe impl fidl::encoding::TypeMarker for PrivacySettings {
10461        type Owned = Self;
10462
10463        #[inline(always)]
10464        fn inline_align(_context: fidl::encoding::Context) -> usize {
10465            8
10466        }
10467
10468        #[inline(always)]
10469        fn inline_size(_context: fidl::encoding::Context) -> usize {
10470            16
10471        }
10472    }
10473
10474    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrivacySettings, D>
10475        for &PrivacySettings
10476    {
10477        unsafe fn encode(
10478            self,
10479            encoder: &mut fidl::encoding::Encoder<'_, D>,
10480            offset: usize,
10481            mut depth: fidl::encoding::Depth,
10482        ) -> fidl::Result<()> {
10483            encoder.debug_check_bounds::<PrivacySettings>(offset);
10484            // Vector header
10485            let max_ordinal: u64 = self.max_ordinal_present();
10486            encoder.write_num(max_ordinal, offset);
10487            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10488            // Calling encoder.out_of_line_offset(0) is not allowed.
10489            if max_ordinal == 0 {
10490                return Ok(());
10491            }
10492            depth.increment()?;
10493            let envelope_size = 8;
10494            let bytes_len = max_ordinal as usize * envelope_size;
10495            #[allow(unused_variables)]
10496            let offset = encoder.out_of_line_offset(bytes_len);
10497            let mut _prev_end_offset: usize = 0;
10498            if 1 > max_ordinal {
10499                return Ok(());
10500            }
10501
10502            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10503            // are envelope_size bytes.
10504            let cur_offset: usize = (1 - 1) * envelope_size;
10505
10506            // Zero reserved fields.
10507            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10508
10509            // Safety:
10510            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10511            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10512            //   envelope_size bytes, there is always sufficient room.
10513            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10514                self.user_data_sharing_consent
10515                    .as_ref()
10516                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10517                encoder,
10518                offset + cur_offset,
10519                depth,
10520            )?;
10521
10522            _prev_end_offset = cur_offset + envelope_size;
10523
10524            Ok(())
10525        }
10526    }
10527
10528    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrivacySettings {
10529        #[inline(always)]
10530        fn new_empty() -> Self {
10531            Self::default()
10532        }
10533
10534        unsafe fn decode(
10535            &mut self,
10536            decoder: &mut fidl::encoding::Decoder<'_, D>,
10537            offset: usize,
10538            mut depth: fidl::encoding::Depth,
10539        ) -> fidl::Result<()> {
10540            decoder.debug_check_bounds::<Self>(offset);
10541            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10542                None => return Err(fidl::Error::NotNullable),
10543                Some(len) => len,
10544            };
10545            // Calling decoder.out_of_line_offset(0) is not allowed.
10546            if len == 0 {
10547                return Ok(());
10548            };
10549            depth.increment()?;
10550            let envelope_size = 8;
10551            let bytes_len = len * envelope_size;
10552            let offset = decoder.out_of_line_offset(bytes_len)?;
10553            // Decode the envelope for each type.
10554            let mut _next_ordinal_to_read = 0;
10555            let mut next_offset = offset;
10556            let end_offset = offset + bytes_len;
10557            _next_ordinal_to_read += 1;
10558            if next_offset >= end_offset {
10559                return Ok(());
10560            }
10561
10562            // Decode unknown envelopes for gaps in ordinals.
10563            while _next_ordinal_to_read < 1 {
10564                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10565                _next_ordinal_to_read += 1;
10566                next_offset += envelope_size;
10567            }
10568
10569            let next_out_of_line = decoder.next_out_of_line();
10570            let handles_before = decoder.remaining_handles();
10571            if let Some((inlined, num_bytes, num_handles)) =
10572                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10573            {
10574                let member_inline_size =
10575                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10576                if inlined != (member_inline_size <= 4) {
10577                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10578                }
10579                let inner_offset;
10580                let mut inner_depth = depth.clone();
10581                if inlined {
10582                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10583                    inner_offset = next_offset;
10584                } else {
10585                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10586                    inner_depth.increment()?;
10587                }
10588                let val_ref =
10589                    self.user_data_sharing_consent.get_or_insert_with(|| fidl::new_empty!(bool, D));
10590                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10591                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10592                {
10593                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10594                }
10595                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10596                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10597                }
10598            }
10599
10600            next_offset += envelope_size;
10601
10602            // Decode the remaining unknown envelopes.
10603            while next_offset < end_offset {
10604                _next_ordinal_to_read += 1;
10605                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10606                next_offset += envelope_size;
10607            }
10608
10609            Ok(())
10610        }
10611    }
10612
10613    impl SetupSettings {
10614        #[inline(always)]
10615        fn max_ordinal_present(&self) -> u64 {
10616            if let Some(_) = self.enabled_configuration_interfaces {
10617                return 1;
10618            }
10619            0
10620        }
10621    }
10622
10623    impl fidl::encoding::ValueTypeMarker for SetupSettings {
10624        type Borrowed<'a> = &'a Self;
10625        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10626            value
10627        }
10628    }
10629
10630    unsafe impl fidl::encoding::TypeMarker for SetupSettings {
10631        type Owned = Self;
10632
10633        #[inline(always)]
10634        fn inline_align(_context: fidl::encoding::Context) -> usize {
10635            8
10636        }
10637
10638        #[inline(always)]
10639        fn inline_size(_context: fidl::encoding::Context) -> usize {
10640            16
10641        }
10642    }
10643
10644    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetupSettings, D>
10645        for &SetupSettings
10646    {
10647        unsafe fn encode(
10648            self,
10649            encoder: &mut fidl::encoding::Encoder<'_, D>,
10650            offset: usize,
10651            mut depth: fidl::encoding::Depth,
10652        ) -> fidl::Result<()> {
10653            encoder.debug_check_bounds::<SetupSettings>(offset);
10654            // Vector header
10655            let max_ordinal: u64 = self.max_ordinal_present();
10656            encoder.write_num(max_ordinal, offset);
10657            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10658            // Calling encoder.out_of_line_offset(0) is not allowed.
10659            if max_ordinal == 0 {
10660                return Ok(());
10661            }
10662            depth.increment()?;
10663            let envelope_size = 8;
10664            let bytes_len = max_ordinal as usize * envelope_size;
10665            #[allow(unused_variables)]
10666            let offset = encoder.out_of_line_offset(bytes_len);
10667            let mut _prev_end_offset: usize = 0;
10668            if 1 > max_ordinal {
10669                return Ok(());
10670            }
10671
10672            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10673            // are envelope_size bytes.
10674            let cur_offset: usize = (1 - 1) * envelope_size;
10675
10676            // Zero reserved fields.
10677            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10678
10679            // Safety:
10680            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10681            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10682            //   envelope_size bytes, there is always sufficient room.
10683            fidl::encoding::encode_in_envelope_optional::<ConfigurationInterfaces, D>(
10684                self.enabled_configuration_interfaces
10685                    .as_ref()
10686                    .map(<ConfigurationInterfaces as fidl::encoding::ValueTypeMarker>::borrow),
10687                encoder,
10688                offset + cur_offset,
10689                depth,
10690            )?;
10691
10692            _prev_end_offset = cur_offset + envelope_size;
10693
10694            Ok(())
10695        }
10696    }
10697
10698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetupSettings {
10699        #[inline(always)]
10700        fn new_empty() -> Self {
10701            Self::default()
10702        }
10703
10704        unsafe fn decode(
10705            &mut self,
10706            decoder: &mut fidl::encoding::Decoder<'_, D>,
10707            offset: usize,
10708            mut depth: fidl::encoding::Depth,
10709        ) -> fidl::Result<()> {
10710            decoder.debug_check_bounds::<Self>(offset);
10711            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10712                None => return Err(fidl::Error::NotNullable),
10713                Some(len) => len,
10714            };
10715            // Calling decoder.out_of_line_offset(0) is not allowed.
10716            if len == 0 {
10717                return Ok(());
10718            };
10719            depth.increment()?;
10720            let envelope_size = 8;
10721            let bytes_len = len * envelope_size;
10722            let offset = decoder.out_of_line_offset(bytes_len)?;
10723            // Decode the envelope for each type.
10724            let mut _next_ordinal_to_read = 0;
10725            let mut next_offset = offset;
10726            let end_offset = offset + bytes_len;
10727            _next_ordinal_to_read += 1;
10728            if next_offset >= end_offset {
10729                return Ok(());
10730            }
10731
10732            // Decode unknown envelopes for gaps in ordinals.
10733            while _next_ordinal_to_read < 1 {
10734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10735                _next_ordinal_to_read += 1;
10736                next_offset += envelope_size;
10737            }
10738
10739            let next_out_of_line = decoder.next_out_of_line();
10740            let handles_before = decoder.remaining_handles();
10741            if let Some((inlined, num_bytes, num_handles)) =
10742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10743            {
10744                let member_inline_size =
10745                    <ConfigurationInterfaces as fidl::encoding::TypeMarker>::inline_size(
10746                        decoder.context,
10747                    );
10748                if inlined != (member_inline_size <= 4) {
10749                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10750                }
10751                let inner_offset;
10752                let mut inner_depth = depth.clone();
10753                if inlined {
10754                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10755                    inner_offset = next_offset;
10756                } else {
10757                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10758                    inner_depth.increment()?;
10759                }
10760                let val_ref = self
10761                    .enabled_configuration_interfaces
10762                    .get_or_insert_with(|| fidl::new_empty!(ConfigurationInterfaces, D));
10763                fidl::decode!(
10764                    ConfigurationInterfaces,
10765                    D,
10766                    val_ref,
10767                    decoder,
10768                    inner_offset,
10769                    inner_depth
10770                )?;
10771                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10772                {
10773                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10774                }
10775                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10776                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10777                }
10778            }
10779
10780            next_offset += envelope_size;
10781
10782            // Decode the remaining unknown envelopes.
10783            while next_offset < end_offset {
10784                _next_ordinal_to_read += 1;
10785                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10786                next_offset += envelope_size;
10787            }
10788
10789            Ok(())
10790        }
10791    }
10792
10793    impl SourceState {
10794        #[inline(always)]
10795        fn max_ordinal_present(&self) -> u64 {
10796            if let Some(_) = self.state {
10797                return 2;
10798            }
10799            if let Some(_) = self.source {
10800                return 1;
10801            }
10802            0
10803        }
10804    }
10805
10806    impl fidl::encoding::ValueTypeMarker for SourceState {
10807        type Borrowed<'a> = &'a Self;
10808        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10809            value
10810        }
10811    }
10812
10813    unsafe impl fidl::encoding::TypeMarker for SourceState {
10814        type Owned = Self;
10815
10816        #[inline(always)]
10817        fn inline_align(_context: fidl::encoding::Context) -> usize {
10818            8
10819        }
10820
10821        #[inline(always)]
10822        fn inline_size(_context: fidl::encoding::Context) -> usize {
10823            16
10824        }
10825    }
10826
10827    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SourceState, D>
10828        for &SourceState
10829    {
10830        unsafe fn encode(
10831            self,
10832            encoder: &mut fidl::encoding::Encoder<'_, D>,
10833            offset: usize,
10834            mut depth: fidl::encoding::Depth,
10835        ) -> fidl::Result<()> {
10836            encoder.debug_check_bounds::<SourceState>(offset);
10837            // Vector header
10838            let max_ordinal: u64 = self.max_ordinal_present();
10839            encoder.write_num(max_ordinal, offset);
10840            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10841            // Calling encoder.out_of_line_offset(0) is not allowed.
10842            if max_ordinal == 0 {
10843                return Ok(());
10844            }
10845            depth.increment()?;
10846            let envelope_size = 8;
10847            let bytes_len = max_ordinal as usize * envelope_size;
10848            #[allow(unused_variables)]
10849            let offset = encoder.out_of_line_offset(bytes_len);
10850            let mut _prev_end_offset: usize = 0;
10851            if 1 > max_ordinal {
10852                return Ok(());
10853            }
10854
10855            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10856            // are envelope_size bytes.
10857            let cur_offset: usize = (1 - 1) * envelope_size;
10858
10859            // Zero reserved fields.
10860            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10861
10862            // Safety:
10863            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10864            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10865            //   envelope_size bytes, there is always sufficient room.
10866            fidl::encoding::encode_in_envelope_optional::<DeviceStateSource, D>(
10867                self.source
10868                    .as_ref()
10869                    .map(<DeviceStateSource as fidl::encoding::ValueTypeMarker>::borrow),
10870                encoder,
10871                offset + cur_offset,
10872                depth,
10873            )?;
10874
10875            _prev_end_offset = cur_offset + envelope_size;
10876            if 2 > max_ordinal {
10877                return Ok(());
10878            }
10879
10880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10881            // are envelope_size bytes.
10882            let cur_offset: usize = (2 - 1) * envelope_size;
10883
10884            // Zero reserved fields.
10885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10886
10887            // Safety:
10888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10890            //   envelope_size bytes, there is always sufficient room.
10891            fidl::encoding::encode_in_envelope_optional::<DeviceState, D>(
10892                self.state.as_ref().map(<DeviceState as fidl::encoding::ValueTypeMarker>::borrow),
10893                encoder,
10894                offset + cur_offset,
10895                depth,
10896            )?;
10897
10898            _prev_end_offset = cur_offset + envelope_size;
10899
10900            Ok(())
10901        }
10902    }
10903
10904    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SourceState {
10905        #[inline(always)]
10906        fn new_empty() -> Self {
10907            Self::default()
10908        }
10909
10910        unsafe fn decode(
10911            &mut self,
10912            decoder: &mut fidl::encoding::Decoder<'_, D>,
10913            offset: usize,
10914            mut depth: fidl::encoding::Depth,
10915        ) -> fidl::Result<()> {
10916            decoder.debug_check_bounds::<Self>(offset);
10917            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10918                None => return Err(fidl::Error::NotNullable),
10919                Some(len) => len,
10920            };
10921            // Calling decoder.out_of_line_offset(0) is not allowed.
10922            if len == 0 {
10923                return Ok(());
10924            };
10925            depth.increment()?;
10926            let envelope_size = 8;
10927            let bytes_len = len * envelope_size;
10928            let offset = decoder.out_of_line_offset(bytes_len)?;
10929            // Decode the envelope for each type.
10930            let mut _next_ordinal_to_read = 0;
10931            let mut next_offset = offset;
10932            let end_offset = offset + bytes_len;
10933            _next_ordinal_to_read += 1;
10934            if next_offset >= end_offset {
10935                return Ok(());
10936            }
10937
10938            // Decode unknown envelopes for gaps in ordinals.
10939            while _next_ordinal_to_read < 1 {
10940                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10941                _next_ordinal_to_read += 1;
10942                next_offset += envelope_size;
10943            }
10944
10945            let next_out_of_line = decoder.next_out_of_line();
10946            let handles_before = decoder.remaining_handles();
10947            if let Some((inlined, num_bytes, num_handles)) =
10948                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10949            {
10950                let member_inline_size =
10951                    <DeviceStateSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10952                if inlined != (member_inline_size <= 4) {
10953                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10954                }
10955                let inner_offset;
10956                let mut inner_depth = depth.clone();
10957                if inlined {
10958                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10959                    inner_offset = next_offset;
10960                } else {
10961                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10962                    inner_depth.increment()?;
10963                }
10964                let val_ref =
10965                    self.source.get_or_insert_with(|| fidl::new_empty!(DeviceStateSource, D));
10966                fidl::decode!(DeviceStateSource, D, val_ref, decoder, inner_offset, inner_depth)?;
10967                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10968                {
10969                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10970                }
10971                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10972                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10973                }
10974            }
10975
10976            next_offset += envelope_size;
10977            _next_ordinal_to_read += 1;
10978            if next_offset >= end_offset {
10979                return Ok(());
10980            }
10981
10982            // Decode unknown envelopes for gaps in ordinals.
10983            while _next_ordinal_to_read < 2 {
10984                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10985                _next_ordinal_to_read += 1;
10986                next_offset += envelope_size;
10987            }
10988
10989            let next_out_of_line = decoder.next_out_of_line();
10990            let handles_before = decoder.remaining_handles();
10991            if let Some((inlined, num_bytes, num_handles)) =
10992                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10993            {
10994                let member_inline_size =
10995                    <DeviceState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10996                if inlined != (member_inline_size <= 4) {
10997                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10998                }
10999                let inner_offset;
11000                let mut inner_depth = depth.clone();
11001                if inlined {
11002                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11003                    inner_offset = next_offset;
11004                } else {
11005                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11006                    inner_depth.increment()?;
11007                }
11008                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(DeviceState, D));
11009                fidl::decode!(DeviceState, D, val_ref, decoder, inner_offset, inner_depth)?;
11010                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11011                {
11012                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11013                }
11014                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11015                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11016                }
11017            }
11018
11019            next_offset += envelope_size;
11020
11021            // Decode the remaining unknown envelopes.
11022            while next_offset < end_offset {
11023                _next_ordinal_to_read += 1;
11024                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11025                next_offset += envelope_size;
11026            }
11027
11028            Ok(())
11029        }
11030    }
11031
11032    impl Theme {
11033        #[inline(always)]
11034        fn max_ordinal_present(&self) -> u64 {
11035            if let Some(_) = self.theme_mode {
11036                return 2;
11037            }
11038            if let Some(_) = self.theme_type {
11039                return 1;
11040            }
11041            0
11042        }
11043    }
11044
11045    impl fidl::encoding::ValueTypeMarker for Theme {
11046        type Borrowed<'a> = &'a Self;
11047        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11048            value
11049        }
11050    }
11051
11052    unsafe impl fidl::encoding::TypeMarker for Theme {
11053        type Owned = Self;
11054
11055        #[inline(always)]
11056        fn inline_align(_context: fidl::encoding::Context) -> usize {
11057            8
11058        }
11059
11060        #[inline(always)]
11061        fn inline_size(_context: fidl::encoding::Context) -> usize {
11062            16
11063        }
11064    }
11065
11066    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Theme, D> for &Theme {
11067        unsafe fn encode(
11068            self,
11069            encoder: &mut fidl::encoding::Encoder<'_, D>,
11070            offset: usize,
11071            mut depth: fidl::encoding::Depth,
11072        ) -> fidl::Result<()> {
11073            encoder.debug_check_bounds::<Theme>(offset);
11074            // Vector header
11075            let max_ordinal: u64 = self.max_ordinal_present();
11076            encoder.write_num(max_ordinal, offset);
11077            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11078            // Calling encoder.out_of_line_offset(0) is not allowed.
11079            if max_ordinal == 0 {
11080                return Ok(());
11081            }
11082            depth.increment()?;
11083            let envelope_size = 8;
11084            let bytes_len = max_ordinal as usize * envelope_size;
11085            #[allow(unused_variables)]
11086            let offset = encoder.out_of_line_offset(bytes_len);
11087            let mut _prev_end_offset: usize = 0;
11088            if 1 > max_ordinal {
11089                return Ok(());
11090            }
11091
11092            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11093            // are envelope_size bytes.
11094            let cur_offset: usize = (1 - 1) * envelope_size;
11095
11096            // Zero reserved fields.
11097            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11098
11099            // Safety:
11100            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11101            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11102            //   envelope_size bytes, there is always sufficient room.
11103            fidl::encoding::encode_in_envelope_optional::<ThemeType, D>(
11104                self.theme_type
11105                    .as_ref()
11106                    .map(<ThemeType as fidl::encoding::ValueTypeMarker>::borrow),
11107                encoder,
11108                offset + cur_offset,
11109                depth,
11110            )?;
11111
11112            _prev_end_offset = cur_offset + envelope_size;
11113            if 2 > max_ordinal {
11114                return Ok(());
11115            }
11116
11117            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11118            // are envelope_size bytes.
11119            let cur_offset: usize = (2 - 1) * envelope_size;
11120
11121            // Zero reserved fields.
11122            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11123
11124            // Safety:
11125            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11126            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11127            //   envelope_size bytes, there is always sufficient room.
11128            fidl::encoding::encode_in_envelope_optional::<ThemeMode, D>(
11129                self.theme_mode
11130                    .as_ref()
11131                    .map(<ThemeMode as fidl::encoding::ValueTypeMarker>::borrow),
11132                encoder,
11133                offset + cur_offset,
11134                depth,
11135            )?;
11136
11137            _prev_end_offset = cur_offset + envelope_size;
11138
11139            Ok(())
11140        }
11141    }
11142
11143    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Theme {
11144        #[inline(always)]
11145        fn new_empty() -> Self {
11146            Self::default()
11147        }
11148
11149        unsafe fn decode(
11150            &mut self,
11151            decoder: &mut fidl::encoding::Decoder<'_, D>,
11152            offset: usize,
11153            mut depth: fidl::encoding::Depth,
11154        ) -> fidl::Result<()> {
11155            decoder.debug_check_bounds::<Self>(offset);
11156            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11157                None => return Err(fidl::Error::NotNullable),
11158                Some(len) => len,
11159            };
11160            // Calling decoder.out_of_line_offset(0) is not allowed.
11161            if len == 0 {
11162                return Ok(());
11163            };
11164            depth.increment()?;
11165            let envelope_size = 8;
11166            let bytes_len = len * envelope_size;
11167            let offset = decoder.out_of_line_offset(bytes_len)?;
11168            // Decode the envelope for each type.
11169            let mut _next_ordinal_to_read = 0;
11170            let mut next_offset = offset;
11171            let end_offset = offset + bytes_len;
11172            _next_ordinal_to_read += 1;
11173            if next_offset >= end_offset {
11174                return Ok(());
11175            }
11176
11177            // Decode unknown envelopes for gaps in ordinals.
11178            while _next_ordinal_to_read < 1 {
11179                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11180                _next_ordinal_to_read += 1;
11181                next_offset += envelope_size;
11182            }
11183
11184            let next_out_of_line = decoder.next_out_of_line();
11185            let handles_before = decoder.remaining_handles();
11186            if let Some((inlined, num_bytes, num_handles)) =
11187                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11188            {
11189                let member_inline_size =
11190                    <ThemeType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11191                if inlined != (member_inline_size <= 4) {
11192                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11193                }
11194                let inner_offset;
11195                let mut inner_depth = depth.clone();
11196                if inlined {
11197                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11198                    inner_offset = next_offset;
11199                } else {
11200                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11201                    inner_depth.increment()?;
11202                }
11203                let val_ref = self.theme_type.get_or_insert_with(|| fidl::new_empty!(ThemeType, D));
11204                fidl::decode!(ThemeType, D, val_ref, decoder, inner_offset, inner_depth)?;
11205                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11206                {
11207                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11208                }
11209                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11210                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11211                }
11212            }
11213
11214            next_offset += envelope_size;
11215            _next_ordinal_to_read += 1;
11216            if next_offset >= end_offset {
11217                return Ok(());
11218            }
11219
11220            // Decode unknown envelopes for gaps in ordinals.
11221            while _next_ordinal_to_read < 2 {
11222                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11223                _next_ordinal_to_read += 1;
11224                next_offset += envelope_size;
11225            }
11226
11227            let next_out_of_line = decoder.next_out_of_line();
11228            let handles_before = decoder.remaining_handles();
11229            if let Some((inlined, num_bytes, num_handles)) =
11230                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11231            {
11232                let member_inline_size =
11233                    <ThemeMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11234                if inlined != (member_inline_size <= 4) {
11235                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11236                }
11237                let inner_offset;
11238                let mut inner_depth = depth.clone();
11239                if inlined {
11240                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11241                    inner_offset = next_offset;
11242                } else {
11243                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11244                    inner_depth.increment()?;
11245                }
11246                let val_ref = self.theme_mode.get_or_insert_with(|| fidl::new_empty!(ThemeMode, D));
11247                fidl::decode!(ThemeMode, D, val_ref, decoder, inner_offset, inner_depth)?;
11248                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11249                {
11250                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11251                }
11252                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11253                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11254                }
11255            }
11256
11257            next_offset += envelope_size;
11258
11259            // Decode the remaining unknown envelopes.
11260            while next_offset < end_offset {
11261                _next_ordinal_to_read += 1;
11262                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11263                next_offset += envelope_size;
11264            }
11265
11266            Ok(())
11267        }
11268    }
11269
11270    impl Volume {
11271        #[inline(always)]
11272        fn max_ordinal_present(&self) -> u64 {
11273            if let Some(_) = self.muted {
11274                return 2;
11275            }
11276            if let Some(_) = self.level {
11277                return 1;
11278            }
11279            0
11280        }
11281    }
11282
11283    impl fidl::encoding::ValueTypeMarker for Volume {
11284        type Borrowed<'a> = &'a Self;
11285        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11286            value
11287        }
11288    }
11289
11290    unsafe impl fidl::encoding::TypeMarker for Volume {
11291        type Owned = Self;
11292
11293        #[inline(always)]
11294        fn inline_align(_context: fidl::encoding::Context) -> usize {
11295            8
11296        }
11297
11298        #[inline(always)]
11299        fn inline_size(_context: fidl::encoding::Context) -> usize {
11300            16
11301        }
11302    }
11303
11304    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Volume, D> for &Volume {
11305        unsafe fn encode(
11306            self,
11307            encoder: &mut fidl::encoding::Encoder<'_, D>,
11308            offset: usize,
11309            mut depth: fidl::encoding::Depth,
11310        ) -> fidl::Result<()> {
11311            encoder.debug_check_bounds::<Volume>(offset);
11312            // Vector header
11313            let max_ordinal: u64 = self.max_ordinal_present();
11314            encoder.write_num(max_ordinal, offset);
11315            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11316            // Calling encoder.out_of_line_offset(0) is not allowed.
11317            if max_ordinal == 0 {
11318                return Ok(());
11319            }
11320            depth.increment()?;
11321            let envelope_size = 8;
11322            let bytes_len = max_ordinal as usize * envelope_size;
11323            #[allow(unused_variables)]
11324            let offset = encoder.out_of_line_offset(bytes_len);
11325            let mut _prev_end_offset: usize = 0;
11326            if 1 > max_ordinal {
11327                return Ok(());
11328            }
11329
11330            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11331            // are envelope_size bytes.
11332            let cur_offset: usize = (1 - 1) * envelope_size;
11333
11334            // Zero reserved fields.
11335            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11336
11337            // Safety:
11338            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11339            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11340            //   envelope_size bytes, there is always sufficient room.
11341            fidl::encoding::encode_in_envelope_optional::<f32, D>(
11342                self.level.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
11343                encoder,
11344                offset + cur_offset,
11345                depth,
11346            )?;
11347
11348            _prev_end_offset = cur_offset + envelope_size;
11349            if 2 > max_ordinal {
11350                return Ok(());
11351            }
11352
11353            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11354            // are envelope_size bytes.
11355            let cur_offset: usize = (2 - 1) * envelope_size;
11356
11357            // Zero reserved fields.
11358            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11359
11360            // Safety:
11361            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11362            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11363            //   envelope_size bytes, there is always sufficient room.
11364            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11365                self.muted.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11366                encoder,
11367                offset + cur_offset,
11368                depth,
11369            )?;
11370
11371            _prev_end_offset = cur_offset + envelope_size;
11372
11373            Ok(())
11374        }
11375    }
11376
11377    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Volume {
11378        #[inline(always)]
11379        fn new_empty() -> Self {
11380            Self::default()
11381        }
11382
11383        unsafe fn decode(
11384            &mut self,
11385            decoder: &mut fidl::encoding::Decoder<'_, D>,
11386            offset: usize,
11387            mut depth: fidl::encoding::Depth,
11388        ) -> fidl::Result<()> {
11389            decoder.debug_check_bounds::<Self>(offset);
11390            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11391                None => return Err(fidl::Error::NotNullable),
11392                Some(len) => len,
11393            };
11394            // Calling decoder.out_of_line_offset(0) is not allowed.
11395            if len == 0 {
11396                return Ok(());
11397            };
11398            depth.increment()?;
11399            let envelope_size = 8;
11400            let bytes_len = len * envelope_size;
11401            let offset = decoder.out_of_line_offset(bytes_len)?;
11402            // Decode the envelope for each type.
11403            let mut _next_ordinal_to_read = 0;
11404            let mut next_offset = offset;
11405            let end_offset = offset + bytes_len;
11406            _next_ordinal_to_read += 1;
11407            if next_offset >= end_offset {
11408                return Ok(());
11409            }
11410
11411            // Decode unknown envelopes for gaps in ordinals.
11412            while _next_ordinal_to_read < 1 {
11413                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11414                _next_ordinal_to_read += 1;
11415                next_offset += envelope_size;
11416            }
11417
11418            let next_out_of_line = decoder.next_out_of_line();
11419            let handles_before = decoder.remaining_handles();
11420            if let Some((inlined, num_bytes, num_handles)) =
11421                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11422            {
11423                let member_inline_size =
11424                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11425                if inlined != (member_inline_size <= 4) {
11426                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11427                }
11428                let inner_offset;
11429                let mut inner_depth = depth.clone();
11430                if inlined {
11431                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11432                    inner_offset = next_offset;
11433                } else {
11434                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11435                    inner_depth.increment()?;
11436                }
11437                let val_ref = self.level.get_or_insert_with(|| fidl::new_empty!(f32, D));
11438                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
11439                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11440                {
11441                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11442                }
11443                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11444                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11445                }
11446            }
11447
11448            next_offset += envelope_size;
11449            _next_ordinal_to_read += 1;
11450            if next_offset >= end_offset {
11451                return Ok(());
11452            }
11453
11454            // Decode unknown envelopes for gaps in ordinals.
11455            while _next_ordinal_to_read < 2 {
11456                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11457                _next_ordinal_to_read += 1;
11458                next_offset += envelope_size;
11459            }
11460
11461            let next_out_of_line = decoder.next_out_of_line();
11462            let handles_before = decoder.remaining_handles();
11463            if let Some((inlined, num_bytes, num_handles)) =
11464                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11465            {
11466                let member_inline_size =
11467                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11468                if inlined != (member_inline_size <= 4) {
11469                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11470                }
11471                let inner_offset;
11472                let mut inner_depth = depth.clone();
11473                if inlined {
11474                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11475                    inner_offset = next_offset;
11476                } else {
11477                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11478                    inner_depth.increment()?;
11479                }
11480                let val_ref = self.muted.get_or_insert_with(|| fidl::new_empty!(bool, D));
11481                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11482                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11483                {
11484                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11485                }
11486                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11487                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11488                }
11489            }
11490
11491            next_offset += envelope_size;
11492
11493            // Decode the remaining unknown envelopes.
11494            while next_offset < end_offset {
11495                _next_ordinal_to_read += 1;
11496                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11497                next_offset += envelope_size;
11498            }
11499
11500            Ok(())
11501        }
11502    }
11503
11504    impl fidl::encoding::ValueTypeMarker for LightValue {
11505        type Borrowed<'a> = &'a Self;
11506        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11507            value
11508        }
11509    }
11510
11511    unsafe impl fidl::encoding::TypeMarker for LightValue {
11512        type Owned = Self;
11513
11514        #[inline(always)]
11515        fn inline_align(_context: fidl::encoding::Context) -> usize {
11516            8
11517        }
11518
11519        #[inline(always)]
11520        fn inline_size(_context: fidl::encoding::Context) -> usize {
11521            16
11522        }
11523    }
11524
11525    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightValue, D>
11526        for &LightValue
11527    {
11528        #[inline]
11529        unsafe fn encode(
11530            self,
11531            encoder: &mut fidl::encoding::Encoder<'_, D>,
11532            offset: usize,
11533            _depth: fidl::encoding::Depth,
11534        ) -> fidl::Result<()> {
11535            encoder.debug_check_bounds::<LightValue>(offset);
11536            encoder.write_num::<u64>(self.ordinal(), offset);
11537            match self {
11538                LightValue::On(ref val) => fidl::encoding::encode_in_envelope::<bool, D>(
11539                    <bool as fidl::encoding::ValueTypeMarker>::borrow(val),
11540                    encoder,
11541                    offset + 8,
11542                    _depth,
11543                ),
11544                LightValue::Brightness(ref val) => fidl::encoding::encode_in_envelope::<f64, D>(
11545                    <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
11546                    encoder,
11547                    offset + 8,
11548                    _depth,
11549                ),
11550                LightValue::Color(ref val) => fidl::encoding::encode_in_envelope::<
11551                    fidl_fuchsia_ui_types::ColorRgb,
11552                    D,
11553                >(
11554                    <fidl_fuchsia_ui_types::ColorRgb as fidl::encoding::ValueTypeMarker>::borrow(
11555                        val,
11556                    ),
11557                    encoder,
11558                    offset + 8,
11559                    _depth,
11560                ),
11561            }
11562        }
11563    }
11564
11565    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightValue {
11566        #[inline(always)]
11567        fn new_empty() -> Self {
11568            Self::On(fidl::new_empty!(bool, D))
11569        }
11570
11571        #[inline]
11572        unsafe fn decode(
11573            &mut self,
11574            decoder: &mut fidl::encoding::Decoder<'_, D>,
11575            offset: usize,
11576            mut depth: fidl::encoding::Depth,
11577        ) -> fidl::Result<()> {
11578            decoder.debug_check_bounds::<Self>(offset);
11579            #[allow(unused_variables)]
11580            let next_out_of_line = decoder.next_out_of_line();
11581            let handles_before = decoder.remaining_handles();
11582            let (ordinal, inlined, num_bytes, num_handles) =
11583                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11584
11585            let member_inline_size = match ordinal {
11586                1 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11587                2 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11588                3 => <fidl_fuchsia_ui_types::ColorRgb as fidl::encoding::TypeMarker>::inline_size(
11589                    decoder.context,
11590                ),
11591                _ => return Err(fidl::Error::UnknownUnionTag),
11592            };
11593
11594            if inlined != (member_inline_size <= 4) {
11595                return Err(fidl::Error::InvalidInlineBitInEnvelope);
11596            }
11597            let _inner_offset;
11598            if inlined {
11599                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11600                _inner_offset = offset + 8;
11601            } else {
11602                depth.increment()?;
11603                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11604            }
11605            match ordinal {
11606                1 => {
11607                    #[allow(irrefutable_let_patterns)]
11608                    if let LightValue::On(_) = self {
11609                        // Do nothing, read the value into the object
11610                    } else {
11611                        // Initialize `self` to the right variant
11612                        *self = LightValue::On(fidl::new_empty!(bool, D));
11613                    }
11614                    #[allow(irrefutable_let_patterns)]
11615                    if let LightValue::On(ref mut val) = self {
11616                        fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
11617                    } else {
11618                        unreachable!()
11619                    }
11620                }
11621                2 => {
11622                    #[allow(irrefutable_let_patterns)]
11623                    if let LightValue::Brightness(_) = self {
11624                        // Do nothing, read the value into the object
11625                    } else {
11626                        // Initialize `self` to the right variant
11627                        *self = LightValue::Brightness(fidl::new_empty!(f64, D));
11628                    }
11629                    #[allow(irrefutable_let_patterns)]
11630                    if let LightValue::Brightness(ref mut val) = self {
11631                        fidl::decode!(f64, D, val, decoder, _inner_offset, depth)?;
11632                    } else {
11633                        unreachable!()
11634                    }
11635                }
11636                3 => {
11637                    #[allow(irrefutable_let_patterns)]
11638                    if let LightValue::Color(_) = self {
11639                        // Do nothing, read the value into the object
11640                    } else {
11641                        // Initialize `self` to the right variant
11642                        *self =
11643                            LightValue::Color(fidl::new_empty!(fidl_fuchsia_ui_types::ColorRgb, D));
11644                    }
11645                    #[allow(irrefutable_let_patterns)]
11646                    if let LightValue::Color(ref mut val) = self {
11647                        fidl::decode!(
11648                            fidl_fuchsia_ui_types::ColorRgb,
11649                            D,
11650                            val,
11651                            decoder,
11652                            _inner_offset,
11653                            depth
11654                        )?;
11655                    } else {
11656                        unreachable!()
11657                    }
11658                }
11659                ordinal => panic!("unexpected ordinal {:?}", ordinal),
11660            }
11661            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11662                return Err(fidl::Error::InvalidNumBytesInEnvelope);
11663            }
11664            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11665                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11666            }
11667            Ok(())
11668        }
11669    }
11670}