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