Skip to main content

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