Skip to main content

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