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__common::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__common::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__common::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__common::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__common::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__common::LocaleId>>,
909    /// The preferred temperature unit.
910    pub temperature_unit: Option<fidl_fuchsia_intl__common::TemperatureUnit>,
911    /// The currently set time zone.
912    pub time_zone_id: Option<fidl_fuchsia_intl__common::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__common::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__common::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__common::AudioRenderUsage, D>(
5555            self.stream.as_ref().map(<fidl_fuchsia_media__common::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__common::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__common::AudioRenderUsage, D)
5674                });
5675                fidl::decode!(
5676                    fidl_fuchsia_media__common::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__common::AudioRenderUsage2, D>(
5879            self.stream.as_ref().map(<fidl_fuchsia_media__common::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__common::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__common::AudioRenderUsage2, D)
5998                });
5999                fidl::decode!(
6000                    fidl_fuchsia_media__common::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__common::ColorRgba, D>(
6231            self.color.as_ref().map(<fidl_fuchsia_ui_types__common::ColorRgba as fidl::encoding::ValueTypeMarker>::borrow),
6232            encoder, offset + cur_offset, depth
6233        )?;
6234
6235            _prev_end_offset = cur_offset + envelope_size;
6236            if 3 > max_ordinal {
6237                return Ok(());
6238            }
6239
6240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6241            // are envelope_size bytes.
6242            let cur_offset: usize = (3 - 1) * envelope_size;
6243
6244            // Zero reserved fields.
6245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6246
6247            // Safety:
6248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6250            //   envelope_size bytes, there is always sufficient room.
6251            fidl::encoding::encode_in_envelope_optional::<f32, D>(
6252                self.relative_size.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
6253                encoder,
6254                offset + cur_offset,
6255                depth,
6256            )?;
6257
6258            _prev_end_offset = cur_offset + envelope_size;
6259            if 4 > max_ordinal {
6260                return Ok(());
6261            }
6262
6263            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6264            // are envelope_size bytes.
6265            let cur_offset: usize = (4 - 1) * envelope_size;
6266
6267            // Zero reserved fields.
6268            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6269
6270            // Safety:
6271            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6272            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6273            //   envelope_size bytes, there is always sufficient room.
6274            fidl::encoding::encode_in_envelope_optional::<EdgeStyle, D>(
6275                self.char_edge_style
6276                    .as_ref()
6277                    .map(<EdgeStyle as fidl::encoding::ValueTypeMarker>::borrow),
6278                encoder,
6279                offset + cur_offset,
6280                depth,
6281            )?;
6282
6283            _prev_end_offset = cur_offset + envelope_size;
6284
6285            Ok(())
6286        }
6287    }
6288
6289    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CaptionFontStyle {
6290        #[inline(always)]
6291        fn new_empty() -> Self {
6292            Self::default()
6293        }
6294
6295        unsafe fn decode(
6296            &mut self,
6297            decoder: &mut fidl::encoding::Decoder<'_, D>,
6298            offset: usize,
6299            mut depth: fidl::encoding::Depth,
6300        ) -> fidl::Result<()> {
6301            decoder.debug_check_bounds::<Self>(offset);
6302            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6303                None => return Err(fidl::Error::NotNullable),
6304                Some(len) => len,
6305            };
6306            // Calling decoder.out_of_line_offset(0) is not allowed.
6307            if len == 0 {
6308                return Ok(());
6309            };
6310            depth.increment()?;
6311            let envelope_size = 8;
6312            let bytes_len = len * envelope_size;
6313            let offset = decoder.out_of_line_offset(bytes_len)?;
6314            // Decode the envelope for each type.
6315            let mut _next_ordinal_to_read = 0;
6316            let mut next_offset = offset;
6317            let end_offset = offset + bytes_len;
6318            _next_ordinal_to_read += 1;
6319            if next_offset >= end_offset {
6320                return Ok(());
6321            }
6322
6323            // Decode unknown envelopes for gaps in ordinals.
6324            while _next_ordinal_to_read < 1 {
6325                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6326                _next_ordinal_to_read += 1;
6327                next_offset += envelope_size;
6328            }
6329
6330            let next_out_of_line = decoder.next_out_of_line();
6331            let handles_before = decoder.remaining_handles();
6332            if let Some((inlined, num_bytes, num_handles)) =
6333                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6334            {
6335                let member_inline_size =
6336                    <CaptionFontFamily as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6337                if inlined != (member_inline_size <= 4) {
6338                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6339                }
6340                let inner_offset;
6341                let mut inner_depth = depth.clone();
6342                if inlined {
6343                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6344                    inner_offset = next_offset;
6345                } else {
6346                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6347                    inner_depth.increment()?;
6348                }
6349                let val_ref =
6350                    self.family.get_or_insert_with(|| fidl::new_empty!(CaptionFontFamily, D));
6351                fidl::decode!(CaptionFontFamily, D, val_ref, decoder, inner_offset, inner_depth)?;
6352                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6353                {
6354                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6355                }
6356                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6357                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6358                }
6359            }
6360
6361            next_offset += envelope_size;
6362            _next_ordinal_to_read += 1;
6363            if next_offset >= end_offset {
6364                return Ok(());
6365            }
6366
6367            // Decode unknown envelopes for gaps in ordinals.
6368            while _next_ordinal_to_read < 2 {
6369                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6370                _next_ordinal_to_read += 1;
6371                next_offset += envelope_size;
6372            }
6373
6374            let next_out_of_line = decoder.next_out_of_line();
6375            let handles_before = decoder.remaining_handles();
6376            if let Some((inlined, num_bytes, num_handles)) =
6377                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6378            {
6379                let member_inline_size = <fidl_fuchsia_ui_types__common::ColorRgba as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6380                if inlined != (member_inline_size <= 4) {
6381                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6382                }
6383                let inner_offset;
6384                let mut inner_depth = depth.clone();
6385                if inlined {
6386                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6387                    inner_offset = next_offset;
6388                } else {
6389                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6390                    inner_depth.increment()?;
6391                }
6392                let val_ref = self.color.get_or_insert_with(|| {
6393                    fidl::new_empty!(fidl_fuchsia_ui_types__common::ColorRgba, D)
6394                });
6395                fidl::decode!(
6396                    fidl_fuchsia_ui_types__common::ColorRgba,
6397                    D,
6398                    val_ref,
6399                    decoder,
6400                    inner_offset,
6401                    inner_depth
6402                )?;
6403                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6404                {
6405                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6406                }
6407                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6408                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6409                }
6410            }
6411
6412            next_offset += envelope_size;
6413            _next_ordinal_to_read += 1;
6414            if next_offset >= end_offset {
6415                return Ok(());
6416            }
6417
6418            // Decode unknown envelopes for gaps in ordinals.
6419            while _next_ordinal_to_read < 3 {
6420                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6421                _next_ordinal_to_read += 1;
6422                next_offset += envelope_size;
6423            }
6424
6425            let next_out_of_line = decoder.next_out_of_line();
6426            let handles_before = decoder.remaining_handles();
6427            if let Some((inlined, num_bytes, num_handles)) =
6428                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6429            {
6430                let member_inline_size =
6431                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6432                if inlined != (member_inline_size <= 4) {
6433                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6434                }
6435                let inner_offset;
6436                let mut inner_depth = depth.clone();
6437                if inlined {
6438                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6439                    inner_offset = next_offset;
6440                } else {
6441                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6442                    inner_depth.increment()?;
6443                }
6444                let val_ref = self.relative_size.get_or_insert_with(|| fidl::new_empty!(f32, D));
6445                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
6446                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6447                {
6448                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6449                }
6450                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6451                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6452                }
6453            }
6454
6455            next_offset += envelope_size;
6456            _next_ordinal_to_read += 1;
6457            if next_offset >= end_offset {
6458                return Ok(());
6459            }
6460
6461            // Decode unknown envelopes for gaps in ordinals.
6462            while _next_ordinal_to_read < 4 {
6463                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6464                _next_ordinal_to_read += 1;
6465                next_offset += envelope_size;
6466            }
6467
6468            let next_out_of_line = decoder.next_out_of_line();
6469            let handles_before = decoder.remaining_handles();
6470            if let Some((inlined, num_bytes, num_handles)) =
6471                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6472            {
6473                let member_inline_size =
6474                    <EdgeStyle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6475                if inlined != (member_inline_size <= 4) {
6476                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6477                }
6478                let inner_offset;
6479                let mut inner_depth = depth.clone();
6480                if inlined {
6481                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6482                    inner_offset = next_offset;
6483                } else {
6484                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6485                    inner_depth.increment()?;
6486                }
6487                let val_ref =
6488                    self.char_edge_style.get_or_insert_with(|| fidl::new_empty!(EdgeStyle, D));
6489                fidl::decode!(EdgeStyle, D, val_ref, decoder, inner_offset, inner_depth)?;
6490                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6491                {
6492                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6493                }
6494                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6495                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6496                }
6497            }
6498
6499            next_offset += envelope_size;
6500
6501            // Decode the remaining unknown envelopes.
6502            while next_offset < end_offset {
6503                _next_ordinal_to_read += 1;
6504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6505                next_offset += envelope_size;
6506            }
6507
6508            Ok(())
6509        }
6510    }
6511
6512    impl CaptionsSettings {
6513        #[inline(always)]
6514        fn max_ordinal_present(&self) -> u64 {
6515            if let Some(_) = self.background_color {
6516                return 5;
6517            }
6518            if let Some(_) = self.window_color {
6519                return 4;
6520            }
6521            if let Some(_) = self.font_style {
6522                return 3;
6523            }
6524            if let Some(_) = self.for_tts {
6525                return 2;
6526            }
6527            if let Some(_) = self.for_media {
6528                return 1;
6529            }
6530            0
6531        }
6532    }
6533
6534    impl fidl::encoding::ValueTypeMarker for CaptionsSettings {
6535        type Borrowed<'a> = &'a Self;
6536        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6537            value
6538        }
6539    }
6540
6541    unsafe impl fidl::encoding::TypeMarker for CaptionsSettings {
6542        type Owned = Self;
6543
6544        #[inline(always)]
6545        fn inline_align(_context: fidl::encoding::Context) -> usize {
6546            8
6547        }
6548
6549        #[inline(always)]
6550        fn inline_size(_context: fidl::encoding::Context) -> usize {
6551            16
6552        }
6553    }
6554
6555    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CaptionsSettings, D>
6556        for &CaptionsSettings
6557    {
6558        unsafe fn encode(
6559            self,
6560            encoder: &mut fidl::encoding::Encoder<'_, D>,
6561            offset: usize,
6562            mut depth: fidl::encoding::Depth,
6563        ) -> fidl::Result<()> {
6564            encoder.debug_check_bounds::<CaptionsSettings>(offset);
6565            // Vector header
6566            let max_ordinal: u64 = self.max_ordinal_present();
6567            encoder.write_num(max_ordinal, offset);
6568            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6569            // Calling encoder.out_of_line_offset(0) is not allowed.
6570            if max_ordinal == 0 {
6571                return Ok(());
6572            }
6573            depth.increment()?;
6574            let envelope_size = 8;
6575            let bytes_len = max_ordinal as usize * envelope_size;
6576            #[allow(unused_variables)]
6577            let offset = encoder.out_of_line_offset(bytes_len);
6578            let mut _prev_end_offset: usize = 0;
6579            if 1 > max_ordinal {
6580                return Ok(());
6581            }
6582
6583            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6584            // are envelope_size bytes.
6585            let cur_offset: usize = (1 - 1) * envelope_size;
6586
6587            // Zero reserved fields.
6588            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6589
6590            // Safety:
6591            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6592            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6593            //   envelope_size bytes, there is always sufficient room.
6594            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6595                self.for_media.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6596                encoder,
6597                offset + cur_offset,
6598                depth,
6599            )?;
6600
6601            _prev_end_offset = cur_offset + envelope_size;
6602            if 2 > max_ordinal {
6603                return Ok(());
6604            }
6605
6606            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6607            // are envelope_size bytes.
6608            let cur_offset: usize = (2 - 1) * envelope_size;
6609
6610            // Zero reserved fields.
6611            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6612
6613            // Safety:
6614            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6615            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6616            //   envelope_size bytes, there is always sufficient room.
6617            fidl::encoding::encode_in_envelope_optional::<bool, D>(
6618                self.for_tts.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
6619                encoder,
6620                offset + cur_offset,
6621                depth,
6622            )?;
6623
6624            _prev_end_offset = cur_offset + envelope_size;
6625            if 3 > max_ordinal {
6626                return Ok(());
6627            }
6628
6629            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6630            // are envelope_size bytes.
6631            let cur_offset: usize = (3 - 1) * envelope_size;
6632
6633            // Zero reserved fields.
6634            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6635
6636            // Safety:
6637            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6638            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6639            //   envelope_size bytes, there is always sufficient room.
6640            fidl::encoding::encode_in_envelope_optional::<CaptionFontStyle, D>(
6641                self.font_style
6642                    .as_ref()
6643                    .map(<CaptionFontStyle as fidl::encoding::ValueTypeMarker>::borrow),
6644                encoder,
6645                offset + cur_offset,
6646                depth,
6647            )?;
6648
6649            _prev_end_offset = cur_offset + envelope_size;
6650            if 4 > max_ordinal {
6651                return Ok(());
6652            }
6653
6654            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6655            // are envelope_size bytes.
6656            let cur_offset: usize = (4 - 1) * envelope_size;
6657
6658            // Zero reserved fields.
6659            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6660
6661            // Safety:
6662            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6663            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6664            //   envelope_size bytes, there is always sufficient room.
6665            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_types__common::ColorRgba, D>(
6666            self.window_color.as_ref().map(<fidl_fuchsia_ui_types__common::ColorRgba as fidl::encoding::ValueTypeMarker>::borrow),
6667            encoder, offset + cur_offset, depth
6668        )?;
6669
6670            _prev_end_offset = cur_offset + envelope_size;
6671            if 5 > max_ordinal {
6672                return Ok(());
6673            }
6674
6675            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6676            // are envelope_size bytes.
6677            let cur_offset: usize = (5 - 1) * envelope_size;
6678
6679            // Zero reserved fields.
6680            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6681
6682            // Safety:
6683            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6684            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6685            //   envelope_size bytes, there is always sufficient room.
6686            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_types__common::ColorRgba, D>(
6687            self.background_color.as_ref().map(<fidl_fuchsia_ui_types__common::ColorRgba as fidl::encoding::ValueTypeMarker>::borrow),
6688            encoder, offset + cur_offset, depth
6689        )?;
6690
6691            _prev_end_offset = cur_offset + envelope_size;
6692
6693            Ok(())
6694        }
6695    }
6696
6697    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CaptionsSettings {
6698        #[inline(always)]
6699        fn new_empty() -> Self {
6700            Self::default()
6701        }
6702
6703        unsafe fn decode(
6704            &mut self,
6705            decoder: &mut fidl::encoding::Decoder<'_, D>,
6706            offset: usize,
6707            mut depth: fidl::encoding::Depth,
6708        ) -> fidl::Result<()> {
6709            decoder.debug_check_bounds::<Self>(offset);
6710            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6711                None => return Err(fidl::Error::NotNullable),
6712                Some(len) => len,
6713            };
6714            // Calling decoder.out_of_line_offset(0) is not allowed.
6715            if len == 0 {
6716                return Ok(());
6717            };
6718            depth.increment()?;
6719            let envelope_size = 8;
6720            let bytes_len = len * envelope_size;
6721            let offset = decoder.out_of_line_offset(bytes_len)?;
6722            // Decode the envelope for each type.
6723            let mut _next_ordinal_to_read = 0;
6724            let mut next_offset = offset;
6725            let end_offset = offset + bytes_len;
6726            _next_ordinal_to_read += 1;
6727            if next_offset >= end_offset {
6728                return Ok(());
6729            }
6730
6731            // Decode unknown envelopes for gaps in ordinals.
6732            while _next_ordinal_to_read < 1 {
6733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6734                _next_ordinal_to_read += 1;
6735                next_offset += envelope_size;
6736            }
6737
6738            let next_out_of_line = decoder.next_out_of_line();
6739            let handles_before = decoder.remaining_handles();
6740            if let Some((inlined, num_bytes, num_handles)) =
6741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6742            {
6743                let member_inline_size =
6744                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6745                if inlined != (member_inline_size <= 4) {
6746                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6747                }
6748                let inner_offset;
6749                let mut inner_depth = depth.clone();
6750                if inlined {
6751                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6752                    inner_offset = next_offset;
6753                } else {
6754                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6755                    inner_depth.increment()?;
6756                }
6757                let val_ref = self.for_media.get_or_insert_with(|| fidl::new_empty!(bool, D));
6758                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6759                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6760                {
6761                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6762                }
6763                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6764                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6765                }
6766            }
6767
6768            next_offset += envelope_size;
6769            _next_ordinal_to_read += 1;
6770            if next_offset >= end_offset {
6771                return Ok(());
6772            }
6773
6774            // Decode unknown envelopes for gaps in ordinals.
6775            while _next_ordinal_to_read < 2 {
6776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6777                _next_ordinal_to_read += 1;
6778                next_offset += envelope_size;
6779            }
6780
6781            let next_out_of_line = decoder.next_out_of_line();
6782            let handles_before = decoder.remaining_handles();
6783            if let Some((inlined, num_bytes, num_handles)) =
6784                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6785            {
6786                let member_inline_size =
6787                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6788                if inlined != (member_inline_size <= 4) {
6789                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6790                }
6791                let inner_offset;
6792                let mut inner_depth = depth.clone();
6793                if inlined {
6794                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6795                    inner_offset = next_offset;
6796                } else {
6797                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6798                    inner_depth.increment()?;
6799                }
6800                let val_ref = self.for_tts.get_or_insert_with(|| fidl::new_empty!(bool, D));
6801                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6802                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6803                {
6804                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6805                }
6806                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6807                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6808                }
6809            }
6810
6811            next_offset += envelope_size;
6812            _next_ordinal_to_read += 1;
6813            if next_offset >= end_offset {
6814                return Ok(());
6815            }
6816
6817            // Decode unknown envelopes for gaps in ordinals.
6818            while _next_ordinal_to_read < 3 {
6819                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6820                _next_ordinal_to_read += 1;
6821                next_offset += envelope_size;
6822            }
6823
6824            let next_out_of_line = decoder.next_out_of_line();
6825            let handles_before = decoder.remaining_handles();
6826            if let Some((inlined, num_bytes, num_handles)) =
6827                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6828            {
6829                let member_inline_size =
6830                    <CaptionFontStyle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6831                if inlined != (member_inline_size <= 4) {
6832                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6833                }
6834                let inner_offset;
6835                let mut inner_depth = depth.clone();
6836                if inlined {
6837                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6838                    inner_offset = next_offset;
6839                } else {
6840                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6841                    inner_depth.increment()?;
6842                }
6843                let val_ref =
6844                    self.font_style.get_or_insert_with(|| fidl::new_empty!(CaptionFontStyle, D));
6845                fidl::decode!(CaptionFontStyle, D, val_ref, decoder, inner_offset, inner_depth)?;
6846                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6847                {
6848                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6849                }
6850                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6851                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6852                }
6853            }
6854
6855            next_offset += envelope_size;
6856            _next_ordinal_to_read += 1;
6857            if next_offset >= end_offset {
6858                return Ok(());
6859            }
6860
6861            // Decode unknown envelopes for gaps in ordinals.
6862            while _next_ordinal_to_read < 4 {
6863                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6864                _next_ordinal_to_read += 1;
6865                next_offset += envelope_size;
6866            }
6867
6868            let next_out_of_line = decoder.next_out_of_line();
6869            let handles_before = decoder.remaining_handles();
6870            if let Some((inlined, num_bytes, num_handles)) =
6871                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6872            {
6873                let member_inline_size = <fidl_fuchsia_ui_types__common::ColorRgba as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6874                if inlined != (member_inline_size <= 4) {
6875                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6876                }
6877                let inner_offset;
6878                let mut inner_depth = depth.clone();
6879                if inlined {
6880                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6881                    inner_offset = next_offset;
6882                } else {
6883                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6884                    inner_depth.increment()?;
6885                }
6886                let val_ref = self.window_color.get_or_insert_with(|| {
6887                    fidl::new_empty!(fidl_fuchsia_ui_types__common::ColorRgba, D)
6888                });
6889                fidl::decode!(
6890                    fidl_fuchsia_ui_types__common::ColorRgba,
6891                    D,
6892                    val_ref,
6893                    decoder,
6894                    inner_offset,
6895                    inner_depth
6896                )?;
6897                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6898                {
6899                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6900                }
6901                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6902                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6903                }
6904            }
6905
6906            next_offset += envelope_size;
6907            _next_ordinal_to_read += 1;
6908            if next_offset >= end_offset {
6909                return Ok(());
6910            }
6911
6912            // Decode unknown envelopes for gaps in ordinals.
6913            while _next_ordinal_to_read < 5 {
6914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6915                _next_ordinal_to_read += 1;
6916                next_offset += envelope_size;
6917            }
6918
6919            let next_out_of_line = decoder.next_out_of_line();
6920            let handles_before = decoder.remaining_handles();
6921            if let Some((inlined, num_bytes, num_handles)) =
6922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6923            {
6924                let member_inline_size = <fidl_fuchsia_ui_types__common::ColorRgba as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6925                if inlined != (member_inline_size <= 4) {
6926                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6927                }
6928                let inner_offset;
6929                let mut inner_depth = depth.clone();
6930                if inlined {
6931                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6932                    inner_offset = next_offset;
6933                } else {
6934                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6935                    inner_depth.increment()?;
6936                }
6937                let val_ref = self.background_color.get_or_insert_with(|| {
6938                    fidl::new_empty!(fidl_fuchsia_ui_types__common::ColorRgba, D)
6939                });
6940                fidl::decode!(
6941                    fidl_fuchsia_ui_types__common::ColorRgba,
6942                    D,
6943                    val_ref,
6944                    decoder,
6945                    inner_offset,
6946                    inner_depth
6947                )?;
6948                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6949                {
6950                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6951                }
6952                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6953                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6954                }
6955            }
6956
6957            next_offset += envelope_size;
6958
6959            // Decode the remaining unknown envelopes.
6960            while next_offset < end_offset {
6961                _next_ordinal_to_read += 1;
6962                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6963                next_offset += envelope_size;
6964            }
6965
6966            Ok(())
6967        }
6968    }
6969
6970    impl DeviceState {
6971        #[inline(always)]
6972        fn max_ordinal_present(&self) -> u64 {
6973            if let Some(_) = self.toggle_flags {
6974                return 1;
6975            }
6976            0
6977        }
6978    }
6979
6980    impl fidl::encoding::ValueTypeMarker for DeviceState {
6981        type Borrowed<'a> = &'a Self;
6982        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6983            value
6984        }
6985    }
6986
6987    unsafe impl fidl::encoding::TypeMarker for DeviceState {
6988        type Owned = Self;
6989
6990        #[inline(always)]
6991        fn inline_align(_context: fidl::encoding::Context) -> usize {
6992            8
6993        }
6994
6995        #[inline(always)]
6996        fn inline_size(_context: fidl::encoding::Context) -> usize {
6997            16
6998        }
6999    }
7000
7001    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceState, D>
7002        for &DeviceState
7003    {
7004        unsafe fn encode(
7005            self,
7006            encoder: &mut fidl::encoding::Encoder<'_, D>,
7007            offset: usize,
7008            mut depth: fidl::encoding::Depth,
7009        ) -> fidl::Result<()> {
7010            encoder.debug_check_bounds::<DeviceState>(offset);
7011            // Vector header
7012            let max_ordinal: u64 = self.max_ordinal_present();
7013            encoder.write_num(max_ordinal, offset);
7014            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7015            // Calling encoder.out_of_line_offset(0) is not allowed.
7016            if max_ordinal == 0 {
7017                return Ok(());
7018            }
7019            depth.increment()?;
7020            let envelope_size = 8;
7021            let bytes_len = max_ordinal as usize * envelope_size;
7022            #[allow(unused_variables)]
7023            let offset = encoder.out_of_line_offset(bytes_len);
7024            let mut _prev_end_offset: usize = 0;
7025            if 1 > max_ordinal {
7026                return Ok(());
7027            }
7028
7029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7030            // are envelope_size bytes.
7031            let cur_offset: usize = (1 - 1) * envelope_size;
7032
7033            // Zero reserved fields.
7034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7035
7036            // Safety:
7037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7039            //   envelope_size bytes, there is always sufficient room.
7040            fidl::encoding::encode_in_envelope_optional::<ToggleStateFlags, D>(
7041                self.toggle_flags
7042                    .as_ref()
7043                    .map(<ToggleStateFlags as fidl::encoding::ValueTypeMarker>::borrow),
7044                encoder,
7045                offset + cur_offset,
7046                depth,
7047            )?;
7048
7049            _prev_end_offset = cur_offset + envelope_size;
7050
7051            Ok(())
7052        }
7053    }
7054
7055    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceState {
7056        #[inline(always)]
7057        fn new_empty() -> Self {
7058            Self::default()
7059        }
7060
7061        unsafe fn decode(
7062            &mut self,
7063            decoder: &mut fidl::encoding::Decoder<'_, D>,
7064            offset: usize,
7065            mut depth: fidl::encoding::Depth,
7066        ) -> fidl::Result<()> {
7067            decoder.debug_check_bounds::<Self>(offset);
7068            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7069                None => return Err(fidl::Error::NotNullable),
7070                Some(len) => len,
7071            };
7072            // Calling decoder.out_of_line_offset(0) is not allowed.
7073            if len == 0 {
7074                return Ok(());
7075            };
7076            depth.increment()?;
7077            let envelope_size = 8;
7078            let bytes_len = len * envelope_size;
7079            let offset = decoder.out_of_line_offset(bytes_len)?;
7080            // Decode the envelope for each type.
7081            let mut _next_ordinal_to_read = 0;
7082            let mut next_offset = offset;
7083            let end_offset = offset + bytes_len;
7084            _next_ordinal_to_read += 1;
7085            if next_offset >= end_offset {
7086                return Ok(());
7087            }
7088
7089            // Decode unknown envelopes for gaps in ordinals.
7090            while _next_ordinal_to_read < 1 {
7091                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7092                _next_ordinal_to_read += 1;
7093                next_offset += envelope_size;
7094            }
7095
7096            let next_out_of_line = decoder.next_out_of_line();
7097            let handles_before = decoder.remaining_handles();
7098            if let Some((inlined, num_bytes, num_handles)) =
7099                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7100            {
7101                let member_inline_size =
7102                    <ToggleStateFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7103                if inlined != (member_inline_size <= 4) {
7104                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7105                }
7106                let inner_offset;
7107                let mut inner_depth = depth.clone();
7108                if inlined {
7109                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7110                    inner_offset = next_offset;
7111                } else {
7112                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7113                    inner_depth.increment()?;
7114                }
7115                let val_ref =
7116                    self.toggle_flags.get_or_insert_with(|| fidl::new_empty!(ToggleStateFlags, D));
7117                fidl::decode!(ToggleStateFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
7118                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7119                {
7120                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7121                }
7122                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7123                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7124                }
7125            }
7126
7127            next_offset += envelope_size;
7128
7129            // Decode the remaining unknown envelopes.
7130            while next_offset < end_offset {
7131                _next_ordinal_to_read += 1;
7132                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7133                next_offset += envelope_size;
7134            }
7135
7136            Ok(())
7137        }
7138    }
7139
7140    impl DisplaySettings {
7141        #[inline(always)]
7142        fn max_ordinal_present(&self) -> u64 {
7143            if let Some(_) = self.adjusted_auto_brightness {
7144                return 7;
7145            }
7146            if let Some(_) = self.theme {
7147                return 6;
7148            }
7149            if let Some(_) = self.screen_enabled {
7150                return 5;
7151            }
7152            if let Some(_) = self.low_light_mode {
7153                return 4;
7154            }
7155            if let Some(_) = self.brightness_value {
7156                return 2;
7157            }
7158            if let Some(_) = self.auto_brightness {
7159                return 1;
7160            }
7161            0
7162        }
7163    }
7164
7165    impl fidl::encoding::ValueTypeMarker for DisplaySettings {
7166        type Borrowed<'a> = &'a Self;
7167        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7168            value
7169        }
7170    }
7171
7172    unsafe impl fidl::encoding::TypeMarker for DisplaySettings {
7173        type Owned = Self;
7174
7175        #[inline(always)]
7176        fn inline_align(_context: fidl::encoding::Context) -> usize {
7177            8
7178        }
7179
7180        #[inline(always)]
7181        fn inline_size(_context: fidl::encoding::Context) -> usize {
7182            16
7183        }
7184    }
7185
7186    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisplaySettings, D>
7187        for &DisplaySettings
7188    {
7189        unsafe fn encode(
7190            self,
7191            encoder: &mut fidl::encoding::Encoder<'_, D>,
7192            offset: usize,
7193            mut depth: fidl::encoding::Depth,
7194        ) -> fidl::Result<()> {
7195            encoder.debug_check_bounds::<DisplaySettings>(offset);
7196            // Vector header
7197            let max_ordinal: u64 = self.max_ordinal_present();
7198            encoder.write_num(max_ordinal, offset);
7199            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7200            // Calling encoder.out_of_line_offset(0) is not allowed.
7201            if max_ordinal == 0 {
7202                return Ok(());
7203            }
7204            depth.increment()?;
7205            let envelope_size = 8;
7206            let bytes_len = max_ordinal as usize * envelope_size;
7207            #[allow(unused_variables)]
7208            let offset = encoder.out_of_line_offset(bytes_len);
7209            let mut _prev_end_offset: usize = 0;
7210            if 1 > max_ordinal {
7211                return Ok(());
7212            }
7213
7214            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7215            // are envelope_size bytes.
7216            let cur_offset: usize = (1 - 1) * envelope_size;
7217
7218            // Zero reserved fields.
7219            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7220
7221            // Safety:
7222            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7223            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7224            //   envelope_size bytes, there is always sufficient room.
7225            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7226                self.auto_brightness
7227                    .as_ref()
7228                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7229                encoder,
7230                offset + cur_offset,
7231                depth,
7232            )?;
7233
7234            _prev_end_offset = cur_offset + envelope_size;
7235            if 2 > max_ordinal {
7236                return Ok(());
7237            }
7238
7239            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7240            // are envelope_size bytes.
7241            let cur_offset: usize = (2 - 1) * envelope_size;
7242
7243            // Zero reserved fields.
7244            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7245
7246            // Safety:
7247            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7248            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7249            //   envelope_size bytes, there is always sufficient room.
7250            fidl::encoding::encode_in_envelope_optional::<f32, D>(
7251                self.brightness_value
7252                    .as_ref()
7253                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
7254                encoder,
7255                offset + cur_offset,
7256                depth,
7257            )?;
7258
7259            _prev_end_offset = cur_offset + envelope_size;
7260            if 4 > max_ordinal {
7261                return Ok(());
7262            }
7263
7264            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7265            // are envelope_size bytes.
7266            let cur_offset: usize = (4 - 1) * envelope_size;
7267
7268            // Zero reserved fields.
7269            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7270
7271            // Safety:
7272            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7273            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7274            //   envelope_size bytes, there is always sufficient room.
7275            fidl::encoding::encode_in_envelope_optional::<LowLightMode, D>(
7276                self.low_light_mode
7277                    .as_ref()
7278                    .map(<LowLightMode as fidl::encoding::ValueTypeMarker>::borrow),
7279                encoder,
7280                offset + cur_offset,
7281                depth,
7282            )?;
7283
7284            _prev_end_offset = cur_offset + envelope_size;
7285            if 5 > max_ordinal {
7286                return Ok(());
7287            }
7288
7289            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7290            // are envelope_size bytes.
7291            let cur_offset: usize = (5 - 1) * envelope_size;
7292
7293            // Zero reserved fields.
7294            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7295
7296            // Safety:
7297            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7298            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7299            //   envelope_size bytes, there is always sufficient room.
7300            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7301                self.screen_enabled.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7302                encoder,
7303                offset + cur_offset,
7304                depth,
7305            )?;
7306
7307            _prev_end_offset = cur_offset + envelope_size;
7308            if 6 > max_ordinal {
7309                return Ok(());
7310            }
7311
7312            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7313            // are envelope_size bytes.
7314            let cur_offset: usize = (6 - 1) * envelope_size;
7315
7316            // Zero reserved fields.
7317            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7318
7319            // Safety:
7320            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7321            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7322            //   envelope_size bytes, there is always sufficient room.
7323            fidl::encoding::encode_in_envelope_optional::<Theme, D>(
7324                self.theme.as_ref().map(<Theme as fidl::encoding::ValueTypeMarker>::borrow),
7325                encoder,
7326                offset + cur_offset,
7327                depth,
7328            )?;
7329
7330            _prev_end_offset = cur_offset + envelope_size;
7331            if 7 > max_ordinal {
7332                return Ok(());
7333            }
7334
7335            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7336            // are envelope_size bytes.
7337            let cur_offset: usize = (7 - 1) * envelope_size;
7338
7339            // Zero reserved fields.
7340            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7341
7342            // Safety:
7343            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7344            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7345            //   envelope_size bytes, there is always sufficient room.
7346            fidl::encoding::encode_in_envelope_optional::<f32, D>(
7347                self.adjusted_auto_brightness
7348                    .as_ref()
7349                    .map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
7350                encoder,
7351                offset + cur_offset,
7352                depth,
7353            )?;
7354
7355            _prev_end_offset = cur_offset + envelope_size;
7356
7357            Ok(())
7358        }
7359    }
7360
7361    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisplaySettings {
7362        #[inline(always)]
7363        fn new_empty() -> Self {
7364            Self::default()
7365        }
7366
7367        unsafe fn decode(
7368            &mut self,
7369            decoder: &mut fidl::encoding::Decoder<'_, D>,
7370            offset: usize,
7371            mut depth: fidl::encoding::Depth,
7372        ) -> fidl::Result<()> {
7373            decoder.debug_check_bounds::<Self>(offset);
7374            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7375                None => return Err(fidl::Error::NotNullable),
7376                Some(len) => len,
7377            };
7378            // Calling decoder.out_of_line_offset(0) is not allowed.
7379            if len == 0 {
7380                return Ok(());
7381            };
7382            depth.increment()?;
7383            let envelope_size = 8;
7384            let bytes_len = len * envelope_size;
7385            let offset = decoder.out_of_line_offset(bytes_len)?;
7386            // Decode the envelope for each type.
7387            let mut _next_ordinal_to_read = 0;
7388            let mut next_offset = offset;
7389            let end_offset = offset + bytes_len;
7390            _next_ordinal_to_read += 1;
7391            if next_offset >= end_offset {
7392                return Ok(());
7393            }
7394
7395            // Decode unknown envelopes for gaps in ordinals.
7396            while _next_ordinal_to_read < 1 {
7397                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7398                _next_ordinal_to_read += 1;
7399                next_offset += envelope_size;
7400            }
7401
7402            let next_out_of_line = decoder.next_out_of_line();
7403            let handles_before = decoder.remaining_handles();
7404            if let Some((inlined, num_bytes, num_handles)) =
7405                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7406            {
7407                let member_inline_size =
7408                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7409                if inlined != (member_inline_size <= 4) {
7410                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7411                }
7412                let inner_offset;
7413                let mut inner_depth = depth.clone();
7414                if inlined {
7415                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7416                    inner_offset = next_offset;
7417                } else {
7418                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7419                    inner_depth.increment()?;
7420                }
7421                let val_ref = self.auto_brightness.get_or_insert_with(|| fidl::new_empty!(bool, D));
7422                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7423                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7424                {
7425                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7426                }
7427                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7428                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7429                }
7430            }
7431
7432            next_offset += envelope_size;
7433            _next_ordinal_to_read += 1;
7434            if next_offset >= end_offset {
7435                return Ok(());
7436            }
7437
7438            // Decode unknown envelopes for gaps in ordinals.
7439            while _next_ordinal_to_read < 2 {
7440                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7441                _next_ordinal_to_read += 1;
7442                next_offset += envelope_size;
7443            }
7444
7445            let next_out_of_line = decoder.next_out_of_line();
7446            let handles_before = decoder.remaining_handles();
7447            if let Some((inlined, num_bytes, num_handles)) =
7448                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7449            {
7450                let member_inline_size =
7451                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7452                if inlined != (member_inline_size <= 4) {
7453                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7454                }
7455                let inner_offset;
7456                let mut inner_depth = depth.clone();
7457                if inlined {
7458                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7459                    inner_offset = next_offset;
7460                } else {
7461                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7462                    inner_depth.increment()?;
7463                }
7464                let val_ref = self.brightness_value.get_or_insert_with(|| fidl::new_empty!(f32, D));
7465                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
7466                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7467                {
7468                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7469                }
7470                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7471                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7472                }
7473            }
7474
7475            next_offset += envelope_size;
7476            _next_ordinal_to_read += 1;
7477            if next_offset >= end_offset {
7478                return Ok(());
7479            }
7480
7481            // Decode unknown envelopes for gaps in ordinals.
7482            while _next_ordinal_to_read < 4 {
7483                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7484                _next_ordinal_to_read += 1;
7485                next_offset += envelope_size;
7486            }
7487
7488            let next_out_of_line = decoder.next_out_of_line();
7489            let handles_before = decoder.remaining_handles();
7490            if let Some((inlined, num_bytes, num_handles)) =
7491                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7492            {
7493                let member_inline_size =
7494                    <LowLightMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7495                if inlined != (member_inline_size <= 4) {
7496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7497                }
7498                let inner_offset;
7499                let mut inner_depth = depth.clone();
7500                if inlined {
7501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7502                    inner_offset = next_offset;
7503                } else {
7504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7505                    inner_depth.increment()?;
7506                }
7507                let val_ref =
7508                    self.low_light_mode.get_or_insert_with(|| fidl::new_empty!(LowLightMode, D));
7509                fidl::decode!(LowLightMode, D, val_ref, decoder, inner_offset, inner_depth)?;
7510                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7511                {
7512                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7513                }
7514                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7515                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7516                }
7517            }
7518
7519            next_offset += envelope_size;
7520            _next_ordinal_to_read += 1;
7521            if next_offset >= end_offset {
7522                return Ok(());
7523            }
7524
7525            // Decode unknown envelopes for gaps in ordinals.
7526            while _next_ordinal_to_read < 5 {
7527                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7528                _next_ordinal_to_read += 1;
7529                next_offset += envelope_size;
7530            }
7531
7532            let next_out_of_line = decoder.next_out_of_line();
7533            let handles_before = decoder.remaining_handles();
7534            if let Some((inlined, num_bytes, num_handles)) =
7535                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7536            {
7537                let member_inline_size =
7538                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7539                if inlined != (member_inline_size <= 4) {
7540                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7541                }
7542                let inner_offset;
7543                let mut inner_depth = depth.clone();
7544                if inlined {
7545                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7546                    inner_offset = next_offset;
7547                } else {
7548                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7549                    inner_depth.increment()?;
7550                }
7551                let val_ref = self.screen_enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
7552                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7553                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7554                {
7555                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7556                }
7557                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7558                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7559                }
7560            }
7561
7562            next_offset += envelope_size;
7563            _next_ordinal_to_read += 1;
7564            if next_offset >= end_offset {
7565                return Ok(());
7566            }
7567
7568            // Decode unknown envelopes for gaps in ordinals.
7569            while _next_ordinal_to_read < 6 {
7570                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7571                _next_ordinal_to_read += 1;
7572                next_offset += envelope_size;
7573            }
7574
7575            let next_out_of_line = decoder.next_out_of_line();
7576            let handles_before = decoder.remaining_handles();
7577            if let Some((inlined, num_bytes, num_handles)) =
7578                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7579            {
7580                let member_inline_size =
7581                    <Theme as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7582                if inlined != (member_inline_size <= 4) {
7583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7584                }
7585                let inner_offset;
7586                let mut inner_depth = depth.clone();
7587                if inlined {
7588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7589                    inner_offset = next_offset;
7590                } else {
7591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7592                    inner_depth.increment()?;
7593                }
7594                let val_ref = self.theme.get_or_insert_with(|| fidl::new_empty!(Theme, D));
7595                fidl::decode!(Theme, D, val_ref, decoder, inner_offset, inner_depth)?;
7596                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7597                {
7598                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7599                }
7600                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7601                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7602                }
7603            }
7604
7605            next_offset += envelope_size;
7606            _next_ordinal_to_read += 1;
7607            if next_offset >= end_offset {
7608                return Ok(());
7609            }
7610
7611            // Decode unknown envelopes for gaps in ordinals.
7612            while _next_ordinal_to_read < 7 {
7613                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7614                _next_ordinal_to_read += 1;
7615                next_offset += envelope_size;
7616            }
7617
7618            let next_out_of_line = decoder.next_out_of_line();
7619            let handles_before = decoder.remaining_handles();
7620            if let Some((inlined, num_bytes, num_handles)) =
7621                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7622            {
7623                let member_inline_size =
7624                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7625                if inlined != (member_inline_size <= 4) {
7626                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7627                }
7628                let inner_offset;
7629                let mut inner_depth = depth.clone();
7630                if inlined {
7631                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7632                    inner_offset = next_offset;
7633                } else {
7634                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7635                    inner_depth.increment()?;
7636                }
7637                let val_ref =
7638                    self.adjusted_auto_brightness.get_or_insert_with(|| fidl::new_empty!(f32, D));
7639                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
7640                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7641                {
7642                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7643                }
7644                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7645                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7646                }
7647            }
7648
7649            next_offset += envelope_size;
7650
7651            // Decode the remaining unknown envelopes.
7652            while next_offset < end_offset {
7653                _next_ordinal_to_read += 1;
7654                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7655                next_offset += envelope_size;
7656            }
7657
7658            Ok(())
7659        }
7660    }
7661
7662    impl DoNotDisturbSettings {
7663        #[inline(always)]
7664        fn max_ordinal_present(&self) -> u64 {
7665            if let Some(_) = self.night_mode_initiated_do_not_disturb {
7666                return 2;
7667            }
7668            if let Some(_) = self.user_initiated_do_not_disturb {
7669                return 1;
7670            }
7671            0
7672        }
7673    }
7674
7675    impl fidl::encoding::ValueTypeMarker for DoNotDisturbSettings {
7676        type Borrowed<'a> = &'a Self;
7677        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7678            value
7679        }
7680    }
7681
7682    unsafe impl fidl::encoding::TypeMarker for DoNotDisturbSettings {
7683        type Owned = Self;
7684
7685        #[inline(always)]
7686        fn inline_align(_context: fidl::encoding::Context) -> usize {
7687            8
7688        }
7689
7690        #[inline(always)]
7691        fn inline_size(_context: fidl::encoding::Context) -> usize {
7692            16
7693        }
7694    }
7695
7696    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DoNotDisturbSettings, D>
7697        for &DoNotDisturbSettings
7698    {
7699        unsafe fn encode(
7700            self,
7701            encoder: &mut fidl::encoding::Encoder<'_, D>,
7702            offset: usize,
7703            mut depth: fidl::encoding::Depth,
7704        ) -> fidl::Result<()> {
7705            encoder.debug_check_bounds::<DoNotDisturbSettings>(offset);
7706            // Vector header
7707            let max_ordinal: u64 = self.max_ordinal_present();
7708            encoder.write_num(max_ordinal, offset);
7709            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7710            // Calling encoder.out_of_line_offset(0) is not allowed.
7711            if max_ordinal == 0 {
7712                return Ok(());
7713            }
7714            depth.increment()?;
7715            let envelope_size = 8;
7716            let bytes_len = max_ordinal as usize * envelope_size;
7717            #[allow(unused_variables)]
7718            let offset = encoder.out_of_line_offset(bytes_len);
7719            let mut _prev_end_offset: usize = 0;
7720            if 1 > max_ordinal {
7721                return Ok(());
7722            }
7723
7724            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7725            // are envelope_size bytes.
7726            let cur_offset: usize = (1 - 1) * envelope_size;
7727
7728            // Zero reserved fields.
7729            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7730
7731            // Safety:
7732            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7733            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7734            //   envelope_size bytes, there is always sufficient room.
7735            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7736                self.user_initiated_do_not_disturb
7737                    .as_ref()
7738                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7739                encoder,
7740                offset + cur_offset,
7741                depth,
7742            )?;
7743
7744            _prev_end_offset = cur_offset + envelope_size;
7745            if 2 > max_ordinal {
7746                return Ok(());
7747            }
7748
7749            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7750            // are envelope_size bytes.
7751            let cur_offset: usize = (2 - 1) * envelope_size;
7752
7753            // Zero reserved fields.
7754            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7755
7756            // Safety:
7757            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7758            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7759            //   envelope_size bytes, there is always sufficient room.
7760            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7761                self.night_mode_initiated_do_not_disturb
7762                    .as_ref()
7763                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7764                encoder,
7765                offset + cur_offset,
7766                depth,
7767            )?;
7768
7769            _prev_end_offset = cur_offset + envelope_size;
7770
7771            Ok(())
7772        }
7773    }
7774
7775    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DoNotDisturbSettings {
7776        #[inline(always)]
7777        fn new_empty() -> Self {
7778            Self::default()
7779        }
7780
7781        unsafe fn decode(
7782            &mut self,
7783            decoder: &mut fidl::encoding::Decoder<'_, D>,
7784            offset: usize,
7785            mut depth: fidl::encoding::Depth,
7786        ) -> fidl::Result<()> {
7787            decoder.debug_check_bounds::<Self>(offset);
7788            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7789                None => return Err(fidl::Error::NotNullable),
7790                Some(len) => len,
7791            };
7792            // Calling decoder.out_of_line_offset(0) is not allowed.
7793            if len == 0 {
7794                return Ok(());
7795            };
7796            depth.increment()?;
7797            let envelope_size = 8;
7798            let bytes_len = len * envelope_size;
7799            let offset = decoder.out_of_line_offset(bytes_len)?;
7800            // Decode the envelope for each type.
7801            let mut _next_ordinal_to_read = 0;
7802            let mut next_offset = offset;
7803            let end_offset = offset + bytes_len;
7804            _next_ordinal_to_read += 1;
7805            if next_offset >= end_offset {
7806                return Ok(());
7807            }
7808
7809            // Decode unknown envelopes for gaps in ordinals.
7810            while _next_ordinal_to_read < 1 {
7811                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7812                _next_ordinal_to_read += 1;
7813                next_offset += envelope_size;
7814            }
7815
7816            let next_out_of_line = decoder.next_out_of_line();
7817            let handles_before = decoder.remaining_handles();
7818            if let Some((inlined, num_bytes, num_handles)) =
7819                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7820            {
7821                let member_inline_size =
7822                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7823                if inlined != (member_inline_size <= 4) {
7824                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7825                }
7826                let inner_offset;
7827                let mut inner_depth = depth.clone();
7828                if inlined {
7829                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7830                    inner_offset = next_offset;
7831                } else {
7832                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7833                    inner_depth.increment()?;
7834                }
7835                let val_ref = self
7836                    .user_initiated_do_not_disturb
7837                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
7838                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7839                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7840                {
7841                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7842                }
7843                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7844                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7845                }
7846            }
7847
7848            next_offset += envelope_size;
7849            _next_ordinal_to_read += 1;
7850            if next_offset >= end_offset {
7851                return Ok(());
7852            }
7853
7854            // Decode unknown envelopes for gaps in ordinals.
7855            while _next_ordinal_to_read < 2 {
7856                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7857                _next_ordinal_to_read += 1;
7858                next_offset += envelope_size;
7859            }
7860
7861            let next_out_of_line = decoder.next_out_of_line();
7862            let handles_before = decoder.remaining_handles();
7863            if let Some((inlined, num_bytes, num_handles)) =
7864                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7865            {
7866                let member_inline_size =
7867                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7868                if inlined != (member_inline_size <= 4) {
7869                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7870                }
7871                let inner_offset;
7872                let mut inner_depth = depth.clone();
7873                if inlined {
7874                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7875                    inner_offset = next_offset;
7876                } else {
7877                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7878                    inner_depth.increment()?;
7879                }
7880                let val_ref = self
7881                    .night_mode_initiated_do_not_disturb
7882                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
7883                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
7884                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7885                {
7886                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7887                }
7888                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7889                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7890                }
7891            }
7892
7893            next_offset += envelope_size;
7894
7895            // Decode the remaining unknown envelopes.
7896            while next_offset < end_offset {
7897                _next_ordinal_to_read += 1;
7898                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7899                next_offset += envelope_size;
7900            }
7901
7902            Ok(())
7903        }
7904    }
7905
7906    impl FactoryResetSettings {
7907        #[inline(always)]
7908        fn max_ordinal_present(&self) -> u64 {
7909            if let Some(_) = self.is_local_reset_allowed {
7910                return 1;
7911            }
7912            0
7913        }
7914    }
7915
7916    impl fidl::encoding::ValueTypeMarker for FactoryResetSettings {
7917        type Borrowed<'a> = &'a Self;
7918        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7919            value
7920        }
7921    }
7922
7923    unsafe impl fidl::encoding::TypeMarker for FactoryResetSettings {
7924        type Owned = Self;
7925
7926        #[inline(always)]
7927        fn inline_align(_context: fidl::encoding::Context) -> usize {
7928            8
7929        }
7930
7931        #[inline(always)]
7932        fn inline_size(_context: fidl::encoding::Context) -> usize {
7933            16
7934        }
7935    }
7936
7937    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FactoryResetSettings, D>
7938        for &FactoryResetSettings
7939    {
7940        unsafe fn encode(
7941            self,
7942            encoder: &mut fidl::encoding::Encoder<'_, D>,
7943            offset: usize,
7944            mut depth: fidl::encoding::Depth,
7945        ) -> fidl::Result<()> {
7946            encoder.debug_check_bounds::<FactoryResetSettings>(offset);
7947            // Vector header
7948            let max_ordinal: u64 = self.max_ordinal_present();
7949            encoder.write_num(max_ordinal, offset);
7950            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7951            // Calling encoder.out_of_line_offset(0) is not allowed.
7952            if max_ordinal == 0 {
7953                return Ok(());
7954            }
7955            depth.increment()?;
7956            let envelope_size = 8;
7957            let bytes_len = max_ordinal as usize * envelope_size;
7958            #[allow(unused_variables)]
7959            let offset = encoder.out_of_line_offset(bytes_len);
7960            let mut _prev_end_offset: usize = 0;
7961            if 1 > max_ordinal {
7962                return Ok(());
7963            }
7964
7965            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7966            // are envelope_size bytes.
7967            let cur_offset: usize = (1 - 1) * envelope_size;
7968
7969            // Zero reserved fields.
7970            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7971
7972            // Safety:
7973            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7974            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7975            //   envelope_size bytes, there is always sufficient room.
7976            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7977                self.is_local_reset_allowed
7978                    .as_ref()
7979                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7980                encoder,
7981                offset + cur_offset,
7982                depth,
7983            )?;
7984
7985            _prev_end_offset = cur_offset + envelope_size;
7986
7987            Ok(())
7988        }
7989    }
7990
7991    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FactoryResetSettings {
7992        #[inline(always)]
7993        fn new_empty() -> Self {
7994            Self::default()
7995        }
7996
7997        unsafe fn decode(
7998            &mut self,
7999            decoder: &mut fidl::encoding::Decoder<'_, D>,
8000            offset: usize,
8001            mut depth: fidl::encoding::Depth,
8002        ) -> fidl::Result<()> {
8003            decoder.debug_check_bounds::<Self>(offset);
8004            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8005                None => return Err(fidl::Error::NotNullable),
8006                Some(len) => len,
8007            };
8008            // Calling decoder.out_of_line_offset(0) is not allowed.
8009            if len == 0 {
8010                return Ok(());
8011            };
8012            depth.increment()?;
8013            let envelope_size = 8;
8014            let bytes_len = len * envelope_size;
8015            let offset = decoder.out_of_line_offset(bytes_len)?;
8016            // Decode the envelope for each type.
8017            let mut _next_ordinal_to_read = 0;
8018            let mut next_offset = offset;
8019            let end_offset = offset + bytes_len;
8020            _next_ordinal_to_read += 1;
8021            if next_offset >= end_offset {
8022                return Ok(());
8023            }
8024
8025            // Decode unknown envelopes for gaps in ordinals.
8026            while _next_ordinal_to_read < 1 {
8027                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8028                _next_ordinal_to_read += 1;
8029                next_offset += envelope_size;
8030            }
8031
8032            let next_out_of_line = decoder.next_out_of_line();
8033            let handles_before = decoder.remaining_handles();
8034            if let Some((inlined, num_bytes, num_handles)) =
8035                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8036            {
8037                let member_inline_size =
8038                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8039                if inlined != (member_inline_size <= 4) {
8040                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8041                }
8042                let inner_offset;
8043                let mut inner_depth = depth.clone();
8044                if inlined {
8045                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8046                    inner_offset = next_offset;
8047                } else {
8048                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8049                    inner_depth.increment()?;
8050                }
8051                let val_ref =
8052                    self.is_local_reset_allowed.get_or_insert_with(|| fidl::new_empty!(bool, D));
8053                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8054                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8055                {
8056                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8057                }
8058                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8059                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8060                }
8061            }
8062
8063            next_offset += envelope_size;
8064
8065            // Decode the remaining unknown envelopes.
8066            while next_offset < end_offset {
8067                _next_ordinal_to_read += 1;
8068                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8069                next_offset += envelope_size;
8070            }
8071
8072            Ok(())
8073        }
8074    }
8075
8076    impl InputDevice {
8077        #[inline(always)]
8078        fn max_ordinal_present(&self) -> u64 {
8079            if let Some(_) = self.state {
8080                return 5;
8081            }
8082            if let Some(_) = self.mutable_toggle_state {
8083                return 4;
8084            }
8085            if let Some(_) = self.source_states {
8086                return 3;
8087            }
8088            if let Some(_) = self.device_type {
8089                return 2;
8090            }
8091            if let Some(_) = self.device_name {
8092                return 1;
8093            }
8094            0
8095        }
8096    }
8097
8098    impl fidl::encoding::ValueTypeMarker for InputDevice {
8099        type Borrowed<'a> = &'a Self;
8100        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8101            value
8102        }
8103    }
8104
8105    unsafe impl fidl::encoding::TypeMarker for InputDevice {
8106        type Owned = Self;
8107
8108        #[inline(always)]
8109        fn inline_align(_context: fidl::encoding::Context) -> usize {
8110            8
8111        }
8112
8113        #[inline(always)]
8114        fn inline_size(_context: fidl::encoding::Context) -> usize {
8115            16
8116        }
8117    }
8118
8119    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputDevice, D>
8120        for &InputDevice
8121    {
8122        unsafe fn encode(
8123            self,
8124            encoder: &mut fidl::encoding::Encoder<'_, D>,
8125            offset: usize,
8126            mut depth: fidl::encoding::Depth,
8127        ) -> fidl::Result<()> {
8128            encoder.debug_check_bounds::<InputDevice>(offset);
8129            // Vector header
8130            let max_ordinal: u64 = self.max_ordinal_present();
8131            encoder.write_num(max_ordinal, offset);
8132            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8133            // Calling encoder.out_of_line_offset(0) is not allowed.
8134            if max_ordinal == 0 {
8135                return Ok(());
8136            }
8137            depth.increment()?;
8138            let envelope_size = 8;
8139            let bytes_len = max_ordinal as usize * envelope_size;
8140            #[allow(unused_variables)]
8141            let offset = encoder.out_of_line_offset(bytes_len);
8142            let mut _prev_end_offset: usize = 0;
8143            if 1 > max_ordinal {
8144                return Ok(());
8145            }
8146
8147            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8148            // are envelope_size bytes.
8149            let cur_offset: usize = (1 - 1) * envelope_size;
8150
8151            // Zero reserved fields.
8152            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8153
8154            // Safety:
8155            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8156            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8157            //   envelope_size bytes, there is always sufficient room.
8158            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
8159                self.device_name.as_ref().map(
8160                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
8161                ),
8162                encoder,
8163                offset + cur_offset,
8164                depth,
8165            )?;
8166
8167            _prev_end_offset = cur_offset + envelope_size;
8168            if 2 > max_ordinal {
8169                return Ok(());
8170            }
8171
8172            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8173            // are envelope_size bytes.
8174            let cur_offset: usize = (2 - 1) * envelope_size;
8175
8176            // Zero reserved fields.
8177            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8178
8179            // Safety:
8180            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8181            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8182            //   envelope_size bytes, there is always sufficient room.
8183            fidl::encoding::encode_in_envelope_optional::<DeviceType, D>(
8184                self.device_type
8185                    .as_ref()
8186                    .map(<DeviceType as fidl::encoding::ValueTypeMarker>::borrow),
8187                encoder,
8188                offset + cur_offset,
8189                depth,
8190            )?;
8191
8192            _prev_end_offset = cur_offset + envelope_size;
8193            if 3 > max_ordinal {
8194                return Ok(());
8195            }
8196
8197            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8198            // are envelope_size bytes.
8199            let cur_offset: usize = (3 - 1) * envelope_size;
8200
8201            // Zero reserved fields.
8202            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8203
8204            // Safety:
8205            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8206            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8207            //   envelope_size bytes, there is always sufficient room.
8208            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<SourceState>, D>(
8209            self.source_states.as_ref().map(<fidl::encoding::UnboundedVector<SourceState> as fidl::encoding::ValueTypeMarker>::borrow),
8210            encoder, offset + cur_offset, depth
8211        )?;
8212
8213            _prev_end_offset = cur_offset + envelope_size;
8214            if 4 > 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 = (4 - 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::<ToggleStateFlags, D>(
8230                self.mutable_toggle_state
8231                    .as_ref()
8232                    .map(<ToggleStateFlags as fidl::encoding::ValueTypeMarker>::borrow),
8233                encoder,
8234                offset + cur_offset,
8235                depth,
8236            )?;
8237
8238            _prev_end_offset = cur_offset + envelope_size;
8239            if 5 > max_ordinal {
8240                return Ok(());
8241            }
8242
8243            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8244            // are envelope_size bytes.
8245            let cur_offset: usize = (5 - 1) * envelope_size;
8246
8247            // Zero reserved fields.
8248            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8249
8250            // Safety:
8251            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8252            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8253            //   envelope_size bytes, there is always sufficient room.
8254            fidl::encoding::encode_in_envelope_optional::<DeviceState, D>(
8255                self.state.as_ref().map(<DeviceState as fidl::encoding::ValueTypeMarker>::borrow),
8256                encoder,
8257                offset + cur_offset,
8258                depth,
8259            )?;
8260
8261            _prev_end_offset = cur_offset + envelope_size;
8262
8263            Ok(())
8264        }
8265    }
8266
8267    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputDevice {
8268        #[inline(always)]
8269        fn new_empty() -> Self {
8270            Self::default()
8271        }
8272
8273        unsafe fn decode(
8274            &mut self,
8275            decoder: &mut fidl::encoding::Decoder<'_, D>,
8276            offset: usize,
8277            mut depth: fidl::encoding::Depth,
8278        ) -> fidl::Result<()> {
8279            decoder.debug_check_bounds::<Self>(offset);
8280            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8281                None => return Err(fidl::Error::NotNullable),
8282                Some(len) => len,
8283            };
8284            // Calling decoder.out_of_line_offset(0) is not allowed.
8285            if len == 0 {
8286                return Ok(());
8287            };
8288            depth.increment()?;
8289            let envelope_size = 8;
8290            let bytes_len = len * envelope_size;
8291            let offset = decoder.out_of_line_offset(bytes_len)?;
8292            // Decode the envelope for each type.
8293            let mut _next_ordinal_to_read = 0;
8294            let mut next_offset = offset;
8295            let end_offset = offset + bytes_len;
8296            _next_ordinal_to_read += 1;
8297            if next_offset >= end_offset {
8298                return Ok(());
8299            }
8300
8301            // Decode unknown envelopes for gaps in ordinals.
8302            while _next_ordinal_to_read < 1 {
8303                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8304                _next_ordinal_to_read += 1;
8305                next_offset += envelope_size;
8306            }
8307
8308            let next_out_of_line = decoder.next_out_of_line();
8309            let handles_before = decoder.remaining_handles();
8310            if let Some((inlined, num_bytes, num_handles)) =
8311                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8312            {
8313                let member_inline_size =
8314                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
8315                        decoder.context,
8316                    );
8317                if inlined != (member_inline_size <= 4) {
8318                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8319                }
8320                let inner_offset;
8321                let mut inner_depth = depth.clone();
8322                if inlined {
8323                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8324                    inner_offset = next_offset;
8325                } else {
8326                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8327                    inner_depth.increment()?;
8328                }
8329                let val_ref = self
8330                    .device_name
8331                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
8332                fidl::decode!(
8333                    fidl::encoding::UnboundedString,
8334                    D,
8335                    val_ref,
8336                    decoder,
8337                    inner_offset,
8338                    inner_depth
8339                )?;
8340                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8341                {
8342                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8343                }
8344                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8345                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8346                }
8347            }
8348
8349            next_offset += envelope_size;
8350            _next_ordinal_to_read += 1;
8351            if next_offset >= end_offset {
8352                return Ok(());
8353            }
8354
8355            // Decode unknown envelopes for gaps in ordinals.
8356            while _next_ordinal_to_read < 2 {
8357                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8358                _next_ordinal_to_read += 1;
8359                next_offset += envelope_size;
8360            }
8361
8362            let next_out_of_line = decoder.next_out_of_line();
8363            let handles_before = decoder.remaining_handles();
8364            if let Some((inlined, num_bytes, num_handles)) =
8365                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8366            {
8367                let member_inline_size =
8368                    <DeviceType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8369                if inlined != (member_inline_size <= 4) {
8370                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8371                }
8372                let inner_offset;
8373                let mut inner_depth = depth.clone();
8374                if inlined {
8375                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8376                    inner_offset = next_offset;
8377                } else {
8378                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8379                    inner_depth.increment()?;
8380                }
8381                let val_ref =
8382                    self.device_type.get_or_insert_with(|| fidl::new_empty!(DeviceType, D));
8383                fidl::decode!(DeviceType, D, val_ref, decoder, inner_offset, inner_depth)?;
8384                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8385                {
8386                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8387                }
8388                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8389                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8390                }
8391            }
8392
8393            next_offset += envelope_size;
8394            _next_ordinal_to_read += 1;
8395            if next_offset >= end_offset {
8396                return Ok(());
8397            }
8398
8399            // Decode unknown envelopes for gaps in ordinals.
8400            while _next_ordinal_to_read < 3 {
8401                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8402                _next_ordinal_to_read += 1;
8403                next_offset += envelope_size;
8404            }
8405
8406            let next_out_of_line = decoder.next_out_of_line();
8407            let handles_before = decoder.remaining_handles();
8408            if let Some((inlined, num_bytes, num_handles)) =
8409                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8410            {
8411                let member_inline_size = <fidl::encoding::UnboundedVector<SourceState> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8412                if inlined != (member_inline_size <= 4) {
8413                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8414                }
8415                let inner_offset;
8416                let mut inner_depth = depth.clone();
8417                if inlined {
8418                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8419                    inner_offset = next_offset;
8420                } else {
8421                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8422                    inner_depth.increment()?;
8423                }
8424                let val_ref = self.source_states.get_or_insert_with(|| {
8425                    fidl::new_empty!(fidl::encoding::UnboundedVector<SourceState>, D)
8426                });
8427                fidl::decode!(
8428                    fidl::encoding::UnboundedVector<SourceState>,
8429                    D,
8430                    val_ref,
8431                    decoder,
8432                    inner_offset,
8433                    inner_depth
8434                )?;
8435                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8436                {
8437                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8438                }
8439                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8440                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8441                }
8442            }
8443
8444            next_offset += envelope_size;
8445            _next_ordinal_to_read += 1;
8446            if next_offset >= end_offset {
8447                return Ok(());
8448            }
8449
8450            // Decode unknown envelopes for gaps in ordinals.
8451            while _next_ordinal_to_read < 4 {
8452                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8453                _next_ordinal_to_read += 1;
8454                next_offset += envelope_size;
8455            }
8456
8457            let next_out_of_line = decoder.next_out_of_line();
8458            let handles_before = decoder.remaining_handles();
8459            if let Some((inlined, num_bytes, num_handles)) =
8460                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8461            {
8462                let member_inline_size =
8463                    <ToggleStateFlags as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8464                if inlined != (member_inline_size <= 4) {
8465                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8466                }
8467                let inner_offset;
8468                let mut inner_depth = depth.clone();
8469                if inlined {
8470                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8471                    inner_offset = next_offset;
8472                } else {
8473                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8474                    inner_depth.increment()?;
8475                }
8476                let val_ref = self
8477                    .mutable_toggle_state
8478                    .get_or_insert_with(|| fidl::new_empty!(ToggleStateFlags, D));
8479                fidl::decode!(ToggleStateFlags, D, val_ref, decoder, inner_offset, inner_depth)?;
8480                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8481                {
8482                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8483                }
8484                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8485                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8486                }
8487            }
8488
8489            next_offset += envelope_size;
8490            _next_ordinal_to_read += 1;
8491            if next_offset >= end_offset {
8492                return Ok(());
8493            }
8494
8495            // Decode unknown envelopes for gaps in ordinals.
8496            while _next_ordinal_to_read < 5 {
8497                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8498                _next_ordinal_to_read += 1;
8499                next_offset += envelope_size;
8500            }
8501
8502            let next_out_of_line = decoder.next_out_of_line();
8503            let handles_before = decoder.remaining_handles();
8504            if let Some((inlined, num_bytes, num_handles)) =
8505                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8506            {
8507                let member_inline_size =
8508                    <DeviceState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8509                if inlined != (member_inline_size <= 4) {
8510                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8511                }
8512                let inner_offset;
8513                let mut inner_depth = depth.clone();
8514                if inlined {
8515                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8516                    inner_offset = next_offset;
8517                } else {
8518                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8519                    inner_depth.increment()?;
8520                }
8521                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(DeviceState, D));
8522                fidl::decode!(DeviceState, D, val_ref, decoder, inner_offset, inner_depth)?;
8523                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8524                {
8525                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8526                }
8527                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8528                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8529                }
8530            }
8531
8532            next_offset += envelope_size;
8533
8534            // Decode the remaining unknown envelopes.
8535            while next_offset < end_offset {
8536                _next_ordinal_to_read += 1;
8537                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8538                next_offset += envelope_size;
8539            }
8540
8541            Ok(())
8542        }
8543    }
8544
8545    impl InputSettings {
8546        #[inline(always)]
8547        fn max_ordinal_present(&self) -> u64 {
8548            if let Some(_) = self.devices {
8549                return 1;
8550            }
8551            0
8552        }
8553    }
8554
8555    impl fidl::encoding::ValueTypeMarker for InputSettings {
8556        type Borrowed<'a> = &'a Self;
8557        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8558            value
8559        }
8560    }
8561
8562    unsafe impl fidl::encoding::TypeMarker for InputSettings {
8563        type Owned = Self;
8564
8565        #[inline(always)]
8566        fn inline_align(_context: fidl::encoding::Context) -> usize {
8567            8
8568        }
8569
8570        #[inline(always)]
8571        fn inline_size(_context: fidl::encoding::Context) -> usize {
8572            16
8573        }
8574    }
8575
8576    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputSettings, D>
8577        for &InputSettings
8578    {
8579        unsafe fn encode(
8580            self,
8581            encoder: &mut fidl::encoding::Encoder<'_, D>,
8582            offset: usize,
8583            mut depth: fidl::encoding::Depth,
8584        ) -> fidl::Result<()> {
8585            encoder.debug_check_bounds::<InputSettings>(offset);
8586            // Vector header
8587            let max_ordinal: u64 = self.max_ordinal_present();
8588            encoder.write_num(max_ordinal, offset);
8589            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8590            // Calling encoder.out_of_line_offset(0) is not allowed.
8591            if max_ordinal == 0 {
8592                return Ok(());
8593            }
8594            depth.increment()?;
8595            let envelope_size = 8;
8596            let bytes_len = max_ordinal as usize * envelope_size;
8597            #[allow(unused_variables)]
8598            let offset = encoder.out_of_line_offset(bytes_len);
8599            let mut _prev_end_offset: usize = 0;
8600            if 1 > max_ordinal {
8601                return Ok(());
8602            }
8603
8604            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8605            // are envelope_size bytes.
8606            let cur_offset: usize = (1 - 1) * envelope_size;
8607
8608            // Zero reserved fields.
8609            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8610
8611            // Safety:
8612            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8613            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8614            //   envelope_size bytes, there is always sufficient room.
8615            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<InputDevice>, D>(
8616            self.devices.as_ref().map(<fidl::encoding::UnboundedVector<InputDevice> as fidl::encoding::ValueTypeMarker>::borrow),
8617            encoder, offset + cur_offset, depth
8618        )?;
8619
8620            _prev_end_offset = cur_offset + envelope_size;
8621
8622            Ok(())
8623        }
8624    }
8625
8626    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputSettings {
8627        #[inline(always)]
8628        fn new_empty() -> Self {
8629            Self::default()
8630        }
8631
8632        unsafe fn decode(
8633            &mut self,
8634            decoder: &mut fidl::encoding::Decoder<'_, D>,
8635            offset: usize,
8636            mut depth: fidl::encoding::Depth,
8637        ) -> fidl::Result<()> {
8638            decoder.debug_check_bounds::<Self>(offset);
8639            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8640                None => return Err(fidl::Error::NotNullable),
8641                Some(len) => len,
8642            };
8643            // Calling decoder.out_of_line_offset(0) is not allowed.
8644            if len == 0 {
8645                return Ok(());
8646            };
8647            depth.increment()?;
8648            let envelope_size = 8;
8649            let bytes_len = len * envelope_size;
8650            let offset = decoder.out_of_line_offset(bytes_len)?;
8651            // Decode the envelope for each type.
8652            let mut _next_ordinal_to_read = 0;
8653            let mut next_offset = offset;
8654            let end_offset = offset + bytes_len;
8655            _next_ordinal_to_read += 1;
8656            if next_offset >= end_offset {
8657                return Ok(());
8658            }
8659
8660            // Decode unknown envelopes for gaps in ordinals.
8661            while _next_ordinal_to_read < 1 {
8662                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8663                _next_ordinal_to_read += 1;
8664                next_offset += envelope_size;
8665            }
8666
8667            let next_out_of_line = decoder.next_out_of_line();
8668            let handles_before = decoder.remaining_handles();
8669            if let Some((inlined, num_bytes, num_handles)) =
8670                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8671            {
8672                let member_inline_size = <fidl::encoding::UnboundedVector<InputDevice> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8673                if inlined != (member_inline_size <= 4) {
8674                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8675                }
8676                let inner_offset;
8677                let mut inner_depth = depth.clone();
8678                if inlined {
8679                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8680                    inner_offset = next_offset;
8681                } else {
8682                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8683                    inner_depth.increment()?;
8684                }
8685                let val_ref = self.devices.get_or_insert_with(|| {
8686                    fidl::new_empty!(fidl::encoding::UnboundedVector<InputDevice>, D)
8687                });
8688                fidl::decode!(
8689                    fidl::encoding::UnboundedVector<InputDevice>,
8690                    D,
8691                    val_ref,
8692                    decoder,
8693                    inner_offset,
8694                    inner_depth
8695                )?;
8696                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8697                {
8698                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8699                }
8700                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8701                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8702                }
8703            }
8704
8705            next_offset += envelope_size;
8706
8707            // Decode the remaining unknown envelopes.
8708            while next_offset < end_offset {
8709                _next_ordinal_to_read += 1;
8710                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8711                next_offset += envelope_size;
8712            }
8713
8714            Ok(())
8715        }
8716    }
8717
8718    impl InputState {
8719        #[inline(always)]
8720        fn max_ordinal_present(&self) -> u64 {
8721            if let Some(_) = self.state {
8722                return 3;
8723            }
8724            if let Some(_) = self.device_type {
8725                return 2;
8726            }
8727            if let Some(_) = self.name {
8728                return 1;
8729            }
8730            0
8731        }
8732    }
8733
8734    impl fidl::encoding::ValueTypeMarker for InputState {
8735        type Borrowed<'a> = &'a Self;
8736        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8737            value
8738        }
8739    }
8740
8741    unsafe impl fidl::encoding::TypeMarker for InputState {
8742        type Owned = Self;
8743
8744        #[inline(always)]
8745        fn inline_align(_context: fidl::encoding::Context) -> usize {
8746            8
8747        }
8748
8749        #[inline(always)]
8750        fn inline_size(_context: fidl::encoding::Context) -> usize {
8751            16
8752        }
8753    }
8754
8755    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputState, D>
8756        for &InputState
8757    {
8758        unsafe fn encode(
8759            self,
8760            encoder: &mut fidl::encoding::Encoder<'_, D>,
8761            offset: usize,
8762            mut depth: fidl::encoding::Depth,
8763        ) -> fidl::Result<()> {
8764            encoder.debug_check_bounds::<InputState>(offset);
8765            // Vector header
8766            let max_ordinal: u64 = self.max_ordinal_present();
8767            encoder.write_num(max_ordinal, offset);
8768            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8769            // Calling encoder.out_of_line_offset(0) is not allowed.
8770            if max_ordinal == 0 {
8771                return Ok(());
8772            }
8773            depth.increment()?;
8774            let envelope_size = 8;
8775            let bytes_len = max_ordinal as usize * envelope_size;
8776            #[allow(unused_variables)]
8777            let offset = encoder.out_of_line_offset(bytes_len);
8778            let mut _prev_end_offset: usize = 0;
8779            if 1 > max_ordinal {
8780                return Ok(());
8781            }
8782
8783            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8784            // are envelope_size bytes.
8785            let cur_offset: usize = (1 - 1) * envelope_size;
8786
8787            // Zero reserved fields.
8788            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8789
8790            // Safety:
8791            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8792            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8793            //   envelope_size bytes, there is always sufficient room.
8794            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedString, D>(
8795                self.name.as_ref().map(
8796                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow,
8797                ),
8798                encoder,
8799                offset + cur_offset,
8800                depth,
8801            )?;
8802
8803            _prev_end_offset = cur_offset + envelope_size;
8804            if 2 > max_ordinal {
8805                return Ok(());
8806            }
8807
8808            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8809            // are envelope_size bytes.
8810            let cur_offset: usize = (2 - 1) * envelope_size;
8811
8812            // Zero reserved fields.
8813            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8814
8815            // Safety:
8816            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8817            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8818            //   envelope_size bytes, there is always sufficient room.
8819            fidl::encoding::encode_in_envelope_optional::<DeviceType, D>(
8820                self.device_type
8821                    .as_ref()
8822                    .map(<DeviceType as fidl::encoding::ValueTypeMarker>::borrow),
8823                encoder,
8824                offset + cur_offset,
8825                depth,
8826            )?;
8827
8828            _prev_end_offset = cur_offset + envelope_size;
8829            if 3 > max_ordinal {
8830                return Ok(());
8831            }
8832
8833            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8834            // are envelope_size bytes.
8835            let cur_offset: usize = (3 - 1) * envelope_size;
8836
8837            // Zero reserved fields.
8838            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8839
8840            // Safety:
8841            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8842            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8843            //   envelope_size bytes, there is always sufficient room.
8844            fidl::encoding::encode_in_envelope_optional::<DeviceState, D>(
8845                self.state.as_ref().map(<DeviceState as fidl::encoding::ValueTypeMarker>::borrow),
8846                encoder,
8847                offset + cur_offset,
8848                depth,
8849            )?;
8850
8851            _prev_end_offset = cur_offset + envelope_size;
8852
8853            Ok(())
8854        }
8855    }
8856
8857    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputState {
8858        #[inline(always)]
8859        fn new_empty() -> Self {
8860            Self::default()
8861        }
8862
8863        unsafe fn decode(
8864            &mut self,
8865            decoder: &mut fidl::encoding::Decoder<'_, D>,
8866            offset: usize,
8867            mut depth: fidl::encoding::Depth,
8868        ) -> fidl::Result<()> {
8869            decoder.debug_check_bounds::<Self>(offset);
8870            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8871                None => return Err(fidl::Error::NotNullable),
8872                Some(len) => len,
8873            };
8874            // Calling decoder.out_of_line_offset(0) is not allowed.
8875            if len == 0 {
8876                return Ok(());
8877            };
8878            depth.increment()?;
8879            let envelope_size = 8;
8880            let bytes_len = len * envelope_size;
8881            let offset = decoder.out_of_line_offset(bytes_len)?;
8882            // Decode the envelope for each type.
8883            let mut _next_ordinal_to_read = 0;
8884            let mut next_offset = offset;
8885            let end_offset = offset + bytes_len;
8886            _next_ordinal_to_read += 1;
8887            if next_offset >= end_offset {
8888                return Ok(());
8889            }
8890
8891            // Decode unknown envelopes for gaps in ordinals.
8892            while _next_ordinal_to_read < 1 {
8893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8894                _next_ordinal_to_read += 1;
8895                next_offset += envelope_size;
8896            }
8897
8898            let next_out_of_line = decoder.next_out_of_line();
8899            let handles_before = decoder.remaining_handles();
8900            if let Some((inlined, num_bytes, num_handles)) =
8901                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8902            {
8903                let member_inline_size =
8904                    <fidl::encoding::UnboundedString as fidl::encoding::TypeMarker>::inline_size(
8905                        decoder.context,
8906                    );
8907                if inlined != (member_inline_size <= 4) {
8908                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8909                }
8910                let inner_offset;
8911                let mut inner_depth = depth.clone();
8912                if inlined {
8913                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8914                    inner_offset = next_offset;
8915                } else {
8916                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8917                    inner_depth.increment()?;
8918                }
8919                let val_ref = self
8920                    .name
8921                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::UnboundedString, D));
8922                fidl::decode!(
8923                    fidl::encoding::UnboundedString,
8924                    D,
8925                    val_ref,
8926                    decoder,
8927                    inner_offset,
8928                    inner_depth
8929                )?;
8930                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8931                {
8932                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8933                }
8934                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8935                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8936                }
8937            }
8938
8939            next_offset += envelope_size;
8940            _next_ordinal_to_read += 1;
8941            if next_offset >= end_offset {
8942                return Ok(());
8943            }
8944
8945            // Decode unknown envelopes for gaps in ordinals.
8946            while _next_ordinal_to_read < 2 {
8947                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8948                _next_ordinal_to_read += 1;
8949                next_offset += envelope_size;
8950            }
8951
8952            let next_out_of_line = decoder.next_out_of_line();
8953            let handles_before = decoder.remaining_handles();
8954            if let Some((inlined, num_bytes, num_handles)) =
8955                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8956            {
8957                let member_inline_size =
8958                    <DeviceType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8959                if inlined != (member_inline_size <= 4) {
8960                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8961                }
8962                let inner_offset;
8963                let mut inner_depth = depth.clone();
8964                if inlined {
8965                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8966                    inner_offset = next_offset;
8967                } else {
8968                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8969                    inner_depth.increment()?;
8970                }
8971                let val_ref =
8972                    self.device_type.get_or_insert_with(|| fidl::new_empty!(DeviceType, D));
8973                fidl::decode!(DeviceType, D, val_ref, decoder, inner_offset, inner_depth)?;
8974                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8975                {
8976                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8977                }
8978                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8979                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8980                }
8981            }
8982
8983            next_offset += envelope_size;
8984            _next_ordinal_to_read += 1;
8985            if next_offset >= end_offset {
8986                return Ok(());
8987            }
8988
8989            // Decode unknown envelopes for gaps in ordinals.
8990            while _next_ordinal_to_read < 3 {
8991                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8992                _next_ordinal_to_read += 1;
8993                next_offset += envelope_size;
8994            }
8995
8996            let next_out_of_line = decoder.next_out_of_line();
8997            let handles_before = decoder.remaining_handles();
8998            if let Some((inlined, num_bytes, num_handles)) =
8999                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9000            {
9001                let member_inline_size =
9002                    <DeviceState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9003                if inlined != (member_inline_size <= 4) {
9004                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9005                }
9006                let inner_offset;
9007                let mut inner_depth = depth.clone();
9008                if inlined {
9009                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9010                    inner_offset = next_offset;
9011                } else {
9012                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9013                    inner_depth.increment()?;
9014                }
9015                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(DeviceState, D));
9016                fidl::decode!(DeviceState, D, val_ref, decoder, inner_offset, inner_depth)?;
9017                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9018                {
9019                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9020                }
9021                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9022                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9023                }
9024            }
9025
9026            next_offset += envelope_size;
9027
9028            // Decode the remaining unknown envelopes.
9029            while next_offset < end_offset {
9030                _next_ordinal_to_read += 1;
9031                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9032                next_offset += envelope_size;
9033            }
9034
9035            Ok(())
9036        }
9037    }
9038
9039    impl IntlSettings {
9040        #[inline(always)]
9041        fn max_ordinal_present(&self) -> u64 {
9042            if let Some(_) = self.hour_cycle {
9043                return 4;
9044            }
9045            if let Some(_) = self.time_zone_id {
9046                return 3;
9047            }
9048            if let Some(_) = self.temperature_unit {
9049                return 2;
9050            }
9051            if let Some(_) = self.locales {
9052                return 1;
9053            }
9054            0
9055        }
9056    }
9057
9058    impl fidl::encoding::ValueTypeMarker for IntlSettings {
9059        type Borrowed<'a> = &'a Self;
9060        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9061            value
9062        }
9063    }
9064
9065    unsafe impl fidl::encoding::TypeMarker for IntlSettings {
9066        type Owned = Self;
9067
9068        #[inline(always)]
9069        fn inline_align(_context: fidl::encoding::Context) -> usize {
9070            8
9071        }
9072
9073        #[inline(always)]
9074        fn inline_size(_context: fidl::encoding::Context) -> usize {
9075            16
9076        }
9077    }
9078
9079    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IntlSettings, D>
9080        for &IntlSettings
9081    {
9082        unsafe fn encode(
9083            self,
9084            encoder: &mut fidl::encoding::Encoder<'_, D>,
9085            offset: usize,
9086            mut depth: fidl::encoding::Depth,
9087        ) -> fidl::Result<()> {
9088            encoder.debug_check_bounds::<IntlSettings>(offset);
9089            // Vector header
9090            let max_ordinal: u64 = self.max_ordinal_present();
9091            encoder.write_num(max_ordinal, offset);
9092            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9093            // Calling encoder.out_of_line_offset(0) is not allowed.
9094            if max_ordinal == 0 {
9095                return Ok(());
9096            }
9097            depth.increment()?;
9098            let envelope_size = 8;
9099            let bytes_len = max_ordinal as usize * envelope_size;
9100            #[allow(unused_variables)]
9101            let offset = encoder.out_of_line_offset(bytes_len);
9102            let mut _prev_end_offset: usize = 0;
9103            if 1 > max_ordinal {
9104                return Ok(());
9105            }
9106
9107            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9108            // are envelope_size bytes.
9109            let cur_offset: usize = (1 - 1) * envelope_size;
9110
9111            // Zero reserved fields.
9112            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9113
9114            // Safety:
9115            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9116            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9117            //   envelope_size bytes, there is always sufficient room.
9118            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_intl__common::LocaleId, 10>, D>(
9119            self.locales.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_intl__common::LocaleId, 10> as fidl::encoding::ValueTypeMarker>::borrow),
9120            encoder, offset + cur_offset, depth
9121        )?;
9122
9123            _prev_end_offset = cur_offset + envelope_size;
9124            if 2 > 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 = (2 - 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_fuchsia_intl__common::TemperatureUnit, D>(
9140            self.temperature_unit.as_ref().map(<fidl_fuchsia_intl__common::TemperatureUnit as fidl::encoding::ValueTypeMarker>::borrow),
9141            encoder, offset + cur_offset, depth
9142        )?;
9143
9144            _prev_end_offset = cur_offset + envelope_size;
9145            if 3 > 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 = (3 - 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__common::TimeZoneId, D>(
9161            self.time_zone_id.as_ref().map(<fidl_fuchsia_intl__common::TimeZoneId as fidl::encoding::ValueTypeMarker>::borrow),
9162            encoder, offset + cur_offset, depth
9163        )?;
9164
9165            _prev_end_offset = cur_offset + envelope_size;
9166            if 4 > max_ordinal {
9167                return Ok(());
9168            }
9169
9170            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9171            // are envelope_size bytes.
9172            let cur_offset: usize = (4 - 1) * envelope_size;
9173
9174            // Zero reserved fields.
9175            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9176
9177            // Safety:
9178            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9179            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9180            //   envelope_size bytes, there is always sufficient room.
9181            fidl::encoding::encode_in_envelope_optional::<HourCycle, D>(
9182                self.hour_cycle
9183                    .as_ref()
9184                    .map(<HourCycle as fidl::encoding::ValueTypeMarker>::borrow),
9185                encoder,
9186                offset + cur_offset,
9187                depth,
9188            )?;
9189
9190            _prev_end_offset = cur_offset + envelope_size;
9191
9192            Ok(())
9193        }
9194    }
9195
9196    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IntlSettings {
9197        #[inline(always)]
9198        fn new_empty() -> Self {
9199            Self::default()
9200        }
9201
9202        unsafe fn decode(
9203            &mut self,
9204            decoder: &mut fidl::encoding::Decoder<'_, D>,
9205            offset: usize,
9206            mut depth: fidl::encoding::Depth,
9207        ) -> fidl::Result<()> {
9208            decoder.debug_check_bounds::<Self>(offset);
9209            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9210                None => return Err(fidl::Error::NotNullable),
9211                Some(len) => len,
9212            };
9213            // Calling decoder.out_of_line_offset(0) is not allowed.
9214            if len == 0 {
9215                return Ok(());
9216            };
9217            depth.increment()?;
9218            let envelope_size = 8;
9219            let bytes_len = len * envelope_size;
9220            let offset = decoder.out_of_line_offset(bytes_len)?;
9221            // Decode the envelope for each type.
9222            let mut _next_ordinal_to_read = 0;
9223            let mut next_offset = offset;
9224            let end_offset = offset + bytes_len;
9225            _next_ordinal_to_read += 1;
9226            if next_offset >= end_offset {
9227                return Ok(());
9228            }
9229
9230            // Decode unknown envelopes for gaps in ordinals.
9231            while _next_ordinal_to_read < 1 {
9232                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9233                _next_ordinal_to_read += 1;
9234                next_offset += envelope_size;
9235            }
9236
9237            let next_out_of_line = decoder.next_out_of_line();
9238            let handles_before = decoder.remaining_handles();
9239            if let Some((inlined, num_bytes, num_handles)) =
9240                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9241            {
9242                let member_inline_size = <fidl::encoding::Vector<
9243                    fidl_fuchsia_intl__common::LocaleId,
9244                    10,
9245                > as fidl::encoding::TypeMarker>::inline_size(
9246                    decoder.context
9247                );
9248                if inlined != (member_inline_size <= 4) {
9249                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9250                }
9251                let inner_offset;
9252                let mut inner_depth = depth.clone();
9253                if inlined {
9254                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9255                    inner_offset = next_offset;
9256                } else {
9257                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9258                    inner_depth.increment()?;
9259                }
9260                let val_ref =
9261                self.locales.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_intl__common::LocaleId, 10>, D));
9262                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_intl__common::LocaleId, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
9263                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9264                {
9265                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9266                }
9267                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9268                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9269                }
9270            }
9271
9272            next_offset += envelope_size;
9273            _next_ordinal_to_read += 1;
9274            if next_offset >= end_offset {
9275                return Ok(());
9276            }
9277
9278            // Decode unknown envelopes for gaps in ordinals.
9279            while _next_ordinal_to_read < 2 {
9280                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9281                _next_ordinal_to_read += 1;
9282                next_offset += envelope_size;
9283            }
9284
9285            let next_out_of_line = decoder.next_out_of_line();
9286            let handles_before = decoder.remaining_handles();
9287            if let Some((inlined, num_bytes, num_handles)) =
9288                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9289            {
9290                let member_inline_size = <fidl_fuchsia_intl__common::TemperatureUnit as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9291                if inlined != (member_inline_size <= 4) {
9292                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9293                }
9294                let inner_offset;
9295                let mut inner_depth = depth.clone();
9296                if inlined {
9297                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9298                    inner_offset = next_offset;
9299                } else {
9300                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9301                    inner_depth.increment()?;
9302                }
9303                let val_ref = self.temperature_unit.get_or_insert_with(|| {
9304                    fidl::new_empty!(fidl_fuchsia_intl__common::TemperatureUnit, D)
9305                });
9306                fidl::decode!(
9307                    fidl_fuchsia_intl__common::TemperatureUnit,
9308                    D,
9309                    val_ref,
9310                    decoder,
9311                    inner_offset,
9312                    inner_depth
9313                )?;
9314                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9315                {
9316                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9317                }
9318                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9319                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9320                }
9321            }
9322
9323            next_offset += envelope_size;
9324            _next_ordinal_to_read += 1;
9325            if next_offset >= end_offset {
9326                return Ok(());
9327            }
9328
9329            // Decode unknown envelopes for gaps in ordinals.
9330            while _next_ordinal_to_read < 3 {
9331                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9332                _next_ordinal_to_read += 1;
9333                next_offset += envelope_size;
9334            }
9335
9336            let next_out_of_line = decoder.next_out_of_line();
9337            let handles_before = decoder.remaining_handles();
9338            if let Some((inlined, num_bytes, num_handles)) =
9339                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9340            {
9341                let member_inline_size = <fidl_fuchsia_intl__common::TimeZoneId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9342                if inlined != (member_inline_size <= 4) {
9343                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9344                }
9345                let inner_offset;
9346                let mut inner_depth = depth.clone();
9347                if inlined {
9348                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9349                    inner_offset = next_offset;
9350                } else {
9351                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9352                    inner_depth.increment()?;
9353                }
9354                let val_ref = self.time_zone_id.get_or_insert_with(|| {
9355                    fidl::new_empty!(fidl_fuchsia_intl__common::TimeZoneId, D)
9356                });
9357                fidl::decode!(
9358                    fidl_fuchsia_intl__common::TimeZoneId,
9359                    D,
9360                    val_ref,
9361                    decoder,
9362                    inner_offset,
9363                    inner_depth
9364                )?;
9365                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9366                {
9367                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9368                }
9369                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9370                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9371                }
9372            }
9373
9374            next_offset += envelope_size;
9375            _next_ordinal_to_read += 1;
9376            if next_offset >= end_offset {
9377                return Ok(());
9378            }
9379
9380            // Decode unknown envelopes for gaps in ordinals.
9381            while _next_ordinal_to_read < 4 {
9382                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9383                _next_ordinal_to_read += 1;
9384                next_offset += envelope_size;
9385            }
9386
9387            let next_out_of_line = decoder.next_out_of_line();
9388            let handles_before = decoder.remaining_handles();
9389            if let Some((inlined, num_bytes, num_handles)) =
9390                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9391            {
9392                let member_inline_size =
9393                    <HourCycle as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9394                if inlined != (member_inline_size <= 4) {
9395                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9396                }
9397                let inner_offset;
9398                let mut inner_depth = depth.clone();
9399                if inlined {
9400                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9401                    inner_offset = next_offset;
9402                } else {
9403                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9404                    inner_depth.increment()?;
9405                }
9406                let val_ref = self.hour_cycle.get_or_insert_with(|| fidl::new_empty!(HourCycle, D));
9407                fidl::decode!(HourCycle, D, val_ref, decoder, inner_offset, inner_depth)?;
9408                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9409                {
9410                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9411                }
9412                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9413                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9414                }
9415            }
9416
9417            next_offset += envelope_size;
9418
9419            // Decode the remaining unknown envelopes.
9420            while next_offset < end_offset {
9421                _next_ordinal_to_read += 1;
9422                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9423                next_offset += envelope_size;
9424            }
9425
9426            Ok(())
9427        }
9428    }
9429
9430    impl KeyboardSettings {
9431        #[inline(always)]
9432        fn max_ordinal_present(&self) -> u64 {
9433            if let Some(_) = self.autorepeat {
9434                return 2;
9435            }
9436            if let Some(_) = self.keymap {
9437                return 1;
9438            }
9439            0
9440        }
9441    }
9442
9443    impl fidl::encoding::ValueTypeMarker for KeyboardSettings {
9444        type Borrowed<'a> = &'a Self;
9445        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9446            value
9447        }
9448    }
9449
9450    unsafe impl fidl::encoding::TypeMarker for KeyboardSettings {
9451        type Owned = Self;
9452
9453        #[inline(always)]
9454        fn inline_align(_context: fidl::encoding::Context) -> usize {
9455            8
9456        }
9457
9458        #[inline(always)]
9459        fn inline_size(_context: fidl::encoding::Context) -> usize {
9460            16
9461        }
9462    }
9463
9464    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardSettings, D>
9465        for &KeyboardSettings
9466    {
9467        unsafe fn encode(
9468            self,
9469            encoder: &mut fidl::encoding::Encoder<'_, D>,
9470            offset: usize,
9471            mut depth: fidl::encoding::Depth,
9472        ) -> fidl::Result<()> {
9473            encoder.debug_check_bounds::<KeyboardSettings>(offset);
9474            // Vector header
9475            let max_ordinal: u64 = self.max_ordinal_present();
9476            encoder.write_num(max_ordinal, offset);
9477            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9478            // Calling encoder.out_of_line_offset(0) is not allowed.
9479            if max_ordinal == 0 {
9480                return Ok(());
9481            }
9482            depth.increment()?;
9483            let envelope_size = 8;
9484            let bytes_len = max_ordinal as usize * envelope_size;
9485            #[allow(unused_variables)]
9486            let offset = encoder.out_of_line_offset(bytes_len);
9487            let mut _prev_end_offset: usize = 0;
9488            if 1 > max_ordinal {
9489                return Ok(());
9490            }
9491
9492            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9493            // are envelope_size bytes.
9494            let cur_offset: usize = (1 - 1) * envelope_size;
9495
9496            // Zero reserved fields.
9497            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9498
9499            // Safety:
9500            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9501            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9502            //   envelope_size bytes, there is always sufficient room.
9503            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input__common::KeymapId, D>(
9504            self.keymap.as_ref().map(<fidl_fuchsia_input__common::KeymapId as fidl::encoding::ValueTypeMarker>::borrow),
9505            encoder, offset + cur_offset, depth
9506        )?;
9507
9508            _prev_end_offset = cur_offset + envelope_size;
9509            if 2 > max_ordinal {
9510                return Ok(());
9511            }
9512
9513            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9514            // are envelope_size bytes.
9515            let cur_offset: usize = (2 - 1) * envelope_size;
9516
9517            // Zero reserved fields.
9518            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9519
9520            // Safety:
9521            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9522            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9523            //   envelope_size bytes, there is always sufficient room.
9524            fidl::encoding::encode_in_envelope_optional::<Autorepeat, D>(
9525                self.autorepeat
9526                    .as_ref()
9527                    .map(<Autorepeat as fidl::encoding::ValueTypeMarker>::borrow),
9528                encoder,
9529                offset + cur_offset,
9530                depth,
9531            )?;
9532
9533            _prev_end_offset = cur_offset + envelope_size;
9534
9535            Ok(())
9536        }
9537    }
9538
9539    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardSettings {
9540        #[inline(always)]
9541        fn new_empty() -> Self {
9542            Self::default()
9543        }
9544
9545        unsafe fn decode(
9546            &mut self,
9547            decoder: &mut fidl::encoding::Decoder<'_, D>,
9548            offset: usize,
9549            mut depth: fidl::encoding::Depth,
9550        ) -> fidl::Result<()> {
9551            decoder.debug_check_bounds::<Self>(offset);
9552            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9553                None => return Err(fidl::Error::NotNullable),
9554                Some(len) => len,
9555            };
9556            // Calling decoder.out_of_line_offset(0) is not allowed.
9557            if len == 0 {
9558                return Ok(());
9559            };
9560            depth.increment()?;
9561            let envelope_size = 8;
9562            let bytes_len = len * envelope_size;
9563            let offset = decoder.out_of_line_offset(bytes_len)?;
9564            // Decode the envelope for each type.
9565            let mut _next_ordinal_to_read = 0;
9566            let mut next_offset = offset;
9567            let end_offset = offset + bytes_len;
9568            _next_ordinal_to_read += 1;
9569            if next_offset >= end_offset {
9570                return Ok(());
9571            }
9572
9573            // Decode unknown envelopes for gaps in ordinals.
9574            while _next_ordinal_to_read < 1 {
9575                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9576                _next_ordinal_to_read += 1;
9577                next_offset += envelope_size;
9578            }
9579
9580            let next_out_of_line = decoder.next_out_of_line();
9581            let handles_before = decoder.remaining_handles();
9582            if let Some((inlined, num_bytes, num_handles)) =
9583                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9584            {
9585                let member_inline_size = <fidl_fuchsia_input__common::KeymapId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9586                if inlined != (member_inline_size <= 4) {
9587                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9588                }
9589                let inner_offset;
9590                let mut inner_depth = depth.clone();
9591                if inlined {
9592                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9593                    inner_offset = next_offset;
9594                } else {
9595                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9596                    inner_depth.increment()?;
9597                }
9598                let val_ref = self.keymap.get_or_insert_with(|| {
9599                    fidl::new_empty!(fidl_fuchsia_input__common::KeymapId, D)
9600                });
9601                fidl::decode!(
9602                    fidl_fuchsia_input__common::KeymapId,
9603                    D,
9604                    val_ref,
9605                    decoder,
9606                    inner_offset,
9607                    inner_depth
9608                )?;
9609                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9610                {
9611                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9612                }
9613                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9614                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9615                }
9616            }
9617
9618            next_offset += envelope_size;
9619            _next_ordinal_to_read += 1;
9620            if next_offset >= end_offset {
9621                return Ok(());
9622            }
9623
9624            // Decode unknown envelopes for gaps in ordinals.
9625            while _next_ordinal_to_read < 2 {
9626                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9627                _next_ordinal_to_read += 1;
9628                next_offset += envelope_size;
9629            }
9630
9631            let next_out_of_line = decoder.next_out_of_line();
9632            let handles_before = decoder.remaining_handles();
9633            if let Some((inlined, num_bytes, num_handles)) =
9634                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9635            {
9636                let member_inline_size =
9637                    <Autorepeat as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9638                if inlined != (member_inline_size <= 4) {
9639                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9640                }
9641                let inner_offset;
9642                let mut inner_depth = depth.clone();
9643                if inlined {
9644                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9645                    inner_offset = next_offset;
9646                } else {
9647                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9648                    inner_depth.increment()?;
9649                }
9650                let val_ref =
9651                    self.autorepeat.get_or_insert_with(|| fidl::new_empty!(Autorepeat, D));
9652                fidl::decode!(Autorepeat, D, val_ref, decoder, inner_offset, inner_depth)?;
9653                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9654                {
9655                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9656                }
9657                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9658                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9659                }
9660            }
9661
9662            next_offset += envelope_size;
9663
9664            // Decode the remaining unknown envelopes.
9665            while next_offset < end_offset {
9666                _next_ordinal_to_read += 1;
9667                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9668                next_offset += envelope_size;
9669            }
9670
9671            Ok(())
9672        }
9673    }
9674
9675    impl LightGroup {
9676        #[inline(always)]
9677        fn max_ordinal_present(&self) -> u64 {
9678            if let Some(_) = self.lights {
9679                return 4;
9680            }
9681            if let Some(_) = self.type_ {
9682                return 3;
9683            }
9684            if let Some(_) = self.enabled {
9685                return 2;
9686            }
9687            if let Some(_) = self.name {
9688                return 1;
9689            }
9690            0
9691        }
9692    }
9693
9694    impl fidl::encoding::ValueTypeMarker for LightGroup {
9695        type Borrowed<'a> = &'a Self;
9696        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9697            value
9698        }
9699    }
9700
9701    unsafe impl fidl::encoding::TypeMarker for LightGroup {
9702        type Owned = Self;
9703
9704        #[inline(always)]
9705        fn inline_align(_context: fidl::encoding::Context) -> usize {
9706            8
9707        }
9708
9709        #[inline(always)]
9710        fn inline_size(_context: fidl::encoding::Context) -> usize {
9711            16
9712        }
9713    }
9714
9715    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightGroup, D>
9716        for &LightGroup
9717    {
9718        unsafe fn encode(
9719            self,
9720            encoder: &mut fidl::encoding::Encoder<'_, D>,
9721            offset: usize,
9722            mut depth: fidl::encoding::Depth,
9723        ) -> fidl::Result<()> {
9724            encoder.debug_check_bounds::<LightGroup>(offset);
9725            // Vector header
9726            let max_ordinal: u64 = self.max_ordinal_present();
9727            encoder.write_num(max_ordinal, offset);
9728            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9729            // Calling encoder.out_of_line_offset(0) is not allowed.
9730            if max_ordinal == 0 {
9731                return Ok(());
9732            }
9733            depth.increment()?;
9734            let envelope_size = 8;
9735            let bytes_len = max_ordinal as usize * envelope_size;
9736            #[allow(unused_variables)]
9737            let offset = encoder.out_of_line_offset(bytes_len);
9738            let mut _prev_end_offset: usize = 0;
9739            if 1 > max_ordinal {
9740                return Ok(());
9741            }
9742
9743            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9744            // are envelope_size bytes.
9745            let cur_offset: usize = (1 - 1) * envelope_size;
9746
9747            // Zero reserved fields.
9748            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9749
9750            // Safety:
9751            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9752            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9753            //   envelope_size bytes, there is always sufficient room.
9754            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<32>, D>(
9755                self.name.as_ref().map(
9756                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
9757                ),
9758                encoder,
9759                offset + cur_offset,
9760                depth,
9761            )?;
9762
9763            _prev_end_offset = cur_offset + envelope_size;
9764            if 2 > max_ordinal {
9765                return Ok(());
9766            }
9767
9768            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9769            // are envelope_size bytes.
9770            let cur_offset: usize = (2 - 1) * envelope_size;
9771
9772            // Zero reserved fields.
9773            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9774
9775            // Safety:
9776            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9777            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9778            //   envelope_size bytes, there is always sufficient room.
9779            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9780                self.enabled.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9781                encoder,
9782                offset + cur_offset,
9783                depth,
9784            )?;
9785
9786            _prev_end_offset = cur_offset + envelope_size;
9787            if 3 > max_ordinal {
9788                return Ok(());
9789            }
9790
9791            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9792            // are envelope_size bytes.
9793            let cur_offset: usize = (3 - 1) * envelope_size;
9794
9795            // Zero reserved fields.
9796            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9797
9798            // Safety:
9799            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9800            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9801            //   envelope_size bytes, there is always sufficient room.
9802            fidl::encoding::encode_in_envelope_optional::<LightType, D>(
9803                self.type_.as_ref().map(<LightType as fidl::encoding::ValueTypeMarker>::borrow),
9804                encoder,
9805                offset + cur_offset,
9806                depth,
9807            )?;
9808
9809            _prev_end_offset = cur_offset + envelope_size;
9810            if 4 > max_ordinal {
9811                return Ok(());
9812            }
9813
9814            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9815            // are envelope_size bytes.
9816            let cur_offset: usize = (4 - 1) * envelope_size;
9817
9818            // Zero reserved fields.
9819            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9820
9821            // Safety:
9822            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9823            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9824            //   envelope_size bytes, there is always sufficient room.
9825            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<LightState>, D>(
9826            self.lights.as_ref().map(<fidl::encoding::UnboundedVector<LightState> as fidl::encoding::ValueTypeMarker>::borrow),
9827            encoder, offset + cur_offset, depth
9828        )?;
9829
9830            _prev_end_offset = cur_offset + envelope_size;
9831
9832            Ok(())
9833        }
9834    }
9835
9836    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightGroup {
9837        #[inline(always)]
9838        fn new_empty() -> Self {
9839            Self::default()
9840        }
9841
9842        unsafe fn decode(
9843            &mut self,
9844            decoder: &mut fidl::encoding::Decoder<'_, D>,
9845            offset: usize,
9846            mut depth: fidl::encoding::Depth,
9847        ) -> fidl::Result<()> {
9848            decoder.debug_check_bounds::<Self>(offset);
9849            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9850                None => return Err(fidl::Error::NotNullable),
9851                Some(len) => len,
9852            };
9853            // Calling decoder.out_of_line_offset(0) is not allowed.
9854            if len == 0 {
9855                return Ok(());
9856            };
9857            depth.increment()?;
9858            let envelope_size = 8;
9859            let bytes_len = len * envelope_size;
9860            let offset = decoder.out_of_line_offset(bytes_len)?;
9861            // Decode the envelope for each type.
9862            let mut _next_ordinal_to_read = 0;
9863            let mut next_offset = offset;
9864            let end_offset = offset + bytes_len;
9865            _next_ordinal_to_read += 1;
9866            if next_offset >= end_offset {
9867                return Ok(());
9868            }
9869
9870            // Decode unknown envelopes for gaps in ordinals.
9871            while _next_ordinal_to_read < 1 {
9872                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9873                _next_ordinal_to_read += 1;
9874                next_offset += envelope_size;
9875            }
9876
9877            let next_out_of_line = decoder.next_out_of_line();
9878            let handles_before = decoder.remaining_handles();
9879            if let Some((inlined, num_bytes, num_handles)) =
9880                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9881            {
9882                let member_inline_size =
9883                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
9884                        decoder.context,
9885                    );
9886                if inlined != (member_inline_size <= 4) {
9887                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9888                }
9889                let inner_offset;
9890                let mut inner_depth = depth.clone();
9891                if inlined {
9892                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9893                    inner_offset = next_offset;
9894                } else {
9895                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9896                    inner_depth.increment()?;
9897                }
9898                let val_ref = self
9899                    .name
9900                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<32>, D));
9901                fidl::decode!(
9902                    fidl::encoding::BoundedString<32>,
9903                    D,
9904                    val_ref,
9905                    decoder,
9906                    inner_offset,
9907                    inner_depth
9908                )?;
9909                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9910                {
9911                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9912                }
9913                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9914                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9915                }
9916            }
9917
9918            next_offset += envelope_size;
9919            _next_ordinal_to_read += 1;
9920            if next_offset >= end_offset {
9921                return Ok(());
9922            }
9923
9924            // Decode unknown envelopes for gaps in ordinals.
9925            while _next_ordinal_to_read < 2 {
9926                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9927                _next_ordinal_to_read += 1;
9928                next_offset += envelope_size;
9929            }
9930
9931            let next_out_of_line = decoder.next_out_of_line();
9932            let handles_before = decoder.remaining_handles();
9933            if let Some((inlined, num_bytes, num_handles)) =
9934                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9935            {
9936                let member_inline_size =
9937                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9938                if inlined != (member_inline_size <= 4) {
9939                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9940                }
9941                let inner_offset;
9942                let mut inner_depth = depth.clone();
9943                if inlined {
9944                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9945                    inner_offset = next_offset;
9946                } else {
9947                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9948                    inner_depth.increment()?;
9949                }
9950                let val_ref = self.enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
9951                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9952                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9953                {
9954                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9955                }
9956                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9957                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9958                }
9959            }
9960
9961            next_offset += envelope_size;
9962            _next_ordinal_to_read += 1;
9963            if next_offset >= end_offset {
9964                return Ok(());
9965            }
9966
9967            // Decode unknown envelopes for gaps in ordinals.
9968            while _next_ordinal_to_read < 3 {
9969                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9970                _next_ordinal_to_read += 1;
9971                next_offset += envelope_size;
9972            }
9973
9974            let next_out_of_line = decoder.next_out_of_line();
9975            let handles_before = decoder.remaining_handles();
9976            if let Some((inlined, num_bytes, num_handles)) =
9977                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9978            {
9979                let member_inline_size =
9980                    <LightType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9981                if inlined != (member_inline_size <= 4) {
9982                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9983                }
9984                let inner_offset;
9985                let mut inner_depth = depth.clone();
9986                if inlined {
9987                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9988                    inner_offset = next_offset;
9989                } else {
9990                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9991                    inner_depth.increment()?;
9992                }
9993                let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(LightType, D));
9994                fidl::decode!(LightType, D, val_ref, decoder, inner_offset, inner_depth)?;
9995                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9996                {
9997                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9998                }
9999                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10000                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10001                }
10002            }
10003
10004            next_offset += envelope_size;
10005            _next_ordinal_to_read += 1;
10006            if next_offset >= end_offset {
10007                return Ok(());
10008            }
10009
10010            // Decode unknown envelopes for gaps in ordinals.
10011            while _next_ordinal_to_read < 4 {
10012                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10013                _next_ordinal_to_read += 1;
10014                next_offset += envelope_size;
10015            }
10016
10017            let next_out_of_line = decoder.next_out_of_line();
10018            let handles_before = decoder.remaining_handles();
10019            if let Some((inlined, num_bytes, num_handles)) =
10020                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10021            {
10022                let member_inline_size = <fidl::encoding::UnboundedVector<LightState> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10023                if inlined != (member_inline_size <= 4) {
10024                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10025                }
10026                let inner_offset;
10027                let mut inner_depth = depth.clone();
10028                if inlined {
10029                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10030                    inner_offset = next_offset;
10031                } else {
10032                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10033                    inner_depth.increment()?;
10034                }
10035                let val_ref = self.lights.get_or_insert_with(|| {
10036                    fidl::new_empty!(fidl::encoding::UnboundedVector<LightState>, D)
10037                });
10038                fidl::decode!(
10039                    fidl::encoding::UnboundedVector<LightState>,
10040                    D,
10041                    val_ref,
10042                    decoder,
10043                    inner_offset,
10044                    inner_depth
10045                )?;
10046                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10047                {
10048                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10049                }
10050                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10051                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10052                }
10053            }
10054
10055            next_offset += envelope_size;
10056
10057            // Decode the remaining unknown envelopes.
10058            while next_offset < end_offset {
10059                _next_ordinal_to_read += 1;
10060                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10061                next_offset += envelope_size;
10062            }
10063
10064            Ok(())
10065        }
10066    }
10067
10068    impl LightState {
10069        #[inline(always)]
10070        fn max_ordinal_present(&self) -> u64 {
10071            if let Some(_) = self.value {
10072                return 1;
10073            }
10074            0
10075        }
10076    }
10077
10078    impl fidl::encoding::ValueTypeMarker for LightState {
10079        type Borrowed<'a> = &'a Self;
10080        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10081            value
10082        }
10083    }
10084
10085    unsafe impl fidl::encoding::TypeMarker for LightState {
10086        type Owned = Self;
10087
10088        #[inline(always)]
10089        fn inline_align(_context: fidl::encoding::Context) -> usize {
10090            8
10091        }
10092
10093        #[inline(always)]
10094        fn inline_size(_context: fidl::encoding::Context) -> usize {
10095            16
10096        }
10097    }
10098
10099    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightState, D>
10100        for &LightState
10101    {
10102        unsafe fn encode(
10103            self,
10104            encoder: &mut fidl::encoding::Encoder<'_, D>,
10105            offset: usize,
10106            mut depth: fidl::encoding::Depth,
10107        ) -> fidl::Result<()> {
10108            encoder.debug_check_bounds::<LightState>(offset);
10109            // Vector header
10110            let max_ordinal: u64 = self.max_ordinal_present();
10111            encoder.write_num(max_ordinal, offset);
10112            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10113            // Calling encoder.out_of_line_offset(0) is not allowed.
10114            if max_ordinal == 0 {
10115                return Ok(());
10116            }
10117            depth.increment()?;
10118            let envelope_size = 8;
10119            let bytes_len = max_ordinal as usize * envelope_size;
10120            #[allow(unused_variables)]
10121            let offset = encoder.out_of_line_offset(bytes_len);
10122            let mut _prev_end_offset: usize = 0;
10123            if 1 > max_ordinal {
10124                return Ok(());
10125            }
10126
10127            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10128            // are envelope_size bytes.
10129            let cur_offset: usize = (1 - 1) * envelope_size;
10130
10131            // Zero reserved fields.
10132            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10133
10134            // Safety:
10135            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10136            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10137            //   envelope_size bytes, there is always sufficient room.
10138            fidl::encoding::encode_in_envelope_optional::<LightValue, D>(
10139                self.value.as_ref().map(<LightValue as fidl::encoding::ValueTypeMarker>::borrow),
10140                encoder,
10141                offset + cur_offset,
10142                depth,
10143            )?;
10144
10145            _prev_end_offset = cur_offset + envelope_size;
10146
10147            Ok(())
10148        }
10149    }
10150
10151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightState {
10152        #[inline(always)]
10153        fn new_empty() -> Self {
10154            Self::default()
10155        }
10156
10157        unsafe fn decode(
10158            &mut self,
10159            decoder: &mut fidl::encoding::Decoder<'_, D>,
10160            offset: usize,
10161            mut depth: fidl::encoding::Depth,
10162        ) -> fidl::Result<()> {
10163            decoder.debug_check_bounds::<Self>(offset);
10164            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10165                None => return Err(fidl::Error::NotNullable),
10166                Some(len) => len,
10167            };
10168            // Calling decoder.out_of_line_offset(0) is not allowed.
10169            if len == 0 {
10170                return Ok(());
10171            };
10172            depth.increment()?;
10173            let envelope_size = 8;
10174            let bytes_len = len * envelope_size;
10175            let offset = decoder.out_of_line_offset(bytes_len)?;
10176            // Decode the envelope for each type.
10177            let mut _next_ordinal_to_read = 0;
10178            let mut next_offset = offset;
10179            let end_offset = offset + bytes_len;
10180            _next_ordinal_to_read += 1;
10181            if next_offset >= end_offset {
10182                return Ok(());
10183            }
10184
10185            // Decode unknown envelopes for gaps in ordinals.
10186            while _next_ordinal_to_read < 1 {
10187                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10188                _next_ordinal_to_read += 1;
10189                next_offset += envelope_size;
10190            }
10191
10192            let next_out_of_line = decoder.next_out_of_line();
10193            let handles_before = decoder.remaining_handles();
10194            if let Some((inlined, num_bytes, num_handles)) =
10195                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10196            {
10197                let member_inline_size =
10198                    <LightValue as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10199                if inlined != (member_inline_size <= 4) {
10200                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10201                }
10202                let inner_offset;
10203                let mut inner_depth = depth.clone();
10204                if inlined {
10205                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10206                    inner_offset = next_offset;
10207                } else {
10208                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10209                    inner_depth.increment()?;
10210                }
10211                let val_ref = self.value.get_or_insert_with(|| fidl::new_empty!(LightValue, D));
10212                fidl::decode!(LightValue, D, val_ref, decoder, inner_offset, inner_depth)?;
10213                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10214                {
10215                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10216                }
10217                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10218                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10219                }
10220            }
10221
10222            next_offset += envelope_size;
10223
10224            // Decode the remaining unknown envelopes.
10225            while next_offset < end_offset {
10226                _next_ordinal_to_read += 1;
10227                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10228                next_offset += envelope_size;
10229            }
10230
10231            Ok(())
10232        }
10233    }
10234
10235    impl NightModeSettings {
10236        #[inline(always)]
10237        fn max_ordinal_present(&self) -> u64 {
10238            if let Some(_) = self.night_mode_enabled {
10239                return 1;
10240            }
10241            0
10242        }
10243    }
10244
10245    impl fidl::encoding::ValueTypeMarker for NightModeSettings {
10246        type Borrowed<'a> = &'a Self;
10247        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10248            value
10249        }
10250    }
10251
10252    unsafe impl fidl::encoding::TypeMarker for NightModeSettings {
10253        type Owned = Self;
10254
10255        #[inline(always)]
10256        fn inline_align(_context: fidl::encoding::Context) -> usize {
10257            8
10258        }
10259
10260        #[inline(always)]
10261        fn inline_size(_context: fidl::encoding::Context) -> usize {
10262            16
10263        }
10264    }
10265
10266    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NightModeSettings, D>
10267        for &NightModeSettings
10268    {
10269        unsafe fn encode(
10270            self,
10271            encoder: &mut fidl::encoding::Encoder<'_, D>,
10272            offset: usize,
10273            mut depth: fidl::encoding::Depth,
10274        ) -> fidl::Result<()> {
10275            encoder.debug_check_bounds::<NightModeSettings>(offset);
10276            // Vector header
10277            let max_ordinal: u64 = self.max_ordinal_present();
10278            encoder.write_num(max_ordinal, offset);
10279            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10280            // Calling encoder.out_of_line_offset(0) is not allowed.
10281            if max_ordinal == 0 {
10282                return Ok(());
10283            }
10284            depth.increment()?;
10285            let envelope_size = 8;
10286            let bytes_len = max_ordinal as usize * envelope_size;
10287            #[allow(unused_variables)]
10288            let offset = encoder.out_of_line_offset(bytes_len);
10289            let mut _prev_end_offset: usize = 0;
10290            if 1 > max_ordinal {
10291                return Ok(());
10292            }
10293
10294            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10295            // are envelope_size bytes.
10296            let cur_offset: usize = (1 - 1) * envelope_size;
10297
10298            // Zero reserved fields.
10299            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10300
10301            // Safety:
10302            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10303            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10304            //   envelope_size bytes, there is always sufficient room.
10305            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10306                self.night_mode_enabled
10307                    .as_ref()
10308                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10309                encoder,
10310                offset + cur_offset,
10311                depth,
10312            )?;
10313
10314            _prev_end_offset = cur_offset + envelope_size;
10315
10316            Ok(())
10317        }
10318    }
10319
10320    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NightModeSettings {
10321        #[inline(always)]
10322        fn new_empty() -> Self {
10323            Self::default()
10324        }
10325
10326        unsafe fn decode(
10327            &mut self,
10328            decoder: &mut fidl::encoding::Decoder<'_, D>,
10329            offset: usize,
10330            mut depth: fidl::encoding::Depth,
10331        ) -> fidl::Result<()> {
10332            decoder.debug_check_bounds::<Self>(offset);
10333            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10334                None => return Err(fidl::Error::NotNullable),
10335                Some(len) => len,
10336            };
10337            // Calling decoder.out_of_line_offset(0) is not allowed.
10338            if len == 0 {
10339                return Ok(());
10340            };
10341            depth.increment()?;
10342            let envelope_size = 8;
10343            let bytes_len = len * envelope_size;
10344            let offset = decoder.out_of_line_offset(bytes_len)?;
10345            // Decode the envelope for each type.
10346            let mut _next_ordinal_to_read = 0;
10347            let mut next_offset = offset;
10348            let end_offset = offset + bytes_len;
10349            _next_ordinal_to_read += 1;
10350            if next_offset >= end_offset {
10351                return Ok(());
10352            }
10353
10354            // Decode unknown envelopes for gaps in ordinals.
10355            while _next_ordinal_to_read < 1 {
10356                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10357                _next_ordinal_to_read += 1;
10358                next_offset += envelope_size;
10359            }
10360
10361            let next_out_of_line = decoder.next_out_of_line();
10362            let handles_before = decoder.remaining_handles();
10363            if let Some((inlined, num_bytes, num_handles)) =
10364                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10365            {
10366                let member_inline_size =
10367                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10368                if inlined != (member_inline_size <= 4) {
10369                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10370                }
10371                let inner_offset;
10372                let mut inner_depth = depth.clone();
10373                if inlined {
10374                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10375                    inner_offset = next_offset;
10376                } else {
10377                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10378                    inner_depth.increment()?;
10379                }
10380                let val_ref =
10381                    self.night_mode_enabled.get_or_insert_with(|| fidl::new_empty!(bool, D));
10382                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10383                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10384                {
10385                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10386                }
10387                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10388                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10389                }
10390            }
10391
10392            next_offset += envelope_size;
10393
10394            // Decode the remaining unknown envelopes.
10395            while next_offset < end_offset {
10396                _next_ordinal_to_read += 1;
10397                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10398                next_offset += envelope_size;
10399            }
10400
10401            Ok(())
10402        }
10403    }
10404
10405    impl PrivacySettings {
10406        #[inline(always)]
10407        fn max_ordinal_present(&self) -> u64 {
10408            if let Some(_) = self.user_data_sharing_consent {
10409                return 1;
10410            }
10411            0
10412        }
10413    }
10414
10415    impl fidl::encoding::ValueTypeMarker for PrivacySettings {
10416        type Borrowed<'a> = &'a Self;
10417        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10418            value
10419        }
10420    }
10421
10422    unsafe impl fidl::encoding::TypeMarker for PrivacySettings {
10423        type Owned = Self;
10424
10425        #[inline(always)]
10426        fn inline_align(_context: fidl::encoding::Context) -> usize {
10427            8
10428        }
10429
10430        #[inline(always)]
10431        fn inline_size(_context: fidl::encoding::Context) -> usize {
10432            16
10433        }
10434    }
10435
10436    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrivacySettings, D>
10437        for &PrivacySettings
10438    {
10439        unsafe fn encode(
10440            self,
10441            encoder: &mut fidl::encoding::Encoder<'_, D>,
10442            offset: usize,
10443            mut depth: fidl::encoding::Depth,
10444        ) -> fidl::Result<()> {
10445            encoder.debug_check_bounds::<PrivacySettings>(offset);
10446            // Vector header
10447            let max_ordinal: u64 = self.max_ordinal_present();
10448            encoder.write_num(max_ordinal, offset);
10449            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10450            // Calling encoder.out_of_line_offset(0) is not allowed.
10451            if max_ordinal == 0 {
10452                return Ok(());
10453            }
10454            depth.increment()?;
10455            let envelope_size = 8;
10456            let bytes_len = max_ordinal as usize * envelope_size;
10457            #[allow(unused_variables)]
10458            let offset = encoder.out_of_line_offset(bytes_len);
10459            let mut _prev_end_offset: usize = 0;
10460            if 1 > max_ordinal {
10461                return Ok(());
10462            }
10463
10464            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10465            // are envelope_size bytes.
10466            let cur_offset: usize = (1 - 1) * envelope_size;
10467
10468            // Zero reserved fields.
10469            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10470
10471            // Safety:
10472            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10473            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10474            //   envelope_size bytes, there is always sufficient room.
10475            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10476                self.user_data_sharing_consent
10477                    .as_ref()
10478                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10479                encoder,
10480                offset + cur_offset,
10481                depth,
10482            )?;
10483
10484            _prev_end_offset = cur_offset + envelope_size;
10485
10486            Ok(())
10487        }
10488    }
10489
10490    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrivacySettings {
10491        #[inline(always)]
10492        fn new_empty() -> Self {
10493            Self::default()
10494        }
10495
10496        unsafe fn decode(
10497            &mut self,
10498            decoder: &mut fidl::encoding::Decoder<'_, D>,
10499            offset: usize,
10500            mut depth: fidl::encoding::Depth,
10501        ) -> fidl::Result<()> {
10502            decoder.debug_check_bounds::<Self>(offset);
10503            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10504                None => return Err(fidl::Error::NotNullable),
10505                Some(len) => len,
10506            };
10507            // Calling decoder.out_of_line_offset(0) is not allowed.
10508            if len == 0 {
10509                return Ok(());
10510            };
10511            depth.increment()?;
10512            let envelope_size = 8;
10513            let bytes_len = len * envelope_size;
10514            let offset = decoder.out_of_line_offset(bytes_len)?;
10515            // Decode the envelope for each type.
10516            let mut _next_ordinal_to_read = 0;
10517            let mut next_offset = offset;
10518            let end_offset = offset + bytes_len;
10519            _next_ordinal_to_read += 1;
10520            if next_offset >= end_offset {
10521                return Ok(());
10522            }
10523
10524            // Decode unknown envelopes for gaps in ordinals.
10525            while _next_ordinal_to_read < 1 {
10526                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10527                _next_ordinal_to_read += 1;
10528                next_offset += envelope_size;
10529            }
10530
10531            let next_out_of_line = decoder.next_out_of_line();
10532            let handles_before = decoder.remaining_handles();
10533            if let Some((inlined, num_bytes, num_handles)) =
10534                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10535            {
10536                let member_inline_size =
10537                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10538                if inlined != (member_inline_size <= 4) {
10539                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10540                }
10541                let inner_offset;
10542                let mut inner_depth = depth.clone();
10543                if inlined {
10544                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10545                    inner_offset = next_offset;
10546                } else {
10547                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10548                    inner_depth.increment()?;
10549                }
10550                let val_ref =
10551                    self.user_data_sharing_consent.get_or_insert_with(|| fidl::new_empty!(bool, D));
10552                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10553                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10554                {
10555                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10556                }
10557                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10558                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10559                }
10560            }
10561
10562            next_offset += envelope_size;
10563
10564            // Decode the remaining unknown envelopes.
10565            while next_offset < end_offset {
10566                _next_ordinal_to_read += 1;
10567                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10568                next_offset += envelope_size;
10569            }
10570
10571            Ok(())
10572        }
10573    }
10574
10575    impl SetupSettings {
10576        #[inline(always)]
10577        fn max_ordinal_present(&self) -> u64 {
10578            if let Some(_) = self.enabled_configuration_interfaces {
10579                return 1;
10580            }
10581            0
10582        }
10583    }
10584
10585    impl fidl::encoding::ValueTypeMarker for SetupSettings {
10586        type Borrowed<'a> = &'a Self;
10587        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10588            value
10589        }
10590    }
10591
10592    unsafe impl fidl::encoding::TypeMarker for SetupSettings {
10593        type Owned = Self;
10594
10595        #[inline(always)]
10596        fn inline_align(_context: fidl::encoding::Context) -> usize {
10597            8
10598        }
10599
10600        #[inline(always)]
10601        fn inline_size(_context: fidl::encoding::Context) -> usize {
10602            16
10603        }
10604    }
10605
10606    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetupSettings, D>
10607        for &SetupSettings
10608    {
10609        unsafe fn encode(
10610            self,
10611            encoder: &mut fidl::encoding::Encoder<'_, D>,
10612            offset: usize,
10613            mut depth: fidl::encoding::Depth,
10614        ) -> fidl::Result<()> {
10615            encoder.debug_check_bounds::<SetupSettings>(offset);
10616            // Vector header
10617            let max_ordinal: u64 = self.max_ordinal_present();
10618            encoder.write_num(max_ordinal, offset);
10619            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10620            // Calling encoder.out_of_line_offset(0) is not allowed.
10621            if max_ordinal == 0 {
10622                return Ok(());
10623            }
10624            depth.increment()?;
10625            let envelope_size = 8;
10626            let bytes_len = max_ordinal as usize * envelope_size;
10627            #[allow(unused_variables)]
10628            let offset = encoder.out_of_line_offset(bytes_len);
10629            let mut _prev_end_offset: usize = 0;
10630            if 1 > max_ordinal {
10631                return Ok(());
10632            }
10633
10634            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10635            // are envelope_size bytes.
10636            let cur_offset: usize = (1 - 1) * envelope_size;
10637
10638            // Zero reserved fields.
10639            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10640
10641            // Safety:
10642            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10643            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10644            //   envelope_size bytes, there is always sufficient room.
10645            fidl::encoding::encode_in_envelope_optional::<ConfigurationInterfaces, D>(
10646                self.enabled_configuration_interfaces
10647                    .as_ref()
10648                    .map(<ConfigurationInterfaces as fidl::encoding::ValueTypeMarker>::borrow),
10649                encoder,
10650                offset + cur_offset,
10651                depth,
10652            )?;
10653
10654            _prev_end_offset = cur_offset + envelope_size;
10655
10656            Ok(())
10657        }
10658    }
10659
10660    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetupSettings {
10661        #[inline(always)]
10662        fn new_empty() -> Self {
10663            Self::default()
10664        }
10665
10666        unsafe fn decode(
10667            &mut self,
10668            decoder: &mut fidl::encoding::Decoder<'_, D>,
10669            offset: usize,
10670            mut depth: fidl::encoding::Depth,
10671        ) -> fidl::Result<()> {
10672            decoder.debug_check_bounds::<Self>(offset);
10673            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10674                None => return Err(fidl::Error::NotNullable),
10675                Some(len) => len,
10676            };
10677            // Calling decoder.out_of_line_offset(0) is not allowed.
10678            if len == 0 {
10679                return Ok(());
10680            };
10681            depth.increment()?;
10682            let envelope_size = 8;
10683            let bytes_len = len * envelope_size;
10684            let offset = decoder.out_of_line_offset(bytes_len)?;
10685            // Decode the envelope for each type.
10686            let mut _next_ordinal_to_read = 0;
10687            let mut next_offset = offset;
10688            let end_offset = offset + bytes_len;
10689            _next_ordinal_to_read += 1;
10690            if next_offset >= end_offset {
10691                return Ok(());
10692            }
10693
10694            // Decode unknown envelopes for gaps in ordinals.
10695            while _next_ordinal_to_read < 1 {
10696                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10697                _next_ordinal_to_read += 1;
10698                next_offset += envelope_size;
10699            }
10700
10701            let next_out_of_line = decoder.next_out_of_line();
10702            let handles_before = decoder.remaining_handles();
10703            if let Some((inlined, num_bytes, num_handles)) =
10704                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10705            {
10706                let member_inline_size =
10707                    <ConfigurationInterfaces as fidl::encoding::TypeMarker>::inline_size(
10708                        decoder.context,
10709                    );
10710                if inlined != (member_inline_size <= 4) {
10711                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10712                }
10713                let inner_offset;
10714                let mut inner_depth = depth.clone();
10715                if inlined {
10716                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10717                    inner_offset = next_offset;
10718                } else {
10719                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10720                    inner_depth.increment()?;
10721                }
10722                let val_ref = self
10723                    .enabled_configuration_interfaces
10724                    .get_or_insert_with(|| fidl::new_empty!(ConfigurationInterfaces, D));
10725                fidl::decode!(
10726                    ConfigurationInterfaces,
10727                    D,
10728                    val_ref,
10729                    decoder,
10730                    inner_offset,
10731                    inner_depth
10732                )?;
10733                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10734                {
10735                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10736                }
10737                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10738                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10739                }
10740            }
10741
10742            next_offset += envelope_size;
10743
10744            // Decode the remaining unknown envelopes.
10745            while next_offset < end_offset {
10746                _next_ordinal_to_read += 1;
10747                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10748                next_offset += envelope_size;
10749            }
10750
10751            Ok(())
10752        }
10753    }
10754
10755    impl SourceState {
10756        #[inline(always)]
10757        fn max_ordinal_present(&self) -> u64 {
10758            if let Some(_) = self.state {
10759                return 2;
10760            }
10761            if let Some(_) = self.source {
10762                return 1;
10763            }
10764            0
10765        }
10766    }
10767
10768    impl fidl::encoding::ValueTypeMarker for SourceState {
10769        type Borrowed<'a> = &'a Self;
10770        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10771            value
10772        }
10773    }
10774
10775    unsafe impl fidl::encoding::TypeMarker for SourceState {
10776        type Owned = Self;
10777
10778        #[inline(always)]
10779        fn inline_align(_context: fidl::encoding::Context) -> usize {
10780            8
10781        }
10782
10783        #[inline(always)]
10784        fn inline_size(_context: fidl::encoding::Context) -> usize {
10785            16
10786        }
10787    }
10788
10789    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SourceState, D>
10790        for &SourceState
10791    {
10792        unsafe fn encode(
10793            self,
10794            encoder: &mut fidl::encoding::Encoder<'_, D>,
10795            offset: usize,
10796            mut depth: fidl::encoding::Depth,
10797        ) -> fidl::Result<()> {
10798            encoder.debug_check_bounds::<SourceState>(offset);
10799            // Vector header
10800            let max_ordinal: u64 = self.max_ordinal_present();
10801            encoder.write_num(max_ordinal, offset);
10802            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10803            // Calling encoder.out_of_line_offset(0) is not allowed.
10804            if max_ordinal == 0 {
10805                return Ok(());
10806            }
10807            depth.increment()?;
10808            let envelope_size = 8;
10809            let bytes_len = max_ordinal as usize * envelope_size;
10810            #[allow(unused_variables)]
10811            let offset = encoder.out_of_line_offset(bytes_len);
10812            let mut _prev_end_offset: usize = 0;
10813            if 1 > max_ordinal {
10814                return Ok(());
10815            }
10816
10817            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10818            // are envelope_size bytes.
10819            let cur_offset: usize = (1 - 1) * envelope_size;
10820
10821            // Zero reserved fields.
10822            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10823
10824            // Safety:
10825            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10826            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10827            //   envelope_size bytes, there is always sufficient room.
10828            fidl::encoding::encode_in_envelope_optional::<DeviceStateSource, D>(
10829                self.source
10830                    .as_ref()
10831                    .map(<DeviceStateSource as fidl::encoding::ValueTypeMarker>::borrow),
10832                encoder,
10833                offset + cur_offset,
10834                depth,
10835            )?;
10836
10837            _prev_end_offset = cur_offset + envelope_size;
10838            if 2 > max_ordinal {
10839                return Ok(());
10840            }
10841
10842            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10843            // are envelope_size bytes.
10844            let cur_offset: usize = (2 - 1) * envelope_size;
10845
10846            // Zero reserved fields.
10847            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10848
10849            // Safety:
10850            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10851            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10852            //   envelope_size bytes, there is always sufficient room.
10853            fidl::encoding::encode_in_envelope_optional::<DeviceState, D>(
10854                self.state.as_ref().map(<DeviceState as fidl::encoding::ValueTypeMarker>::borrow),
10855                encoder,
10856                offset + cur_offset,
10857                depth,
10858            )?;
10859
10860            _prev_end_offset = cur_offset + envelope_size;
10861
10862            Ok(())
10863        }
10864    }
10865
10866    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SourceState {
10867        #[inline(always)]
10868        fn new_empty() -> Self {
10869            Self::default()
10870        }
10871
10872        unsafe fn decode(
10873            &mut self,
10874            decoder: &mut fidl::encoding::Decoder<'_, D>,
10875            offset: usize,
10876            mut depth: fidl::encoding::Depth,
10877        ) -> fidl::Result<()> {
10878            decoder.debug_check_bounds::<Self>(offset);
10879            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10880                None => return Err(fidl::Error::NotNullable),
10881                Some(len) => len,
10882            };
10883            // Calling decoder.out_of_line_offset(0) is not allowed.
10884            if len == 0 {
10885                return Ok(());
10886            };
10887            depth.increment()?;
10888            let envelope_size = 8;
10889            let bytes_len = len * envelope_size;
10890            let offset = decoder.out_of_line_offset(bytes_len)?;
10891            // Decode the envelope for each type.
10892            let mut _next_ordinal_to_read = 0;
10893            let mut next_offset = offset;
10894            let end_offset = offset + bytes_len;
10895            _next_ordinal_to_read += 1;
10896            if next_offset >= end_offset {
10897                return Ok(());
10898            }
10899
10900            // Decode unknown envelopes for gaps in ordinals.
10901            while _next_ordinal_to_read < 1 {
10902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10903                _next_ordinal_to_read += 1;
10904                next_offset += envelope_size;
10905            }
10906
10907            let next_out_of_line = decoder.next_out_of_line();
10908            let handles_before = decoder.remaining_handles();
10909            if let Some((inlined, num_bytes, num_handles)) =
10910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10911            {
10912                let member_inline_size =
10913                    <DeviceStateSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10914                if inlined != (member_inline_size <= 4) {
10915                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10916                }
10917                let inner_offset;
10918                let mut inner_depth = depth.clone();
10919                if inlined {
10920                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10921                    inner_offset = next_offset;
10922                } else {
10923                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10924                    inner_depth.increment()?;
10925                }
10926                let val_ref =
10927                    self.source.get_or_insert_with(|| fidl::new_empty!(DeviceStateSource, D));
10928                fidl::decode!(DeviceStateSource, D, val_ref, decoder, inner_offset, inner_depth)?;
10929                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10930                {
10931                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10932                }
10933                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10934                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10935                }
10936            }
10937
10938            next_offset += envelope_size;
10939            _next_ordinal_to_read += 1;
10940            if next_offset >= end_offset {
10941                return Ok(());
10942            }
10943
10944            // Decode unknown envelopes for gaps in ordinals.
10945            while _next_ordinal_to_read < 2 {
10946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10947                _next_ordinal_to_read += 1;
10948                next_offset += envelope_size;
10949            }
10950
10951            let next_out_of_line = decoder.next_out_of_line();
10952            let handles_before = decoder.remaining_handles();
10953            if let Some((inlined, num_bytes, num_handles)) =
10954                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10955            {
10956                let member_inline_size =
10957                    <DeviceState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10958                if inlined != (member_inline_size <= 4) {
10959                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10960                }
10961                let inner_offset;
10962                let mut inner_depth = depth.clone();
10963                if inlined {
10964                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10965                    inner_offset = next_offset;
10966                } else {
10967                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10968                    inner_depth.increment()?;
10969                }
10970                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(DeviceState, D));
10971                fidl::decode!(DeviceState, D, val_ref, decoder, inner_offset, inner_depth)?;
10972                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10973                {
10974                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10975                }
10976                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10977                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10978                }
10979            }
10980
10981            next_offset += envelope_size;
10982
10983            // Decode the remaining unknown envelopes.
10984            while next_offset < end_offset {
10985                _next_ordinal_to_read += 1;
10986                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10987                next_offset += envelope_size;
10988            }
10989
10990            Ok(())
10991        }
10992    }
10993
10994    impl Theme {
10995        #[inline(always)]
10996        fn max_ordinal_present(&self) -> u64 {
10997            if let Some(_) = self.theme_mode {
10998                return 2;
10999            }
11000            if let Some(_) = self.theme_type {
11001                return 1;
11002            }
11003            0
11004        }
11005    }
11006
11007    impl fidl::encoding::ValueTypeMarker for Theme {
11008        type Borrowed<'a> = &'a Self;
11009        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11010            value
11011        }
11012    }
11013
11014    unsafe impl fidl::encoding::TypeMarker for Theme {
11015        type Owned = Self;
11016
11017        #[inline(always)]
11018        fn inline_align(_context: fidl::encoding::Context) -> usize {
11019            8
11020        }
11021
11022        #[inline(always)]
11023        fn inline_size(_context: fidl::encoding::Context) -> usize {
11024            16
11025        }
11026    }
11027
11028    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Theme, D> for &Theme {
11029        unsafe fn encode(
11030            self,
11031            encoder: &mut fidl::encoding::Encoder<'_, D>,
11032            offset: usize,
11033            mut depth: fidl::encoding::Depth,
11034        ) -> fidl::Result<()> {
11035            encoder.debug_check_bounds::<Theme>(offset);
11036            // Vector header
11037            let max_ordinal: u64 = self.max_ordinal_present();
11038            encoder.write_num(max_ordinal, offset);
11039            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11040            // Calling encoder.out_of_line_offset(0) is not allowed.
11041            if max_ordinal == 0 {
11042                return Ok(());
11043            }
11044            depth.increment()?;
11045            let envelope_size = 8;
11046            let bytes_len = max_ordinal as usize * envelope_size;
11047            #[allow(unused_variables)]
11048            let offset = encoder.out_of_line_offset(bytes_len);
11049            let mut _prev_end_offset: usize = 0;
11050            if 1 > max_ordinal {
11051                return Ok(());
11052            }
11053
11054            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11055            // are envelope_size bytes.
11056            let cur_offset: usize = (1 - 1) * envelope_size;
11057
11058            // Zero reserved fields.
11059            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11060
11061            // Safety:
11062            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11063            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11064            //   envelope_size bytes, there is always sufficient room.
11065            fidl::encoding::encode_in_envelope_optional::<ThemeType, D>(
11066                self.theme_type
11067                    .as_ref()
11068                    .map(<ThemeType as fidl::encoding::ValueTypeMarker>::borrow),
11069                encoder,
11070                offset + cur_offset,
11071                depth,
11072            )?;
11073
11074            _prev_end_offset = cur_offset + envelope_size;
11075            if 2 > max_ordinal {
11076                return Ok(());
11077            }
11078
11079            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11080            // are envelope_size bytes.
11081            let cur_offset: usize = (2 - 1) * envelope_size;
11082
11083            // Zero reserved fields.
11084            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11085
11086            // Safety:
11087            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11088            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11089            //   envelope_size bytes, there is always sufficient room.
11090            fidl::encoding::encode_in_envelope_optional::<ThemeMode, D>(
11091                self.theme_mode
11092                    .as_ref()
11093                    .map(<ThemeMode as fidl::encoding::ValueTypeMarker>::borrow),
11094                encoder,
11095                offset + cur_offset,
11096                depth,
11097            )?;
11098
11099            _prev_end_offset = cur_offset + envelope_size;
11100
11101            Ok(())
11102        }
11103    }
11104
11105    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Theme {
11106        #[inline(always)]
11107        fn new_empty() -> Self {
11108            Self::default()
11109        }
11110
11111        unsafe fn decode(
11112            &mut self,
11113            decoder: &mut fidl::encoding::Decoder<'_, D>,
11114            offset: usize,
11115            mut depth: fidl::encoding::Depth,
11116        ) -> fidl::Result<()> {
11117            decoder.debug_check_bounds::<Self>(offset);
11118            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11119                None => return Err(fidl::Error::NotNullable),
11120                Some(len) => len,
11121            };
11122            // Calling decoder.out_of_line_offset(0) is not allowed.
11123            if len == 0 {
11124                return Ok(());
11125            };
11126            depth.increment()?;
11127            let envelope_size = 8;
11128            let bytes_len = len * envelope_size;
11129            let offset = decoder.out_of_line_offset(bytes_len)?;
11130            // Decode the envelope for each type.
11131            let mut _next_ordinal_to_read = 0;
11132            let mut next_offset = offset;
11133            let end_offset = offset + bytes_len;
11134            _next_ordinal_to_read += 1;
11135            if next_offset >= end_offset {
11136                return Ok(());
11137            }
11138
11139            // Decode unknown envelopes for gaps in ordinals.
11140            while _next_ordinal_to_read < 1 {
11141                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11142                _next_ordinal_to_read += 1;
11143                next_offset += envelope_size;
11144            }
11145
11146            let next_out_of_line = decoder.next_out_of_line();
11147            let handles_before = decoder.remaining_handles();
11148            if let Some((inlined, num_bytes, num_handles)) =
11149                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11150            {
11151                let member_inline_size =
11152                    <ThemeType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11153                if inlined != (member_inline_size <= 4) {
11154                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11155                }
11156                let inner_offset;
11157                let mut inner_depth = depth.clone();
11158                if inlined {
11159                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11160                    inner_offset = next_offset;
11161                } else {
11162                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11163                    inner_depth.increment()?;
11164                }
11165                let val_ref = self.theme_type.get_or_insert_with(|| fidl::new_empty!(ThemeType, D));
11166                fidl::decode!(ThemeType, D, val_ref, decoder, inner_offset, inner_depth)?;
11167                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11168                {
11169                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11170                }
11171                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11172                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11173                }
11174            }
11175
11176            next_offset += envelope_size;
11177            _next_ordinal_to_read += 1;
11178            if next_offset >= end_offset {
11179                return Ok(());
11180            }
11181
11182            // Decode unknown envelopes for gaps in ordinals.
11183            while _next_ordinal_to_read < 2 {
11184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11185                _next_ordinal_to_read += 1;
11186                next_offset += envelope_size;
11187            }
11188
11189            let next_out_of_line = decoder.next_out_of_line();
11190            let handles_before = decoder.remaining_handles();
11191            if let Some((inlined, num_bytes, num_handles)) =
11192                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11193            {
11194                let member_inline_size =
11195                    <ThemeMode as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11196                if inlined != (member_inline_size <= 4) {
11197                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11198                }
11199                let inner_offset;
11200                let mut inner_depth = depth.clone();
11201                if inlined {
11202                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11203                    inner_offset = next_offset;
11204                } else {
11205                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11206                    inner_depth.increment()?;
11207                }
11208                let val_ref = self.theme_mode.get_or_insert_with(|| fidl::new_empty!(ThemeMode, D));
11209                fidl::decode!(ThemeMode, D, val_ref, decoder, inner_offset, inner_depth)?;
11210                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11211                {
11212                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11213                }
11214                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11215                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11216                }
11217            }
11218
11219            next_offset += envelope_size;
11220
11221            // Decode the remaining unknown envelopes.
11222            while next_offset < end_offset {
11223                _next_ordinal_to_read += 1;
11224                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11225                next_offset += envelope_size;
11226            }
11227
11228            Ok(())
11229        }
11230    }
11231
11232    impl Volume {
11233        #[inline(always)]
11234        fn max_ordinal_present(&self) -> u64 {
11235            if let Some(_) = self.muted {
11236                return 2;
11237            }
11238            if let Some(_) = self.level {
11239                return 1;
11240            }
11241            0
11242        }
11243    }
11244
11245    impl fidl::encoding::ValueTypeMarker for Volume {
11246        type Borrowed<'a> = &'a Self;
11247        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11248            value
11249        }
11250    }
11251
11252    unsafe impl fidl::encoding::TypeMarker for Volume {
11253        type Owned = Self;
11254
11255        #[inline(always)]
11256        fn inline_align(_context: fidl::encoding::Context) -> usize {
11257            8
11258        }
11259
11260        #[inline(always)]
11261        fn inline_size(_context: fidl::encoding::Context) -> usize {
11262            16
11263        }
11264    }
11265
11266    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Volume, D> for &Volume {
11267        unsafe fn encode(
11268            self,
11269            encoder: &mut fidl::encoding::Encoder<'_, D>,
11270            offset: usize,
11271            mut depth: fidl::encoding::Depth,
11272        ) -> fidl::Result<()> {
11273            encoder.debug_check_bounds::<Volume>(offset);
11274            // Vector header
11275            let max_ordinal: u64 = self.max_ordinal_present();
11276            encoder.write_num(max_ordinal, offset);
11277            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11278            // Calling encoder.out_of_line_offset(0) is not allowed.
11279            if max_ordinal == 0 {
11280                return Ok(());
11281            }
11282            depth.increment()?;
11283            let envelope_size = 8;
11284            let bytes_len = max_ordinal as usize * envelope_size;
11285            #[allow(unused_variables)]
11286            let offset = encoder.out_of_line_offset(bytes_len);
11287            let mut _prev_end_offset: usize = 0;
11288            if 1 > max_ordinal {
11289                return Ok(());
11290            }
11291
11292            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11293            // are envelope_size bytes.
11294            let cur_offset: usize = (1 - 1) * envelope_size;
11295
11296            // Zero reserved fields.
11297            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11298
11299            // Safety:
11300            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11301            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11302            //   envelope_size bytes, there is always sufficient room.
11303            fidl::encoding::encode_in_envelope_optional::<f32, D>(
11304                self.level.as_ref().map(<f32 as fidl::encoding::ValueTypeMarker>::borrow),
11305                encoder,
11306                offset + cur_offset,
11307                depth,
11308            )?;
11309
11310            _prev_end_offset = cur_offset + envelope_size;
11311            if 2 > max_ordinal {
11312                return Ok(());
11313            }
11314
11315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11316            // are envelope_size bytes.
11317            let cur_offset: usize = (2 - 1) * envelope_size;
11318
11319            // Zero reserved fields.
11320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11321
11322            // Safety:
11323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11325            //   envelope_size bytes, there is always sufficient room.
11326            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11327                self.muted.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11328                encoder,
11329                offset + cur_offset,
11330                depth,
11331            )?;
11332
11333            _prev_end_offset = cur_offset + envelope_size;
11334
11335            Ok(())
11336        }
11337    }
11338
11339    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Volume {
11340        #[inline(always)]
11341        fn new_empty() -> Self {
11342            Self::default()
11343        }
11344
11345        unsafe fn decode(
11346            &mut self,
11347            decoder: &mut fidl::encoding::Decoder<'_, D>,
11348            offset: usize,
11349            mut depth: fidl::encoding::Depth,
11350        ) -> fidl::Result<()> {
11351            decoder.debug_check_bounds::<Self>(offset);
11352            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11353                None => return Err(fidl::Error::NotNullable),
11354                Some(len) => len,
11355            };
11356            // Calling decoder.out_of_line_offset(0) is not allowed.
11357            if len == 0 {
11358                return Ok(());
11359            };
11360            depth.increment()?;
11361            let envelope_size = 8;
11362            let bytes_len = len * envelope_size;
11363            let offset = decoder.out_of_line_offset(bytes_len)?;
11364            // Decode the envelope for each type.
11365            let mut _next_ordinal_to_read = 0;
11366            let mut next_offset = offset;
11367            let end_offset = offset + bytes_len;
11368            _next_ordinal_to_read += 1;
11369            if next_offset >= end_offset {
11370                return Ok(());
11371            }
11372
11373            // Decode unknown envelopes for gaps in ordinals.
11374            while _next_ordinal_to_read < 1 {
11375                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11376                _next_ordinal_to_read += 1;
11377                next_offset += envelope_size;
11378            }
11379
11380            let next_out_of_line = decoder.next_out_of_line();
11381            let handles_before = decoder.remaining_handles();
11382            if let Some((inlined, num_bytes, num_handles)) =
11383                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11384            {
11385                let member_inline_size =
11386                    <f32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11387                if inlined != (member_inline_size <= 4) {
11388                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11389                }
11390                let inner_offset;
11391                let mut inner_depth = depth.clone();
11392                if inlined {
11393                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11394                    inner_offset = next_offset;
11395                } else {
11396                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11397                    inner_depth.increment()?;
11398                }
11399                let val_ref = self.level.get_or_insert_with(|| fidl::new_empty!(f32, D));
11400                fidl::decode!(f32, D, val_ref, decoder, inner_offset, inner_depth)?;
11401                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11402                {
11403                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11404                }
11405                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11406                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11407                }
11408            }
11409
11410            next_offset += envelope_size;
11411            _next_ordinal_to_read += 1;
11412            if next_offset >= end_offset {
11413                return Ok(());
11414            }
11415
11416            // Decode unknown envelopes for gaps in ordinals.
11417            while _next_ordinal_to_read < 2 {
11418                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11419                _next_ordinal_to_read += 1;
11420                next_offset += envelope_size;
11421            }
11422
11423            let next_out_of_line = decoder.next_out_of_line();
11424            let handles_before = decoder.remaining_handles();
11425            if let Some((inlined, num_bytes, num_handles)) =
11426                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11427            {
11428                let member_inline_size =
11429                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11430                if inlined != (member_inline_size <= 4) {
11431                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11432                }
11433                let inner_offset;
11434                let mut inner_depth = depth.clone();
11435                if inlined {
11436                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11437                    inner_offset = next_offset;
11438                } else {
11439                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11440                    inner_depth.increment()?;
11441                }
11442                let val_ref = self.muted.get_or_insert_with(|| fidl::new_empty!(bool, D));
11443                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11444                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11445                {
11446                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11447                }
11448                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11449                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11450                }
11451            }
11452
11453            next_offset += envelope_size;
11454
11455            // Decode the remaining unknown envelopes.
11456            while next_offset < end_offset {
11457                _next_ordinal_to_read += 1;
11458                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11459                next_offset += envelope_size;
11460            }
11461
11462            Ok(())
11463        }
11464    }
11465
11466    impl fidl::encoding::ValueTypeMarker for LightValue {
11467        type Borrowed<'a> = &'a Self;
11468        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11469            value
11470        }
11471    }
11472
11473    unsafe impl fidl::encoding::TypeMarker for LightValue {
11474        type Owned = Self;
11475
11476        #[inline(always)]
11477        fn inline_align(_context: fidl::encoding::Context) -> usize {
11478            8
11479        }
11480
11481        #[inline(always)]
11482        fn inline_size(_context: fidl::encoding::Context) -> usize {
11483            16
11484        }
11485    }
11486
11487    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LightValue, D>
11488        for &LightValue
11489    {
11490        #[inline]
11491        unsafe fn encode(
11492            self,
11493            encoder: &mut fidl::encoding::Encoder<'_, D>,
11494            offset: usize,
11495            _depth: fidl::encoding::Depth,
11496        ) -> fidl::Result<()> {
11497            encoder.debug_check_bounds::<LightValue>(offset);
11498            encoder.write_num::<u64>(self.ordinal(), offset);
11499            match self {
11500            LightValue::On(ref val) => {
11501                fidl::encoding::encode_in_envelope::<bool, D>(
11502                    <bool as fidl::encoding::ValueTypeMarker>::borrow(val),
11503                    encoder, offset + 8, _depth
11504                )
11505            }
11506            LightValue::Brightness(ref val) => {
11507                fidl::encoding::encode_in_envelope::<f64, D>(
11508                    <f64 as fidl::encoding::ValueTypeMarker>::borrow(val),
11509                    encoder, offset + 8, _depth
11510                )
11511            }
11512            LightValue::Color(ref val) => {
11513                fidl::encoding::encode_in_envelope::<fidl_fuchsia_ui_types__common::ColorRgb, D>(
11514                    <fidl_fuchsia_ui_types__common::ColorRgb as fidl::encoding::ValueTypeMarker>::borrow(val),
11515                    encoder, offset + 8, _depth
11516                )
11517            }
11518        }
11519        }
11520    }
11521
11522    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LightValue {
11523        #[inline(always)]
11524        fn new_empty() -> Self {
11525            Self::On(fidl::new_empty!(bool, D))
11526        }
11527
11528        #[inline]
11529        unsafe fn decode(
11530            &mut self,
11531            decoder: &mut fidl::encoding::Decoder<'_, D>,
11532            offset: usize,
11533            mut depth: fidl::encoding::Depth,
11534        ) -> fidl::Result<()> {
11535            decoder.debug_check_bounds::<Self>(offset);
11536            #[allow(unused_variables)]
11537            let next_out_of_line = decoder.next_out_of_line();
11538            let handles_before = decoder.remaining_handles();
11539            let (ordinal, inlined, num_bytes, num_handles) =
11540                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
11541
11542            let member_inline_size = match ordinal {
11543            1 => <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11544            2 => <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11545            3 => <fidl_fuchsia_ui_types__common::ColorRgb as fidl::encoding::TypeMarker>::inline_size(decoder.context),
11546            _ => return Err(fidl::Error::UnknownUnionTag),
11547        };
11548
11549            if inlined != (member_inline_size <= 4) {
11550                return Err(fidl::Error::InvalidInlineBitInEnvelope);
11551            }
11552            let _inner_offset;
11553            if inlined {
11554                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
11555                _inner_offset = offset + 8;
11556            } else {
11557                depth.increment()?;
11558                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11559            }
11560            match ordinal {
11561                1 => {
11562                    #[allow(irrefutable_let_patterns)]
11563                    if let LightValue::On(_) = self {
11564                        // Do nothing, read the value into the object
11565                    } else {
11566                        // Initialize `self` to the right variant
11567                        *self = LightValue::On(fidl::new_empty!(bool, D));
11568                    }
11569                    #[allow(irrefutable_let_patterns)]
11570                    if let LightValue::On(ref mut val) = self {
11571                        fidl::decode!(bool, D, val, decoder, _inner_offset, depth)?;
11572                    } else {
11573                        unreachable!()
11574                    }
11575                }
11576                2 => {
11577                    #[allow(irrefutable_let_patterns)]
11578                    if let LightValue::Brightness(_) = self {
11579                        // Do nothing, read the value into the object
11580                    } else {
11581                        // Initialize `self` to the right variant
11582                        *self = LightValue::Brightness(fidl::new_empty!(f64, D));
11583                    }
11584                    #[allow(irrefutable_let_patterns)]
11585                    if let LightValue::Brightness(ref mut val) = self {
11586                        fidl::decode!(f64, D, val, decoder, _inner_offset, depth)?;
11587                    } else {
11588                        unreachable!()
11589                    }
11590                }
11591                3 => {
11592                    #[allow(irrefutable_let_patterns)]
11593                    if let LightValue::Color(_) = self {
11594                        // Do nothing, read the value into the object
11595                    } else {
11596                        // Initialize `self` to the right variant
11597                        *self = LightValue::Color(fidl::new_empty!(
11598                            fidl_fuchsia_ui_types__common::ColorRgb,
11599                            D
11600                        ));
11601                    }
11602                    #[allow(irrefutable_let_patterns)]
11603                    if let LightValue::Color(ref mut val) = self {
11604                        fidl::decode!(
11605                            fidl_fuchsia_ui_types__common::ColorRgb,
11606                            D,
11607                            val,
11608                            decoder,
11609                            _inner_offset,
11610                            depth
11611                        )?;
11612                    } else {
11613                        unreachable!()
11614                    }
11615                }
11616                ordinal => panic!("unexpected ordinal {:?}", ordinal),
11617            }
11618            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
11619                return Err(fidl::Error::InvalidNumBytesInEnvelope);
11620            }
11621            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11622                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11623            }
11624            Ok(())
11625        }
11626    }
11627}