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
25/// A hardcoded number of max reports. Because report ID is only 8 bits, only 255
26/// different reports are allowed at a time.
27pub const MAX_REPORT_COUNT: u32 = 255;
28
29/// A hardcoded number of max mouse buttons. This should be increased in the future
30/// if we ever see mice with more buttons.
31pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
32
33/// A hardcoded number of max sensor values. This should be increased in the future
34/// if we ever see a sensor with more values.
35pub const SENSOR_MAX_VALUES: u32 = 100;
36
37/// A hardcoded number of max contacts per report. This should be increased in the future if
38/// we see devices with more than the max amount.
39pub const TOUCH_MAX_CONTACTS: u32 = 10;
40
41pub const TOUCH_MAX_NUM_BUTTONS: u32 = 10;
42
43/// These ControlButtons represent on/off buttons whose purpose is to change
44/// the host's configuration.
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub enum ConsumerControlButton {
47    /// This button represents increasing volume.
48    VolumeUp,
49    /// This button represents decreasing volume.
50    VolumeDown,
51    /// This button represents pausing.
52    Pause,
53    /// This button represents factory resetting the host.
54    FactoryReset,
55    /// This button represents muting the microphone on the host.
56    MicMute,
57    /// This button represents rebooting the host.
58    Reboot,
59    /// This button represents disabling the camera on the host.
60    CameraDisable,
61    /// This button represents a function.
62    Function,
63    /// This button represents a power button.
64    Power,
65    #[doc(hidden)]
66    __SourceBreaking { unknown_ordinal: u32 },
67}
68
69/// Pattern that matches an unknown `ConsumerControlButton` member.
70#[macro_export]
71macro_rules! ConsumerControlButtonUnknown {
72    () => {
73        _
74    };
75}
76
77impl ConsumerControlButton {
78    #[inline]
79    pub fn from_primitive(prim: u32) -> Option<Self> {
80        match prim {
81            1 => Some(Self::VolumeUp),
82            2 => Some(Self::VolumeDown),
83            3 => Some(Self::Pause),
84            4 => Some(Self::FactoryReset),
85            5 => Some(Self::MicMute),
86            6 => Some(Self::Reboot),
87            7 => Some(Self::CameraDisable),
88            8 => Some(Self::Function),
89            9 => Some(Self::Power),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96        match prim {
97            1 => Self::VolumeUp,
98            2 => Self::VolumeDown,
99            3 => Self::Pause,
100            4 => Self::FactoryReset,
101            5 => Self::MicMute,
102            6 => Self::Reboot,
103            7 => Self::CameraDisable,
104            8 => Self::Function,
105            9 => Self::Power,
106            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107        }
108    }
109
110    #[inline]
111    pub fn unknown() -> Self {
112        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        match self {
118            Self::VolumeUp => 1,
119            Self::VolumeDown => 2,
120            Self::Pause => 3,
121            Self::FactoryReset => 4,
122            Self::MicMute => 5,
123            Self::Reboot => 6,
124            Self::CameraDisable => 7,
125            Self::Function => 8,
126            Self::Power => 9,
127            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128        }
129    }
130
131    #[inline]
132    pub fn is_unknown(&self) -> bool {
133        match self {
134            Self::__SourceBreaking { unknown_ordinal: _ } => true,
135            _ => false,
136        }
137    }
138}
139
140/// The InputReport field to be populated by InputDevice.GetInputReport.
141#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
142pub enum DeviceType {
143    Mouse,
144    Sensor,
145    Touch,
146    Keyboard,
147    ConsumerControl,
148    #[doc(hidden)]
149    __SourceBreaking {
150        unknown_ordinal: u32,
151    },
152}
153
154/// Pattern that matches an unknown `DeviceType` member.
155#[macro_export]
156macro_rules! DeviceTypeUnknown {
157    () => {
158        _
159    };
160}
161
162impl DeviceType {
163    #[inline]
164    pub fn from_primitive(prim: u32) -> Option<Self> {
165        match prim {
166            0 => Some(Self::Mouse),
167            1 => Some(Self::Sensor),
168            2 => Some(Self::Touch),
169            3 => Some(Self::Keyboard),
170            4 => Some(Self::ConsumerControl),
171            _ => None,
172        }
173    }
174
175    #[inline]
176    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
177        match prim {
178            0 => Self::Mouse,
179            1 => Self::Sensor,
180            2 => Self::Touch,
181            3 => Self::Keyboard,
182            4 => Self::ConsumerControl,
183            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
184        }
185    }
186
187    #[inline]
188    pub fn unknown() -> Self {
189        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
190    }
191
192    #[inline]
193    pub const fn into_primitive(self) -> u32 {
194        match self {
195            Self::Mouse => 0,
196            Self::Sensor => 1,
197            Self::Touch => 2,
198            Self::Keyboard => 3,
199            Self::ConsumerControl => 4,
200            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
201        }
202    }
203
204    #[inline]
205    pub fn is_unknown(&self) -> bool {
206        match self {
207            Self::__SourceBreaking { unknown_ordinal: _ } => true,
208            _ => false,
209        }
210    }
211}
212
213/// An LedType represents an LED on a device that can be turned on or off.
214/// When applicable, the definition of each LED is derived from one of the
215/// following sources albeit with a Fuchsia-specific numeric value:
216/// - USB HID usage codes for usage page 0x0008 (LED)
217#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
218pub enum LedType {
219    /// LED to indicate a Keyboard's number lock is enabled.
220    /// Corresponds to USB HID page 0x0008 usage 0x0001
221    NumLock,
222    /// LED to indicate a Keyboard's capital lock is enabled.
223    /// Corresponds to USB HID page 0x0008 usage 0x0002
224    CapsLock,
225    /// LED to indicate a Keyboard's scroll lock is enabled.
226    /// Corresponds to USB HID page 0x0008 usage 0x0003
227    ScrollLock,
228    /// LED to indicate a Keyboard's composition mode is enabled.
229    /// Corresponds to USB HID page 0x0008 usage 0x0004
230    Compose,
231    /// LED to indicate a Keyboard's Kana mode is enabled.
232    /// Corresponds to USB HID page 0x0008 usage 0x0005
233    Kana,
234    #[doc(hidden)]
235    __SourceBreaking { unknown_ordinal: u32 },
236}
237
238/// Pattern that matches an unknown `LedType` member.
239#[macro_export]
240macro_rules! LedTypeUnknown {
241    () => {
242        _
243    };
244}
245
246impl LedType {
247    #[inline]
248    pub fn from_primitive(prim: u32) -> Option<Self> {
249        match prim {
250            1 => Some(Self::NumLock),
251            2 => Some(Self::CapsLock),
252            3 => Some(Self::ScrollLock),
253            4 => Some(Self::Compose),
254            5 => Some(Self::Kana),
255            _ => None,
256        }
257    }
258
259    #[inline]
260    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
261        match prim {
262            1 => Self::NumLock,
263            2 => Self::CapsLock,
264            3 => Self::ScrollLock,
265            4 => Self::Compose,
266            5 => Self::Kana,
267            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
268        }
269    }
270
271    #[inline]
272    pub fn unknown() -> Self {
273        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
274    }
275
276    #[inline]
277    pub const fn into_primitive(self) -> u32 {
278        match self {
279            Self::NumLock => 1,
280            Self::CapsLock => 2,
281            Self::ScrollLock => 3,
282            Self::Compose => 4,
283            Self::Kana => 5,
284            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
285        }
286    }
287
288    #[inline]
289    pub fn is_unknown(&self) -> bool {
290        match self {
291            Self::__SourceBreaking { unknown_ordinal: _ } => true,
292            _ => false,
293        }
294    }
295}
296
297/// `SensorReportingState` determines when a sensor will send reports.
298#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
299pub enum SensorReportingState {
300    /// No events will be sent from the sensor.
301    ReportNoEvents,
302    /// All events will be sent from the sensor. For most sensors, this
303    /// frequency can be set by `report_interval`.
304    ReportAllEvents,
305    /// Only events that cross a threshold will be reported.
306    ReportThresholdEvents,
307    #[doc(hidden)]
308    __SourceBreaking { unknown_ordinal: u32 },
309}
310
311/// Pattern that matches an unknown `SensorReportingState` member.
312#[macro_export]
313macro_rules! SensorReportingStateUnknown {
314    () => {
315        _
316    };
317}
318
319impl SensorReportingState {
320    #[inline]
321    pub fn from_primitive(prim: u32) -> Option<Self> {
322        match prim {
323            1 => Some(Self::ReportNoEvents),
324            2 => Some(Self::ReportAllEvents),
325            3 => Some(Self::ReportThresholdEvents),
326            _ => None,
327        }
328    }
329
330    #[inline]
331    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
332        match prim {
333            1 => Self::ReportNoEvents,
334            2 => Self::ReportAllEvents,
335            3 => Self::ReportThresholdEvents,
336            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337        }
338    }
339
340    #[inline]
341    pub fn unknown() -> Self {
342        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
343    }
344
345    #[inline]
346    pub const fn into_primitive(self) -> u32 {
347        match self {
348            Self::ReportNoEvents => 1,
349            Self::ReportAllEvents => 2,
350            Self::ReportThresholdEvents => 3,
351            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
352        }
353    }
354
355    #[inline]
356    pub fn is_unknown(&self) -> bool {
357        match self {
358            Self::__SourceBreaking { unknown_ordinal: _ } => true,
359            _ => false,
360        }
361    }
362}
363
364/// Each sensor value has a corresponding SensorType, which explains what the
365/// value is measuring in the world.
366#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
367pub enum SensorType {
368    /// Acceleration on the X axis.
369    AccelerometerX,
370    /// Acceleration on the Y axis.
371    AccelerometerY,
372    /// Acceleration on the Z axis.
373    AccelerometerZ,
374    /// Strength of the Magnetic Field in the X axis.
375    MagnetometerX,
376    /// Strength of the Magnetic Field in the Y axis.
377    MagnetometerY,
378    /// Strength of the Magnetic Field in the Z axis.
379    MagnetometerZ,
380    /// Angular Velocity in the X direction moving counter-clockwise.
381    GyroscopeX,
382    /// Angular Velocity in the Y direction moving counter-clockwise.
383    GyroscopeY,
384    /// Angular Velocity in the Z direction moving counter-clockwise.
385    GyroscopeZ,
386    /// Ambient level of Light.
387    LightIlluminance,
388    /// Ambient level of Red Light.
389    LightRed,
390    /// Ambient level of Green Light.
391    LightGreen,
392    /// Ambient level of Blue Light.
393    LightBlue,
394    #[doc(hidden)]
395    __SourceBreaking { unknown_ordinal: u32 },
396}
397
398/// Pattern that matches an unknown `SensorType` member.
399#[macro_export]
400macro_rules! SensorTypeUnknown {
401    () => {
402        _
403    };
404}
405
406impl SensorType {
407    #[inline]
408    pub fn from_primitive(prim: u32) -> Option<Self> {
409        match prim {
410            1 => Some(Self::AccelerometerX),
411            2 => Some(Self::AccelerometerY),
412            3 => Some(Self::AccelerometerZ),
413            4 => Some(Self::MagnetometerX),
414            5 => Some(Self::MagnetometerY),
415            6 => Some(Self::MagnetometerZ),
416            7 => Some(Self::GyroscopeX),
417            8 => Some(Self::GyroscopeY),
418            9 => Some(Self::GyroscopeZ),
419            10 => Some(Self::LightIlluminance),
420            11 => Some(Self::LightRed),
421            12 => Some(Self::LightGreen),
422            13 => Some(Self::LightBlue),
423            _ => None,
424        }
425    }
426
427    #[inline]
428    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
429        match prim {
430            1 => Self::AccelerometerX,
431            2 => Self::AccelerometerY,
432            3 => Self::AccelerometerZ,
433            4 => Self::MagnetometerX,
434            5 => Self::MagnetometerY,
435            6 => Self::MagnetometerZ,
436            7 => Self::GyroscopeX,
437            8 => Self::GyroscopeY,
438            9 => Self::GyroscopeZ,
439            10 => Self::LightIlluminance,
440            11 => Self::LightRed,
441            12 => Self::LightGreen,
442            13 => Self::LightBlue,
443            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
444        }
445    }
446
447    #[inline]
448    pub fn unknown() -> Self {
449        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
450    }
451
452    #[inline]
453    pub const fn into_primitive(self) -> u32 {
454        match self {
455            Self::AccelerometerX => 1,
456            Self::AccelerometerY => 2,
457            Self::AccelerometerZ => 3,
458            Self::MagnetometerX => 4,
459            Self::MagnetometerY => 5,
460            Self::MagnetometerZ => 6,
461            Self::GyroscopeX => 7,
462            Self::GyroscopeY => 8,
463            Self::GyroscopeZ => 9,
464            Self::LightIlluminance => 10,
465            Self::LightRed => 11,
466            Self::LightGreen => 12,
467            Self::LightBlue => 13,
468            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
469        }
470    }
471
472    #[inline]
473    pub fn is_unknown(&self) -> bool {
474        match self {
475            Self::__SourceBreaking { unknown_ordinal: _ } => true,
476            _ => false,
477        }
478    }
479}
480
481#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
482pub enum TouchButton {
483    /// Represents palm on touchscreen.
484    Palm,
485    #[doc(hidden)]
486    __SourceBreaking { unknown_ordinal: u8 },
487}
488
489/// Pattern that matches an unknown `TouchButton` member.
490#[macro_export]
491macro_rules! TouchButtonUnknown {
492    () => {
493        _
494    };
495}
496
497impl TouchButton {
498    #[inline]
499    pub fn from_primitive(prim: u8) -> Option<Self> {
500        match prim {
501            1 => Some(Self::Palm),
502            _ => None,
503        }
504    }
505
506    #[inline]
507    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
508        match prim {
509            1 => Self::Palm,
510            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
511        }
512    }
513
514    #[inline]
515    pub fn unknown() -> Self {
516        Self::__SourceBreaking { unknown_ordinal: 0xff }
517    }
518
519    #[inline]
520    pub const fn into_primitive(self) -> u8 {
521        match self {
522            Self::Palm => 1,
523            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
524        }
525    }
526
527    #[inline]
528    pub fn is_unknown(&self) -> bool {
529        match self {
530            Self::__SourceBreaking { unknown_ordinal: _ } => true,
531            _ => false,
532        }
533    }
534}
535
536/// Input mode indicating which top-level collection should be used for input reporting.
537/// These values must correspond to the input modes defined in 16.7 of the HID Usage Tables
538/// for Universal Serial Bus (USB) Spec (https://usb.org/sites/default/files/hut1_22.pdf).
539#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
540pub enum TouchConfigurationInputMode {
541    /// Use the Mouse Collection for reporting data.
542    MouseCollection,
543    /// Use the Windows Precision Touchpad Collection for reporting data. Defined by Windows
544    /// Precision Touchpad Required HID Top-Level Collections: https://docs.microsoft.com/
545    /// en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required
546    /// -hid-top-level-collections).
547    WindowsPrecisionTouchpadCollection,
548    #[doc(hidden)]
549    __SourceBreaking { unknown_ordinal: u32 },
550}
551
552/// Pattern that matches an unknown `TouchConfigurationInputMode` member.
553#[macro_export]
554macro_rules! TouchConfigurationInputModeUnknown {
555    () => {
556        _
557    };
558}
559
560impl TouchConfigurationInputMode {
561    #[inline]
562    pub fn from_primitive(prim: u32) -> Option<Self> {
563        match prim {
564            0 => Some(Self::MouseCollection),
565            3 => Some(Self::WindowsPrecisionTouchpadCollection),
566            _ => None,
567        }
568    }
569
570    #[inline]
571    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
572        match prim {
573            0 => Self::MouseCollection,
574            3 => Self::WindowsPrecisionTouchpadCollection,
575            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
576        }
577    }
578
579    #[inline]
580    pub fn unknown() -> Self {
581        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
582    }
583
584    #[inline]
585    pub const fn into_primitive(self) -> u32 {
586        match self {
587            Self::MouseCollection => 0,
588            Self::WindowsPrecisionTouchpadCollection => 3,
589            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
590        }
591    }
592
593    #[inline]
594    pub fn is_unknown(&self) -> bool {
595        match self {
596            Self::__SourceBreaking { unknown_ordinal: _ } => true,
597            _ => false,
598        }
599    }
600}
601
602/// The device type from which the touch originated.
603#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
604pub enum TouchType {
605    /// A touch screen has direct finger input associated with a display.
606    Touchscreen,
607    /// A touch pad is a pointer device that tracks finger positions.
608    Touchpad,
609    #[doc(hidden)]
610    __SourceBreaking { unknown_ordinal: u32 },
611}
612
613/// Pattern that matches an unknown `TouchType` member.
614#[macro_export]
615macro_rules! TouchTypeUnknown {
616    () => {
617        _
618    };
619}
620
621impl TouchType {
622    #[inline]
623    pub fn from_primitive(prim: u32) -> Option<Self> {
624        match prim {
625            1 => Some(Self::Touchscreen),
626            2 => Some(Self::Touchpad),
627            _ => None,
628        }
629    }
630
631    #[inline]
632    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
633        match prim {
634            1 => Self::Touchscreen,
635            2 => Self::Touchpad,
636            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
637        }
638    }
639
640    #[inline]
641    pub fn unknown() -> Self {
642        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
643    }
644
645    #[inline]
646    pub const fn into_primitive(self) -> u32 {
647        match self {
648            Self::Touchscreen => 1,
649            Self::Touchpad => 2,
650            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
651        }
652    }
653
654    #[inline]
655    pub fn is_unknown(&self) -> bool {
656        match self {
657            Self::__SourceBreaking { unknown_ordinal: _ } => true,
658            _ => false,
659        }
660    }
661}
662
663/// This provides an easy, standardized way to specify units. New units can
664/// be added as needed. Each UnitType should be named after a specific unit that
665/// should be fully distinguished by the name (E.g: Use METERS instead of
666/// DISTANCE). More complicated units that need to be differentiated should
667/// begin with SI_ (for Internation System of Units) or ENGLISH_ (for English
668/// System of Units).
669#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
670pub enum UnitType {
671    /// The device did not specify units.
672    None,
673    /// The device specified units that are not convertible to any of the other units.
674    Other,
675    /// A measurement of distance in meters.
676    Meters,
677    /// A measurement of mass in grams.
678    Grams,
679    /// A measurement of rotation in degrees.
680    Degrees,
681    /// A measurement of angular velocity in degrees per second.
682    EnglishAngularVelocity,
683    /// A measurement of linear velocity in meters per second.
684    SiLinearVelocity,
685    /// A measurement of acceleration in meters per second squared.
686    SiLinearAcceleration,
687    /// A measure of magnetic flux in webers.
688    Webers,
689    /// A measurement of luminous intensity in candelas.
690    Candelas,
691    /// A measurement of pressure in pascals.
692    Pascals,
693    Lux,
694    Seconds,
695    #[doc(hidden)]
696    __SourceBreaking {
697        unknown_ordinal: u32,
698    },
699}
700
701/// Pattern that matches an unknown `UnitType` member.
702#[macro_export]
703macro_rules! UnitTypeUnknown {
704    () => {
705        _
706    };
707}
708
709impl UnitType {
710    #[inline]
711    pub fn from_primitive(prim: u32) -> Option<Self> {
712        match prim {
713            0 => Some(Self::None),
714            1 => Some(Self::Other),
715            2 => Some(Self::Meters),
716            3 => Some(Self::Grams),
717            4 => Some(Self::Degrees),
718            5 => Some(Self::EnglishAngularVelocity),
719            6 => Some(Self::SiLinearVelocity),
720            7 => Some(Self::SiLinearAcceleration),
721            8 => Some(Self::Webers),
722            9 => Some(Self::Candelas),
723            10 => Some(Self::Pascals),
724            11 => Some(Self::Lux),
725            12 => Some(Self::Seconds),
726            _ => None,
727        }
728    }
729
730    #[inline]
731    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
732        match prim {
733            0 => Self::None,
734            1 => Self::Other,
735            2 => Self::Meters,
736            3 => Self::Grams,
737            4 => Self::Degrees,
738            5 => Self::EnglishAngularVelocity,
739            6 => Self::SiLinearVelocity,
740            7 => Self::SiLinearAcceleration,
741            8 => Self::Webers,
742            9 => Self::Candelas,
743            10 => Self::Pascals,
744            11 => Self::Lux,
745            12 => Self::Seconds,
746            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
747        }
748    }
749
750    #[inline]
751    pub fn unknown() -> Self {
752        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
753    }
754
755    #[inline]
756    pub const fn into_primitive(self) -> u32 {
757        match self {
758            Self::None => 0,
759            Self::Other => 1,
760            Self::Meters => 2,
761            Self::Grams => 3,
762            Self::Degrees => 4,
763            Self::EnglishAngularVelocity => 5,
764            Self::SiLinearVelocity => 6,
765            Self::SiLinearAcceleration => 7,
766            Self::Webers => 8,
767            Self::Candelas => 9,
768            Self::Pascals => 10,
769            Self::Lux => 11,
770            Self::Seconds => 12,
771            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
772        }
773    }
774
775    #[inline]
776    pub fn is_unknown(&self) -> bool {
777        match self {
778            Self::__SourceBreaking { unknown_ordinal: _ } => true,
779            _ => false,
780        }
781    }
782}
783
784/// Below are ProductIds which represents which product this Input device represents. If the
785/// Input device is a HID device, the ProductId maps directly to the HID
786/// ProductId. If the Input device is not a HID device, then the ProductId
787/// will be greater than 0xFFFF, which is the max HID ProductId.
788#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
789pub enum VendorGoogleProductId {
790    /// Below are the non-HID VendorIds
791    FocaltechTouchscreen,
792    AmsLightSensor,
793    PcPs2Keyboard,
794    PcPs2Mouse,
795    AdcButtons,
796    GoodixTouchscreen,
797    HidButtons,
798    VirtioMouse,
799    VirtioKeyboard,
800    VirtioTouchscreen,
801    GoldfishAccelerationSensor,
802    GoldfishGyroscopeSensor,
803    GoldfishRgbcLightSensor,
804    #[doc(hidden)]
805    __SourceBreaking {
806        unknown_ordinal: u32,
807    },
808}
809
810/// Pattern that matches an unknown `VendorGoogleProductId` member.
811#[macro_export]
812macro_rules! VendorGoogleProductIdUnknown {
813    () => {
814        _
815    };
816}
817
818impl VendorGoogleProductId {
819    #[inline]
820    pub fn from_primitive(prim: u32) -> Option<Self> {
821        match prim {
822            65537 => Some(Self::FocaltechTouchscreen),
823            65538 => Some(Self::AmsLightSensor),
824            65539 => Some(Self::PcPs2Keyboard),
825            65540 => Some(Self::PcPs2Mouse),
826            65541 => Some(Self::AdcButtons),
827            65542 => Some(Self::GoodixTouchscreen),
828            65543 => Some(Self::HidButtons),
829            65544 => Some(Self::VirtioMouse),
830            65545 => Some(Self::VirtioKeyboard),
831            65546 => Some(Self::VirtioTouchscreen),
832            2417819649 => Some(Self::GoldfishAccelerationSensor),
833            2417819650 => Some(Self::GoldfishGyroscopeSensor),
834            2417819651 => Some(Self::GoldfishRgbcLightSensor),
835            _ => None,
836        }
837    }
838
839    #[inline]
840    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
841        match prim {
842            65537 => Self::FocaltechTouchscreen,
843            65538 => Self::AmsLightSensor,
844            65539 => Self::PcPs2Keyboard,
845            65540 => Self::PcPs2Mouse,
846            65541 => Self::AdcButtons,
847            65542 => Self::GoodixTouchscreen,
848            65543 => Self::HidButtons,
849            65544 => Self::VirtioMouse,
850            65545 => Self::VirtioKeyboard,
851            65546 => Self::VirtioTouchscreen,
852            2417819649 => Self::GoldfishAccelerationSensor,
853            2417819650 => Self::GoldfishGyroscopeSensor,
854            2417819651 => Self::GoldfishRgbcLightSensor,
855            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
856        }
857    }
858
859    #[inline]
860    pub fn unknown() -> Self {
861        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
862    }
863
864    #[inline]
865    pub const fn into_primitive(self) -> u32 {
866        match self {
867            Self::FocaltechTouchscreen => 65537,
868            Self::AmsLightSensor => 65538,
869            Self::PcPs2Keyboard => 65539,
870            Self::PcPs2Mouse => 65540,
871            Self::AdcButtons => 65541,
872            Self::GoodixTouchscreen => 65542,
873            Self::HidButtons => 65543,
874            Self::VirtioMouse => 65544,
875            Self::VirtioKeyboard => 65545,
876            Self::VirtioTouchscreen => 65546,
877            Self::GoldfishAccelerationSensor => 2417819649,
878            Self::GoldfishGyroscopeSensor => 2417819650,
879            Self::GoldfishRgbcLightSensor => 2417819651,
880            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
881        }
882    }
883
884    #[inline]
885    pub fn is_unknown(&self) -> bool {
886        match self {
887            Self::__SourceBreaking { unknown_ordinal: _ } => true,
888            _ => false,
889        }
890    }
891}
892
893/// The VendorId represents the vendor that created this Input device. If the
894/// Input device is a HID device, the VendorId maps directly to the HID
895/// VendorId. If the Input device is not a HID device, then the VendorId
896/// will be greater than 0xFFFF, which is the max HID VendorId.
897#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
898pub enum VendorId {
899    /// Below are the HID VendorIds, range 0x0000 - 0xFFFF.
900    Google,
901    #[doc(hidden)]
902    __SourceBreaking { unknown_ordinal: u32 },
903}
904
905/// Pattern that matches an unknown `VendorId` member.
906#[macro_export]
907macro_rules! VendorIdUnknown {
908    () => {
909        _
910    };
911}
912
913impl VendorId {
914    #[inline]
915    pub fn from_primitive(prim: u32) -> Option<Self> {
916        match prim {
917            6353 => Some(Self::Google),
918            _ => None,
919        }
920    }
921
922    #[inline]
923    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
924        match prim {
925            6353 => Self::Google,
926            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
927        }
928    }
929
930    #[inline]
931    pub fn unknown() -> Self {
932        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
933    }
934
935    #[inline]
936    pub const fn into_primitive(self) -> u32 {
937        match self {
938            Self::Google => 6353,
939            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
940        }
941    }
942
943    #[inline]
944    pub fn is_unknown(&self) -> bool {
945        match self {
946            Self::__SourceBreaking { unknown_ordinal: _ } => true,
947            _ => false,
948        }
949    }
950}
951
952/// An `Axis` is defined as a `range` and a `unit`.
953#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
954pub struct Axis {
955    pub range: Range,
956    pub unit: Unit,
957}
958
959impl fidl::Persistable for Axis {}
960
961#[derive(Clone, Debug, PartialEq)]
962pub struct InputDeviceGetDescriptorResponse {
963    pub descriptor: DeviceDescriptor,
964}
965
966impl fidl::Persistable for InputDeviceGetDescriptorResponse {}
967
968#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
969pub struct InputDeviceGetInputReportRequest {
970    pub device_type: DeviceType,
971}
972
973impl fidl::Persistable for InputDeviceGetInputReportRequest {}
974
975#[derive(Clone, Debug, PartialEq)]
976pub struct InputDeviceSendOutputReportRequest {
977    pub report: OutputReport,
978}
979
980impl fidl::Persistable for InputDeviceSendOutputReportRequest {}
981
982#[derive(Clone, Debug, PartialEq)]
983pub struct InputDeviceSetFeatureReportRequest {
984    pub report: FeatureReport,
985}
986
987impl fidl::Persistable for InputDeviceSetFeatureReportRequest {}
988
989#[derive(Clone, Debug, PartialEq)]
990pub struct InputDeviceGetFeatureReportResponse {
991    pub report: FeatureReport,
992}
993
994impl fidl::Persistable for InputDeviceGetFeatureReportResponse {}
995
996#[derive(Clone, Debug, PartialEq)]
997pub struct InputDeviceGetInputReportResponse {
998    pub report: InputReport,
999}
1000
1001impl fidl::Persistable for InputDeviceGetInputReportResponse {}
1002
1003#[derive(Clone, Debug, PartialEq)]
1004pub struct InputReportsReaderReadInputReportsResponse {
1005    pub reports: Vec<InputReport>,
1006}
1007
1008impl fidl::Persistable for InputReportsReaderReadInputReportsResponse {}
1009
1010/// Describe a `Range` of values.
1011#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1012#[repr(C)]
1013pub struct Range {
1014    pub min: i64,
1015    pub max: i64,
1016}
1017
1018impl fidl::Persistable for Range {}
1019
1020/// A `SensorAxis` is a normal `Axis` with an additional `SensorType` to describe what the
1021/// axis is measuring.
1022#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1023pub struct SensorAxis {
1024    pub axis: Axis,
1025    pub type_: SensorType,
1026}
1027
1028impl fidl::Persistable for SensorAxis {}
1029
1030/// Describes a given unit by giving the unit and the unit's exponent.
1031/// E.g: Nanometers would have type METERS and exponent -9.
1032#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1033pub struct Unit {
1034    pub type_: UnitType,
1035    pub exponent: i32,
1036}
1037
1038impl fidl::Persistable for Unit {}
1039
1040/// A Fuchsia ConsumerControl represents a device thats purpose is to change
1041/// values on the host. Typical controls are Volume, Power, Media Playback.
1042/// (Consider a TV remote to be a typical ConsumerControl).
1043#[derive(Clone, Debug, Default, PartialEq)]
1044pub struct ConsumerControlDescriptor {
1045    pub input: Option<ConsumerControlInputDescriptor>,
1046    #[doc(hidden)]
1047    pub __source_breaking: fidl::marker::SourceBreaking,
1048}
1049
1050impl fidl::Persistable for ConsumerControlDescriptor {}
1051
1052/// Describes the format of the input report that will be sent from the
1053/// ConsumerControl device to the host.
1054#[derive(Clone, Debug, Default, PartialEq)]
1055pub struct ConsumerControlInputDescriptor {
1056    /// The list of buttons that this device contains.
1057    pub buttons: Option<Vec<ConsumerControlButton>>,
1058    #[doc(hidden)]
1059    pub __source_breaking: fidl::marker::SourceBreaking,
1060}
1061
1062impl fidl::Persistable for ConsumerControlInputDescriptor {}
1063
1064/// A single report created by a ConsumerControl device.
1065#[derive(Clone, Debug, Default, PartialEq)]
1066pub struct ConsumerControlInputReport {
1067    /// The list of buttons that are currently pressed down.
1068    pub pressed_buttons: Option<Vec<ConsumerControlButton>>,
1069    #[doc(hidden)]
1070    pub __source_breaking: fidl::marker::SourceBreaking,
1071}
1072
1073impl fidl::Persistable for ConsumerControlInputReport {}
1074
1075/// `ContactInputDescriptor` describes the fields associated with a touch on a touch device.
1076#[derive(Clone, Debug, Default, PartialEq)]
1077pub struct ContactInputDescriptor {
1078    /// Describes the reporting of the x-axis.
1079    pub position_x: Option<Axis>,
1080    /// Describes the reporting of the y-axis.
1081    pub position_y: Option<Axis>,
1082    /// Pressure of the contact.
1083    pub pressure: Option<Axis>,
1084    /// Width of the area of contact.
1085    pub contact_width: Option<Axis>,
1086    /// Height of the area of contact.
1087    pub contact_height: Option<Axis>,
1088    #[doc(hidden)]
1089    pub __source_breaking: fidl::marker::SourceBreaking,
1090}
1091
1092impl fidl::Persistable for ContactInputDescriptor {}
1093
1094/// `ContactInputReport` describes one touch on a touch device.
1095#[derive(Clone, Debug, Default, PartialEq)]
1096pub struct ContactInputReport {
1097    /// Identifier for this contact.
1098    pub contact_id: Option<u32>,
1099    /// A contact's position on the x axis.
1100    pub position_x: Option<i64>,
1101    /// A contact's position on the y axis.
1102    pub position_y: Option<i64>,
1103    /// Pressure of the contact.
1104    pub pressure: Option<i64>,
1105    /// Width of the bounding box around the touch contact. Combined with
1106    /// `contact_height`, this describes the area of the touch contact.
1107    /// `contact_width` and `contact_height` should both have units of distance,
1108    /// and they should be in the same units as `position_x` and `position_y`.
1109    pub contact_width: Option<i64>,
1110    /// Height of the bounding box around the touch contact. Combined with
1111    /// `contact_width`, this describes the area of the touch contact.
1112    /// `contact_width` and `contact_height` should both have units of distance,
1113    /// and they should be in the same units as `position_x` and `position_y`.
1114    pub contact_height: Option<i64>,
1115    /// Also known as touch valid. Indicates the device’s confidence that the touch
1116    /// contact was an intended, valid contact. The device should report 0 if the
1117    /// contact is not a valid touch. The device should report 1 if the contact is
1118    /// intended and valid (e.g. a pointing touch)
1119    pub confidence: Option<bool>,
1120    #[doc(hidden)]
1121    pub __source_breaking: fidl::marker::SourceBreaking,
1122}
1123
1124impl fidl::Persistable for ContactInputReport {}
1125
1126/// `DeviceDescriptor` describes a physical input device. Some physical devices may
1127/// send multiple types of reports (E.g: a physical touchscreen can send touch and
1128/// stylus reports, so it will have both a TouchDescriptor and a StylusDescriptor).
1129#[derive(Clone, Debug, Default, PartialEq)]
1130pub struct DeviceDescriptor {
1131    /// When `mouse` is present the device has a mouse.
1132    pub mouse: Option<MouseDescriptor>,
1133    /// When `sensor` is present the device has a sensor.
1134    pub sensor: Option<SensorDescriptor>,
1135    /// When `touch` is present the device has a touch device.
1136    /// (E.g: Touchscreen, touchpad).
1137    pub touch: Option<TouchDescriptor>,
1138    /// When `keyboard` is present the device has a keyboard.
1139    pub keyboard: Option<KeyboardDescriptor>,
1140    /// When `consumer_control` is present the device has a ConsumerControl
1141    /// device.
1142    pub consumer_control: Option<ConsumerControlDescriptor>,
1143    /// `device_information` should always be present to help distinguish
1144    /// between physical devices.
1145    pub device_information: Option<DeviceInformation>,
1146    #[doc(hidden)]
1147    pub __source_breaking: fidl::marker::SourceBreaking,
1148}
1149
1150impl fidl::Persistable for DeviceDescriptor {}
1151
1152/// DeviceInformation provides more information about the device and lets a
1153/// client distinguish between devices (e.g between two touchscreens that come
1154/// from different vendors). If the device is a HID device, then the id
1155/// information will come from the device itself. Other, non-HID devices may
1156/// assign the ids in the driver, so it will be the driver author's
1157/// responsibility to assign sensible ids.
1158#[derive(Clone, Debug, Default, PartialEq)]
1159pub struct DeviceInformation {
1160    pub vendor_id: Option<u32>,
1161    pub product_id: Option<u32>,
1162    pub version: Option<u32>,
1163    pub polling_rate: Option<i64>,
1164    #[doc(hidden)]
1165    pub __source_breaking: fidl::marker::SourceBreaking,
1166}
1167
1168impl fidl::Persistable for DeviceInformation {}
1169
1170/// A single report containing the feature information for an input device.
1171/// Feature reports obtained from the device show the current state of the
1172/// device. Sending a feature report to the device sets the device in that
1173/// state.
1174#[derive(Clone, Debug, Default, PartialEq)]
1175pub struct FeatureReport {
1176    pub sensor: Option<SensorFeatureReport>,
1177    pub touch: Option<TouchFeatureReport>,
1178    #[doc(hidden)]
1179    pub __source_breaking: fidl::marker::SourceBreaking,
1180}
1181
1182impl fidl::Persistable for FeatureReport {}
1183
1184/// `InputReport` is a single report that is created by an input device.
1185#[derive(Clone, Debug, Default, PartialEq)]
1186pub struct InputReport {
1187    /// `event_time` is in nanoseconds when the event was recorded.
1188    pub event_time: Option<i64>,
1189    /// `mouse` is the report generated if the device contains a mouse.
1190    pub mouse: Option<MouseInputReport>,
1191    /// Unique ID to connect trace async begin/end events.
1192    pub trace_id: Option<u64>,
1193    /// `sensor` is the report generated if the device contains a sensor.
1194    pub sensor: Option<SensorInputReport>,
1195    /// `touch` is the report generated if the device contains a touch device.
1196    pub touch: Option<TouchInputReport>,
1197    /// `keyboard` is the report generated if the device contains a keyboard.
1198    pub keyboard: Option<KeyboardInputReport>,
1199    /// `consumer_controls` is the report generated if the device contains a
1200    /// ConsumerControl device.
1201    pub consumer_control: Option<ConsumerControlInputReport>,
1202    /// The Descriptor that describes this InputReport will have a matching
1203    /// ReportID. If this doesn't exist, report_id is 0.
1204    pub report_id: Option<u8>,
1205    #[doc(hidden)]
1206    pub __source_breaking: fidl::marker::SourceBreaking,
1207}
1208
1209impl fidl::Persistable for InputReport {}
1210
1211/// The capabilities of a keyboard device.
1212#[derive(Clone, Debug, Default, PartialEq)]
1213pub struct KeyboardDescriptor {
1214    pub input: Option<KeyboardInputDescriptor>,
1215    pub output: Option<KeyboardOutputDescriptor>,
1216    #[doc(hidden)]
1217    pub __source_breaking: fidl::marker::SourceBreaking,
1218}
1219
1220impl fidl::Persistable for KeyboardDescriptor {}
1221
1222/// Describes the format of the input report that will be sent from the keyboard
1223/// to the device.
1224#[derive(Clone, Debug, Default, PartialEq)]
1225pub struct KeyboardInputDescriptor {
1226    /// The list of keys that this keyboard contains.
1227    pub keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1228    #[doc(hidden)]
1229    pub __source_breaking: fidl::marker::SourceBreaking,
1230}
1231
1232impl fidl::Persistable for KeyboardInputDescriptor {}
1233
1234/// A single report created by a keyboard device.
1235#[derive(Clone, Debug, Default, PartialEq)]
1236pub struct KeyboardInputReport {
1237    /// The list of keys that are currently pressed down.
1238    pub pressed_keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1239    #[doc(hidden)]
1240    pub __source_breaking: fidl::marker::SourceBreaking,
1241}
1242
1243impl fidl::Persistable for KeyboardInputReport {}
1244
1245/// Describes the format of the output report that can be sent to the keyboard..
1246#[derive(Clone, Debug, Default, PartialEq)]
1247pub struct KeyboardOutputDescriptor {
1248    /// The list of keyboard LEDs that can be toggled.
1249    pub leds: Option<Vec<LedType>>,
1250    #[doc(hidden)]
1251    pub __source_breaking: fidl::marker::SourceBreaking,
1252}
1253
1254impl fidl::Persistable for KeyboardOutputDescriptor {}
1255
1256/// A single report containing output information for a keyboard.
1257#[derive(Clone, Debug, Default, PartialEq)]
1258pub struct KeyboardOutputReport {
1259    /// Each LED in this list will be turned on. Any LED not in this list will be
1260    /// turned off.
1261    pub enabled_leds: Option<Vec<LedType>>,
1262    #[doc(hidden)]
1263    pub __source_breaking: fidl::marker::SourceBreaking,
1264}
1265
1266impl fidl::Persistable for KeyboardOutputReport {}
1267
1268/// The capabilities of a mouse device.
1269#[derive(Clone, Debug, Default, PartialEq)]
1270pub struct MouseDescriptor {
1271    pub input: Option<MouseInputDescriptor>,
1272    #[doc(hidden)]
1273    pub __source_breaking: fidl::marker::SourceBreaking,
1274}
1275
1276impl fidl::Persistable for MouseDescriptor {}
1277
1278/// Describes the format of the input report that will be sent from the mouse
1279/// to the device.
1280#[derive(Clone, Debug, Default, PartialEq)]
1281pub struct MouseInputDescriptor {
1282    /// The range of relative X movement.
1283    pub movement_x: Option<Axis>,
1284    /// The range of relative Y movement.
1285    pub movement_y: Option<Axis>,
1286    /// The range of relative vertical scroll.
1287    pub scroll_v: Option<Axis>,
1288    /// The range of relative horizontal scroll.
1289    pub scroll_h: Option<Axis>,
1290    /// This is a vector of ids for the mouse buttons.
1291    pub buttons: Option<Vec<u8>>,
1292    /// The range of the position of X.
1293    /// The main use of position is from virtual mice like over VNC.
1294    pub position_x: Option<Axis>,
1295    /// The range of the position of Y.
1296    /// The main use of position is from virtual mice like over VNC.
1297    pub position_y: Option<Axis>,
1298    #[doc(hidden)]
1299    pub __source_breaking: fidl::marker::SourceBreaking,
1300}
1301
1302impl fidl::Persistable for MouseInputDescriptor {}
1303
1304/// `MouseReport` gives the relative movement of the mouse and currently
1305/// pressed buttons. Relative means the movement seen between the previous
1306/// report and this report. The client is responsible for tracking this and
1307/// converting it to absolute movement.
1308#[derive(Clone, Debug, Default, PartialEq)]
1309pub struct MouseInputReport {
1310    /// Relative X positional displacement.
1311    pub movement_x: Option<i64>,
1312    /// Relative Y positional displacement.
1313    pub movement_y: Option<i64>,
1314    /// Relative vertical scrolling displacement.
1315    pub scroll_v: Option<i64>,
1316    /// Relative horizontal scrolling displacement.
1317    pub scroll_h: Option<i64>,
1318    /// A list of currently pressed buttons.
1319    pub pressed_buttons: Option<Vec<u8>>,
1320    /// The position of X.
1321    /// The main use of position is from virtual mice like over VNC.
1322    pub position_x: Option<i64>,
1323    /// The position of Y.
1324    /// The main use of position is from virtual mice like over VNC.
1325    pub position_y: Option<i64>,
1326    #[doc(hidden)]
1327    pub __source_breaking: fidl::marker::SourceBreaking,
1328}
1329
1330impl fidl::Persistable for MouseInputReport {}
1331
1332/// Describes the output reports that a physical input device will accept.
1333/// Output information typically represents device output to the user
1334/// (E.g: LEDs, tactile feedback, etc).
1335#[derive(Clone, Debug, Default, PartialEq)]
1336pub struct OutputDescriptor {
1337    pub keyboard: Option<KeyboardOutputDescriptor>,
1338    #[doc(hidden)]
1339    pub __source_breaking: fidl::marker::SourceBreaking,
1340}
1341
1342impl fidl::Persistable for OutputDescriptor {}
1343
1344/// A single report containing output information for an input device.
1345/// Output information typically represents device output to the user
1346/// (E.g: LEDs, tactile feedback, etc).
1347#[derive(Clone, Debug, Default, PartialEq)]
1348pub struct OutputReport {
1349    pub keyboard: Option<KeyboardOutputReport>,
1350    #[doc(hidden)]
1351    pub __source_breaking: fidl::marker::SourceBreaking,
1352}
1353
1354impl fidl::Persistable for OutputReport {}
1355
1356/// Selective Reporting Feature Report indicating which types of input are reported.
1357#[derive(Clone, Debug, Default, PartialEq)]
1358pub struct SelectiveReportingFeatureReport {
1359    /// If this is true, the device will report surface contacts.
1360    pub surface_switch: Option<bool>,
1361    /// If this is true, the device will report button state.
1362    pub button_switch: Option<bool>,
1363    #[doc(hidden)]
1364    pub __source_breaking: fidl::marker::SourceBreaking,
1365}
1366
1367impl fidl::Persistable for SelectiveReportingFeatureReport {}
1368
1369/// The capabilities of a sensor device.
1370#[derive(Clone, Debug, Default, PartialEq)]
1371pub struct SensorDescriptor {
1372    pub input: Option<Vec<SensorInputDescriptor>>,
1373    pub feature: Option<Vec<SensorFeatureDescriptor>>,
1374    #[doc(hidden)]
1375    pub __source_breaking: fidl::marker::SourceBreaking,
1376}
1377
1378impl fidl::Persistable for SensorDescriptor {}
1379
1380/// Describes the format of the sensor's feature report. Feature reports can be
1381/// requested from the sensor, or sent to the sensor.
1382#[derive(Clone, Debug, Default, PartialEq)]
1383pub struct SensorFeatureDescriptor {
1384    /// Describes the minimum and maximum reporting interval this sensor
1385    /// supports.
1386    pub report_interval: Option<Axis>,
1387    /// Sets the sensitivity for the given `SensorType`.
1388    pub sensitivity: Option<Vec<SensorAxis>>,
1389    /// If this is true then SensorFeatureReport supports setting a
1390    /// SensorReportingState.
1391    pub supports_reporting_state: Option<bool>,
1392    /// Sets the high threshold values for the given `SensorType`.
1393    pub threshold_high: Option<Vec<SensorAxis>>,
1394    /// Sets the low threshold values for the given `SensorType`.
1395    pub threshold_low: Option<Vec<SensorAxis>>,
1396    /// Describes the minimum and maximum sampling rate this sensor supports.
1397    pub sampling_rate: Option<Axis>,
1398    /// ReportID of current descriptor. Report with same report ID should be
1399    /// associated with this descriptor.
1400    pub report_id: Option<u8>,
1401    #[doc(hidden)]
1402    pub __source_breaking: fidl::marker::SourceBreaking,
1403}
1404
1405impl fidl::Persistable for SensorFeatureDescriptor {}
1406
1407/// A SensorFeatureReport describes the features of a given sensor. If a
1408/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1409/// If a FeatureReport is requested from the Input Device it shows the device's
1410/// current configuration.
1411#[derive(Clone, Debug, Default, PartialEq)]
1412pub struct SensorFeatureReport {
1413    /// The time between reports sent by the sensor.
1414    pub report_interval: Option<i64>,
1415    /// The sensitivity for various `SensorType`. This vector must be given in
1416    /// the order of the descriptor's `sensitivity` vector.
1417    pub sensitivity: Option<Vec<i64>>,
1418    /// This determines when the sensor will send reports.
1419    pub reporting_state: Option<SensorReportingState>,
1420    /// The high thresholds for various `SensorType`. This vector must be given in
1421    /// the order of the descriptor's `threshold_high` vector.
1422    pub threshold_high: Option<Vec<i64>>,
1423    /// The low thresholds for various `SensorType`. This vector must be given in
1424    /// the order of the descriptor's `threshold_low` vector.
1425    pub threshold_low: Option<Vec<i64>>,
1426    /// The rate at which the sensor is sampled.
1427    pub sampling_rate: Option<i64>,
1428    #[doc(hidden)]
1429    pub __source_breaking: fidl::marker::SourceBreaking,
1430}
1431
1432impl fidl::Persistable for SensorFeatureReport {}
1433
1434/// Describes the format of the input report that will be sent from the sensor
1435/// to the device.
1436#[derive(Clone, Debug, Default, PartialEq)]
1437pub struct SensorInputDescriptor {
1438    /// Each `SensorAxis` in `values` describes what a sensor is measuring and its range.
1439    /// These will directly correspond to the values in `SensorReport`.
1440    pub values: Option<Vec<SensorAxis>>,
1441    /// ReportID of current descriptor. Report with same report ID should be
1442    /// associated with this descriptor.
1443    pub report_id: Option<u8>,
1444    #[doc(hidden)]
1445    pub __source_breaking: fidl::marker::SourceBreaking,
1446}
1447
1448impl fidl::Persistable for SensorInputDescriptor {}
1449
1450/// `SensorReport` gives the values measured by a sensor at a given point in time.
1451#[derive(Clone, Debug, Default, PartialEq)]
1452pub struct SensorInputReport {
1453    /// The ordering of `values` will always directly correspond to the ordering of
1454    /// the values in `SensorDescriptor`.
1455    pub values: Option<Vec<i64>>,
1456    #[doc(hidden)]
1457    pub __source_breaking: fidl::marker::SourceBreaking,
1458}
1459
1460impl fidl::Persistable for SensorInputReport {}
1461
1462/// The capabilities of a touch device.
1463#[derive(Clone, Debug, Default, PartialEq)]
1464pub struct TouchDescriptor {
1465    pub input: Option<TouchInputDescriptor>,
1466    pub feature: Option<TouchFeatureDescriptor>,
1467    #[doc(hidden)]
1468    pub __source_breaking: fidl::marker::SourceBreaking,
1469}
1470
1471impl fidl::Persistable for TouchDescriptor {}
1472
1473/// Describes the format of the touchpad configuration's feature report. Feature reports
1474/// can be requested from the touchpad, or sent to the touchpad.
1475#[derive(Clone, Debug, Default, PartialEq)]
1476pub struct TouchFeatureDescriptor {
1477    /// Indicates whether or not touch feature descriptor supports different input modes.
1478    pub supports_input_mode: Option<bool>,
1479    /// Indicates whether or not touch feature descriptor supports selective reporting.
1480    pub supports_selective_reporting: Option<bool>,
1481    #[doc(hidden)]
1482    pub __source_breaking: fidl::marker::SourceBreaking,
1483}
1484
1485impl fidl::Persistable for TouchFeatureDescriptor {}
1486
1487/// A TouchFeatureReport describes the features of a given touch device. If a
1488/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1489/// If a FeatureReport is requested from the Input Device it shows the device's
1490/// current configuration.
1491#[derive(Clone, Debug, Default, PartialEq)]
1492pub struct TouchFeatureReport {
1493    /// The input mode currently reporting.
1494    pub input_mode: Option<TouchConfigurationInputMode>,
1495    /// The current report types being reported.
1496    pub selective_reporting: Option<SelectiveReportingFeatureReport>,
1497    #[doc(hidden)]
1498    pub __source_breaking: fidl::marker::SourceBreaking,
1499}
1500
1501impl fidl::Persistable for TouchFeatureReport {}
1502
1503/// Describes the format of the input report that will be sent from the keyboard
1504/// to the device.
1505#[derive(Clone, Debug, Default, PartialEq)]
1506pub struct TouchInputDescriptor {
1507    /// The contact descriptors associated with this touch descriptor.
1508    pub contacts: Option<Vec<ContactInputDescriptor>>,
1509    /// The max number of contacts that this touch device can report at once.
1510    pub max_contacts: Option<u32>,
1511    /// The type of touch device being used.
1512    pub touch_type: Option<TouchType>,
1513    pub buttons: Option<Vec<TouchButton>>,
1514    #[doc(hidden)]
1515    pub __source_breaking: fidl::marker::SourceBreaking,
1516}
1517
1518impl fidl::Persistable for TouchInputDescriptor {}
1519
1520/// `TouchInputReport` describes the current contacts recorded by the touchscreen.
1521#[derive(Clone, Debug, Default, PartialEq)]
1522pub struct TouchInputReport {
1523    /// The contacts currently being reported by the device.
1524    pub contacts: Option<Vec<ContactInputReport>>,
1525    pub pressed_buttons: Option<Vec<TouchButton>>,
1526    #[doc(hidden)]
1527    pub __source_breaking: fidl::marker::SourceBreaking,
1528}
1529
1530impl fidl::Persistable for TouchInputReport {}
1531
1532pub mod input_device_ordinals {
1533    pub const GET_INPUT_REPORTS_READER: u64 = 0x68d9cf83e397ab41;
1534    pub const GET_DESCRIPTOR: u64 = 0x3d76420f2ff8ad32;
1535    pub const SEND_OUTPUT_REPORT: u64 = 0x67a4888774e6f3a;
1536    pub const GET_FEATURE_REPORT: u64 = 0x497a7d98d9391f16;
1537    pub const SET_FEATURE_REPORT: u64 = 0x7679a2f5a42842ef;
1538    pub const GET_INPUT_REPORT: u64 = 0x4752ccab96c10248;
1539}
1540
1541pub mod input_reports_reader_ordinals {
1542    pub const READ_INPUT_REPORTS: u64 = 0x3595efdc88842559;
1543}
1544
1545mod internal {
1546    use super::*;
1547    unsafe impl fidl::encoding::TypeMarker for ConsumerControlButton {
1548        type Owned = Self;
1549
1550        #[inline(always)]
1551        fn inline_align(_context: fidl::encoding::Context) -> usize {
1552            std::mem::align_of::<u32>()
1553        }
1554
1555        #[inline(always)]
1556        fn inline_size(_context: fidl::encoding::Context) -> usize {
1557            std::mem::size_of::<u32>()
1558        }
1559
1560        #[inline(always)]
1561        fn encode_is_copy() -> bool {
1562            false
1563        }
1564
1565        #[inline(always)]
1566        fn decode_is_copy() -> bool {
1567            false
1568        }
1569    }
1570
1571    impl fidl::encoding::ValueTypeMarker for ConsumerControlButton {
1572        type Borrowed<'a> = Self;
1573        #[inline(always)]
1574        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1575            *value
1576        }
1577    }
1578
1579    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1580        for ConsumerControlButton
1581    {
1582        #[inline]
1583        unsafe fn encode(
1584            self,
1585            encoder: &mut fidl::encoding::Encoder<'_, D>,
1586            offset: usize,
1587            _depth: fidl::encoding::Depth,
1588        ) -> fidl::Result<()> {
1589            encoder.debug_check_bounds::<Self>(offset);
1590            encoder.write_num(self.into_primitive(), offset);
1591            Ok(())
1592        }
1593    }
1594
1595    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsumerControlButton {
1596        #[inline(always)]
1597        fn new_empty() -> Self {
1598            Self::unknown()
1599        }
1600
1601        #[inline]
1602        unsafe fn decode(
1603            &mut self,
1604            decoder: &mut fidl::encoding::Decoder<'_, D>,
1605            offset: usize,
1606            _depth: fidl::encoding::Depth,
1607        ) -> fidl::Result<()> {
1608            decoder.debug_check_bounds::<Self>(offset);
1609            let prim = decoder.read_num::<u32>(offset);
1610
1611            *self = Self::from_primitive_allow_unknown(prim);
1612            Ok(())
1613        }
1614    }
1615    unsafe impl fidl::encoding::TypeMarker for DeviceType {
1616        type Owned = Self;
1617
1618        #[inline(always)]
1619        fn inline_align(_context: fidl::encoding::Context) -> usize {
1620            std::mem::align_of::<u32>()
1621        }
1622
1623        #[inline(always)]
1624        fn inline_size(_context: fidl::encoding::Context) -> usize {
1625            std::mem::size_of::<u32>()
1626        }
1627
1628        #[inline(always)]
1629        fn encode_is_copy() -> bool {
1630            false
1631        }
1632
1633        #[inline(always)]
1634        fn decode_is_copy() -> bool {
1635            false
1636        }
1637    }
1638
1639    impl fidl::encoding::ValueTypeMarker for DeviceType {
1640        type Borrowed<'a> = Self;
1641        #[inline(always)]
1642        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1643            *value
1644        }
1645    }
1646
1647    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
1648        #[inline]
1649        unsafe fn encode(
1650            self,
1651            encoder: &mut fidl::encoding::Encoder<'_, D>,
1652            offset: usize,
1653            _depth: fidl::encoding::Depth,
1654        ) -> fidl::Result<()> {
1655            encoder.debug_check_bounds::<Self>(offset);
1656            encoder.write_num(self.into_primitive(), offset);
1657            Ok(())
1658        }
1659    }
1660
1661    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
1662        #[inline(always)]
1663        fn new_empty() -> Self {
1664            Self::unknown()
1665        }
1666
1667        #[inline]
1668        unsafe fn decode(
1669            &mut self,
1670            decoder: &mut fidl::encoding::Decoder<'_, D>,
1671            offset: usize,
1672            _depth: fidl::encoding::Depth,
1673        ) -> fidl::Result<()> {
1674            decoder.debug_check_bounds::<Self>(offset);
1675            let prim = decoder.read_num::<u32>(offset);
1676
1677            *self = Self::from_primitive_allow_unknown(prim);
1678            Ok(())
1679        }
1680    }
1681    unsafe impl fidl::encoding::TypeMarker for LedType {
1682        type Owned = Self;
1683
1684        #[inline(always)]
1685        fn inline_align(_context: fidl::encoding::Context) -> usize {
1686            std::mem::align_of::<u32>()
1687        }
1688
1689        #[inline(always)]
1690        fn inline_size(_context: fidl::encoding::Context) -> usize {
1691            std::mem::size_of::<u32>()
1692        }
1693
1694        #[inline(always)]
1695        fn encode_is_copy() -> bool {
1696            false
1697        }
1698
1699        #[inline(always)]
1700        fn decode_is_copy() -> bool {
1701            false
1702        }
1703    }
1704
1705    impl fidl::encoding::ValueTypeMarker for LedType {
1706        type Borrowed<'a> = Self;
1707        #[inline(always)]
1708        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1709            *value
1710        }
1711    }
1712
1713    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LedType {
1714        #[inline]
1715        unsafe fn encode(
1716            self,
1717            encoder: &mut fidl::encoding::Encoder<'_, D>,
1718            offset: usize,
1719            _depth: fidl::encoding::Depth,
1720        ) -> fidl::Result<()> {
1721            encoder.debug_check_bounds::<Self>(offset);
1722            encoder.write_num(self.into_primitive(), offset);
1723            Ok(())
1724        }
1725    }
1726
1727    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LedType {
1728        #[inline(always)]
1729        fn new_empty() -> Self {
1730            Self::unknown()
1731        }
1732
1733        #[inline]
1734        unsafe fn decode(
1735            &mut self,
1736            decoder: &mut fidl::encoding::Decoder<'_, D>,
1737            offset: usize,
1738            _depth: fidl::encoding::Depth,
1739        ) -> fidl::Result<()> {
1740            decoder.debug_check_bounds::<Self>(offset);
1741            let prim = decoder.read_num::<u32>(offset);
1742
1743            *self = Self::from_primitive_allow_unknown(prim);
1744            Ok(())
1745        }
1746    }
1747    unsafe impl fidl::encoding::TypeMarker for SensorReportingState {
1748        type Owned = Self;
1749
1750        #[inline(always)]
1751        fn inline_align(_context: fidl::encoding::Context) -> usize {
1752            std::mem::align_of::<u32>()
1753        }
1754
1755        #[inline(always)]
1756        fn inline_size(_context: fidl::encoding::Context) -> usize {
1757            std::mem::size_of::<u32>()
1758        }
1759
1760        #[inline(always)]
1761        fn encode_is_copy() -> bool {
1762            false
1763        }
1764
1765        #[inline(always)]
1766        fn decode_is_copy() -> bool {
1767            false
1768        }
1769    }
1770
1771    impl fidl::encoding::ValueTypeMarker for SensorReportingState {
1772        type Borrowed<'a> = Self;
1773        #[inline(always)]
1774        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1775            *value
1776        }
1777    }
1778
1779    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1780        for SensorReportingState
1781    {
1782        #[inline]
1783        unsafe fn encode(
1784            self,
1785            encoder: &mut fidl::encoding::Encoder<'_, D>,
1786            offset: usize,
1787            _depth: fidl::encoding::Depth,
1788        ) -> fidl::Result<()> {
1789            encoder.debug_check_bounds::<Self>(offset);
1790            encoder.write_num(self.into_primitive(), offset);
1791            Ok(())
1792        }
1793    }
1794
1795    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReportingState {
1796        #[inline(always)]
1797        fn new_empty() -> Self {
1798            Self::unknown()
1799        }
1800
1801        #[inline]
1802        unsafe fn decode(
1803            &mut self,
1804            decoder: &mut fidl::encoding::Decoder<'_, D>,
1805            offset: usize,
1806            _depth: fidl::encoding::Depth,
1807        ) -> fidl::Result<()> {
1808            decoder.debug_check_bounds::<Self>(offset);
1809            let prim = decoder.read_num::<u32>(offset);
1810
1811            *self = Self::from_primitive_allow_unknown(prim);
1812            Ok(())
1813        }
1814    }
1815    unsafe impl fidl::encoding::TypeMarker for SensorType {
1816        type Owned = Self;
1817
1818        #[inline(always)]
1819        fn inline_align(_context: fidl::encoding::Context) -> usize {
1820            std::mem::align_of::<u32>()
1821        }
1822
1823        #[inline(always)]
1824        fn inline_size(_context: fidl::encoding::Context) -> usize {
1825            std::mem::size_of::<u32>()
1826        }
1827
1828        #[inline(always)]
1829        fn encode_is_copy() -> bool {
1830            false
1831        }
1832
1833        #[inline(always)]
1834        fn decode_is_copy() -> bool {
1835            false
1836        }
1837    }
1838
1839    impl fidl::encoding::ValueTypeMarker for SensorType {
1840        type Borrowed<'a> = Self;
1841        #[inline(always)]
1842        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1843            *value
1844        }
1845    }
1846
1847    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1848        #[inline]
1849        unsafe fn encode(
1850            self,
1851            encoder: &mut fidl::encoding::Encoder<'_, D>,
1852            offset: usize,
1853            _depth: fidl::encoding::Depth,
1854        ) -> fidl::Result<()> {
1855            encoder.debug_check_bounds::<Self>(offset);
1856            encoder.write_num(self.into_primitive(), offset);
1857            Ok(())
1858        }
1859    }
1860
1861    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1862        #[inline(always)]
1863        fn new_empty() -> Self {
1864            Self::unknown()
1865        }
1866
1867        #[inline]
1868        unsafe fn decode(
1869            &mut self,
1870            decoder: &mut fidl::encoding::Decoder<'_, D>,
1871            offset: usize,
1872            _depth: fidl::encoding::Depth,
1873        ) -> fidl::Result<()> {
1874            decoder.debug_check_bounds::<Self>(offset);
1875            let prim = decoder.read_num::<u32>(offset);
1876
1877            *self = Self::from_primitive_allow_unknown(prim);
1878            Ok(())
1879        }
1880    }
1881    unsafe impl fidl::encoding::TypeMarker for TouchButton {
1882        type Owned = Self;
1883
1884        #[inline(always)]
1885        fn inline_align(_context: fidl::encoding::Context) -> usize {
1886            std::mem::align_of::<u8>()
1887        }
1888
1889        #[inline(always)]
1890        fn inline_size(_context: fidl::encoding::Context) -> usize {
1891            std::mem::size_of::<u8>()
1892        }
1893
1894        #[inline(always)]
1895        fn encode_is_copy() -> bool {
1896            false
1897        }
1898
1899        #[inline(always)]
1900        fn decode_is_copy() -> bool {
1901            false
1902        }
1903    }
1904
1905    impl fidl::encoding::ValueTypeMarker for TouchButton {
1906        type Borrowed<'a> = Self;
1907        #[inline(always)]
1908        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1909            *value
1910        }
1911    }
1912
1913    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchButton {
1914        #[inline]
1915        unsafe fn encode(
1916            self,
1917            encoder: &mut fidl::encoding::Encoder<'_, D>,
1918            offset: usize,
1919            _depth: fidl::encoding::Depth,
1920        ) -> fidl::Result<()> {
1921            encoder.debug_check_bounds::<Self>(offset);
1922            encoder.write_num(self.into_primitive(), offset);
1923            Ok(())
1924        }
1925    }
1926
1927    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchButton {
1928        #[inline(always)]
1929        fn new_empty() -> Self {
1930            Self::unknown()
1931        }
1932
1933        #[inline]
1934        unsafe fn decode(
1935            &mut self,
1936            decoder: &mut fidl::encoding::Decoder<'_, D>,
1937            offset: usize,
1938            _depth: fidl::encoding::Depth,
1939        ) -> fidl::Result<()> {
1940            decoder.debug_check_bounds::<Self>(offset);
1941            let prim = decoder.read_num::<u8>(offset);
1942
1943            *self = Self::from_primitive_allow_unknown(prim);
1944            Ok(())
1945        }
1946    }
1947    unsafe impl fidl::encoding::TypeMarker for TouchConfigurationInputMode {
1948        type Owned = Self;
1949
1950        #[inline(always)]
1951        fn inline_align(_context: fidl::encoding::Context) -> usize {
1952            std::mem::align_of::<u32>()
1953        }
1954
1955        #[inline(always)]
1956        fn inline_size(_context: fidl::encoding::Context) -> usize {
1957            std::mem::size_of::<u32>()
1958        }
1959
1960        #[inline(always)]
1961        fn encode_is_copy() -> bool {
1962            false
1963        }
1964
1965        #[inline(always)]
1966        fn decode_is_copy() -> bool {
1967            false
1968        }
1969    }
1970
1971    impl fidl::encoding::ValueTypeMarker for TouchConfigurationInputMode {
1972        type Borrowed<'a> = Self;
1973        #[inline(always)]
1974        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1975            *value
1976        }
1977    }
1978
1979    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1980        for TouchConfigurationInputMode
1981    {
1982        #[inline]
1983        unsafe fn encode(
1984            self,
1985            encoder: &mut fidl::encoding::Encoder<'_, D>,
1986            offset: usize,
1987            _depth: fidl::encoding::Depth,
1988        ) -> fidl::Result<()> {
1989            encoder.debug_check_bounds::<Self>(offset);
1990            encoder.write_num(self.into_primitive(), offset);
1991            Ok(())
1992        }
1993    }
1994
1995    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1996        for TouchConfigurationInputMode
1997    {
1998        #[inline(always)]
1999        fn new_empty() -> Self {
2000            Self::unknown()
2001        }
2002
2003        #[inline]
2004        unsafe fn decode(
2005            &mut self,
2006            decoder: &mut fidl::encoding::Decoder<'_, D>,
2007            offset: usize,
2008            _depth: fidl::encoding::Depth,
2009        ) -> fidl::Result<()> {
2010            decoder.debug_check_bounds::<Self>(offset);
2011            let prim = decoder.read_num::<u32>(offset);
2012
2013            *self = Self::from_primitive_allow_unknown(prim);
2014            Ok(())
2015        }
2016    }
2017    unsafe impl fidl::encoding::TypeMarker for TouchType {
2018        type Owned = Self;
2019
2020        #[inline(always)]
2021        fn inline_align(_context: fidl::encoding::Context) -> usize {
2022            std::mem::align_of::<u32>()
2023        }
2024
2025        #[inline(always)]
2026        fn inline_size(_context: fidl::encoding::Context) -> usize {
2027            std::mem::size_of::<u32>()
2028        }
2029
2030        #[inline(always)]
2031        fn encode_is_copy() -> bool {
2032            false
2033        }
2034
2035        #[inline(always)]
2036        fn decode_is_copy() -> bool {
2037            false
2038        }
2039    }
2040
2041    impl fidl::encoding::ValueTypeMarker for TouchType {
2042        type Borrowed<'a> = Self;
2043        #[inline(always)]
2044        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2045            *value
2046        }
2047    }
2048
2049    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchType {
2050        #[inline]
2051        unsafe fn encode(
2052            self,
2053            encoder: &mut fidl::encoding::Encoder<'_, D>,
2054            offset: usize,
2055            _depth: fidl::encoding::Depth,
2056        ) -> fidl::Result<()> {
2057            encoder.debug_check_bounds::<Self>(offset);
2058            encoder.write_num(self.into_primitive(), offset);
2059            Ok(())
2060        }
2061    }
2062
2063    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchType {
2064        #[inline(always)]
2065        fn new_empty() -> Self {
2066            Self::unknown()
2067        }
2068
2069        #[inline]
2070        unsafe fn decode(
2071            &mut self,
2072            decoder: &mut fidl::encoding::Decoder<'_, D>,
2073            offset: usize,
2074            _depth: fidl::encoding::Depth,
2075        ) -> fidl::Result<()> {
2076            decoder.debug_check_bounds::<Self>(offset);
2077            let prim = decoder.read_num::<u32>(offset);
2078
2079            *self = Self::from_primitive_allow_unknown(prim);
2080            Ok(())
2081        }
2082    }
2083    unsafe impl fidl::encoding::TypeMarker for UnitType {
2084        type Owned = Self;
2085
2086        #[inline(always)]
2087        fn inline_align(_context: fidl::encoding::Context) -> usize {
2088            std::mem::align_of::<u32>()
2089        }
2090
2091        #[inline(always)]
2092        fn inline_size(_context: fidl::encoding::Context) -> usize {
2093            std::mem::size_of::<u32>()
2094        }
2095
2096        #[inline(always)]
2097        fn encode_is_copy() -> bool {
2098            false
2099        }
2100
2101        #[inline(always)]
2102        fn decode_is_copy() -> bool {
2103            false
2104        }
2105    }
2106
2107    impl fidl::encoding::ValueTypeMarker for UnitType {
2108        type Borrowed<'a> = Self;
2109        #[inline(always)]
2110        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2111            *value
2112        }
2113    }
2114
2115    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UnitType {
2116        #[inline]
2117        unsafe fn encode(
2118            self,
2119            encoder: &mut fidl::encoding::Encoder<'_, D>,
2120            offset: usize,
2121            _depth: fidl::encoding::Depth,
2122        ) -> fidl::Result<()> {
2123            encoder.debug_check_bounds::<Self>(offset);
2124            encoder.write_num(self.into_primitive(), offset);
2125            Ok(())
2126        }
2127    }
2128
2129    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnitType {
2130        #[inline(always)]
2131        fn new_empty() -> Self {
2132            Self::unknown()
2133        }
2134
2135        #[inline]
2136        unsafe fn decode(
2137            &mut self,
2138            decoder: &mut fidl::encoding::Decoder<'_, D>,
2139            offset: usize,
2140            _depth: fidl::encoding::Depth,
2141        ) -> fidl::Result<()> {
2142            decoder.debug_check_bounds::<Self>(offset);
2143            let prim = decoder.read_num::<u32>(offset);
2144
2145            *self = Self::from_primitive_allow_unknown(prim);
2146            Ok(())
2147        }
2148    }
2149    unsafe impl fidl::encoding::TypeMarker for VendorGoogleProductId {
2150        type Owned = Self;
2151
2152        #[inline(always)]
2153        fn inline_align(_context: fidl::encoding::Context) -> usize {
2154            std::mem::align_of::<u32>()
2155        }
2156
2157        #[inline(always)]
2158        fn inline_size(_context: fidl::encoding::Context) -> usize {
2159            std::mem::size_of::<u32>()
2160        }
2161
2162        #[inline(always)]
2163        fn encode_is_copy() -> bool {
2164            false
2165        }
2166
2167        #[inline(always)]
2168        fn decode_is_copy() -> bool {
2169            false
2170        }
2171    }
2172
2173    impl fidl::encoding::ValueTypeMarker for VendorGoogleProductId {
2174        type Borrowed<'a> = Self;
2175        #[inline(always)]
2176        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2177            *value
2178        }
2179    }
2180
2181    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2182        for VendorGoogleProductId
2183    {
2184        #[inline]
2185        unsafe fn encode(
2186            self,
2187            encoder: &mut fidl::encoding::Encoder<'_, D>,
2188            offset: usize,
2189            _depth: fidl::encoding::Depth,
2190        ) -> fidl::Result<()> {
2191            encoder.debug_check_bounds::<Self>(offset);
2192            encoder.write_num(self.into_primitive(), offset);
2193            Ok(())
2194        }
2195    }
2196
2197    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorGoogleProductId {
2198        #[inline(always)]
2199        fn new_empty() -> Self {
2200            Self::unknown()
2201        }
2202
2203        #[inline]
2204        unsafe fn decode(
2205            &mut self,
2206            decoder: &mut fidl::encoding::Decoder<'_, D>,
2207            offset: usize,
2208            _depth: fidl::encoding::Depth,
2209        ) -> fidl::Result<()> {
2210            decoder.debug_check_bounds::<Self>(offset);
2211            let prim = decoder.read_num::<u32>(offset);
2212
2213            *self = Self::from_primitive_allow_unknown(prim);
2214            Ok(())
2215        }
2216    }
2217    unsafe impl fidl::encoding::TypeMarker for VendorId {
2218        type Owned = Self;
2219
2220        #[inline(always)]
2221        fn inline_align(_context: fidl::encoding::Context) -> usize {
2222            std::mem::align_of::<u32>()
2223        }
2224
2225        #[inline(always)]
2226        fn inline_size(_context: fidl::encoding::Context) -> usize {
2227            std::mem::size_of::<u32>()
2228        }
2229
2230        #[inline(always)]
2231        fn encode_is_copy() -> bool {
2232            false
2233        }
2234
2235        #[inline(always)]
2236        fn decode_is_copy() -> bool {
2237            false
2238        }
2239    }
2240
2241    impl fidl::encoding::ValueTypeMarker for VendorId {
2242        type Borrowed<'a> = Self;
2243        #[inline(always)]
2244        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2245            *value
2246        }
2247    }
2248
2249    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for VendorId {
2250        #[inline]
2251        unsafe fn encode(
2252            self,
2253            encoder: &mut fidl::encoding::Encoder<'_, D>,
2254            offset: usize,
2255            _depth: fidl::encoding::Depth,
2256        ) -> fidl::Result<()> {
2257            encoder.debug_check_bounds::<Self>(offset);
2258            encoder.write_num(self.into_primitive(), offset);
2259            Ok(())
2260        }
2261    }
2262
2263    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorId {
2264        #[inline(always)]
2265        fn new_empty() -> Self {
2266            Self::unknown()
2267        }
2268
2269        #[inline]
2270        unsafe fn decode(
2271            &mut self,
2272            decoder: &mut fidl::encoding::Decoder<'_, D>,
2273            offset: usize,
2274            _depth: fidl::encoding::Depth,
2275        ) -> fidl::Result<()> {
2276            decoder.debug_check_bounds::<Self>(offset);
2277            let prim = decoder.read_num::<u32>(offset);
2278
2279            *self = Self::from_primitive_allow_unknown(prim);
2280            Ok(())
2281        }
2282    }
2283
2284    impl fidl::encoding::ValueTypeMarker for Axis {
2285        type Borrowed<'a> = &'a Self;
2286        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2287            value
2288        }
2289    }
2290
2291    unsafe impl fidl::encoding::TypeMarker for Axis {
2292        type Owned = Self;
2293
2294        #[inline(always)]
2295        fn inline_align(_context: fidl::encoding::Context) -> usize {
2296            8
2297        }
2298
2299        #[inline(always)]
2300        fn inline_size(_context: fidl::encoding::Context) -> usize {
2301            24
2302        }
2303    }
2304
2305    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
2306        #[inline]
2307        unsafe fn encode(
2308            self,
2309            encoder: &mut fidl::encoding::Encoder<'_, D>,
2310            offset: usize,
2311            _depth: fidl::encoding::Depth,
2312        ) -> fidl::Result<()> {
2313            encoder.debug_check_bounds::<Axis>(offset);
2314            // Delegate to tuple encoding.
2315            fidl::encoding::Encode::<Axis, D>::encode(
2316                (
2317                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2318                    <Unit as fidl::encoding::ValueTypeMarker>::borrow(&self.unit),
2319                ),
2320                encoder,
2321                offset,
2322                _depth,
2323            )
2324        }
2325    }
2326    unsafe impl<
2327        D: fidl::encoding::ResourceDialect,
2328        T0: fidl::encoding::Encode<Range, D>,
2329        T1: fidl::encoding::Encode<Unit, D>,
2330    > fidl::encoding::Encode<Axis, D> for (T0, T1)
2331    {
2332        #[inline]
2333        unsafe fn encode(
2334            self,
2335            encoder: &mut fidl::encoding::Encoder<'_, D>,
2336            offset: usize,
2337            depth: fidl::encoding::Depth,
2338        ) -> fidl::Result<()> {
2339            encoder.debug_check_bounds::<Axis>(offset);
2340            // Zero out padding regions. There's no need to apply masks
2341            // because the unmasked parts will be overwritten by fields.
2342            // Write the fields.
2343            self.0.encode(encoder, offset + 0, depth)?;
2344            self.1.encode(encoder, offset + 16, depth)?;
2345            Ok(())
2346        }
2347    }
2348
2349    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
2350        #[inline(always)]
2351        fn new_empty() -> Self {
2352            Self { range: fidl::new_empty!(Range, D), unit: fidl::new_empty!(Unit, D) }
2353        }
2354
2355        #[inline]
2356        unsafe fn decode(
2357            &mut self,
2358            decoder: &mut fidl::encoding::Decoder<'_, D>,
2359            offset: usize,
2360            _depth: fidl::encoding::Depth,
2361        ) -> fidl::Result<()> {
2362            decoder.debug_check_bounds::<Self>(offset);
2363            // Verify that padding bytes are zero.
2364            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
2365            fidl::decode!(Unit, D, &mut self.unit, decoder, offset + 16, _depth)?;
2366            Ok(())
2367        }
2368    }
2369
2370    impl fidl::encoding::ValueTypeMarker for InputDeviceGetDescriptorResponse {
2371        type Borrowed<'a> = &'a Self;
2372        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2373            value
2374        }
2375    }
2376
2377    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetDescriptorResponse {
2378        type Owned = Self;
2379
2380        #[inline(always)]
2381        fn inline_align(_context: fidl::encoding::Context) -> usize {
2382            8
2383        }
2384
2385        #[inline(always)]
2386        fn inline_size(_context: fidl::encoding::Context) -> usize {
2387            16
2388        }
2389    }
2390
2391    unsafe impl<D: fidl::encoding::ResourceDialect>
2392        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D>
2393        for &InputDeviceGetDescriptorResponse
2394    {
2395        #[inline]
2396        unsafe fn encode(
2397            self,
2398            encoder: &mut fidl::encoding::Encoder<'_, D>,
2399            offset: usize,
2400            _depth: fidl::encoding::Depth,
2401        ) -> fidl::Result<()> {
2402            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2403            // Delegate to tuple encoding.
2404            fidl::encoding::Encode::<InputDeviceGetDescriptorResponse, D>::encode(
2405                (<DeviceDescriptor as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptor),),
2406                encoder,
2407                offset,
2408                _depth,
2409            )
2410        }
2411    }
2412    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceDescriptor, D>>
2413        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D> for (T0,)
2414    {
2415        #[inline]
2416        unsafe fn encode(
2417            self,
2418            encoder: &mut fidl::encoding::Encoder<'_, D>,
2419            offset: usize,
2420            depth: fidl::encoding::Depth,
2421        ) -> fidl::Result<()> {
2422            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2423            // Zero out padding regions. There's no need to apply masks
2424            // because the unmasked parts will be overwritten by fields.
2425            // Write the fields.
2426            self.0.encode(encoder, offset + 0, depth)?;
2427            Ok(())
2428        }
2429    }
2430
2431    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2432        for InputDeviceGetDescriptorResponse
2433    {
2434        #[inline(always)]
2435        fn new_empty() -> Self {
2436            Self { descriptor: fidl::new_empty!(DeviceDescriptor, D) }
2437        }
2438
2439        #[inline]
2440        unsafe fn decode(
2441            &mut self,
2442            decoder: &mut fidl::encoding::Decoder<'_, D>,
2443            offset: usize,
2444            _depth: fidl::encoding::Depth,
2445        ) -> fidl::Result<()> {
2446            decoder.debug_check_bounds::<Self>(offset);
2447            // Verify that padding bytes are zero.
2448            fidl::decode!(DeviceDescriptor, D, &mut self.descriptor, decoder, offset + 0, _depth)?;
2449            Ok(())
2450        }
2451    }
2452
2453    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportRequest {
2454        type Borrowed<'a> = &'a Self;
2455        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2456            value
2457        }
2458    }
2459
2460    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportRequest {
2461        type Owned = Self;
2462
2463        #[inline(always)]
2464        fn inline_align(_context: fidl::encoding::Context) -> usize {
2465            4
2466        }
2467
2468        #[inline(always)]
2469        fn inline_size(_context: fidl::encoding::Context) -> usize {
2470            4
2471        }
2472    }
2473
2474    unsafe impl<D: fidl::encoding::ResourceDialect>
2475        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D>
2476        for &InputDeviceGetInputReportRequest
2477    {
2478        #[inline]
2479        unsafe fn encode(
2480            self,
2481            encoder: &mut fidl::encoding::Encoder<'_, D>,
2482            offset: usize,
2483            _depth: fidl::encoding::Depth,
2484        ) -> fidl::Result<()> {
2485            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2486            // Delegate to tuple encoding.
2487            fidl::encoding::Encode::<InputDeviceGetInputReportRequest, D>::encode(
2488                (<DeviceType as fidl::encoding::ValueTypeMarker>::borrow(&self.device_type),),
2489                encoder,
2490                offset,
2491                _depth,
2492            )
2493        }
2494    }
2495    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceType, D>>
2496        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D> for (T0,)
2497    {
2498        #[inline]
2499        unsafe fn encode(
2500            self,
2501            encoder: &mut fidl::encoding::Encoder<'_, D>,
2502            offset: usize,
2503            depth: fidl::encoding::Depth,
2504        ) -> fidl::Result<()> {
2505            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2506            // Zero out padding regions. There's no need to apply masks
2507            // because the unmasked parts will be overwritten by fields.
2508            // Write the fields.
2509            self.0.encode(encoder, offset + 0, depth)?;
2510            Ok(())
2511        }
2512    }
2513
2514    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2515        for InputDeviceGetInputReportRequest
2516    {
2517        #[inline(always)]
2518        fn new_empty() -> Self {
2519            Self { device_type: fidl::new_empty!(DeviceType, D) }
2520        }
2521
2522        #[inline]
2523        unsafe fn decode(
2524            &mut self,
2525            decoder: &mut fidl::encoding::Decoder<'_, D>,
2526            offset: usize,
2527            _depth: fidl::encoding::Depth,
2528        ) -> fidl::Result<()> {
2529            decoder.debug_check_bounds::<Self>(offset);
2530            // Verify that padding bytes are zero.
2531            fidl::decode!(DeviceType, D, &mut self.device_type, decoder, offset + 0, _depth)?;
2532            Ok(())
2533        }
2534    }
2535
2536    impl fidl::encoding::ValueTypeMarker for InputDeviceSendOutputReportRequest {
2537        type Borrowed<'a> = &'a Self;
2538        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2539            value
2540        }
2541    }
2542
2543    unsafe impl fidl::encoding::TypeMarker for InputDeviceSendOutputReportRequest {
2544        type Owned = Self;
2545
2546        #[inline(always)]
2547        fn inline_align(_context: fidl::encoding::Context) -> usize {
2548            8
2549        }
2550
2551        #[inline(always)]
2552        fn inline_size(_context: fidl::encoding::Context) -> usize {
2553            16
2554        }
2555    }
2556
2557    unsafe impl<D: fidl::encoding::ResourceDialect>
2558        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D>
2559        for &InputDeviceSendOutputReportRequest
2560    {
2561        #[inline]
2562        unsafe fn encode(
2563            self,
2564            encoder: &mut fidl::encoding::Encoder<'_, D>,
2565            offset: usize,
2566            _depth: fidl::encoding::Depth,
2567        ) -> fidl::Result<()> {
2568            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2569            // Delegate to tuple encoding.
2570            fidl::encoding::Encode::<InputDeviceSendOutputReportRequest, D>::encode(
2571                (<OutputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2572                encoder,
2573                offset,
2574                _depth,
2575            )
2576        }
2577    }
2578    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OutputReport, D>>
2579        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D> for (T0,)
2580    {
2581        #[inline]
2582        unsafe fn encode(
2583            self,
2584            encoder: &mut fidl::encoding::Encoder<'_, D>,
2585            offset: usize,
2586            depth: fidl::encoding::Depth,
2587        ) -> fidl::Result<()> {
2588            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2589            // Zero out padding regions. There's no need to apply masks
2590            // because the unmasked parts will be overwritten by fields.
2591            // Write the fields.
2592            self.0.encode(encoder, offset + 0, depth)?;
2593            Ok(())
2594        }
2595    }
2596
2597    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2598        for InputDeviceSendOutputReportRequest
2599    {
2600        #[inline(always)]
2601        fn new_empty() -> Self {
2602            Self { report: fidl::new_empty!(OutputReport, D) }
2603        }
2604
2605        #[inline]
2606        unsafe fn decode(
2607            &mut self,
2608            decoder: &mut fidl::encoding::Decoder<'_, D>,
2609            offset: usize,
2610            _depth: fidl::encoding::Depth,
2611        ) -> fidl::Result<()> {
2612            decoder.debug_check_bounds::<Self>(offset);
2613            // Verify that padding bytes are zero.
2614            fidl::decode!(OutputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2615            Ok(())
2616        }
2617    }
2618
2619    impl fidl::encoding::ValueTypeMarker for InputDeviceSetFeatureReportRequest {
2620        type Borrowed<'a> = &'a Self;
2621        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2622            value
2623        }
2624    }
2625
2626    unsafe impl fidl::encoding::TypeMarker for InputDeviceSetFeatureReportRequest {
2627        type Owned = Self;
2628
2629        #[inline(always)]
2630        fn inline_align(_context: fidl::encoding::Context) -> usize {
2631            8
2632        }
2633
2634        #[inline(always)]
2635        fn inline_size(_context: fidl::encoding::Context) -> usize {
2636            16
2637        }
2638    }
2639
2640    unsafe impl<D: fidl::encoding::ResourceDialect>
2641        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D>
2642        for &InputDeviceSetFeatureReportRequest
2643    {
2644        #[inline]
2645        unsafe fn encode(
2646            self,
2647            encoder: &mut fidl::encoding::Encoder<'_, D>,
2648            offset: usize,
2649            _depth: fidl::encoding::Depth,
2650        ) -> fidl::Result<()> {
2651            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2652            // Delegate to tuple encoding.
2653            fidl::encoding::Encode::<InputDeviceSetFeatureReportRequest, D>::encode(
2654                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2655                encoder,
2656                offset,
2657                _depth,
2658            )
2659        }
2660    }
2661    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2662        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D> for (T0,)
2663    {
2664        #[inline]
2665        unsafe fn encode(
2666            self,
2667            encoder: &mut fidl::encoding::Encoder<'_, D>,
2668            offset: usize,
2669            depth: fidl::encoding::Depth,
2670        ) -> fidl::Result<()> {
2671            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2672            // Zero out padding regions. There's no need to apply masks
2673            // because the unmasked parts will be overwritten by fields.
2674            // Write the fields.
2675            self.0.encode(encoder, offset + 0, depth)?;
2676            Ok(())
2677        }
2678    }
2679
2680    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2681        for InputDeviceSetFeatureReportRequest
2682    {
2683        #[inline(always)]
2684        fn new_empty() -> Self {
2685            Self { report: fidl::new_empty!(FeatureReport, D) }
2686        }
2687
2688        #[inline]
2689        unsafe fn decode(
2690            &mut self,
2691            decoder: &mut fidl::encoding::Decoder<'_, D>,
2692            offset: usize,
2693            _depth: fidl::encoding::Depth,
2694        ) -> fidl::Result<()> {
2695            decoder.debug_check_bounds::<Self>(offset);
2696            // Verify that padding bytes are zero.
2697            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2698            Ok(())
2699        }
2700    }
2701
2702    impl fidl::encoding::ValueTypeMarker for InputDeviceGetFeatureReportResponse {
2703        type Borrowed<'a> = &'a Self;
2704        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2705            value
2706        }
2707    }
2708
2709    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetFeatureReportResponse {
2710        type Owned = Self;
2711
2712        #[inline(always)]
2713        fn inline_align(_context: fidl::encoding::Context) -> usize {
2714            8
2715        }
2716
2717        #[inline(always)]
2718        fn inline_size(_context: fidl::encoding::Context) -> usize {
2719            16
2720        }
2721    }
2722
2723    unsafe impl<D: fidl::encoding::ResourceDialect>
2724        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D>
2725        for &InputDeviceGetFeatureReportResponse
2726    {
2727        #[inline]
2728        unsafe fn encode(
2729            self,
2730            encoder: &mut fidl::encoding::Encoder<'_, D>,
2731            offset: usize,
2732            _depth: fidl::encoding::Depth,
2733        ) -> fidl::Result<()> {
2734            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2735            // Delegate to tuple encoding.
2736            fidl::encoding::Encode::<InputDeviceGetFeatureReportResponse, D>::encode(
2737                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2738                encoder,
2739                offset,
2740                _depth,
2741            )
2742        }
2743    }
2744    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2745        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D> for (T0,)
2746    {
2747        #[inline]
2748        unsafe fn encode(
2749            self,
2750            encoder: &mut fidl::encoding::Encoder<'_, D>,
2751            offset: usize,
2752            depth: fidl::encoding::Depth,
2753        ) -> fidl::Result<()> {
2754            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2755            // Zero out padding regions. There's no need to apply masks
2756            // because the unmasked parts will be overwritten by fields.
2757            // Write the fields.
2758            self.0.encode(encoder, offset + 0, depth)?;
2759            Ok(())
2760        }
2761    }
2762
2763    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2764        for InputDeviceGetFeatureReportResponse
2765    {
2766        #[inline(always)]
2767        fn new_empty() -> Self {
2768            Self { report: fidl::new_empty!(FeatureReport, D) }
2769        }
2770
2771        #[inline]
2772        unsafe fn decode(
2773            &mut self,
2774            decoder: &mut fidl::encoding::Decoder<'_, D>,
2775            offset: usize,
2776            _depth: fidl::encoding::Depth,
2777        ) -> fidl::Result<()> {
2778            decoder.debug_check_bounds::<Self>(offset);
2779            // Verify that padding bytes are zero.
2780            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2781            Ok(())
2782        }
2783    }
2784
2785    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportResponse {
2786        type Borrowed<'a> = &'a Self;
2787        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2788            value
2789        }
2790    }
2791
2792    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2793        type Owned = Self;
2794
2795        #[inline(always)]
2796        fn inline_align(_context: fidl::encoding::Context) -> usize {
2797            8
2798        }
2799
2800        #[inline(always)]
2801        fn inline_size(_context: fidl::encoding::Context) -> usize {
2802            16
2803        }
2804    }
2805
2806    unsafe impl<D: fidl::encoding::ResourceDialect>
2807        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D>
2808        for &InputDeviceGetInputReportResponse
2809    {
2810        #[inline]
2811        unsafe fn encode(
2812            self,
2813            encoder: &mut fidl::encoding::Encoder<'_, D>,
2814            offset: usize,
2815            _depth: fidl::encoding::Depth,
2816        ) -> fidl::Result<()> {
2817            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2818            // Delegate to tuple encoding.
2819            fidl::encoding::Encode::<InputDeviceGetInputReportResponse, D>::encode(
2820                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2821                encoder,
2822                offset,
2823                _depth,
2824            )
2825        }
2826    }
2827    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2828        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D> for (T0,)
2829    {
2830        #[inline]
2831        unsafe fn encode(
2832            self,
2833            encoder: &mut fidl::encoding::Encoder<'_, D>,
2834            offset: usize,
2835            depth: fidl::encoding::Depth,
2836        ) -> fidl::Result<()> {
2837            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2838            // Zero out padding regions. There's no need to apply masks
2839            // because the unmasked parts will be overwritten by fields.
2840            // Write the fields.
2841            self.0.encode(encoder, offset + 0, depth)?;
2842            Ok(())
2843        }
2844    }
2845
2846    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2847        for InputDeviceGetInputReportResponse
2848    {
2849        #[inline(always)]
2850        fn new_empty() -> Self {
2851            Self { report: fidl::new_empty!(InputReport, D) }
2852        }
2853
2854        #[inline]
2855        unsafe fn decode(
2856            &mut self,
2857            decoder: &mut fidl::encoding::Decoder<'_, D>,
2858            offset: usize,
2859            _depth: fidl::encoding::Depth,
2860        ) -> fidl::Result<()> {
2861            decoder.debug_check_bounds::<Self>(offset);
2862            // Verify that padding bytes are zero.
2863            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2864            Ok(())
2865        }
2866    }
2867
2868    impl fidl::encoding::ValueTypeMarker for InputReportsReaderReadInputReportsResponse {
2869        type Borrowed<'a> = &'a Self;
2870        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2871            value
2872        }
2873    }
2874
2875    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2876        type Owned = Self;
2877
2878        #[inline(always)]
2879        fn inline_align(_context: fidl::encoding::Context) -> usize {
2880            8
2881        }
2882
2883        #[inline(always)]
2884        fn inline_size(_context: fidl::encoding::Context) -> usize {
2885            16
2886        }
2887    }
2888
2889    unsafe impl<D: fidl::encoding::ResourceDialect>
2890        fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D>
2891        for &InputReportsReaderReadInputReportsResponse
2892    {
2893        #[inline]
2894        unsafe fn encode(
2895            self,
2896            encoder: &mut fidl::encoding::Encoder<'_, D>,
2897            offset: usize,
2898            _depth: fidl::encoding::Depth,
2899        ) -> fidl::Result<()> {
2900            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2901            // Delegate to tuple encoding.
2902            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, D>::encode(
2903                (
2904                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.reports),
2905                ),
2906                encoder, offset, _depth
2907            )
2908        }
2909    }
2910    unsafe impl<
2911        D: fidl::encoding::ResourceDialect,
2912        T0: fidl::encoding::Encode<fidl::encoding::Vector<InputReport, 50>, D>,
2913    > fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D> for (T0,)
2914    {
2915        #[inline]
2916        unsafe fn encode(
2917            self,
2918            encoder: &mut fidl::encoding::Encoder<'_, D>,
2919            offset: usize,
2920            depth: fidl::encoding::Depth,
2921        ) -> fidl::Result<()> {
2922            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2923            // Zero out padding regions. There's no need to apply masks
2924            // because the unmasked parts will be overwritten by fields.
2925            // Write the fields.
2926            self.0.encode(encoder, offset + 0, depth)?;
2927            Ok(())
2928        }
2929    }
2930
2931    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2932        for InputReportsReaderReadInputReportsResponse
2933    {
2934        #[inline(always)]
2935        fn new_empty() -> Self {
2936            Self { reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, D) }
2937        }
2938
2939        #[inline]
2940        unsafe fn decode(
2941            &mut self,
2942            decoder: &mut fidl::encoding::Decoder<'_, D>,
2943            offset: usize,
2944            _depth: fidl::encoding::Depth,
2945        ) -> fidl::Result<()> {
2946            decoder.debug_check_bounds::<Self>(offset);
2947            // Verify that padding bytes are zero.
2948            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, D, &mut self.reports, decoder, offset + 0, _depth)?;
2949            Ok(())
2950        }
2951    }
2952
2953    impl fidl::encoding::ValueTypeMarker for Range {
2954        type Borrowed<'a> = &'a Self;
2955        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2956            value
2957        }
2958    }
2959
2960    unsafe impl fidl::encoding::TypeMarker for Range {
2961        type Owned = Self;
2962
2963        #[inline(always)]
2964        fn inline_align(_context: fidl::encoding::Context) -> usize {
2965            8
2966        }
2967
2968        #[inline(always)]
2969        fn inline_size(_context: fidl::encoding::Context) -> usize {
2970            16
2971        }
2972        #[inline(always)]
2973        fn encode_is_copy() -> bool {
2974            true
2975        }
2976
2977        #[inline(always)]
2978        fn decode_is_copy() -> bool {
2979            true
2980        }
2981    }
2982
2983    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
2984        #[inline]
2985        unsafe fn encode(
2986            self,
2987            encoder: &mut fidl::encoding::Encoder<'_, D>,
2988            offset: usize,
2989            _depth: fidl::encoding::Depth,
2990        ) -> fidl::Result<()> {
2991            encoder.debug_check_bounds::<Range>(offset);
2992            unsafe {
2993                // Copy the object into the buffer.
2994                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2995                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
2996                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2997                // done second because the memcpy will write garbage to these bytes.
2998            }
2999            Ok(())
3000        }
3001    }
3002    unsafe impl<
3003        D: fidl::encoding::ResourceDialect,
3004        T0: fidl::encoding::Encode<i64, D>,
3005        T1: fidl::encoding::Encode<i64, D>,
3006    > fidl::encoding::Encode<Range, D> for (T0, T1)
3007    {
3008        #[inline]
3009        unsafe fn encode(
3010            self,
3011            encoder: &mut fidl::encoding::Encoder<'_, D>,
3012            offset: usize,
3013            depth: fidl::encoding::Depth,
3014        ) -> fidl::Result<()> {
3015            encoder.debug_check_bounds::<Range>(offset);
3016            // Zero out padding regions. There's no need to apply masks
3017            // because the unmasked parts will be overwritten by fields.
3018            // Write the fields.
3019            self.0.encode(encoder, offset + 0, depth)?;
3020            self.1.encode(encoder, offset + 8, depth)?;
3021            Ok(())
3022        }
3023    }
3024
3025    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
3026        #[inline(always)]
3027        fn new_empty() -> Self {
3028            Self { min: fidl::new_empty!(i64, D), max: fidl::new_empty!(i64, D) }
3029        }
3030
3031        #[inline]
3032        unsafe fn decode(
3033            &mut self,
3034            decoder: &mut fidl::encoding::Decoder<'_, D>,
3035            offset: usize,
3036            _depth: fidl::encoding::Depth,
3037        ) -> fidl::Result<()> {
3038            decoder.debug_check_bounds::<Self>(offset);
3039            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3040            // Verify that padding bytes are zero.
3041            // Copy from the buffer into the object.
3042            unsafe {
3043                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3044            }
3045            Ok(())
3046        }
3047    }
3048
3049    impl fidl::encoding::ValueTypeMarker for SensorAxis {
3050        type Borrowed<'a> = &'a Self;
3051        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3052            value
3053        }
3054    }
3055
3056    unsafe impl fidl::encoding::TypeMarker for SensorAxis {
3057        type Owned = Self;
3058
3059        #[inline(always)]
3060        fn inline_align(_context: fidl::encoding::Context) -> usize {
3061            8
3062        }
3063
3064        #[inline(always)]
3065        fn inline_size(_context: fidl::encoding::Context) -> usize {
3066            32
3067        }
3068    }
3069
3070    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorAxis, D>
3071        for &SensorAxis
3072    {
3073        #[inline]
3074        unsafe fn encode(
3075            self,
3076            encoder: &mut fidl::encoding::Encoder<'_, D>,
3077            offset: usize,
3078            _depth: fidl::encoding::Depth,
3079        ) -> fidl::Result<()> {
3080            encoder.debug_check_bounds::<SensorAxis>(offset);
3081            // Delegate to tuple encoding.
3082            fidl::encoding::Encode::<SensorAxis, D>::encode(
3083                (
3084                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.axis),
3085                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3086                ),
3087                encoder,
3088                offset,
3089                _depth,
3090            )
3091        }
3092    }
3093    unsafe impl<
3094        D: fidl::encoding::ResourceDialect,
3095        T0: fidl::encoding::Encode<Axis, D>,
3096        T1: fidl::encoding::Encode<SensorType, D>,
3097    > fidl::encoding::Encode<SensorAxis, D> for (T0, T1)
3098    {
3099        #[inline]
3100        unsafe fn encode(
3101            self,
3102            encoder: &mut fidl::encoding::Encoder<'_, D>,
3103            offset: usize,
3104            depth: fidl::encoding::Depth,
3105        ) -> fidl::Result<()> {
3106            encoder.debug_check_bounds::<SensorAxis>(offset);
3107            // Zero out padding regions. There's no need to apply masks
3108            // because the unmasked parts will be overwritten by fields.
3109            unsafe {
3110                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3111                (ptr as *mut u64).write_unaligned(0);
3112            }
3113            // Write the fields.
3114            self.0.encode(encoder, offset + 0, depth)?;
3115            self.1.encode(encoder, offset + 24, depth)?;
3116            Ok(())
3117        }
3118    }
3119
3120    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorAxis {
3121        #[inline(always)]
3122        fn new_empty() -> Self {
3123            Self { axis: fidl::new_empty!(Axis, D), type_: fidl::new_empty!(SensorType, D) }
3124        }
3125
3126        #[inline]
3127        unsafe fn decode(
3128            &mut self,
3129            decoder: &mut fidl::encoding::Decoder<'_, D>,
3130            offset: usize,
3131            _depth: fidl::encoding::Depth,
3132        ) -> fidl::Result<()> {
3133            decoder.debug_check_bounds::<Self>(offset);
3134            // Verify that padding bytes are zero.
3135            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3136            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3137            let mask = 0xffffffff00000000u64;
3138            let maskedval = padval & mask;
3139            if maskedval != 0 {
3140                return Err(fidl::Error::NonZeroPadding {
3141                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3142                });
3143            }
3144            fidl::decode!(Axis, D, &mut self.axis, decoder, offset + 0, _depth)?;
3145            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 24, _depth)?;
3146            Ok(())
3147        }
3148    }
3149
3150    impl fidl::encoding::ValueTypeMarker for Unit {
3151        type Borrowed<'a> = &'a Self;
3152        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3153            value
3154        }
3155    }
3156
3157    unsafe impl fidl::encoding::TypeMarker for Unit {
3158        type Owned = Self;
3159
3160        #[inline(always)]
3161        fn inline_align(_context: fidl::encoding::Context) -> usize {
3162            4
3163        }
3164
3165        #[inline(always)]
3166        fn inline_size(_context: fidl::encoding::Context) -> usize {
3167            8
3168        }
3169    }
3170
3171    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
3172        #[inline]
3173        unsafe fn encode(
3174            self,
3175            encoder: &mut fidl::encoding::Encoder<'_, D>,
3176            offset: usize,
3177            _depth: fidl::encoding::Depth,
3178        ) -> fidl::Result<()> {
3179            encoder.debug_check_bounds::<Unit>(offset);
3180            // Delegate to tuple encoding.
3181            fidl::encoding::Encode::<Unit, D>::encode(
3182                (
3183                    <UnitType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3184                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
3185                ),
3186                encoder,
3187                offset,
3188                _depth,
3189            )
3190        }
3191    }
3192    unsafe impl<
3193        D: fidl::encoding::ResourceDialect,
3194        T0: fidl::encoding::Encode<UnitType, D>,
3195        T1: fidl::encoding::Encode<i32, D>,
3196    > fidl::encoding::Encode<Unit, D> for (T0, T1)
3197    {
3198        #[inline]
3199        unsafe fn encode(
3200            self,
3201            encoder: &mut fidl::encoding::Encoder<'_, D>,
3202            offset: usize,
3203            depth: fidl::encoding::Depth,
3204        ) -> fidl::Result<()> {
3205            encoder.debug_check_bounds::<Unit>(offset);
3206            // Zero out padding regions. There's no need to apply masks
3207            // because the unmasked parts will be overwritten by fields.
3208            // Write the fields.
3209            self.0.encode(encoder, offset + 0, depth)?;
3210            self.1.encode(encoder, offset + 4, depth)?;
3211            Ok(())
3212        }
3213    }
3214
3215    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
3216        #[inline(always)]
3217        fn new_empty() -> Self {
3218            Self { type_: fidl::new_empty!(UnitType, D), exponent: fidl::new_empty!(i32, D) }
3219        }
3220
3221        #[inline]
3222        unsafe fn decode(
3223            &mut self,
3224            decoder: &mut fidl::encoding::Decoder<'_, D>,
3225            offset: usize,
3226            _depth: fidl::encoding::Depth,
3227        ) -> fidl::Result<()> {
3228            decoder.debug_check_bounds::<Self>(offset);
3229            // Verify that padding bytes are zero.
3230            fidl::decode!(UnitType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3231            fidl::decode!(i32, D, &mut self.exponent, decoder, offset + 4, _depth)?;
3232            Ok(())
3233        }
3234    }
3235
3236    impl ConsumerControlDescriptor {
3237        #[inline(always)]
3238        fn max_ordinal_present(&self) -> u64 {
3239            if let Some(_) = self.input {
3240                return 1;
3241            }
3242            0
3243        }
3244    }
3245
3246    impl fidl::encoding::ValueTypeMarker for ConsumerControlDescriptor {
3247        type Borrowed<'a> = &'a Self;
3248        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3249            value
3250        }
3251    }
3252
3253    unsafe impl fidl::encoding::TypeMarker for ConsumerControlDescriptor {
3254        type Owned = Self;
3255
3256        #[inline(always)]
3257        fn inline_align(_context: fidl::encoding::Context) -> usize {
3258            8
3259        }
3260
3261        #[inline(always)]
3262        fn inline_size(_context: fidl::encoding::Context) -> usize {
3263            16
3264        }
3265    }
3266
3267    unsafe impl<D: fidl::encoding::ResourceDialect>
3268        fidl::encoding::Encode<ConsumerControlDescriptor, D> for &ConsumerControlDescriptor
3269    {
3270        unsafe fn encode(
3271            self,
3272            encoder: &mut fidl::encoding::Encoder<'_, D>,
3273            offset: usize,
3274            mut depth: fidl::encoding::Depth,
3275        ) -> fidl::Result<()> {
3276            encoder.debug_check_bounds::<ConsumerControlDescriptor>(offset);
3277            // Vector header
3278            let max_ordinal: u64 = self.max_ordinal_present();
3279            encoder.write_num(max_ordinal, offset);
3280            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3281            // Calling encoder.out_of_line_offset(0) is not allowed.
3282            if max_ordinal == 0 {
3283                return Ok(());
3284            }
3285            depth.increment()?;
3286            let envelope_size = 8;
3287            let bytes_len = max_ordinal as usize * envelope_size;
3288            #[allow(unused_variables)]
3289            let offset = encoder.out_of_line_offset(bytes_len);
3290            let mut _prev_end_offset: usize = 0;
3291            if 1 > max_ordinal {
3292                return Ok(());
3293            }
3294
3295            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3296            // are envelope_size bytes.
3297            let cur_offset: usize = (1 - 1) * envelope_size;
3298
3299            // Zero reserved fields.
3300            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3301
3302            // Safety:
3303            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3304            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3305            //   envelope_size bytes, there is always sufficient room.
3306            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputDescriptor, D>(
3307                self.input.as_ref().map(
3308                    <ConsumerControlInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow,
3309                ),
3310                encoder,
3311                offset + cur_offset,
3312                depth,
3313            )?;
3314
3315            _prev_end_offset = cur_offset + envelope_size;
3316
3317            Ok(())
3318        }
3319    }
3320
3321    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3322        for ConsumerControlDescriptor
3323    {
3324        #[inline(always)]
3325        fn new_empty() -> Self {
3326            Self::default()
3327        }
3328
3329        unsafe fn decode(
3330            &mut self,
3331            decoder: &mut fidl::encoding::Decoder<'_, D>,
3332            offset: usize,
3333            mut depth: fidl::encoding::Depth,
3334        ) -> fidl::Result<()> {
3335            decoder.debug_check_bounds::<Self>(offset);
3336            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3337                None => return Err(fidl::Error::NotNullable),
3338                Some(len) => len,
3339            };
3340            // Calling decoder.out_of_line_offset(0) is not allowed.
3341            if len == 0 {
3342                return Ok(());
3343            };
3344            depth.increment()?;
3345            let envelope_size = 8;
3346            let bytes_len = len * envelope_size;
3347            let offset = decoder.out_of_line_offset(bytes_len)?;
3348            // Decode the envelope for each type.
3349            let mut _next_ordinal_to_read = 0;
3350            let mut next_offset = offset;
3351            let end_offset = offset + bytes_len;
3352            _next_ordinal_to_read += 1;
3353            if next_offset >= end_offset {
3354                return Ok(());
3355            }
3356
3357            // Decode unknown envelopes for gaps in ordinals.
3358            while _next_ordinal_to_read < 1 {
3359                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3360                _next_ordinal_to_read += 1;
3361                next_offset += envelope_size;
3362            }
3363
3364            let next_out_of_line = decoder.next_out_of_line();
3365            let handles_before = decoder.remaining_handles();
3366            if let Some((inlined, num_bytes, num_handles)) =
3367                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3368            {
3369                let member_inline_size =
3370                    <ConsumerControlInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
3371                        decoder.context,
3372                    );
3373                if inlined != (member_inline_size <= 4) {
3374                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3375                }
3376                let inner_offset;
3377                let mut inner_depth = depth.clone();
3378                if inlined {
3379                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3380                    inner_offset = next_offset;
3381                } else {
3382                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3383                    inner_depth.increment()?;
3384                }
3385                let val_ref = self
3386                    .input
3387                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputDescriptor, D));
3388                fidl::decode!(
3389                    ConsumerControlInputDescriptor,
3390                    D,
3391                    val_ref,
3392                    decoder,
3393                    inner_offset,
3394                    inner_depth
3395                )?;
3396                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3397                {
3398                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3399                }
3400                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3401                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3402                }
3403            }
3404
3405            next_offset += envelope_size;
3406
3407            // Decode the remaining unknown envelopes.
3408            while next_offset < end_offset {
3409                _next_ordinal_to_read += 1;
3410                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3411                next_offset += envelope_size;
3412            }
3413
3414            Ok(())
3415        }
3416    }
3417
3418    impl ConsumerControlInputDescriptor {
3419        #[inline(always)]
3420        fn max_ordinal_present(&self) -> u64 {
3421            if let Some(_) = self.buttons {
3422                return 1;
3423            }
3424            0
3425        }
3426    }
3427
3428    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputDescriptor {
3429        type Borrowed<'a> = &'a Self;
3430        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3431            value
3432        }
3433    }
3434
3435    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputDescriptor {
3436        type Owned = Self;
3437
3438        #[inline(always)]
3439        fn inline_align(_context: fidl::encoding::Context) -> usize {
3440            8
3441        }
3442
3443        #[inline(always)]
3444        fn inline_size(_context: fidl::encoding::Context) -> usize {
3445            16
3446        }
3447    }
3448
3449    unsafe impl<D: fidl::encoding::ResourceDialect>
3450        fidl::encoding::Encode<ConsumerControlInputDescriptor, D>
3451        for &ConsumerControlInputDescriptor
3452    {
3453        unsafe fn encode(
3454            self,
3455            encoder: &mut fidl::encoding::Encoder<'_, D>,
3456            offset: usize,
3457            mut depth: fidl::encoding::Depth,
3458        ) -> fidl::Result<()> {
3459            encoder.debug_check_bounds::<ConsumerControlInputDescriptor>(offset);
3460            // Vector header
3461            let max_ordinal: u64 = self.max_ordinal_present();
3462            encoder.write_num(max_ordinal, offset);
3463            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3464            // Calling encoder.out_of_line_offset(0) is not allowed.
3465            if max_ordinal == 0 {
3466                return Ok(());
3467            }
3468            depth.increment()?;
3469            let envelope_size = 8;
3470            let bytes_len = max_ordinal as usize * envelope_size;
3471            #[allow(unused_variables)]
3472            let offset = encoder.out_of_line_offset(bytes_len);
3473            let mut _prev_end_offset: usize = 0;
3474            if 1 > max_ordinal {
3475                return Ok(());
3476            }
3477
3478            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3479            // are envelope_size bytes.
3480            let cur_offset: usize = (1 - 1) * envelope_size;
3481
3482            // Zero reserved fields.
3483            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3484
3485            // Safety:
3486            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3487            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3488            //   envelope_size bytes, there is always sufficient room.
3489            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3490            self.buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3491            encoder, offset + cur_offset, depth
3492        )?;
3493
3494            _prev_end_offset = cur_offset + envelope_size;
3495
3496            Ok(())
3497        }
3498    }
3499
3500    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3501        for ConsumerControlInputDescriptor
3502    {
3503        #[inline(always)]
3504        fn new_empty() -> Self {
3505            Self::default()
3506        }
3507
3508        unsafe fn decode(
3509            &mut self,
3510            decoder: &mut fidl::encoding::Decoder<'_, D>,
3511            offset: usize,
3512            mut depth: fidl::encoding::Depth,
3513        ) -> fidl::Result<()> {
3514            decoder.debug_check_bounds::<Self>(offset);
3515            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3516                None => return Err(fidl::Error::NotNullable),
3517                Some(len) => len,
3518            };
3519            // Calling decoder.out_of_line_offset(0) is not allowed.
3520            if len == 0 {
3521                return Ok(());
3522            };
3523            depth.increment()?;
3524            let envelope_size = 8;
3525            let bytes_len = len * envelope_size;
3526            let offset = decoder.out_of_line_offset(bytes_len)?;
3527            // Decode the envelope for each type.
3528            let mut _next_ordinal_to_read = 0;
3529            let mut next_offset = offset;
3530            let end_offset = offset + bytes_len;
3531            _next_ordinal_to_read += 1;
3532            if next_offset >= end_offset {
3533                return Ok(());
3534            }
3535
3536            // Decode unknown envelopes for gaps in ordinals.
3537            while _next_ordinal_to_read < 1 {
3538                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3539                _next_ordinal_to_read += 1;
3540                next_offset += envelope_size;
3541            }
3542
3543            let next_out_of_line = decoder.next_out_of_line();
3544            let handles_before = decoder.remaining_handles();
3545            if let Some((inlined, num_bytes, num_handles)) =
3546                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3547            {
3548                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3549                if inlined != (member_inline_size <= 4) {
3550                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3551                }
3552                let inner_offset;
3553                let mut inner_depth = depth.clone();
3554                if inlined {
3555                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3556                    inner_offset = next_offset;
3557                } else {
3558                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3559                    inner_depth.increment()?;
3560                }
3561                let val_ref = self.buttons.get_or_insert_with(
3562                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3563                );
3564                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3565                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3566                {
3567                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3568                }
3569                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3570                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3571                }
3572            }
3573
3574            next_offset += envelope_size;
3575
3576            // Decode the remaining unknown envelopes.
3577            while next_offset < end_offset {
3578                _next_ordinal_to_read += 1;
3579                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3580                next_offset += envelope_size;
3581            }
3582
3583            Ok(())
3584        }
3585    }
3586
3587    impl ConsumerControlInputReport {
3588        #[inline(always)]
3589        fn max_ordinal_present(&self) -> u64 {
3590            if let Some(_) = self.pressed_buttons {
3591                return 1;
3592            }
3593            0
3594        }
3595    }
3596
3597    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputReport {
3598        type Borrowed<'a> = &'a Self;
3599        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3600            value
3601        }
3602    }
3603
3604    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputReport {
3605        type Owned = Self;
3606
3607        #[inline(always)]
3608        fn inline_align(_context: fidl::encoding::Context) -> usize {
3609            8
3610        }
3611
3612        #[inline(always)]
3613        fn inline_size(_context: fidl::encoding::Context) -> usize {
3614            16
3615        }
3616    }
3617
3618    unsafe impl<D: fidl::encoding::ResourceDialect>
3619        fidl::encoding::Encode<ConsumerControlInputReport, D> for &ConsumerControlInputReport
3620    {
3621        unsafe fn encode(
3622            self,
3623            encoder: &mut fidl::encoding::Encoder<'_, D>,
3624            offset: usize,
3625            mut depth: fidl::encoding::Depth,
3626        ) -> fidl::Result<()> {
3627            encoder.debug_check_bounds::<ConsumerControlInputReport>(offset);
3628            // Vector header
3629            let max_ordinal: u64 = self.max_ordinal_present();
3630            encoder.write_num(max_ordinal, offset);
3631            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3632            // Calling encoder.out_of_line_offset(0) is not allowed.
3633            if max_ordinal == 0 {
3634                return Ok(());
3635            }
3636            depth.increment()?;
3637            let envelope_size = 8;
3638            let bytes_len = max_ordinal as usize * envelope_size;
3639            #[allow(unused_variables)]
3640            let offset = encoder.out_of_line_offset(bytes_len);
3641            let mut _prev_end_offset: usize = 0;
3642            if 1 > max_ordinal {
3643                return Ok(());
3644            }
3645
3646            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3647            // are envelope_size bytes.
3648            let cur_offset: usize = (1 - 1) * envelope_size;
3649
3650            // Zero reserved fields.
3651            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3652
3653            // Safety:
3654            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3655            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3656            //   envelope_size bytes, there is always sufficient room.
3657            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3658            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3659            encoder, offset + cur_offset, depth
3660        )?;
3661
3662            _prev_end_offset = cur_offset + envelope_size;
3663
3664            Ok(())
3665        }
3666    }
3667
3668    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3669        for ConsumerControlInputReport
3670    {
3671        #[inline(always)]
3672        fn new_empty() -> Self {
3673            Self::default()
3674        }
3675
3676        unsafe fn decode(
3677            &mut self,
3678            decoder: &mut fidl::encoding::Decoder<'_, D>,
3679            offset: usize,
3680            mut depth: fidl::encoding::Depth,
3681        ) -> fidl::Result<()> {
3682            decoder.debug_check_bounds::<Self>(offset);
3683            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3684                None => return Err(fidl::Error::NotNullable),
3685                Some(len) => len,
3686            };
3687            // Calling decoder.out_of_line_offset(0) is not allowed.
3688            if len == 0 {
3689                return Ok(());
3690            };
3691            depth.increment()?;
3692            let envelope_size = 8;
3693            let bytes_len = len * envelope_size;
3694            let offset = decoder.out_of_line_offset(bytes_len)?;
3695            // Decode the envelope for each type.
3696            let mut _next_ordinal_to_read = 0;
3697            let mut next_offset = offset;
3698            let end_offset = offset + bytes_len;
3699            _next_ordinal_to_read += 1;
3700            if next_offset >= end_offset {
3701                return Ok(());
3702            }
3703
3704            // Decode unknown envelopes for gaps in ordinals.
3705            while _next_ordinal_to_read < 1 {
3706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3707                _next_ordinal_to_read += 1;
3708                next_offset += envelope_size;
3709            }
3710
3711            let next_out_of_line = decoder.next_out_of_line();
3712            let handles_before = decoder.remaining_handles();
3713            if let Some((inlined, num_bytes, num_handles)) =
3714                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3715            {
3716                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3717                if inlined != (member_inline_size <= 4) {
3718                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3719                }
3720                let inner_offset;
3721                let mut inner_depth = depth.clone();
3722                if inlined {
3723                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3724                    inner_offset = next_offset;
3725                } else {
3726                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3727                    inner_depth.increment()?;
3728                }
3729                let val_ref = self.pressed_buttons.get_or_insert_with(
3730                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3731                );
3732                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3733                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3734                {
3735                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3736                }
3737                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3738                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3739                }
3740            }
3741
3742            next_offset += envelope_size;
3743
3744            // Decode the remaining unknown envelopes.
3745            while next_offset < end_offset {
3746                _next_ordinal_to_read += 1;
3747                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3748                next_offset += envelope_size;
3749            }
3750
3751            Ok(())
3752        }
3753    }
3754
3755    impl ContactInputDescriptor {
3756        #[inline(always)]
3757        fn max_ordinal_present(&self) -> u64 {
3758            if let Some(_) = self.contact_height {
3759                return 5;
3760            }
3761            if let Some(_) = self.contact_width {
3762                return 4;
3763            }
3764            if let Some(_) = self.pressure {
3765                return 3;
3766            }
3767            if let Some(_) = self.position_y {
3768                return 2;
3769            }
3770            if let Some(_) = self.position_x {
3771                return 1;
3772            }
3773            0
3774        }
3775    }
3776
3777    impl fidl::encoding::ValueTypeMarker for ContactInputDescriptor {
3778        type Borrowed<'a> = &'a Self;
3779        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3780            value
3781        }
3782    }
3783
3784    unsafe impl fidl::encoding::TypeMarker for ContactInputDescriptor {
3785        type Owned = Self;
3786
3787        #[inline(always)]
3788        fn inline_align(_context: fidl::encoding::Context) -> usize {
3789            8
3790        }
3791
3792        #[inline(always)]
3793        fn inline_size(_context: fidl::encoding::Context) -> usize {
3794            16
3795        }
3796    }
3797
3798    unsafe impl<D: fidl::encoding::ResourceDialect>
3799        fidl::encoding::Encode<ContactInputDescriptor, D> for &ContactInputDescriptor
3800    {
3801        unsafe fn encode(
3802            self,
3803            encoder: &mut fidl::encoding::Encoder<'_, D>,
3804            offset: usize,
3805            mut depth: fidl::encoding::Depth,
3806        ) -> fidl::Result<()> {
3807            encoder.debug_check_bounds::<ContactInputDescriptor>(offset);
3808            // Vector header
3809            let max_ordinal: u64 = self.max_ordinal_present();
3810            encoder.write_num(max_ordinal, offset);
3811            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3812            // Calling encoder.out_of_line_offset(0) is not allowed.
3813            if max_ordinal == 0 {
3814                return Ok(());
3815            }
3816            depth.increment()?;
3817            let envelope_size = 8;
3818            let bytes_len = max_ordinal as usize * envelope_size;
3819            #[allow(unused_variables)]
3820            let offset = encoder.out_of_line_offset(bytes_len);
3821            let mut _prev_end_offset: usize = 0;
3822            if 1 > max_ordinal {
3823                return Ok(());
3824            }
3825
3826            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3827            // are envelope_size bytes.
3828            let cur_offset: usize = (1 - 1) * envelope_size;
3829
3830            // Zero reserved fields.
3831            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3832
3833            // Safety:
3834            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3835            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3836            //   envelope_size bytes, there is always sufficient room.
3837            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3838                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3839                encoder,
3840                offset + cur_offset,
3841                depth,
3842            )?;
3843
3844            _prev_end_offset = cur_offset + envelope_size;
3845            if 2 > max_ordinal {
3846                return Ok(());
3847            }
3848
3849            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3850            // are envelope_size bytes.
3851            let cur_offset: usize = (2 - 1) * envelope_size;
3852
3853            // Zero reserved fields.
3854            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3855
3856            // Safety:
3857            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3858            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3859            //   envelope_size bytes, there is always sufficient room.
3860            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3861                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3862                encoder,
3863                offset + cur_offset,
3864                depth,
3865            )?;
3866
3867            _prev_end_offset = cur_offset + envelope_size;
3868            if 3 > max_ordinal {
3869                return Ok(());
3870            }
3871
3872            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3873            // are envelope_size bytes.
3874            let cur_offset: usize = (3 - 1) * envelope_size;
3875
3876            // Zero reserved fields.
3877            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3878
3879            // Safety:
3880            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3881            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3882            //   envelope_size bytes, there is always sufficient room.
3883            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3884                self.pressure.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3885                encoder,
3886                offset + cur_offset,
3887                depth,
3888            )?;
3889
3890            _prev_end_offset = cur_offset + envelope_size;
3891            if 4 > max_ordinal {
3892                return Ok(());
3893            }
3894
3895            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3896            // are envelope_size bytes.
3897            let cur_offset: usize = (4 - 1) * envelope_size;
3898
3899            // Zero reserved fields.
3900            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3901
3902            // Safety:
3903            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3904            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3905            //   envelope_size bytes, there is always sufficient room.
3906            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3907                self.contact_width.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3908                encoder,
3909                offset + cur_offset,
3910                depth,
3911            )?;
3912
3913            _prev_end_offset = cur_offset + envelope_size;
3914            if 5 > max_ordinal {
3915                return Ok(());
3916            }
3917
3918            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3919            // are envelope_size bytes.
3920            let cur_offset: usize = (5 - 1) * envelope_size;
3921
3922            // Zero reserved fields.
3923            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3924
3925            // Safety:
3926            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3927            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3928            //   envelope_size bytes, there is always sufficient room.
3929            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3930                self.contact_height.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3931                encoder,
3932                offset + cur_offset,
3933                depth,
3934            )?;
3935
3936            _prev_end_offset = cur_offset + envelope_size;
3937
3938            Ok(())
3939        }
3940    }
3941
3942    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3943        for ContactInputDescriptor
3944    {
3945        #[inline(always)]
3946        fn new_empty() -> Self {
3947            Self::default()
3948        }
3949
3950        unsafe fn decode(
3951            &mut self,
3952            decoder: &mut fidl::encoding::Decoder<'_, D>,
3953            offset: usize,
3954            mut depth: fidl::encoding::Depth,
3955        ) -> fidl::Result<()> {
3956            decoder.debug_check_bounds::<Self>(offset);
3957            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3958                None => return Err(fidl::Error::NotNullable),
3959                Some(len) => len,
3960            };
3961            // Calling decoder.out_of_line_offset(0) is not allowed.
3962            if len == 0 {
3963                return Ok(());
3964            };
3965            depth.increment()?;
3966            let envelope_size = 8;
3967            let bytes_len = len * envelope_size;
3968            let offset = decoder.out_of_line_offset(bytes_len)?;
3969            // Decode the envelope for each type.
3970            let mut _next_ordinal_to_read = 0;
3971            let mut next_offset = offset;
3972            let end_offset = offset + bytes_len;
3973            _next_ordinal_to_read += 1;
3974            if next_offset >= end_offset {
3975                return Ok(());
3976            }
3977
3978            // Decode unknown envelopes for gaps in ordinals.
3979            while _next_ordinal_to_read < 1 {
3980                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3981                _next_ordinal_to_read += 1;
3982                next_offset += envelope_size;
3983            }
3984
3985            let next_out_of_line = decoder.next_out_of_line();
3986            let handles_before = decoder.remaining_handles();
3987            if let Some((inlined, num_bytes, num_handles)) =
3988                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3989            {
3990                let member_inline_size =
3991                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3992                if inlined != (member_inline_size <= 4) {
3993                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3994                }
3995                let inner_offset;
3996                let mut inner_depth = depth.clone();
3997                if inlined {
3998                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3999                    inner_offset = next_offset;
4000                } else {
4001                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4002                    inner_depth.increment()?;
4003                }
4004                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4005                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4006                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4007                {
4008                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4009                }
4010                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4011                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4012                }
4013            }
4014
4015            next_offset += envelope_size;
4016            _next_ordinal_to_read += 1;
4017            if next_offset >= end_offset {
4018                return Ok(());
4019            }
4020
4021            // Decode unknown envelopes for gaps in ordinals.
4022            while _next_ordinal_to_read < 2 {
4023                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4024                _next_ordinal_to_read += 1;
4025                next_offset += envelope_size;
4026            }
4027
4028            let next_out_of_line = decoder.next_out_of_line();
4029            let handles_before = decoder.remaining_handles();
4030            if let Some((inlined, num_bytes, num_handles)) =
4031                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4032            {
4033                let member_inline_size =
4034                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4035                if inlined != (member_inline_size <= 4) {
4036                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4037                }
4038                let inner_offset;
4039                let mut inner_depth = depth.clone();
4040                if inlined {
4041                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4042                    inner_offset = next_offset;
4043                } else {
4044                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4045                    inner_depth.increment()?;
4046                }
4047                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4048                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4049                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4050                {
4051                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4052                }
4053                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4054                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4055                }
4056            }
4057
4058            next_offset += envelope_size;
4059            _next_ordinal_to_read += 1;
4060            if next_offset >= end_offset {
4061                return Ok(());
4062            }
4063
4064            // Decode unknown envelopes for gaps in ordinals.
4065            while _next_ordinal_to_read < 3 {
4066                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4067                _next_ordinal_to_read += 1;
4068                next_offset += envelope_size;
4069            }
4070
4071            let next_out_of_line = decoder.next_out_of_line();
4072            let handles_before = decoder.remaining_handles();
4073            if let Some((inlined, num_bytes, num_handles)) =
4074                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4075            {
4076                let member_inline_size =
4077                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4078                if inlined != (member_inline_size <= 4) {
4079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4080                }
4081                let inner_offset;
4082                let mut inner_depth = depth.clone();
4083                if inlined {
4084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4085                    inner_offset = next_offset;
4086                } else {
4087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4088                    inner_depth.increment()?;
4089                }
4090                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4091                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4092                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4093                {
4094                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4095                }
4096                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4097                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4098                }
4099            }
4100
4101            next_offset += envelope_size;
4102            _next_ordinal_to_read += 1;
4103            if next_offset >= end_offset {
4104                return Ok(());
4105            }
4106
4107            // Decode unknown envelopes for gaps in ordinals.
4108            while _next_ordinal_to_read < 4 {
4109                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4110                _next_ordinal_to_read += 1;
4111                next_offset += envelope_size;
4112            }
4113
4114            let next_out_of_line = decoder.next_out_of_line();
4115            let handles_before = decoder.remaining_handles();
4116            if let Some((inlined, num_bytes, num_handles)) =
4117                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4118            {
4119                let member_inline_size =
4120                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4121                if inlined != (member_inline_size <= 4) {
4122                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4123                }
4124                let inner_offset;
4125                let mut inner_depth = depth.clone();
4126                if inlined {
4127                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4128                    inner_offset = next_offset;
4129                } else {
4130                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4131                    inner_depth.increment()?;
4132                }
4133                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4134                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4135                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4136                {
4137                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4138                }
4139                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4140                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4141                }
4142            }
4143
4144            next_offset += envelope_size;
4145            _next_ordinal_to_read += 1;
4146            if next_offset >= end_offset {
4147                return Ok(());
4148            }
4149
4150            // Decode unknown envelopes for gaps in ordinals.
4151            while _next_ordinal_to_read < 5 {
4152                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4153                _next_ordinal_to_read += 1;
4154                next_offset += envelope_size;
4155            }
4156
4157            let next_out_of_line = decoder.next_out_of_line();
4158            let handles_before = decoder.remaining_handles();
4159            if let Some((inlined, num_bytes, num_handles)) =
4160                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4161            {
4162                let member_inline_size =
4163                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4164                if inlined != (member_inline_size <= 4) {
4165                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4166                }
4167                let inner_offset;
4168                let mut inner_depth = depth.clone();
4169                if inlined {
4170                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4171                    inner_offset = next_offset;
4172                } else {
4173                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4174                    inner_depth.increment()?;
4175                }
4176                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4177                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4178                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4179                {
4180                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4181                }
4182                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4183                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4184                }
4185            }
4186
4187            next_offset += envelope_size;
4188
4189            // Decode the remaining unknown envelopes.
4190            while next_offset < end_offset {
4191                _next_ordinal_to_read += 1;
4192                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4193                next_offset += envelope_size;
4194            }
4195
4196            Ok(())
4197        }
4198    }
4199
4200    impl ContactInputReport {
4201        #[inline(always)]
4202        fn max_ordinal_present(&self) -> u64 {
4203            if let Some(_) = self.confidence {
4204                return 7;
4205            }
4206            if let Some(_) = self.contact_height {
4207                return 6;
4208            }
4209            if let Some(_) = self.contact_width {
4210                return 5;
4211            }
4212            if let Some(_) = self.pressure {
4213                return 4;
4214            }
4215            if let Some(_) = self.position_y {
4216                return 3;
4217            }
4218            if let Some(_) = self.position_x {
4219                return 2;
4220            }
4221            if let Some(_) = self.contact_id {
4222                return 1;
4223            }
4224            0
4225        }
4226    }
4227
4228    impl fidl::encoding::ValueTypeMarker for ContactInputReport {
4229        type Borrowed<'a> = &'a Self;
4230        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4231            value
4232        }
4233    }
4234
4235    unsafe impl fidl::encoding::TypeMarker for ContactInputReport {
4236        type Owned = Self;
4237
4238        #[inline(always)]
4239        fn inline_align(_context: fidl::encoding::Context) -> usize {
4240            8
4241        }
4242
4243        #[inline(always)]
4244        fn inline_size(_context: fidl::encoding::Context) -> usize {
4245            16
4246        }
4247    }
4248
4249    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContactInputReport, D>
4250        for &ContactInputReport
4251    {
4252        unsafe fn encode(
4253            self,
4254            encoder: &mut fidl::encoding::Encoder<'_, D>,
4255            offset: usize,
4256            mut depth: fidl::encoding::Depth,
4257        ) -> fidl::Result<()> {
4258            encoder.debug_check_bounds::<ContactInputReport>(offset);
4259            // Vector header
4260            let max_ordinal: u64 = self.max_ordinal_present();
4261            encoder.write_num(max_ordinal, offset);
4262            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4263            // Calling encoder.out_of_line_offset(0) is not allowed.
4264            if max_ordinal == 0 {
4265                return Ok(());
4266            }
4267            depth.increment()?;
4268            let envelope_size = 8;
4269            let bytes_len = max_ordinal as usize * envelope_size;
4270            #[allow(unused_variables)]
4271            let offset = encoder.out_of_line_offset(bytes_len);
4272            let mut _prev_end_offset: usize = 0;
4273            if 1 > max_ordinal {
4274                return Ok(());
4275            }
4276
4277            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4278            // are envelope_size bytes.
4279            let cur_offset: usize = (1 - 1) * envelope_size;
4280
4281            // Zero reserved fields.
4282            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4283
4284            // Safety:
4285            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4286            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4287            //   envelope_size bytes, there is always sufficient room.
4288            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4289                self.contact_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4290                encoder,
4291                offset + cur_offset,
4292                depth,
4293            )?;
4294
4295            _prev_end_offset = cur_offset + envelope_size;
4296            if 2 > max_ordinal {
4297                return Ok(());
4298            }
4299
4300            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4301            // are envelope_size bytes.
4302            let cur_offset: usize = (2 - 1) * envelope_size;
4303
4304            // Zero reserved fields.
4305            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4306
4307            // Safety:
4308            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4309            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4310            //   envelope_size bytes, there is always sufficient room.
4311            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4312                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4313                encoder,
4314                offset + cur_offset,
4315                depth,
4316            )?;
4317
4318            _prev_end_offset = cur_offset + envelope_size;
4319            if 3 > max_ordinal {
4320                return Ok(());
4321            }
4322
4323            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4324            // are envelope_size bytes.
4325            let cur_offset: usize = (3 - 1) * envelope_size;
4326
4327            // Zero reserved fields.
4328            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4329
4330            // Safety:
4331            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4332            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4333            //   envelope_size bytes, there is always sufficient room.
4334            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4335                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4336                encoder,
4337                offset + cur_offset,
4338                depth,
4339            )?;
4340
4341            _prev_end_offset = cur_offset + envelope_size;
4342            if 4 > max_ordinal {
4343                return Ok(());
4344            }
4345
4346            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4347            // are envelope_size bytes.
4348            let cur_offset: usize = (4 - 1) * envelope_size;
4349
4350            // Zero reserved fields.
4351            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4352
4353            // Safety:
4354            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4355            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4356            //   envelope_size bytes, there is always sufficient room.
4357            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4358                self.pressure.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4359                encoder,
4360                offset + cur_offset,
4361                depth,
4362            )?;
4363
4364            _prev_end_offset = cur_offset + envelope_size;
4365            if 5 > max_ordinal {
4366                return Ok(());
4367            }
4368
4369            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4370            // are envelope_size bytes.
4371            let cur_offset: usize = (5 - 1) * envelope_size;
4372
4373            // Zero reserved fields.
4374            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4375
4376            // Safety:
4377            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4378            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4379            //   envelope_size bytes, there is always sufficient room.
4380            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4381                self.contact_width.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4382                encoder,
4383                offset + cur_offset,
4384                depth,
4385            )?;
4386
4387            _prev_end_offset = cur_offset + envelope_size;
4388            if 6 > max_ordinal {
4389                return Ok(());
4390            }
4391
4392            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4393            // are envelope_size bytes.
4394            let cur_offset: usize = (6 - 1) * envelope_size;
4395
4396            // Zero reserved fields.
4397            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4398
4399            // Safety:
4400            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4401            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4402            //   envelope_size bytes, there is always sufficient room.
4403            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4404                self.contact_height.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4405                encoder,
4406                offset + cur_offset,
4407                depth,
4408            )?;
4409
4410            _prev_end_offset = cur_offset + envelope_size;
4411            if 7 > max_ordinal {
4412                return Ok(());
4413            }
4414
4415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4416            // are envelope_size bytes.
4417            let cur_offset: usize = (7 - 1) * envelope_size;
4418
4419            // Zero reserved fields.
4420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4421
4422            // Safety:
4423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4425            //   envelope_size bytes, there is always sufficient room.
4426            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4427                self.confidence.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4428                encoder,
4429                offset + cur_offset,
4430                depth,
4431            )?;
4432
4433            _prev_end_offset = cur_offset + envelope_size;
4434
4435            Ok(())
4436        }
4437    }
4438
4439    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContactInputReport {
4440        #[inline(always)]
4441        fn new_empty() -> Self {
4442            Self::default()
4443        }
4444
4445        unsafe fn decode(
4446            &mut self,
4447            decoder: &mut fidl::encoding::Decoder<'_, D>,
4448            offset: usize,
4449            mut depth: fidl::encoding::Depth,
4450        ) -> fidl::Result<()> {
4451            decoder.debug_check_bounds::<Self>(offset);
4452            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4453                None => return Err(fidl::Error::NotNullable),
4454                Some(len) => len,
4455            };
4456            // Calling decoder.out_of_line_offset(0) is not allowed.
4457            if len == 0 {
4458                return Ok(());
4459            };
4460            depth.increment()?;
4461            let envelope_size = 8;
4462            let bytes_len = len * envelope_size;
4463            let offset = decoder.out_of_line_offset(bytes_len)?;
4464            // Decode the envelope for each type.
4465            let mut _next_ordinal_to_read = 0;
4466            let mut next_offset = offset;
4467            let end_offset = offset + bytes_len;
4468            _next_ordinal_to_read += 1;
4469            if next_offset >= end_offset {
4470                return Ok(());
4471            }
4472
4473            // Decode unknown envelopes for gaps in ordinals.
4474            while _next_ordinal_to_read < 1 {
4475                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4476                _next_ordinal_to_read += 1;
4477                next_offset += envelope_size;
4478            }
4479
4480            let next_out_of_line = decoder.next_out_of_line();
4481            let handles_before = decoder.remaining_handles();
4482            if let Some((inlined, num_bytes, num_handles)) =
4483                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4484            {
4485                let member_inline_size =
4486                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4487                if inlined != (member_inline_size <= 4) {
4488                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4489                }
4490                let inner_offset;
4491                let mut inner_depth = depth.clone();
4492                if inlined {
4493                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4494                    inner_offset = next_offset;
4495                } else {
4496                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4497                    inner_depth.increment()?;
4498                }
4499                let val_ref = self.contact_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4500                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4501                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4502                {
4503                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4504                }
4505                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4506                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4507                }
4508            }
4509
4510            next_offset += envelope_size;
4511            _next_ordinal_to_read += 1;
4512            if next_offset >= end_offset {
4513                return Ok(());
4514            }
4515
4516            // Decode unknown envelopes for gaps in ordinals.
4517            while _next_ordinal_to_read < 2 {
4518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4519                _next_ordinal_to_read += 1;
4520                next_offset += envelope_size;
4521            }
4522
4523            let next_out_of_line = decoder.next_out_of_line();
4524            let handles_before = decoder.remaining_handles();
4525            if let Some((inlined, num_bytes, num_handles)) =
4526                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4527            {
4528                let member_inline_size =
4529                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4530                if inlined != (member_inline_size <= 4) {
4531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4532                }
4533                let inner_offset;
4534                let mut inner_depth = depth.clone();
4535                if inlined {
4536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4537                    inner_offset = next_offset;
4538                } else {
4539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4540                    inner_depth.increment()?;
4541                }
4542                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
4543                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4544                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4545                {
4546                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4547                }
4548                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4549                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4550                }
4551            }
4552
4553            next_offset += envelope_size;
4554            _next_ordinal_to_read += 1;
4555            if next_offset >= end_offset {
4556                return Ok(());
4557            }
4558
4559            // Decode unknown envelopes for gaps in ordinals.
4560            while _next_ordinal_to_read < 3 {
4561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4562                _next_ordinal_to_read += 1;
4563                next_offset += envelope_size;
4564            }
4565
4566            let next_out_of_line = decoder.next_out_of_line();
4567            let handles_before = decoder.remaining_handles();
4568            if let Some((inlined, num_bytes, num_handles)) =
4569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4570            {
4571                let member_inline_size =
4572                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4573                if inlined != (member_inline_size <= 4) {
4574                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4575                }
4576                let inner_offset;
4577                let mut inner_depth = depth.clone();
4578                if inlined {
4579                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4580                    inner_offset = next_offset;
4581                } else {
4582                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4583                    inner_depth.increment()?;
4584                }
4585                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
4586                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4587                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4588                {
4589                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4590                }
4591                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4592                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4593                }
4594            }
4595
4596            next_offset += envelope_size;
4597            _next_ordinal_to_read += 1;
4598            if next_offset >= end_offset {
4599                return Ok(());
4600            }
4601
4602            // Decode unknown envelopes for gaps in ordinals.
4603            while _next_ordinal_to_read < 4 {
4604                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4605                _next_ordinal_to_read += 1;
4606                next_offset += envelope_size;
4607            }
4608
4609            let next_out_of_line = decoder.next_out_of_line();
4610            let handles_before = decoder.remaining_handles();
4611            if let Some((inlined, num_bytes, num_handles)) =
4612                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4613            {
4614                let member_inline_size =
4615                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4616                if inlined != (member_inline_size <= 4) {
4617                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4618                }
4619                let inner_offset;
4620                let mut inner_depth = depth.clone();
4621                if inlined {
4622                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4623                    inner_offset = next_offset;
4624                } else {
4625                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4626                    inner_depth.increment()?;
4627                }
4628                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(i64, D));
4629                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4630                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4631                {
4632                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4633                }
4634                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4635                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4636                }
4637            }
4638
4639            next_offset += envelope_size;
4640            _next_ordinal_to_read += 1;
4641            if next_offset >= end_offset {
4642                return Ok(());
4643            }
4644
4645            // Decode unknown envelopes for gaps in ordinals.
4646            while _next_ordinal_to_read < 5 {
4647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4648                _next_ordinal_to_read += 1;
4649                next_offset += envelope_size;
4650            }
4651
4652            let next_out_of_line = decoder.next_out_of_line();
4653            let handles_before = decoder.remaining_handles();
4654            if let Some((inlined, num_bytes, num_handles)) =
4655                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4656            {
4657                let member_inline_size =
4658                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4659                if inlined != (member_inline_size <= 4) {
4660                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4661                }
4662                let inner_offset;
4663                let mut inner_depth = depth.clone();
4664                if inlined {
4665                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4666                    inner_offset = next_offset;
4667                } else {
4668                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4669                    inner_depth.increment()?;
4670                }
4671                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(i64, D));
4672                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4673                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4674                {
4675                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4676                }
4677                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4678                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4679                }
4680            }
4681
4682            next_offset += envelope_size;
4683            _next_ordinal_to_read += 1;
4684            if next_offset >= end_offset {
4685                return Ok(());
4686            }
4687
4688            // Decode unknown envelopes for gaps in ordinals.
4689            while _next_ordinal_to_read < 6 {
4690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4691                _next_ordinal_to_read += 1;
4692                next_offset += envelope_size;
4693            }
4694
4695            let next_out_of_line = decoder.next_out_of_line();
4696            let handles_before = decoder.remaining_handles();
4697            if let Some((inlined, num_bytes, num_handles)) =
4698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4699            {
4700                let member_inline_size =
4701                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4702                if inlined != (member_inline_size <= 4) {
4703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4704                }
4705                let inner_offset;
4706                let mut inner_depth = depth.clone();
4707                if inlined {
4708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4709                    inner_offset = next_offset;
4710                } else {
4711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4712                    inner_depth.increment()?;
4713                }
4714                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(i64, D));
4715                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4716                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4717                {
4718                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4719                }
4720                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4721                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4722                }
4723            }
4724
4725            next_offset += envelope_size;
4726            _next_ordinal_to_read += 1;
4727            if next_offset >= end_offset {
4728                return Ok(());
4729            }
4730
4731            // Decode unknown envelopes for gaps in ordinals.
4732            while _next_ordinal_to_read < 7 {
4733                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4734                _next_ordinal_to_read += 1;
4735                next_offset += envelope_size;
4736            }
4737
4738            let next_out_of_line = decoder.next_out_of_line();
4739            let handles_before = decoder.remaining_handles();
4740            if let Some((inlined, num_bytes, num_handles)) =
4741                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4742            {
4743                let member_inline_size =
4744                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4745                if inlined != (member_inline_size <= 4) {
4746                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4747                }
4748                let inner_offset;
4749                let mut inner_depth = depth.clone();
4750                if inlined {
4751                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4752                    inner_offset = next_offset;
4753                } else {
4754                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4755                    inner_depth.increment()?;
4756                }
4757                let val_ref = self.confidence.get_or_insert_with(|| fidl::new_empty!(bool, D));
4758                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4759                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4760                {
4761                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4762                }
4763                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4764                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4765                }
4766            }
4767
4768            next_offset += envelope_size;
4769
4770            // Decode the remaining unknown envelopes.
4771            while next_offset < end_offset {
4772                _next_ordinal_to_read += 1;
4773                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4774                next_offset += envelope_size;
4775            }
4776
4777            Ok(())
4778        }
4779    }
4780
4781    impl DeviceDescriptor {
4782        #[inline(always)]
4783        fn max_ordinal_present(&self) -> u64 {
4784            if let Some(_) = self.device_information {
4785                return 7;
4786            }
4787            if let Some(_) = self.consumer_control {
4788                return 6;
4789            }
4790            if let Some(_) = self.keyboard {
4791                return 5;
4792            }
4793            if let Some(_) = self.touch {
4794                return 4;
4795            }
4796            if let Some(_) = self.sensor {
4797                return 3;
4798            }
4799            if let Some(_) = self.mouse {
4800                return 2;
4801            }
4802            0
4803        }
4804    }
4805
4806    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
4807        type Borrowed<'a> = &'a Self;
4808        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4809            value
4810        }
4811    }
4812
4813    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
4814        type Owned = Self;
4815
4816        #[inline(always)]
4817        fn inline_align(_context: fidl::encoding::Context) -> usize {
4818            8
4819        }
4820
4821        #[inline(always)]
4822        fn inline_size(_context: fidl::encoding::Context) -> usize {
4823            16
4824        }
4825    }
4826
4827    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
4828        for &DeviceDescriptor
4829    {
4830        unsafe fn encode(
4831            self,
4832            encoder: &mut fidl::encoding::Encoder<'_, D>,
4833            offset: usize,
4834            mut depth: fidl::encoding::Depth,
4835        ) -> fidl::Result<()> {
4836            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
4837            // Vector header
4838            let max_ordinal: u64 = self.max_ordinal_present();
4839            encoder.write_num(max_ordinal, offset);
4840            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4841            // Calling encoder.out_of_line_offset(0) is not allowed.
4842            if max_ordinal == 0 {
4843                return Ok(());
4844            }
4845            depth.increment()?;
4846            let envelope_size = 8;
4847            let bytes_len = max_ordinal as usize * envelope_size;
4848            #[allow(unused_variables)]
4849            let offset = encoder.out_of_line_offset(bytes_len);
4850            let mut _prev_end_offset: usize = 0;
4851            if 2 > max_ordinal {
4852                return Ok(());
4853            }
4854
4855            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4856            // are envelope_size bytes.
4857            let cur_offset: usize = (2 - 1) * envelope_size;
4858
4859            // Zero reserved fields.
4860            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4861
4862            // Safety:
4863            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4864            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4865            //   envelope_size bytes, there is always sufficient room.
4866            fidl::encoding::encode_in_envelope_optional::<MouseDescriptor, D>(
4867                self.mouse
4868                    .as_ref()
4869                    .map(<MouseDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4870                encoder,
4871                offset + cur_offset,
4872                depth,
4873            )?;
4874
4875            _prev_end_offset = cur_offset + envelope_size;
4876            if 3 > max_ordinal {
4877                return Ok(());
4878            }
4879
4880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4881            // are envelope_size bytes.
4882            let cur_offset: usize = (3 - 1) * envelope_size;
4883
4884            // Zero reserved fields.
4885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4886
4887            // Safety:
4888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4890            //   envelope_size bytes, there is always sufficient room.
4891            fidl::encoding::encode_in_envelope_optional::<SensorDescriptor, D>(
4892                self.sensor
4893                    .as_ref()
4894                    .map(<SensorDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4895                encoder,
4896                offset + cur_offset,
4897                depth,
4898            )?;
4899
4900            _prev_end_offset = cur_offset + envelope_size;
4901            if 4 > max_ordinal {
4902                return Ok(());
4903            }
4904
4905            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4906            // are envelope_size bytes.
4907            let cur_offset: usize = (4 - 1) * envelope_size;
4908
4909            // Zero reserved fields.
4910            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4911
4912            // Safety:
4913            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4914            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4915            //   envelope_size bytes, there is always sufficient room.
4916            fidl::encoding::encode_in_envelope_optional::<TouchDescriptor, D>(
4917                self.touch
4918                    .as_ref()
4919                    .map(<TouchDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4920                encoder,
4921                offset + cur_offset,
4922                depth,
4923            )?;
4924
4925            _prev_end_offset = cur_offset + envelope_size;
4926            if 5 > max_ordinal {
4927                return Ok(());
4928            }
4929
4930            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4931            // are envelope_size bytes.
4932            let cur_offset: usize = (5 - 1) * envelope_size;
4933
4934            // Zero reserved fields.
4935            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4936
4937            // Safety:
4938            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4939            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4940            //   envelope_size bytes, there is always sufficient room.
4941            fidl::encoding::encode_in_envelope_optional::<KeyboardDescriptor, D>(
4942                self.keyboard
4943                    .as_ref()
4944                    .map(<KeyboardDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4945                encoder,
4946                offset + cur_offset,
4947                depth,
4948            )?;
4949
4950            _prev_end_offset = cur_offset + envelope_size;
4951            if 6 > max_ordinal {
4952                return Ok(());
4953            }
4954
4955            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4956            // are envelope_size bytes.
4957            let cur_offset: usize = (6 - 1) * envelope_size;
4958
4959            // Zero reserved fields.
4960            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4961
4962            // Safety:
4963            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4964            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4965            //   envelope_size bytes, there is always sufficient room.
4966            fidl::encoding::encode_in_envelope_optional::<ConsumerControlDescriptor, D>(
4967                self.consumer_control
4968                    .as_ref()
4969                    .map(<ConsumerControlDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4970                encoder,
4971                offset + cur_offset,
4972                depth,
4973            )?;
4974
4975            _prev_end_offset = cur_offset + envelope_size;
4976            if 7 > max_ordinal {
4977                return Ok(());
4978            }
4979
4980            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4981            // are envelope_size bytes.
4982            let cur_offset: usize = (7 - 1) * envelope_size;
4983
4984            // Zero reserved fields.
4985            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4986
4987            // Safety:
4988            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4989            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4990            //   envelope_size bytes, there is always sufficient room.
4991            fidl::encoding::encode_in_envelope_optional::<DeviceInformation, D>(
4992                self.device_information
4993                    .as_ref()
4994                    .map(<DeviceInformation as fidl::encoding::ValueTypeMarker>::borrow),
4995                encoder,
4996                offset + cur_offset,
4997                depth,
4998            )?;
4999
5000            _prev_end_offset = cur_offset + envelope_size;
5001
5002            Ok(())
5003        }
5004    }
5005
5006    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
5007        #[inline(always)]
5008        fn new_empty() -> Self {
5009            Self::default()
5010        }
5011
5012        unsafe fn decode(
5013            &mut self,
5014            decoder: &mut fidl::encoding::Decoder<'_, D>,
5015            offset: usize,
5016            mut depth: fidl::encoding::Depth,
5017        ) -> fidl::Result<()> {
5018            decoder.debug_check_bounds::<Self>(offset);
5019            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5020                None => return Err(fidl::Error::NotNullable),
5021                Some(len) => len,
5022            };
5023            // Calling decoder.out_of_line_offset(0) is not allowed.
5024            if len == 0 {
5025                return Ok(());
5026            };
5027            depth.increment()?;
5028            let envelope_size = 8;
5029            let bytes_len = len * envelope_size;
5030            let offset = decoder.out_of_line_offset(bytes_len)?;
5031            // Decode the envelope for each type.
5032            let mut _next_ordinal_to_read = 0;
5033            let mut next_offset = offset;
5034            let end_offset = offset + bytes_len;
5035            _next_ordinal_to_read += 1;
5036            if next_offset >= end_offset {
5037                return Ok(());
5038            }
5039
5040            // Decode unknown envelopes for gaps in ordinals.
5041            while _next_ordinal_to_read < 2 {
5042                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5043                _next_ordinal_to_read += 1;
5044                next_offset += envelope_size;
5045            }
5046
5047            let next_out_of_line = decoder.next_out_of_line();
5048            let handles_before = decoder.remaining_handles();
5049            if let Some((inlined, num_bytes, num_handles)) =
5050                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5051            {
5052                let member_inline_size =
5053                    <MouseDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5054                if inlined != (member_inline_size <= 4) {
5055                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5056                }
5057                let inner_offset;
5058                let mut inner_depth = depth.clone();
5059                if inlined {
5060                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5061                    inner_offset = next_offset;
5062                } else {
5063                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5064                    inner_depth.increment()?;
5065                }
5066                let val_ref =
5067                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseDescriptor, D));
5068                fidl::decode!(MouseDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5069                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5070                {
5071                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5072                }
5073                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5074                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5075                }
5076            }
5077
5078            next_offset += envelope_size;
5079            _next_ordinal_to_read += 1;
5080            if next_offset >= end_offset {
5081                return Ok(());
5082            }
5083
5084            // Decode unknown envelopes for gaps in ordinals.
5085            while _next_ordinal_to_read < 3 {
5086                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5087                _next_ordinal_to_read += 1;
5088                next_offset += envelope_size;
5089            }
5090
5091            let next_out_of_line = decoder.next_out_of_line();
5092            let handles_before = decoder.remaining_handles();
5093            if let Some((inlined, num_bytes, num_handles)) =
5094                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5095            {
5096                let member_inline_size =
5097                    <SensorDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5098                if inlined != (member_inline_size <= 4) {
5099                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5100                }
5101                let inner_offset;
5102                let mut inner_depth = depth.clone();
5103                if inlined {
5104                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5105                    inner_offset = next_offset;
5106                } else {
5107                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5108                    inner_depth.increment()?;
5109                }
5110                let val_ref =
5111                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorDescriptor, D));
5112                fidl::decode!(SensorDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5113                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5114                {
5115                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5116                }
5117                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5118                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5119                }
5120            }
5121
5122            next_offset += envelope_size;
5123            _next_ordinal_to_read += 1;
5124            if next_offset >= end_offset {
5125                return Ok(());
5126            }
5127
5128            // Decode unknown envelopes for gaps in ordinals.
5129            while _next_ordinal_to_read < 4 {
5130                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5131                _next_ordinal_to_read += 1;
5132                next_offset += envelope_size;
5133            }
5134
5135            let next_out_of_line = decoder.next_out_of_line();
5136            let handles_before = decoder.remaining_handles();
5137            if let Some((inlined, num_bytes, num_handles)) =
5138                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5139            {
5140                let member_inline_size =
5141                    <TouchDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5142                if inlined != (member_inline_size <= 4) {
5143                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5144                }
5145                let inner_offset;
5146                let mut inner_depth = depth.clone();
5147                if inlined {
5148                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5149                    inner_offset = next_offset;
5150                } else {
5151                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5152                    inner_depth.increment()?;
5153                }
5154                let val_ref =
5155                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchDescriptor, D));
5156                fidl::decode!(TouchDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5157                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5158                {
5159                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5160                }
5161                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5162                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5163                }
5164            }
5165
5166            next_offset += envelope_size;
5167            _next_ordinal_to_read += 1;
5168            if next_offset >= end_offset {
5169                return Ok(());
5170            }
5171
5172            // Decode unknown envelopes for gaps in ordinals.
5173            while _next_ordinal_to_read < 5 {
5174                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5175                _next_ordinal_to_read += 1;
5176                next_offset += envelope_size;
5177            }
5178
5179            let next_out_of_line = decoder.next_out_of_line();
5180            let handles_before = decoder.remaining_handles();
5181            if let Some((inlined, num_bytes, num_handles)) =
5182                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5183            {
5184                let member_inline_size =
5185                    <KeyboardDescriptor as fidl::encoding::TypeMarker>::inline_size(
5186                        decoder.context,
5187                    );
5188                if inlined != (member_inline_size <= 4) {
5189                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5190                }
5191                let inner_offset;
5192                let mut inner_depth = depth.clone();
5193                if inlined {
5194                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5195                    inner_offset = next_offset;
5196                } else {
5197                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5198                    inner_depth.increment()?;
5199                }
5200                let val_ref =
5201                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardDescriptor, D));
5202                fidl::decode!(KeyboardDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5204                {
5205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5206                }
5207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5209                }
5210            }
5211
5212            next_offset += envelope_size;
5213            _next_ordinal_to_read += 1;
5214            if next_offset >= end_offset {
5215                return Ok(());
5216            }
5217
5218            // Decode unknown envelopes for gaps in ordinals.
5219            while _next_ordinal_to_read < 6 {
5220                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5221                _next_ordinal_to_read += 1;
5222                next_offset += envelope_size;
5223            }
5224
5225            let next_out_of_line = decoder.next_out_of_line();
5226            let handles_before = decoder.remaining_handles();
5227            if let Some((inlined, num_bytes, num_handles)) =
5228                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5229            {
5230                let member_inline_size =
5231                    <ConsumerControlDescriptor as fidl::encoding::TypeMarker>::inline_size(
5232                        decoder.context,
5233                    );
5234                if inlined != (member_inline_size <= 4) {
5235                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5236                }
5237                let inner_offset;
5238                let mut inner_depth = depth.clone();
5239                if inlined {
5240                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5241                    inner_offset = next_offset;
5242                } else {
5243                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5244                    inner_depth.increment()?;
5245                }
5246                let val_ref = self
5247                    .consumer_control
5248                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlDescriptor, D));
5249                fidl::decode!(
5250                    ConsumerControlDescriptor,
5251                    D,
5252                    val_ref,
5253                    decoder,
5254                    inner_offset,
5255                    inner_depth
5256                )?;
5257                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5258                {
5259                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5260                }
5261                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5262                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5263                }
5264            }
5265
5266            next_offset += envelope_size;
5267            _next_ordinal_to_read += 1;
5268            if next_offset >= end_offset {
5269                return Ok(());
5270            }
5271
5272            // Decode unknown envelopes for gaps in ordinals.
5273            while _next_ordinal_to_read < 7 {
5274                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5275                _next_ordinal_to_read += 1;
5276                next_offset += envelope_size;
5277            }
5278
5279            let next_out_of_line = decoder.next_out_of_line();
5280            let handles_before = decoder.remaining_handles();
5281            if let Some((inlined, num_bytes, num_handles)) =
5282                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5283            {
5284                let member_inline_size =
5285                    <DeviceInformation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5286                if inlined != (member_inline_size <= 4) {
5287                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5288                }
5289                let inner_offset;
5290                let mut inner_depth = depth.clone();
5291                if inlined {
5292                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5293                    inner_offset = next_offset;
5294                } else {
5295                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5296                    inner_depth.increment()?;
5297                }
5298                let val_ref = self
5299                    .device_information
5300                    .get_or_insert_with(|| fidl::new_empty!(DeviceInformation, D));
5301                fidl::decode!(DeviceInformation, D, val_ref, decoder, inner_offset, inner_depth)?;
5302                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5303                {
5304                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5305                }
5306                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5307                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5308                }
5309            }
5310
5311            next_offset += envelope_size;
5312
5313            // Decode the remaining unknown envelopes.
5314            while next_offset < end_offset {
5315                _next_ordinal_to_read += 1;
5316                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5317                next_offset += envelope_size;
5318            }
5319
5320            Ok(())
5321        }
5322    }
5323
5324    impl DeviceInformation {
5325        #[inline(always)]
5326        fn max_ordinal_present(&self) -> u64 {
5327            if let Some(_) = self.polling_rate {
5328                return 4;
5329            }
5330            if let Some(_) = self.version {
5331                return 3;
5332            }
5333            if let Some(_) = self.product_id {
5334                return 2;
5335            }
5336            if let Some(_) = self.vendor_id {
5337                return 1;
5338            }
5339            0
5340        }
5341    }
5342
5343    impl fidl::encoding::ValueTypeMarker for DeviceInformation {
5344        type Borrowed<'a> = &'a Self;
5345        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5346            value
5347        }
5348    }
5349
5350    unsafe impl fidl::encoding::TypeMarker for DeviceInformation {
5351        type Owned = Self;
5352
5353        #[inline(always)]
5354        fn inline_align(_context: fidl::encoding::Context) -> usize {
5355            8
5356        }
5357
5358        #[inline(always)]
5359        fn inline_size(_context: fidl::encoding::Context) -> usize {
5360            16
5361        }
5362    }
5363
5364    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInformation, D>
5365        for &DeviceInformation
5366    {
5367        unsafe fn encode(
5368            self,
5369            encoder: &mut fidl::encoding::Encoder<'_, D>,
5370            offset: usize,
5371            mut depth: fidl::encoding::Depth,
5372        ) -> fidl::Result<()> {
5373            encoder.debug_check_bounds::<DeviceInformation>(offset);
5374            // Vector header
5375            let max_ordinal: u64 = self.max_ordinal_present();
5376            encoder.write_num(max_ordinal, offset);
5377            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5378            // Calling encoder.out_of_line_offset(0) is not allowed.
5379            if max_ordinal == 0 {
5380                return Ok(());
5381            }
5382            depth.increment()?;
5383            let envelope_size = 8;
5384            let bytes_len = max_ordinal as usize * envelope_size;
5385            #[allow(unused_variables)]
5386            let offset = encoder.out_of_line_offset(bytes_len);
5387            let mut _prev_end_offset: usize = 0;
5388            if 1 > max_ordinal {
5389                return Ok(());
5390            }
5391
5392            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5393            // are envelope_size bytes.
5394            let cur_offset: usize = (1 - 1) * envelope_size;
5395
5396            // Zero reserved fields.
5397            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5398
5399            // Safety:
5400            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5401            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5402            //   envelope_size bytes, there is always sufficient room.
5403            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5404                self.vendor_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5405                encoder,
5406                offset + cur_offset,
5407                depth,
5408            )?;
5409
5410            _prev_end_offset = cur_offset + envelope_size;
5411            if 2 > max_ordinal {
5412                return Ok(());
5413            }
5414
5415            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5416            // are envelope_size bytes.
5417            let cur_offset: usize = (2 - 1) * envelope_size;
5418
5419            // Zero reserved fields.
5420            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5421
5422            // Safety:
5423            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5424            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5425            //   envelope_size bytes, there is always sufficient room.
5426            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5427                self.product_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5428                encoder,
5429                offset + cur_offset,
5430                depth,
5431            )?;
5432
5433            _prev_end_offset = cur_offset + envelope_size;
5434            if 3 > max_ordinal {
5435                return Ok(());
5436            }
5437
5438            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5439            // are envelope_size bytes.
5440            let cur_offset: usize = (3 - 1) * envelope_size;
5441
5442            // Zero reserved fields.
5443            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5444
5445            // Safety:
5446            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5447            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5448            //   envelope_size bytes, there is always sufficient room.
5449            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5450                self.version.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5451                encoder,
5452                offset + cur_offset,
5453                depth,
5454            )?;
5455
5456            _prev_end_offset = cur_offset + envelope_size;
5457            if 4 > max_ordinal {
5458                return Ok(());
5459            }
5460
5461            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5462            // are envelope_size bytes.
5463            let cur_offset: usize = (4 - 1) * envelope_size;
5464
5465            // Zero reserved fields.
5466            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5467
5468            // Safety:
5469            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5470            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5471            //   envelope_size bytes, there is always sufficient room.
5472            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5473                self.polling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5474                encoder,
5475                offset + cur_offset,
5476                depth,
5477            )?;
5478
5479            _prev_end_offset = cur_offset + envelope_size;
5480
5481            Ok(())
5482        }
5483    }
5484
5485    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInformation {
5486        #[inline(always)]
5487        fn new_empty() -> Self {
5488            Self::default()
5489        }
5490
5491        unsafe fn decode(
5492            &mut self,
5493            decoder: &mut fidl::encoding::Decoder<'_, D>,
5494            offset: usize,
5495            mut depth: fidl::encoding::Depth,
5496        ) -> fidl::Result<()> {
5497            decoder.debug_check_bounds::<Self>(offset);
5498            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5499                None => return Err(fidl::Error::NotNullable),
5500                Some(len) => len,
5501            };
5502            // Calling decoder.out_of_line_offset(0) is not allowed.
5503            if len == 0 {
5504                return Ok(());
5505            };
5506            depth.increment()?;
5507            let envelope_size = 8;
5508            let bytes_len = len * envelope_size;
5509            let offset = decoder.out_of_line_offset(bytes_len)?;
5510            // Decode the envelope for each type.
5511            let mut _next_ordinal_to_read = 0;
5512            let mut next_offset = offset;
5513            let end_offset = offset + bytes_len;
5514            _next_ordinal_to_read += 1;
5515            if next_offset >= end_offset {
5516                return Ok(());
5517            }
5518
5519            // Decode unknown envelopes for gaps in ordinals.
5520            while _next_ordinal_to_read < 1 {
5521                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5522                _next_ordinal_to_read += 1;
5523                next_offset += envelope_size;
5524            }
5525
5526            let next_out_of_line = decoder.next_out_of_line();
5527            let handles_before = decoder.remaining_handles();
5528            if let Some((inlined, num_bytes, num_handles)) =
5529                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5530            {
5531                let member_inline_size =
5532                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5533                if inlined != (member_inline_size <= 4) {
5534                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5535                }
5536                let inner_offset;
5537                let mut inner_depth = depth.clone();
5538                if inlined {
5539                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5540                    inner_offset = next_offset;
5541                } else {
5542                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5543                    inner_depth.increment()?;
5544                }
5545                let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5546                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5547                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5548                {
5549                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5550                }
5551                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5552                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5553                }
5554            }
5555
5556            next_offset += envelope_size;
5557            _next_ordinal_to_read += 1;
5558            if next_offset >= end_offset {
5559                return Ok(());
5560            }
5561
5562            // Decode unknown envelopes for gaps in ordinals.
5563            while _next_ordinal_to_read < 2 {
5564                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5565                _next_ordinal_to_read += 1;
5566                next_offset += envelope_size;
5567            }
5568
5569            let next_out_of_line = decoder.next_out_of_line();
5570            let handles_before = decoder.remaining_handles();
5571            if let Some((inlined, num_bytes, num_handles)) =
5572                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5573            {
5574                let member_inline_size =
5575                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5576                if inlined != (member_inline_size <= 4) {
5577                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5578                }
5579                let inner_offset;
5580                let mut inner_depth = depth.clone();
5581                if inlined {
5582                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5583                    inner_offset = next_offset;
5584                } else {
5585                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5586                    inner_depth.increment()?;
5587                }
5588                let val_ref = self.product_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5589                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5590                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5591                {
5592                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5593                }
5594                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5595                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5596                }
5597            }
5598
5599            next_offset += envelope_size;
5600            _next_ordinal_to_read += 1;
5601            if next_offset >= end_offset {
5602                return Ok(());
5603            }
5604
5605            // Decode unknown envelopes for gaps in ordinals.
5606            while _next_ordinal_to_read < 3 {
5607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5608                _next_ordinal_to_read += 1;
5609                next_offset += envelope_size;
5610            }
5611
5612            let next_out_of_line = decoder.next_out_of_line();
5613            let handles_before = decoder.remaining_handles();
5614            if let Some((inlined, num_bytes, num_handles)) =
5615                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5616            {
5617                let member_inline_size =
5618                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5619                if inlined != (member_inline_size <= 4) {
5620                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5621                }
5622                let inner_offset;
5623                let mut inner_depth = depth.clone();
5624                if inlined {
5625                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5626                    inner_offset = next_offset;
5627                } else {
5628                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5629                    inner_depth.increment()?;
5630                }
5631                let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(u32, D));
5632                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5633                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5634                {
5635                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5636                }
5637                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5638                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5639                }
5640            }
5641
5642            next_offset += envelope_size;
5643            _next_ordinal_to_read += 1;
5644            if next_offset >= end_offset {
5645                return Ok(());
5646            }
5647
5648            // Decode unknown envelopes for gaps in ordinals.
5649            while _next_ordinal_to_read < 4 {
5650                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5651                _next_ordinal_to_read += 1;
5652                next_offset += envelope_size;
5653            }
5654
5655            let next_out_of_line = decoder.next_out_of_line();
5656            let handles_before = decoder.remaining_handles();
5657            if let Some((inlined, num_bytes, num_handles)) =
5658                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5659            {
5660                let member_inline_size =
5661                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5662                if inlined != (member_inline_size <= 4) {
5663                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5664                }
5665                let inner_offset;
5666                let mut inner_depth = depth.clone();
5667                if inlined {
5668                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5669                    inner_offset = next_offset;
5670                } else {
5671                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5672                    inner_depth.increment()?;
5673                }
5674                let val_ref = self.polling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
5675                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5676                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5677                {
5678                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5679                }
5680                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5681                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5682                }
5683            }
5684
5685            next_offset += envelope_size;
5686
5687            // Decode the remaining unknown envelopes.
5688            while next_offset < end_offset {
5689                _next_ordinal_to_read += 1;
5690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5691                next_offset += envelope_size;
5692            }
5693
5694            Ok(())
5695        }
5696    }
5697
5698    impl FeatureReport {
5699        #[inline(always)]
5700        fn max_ordinal_present(&self) -> u64 {
5701            if let Some(_) = self.touch {
5702                return 2;
5703            }
5704            if let Some(_) = self.sensor {
5705                return 1;
5706            }
5707            0
5708        }
5709    }
5710
5711    impl fidl::encoding::ValueTypeMarker for FeatureReport {
5712        type Borrowed<'a> = &'a Self;
5713        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5714            value
5715        }
5716    }
5717
5718    unsafe impl fidl::encoding::TypeMarker for FeatureReport {
5719        type Owned = Self;
5720
5721        #[inline(always)]
5722        fn inline_align(_context: fidl::encoding::Context) -> usize {
5723            8
5724        }
5725
5726        #[inline(always)]
5727        fn inline_size(_context: fidl::encoding::Context) -> usize {
5728            16
5729        }
5730    }
5731
5732    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FeatureReport, D>
5733        for &FeatureReport
5734    {
5735        unsafe fn encode(
5736            self,
5737            encoder: &mut fidl::encoding::Encoder<'_, D>,
5738            offset: usize,
5739            mut depth: fidl::encoding::Depth,
5740        ) -> fidl::Result<()> {
5741            encoder.debug_check_bounds::<FeatureReport>(offset);
5742            // Vector header
5743            let max_ordinal: u64 = self.max_ordinal_present();
5744            encoder.write_num(max_ordinal, offset);
5745            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5746            // Calling encoder.out_of_line_offset(0) is not allowed.
5747            if max_ordinal == 0 {
5748                return Ok(());
5749            }
5750            depth.increment()?;
5751            let envelope_size = 8;
5752            let bytes_len = max_ordinal as usize * envelope_size;
5753            #[allow(unused_variables)]
5754            let offset = encoder.out_of_line_offset(bytes_len);
5755            let mut _prev_end_offset: usize = 0;
5756            if 1 > max_ordinal {
5757                return Ok(());
5758            }
5759
5760            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5761            // are envelope_size bytes.
5762            let cur_offset: usize = (1 - 1) * envelope_size;
5763
5764            // Zero reserved fields.
5765            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5766
5767            // Safety:
5768            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5769            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5770            //   envelope_size bytes, there is always sufficient room.
5771            fidl::encoding::encode_in_envelope_optional::<SensorFeatureReport, D>(
5772                self.sensor
5773                    .as_ref()
5774                    .map(<SensorFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5775                encoder,
5776                offset + cur_offset,
5777                depth,
5778            )?;
5779
5780            _prev_end_offset = cur_offset + envelope_size;
5781            if 2 > max_ordinal {
5782                return Ok(());
5783            }
5784
5785            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5786            // are envelope_size bytes.
5787            let cur_offset: usize = (2 - 1) * envelope_size;
5788
5789            // Zero reserved fields.
5790            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5791
5792            // Safety:
5793            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5794            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5795            //   envelope_size bytes, there is always sufficient room.
5796            fidl::encoding::encode_in_envelope_optional::<TouchFeatureReport, D>(
5797                self.touch
5798                    .as_ref()
5799                    .map(<TouchFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5800                encoder,
5801                offset + cur_offset,
5802                depth,
5803            )?;
5804
5805            _prev_end_offset = cur_offset + envelope_size;
5806
5807            Ok(())
5808        }
5809    }
5810
5811    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FeatureReport {
5812        #[inline(always)]
5813        fn new_empty() -> Self {
5814            Self::default()
5815        }
5816
5817        unsafe fn decode(
5818            &mut self,
5819            decoder: &mut fidl::encoding::Decoder<'_, D>,
5820            offset: usize,
5821            mut depth: fidl::encoding::Depth,
5822        ) -> fidl::Result<()> {
5823            decoder.debug_check_bounds::<Self>(offset);
5824            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5825                None => return Err(fidl::Error::NotNullable),
5826                Some(len) => len,
5827            };
5828            // Calling decoder.out_of_line_offset(0) is not allowed.
5829            if len == 0 {
5830                return Ok(());
5831            };
5832            depth.increment()?;
5833            let envelope_size = 8;
5834            let bytes_len = len * envelope_size;
5835            let offset = decoder.out_of_line_offset(bytes_len)?;
5836            // Decode the envelope for each type.
5837            let mut _next_ordinal_to_read = 0;
5838            let mut next_offset = offset;
5839            let end_offset = offset + bytes_len;
5840            _next_ordinal_to_read += 1;
5841            if next_offset >= end_offset {
5842                return Ok(());
5843            }
5844
5845            // Decode unknown envelopes for gaps in ordinals.
5846            while _next_ordinal_to_read < 1 {
5847                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5848                _next_ordinal_to_read += 1;
5849                next_offset += envelope_size;
5850            }
5851
5852            let next_out_of_line = decoder.next_out_of_line();
5853            let handles_before = decoder.remaining_handles();
5854            if let Some((inlined, num_bytes, num_handles)) =
5855                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5856            {
5857                let member_inline_size =
5858                    <SensorFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5859                        decoder.context,
5860                    );
5861                if inlined != (member_inline_size <= 4) {
5862                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5863                }
5864                let inner_offset;
5865                let mut inner_depth = depth.clone();
5866                if inlined {
5867                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5868                    inner_offset = next_offset;
5869                } else {
5870                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5871                    inner_depth.increment()?;
5872                }
5873                let val_ref =
5874                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorFeatureReport, D));
5875                fidl::decode!(SensorFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5876                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5877                {
5878                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5879                }
5880                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5881                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5882                }
5883            }
5884
5885            next_offset += envelope_size;
5886            _next_ordinal_to_read += 1;
5887            if next_offset >= end_offset {
5888                return Ok(());
5889            }
5890
5891            // Decode unknown envelopes for gaps in ordinals.
5892            while _next_ordinal_to_read < 2 {
5893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5894                _next_ordinal_to_read += 1;
5895                next_offset += envelope_size;
5896            }
5897
5898            let next_out_of_line = decoder.next_out_of_line();
5899            let handles_before = decoder.remaining_handles();
5900            if let Some((inlined, num_bytes, num_handles)) =
5901                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5902            {
5903                let member_inline_size =
5904                    <TouchFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5905                        decoder.context,
5906                    );
5907                if inlined != (member_inline_size <= 4) {
5908                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5909                }
5910                let inner_offset;
5911                let mut inner_depth = depth.clone();
5912                if inlined {
5913                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5914                    inner_offset = next_offset;
5915                } else {
5916                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5917                    inner_depth.increment()?;
5918                }
5919                let val_ref =
5920                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchFeatureReport, D));
5921                fidl::decode!(TouchFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5922                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5923                {
5924                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5925                }
5926                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5927                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5928                }
5929            }
5930
5931            next_offset += envelope_size;
5932
5933            // Decode the remaining unknown envelopes.
5934            while next_offset < end_offset {
5935                _next_ordinal_to_read += 1;
5936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5937                next_offset += envelope_size;
5938            }
5939
5940            Ok(())
5941        }
5942    }
5943
5944    impl InputReport {
5945        #[inline(always)]
5946        fn max_ordinal_present(&self) -> u64 {
5947            if let Some(_) = self.report_id {
5948                return 8;
5949            }
5950            if let Some(_) = self.consumer_control {
5951                return 7;
5952            }
5953            if let Some(_) = self.keyboard {
5954                return 6;
5955            }
5956            if let Some(_) = self.touch {
5957                return 5;
5958            }
5959            if let Some(_) = self.sensor {
5960                return 4;
5961            }
5962            if let Some(_) = self.trace_id {
5963                return 3;
5964            }
5965            if let Some(_) = self.mouse {
5966                return 2;
5967            }
5968            if let Some(_) = self.event_time {
5969                return 1;
5970            }
5971            0
5972        }
5973    }
5974
5975    impl fidl::encoding::ValueTypeMarker for InputReport {
5976        type Borrowed<'a> = &'a Self;
5977        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5978            value
5979        }
5980    }
5981
5982    unsafe impl fidl::encoding::TypeMarker for InputReport {
5983        type Owned = Self;
5984
5985        #[inline(always)]
5986        fn inline_align(_context: fidl::encoding::Context) -> usize {
5987            8
5988        }
5989
5990        #[inline(always)]
5991        fn inline_size(_context: fidl::encoding::Context) -> usize {
5992            16
5993        }
5994    }
5995
5996    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
5997        for &InputReport
5998    {
5999        unsafe fn encode(
6000            self,
6001            encoder: &mut fidl::encoding::Encoder<'_, D>,
6002            offset: usize,
6003            mut depth: fidl::encoding::Depth,
6004        ) -> fidl::Result<()> {
6005            encoder.debug_check_bounds::<InputReport>(offset);
6006            // Vector header
6007            let max_ordinal: u64 = self.max_ordinal_present();
6008            encoder.write_num(max_ordinal, offset);
6009            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6010            // Calling encoder.out_of_line_offset(0) is not allowed.
6011            if max_ordinal == 0 {
6012                return Ok(());
6013            }
6014            depth.increment()?;
6015            let envelope_size = 8;
6016            let bytes_len = max_ordinal as usize * envelope_size;
6017            #[allow(unused_variables)]
6018            let offset = encoder.out_of_line_offset(bytes_len);
6019            let mut _prev_end_offset: usize = 0;
6020            if 1 > max_ordinal {
6021                return Ok(());
6022            }
6023
6024            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6025            // are envelope_size bytes.
6026            let cur_offset: usize = (1 - 1) * envelope_size;
6027
6028            // Zero reserved fields.
6029            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6030
6031            // Safety:
6032            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6033            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6034            //   envelope_size bytes, there is always sufficient room.
6035            fidl::encoding::encode_in_envelope_optional::<i64, D>(
6036                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6037                encoder,
6038                offset + cur_offset,
6039                depth,
6040            )?;
6041
6042            _prev_end_offset = cur_offset + envelope_size;
6043            if 2 > max_ordinal {
6044                return Ok(());
6045            }
6046
6047            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6048            // are envelope_size bytes.
6049            let cur_offset: usize = (2 - 1) * envelope_size;
6050
6051            // Zero reserved fields.
6052            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6053
6054            // Safety:
6055            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6056            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6057            //   envelope_size bytes, there is always sufficient room.
6058            fidl::encoding::encode_in_envelope_optional::<MouseInputReport, D>(
6059                self.mouse
6060                    .as_ref()
6061                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6062                encoder,
6063                offset + cur_offset,
6064                depth,
6065            )?;
6066
6067            _prev_end_offset = cur_offset + envelope_size;
6068            if 3 > max_ordinal {
6069                return Ok(());
6070            }
6071
6072            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6073            // are envelope_size bytes.
6074            let cur_offset: usize = (3 - 1) * envelope_size;
6075
6076            // Zero reserved fields.
6077            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6078
6079            // Safety:
6080            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6081            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6082            //   envelope_size bytes, there is always sufficient room.
6083            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6084                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6085                encoder,
6086                offset + cur_offset,
6087                depth,
6088            )?;
6089
6090            _prev_end_offset = cur_offset + envelope_size;
6091            if 4 > max_ordinal {
6092                return Ok(());
6093            }
6094
6095            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6096            // are envelope_size bytes.
6097            let cur_offset: usize = (4 - 1) * envelope_size;
6098
6099            // Zero reserved fields.
6100            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6101
6102            // Safety:
6103            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6104            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6105            //   envelope_size bytes, there is always sufficient room.
6106            fidl::encoding::encode_in_envelope_optional::<SensorInputReport, D>(
6107                self.sensor
6108                    .as_ref()
6109                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6110                encoder,
6111                offset + cur_offset,
6112                depth,
6113            )?;
6114
6115            _prev_end_offset = cur_offset + envelope_size;
6116            if 5 > max_ordinal {
6117                return Ok(());
6118            }
6119
6120            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6121            // are envelope_size bytes.
6122            let cur_offset: usize = (5 - 1) * envelope_size;
6123
6124            // Zero reserved fields.
6125            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6126
6127            // Safety:
6128            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6129            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6130            //   envelope_size bytes, there is always sufficient room.
6131            fidl::encoding::encode_in_envelope_optional::<TouchInputReport, D>(
6132                self.touch
6133                    .as_ref()
6134                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6135                encoder,
6136                offset + cur_offset,
6137                depth,
6138            )?;
6139
6140            _prev_end_offset = cur_offset + envelope_size;
6141            if 6 > max_ordinal {
6142                return Ok(());
6143            }
6144
6145            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6146            // are envelope_size bytes.
6147            let cur_offset: usize = (6 - 1) * envelope_size;
6148
6149            // Zero reserved fields.
6150            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6151
6152            // Safety:
6153            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6154            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6155            //   envelope_size bytes, there is always sufficient room.
6156            fidl::encoding::encode_in_envelope_optional::<KeyboardInputReport, D>(
6157                self.keyboard
6158                    .as_ref()
6159                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6160                encoder,
6161                offset + cur_offset,
6162                depth,
6163            )?;
6164
6165            _prev_end_offset = cur_offset + envelope_size;
6166            if 7 > max_ordinal {
6167                return Ok(());
6168            }
6169
6170            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6171            // are envelope_size bytes.
6172            let cur_offset: usize = (7 - 1) * envelope_size;
6173
6174            // Zero reserved fields.
6175            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6176
6177            // Safety:
6178            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6179            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6180            //   envelope_size bytes, there is always sufficient room.
6181            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputReport, D>(
6182                self.consumer_control
6183                    .as_ref()
6184                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6185                encoder,
6186                offset + cur_offset,
6187                depth,
6188            )?;
6189
6190            _prev_end_offset = cur_offset + envelope_size;
6191            if 8 > max_ordinal {
6192                return Ok(());
6193            }
6194
6195            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6196            // are envelope_size bytes.
6197            let cur_offset: usize = (8 - 1) * envelope_size;
6198
6199            // Zero reserved fields.
6200            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6201
6202            // Safety:
6203            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6204            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6205            //   envelope_size bytes, there is always sufficient room.
6206            fidl::encoding::encode_in_envelope_optional::<u8, D>(
6207                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
6208                encoder,
6209                offset + cur_offset,
6210                depth,
6211            )?;
6212
6213            _prev_end_offset = cur_offset + envelope_size;
6214
6215            Ok(())
6216        }
6217    }
6218
6219    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
6220        #[inline(always)]
6221        fn new_empty() -> Self {
6222            Self::default()
6223        }
6224
6225        unsafe fn decode(
6226            &mut self,
6227            decoder: &mut fidl::encoding::Decoder<'_, D>,
6228            offset: usize,
6229            mut depth: fidl::encoding::Depth,
6230        ) -> fidl::Result<()> {
6231            decoder.debug_check_bounds::<Self>(offset);
6232            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6233                None => return Err(fidl::Error::NotNullable),
6234                Some(len) => len,
6235            };
6236            // Calling decoder.out_of_line_offset(0) is not allowed.
6237            if len == 0 {
6238                return Ok(());
6239            };
6240            depth.increment()?;
6241            let envelope_size = 8;
6242            let bytes_len = len * envelope_size;
6243            let offset = decoder.out_of_line_offset(bytes_len)?;
6244            // Decode the envelope for each type.
6245            let mut _next_ordinal_to_read = 0;
6246            let mut next_offset = offset;
6247            let end_offset = offset + bytes_len;
6248            _next_ordinal_to_read += 1;
6249            if next_offset >= end_offset {
6250                return Ok(());
6251            }
6252
6253            // Decode unknown envelopes for gaps in ordinals.
6254            while _next_ordinal_to_read < 1 {
6255                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6256                _next_ordinal_to_read += 1;
6257                next_offset += envelope_size;
6258            }
6259
6260            let next_out_of_line = decoder.next_out_of_line();
6261            let handles_before = decoder.remaining_handles();
6262            if let Some((inlined, num_bytes, num_handles)) =
6263                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6264            {
6265                let member_inline_size =
6266                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6267                if inlined != (member_inline_size <= 4) {
6268                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6269                }
6270                let inner_offset;
6271                let mut inner_depth = depth.clone();
6272                if inlined {
6273                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6274                    inner_offset = next_offset;
6275                } else {
6276                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6277                    inner_depth.increment()?;
6278                }
6279                let val_ref = self.event_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
6280                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6281                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6282                {
6283                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6284                }
6285                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6286                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6287                }
6288            }
6289
6290            next_offset += envelope_size;
6291            _next_ordinal_to_read += 1;
6292            if next_offset >= end_offset {
6293                return Ok(());
6294            }
6295
6296            // Decode unknown envelopes for gaps in ordinals.
6297            while _next_ordinal_to_read < 2 {
6298                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6299                _next_ordinal_to_read += 1;
6300                next_offset += envelope_size;
6301            }
6302
6303            let next_out_of_line = decoder.next_out_of_line();
6304            let handles_before = decoder.remaining_handles();
6305            if let Some((inlined, num_bytes, num_handles)) =
6306                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6307            {
6308                let member_inline_size =
6309                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6310                if inlined != (member_inline_size <= 4) {
6311                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6312                }
6313                let inner_offset;
6314                let mut inner_depth = depth.clone();
6315                if inlined {
6316                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6317                    inner_offset = next_offset;
6318                } else {
6319                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6320                    inner_depth.increment()?;
6321                }
6322                let val_ref =
6323                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseInputReport, D));
6324                fidl::decode!(MouseInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6325                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6326                {
6327                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6328                }
6329                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6330                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6331                }
6332            }
6333
6334            next_offset += envelope_size;
6335            _next_ordinal_to_read += 1;
6336            if next_offset >= end_offset {
6337                return Ok(());
6338            }
6339
6340            // Decode unknown envelopes for gaps in ordinals.
6341            while _next_ordinal_to_read < 3 {
6342                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6343                _next_ordinal_to_read += 1;
6344                next_offset += envelope_size;
6345            }
6346
6347            let next_out_of_line = decoder.next_out_of_line();
6348            let handles_before = decoder.remaining_handles();
6349            if let Some((inlined, num_bytes, num_handles)) =
6350                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6351            {
6352                let member_inline_size =
6353                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6354                if inlined != (member_inline_size <= 4) {
6355                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6356                }
6357                let inner_offset;
6358                let mut inner_depth = depth.clone();
6359                if inlined {
6360                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6361                    inner_offset = next_offset;
6362                } else {
6363                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6364                    inner_depth.increment()?;
6365                }
6366                let val_ref = self.trace_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
6367                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6368                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6369                {
6370                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6371                }
6372                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6373                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6374                }
6375            }
6376
6377            next_offset += envelope_size;
6378            _next_ordinal_to_read += 1;
6379            if next_offset >= end_offset {
6380                return Ok(());
6381            }
6382
6383            // Decode unknown envelopes for gaps in ordinals.
6384            while _next_ordinal_to_read < 4 {
6385                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6386                _next_ordinal_to_read += 1;
6387                next_offset += envelope_size;
6388            }
6389
6390            let next_out_of_line = decoder.next_out_of_line();
6391            let handles_before = decoder.remaining_handles();
6392            if let Some((inlined, num_bytes, num_handles)) =
6393                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6394            {
6395                let member_inline_size =
6396                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6397                if inlined != (member_inline_size <= 4) {
6398                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6399                }
6400                let inner_offset;
6401                let mut inner_depth = depth.clone();
6402                if inlined {
6403                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6404                    inner_offset = next_offset;
6405                } else {
6406                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6407                    inner_depth.increment()?;
6408                }
6409                let val_ref =
6410                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorInputReport, D));
6411                fidl::decode!(SensorInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6412                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6413                {
6414                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6415                }
6416                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6417                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6418                }
6419            }
6420
6421            next_offset += envelope_size;
6422            _next_ordinal_to_read += 1;
6423            if next_offset >= end_offset {
6424                return Ok(());
6425            }
6426
6427            // Decode unknown envelopes for gaps in ordinals.
6428            while _next_ordinal_to_read < 5 {
6429                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6430                _next_ordinal_to_read += 1;
6431                next_offset += envelope_size;
6432            }
6433
6434            let next_out_of_line = decoder.next_out_of_line();
6435            let handles_before = decoder.remaining_handles();
6436            if let Some((inlined, num_bytes, num_handles)) =
6437                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6438            {
6439                let member_inline_size =
6440                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6441                if inlined != (member_inline_size <= 4) {
6442                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6443                }
6444                let inner_offset;
6445                let mut inner_depth = depth.clone();
6446                if inlined {
6447                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6448                    inner_offset = next_offset;
6449                } else {
6450                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6451                    inner_depth.increment()?;
6452                }
6453                let val_ref =
6454                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchInputReport, D));
6455                fidl::decode!(TouchInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6457                {
6458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6459                }
6460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6462                }
6463            }
6464
6465            next_offset += envelope_size;
6466            _next_ordinal_to_read += 1;
6467            if next_offset >= end_offset {
6468                return Ok(());
6469            }
6470
6471            // Decode unknown envelopes for gaps in ordinals.
6472            while _next_ordinal_to_read < 6 {
6473                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6474                _next_ordinal_to_read += 1;
6475                next_offset += envelope_size;
6476            }
6477
6478            let next_out_of_line = decoder.next_out_of_line();
6479            let handles_before = decoder.remaining_handles();
6480            if let Some((inlined, num_bytes, num_handles)) =
6481                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6482            {
6483                let member_inline_size =
6484                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
6485                        decoder.context,
6486                    );
6487                if inlined != (member_inline_size <= 4) {
6488                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6489                }
6490                let inner_offset;
6491                let mut inner_depth = depth.clone();
6492                if inlined {
6493                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6494                    inner_offset = next_offset;
6495                } else {
6496                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6497                    inner_depth.increment()?;
6498                }
6499                let val_ref =
6500                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardInputReport, D));
6501                fidl::decode!(KeyboardInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6502                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6503                {
6504                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6505                }
6506                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6507                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6508                }
6509            }
6510
6511            next_offset += envelope_size;
6512            _next_ordinal_to_read += 1;
6513            if next_offset >= end_offset {
6514                return Ok(());
6515            }
6516
6517            // Decode unknown envelopes for gaps in ordinals.
6518            while _next_ordinal_to_read < 7 {
6519                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6520                _next_ordinal_to_read += 1;
6521                next_offset += envelope_size;
6522            }
6523
6524            let next_out_of_line = decoder.next_out_of_line();
6525            let handles_before = decoder.remaining_handles();
6526            if let Some((inlined, num_bytes, num_handles)) =
6527                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6528            {
6529                let member_inline_size =
6530                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
6531                        decoder.context,
6532                    );
6533                if inlined != (member_inline_size <= 4) {
6534                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6535                }
6536                let inner_offset;
6537                let mut inner_depth = depth.clone();
6538                if inlined {
6539                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6540                    inner_offset = next_offset;
6541                } else {
6542                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6543                    inner_depth.increment()?;
6544                }
6545                let val_ref = self
6546                    .consumer_control
6547                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputReport, D));
6548                fidl::decode!(
6549                    ConsumerControlInputReport,
6550                    D,
6551                    val_ref,
6552                    decoder,
6553                    inner_offset,
6554                    inner_depth
6555                )?;
6556                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6557                {
6558                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6559                }
6560                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6561                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6562                }
6563            }
6564
6565            next_offset += envelope_size;
6566            _next_ordinal_to_read += 1;
6567            if next_offset >= end_offset {
6568                return Ok(());
6569            }
6570
6571            // Decode unknown envelopes for gaps in ordinals.
6572            while _next_ordinal_to_read < 8 {
6573                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6574                _next_ordinal_to_read += 1;
6575                next_offset += envelope_size;
6576            }
6577
6578            let next_out_of_line = decoder.next_out_of_line();
6579            let handles_before = decoder.remaining_handles();
6580            if let Some((inlined, num_bytes, num_handles)) =
6581                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6582            {
6583                let member_inline_size =
6584                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6585                if inlined != (member_inline_size <= 4) {
6586                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6587                }
6588                let inner_offset;
6589                let mut inner_depth = depth.clone();
6590                if inlined {
6591                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6592                    inner_offset = next_offset;
6593                } else {
6594                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6595                    inner_depth.increment()?;
6596                }
6597                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
6598                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6599                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6600                {
6601                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6602                }
6603                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6604                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6605                }
6606            }
6607
6608            next_offset += envelope_size;
6609
6610            // Decode the remaining unknown envelopes.
6611            while next_offset < end_offset {
6612                _next_ordinal_to_read += 1;
6613                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6614                next_offset += envelope_size;
6615            }
6616
6617            Ok(())
6618        }
6619    }
6620
6621    impl KeyboardDescriptor {
6622        #[inline(always)]
6623        fn max_ordinal_present(&self) -> u64 {
6624            if let Some(_) = self.output {
6625                return 2;
6626            }
6627            if let Some(_) = self.input {
6628                return 1;
6629            }
6630            0
6631        }
6632    }
6633
6634    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
6635        type Borrowed<'a> = &'a Self;
6636        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6637            value
6638        }
6639    }
6640
6641    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
6642        type Owned = Self;
6643
6644        #[inline(always)]
6645        fn inline_align(_context: fidl::encoding::Context) -> usize {
6646            8
6647        }
6648
6649        #[inline(always)]
6650        fn inline_size(_context: fidl::encoding::Context) -> usize {
6651            16
6652        }
6653    }
6654
6655    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
6656        for &KeyboardDescriptor
6657    {
6658        unsafe fn encode(
6659            self,
6660            encoder: &mut fidl::encoding::Encoder<'_, D>,
6661            offset: usize,
6662            mut depth: fidl::encoding::Depth,
6663        ) -> fidl::Result<()> {
6664            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
6665            // Vector header
6666            let max_ordinal: u64 = self.max_ordinal_present();
6667            encoder.write_num(max_ordinal, offset);
6668            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6669            // Calling encoder.out_of_line_offset(0) is not allowed.
6670            if max_ordinal == 0 {
6671                return Ok(());
6672            }
6673            depth.increment()?;
6674            let envelope_size = 8;
6675            let bytes_len = max_ordinal as usize * envelope_size;
6676            #[allow(unused_variables)]
6677            let offset = encoder.out_of_line_offset(bytes_len);
6678            let mut _prev_end_offset: usize = 0;
6679            if 1 > max_ordinal {
6680                return Ok(());
6681            }
6682
6683            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6684            // are envelope_size bytes.
6685            let cur_offset: usize = (1 - 1) * envelope_size;
6686
6687            // Zero reserved fields.
6688            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6689
6690            // Safety:
6691            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6692            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6693            //   envelope_size bytes, there is always sufficient room.
6694            fidl::encoding::encode_in_envelope_optional::<KeyboardInputDescriptor, D>(
6695                self.input
6696                    .as_ref()
6697                    .map(<KeyboardInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6698                encoder,
6699                offset + cur_offset,
6700                depth,
6701            )?;
6702
6703            _prev_end_offset = cur_offset + envelope_size;
6704            if 2 > max_ordinal {
6705                return Ok(());
6706            }
6707
6708            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6709            // are envelope_size bytes.
6710            let cur_offset: usize = (2 - 1) * envelope_size;
6711
6712            // Zero reserved fields.
6713            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6714
6715            // Safety:
6716            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6717            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6718            //   envelope_size bytes, there is always sufficient room.
6719            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
6720                self.output
6721                    .as_ref()
6722                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6723                encoder,
6724                offset + cur_offset,
6725                depth,
6726            )?;
6727
6728            _prev_end_offset = cur_offset + envelope_size;
6729
6730            Ok(())
6731        }
6732    }
6733
6734    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
6735        #[inline(always)]
6736        fn new_empty() -> Self {
6737            Self::default()
6738        }
6739
6740        unsafe fn decode(
6741            &mut self,
6742            decoder: &mut fidl::encoding::Decoder<'_, D>,
6743            offset: usize,
6744            mut depth: fidl::encoding::Depth,
6745        ) -> fidl::Result<()> {
6746            decoder.debug_check_bounds::<Self>(offset);
6747            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6748                None => return Err(fidl::Error::NotNullable),
6749                Some(len) => len,
6750            };
6751            // Calling decoder.out_of_line_offset(0) is not allowed.
6752            if len == 0 {
6753                return Ok(());
6754            };
6755            depth.increment()?;
6756            let envelope_size = 8;
6757            let bytes_len = len * envelope_size;
6758            let offset = decoder.out_of_line_offset(bytes_len)?;
6759            // Decode the envelope for each type.
6760            let mut _next_ordinal_to_read = 0;
6761            let mut next_offset = offset;
6762            let end_offset = offset + bytes_len;
6763            _next_ordinal_to_read += 1;
6764            if next_offset >= end_offset {
6765                return Ok(());
6766            }
6767
6768            // Decode unknown envelopes for gaps in ordinals.
6769            while _next_ordinal_to_read < 1 {
6770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6771                _next_ordinal_to_read += 1;
6772                next_offset += envelope_size;
6773            }
6774
6775            let next_out_of_line = decoder.next_out_of_line();
6776            let handles_before = decoder.remaining_handles();
6777            if let Some((inlined, num_bytes, num_handles)) =
6778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6779            {
6780                let member_inline_size =
6781                    <KeyboardInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6782                        decoder.context,
6783                    );
6784                if inlined != (member_inline_size <= 4) {
6785                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6786                }
6787                let inner_offset;
6788                let mut inner_depth = depth.clone();
6789                if inlined {
6790                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6791                    inner_offset = next_offset;
6792                } else {
6793                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6794                    inner_depth.increment()?;
6795                }
6796                let val_ref =
6797                    self.input.get_or_insert_with(|| fidl::new_empty!(KeyboardInputDescriptor, D));
6798                fidl::decode!(
6799                    KeyboardInputDescriptor,
6800                    D,
6801                    val_ref,
6802                    decoder,
6803                    inner_offset,
6804                    inner_depth
6805                )?;
6806                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6807                {
6808                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6809                }
6810                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6811                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6812                }
6813            }
6814
6815            next_offset += envelope_size;
6816            _next_ordinal_to_read += 1;
6817            if next_offset >= end_offset {
6818                return Ok(());
6819            }
6820
6821            // Decode unknown envelopes for gaps in ordinals.
6822            while _next_ordinal_to_read < 2 {
6823                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6824                _next_ordinal_to_read += 1;
6825                next_offset += envelope_size;
6826            }
6827
6828            let next_out_of_line = decoder.next_out_of_line();
6829            let handles_before = decoder.remaining_handles();
6830            if let Some((inlined, num_bytes, num_handles)) =
6831                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6832            {
6833                let member_inline_size =
6834                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6835                        decoder.context,
6836                    );
6837                if inlined != (member_inline_size <= 4) {
6838                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6839                }
6840                let inner_offset;
6841                let mut inner_depth = depth.clone();
6842                if inlined {
6843                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6844                    inner_offset = next_offset;
6845                } else {
6846                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6847                    inner_depth.increment()?;
6848                }
6849                let val_ref = self
6850                    .output
6851                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
6852                fidl::decode!(
6853                    KeyboardOutputDescriptor,
6854                    D,
6855                    val_ref,
6856                    decoder,
6857                    inner_offset,
6858                    inner_depth
6859                )?;
6860                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6861                {
6862                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6863                }
6864                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6865                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6866                }
6867            }
6868
6869            next_offset += envelope_size;
6870
6871            // Decode the remaining unknown envelopes.
6872            while next_offset < end_offset {
6873                _next_ordinal_to_read += 1;
6874                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6875                next_offset += envelope_size;
6876            }
6877
6878            Ok(())
6879        }
6880    }
6881
6882    impl KeyboardInputDescriptor {
6883        #[inline(always)]
6884        fn max_ordinal_present(&self) -> u64 {
6885            if let Some(_) = self.keys3 {
6886                return 2;
6887            }
6888            0
6889        }
6890    }
6891
6892    impl fidl::encoding::ValueTypeMarker for KeyboardInputDescriptor {
6893        type Borrowed<'a> = &'a Self;
6894        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6895            value
6896        }
6897    }
6898
6899    unsafe impl fidl::encoding::TypeMarker for KeyboardInputDescriptor {
6900        type Owned = Self;
6901
6902        #[inline(always)]
6903        fn inline_align(_context: fidl::encoding::Context) -> usize {
6904            8
6905        }
6906
6907        #[inline(always)]
6908        fn inline_size(_context: fidl::encoding::Context) -> usize {
6909            16
6910        }
6911    }
6912
6913    unsafe impl<D: fidl::encoding::ResourceDialect>
6914        fidl::encoding::Encode<KeyboardInputDescriptor, D> for &KeyboardInputDescriptor
6915    {
6916        unsafe fn encode(
6917            self,
6918            encoder: &mut fidl::encoding::Encoder<'_, D>,
6919            offset: usize,
6920            mut depth: fidl::encoding::Depth,
6921        ) -> fidl::Result<()> {
6922            encoder.debug_check_bounds::<KeyboardInputDescriptor>(offset);
6923            // Vector header
6924            let max_ordinal: u64 = self.max_ordinal_present();
6925            encoder.write_num(max_ordinal, offset);
6926            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6927            // Calling encoder.out_of_line_offset(0) is not allowed.
6928            if max_ordinal == 0 {
6929                return Ok(());
6930            }
6931            depth.increment()?;
6932            let envelope_size = 8;
6933            let bytes_len = max_ordinal as usize * envelope_size;
6934            #[allow(unused_variables)]
6935            let offset = encoder.out_of_line_offset(bytes_len);
6936            let mut _prev_end_offset: usize = 0;
6937            if 2 > max_ordinal {
6938                return Ok(());
6939            }
6940
6941            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6942            // are envelope_size bytes.
6943            let cur_offset: usize = (2 - 1) * envelope_size;
6944
6945            // Zero reserved fields.
6946            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6947
6948            // Safety:
6949            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6950            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6951            //   envelope_size bytes, there is always sufficient room.
6952            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
6953            self.keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
6954            encoder, offset + cur_offset, depth
6955        )?;
6956
6957            _prev_end_offset = cur_offset + envelope_size;
6958
6959            Ok(())
6960        }
6961    }
6962
6963    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6964        for KeyboardInputDescriptor
6965    {
6966        #[inline(always)]
6967        fn new_empty() -> Self {
6968            Self::default()
6969        }
6970
6971        unsafe fn decode(
6972            &mut self,
6973            decoder: &mut fidl::encoding::Decoder<'_, D>,
6974            offset: usize,
6975            mut depth: fidl::encoding::Depth,
6976        ) -> fidl::Result<()> {
6977            decoder.debug_check_bounds::<Self>(offset);
6978            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6979                None => return Err(fidl::Error::NotNullable),
6980                Some(len) => len,
6981            };
6982            // Calling decoder.out_of_line_offset(0) is not allowed.
6983            if len == 0 {
6984                return Ok(());
6985            };
6986            depth.increment()?;
6987            let envelope_size = 8;
6988            let bytes_len = len * envelope_size;
6989            let offset = decoder.out_of_line_offset(bytes_len)?;
6990            // Decode the envelope for each type.
6991            let mut _next_ordinal_to_read = 0;
6992            let mut next_offset = offset;
6993            let end_offset = offset + bytes_len;
6994            _next_ordinal_to_read += 1;
6995            if next_offset >= end_offset {
6996                return Ok(());
6997            }
6998
6999            // Decode unknown envelopes for gaps in ordinals.
7000            while _next_ordinal_to_read < 2 {
7001                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7002                _next_ordinal_to_read += 1;
7003                next_offset += envelope_size;
7004            }
7005
7006            let next_out_of_line = decoder.next_out_of_line();
7007            let handles_before = decoder.remaining_handles();
7008            if let Some((inlined, num_bytes, num_handles)) =
7009                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7010            {
7011                let member_inline_size = <fidl::encoding::Vector<
7012                    fidl_fuchsia_input__common::Key,
7013                    256,
7014                > as fidl::encoding::TypeMarker>::inline_size(
7015                    decoder.context
7016                );
7017                if inlined != (member_inline_size <= 4) {
7018                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7019                }
7020                let inner_offset;
7021                let mut inner_depth = depth.clone();
7022                if inlined {
7023                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7024                    inner_offset = next_offset;
7025                } else {
7026                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7027                    inner_depth.increment()?;
7028                }
7029                let val_ref =
7030                self.keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7031                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7032                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7033                {
7034                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7035                }
7036                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7037                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7038                }
7039            }
7040
7041            next_offset += envelope_size;
7042
7043            // Decode the remaining unknown envelopes.
7044            while next_offset < end_offset {
7045                _next_ordinal_to_read += 1;
7046                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7047                next_offset += envelope_size;
7048            }
7049
7050            Ok(())
7051        }
7052    }
7053
7054    impl KeyboardInputReport {
7055        #[inline(always)]
7056        fn max_ordinal_present(&self) -> u64 {
7057            if let Some(_) = self.pressed_keys3 {
7058                return 2;
7059            }
7060            0
7061        }
7062    }
7063
7064    impl fidl::encoding::ValueTypeMarker for KeyboardInputReport {
7065        type Borrowed<'a> = &'a Self;
7066        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7067            value
7068        }
7069    }
7070
7071    unsafe impl fidl::encoding::TypeMarker for KeyboardInputReport {
7072        type Owned = Self;
7073
7074        #[inline(always)]
7075        fn inline_align(_context: fidl::encoding::Context) -> usize {
7076            8
7077        }
7078
7079        #[inline(always)]
7080        fn inline_size(_context: fidl::encoding::Context) -> usize {
7081            16
7082        }
7083    }
7084
7085    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardInputReport, D>
7086        for &KeyboardInputReport
7087    {
7088        unsafe fn encode(
7089            self,
7090            encoder: &mut fidl::encoding::Encoder<'_, D>,
7091            offset: usize,
7092            mut depth: fidl::encoding::Depth,
7093        ) -> fidl::Result<()> {
7094            encoder.debug_check_bounds::<KeyboardInputReport>(offset);
7095            // Vector header
7096            let max_ordinal: u64 = self.max_ordinal_present();
7097            encoder.write_num(max_ordinal, offset);
7098            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7099            // Calling encoder.out_of_line_offset(0) is not allowed.
7100            if max_ordinal == 0 {
7101                return Ok(());
7102            }
7103            depth.increment()?;
7104            let envelope_size = 8;
7105            let bytes_len = max_ordinal as usize * envelope_size;
7106            #[allow(unused_variables)]
7107            let offset = encoder.out_of_line_offset(bytes_len);
7108            let mut _prev_end_offset: usize = 0;
7109            if 2 > max_ordinal {
7110                return Ok(());
7111            }
7112
7113            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7114            // are envelope_size bytes.
7115            let cur_offset: usize = (2 - 1) * envelope_size;
7116
7117            // Zero reserved fields.
7118            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7119
7120            // Safety:
7121            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7122            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7123            //   envelope_size bytes, there is always sufficient room.
7124            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7125            self.pressed_keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7126            encoder, offset + cur_offset, depth
7127        )?;
7128
7129            _prev_end_offset = cur_offset + envelope_size;
7130
7131            Ok(())
7132        }
7133    }
7134
7135    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardInputReport {
7136        #[inline(always)]
7137        fn new_empty() -> Self {
7138            Self::default()
7139        }
7140
7141        unsafe fn decode(
7142            &mut self,
7143            decoder: &mut fidl::encoding::Decoder<'_, D>,
7144            offset: usize,
7145            mut depth: fidl::encoding::Depth,
7146        ) -> fidl::Result<()> {
7147            decoder.debug_check_bounds::<Self>(offset);
7148            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7149                None => return Err(fidl::Error::NotNullable),
7150                Some(len) => len,
7151            };
7152            // Calling decoder.out_of_line_offset(0) is not allowed.
7153            if len == 0 {
7154                return Ok(());
7155            };
7156            depth.increment()?;
7157            let envelope_size = 8;
7158            let bytes_len = len * envelope_size;
7159            let offset = decoder.out_of_line_offset(bytes_len)?;
7160            // Decode the envelope for each type.
7161            let mut _next_ordinal_to_read = 0;
7162            let mut next_offset = offset;
7163            let end_offset = offset + bytes_len;
7164            _next_ordinal_to_read += 1;
7165            if next_offset >= end_offset {
7166                return Ok(());
7167            }
7168
7169            // Decode unknown envelopes for gaps in ordinals.
7170            while _next_ordinal_to_read < 2 {
7171                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7172                _next_ordinal_to_read += 1;
7173                next_offset += envelope_size;
7174            }
7175
7176            let next_out_of_line = decoder.next_out_of_line();
7177            let handles_before = decoder.remaining_handles();
7178            if let Some((inlined, num_bytes, num_handles)) =
7179                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7180            {
7181                let member_inline_size = <fidl::encoding::Vector<
7182                    fidl_fuchsia_input__common::Key,
7183                    256,
7184                > as fidl::encoding::TypeMarker>::inline_size(
7185                    decoder.context
7186                );
7187                if inlined != (member_inline_size <= 4) {
7188                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7189                }
7190                let inner_offset;
7191                let mut inner_depth = depth.clone();
7192                if inlined {
7193                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7194                    inner_offset = next_offset;
7195                } else {
7196                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7197                    inner_depth.increment()?;
7198                }
7199                let val_ref =
7200                self.pressed_keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7201                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7202                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7203                {
7204                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7205                }
7206                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7207                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7208                }
7209            }
7210
7211            next_offset += envelope_size;
7212
7213            // Decode the remaining unknown envelopes.
7214            while next_offset < end_offset {
7215                _next_ordinal_to_read += 1;
7216                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7217                next_offset += envelope_size;
7218            }
7219
7220            Ok(())
7221        }
7222    }
7223
7224    impl KeyboardOutputDescriptor {
7225        #[inline(always)]
7226        fn max_ordinal_present(&self) -> u64 {
7227            if let Some(_) = self.leds {
7228                return 1;
7229            }
7230            0
7231        }
7232    }
7233
7234    impl fidl::encoding::ValueTypeMarker for KeyboardOutputDescriptor {
7235        type Borrowed<'a> = &'a Self;
7236        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7237            value
7238        }
7239    }
7240
7241    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputDescriptor {
7242        type Owned = Self;
7243
7244        #[inline(always)]
7245        fn inline_align(_context: fidl::encoding::Context) -> usize {
7246            8
7247        }
7248
7249        #[inline(always)]
7250        fn inline_size(_context: fidl::encoding::Context) -> usize {
7251            16
7252        }
7253    }
7254
7255    unsafe impl<D: fidl::encoding::ResourceDialect>
7256        fidl::encoding::Encode<KeyboardOutputDescriptor, D> for &KeyboardOutputDescriptor
7257    {
7258        unsafe fn encode(
7259            self,
7260            encoder: &mut fidl::encoding::Encoder<'_, D>,
7261            offset: usize,
7262            mut depth: fidl::encoding::Depth,
7263        ) -> fidl::Result<()> {
7264            encoder.debug_check_bounds::<KeyboardOutputDescriptor>(offset);
7265            // Vector header
7266            let max_ordinal: u64 = self.max_ordinal_present();
7267            encoder.write_num(max_ordinal, offset);
7268            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7269            // Calling encoder.out_of_line_offset(0) is not allowed.
7270            if max_ordinal == 0 {
7271                return Ok(());
7272            }
7273            depth.increment()?;
7274            let envelope_size = 8;
7275            let bytes_len = max_ordinal as usize * envelope_size;
7276            #[allow(unused_variables)]
7277            let offset = encoder.out_of_line_offset(bytes_len);
7278            let mut _prev_end_offset: usize = 0;
7279            if 1 > max_ordinal {
7280                return Ok(());
7281            }
7282
7283            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7284            // are envelope_size bytes.
7285            let cur_offset: usize = (1 - 1) * envelope_size;
7286
7287            // Zero reserved fields.
7288            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7289
7290            // Safety:
7291            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7292            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7293            //   envelope_size bytes, there is always sufficient room.
7294            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7295            self.leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7296            encoder, offset + cur_offset, depth
7297        )?;
7298
7299            _prev_end_offset = cur_offset + envelope_size;
7300
7301            Ok(())
7302        }
7303    }
7304
7305    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7306        for KeyboardOutputDescriptor
7307    {
7308        #[inline(always)]
7309        fn new_empty() -> Self {
7310            Self::default()
7311        }
7312
7313        unsafe fn decode(
7314            &mut self,
7315            decoder: &mut fidl::encoding::Decoder<'_, D>,
7316            offset: usize,
7317            mut depth: fidl::encoding::Depth,
7318        ) -> fidl::Result<()> {
7319            decoder.debug_check_bounds::<Self>(offset);
7320            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7321                None => return Err(fidl::Error::NotNullable),
7322                Some(len) => len,
7323            };
7324            // Calling decoder.out_of_line_offset(0) is not allowed.
7325            if len == 0 {
7326                return Ok(());
7327            };
7328            depth.increment()?;
7329            let envelope_size = 8;
7330            let bytes_len = len * envelope_size;
7331            let offset = decoder.out_of_line_offset(bytes_len)?;
7332            // Decode the envelope for each type.
7333            let mut _next_ordinal_to_read = 0;
7334            let mut next_offset = offset;
7335            let end_offset = offset + bytes_len;
7336            _next_ordinal_to_read += 1;
7337            if next_offset >= end_offset {
7338                return Ok(());
7339            }
7340
7341            // Decode unknown envelopes for gaps in ordinals.
7342            while _next_ordinal_to_read < 1 {
7343                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7344                _next_ordinal_to_read += 1;
7345                next_offset += envelope_size;
7346            }
7347
7348            let next_out_of_line = decoder.next_out_of_line();
7349            let handles_before = decoder.remaining_handles();
7350            if let Some((inlined, num_bytes, num_handles)) =
7351                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7352            {
7353                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7354                if inlined != (member_inline_size <= 4) {
7355                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7356                }
7357                let inner_offset;
7358                let mut inner_depth = depth.clone();
7359                if inlined {
7360                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7361                    inner_offset = next_offset;
7362                } else {
7363                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7364                    inner_depth.increment()?;
7365                }
7366                let val_ref = self.leds.get_or_insert_with(
7367                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7368                );
7369                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7370                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7371                {
7372                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7373                }
7374                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7375                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7376                }
7377            }
7378
7379            next_offset += envelope_size;
7380
7381            // Decode the remaining unknown envelopes.
7382            while next_offset < end_offset {
7383                _next_ordinal_to_read += 1;
7384                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7385                next_offset += envelope_size;
7386            }
7387
7388            Ok(())
7389        }
7390    }
7391
7392    impl KeyboardOutputReport {
7393        #[inline(always)]
7394        fn max_ordinal_present(&self) -> u64 {
7395            if let Some(_) = self.enabled_leds {
7396                return 1;
7397            }
7398            0
7399        }
7400    }
7401
7402    impl fidl::encoding::ValueTypeMarker for KeyboardOutputReport {
7403        type Borrowed<'a> = &'a Self;
7404        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7405            value
7406        }
7407    }
7408
7409    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputReport {
7410        type Owned = Self;
7411
7412        #[inline(always)]
7413        fn inline_align(_context: fidl::encoding::Context) -> usize {
7414            8
7415        }
7416
7417        #[inline(always)]
7418        fn inline_size(_context: fidl::encoding::Context) -> usize {
7419            16
7420        }
7421    }
7422
7423    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardOutputReport, D>
7424        for &KeyboardOutputReport
7425    {
7426        unsafe fn encode(
7427            self,
7428            encoder: &mut fidl::encoding::Encoder<'_, D>,
7429            offset: usize,
7430            mut depth: fidl::encoding::Depth,
7431        ) -> fidl::Result<()> {
7432            encoder.debug_check_bounds::<KeyboardOutputReport>(offset);
7433            // Vector header
7434            let max_ordinal: u64 = self.max_ordinal_present();
7435            encoder.write_num(max_ordinal, offset);
7436            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7437            // Calling encoder.out_of_line_offset(0) is not allowed.
7438            if max_ordinal == 0 {
7439                return Ok(());
7440            }
7441            depth.increment()?;
7442            let envelope_size = 8;
7443            let bytes_len = max_ordinal as usize * envelope_size;
7444            #[allow(unused_variables)]
7445            let offset = encoder.out_of_line_offset(bytes_len);
7446            let mut _prev_end_offset: usize = 0;
7447            if 1 > max_ordinal {
7448                return Ok(());
7449            }
7450
7451            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7452            // are envelope_size bytes.
7453            let cur_offset: usize = (1 - 1) * envelope_size;
7454
7455            // Zero reserved fields.
7456            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7457
7458            // Safety:
7459            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7460            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7461            //   envelope_size bytes, there is always sufficient room.
7462            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7463            self.enabled_leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7464            encoder, offset + cur_offset, depth
7465        )?;
7466
7467            _prev_end_offset = cur_offset + envelope_size;
7468
7469            Ok(())
7470        }
7471    }
7472
7473    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardOutputReport {
7474        #[inline(always)]
7475        fn new_empty() -> Self {
7476            Self::default()
7477        }
7478
7479        unsafe fn decode(
7480            &mut self,
7481            decoder: &mut fidl::encoding::Decoder<'_, D>,
7482            offset: usize,
7483            mut depth: fidl::encoding::Depth,
7484        ) -> fidl::Result<()> {
7485            decoder.debug_check_bounds::<Self>(offset);
7486            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7487                None => return Err(fidl::Error::NotNullable),
7488                Some(len) => len,
7489            };
7490            // Calling decoder.out_of_line_offset(0) is not allowed.
7491            if len == 0 {
7492                return Ok(());
7493            };
7494            depth.increment()?;
7495            let envelope_size = 8;
7496            let bytes_len = len * envelope_size;
7497            let offset = decoder.out_of_line_offset(bytes_len)?;
7498            // Decode the envelope for each type.
7499            let mut _next_ordinal_to_read = 0;
7500            let mut next_offset = offset;
7501            let end_offset = offset + bytes_len;
7502            _next_ordinal_to_read += 1;
7503            if next_offset >= end_offset {
7504                return Ok(());
7505            }
7506
7507            // Decode unknown envelopes for gaps in ordinals.
7508            while _next_ordinal_to_read < 1 {
7509                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7510                _next_ordinal_to_read += 1;
7511                next_offset += envelope_size;
7512            }
7513
7514            let next_out_of_line = decoder.next_out_of_line();
7515            let handles_before = decoder.remaining_handles();
7516            if let Some((inlined, num_bytes, num_handles)) =
7517                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7518            {
7519                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7520                if inlined != (member_inline_size <= 4) {
7521                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7522                }
7523                let inner_offset;
7524                let mut inner_depth = depth.clone();
7525                if inlined {
7526                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7527                    inner_offset = next_offset;
7528                } else {
7529                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7530                    inner_depth.increment()?;
7531                }
7532                let val_ref = self.enabled_leds.get_or_insert_with(
7533                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7534                );
7535                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7536                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7537                {
7538                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7539                }
7540                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7541                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7542                }
7543            }
7544
7545            next_offset += envelope_size;
7546
7547            // Decode the remaining unknown envelopes.
7548            while next_offset < end_offset {
7549                _next_ordinal_to_read += 1;
7550                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7551                next_offset += envelope_size;
7552            }
7553
7554            Ok(())
7555        }
7556    }
7557
7558    impl MouseDescriptor {
7559        #[inline(always)]
7560        fn max_ordinal_present(&self) -> u64 {
7561            if let Some(_) = self.input {
7562                return 1;
7563            }
7564            0
7565        }
7566    }
7567
7568    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
7569        type Borrowed<'a> = &'a Self;
7570        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7571            value
7572        }
7573    }
7574
7575    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
7576        type Owned = Self;
7577
7578        #[inline(always)]
7579        fn inline_align(_context: fidl::encoding::Context) -> usize {
7580            8
7581        }
7582
7583        #[inline(always)]
7584        fn inline_size(_context: fidl::encoding::Context) -> usize {
7585            16
7586        }
7587    }
7588
7589    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
7590        for &MouseDescriptor
7591    {
7592        unsafe fn encode(
7593            self,
7594            encoder: &mut fidl::encoding::Encoder<'_, D>,
7595            offset: usize,
7596            mut depth: fidl::encoding::Depth,
7597        ) -> fidl::Result<()> {
7598            encoder.debug_check_bounds::<MouseDescriptor>(offset);
7599            // Vector header
7600            let max_ordinal: u64 = self.max_ordinal_present();
7601            encoder.write_num(max_ordinal, offset);
7602            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7603            // Calling encoder.out_of_line_offset(0) is not allowed.
7604            if max_ordinal == 0 {
7605                return Ok(());
7606            }
7607            depth.increment()?;
7608            let envelope_size = 8;
7609            let bytes_len = max_ordinal as usize * envelope_size;
7610            #[allow(unused_variables)]
7611            let offset = encoder.out_of_line_offset(bytes_len);
7612            let mut _prev_end_offset: usize = 0;
7613            if 1 > max_ordinal {
7614                return Ok(());
7615            }
7616
7617            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7618            // are envelope_size bytes.
7619            let cur_offset: usize = (1 - 1) * envelope_size;
7620
7621            // Zero reserved fields.
7622            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7623
7624            // Safety:
7625            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7626            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7627            //   envelope_size bytes, there is always sufficient room.
7628            fidl::encoding::encode_in_envelope_optional::<MouseInputDescriptor, D>(
7629                self.input
7630                    .as_ref()
7631                    .map(<MouseInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
7632                encoder,
7633                offset + cur_offset,
7634                depth,
7635            )?;
7636
7637            _prev_end_offset = cur_offset + envelope_size;
7638
7639            Ok(())
7640        }
7641    }
7642
7643    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
7644        #[inline(always)]
7645        fn new_empty() -> Self {
7646            Self::default()
7647        }
7648
7649        unsafe fn decode(
7650            &mut self,
7651            decoder: &mut fidl::encoding::Decoder<'_, D>,
7652            offset: usize,
7653            mut depth: fidl::encoding::Depth,
7654        ) -> fidl::Result<()> {
7655            decoder.debug_check_bounds::<Self>(offset);
7656            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7657                None => return Err(fidl::Error::NotNullable),
7658                Some(len) => len,
7659            };
7660            // Calling decoder.out_of_line_offset(0) is not allowed.
7661            if len == 0 {
7662                return Ok(());
7663            };
7664            depth.increment()?;
7665            let envelope_size = 8;
7666            let bytes_len = len * envelope_size;
7667            let offset = decoder.out_of_line_offset(bytes_len)?;
7668            // Decode the envelope for each type.
7669            let mut _next_ordinal_to_read = 0;
7670            let mut next_offset = offset;
7671            let end_offset = offset + bytes_len;
7672            _next_ordinal_to_read += 1;
7673            if next_offset >= end_offset {
7674                return Ok(());
7675            }
7676
7677            // Decode unknown envelopes for gaps in ordinals.
7678            while _next_ordinal_to_read < 1 {
7679                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7680                _next_ordinal_to_read += 1;
7681                next_offset += envelope_size;
7682            }
7683
7684            let next_out_of_line = decoder.next_out_of_line();
7685            let handles_before = decoder.remaining_handles();
7686            if let Some((inlined, num_bytes, num_handles)) =
7687                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7688            {
7689                let member_inline_size =
7690                    <MouseInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
7691                        decoder.context,
7692                    );
7693                if inlined != (member_inline_size <= 4) {
7694                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7695                }
7696                let inner_offset;
7697                let mut inner_depth = depth.clone();
7698                if inlined {
7699                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7700                    inner_offset = next_offset;
7701                } else {
7702                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7703                    inner_depth.increment()?;
7704                }
7705                let val_ref =
7706                    self.input.get_or_insert_with(|| fidl::new_empty!(MouseInputDescriptor, D));
7707                fidl::decode!(
7708                    MouseInputDescriptor,
7709                    D,
7710                    val_ref,
7711                    decoder,
7712                    inner_offset,
7713                    inner_depth
7714                )?;
7715                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7716                {
7717                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7718                }
7719                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7720                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7721                }
7722            }
7723
7724            next_offset += envelope_size;
7725
7726            // Decode the remaining unknown envelopes.
7727            while next_offset < end_offset {
7728                _next_ordinal_to_read += 1;
7729                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7730                next_offset += envelope_size;
7731            }
7732
7733            Ok(())
7734        }
7735    }
7736
7737    impl MouseInputDescriptor {
7738        #[inline(always)]
7739        fn max_ordinal_present(&self) -> u64 {
7740            if let Some(_) = self.position_y {
7741                return 7;
7742            }
7743            if let Some(_) = self.position_x {
7744                return 6;
7745            }
7746            if let Some(_) = self.buttons {
7747                return 5;
7748            }
7749            if let Some(_) = self.scroll_h {
7750                return 4;
7751            }
7752            if let Some(_) = self.scroll_v {
7753                return 3;
7754            }
7755            if let Some(_) = self.movement_y {
7756                return 2;
7757            }
7758            if let Some(_) = self.movement_x {
7759                return 1;
7760            }
7761            0
7762        }
7763    }
7764
7765    impl fidl::encoding::ValueTypeMarker for MouseInputDescriptor {
7766        type Borrowed<'a> = &'a Self;
7767        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7768            value
7769        }
7770    }
7771
7772    unsafe impl fidl::encoding::TypeMarker for MouseInputDescriptor {
7773        type Owned = Self;
7774
7775        #[inline(always)]
7776        fn inline_align(_context: fidl::encoding::Context) -> usize {
7777            8
7778        }
7779
7780        #[inline(always)]
7781        fn inline_size(_context: fidl::encoding::Context) -> usize {
7782            16
7783        }
7784    }
7785
7786    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputDescriptor, D>
7787        for &MouseInputDescriptor
7788    {
7789        unsafe fn encode(
7790            self,
7791            encoder: &mut fidl::encoding::Encoder<'_, D>,
7792            offset: usize,
7793            mut depth: fidl::encoding::Depth,
7794        ) -> fidl::Result<()> {
7795            encoder.debug_check_bounds::<MouseInputDescriptor>(offset);
7796            // Vector header
7797            let max_ordinal: u64 = self.max_ordinal_present();
7798            encoder.write_num(max_ordinal, offset);
7799            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7800            // Calling encoder.out_of_line_offset(0) is not allowed.
7801            if max_ordinal == 0 {
7802                return Ok(());
7803            }
7804            depth.increment()?;
7805            let envelope_size = 8;
7806            let bytes_len = max_ordinal as usize * envelope_size;
7807            #[allow(unused_variables)]
7808            let offset = encoder.out_of_line_offset(bytes_len);
7809            let mut _prev_end_offset: usize = 0;
7810            if 1 > max_ordinal {
7811                return Ok(());
7812            }
7813
7814            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7815            // are envelope_size bytes.
7816            let cur_offset: usize = (1 - 1) * envelope_size;
7817
7818            // Zero reserved fields.
7819            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7820
7821            // Safety:
7822            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7823            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7824            //   envelope_size bytes, there is always sufficient room.
7825            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7826                self.movement_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7827                encoder,
7828                offset + cur_offset,
7829                depth,
7830            )?;
7831
7832            _prev_end_offset = cur_offset + envelope_size;
7833            if 2 > max_ordinal {
7834                return Ok(());
7835            }
7836
7837            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7838            // are envelope_size bytes.
7839            let cur_offset: usize = (2 - 1) * envelope_size;
7840
7841            // Zero reserved fields.
7842            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7843
7844            // Safety:
7845            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7846            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7847            //   envelope_size bytes, there is always sufficient room.
7848            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7849                self.movement_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7850                encoder,
7851                offset + cur_offset,
7852                depth,
7853            )?;
7854
7855            _prev_end_offset = cur_offset + envelope_size;
7856            if 3 > max_ordinal {
7857                return Ok(());
7858            }
7859
7860            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7861            // are envelope_size bytes.
7862            let cur_offset: usize = (3 - 1) * envelope_size;
7863
7864            // Zero reserved fields.
7865            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7866
7867            // Safety:
7868            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7869            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7870            //   envelope_size bytes, there is always sufficient room.
7871            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7872                self.scroll_v.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7873                encoder,
7874                offset + cur_offset,
7875                depth,
7876            )?;
7877
7878            _prev_end_offset = cur_offset + envelope_size;
7879            if 4 > max_ordinal {
7880                return Ok(());
7881            }
7882
7883            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7884            // are envelope_size bytes.
7885            let cur_offset: usize = (4 - 1) * envelope_size;
7886
7887            // Zero reserved fields.
7888            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7889
7890            // Safety:
7891            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7892            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7893            //   envelope_size bytes, there is always sufficient room.
7894            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7895                self.scroll_h.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7896                encoder,
7897                offset + cur_offset,
7898                depth,
7899            )?;
7900
7901            _prev_end_offset = cur_offset + envelope_size;
7902            if 5 > max_ordinal {
7903                return Ok(());
7904            }
7905
7906            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7907            // are envelope_size bytes.
7908            let cur_offset: usize = (5 - 1) * envelope_size;
7909
7910            // Zero reserved fields.
7911            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7912
7913            // Safety:
7914            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7915            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7916            //   envelope_size bytes, there is always sufficient room.
7917            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
7918                self.buttons.as_ref().map(
7919                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
7920                ),
7921                encoder,
7922                offset + cur_offset,
7923                depth,
7924            )?;
7925
7926            _prev_end_offset = cur_offset + envelope_size;
7927            if 6 > max_ordinal {
7928                return Ok(());
7929            }
7930
7931            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7932            // are envelope_size bytes.
7933            let cur_offset: usize = (6 - 1) * envelope_size;
7934
7935            // Zero reserved fields.
7936            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7937
7938            // Safety:
7939            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7940            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7941            //   envelope_size bytes, there is always sufficient room.
7942            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7943                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7944                encoder,
7945                offset + cur_offset,
7946                depth,
7947            )?;
7948
7949            _prev_end_offset = cur_offset + envelope_size;
7950            if 7 > max_ordinal {
7951                return Ok(());
7952            }
7953
7954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7955            // are envelope_size bytes.
7956            let cur_offset: usize = (7 - 1) * envelope_size;
7957
7958            // Zero reserved fields.
7959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7960
7961            // Safety:
7962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7964            //   envelope_size bytes, there is always sufficient room.
7965            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7966                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7967                encoder,
7968                offset + cur_offset,
7969                depth,
7970            )?;
7971
7972            _prev_end_offset = cur_offset + envelope_size;
7973
7974            Ok(())
7975        }
7976    }
7977
7978    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputDescriptor {
7979        #[inline(always)]
7980        fn new_empty() -> Self {
7981            Self::default()
7982        }
7983
7984        unsafe fn decode(
7985            &mut self,
7986            decoder: &mut fidl::encoding::Decoder<'_, D>,
7987            offset: usize,
7988            mut depth: fidl::encoding::Depth,
7989        ) -> fidl::Result<()> {
7990            decoder.debug_check_bounds::<Self>(offset);
7991            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7992                None => return Err(fidl::Error::NotNullable),
7993                Some(len) => len,
7994            };
7995            // Calling decoder.out_of_line_offset(0) is not allowed.
7996            if len == 0 {
7997                return Ok(());
7998            };
7999            depth.increment()?;
8000            let envelope_size = 8;
8001            let bytes_len = len * envelope_size;
8002            let offset = decoder.out_of_line_offset(bytes_len)?;
8003            // Decode the envelope for each type.
8004            let mut _next_ordinal_to_read = 0;
8005            let mut next_offset = offset;
8006            let end_offset = offset + bytes_len;
8007            _next_ordinal_to_read += 1;
8008            if next_offset >= end_offset {
8009                return Ok(());
8010            }
8011
8012            // Decode unknown envelopes for gaps in ordinals.
8013            while _next_ordinal_to_read < 1 {
8014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8015                _next_ordinal_to_read += 1;
8016                next_offset += envelope_size;
8017            }
8018
8019            let next_out_of_line = decoder.next_out_of_line();
8020            let handles_before = decoder.remaining_handles();
8021            if let Some((inlined, num_bytes, num_handles)) =
8022                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8023            {
8024                let member_inline_size =
8025                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8026                if inlined != (member_inline_size <= 4) {
8027                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8028                }
8029                let inner_offset;
8030                let mut inner_depth = depth.clone();
8031                if inlined {
8032                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8033                    inner_offset = next_offset;
8034                } else {
8035                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8036                    inner_depth.increment()?;
8037                }
8038                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8039                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8040                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8041                {
8042                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8043                }
8044                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8045                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8046                }
8047            }
8048
8049            next_offset += envelope_size;
8050            _next_ordinal_to_read += 1;
8051            if next_offset >= end_offset {
8052                return Ok(());
8053            }
8054
8055            // Decode unknown envelopes for gaps in ordinals.
8056            while _next_ordinal_to_read < 2 {
8057                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8058                _next_ordinal_to_read += 1;
8059                next_offset += envelope_size;
8060            }
8061
8062            let next_out_of_line = decoder.next_out_of_line();
8063            let handles_before = decoder.remaining_handles();
8064            if let Some((inlined, num_bytes, num_handles)) =
8065                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8066            {
8067                let member_inline_size =
8068                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8069                if inlined != (member_inline_size <= 4) {
8070                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8071                }
8072                let inner_offset;
8073                let mut inner_depth = depth.clone();
8074                if inlined {
8075                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8076                    inner_offset = next_offset;
8077                } else {
8078                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8079                    inner_depth.increment()?;
8080                }
8081                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8082                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8083                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8084                {
8085                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8086                }
8087                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8088                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8089                }
8090            }
8091
8092            next_offset += envelope_size;
8093            _next_ordinal_to_read += 1;
8094            if next_offset >= end_offset {
8095                return Ok(());
8096            }
8097
8098            // Decode unknown envelopes for gaps in ordinals.
8099            while _next_ordinal_to_read < 3 {
8100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8101                _next_ordinal_to_read += 1;
8102                next_offset += envelope_size;
8103            }
8104
8105            let next_out_of_line = decoder.next_out_of_line();
8106            let handles_before = decoder.remaining_handles();
8107            if let Some((inlined, num_bytes, num_handles)) =
8108                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8109            {
8110                let member_inline_size =
8111                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8112                if inlined != (member_inline_size <= 4) {
8113                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8114                }
8115                let inner_offset;
8116                let mut inner_depth = depth.clone();
8117                if inlined {
8118                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8119                    inner_offset = next_offset;
8120                } else {
8121                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8122                    inner_depth.increment()?;
8123                }
8124                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8125                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8126                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8127                {
8128                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8129                }
8130                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8131                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8132                }
8133            }
8134
8135            next_offset += envelope_size;
8136            _next_ordinal_to_read += 1;
8137            if next_offset >= end_offset {
8138                return Ok(());
8139            }
8140
8141            // Decode unknown envelopes for gaps in ordinals.
8142            while _next_ordinal_to_read < 4 {
8143                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8144                _next_ordinal_to_read += 1;
8145                next_offset += envelope_size;
8146            }
8147
8148            let next_out_of_line = decoder.next_out_of_line();
8149            let handles_before = decoder.remaining_handles();
8150            if let Some((inlined, num_bytes, num_handles)) =
8151                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8152            {
8153                let member_inline_size =
8154                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8155                if inlined != (member_inline_size <= 4) {
8156                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8157                }
8158                let inner_offset;
8159                let mut inner_depth = depth.clone();
8160                if inlined {
8161                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8162                    inner_offset = next_offset;
8163                } else {
8164                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8165                    inner_depth.increment()?;
8166                }
8167                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8168                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8169                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8170                {
8171                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8172                }
8173                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8174                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8175                }
8176            }
8177
8178            next_offset += envelope_size;
8179            _next_ordinal_to_read += 1;
8180            if next_offset >= end_offset {
8181                return Ok(());
8182            }
8183
8184            // Decode unknown envelopes for gaps in ordinals.
8185            while _next_ordinal_to_read < 5 {
8186                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8187                _next_ordinal_to_read += 1;
8188                next_offset += envelope_size;
8189            }
8190
8191            let next_out_of_line = decoder.next_out_of_line();
8192            let handles_before = decoder.remaining_handles();
8193            if let Some((inlined, num_bytes, num_handles)) =
8194                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8195            {
8196                let member_inline_size =
8197                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8198                        decoder.context,
8199                    );
8200                if inlined != (member_inline_size <= 4) {
8201                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8202                }
8203                let inner_offset;
8204                let mut inner_depth = depth.clone();
8205                if inlined {
8206                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8207                    inner_offset = next_offset;
8208                } else {
8209                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8210                    inner_depth.increment()?;
8211                }
8212                let val_ref = self
8213                    .buttons
8214                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8215                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8216                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8217                {
8218                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8219                }
8220                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8221                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8222                }
8223            }
8224
8225            next_offset += envelope_size;
8226            _next_ordinal_to_read += 1;
8227            if next_offset >= end_offset {
8228                return Ok(());
8229            }
8230
8231            // Decode unknown envelopes for gaps in ordinals.
8232            while _next_ordinal_to_read < 6 {
8233                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8234                _next_ordinal_to_read += 1;
8235                next_offset += envelope_size;
8236            }
8237
8238            let next_out_of_line = decoder.next_out_of_line();
8239            let handles_before = decoder.remaining_handles();
8240            if let Some((inlined, num_bytes, num_handles)) =
8241                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8242            {
8243                let member_inline_size =
8244                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8245                if inlined != (member_inline_size <= 4) {
8246                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8247                }
8248                let inner_offset;
8249                let mut inner_depth = depth.clone();
8250                if inlined {
8251                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8252                    inner_offset = next_offset;
8253                } else {
8254                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8255                    inner_depth.increment()?;
8256                }
8257                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8258                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8259                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8260                {
8261                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8262                }
8263                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8264                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8265                }
8266            }
8267
8268            next_offset += envelope_size;
8269            _next_ordinal_to_read += 1;
8270            if next_offset >= end_offset {
8271                return Ok(());
8272            }
8273
8274            // Decode unknown envelopes for gaps in ordinals.
8275            while _next_ordinal_to_read < 7 {
8276                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8277                _next_ordinal_to_read += 1;
8278                next_offset += envelope_size;
8279            }
8280
8281            let next_out_of_line = decoder.next_out_of_line();
8282            let handles_before = decoder.remaining_handles();
8283            if let Some((inlined, num_bytes, num_handles)) =
8284                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8285            {
8286                let member_inline_size =
8287                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8288                if inlined != (member_inline_size <= 4) {
8289                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8290                }
8291                let inner_offset;
8292                let mut inner_depth = depth.clone();
8293                if inlined {
8294                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8295                    inner_offset = next_offset;
8296                } else {
8297                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8298                    inner_depth.increment()?;
8299                }
8300                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8301                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8302                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8303                {
8304                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8305                }
8306                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8307                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8308                }
8309            }
8310
8311            next_offset += envelope_size;
8312
8313            // Decode the remaining unknown envelopes.
8314            while next_offset < end_offset {
8315                _next_ordinal_to_read += 1;
8316                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8317                next_offset += envelope_size;
8318            }
8319
8320            Ok(())
8321        }
8322    }
8323
8324    impl MouseInputReport {
8325        #[inline(always)]
8326        fn max_ordinal_present(&self) -> u64 {
8327            if let Some(_) = self.position_y {
8328                return 7;
8329            }
8330            if let Some(_) = self.position_x {
8331                return 6;
8332            }
8333            if let Some(_) = self.pressed_buttons {
8334                return 5;
8335            }
8336            if let Some(_) = self.scroll_h {
8337                return 4;
8338            }
8339            if let Some(_) = self.scroll_v {
8340                return 3;
8341            }
8342            if let Some(_) = self.movement_y {
8343                return 2;
8344            }
8345            if let Some(_) = self.movement_x {
8346                return 1;
8347            }
8348            0
8349        }
8350    }
8351
8352    impl fidl::encoding::ValueTypeMarker for MouseInputReport {
8353        type Borrowed<'a> = &'a Self;
8354        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8355            value
8356        }
8357    }
8358
8359    unsafe impl fidl::encoding::TypeMarker for MouseInputReport {
8360        type Owned = Self;
8361
8362        #[inline(always)]
8363        fn inline_align(_context: fidl::encoding::Context) -> usize {
8364            8
8365        }
8366
8367        #[inline(always)]
8368        fn inline_size(_context: fidl::encoding::Context) -> usize {
8369            16
8370        }
8371    }
8372
8373    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputReport, D>
8374        for &MouseInputReport
8375    {
8376        unsafe fn encode(
8377            self,
8378            encoder: &mut fidl::encoding::Encoder<'_, D>,
8379            offset: usize,
8380            mut depth: fidl::encoding::Depth,
8381        ) -> fidl::Result<()> {
8382            encoder.debug_check_bounds::<MouseInputReport>(offset);
8383            // Vector header
8384            let max_ordinal: u64 = self.max_ordinal_present();
8385            encoder.write_num(max_ordinal, offset);
8386            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8387            // Calling encoder.out_of_line_offset(0) is not allowed.
8388            if max_ordinal == 0 {
8389                return Ok(());
8390            }
8391            depth.increment()?;
8392            let envelope_size = 8;
8393            let bytes_len = max_ordinal as usize * envelope_size;
8394            #[allow(unused_variables)]
8395            let offset = encoder.out_of_line_offset(bytes_len);
8396            let mut _prev_end_offset: usize = 0;
8397            if 1 > max_ordinal {
8398                return Ok(());
8399            }
8400
8401            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8402            // are envelope_size bytes.
8403            let cur_offset: usize = (1 - 1) * envelope_size;
8404
8405            // Zero reserved fields.
8406            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8407
8408            // Safety:
8409            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8410            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8411            //   envelope_size bytes, there is always sufficient room.
8412            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8413                self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8414                encoder,
8415                offset + cur_offset,
8416                depth,
8417            )?;
8418
8419            _prev_end_offset = cur_offset + envelope_size;
8420            if 2 > max_ordinal {
8421                return Ok(());
8422            }
8423
8424            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8425            // are envelope_size bytes.
8426            let cur_offset: usize = (2 - 1) * envelope_size;
8427
8428            // Zero reserved fields.
8429            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8430
8431            // Safety:
8432            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8433            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8434            //   envelope_size bytes, there is always sufficient room.
8435            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8436                self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8437                encoder,
8438                offset + cur_offset,
8439                depth,
8440            )?;
8441
8442            _prev_end_offset = cur_offset + envelope_size;
8443            if 3 > max_ordinal {
8444                return Ok(());
8445            }
8446
8447            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8448            // are envelope_size bytes.
8449            let cur_offset: usize = (3 - 1) * envelope_size;
8450
8451            // Zero reserved fields.
8452            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8453
8454            // Safety:
8455            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8456            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8457            //   envelope_size bytes, there is always sufficient room.
8458            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8459                self.scroll_v.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8460                encoder,
8461                offset + cur_offset,
8462                depth,
8463            )?;
8464
8465            _prev_end_offset = cur_offset + envelope_size;
8466            if 4 > max_ordinal {
8467                return Ok(());
8468            }
8469
8470            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8471            // are envelope_size bytes.
8472            let cur_offset: usize = (4 - 1) * envelope_size;
8473
8474            // Zero reserved fields.
8475            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8476
8477            // Safety:
8478            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8479            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8480            //   envelope_size bytes, there is always sufficient room.
8481            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8482                self.scroll_h.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8483                encoder,
8484                offset + cur_offset,
8485                depth,
8486            )?;
8487
8488            _prev_end_offset = cur_offset + envelope_size;
8489            if 5 > max_ordinal {
8490                return Ok(());
8491            }
8492
8493            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8494            // are envelope_size bytes.
8495            let cur_offset: usize = (5 - 1) * envelope_size;
8496
8497            // Zero reserved fields.
8498            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8499
8500            // Safety:
8501            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8502            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8503            //   envelope_size bytes, there is always sufficient room.
8504            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
8505                self.pressed_buttons.as_ref().map(
8506                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
8507                ),
8508                encoder,
8509                offset + cur_offset,
8510                depth,
8511            )?;
8512
8513            _prev_end_offset = cur_offset + envelope_size;
8514            if 6 > max_ordinal {
8515                return Ok(());
8516            }
8517
8518            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8519            // are envelope_size bytes.
8520            let cur_offset: usize = (6 - 1) * envelope_size;
8521
8522            // Zero reserved fields.
8523            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8524
8525            // Safety:
8526            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8527            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8528            //   envelope_size bytes, there is always sufficient room.
8529            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8530                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8531                encoder,
8532                offset + cur_offset,
8533                depth,
8534            )?;
8535
8536            _prev_end_offset = cur_offset + envelope_size;
8537            if 7 > max_ordinal {
8538                return Ok(());
8539            }
8540
8541            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8542            // are envelope_size bytes.
8543            let cur_offset: usize = (7 - 1) * envelope_size;
8544
8545            // Zero reserved fields.
8546            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8547
8548            // Safety:
8549            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8550            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8551            //   envelope_size bytes, there is always sufficient room.
8552            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8553                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8554                encoder,
8555                offset + cur_offset,
8556                depth,
8557            )?;
8558
8559            _prev_end_offset = cur_offset + envelope_size;
8560
8561            Ok(())
8562        }
8563    }
8564
8565    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputReport {
8566        #[inline(always)]
8567        fn new_empty() -> Self {
8568            Self::default()
8569        }
8570
8571        unsafe fn decode(
8572            &mut self,
8573            decoder: &mut fidl::encoding::Decoder<'_, D>,
8574            offset: usize,
8575            mut depth: fidl::encoding::Depth,
8576        ) -> fidl::Result<()> {
8577            decoder.debug_check_bounds::<Self>(offset);
8578            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8579                None => return Err(fidl::Error::NotNullable),
8580                Some(len) => len,
8581            };
8582            // Calling decoder.out_of_line_offset(0) is not allowed.
8583            if len == 0 {
8584                return Ok(());
8585            };
8586            depth.increment()?;
8587            let envelope_size = 8;
8588            let bytes_len = len * envelope_size;
8589            let offset = decoder.out_of_line_offset(bytes_len)?;
8590            // Decode the envelope for each type.
8591            let mut _next_ordinal_to_read = 0;
8592            let mut next_offset = offset;
8593            let end_offset = offset + bytes_len;
8594            _next_ordinal_to_read += 1;
8595            if next_offset >= end_offset {
8596                return Ok(());
8597            }
8598
8599            // Decode unknown envelopes for gaps in ordinals.
8600            while _next_ordinal_to_read < 1 {
8601                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8602                _next_ordinal_to_read += 1;
8603                next_offset += envelope_size;
8604            }
8605
8606            let next_out_of_line = decoder.next_out_of_line();
8607            let handles_before = decoder.remaining_handles();
8608            if let Some((inlined, num_bytes, num_handles)) =
8609                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8610            {
8611                let member_inline_size =
8612                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8613                if inlined != (member_inline_size <= 4) {
8614                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8615                }
8616                let inner_offset;
8617                let mut inner_depth = depth.clone();
8618                if inlined {
8619                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8620                    inner_offset = next_offset;
8621                } else {
8622                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8623                    inner_depth.increment()?;
8624                }
8625                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8626                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
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            _next_ordinal_to_read += 1;
8638            if next_offset >= end_offset {
8639                return Ok(());
8640            }
8641
8642            // Decode unknown envelopes for gaps in ordinals.
8643            while _next_ordinal_to_read < 2 {
8644                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8645                _next_ordinal_to_read += 1;
8646                next_offset += envelope_size;
8647            }
8648
8649            let next_out_of_line = decoder.next_out_of_line();
8650            let handles_before = decoder.remaining_handles();
8651            if let Some((inlined, num_bytes, num_handles)) =
8652                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8653            {
8654                let member_inline_size =
8655                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8656                if inlined != (member_inline_size <= 4) {
8657                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8658                }
8659                let inner_offset;
8660                let mut inner_depth = depth.clone();
8661                if inlined {
8662                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8663                    inner_offset = next_offset;
8664                } else {
8665                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8666                    inner_depth.increment()?;
8667                }
8668                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8669                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8670                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8671                {
8672                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8673                }
8674                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8675                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8676                }
8677            }
8678
8679            next_offset += envelope_size;
8680            _next_ordinal_to_read += 1;
8681            if next_offset >= end_offset {
8682                return Ok(());
8683            }
8684
8685            // Decode unknown envelopes for gaps in ordinals.
8686            while _next_ordinal_to_read < 3 {
8687                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8688                _next_ordinal_to_read += 1;
8689                next_offset += envelope_size;
8690            }
8691
8692            let next_out_of_line = decoder.next_out_of_line();
8693            let handles_before = decoder.remaining_handles();
8694            if let Some((inlined, num_bytes, num_handles)) =
8695                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8696            {
8697                let member_inline_size =
8698                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8699                if inlined != (member_inline_size <= 4) {
8700                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8701                }
8702                let inner_offset;
8703                let mut inner_depth = depth.clone();
8704                if inlined {
8705                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8706                    inner_offset = next_offset;
8707                } else {
8708                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8709                    inner_depth.increment()?;
8710                }
8711                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(i64, D));
8712                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8713                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8714                {
8715                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8716                }
8717                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8718                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8719                }
8720            }
8721
8722            next_offset += envelope_size;
8723            _next_ordinal_to_read += 1;
8724            if next_offset >= end_offset {
8725                return Ok(());
8726            }
8727
8728            // Decode unknown envelopes for gaps in ordinals.
8729            while _next_ordinal_to_read < 4 {
8730                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8731                _next_ordinal_to_read += 1;
8732                next_offset += envelope_size;
8733            }
8734
8735            let next_out_of_line = decoder.next_out_of_line();
8736            let handles_before = decoder.remaining_handles();
8737            if let Some((inlined, num_bytes, num_handles)) =
8738                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8739            {
8740                let member_inline_size =
8741                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8742                if inlined != (member_inline_size <= 4) {
8743                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8744                }
8745                let inner_offset;
8746                let mut inner_depth = depth.clone();
8747                if inlined {
8748                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8749                    inner_offset = next_offset;
8750                } else {
8751                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8752                    inner_depth.increment()?;
8753                }
8754                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(i64, D));
8755                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8756                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8757                {
8758                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8759                }
8760                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8761                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8762                }
8763            }
8764
8765            next_offset += envelope_size;
8766            _next_ordinal_to_read += 1;
8767            if next_offset >= end_offset {
8768                return Ok(());
8769            }
8770
8771            // Decode unknown envelopes for gaps in ordinals.
8772            while _next_ordinal_to_read < 5 {
8773                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8774                _next_ordinal_to_read += 1;
8775                next_offset += envelope_size;
8776            }
8777
8778            let next_out_of_line = decoder.next_out_of_line();
8779            let handles_before = decoder.remaining_handles();
8780            if let Some((inlined, num_bytes, num_handles)) =
8781                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8782            {
8783                let member_inline_size =
8784                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8785                        decoder.context,
8786                    );
8787                if inlined != (member_inline_size <= 4) {
8788                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8789                }
8790                let inner_offset;
8791                let mut inner_depth = depth.clone();
8792                if inlined {
8793                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8794                    inner_offset = next_offset;
8795                } else {
8796                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8797                    inner_depth.increment()?;
8798                }
8799                let val_ref = self
8800                    .pressed_buttons
8801                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8802                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8803                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8804                {
8805                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8806                }
8807                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8808                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8809                }
8810            }
8811
8812            next_offset += envelope_size;
8813            _next_ordinal_to_read += 1;
8814            if next_offset >= end_offset {
8815                return Ok(());
8816            }
8817
8818            // Decode unknown envelopes for gaps in ordinals.
8819            while _next_ordinal_to_read < 6 {
8820                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8821                _next_ordinal_to_read += 1;
8822                next_offset += envelope_size;
8823            }
8824
8825            let next_out_of_line = decoder.next_out_of_line();
8826            let handles_before = decoder.remaining_handles();
8827            if let Some((inlined, num_bytes, num_handles)) =
8828                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8829            {
8830                let member_inline_size =
8831                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8832                if inlined != (member_inline_size <= 4) {
8833                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8834                }
8835                let inner_offset;
8836                let mut inner_depth = depth.clone();
8837                if inlined {
8838                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8839                    inner_offset = next_offset;
8840                } else {
8841                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8842                    inner_depth.increment()?;
8843                }
8844                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8845                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8846                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8847                {
8848                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8849                }
8850                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8851                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8852                }
8853            }
8854
8855            next_offset += envelope_size;
8856            _next_ordinal_to_read += 1;
8857            if next_offset >= end_offset {
8858                return Ok(());
8859            }
8860
8861            // Decode unknown envelopes for gaps in ordinals.
8862            while _next_ordinal_to_read < 7 {
8863                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8864                _next_ordinal_to_read += 1;
8865                next_offset += envelope_size;
8866            }
8867
8868            let next_out_of_line = decoder.next_out_of_line();
8869            let handles_before = decoder.remaining_handles();
8870            if let Some((inlined, num_bytes, num_handles)) =
8871                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8872            {
8873                let member_inline_size =
8874                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8875                if inlined != (member_inline_size <= 4) {
8876                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8877                }
8878                let inner_offset;
8879                let mut inner_depth = depth.clone();
8880                if inlined {
8881                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8882                    inner_offset = next_offset;
8883                } else {
8884                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8885                    inner_depth.increment()?;
8886                }
8887                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8888                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8889                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8890                {
8891                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8892                }
8893                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8894                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8895                }
8896            }
8897
8898            next_offset += envelope_size;
8899
8900            // Decode the remaining unknown envelopes.
8901            while next_offset < end_offset {
8902                _next_ordinal_to_read += 1;
8903                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8904                next_offset += envelope_size;
8905            }
8906
8907            Ok(())
8908        }
8909    }
8910
8911    impl OutputDescriptor {
8912        #[inline(always)]
8913        fn max_ordinal_present(&self) -> u64 {
8914            if let Some(_) = self.keyboard {
8915                return 1;
8916            }
8917            0
8918        }
8919    }
8920
8921    impl fidl::encoding::ValueTypeMarker for OutputDescriptor {
8922        type Borrowed<'a> = &'a Self;
8923        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8924            value
8925        }
8926    }
8927
8928    unsafe impl fidl::encoding::TypeMarker for OutputDescriptor {
8929        type Owned = Self;
8930
8931        #[inline(always)]
8932        fn inline_align(_context: fidl::encoding::Context) -> usize {
8933            8
8934        }
8935
8936        #[inline(always)]
8937        fn inline_size(_context: fidl::encoding::Context) -> usize {
8938            16
8939        }
8940    }
8941
8942    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputDescriptor, D>
8943        for &OutputDescriptor
8944    {
8945        unsafe fn encode(
8946            self,
8947            encoder: &mut fidl::encoding::Encoder<'_, D>,
8948            offset: usize,
8949            mut depth: fidl::encoding::Depth,
8950        ) -> fidl::Result<()> {
8951            encoder.debug_check_bounds::<OutputDescriptor>(offset);
8952            // Vector header
8953            let max_ordinal: u64 = self.max_ordinal_present();
8954            encoder.write_num(max_ordinal, offset);
8955            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8956            // Calling encoder.out_of_line_offset(0) is not allowed.
8957            if max_ordinal == 0 {
8958                return Ok(());
8959            }
8960            depth.increment()?;
8961            let envelope_size = 8;
8962            let bytes_len = max_ordinal as usize * envelope_size;
8963            #[allow(unused_variables)]
8964            let offset = encoder.out_of_line_offset(bytes_len);
8965            let mut _prev_end_offset: usize = 0;
8966            if 1 > max_ordinal {
8967                return Ok(());
8968            }
8969
8970            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8971            // are envelope_size bytes.
8972            let cur_offset: usize = (1 - 1) * envelope_size;
8973
8974            // Zero reserved fields.
8975            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8976
8977            // Safety:
8978            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8979            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8980            //   envelope_size bytes, there is always sufficient room.
8981            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
8982                self.keyboard
8983                    .as_ref()
8984                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
8985                encoder,
8986                offset + cur_offset,
8987                depth,
8988            )?;
8989
8990            _prev_end_offset = cur_offset + envelope_size;
8991
8992            Ok(())
8993        }
8994    }
8995
8996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputDescriptor {
8997        #[inline(always)]
8998        fn new_empty() -> Self {
8999            Self::default()
9000        }
9001
9002        unsafe fn decode(
9003            &mut self,
9004            decoder: &mut fidl::encoding::Decoder<'_, D>,
9005            offset: usize,
9006            mut depth: fidl::encoding::Depth,
9007        ) -> fidl::Result<()> {
9008            decoder.debug_check_bounds::<Self>(offset);
9009            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9010                None => return Err(fidl::Error::NotNullable),
9011                Some(len) => len,
9012            };
9013            // Calling decoder.out_of_line_offset(0) is not allowed.
9014            if len == 0 {
9015                return Ok(());
9016            };
9017            depth.increment()?;
9018            let envelope_size = 8;
9019            let bytes_len = len * envelope_size;
9020            let offset = decoder.out_of_line_offset(bytes_len)?;
9021            // Decode the envelope for each type.
9022            let mut _next_ordinal_to_read = 0;
9023            let mut next_offset = offset;
9024            let end_offset = offset + bytes_len;
9025            _next_ordinal_to_read += 1;
9026            if next_offset >= end_offset {
9027                return Ok(());
9028            }
9029
9030            // Decode unknown envelopes for gaps in ordinals.
9031            while _next_ordinal_to_read < 1 {
9032                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9033                _next_ordinal_to_read += 1;
9034                next_offset += envelope_size;
9035            }
9036
9037            let next_out_of_line = decoder.next_out_of_line();
9038            let handles_before = decoder.remaining_handles();
9039            if let Some((inlined, num_bytes, num_handles)) =
9040                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9041            {
9042                let member_inline_size =
9043                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
9044                        decoder.context,
9045                    );
9046                if inlined != (member_inline_size <= 4) {
9047                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9048                }
9049                let inner_offset;
9050                let mut inner_depth = depth.clone();
9051                if inlined {
9052                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9053                    inner_offset = next_offset;
9054                } else {
9055                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9056                    inner_depth.increment()?;
9057                }
9058                let val_ref = self
9059                    .keyboard
9060                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
9061                fidl::decode!(
9062                    KeyboardOutputDescriptor,
9063                    D,
9064                    val_ref,
9065                    decoder,
9066                    inner_offset,
9067                    inner_depth
9068                )?;
9069                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9070                {
9071                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9072                }
9073                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9074                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9075                }
9076            }
9077
9078            next_offset += envelope_size;
9079
9080            // Decode the remaining unknown envelopes.
9081            while next_offset < end_offset {
9082                _next_ordinal_to_read += 1;
9083                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9084                next_offset += envelope_size;
9085            }
9086
9087            Ok(())
9088        }
9089    }
9090
9091    impl OutputReport {
9092        #[inline(always)]
9093        fn max_ordinal_present(&self) -> u64 {
9094            if let Some(_) = self.keyboard {
9095                return 1;
9096            }
9097            0
9098        }
9099    }
9100
9101    impl fidl::encoding::ValueTypeMarker for OutputReport {
9102        type Borrowed<'a> = &'a Self;
9103        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9104            value
9105        }
9106    }
9107
9108    unsafe impl fidl::encoding::TypeMarker for OutputReport {
9109        type Owned = Self;
9110
9111        #[inline(always)]
9112        fn inline_align(_context: fidl::encoding::Context) -> usize {
9113            8
9114        }
9115
9116        #[inline(always)]
9117        fn inline_size(_context: fidl::encoding::Context) -> usize {
9118            16
9119        }
9120    }
9121
9122    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputReport, D>
9123        for &OutputReport
9124    {
9125        unsafe fn encode(
9126            self,
9127            encoder: &mut fidl::encoding::Encoder<'_, D>,
9128            offset: usize,
9129            mut depth: fidl::encoding::Depth,
9130        ) -> fidl::Result<()> {
9131            encoder.debug_check_bounds::<OutputReport>(offset);
9132            // Vector header
9133            let max_ordinal: u64 = self.max_ordinal_present();
9134            encoder.write_num(max_ordinal, offset);
9135            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9136            // Calling encoder.out_of_line_offset(0) is not allowed.
9137            if max_ordinal == 0 {
9138                return Ok(());
9139            }
9140            depth.increment()?;
9141            let envelope_size = 8;
9142            let bytes_len = max_ordinal as usize * envelope_size;
9143            #[allow(unused_variables)]
9144            let offset = encoder.out_of_line_offset(bytes_len);
9145            let mut _prev_end_offset: usize = 0;
9146            if 1 > 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 = (1 - 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::<KeyboardOutputReport, D>(
9162                self.keyboard
9163                    .as_ref()
9164                    .map(<KeyboardOutputReport as fidl::encoding::ValueTypeMarker>::borrow),
9165                encoder,
9166                offset + cur_offset,
9167                depth,
9168            )?;
9169
9170            _prev_end_offset = cur_offset + envelope_size;
9171
9172            Ok(())
9173        }
9174    }
9175
9176    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputReport {
9177        #[inline(always)]
9178        fn new_empty() -> Self {
9179            Self::default()
9180        }
9181
9182        unsafe fn decode(
9183            &mut self,
9184            decoder: &mut fidl::encoding::Decoder<'_, D>,
9185            offset: usize,
9186            mut depth: fidl::encoding::Depth,
9187        ) -> fidl::Result<()> {
9188            decoder.debug_check_bounds::<Self>(offset);
9189            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9190                None => return Err(fidl::Error::NotNullable),
9191                Some(len) => len,
9192            };
9193            // Calling decoder.out_of_line_offset(0) is not allowed.
9194            if len == 0 {
9195                return Ok(());
9196            };
9197            depth.increment()?;
9198            let envelope_size = 8;
9199            let bytes_len = len * envelope_size;
9200            let offset = decoder.out_of_line_offset(bytes_len)?;
9201            // Decode the envelope for each type.
9202            let mut _next_ordinal_to_read = 0;
9203            let mut next_offset = offset;
9204            let end_offset = offset + bytes_len;
9205            _next_ordinal_to_read += 1;
9206            if next_offset >= end_offset {
9207                return Ok(());
9208            }
9209
9210            // Decode unknown envelopes for gaps in ordinals.
9211            while _next_ordinal_to_read < 1 {
9212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9213                _next_ordinal_to_read += 1;
9214                next_offset += envelope_size;
9215            }
9216
9217            let next_out_of_line = decoder.next_out_of_line();
9218            let handles_before = decoder.remaining_handles();
9219            if let Some((inlined, num_bytes, num_handles)) =
9220                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9221            {
9222                let member_inline_size =
9223                    <KeyboardOutputReport as fidl::encoding::TypeMarker>::inline_size(
9224                        decoder.context,
9225                    );
9226                if inlined != (member_inline_size <= 4) {
9227                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9228                }
9229                let inner_offset;
9230                let mut inner_depth = depth.clone();
9231                if inlined {
9232                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9233                    inner_offset = next_offset;
9234                } else {
9235                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9236                    inner_depth.increment()?;
9237                }
9238                let val_ref =
9239                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardOutputReport, D));
9240                fidl::decode!(
9241                    KeyboardOutputReport,
9242                    D,
9243                    val_ref,
9244                    decoder,
9245                    inner_offset,
9246                    inner_depth
9247                )?;
9248                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9249                {
9250                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9251                }
9252                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9253                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9254                }
9255            }
9256
9257            next_offset += envelope_size;
9258
9259            // Decode the remaining unknown envelopes.
9260            while next_offset < end_offset {
9261                _next_ordinal_to_read += 1;
9262                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9263                next_offset += envelope_size;
9264            }
9265
9266            Ok(())
9267        }
9268    }
9269
9270    impl SelectiveReportingFeatureReport {
9271        #[inline(always)]
9272        fn max_ordinal_present(&self) -> u64 {
9273            if let Some(_) = self.button_switch {
9274                return 2;
9275            }
9276            if let Some(_) = self.surface_switch {
9277                return 1;
9278            }
9279            0
9280        }
9281    }
9282
9283    impl fidl::encoding::ValueTypeMarker for SelectiveReportingFeatureReport {
9284        type Borrowed<'a> = &'a Self;
9285        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9286            value
9287        }
9288    }
9289
9290    unsafe impl fidl::encoding::TypeMarker for SelectiveReportingFeatureReport {
9291        type Owned = Self;
9292
9293        #[inline(always)]
9294        fn inline_align(_context: fidl::encoding::Context) -> usize {
9295            8
9296        }
9297
9298        #[inline(always)]
9299        fn inline_size(_context: fidl::encoding::Context) -> usize {
9300            16
9301        }
9302    }
9303
9304    unsafe impl<D: fidl::encoding::ResourceDialect>
9305        fidl::encoding::Encode<SelectiveReportingFeatureReport, D>
9306        for &SelectiveReportingFeatureReport
9307    {
9308        unsafe fn encode(
9309            self,
9310            encoder: &mut fidl::encoding::Encoder<'_, D>,
9311            offset: usize,
9312            mut depth: fidl::encoding::Depth,
9313        ) -> fidl::Result<()> {
9314            encoder.debug_check_bounds::<SelectiveReportingFeatureReport>(offset);
9315            // Vector header
9316            let max_ordinal: u64 = self.max_ordinal_present();
9317            encoder.write_num(max_ordinal, offset);
9318            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9319            // Calling encoder.out_of_line_offset(0) is not allowed.
9320            if max_ordinal == 0 {
9321                return Ok(());
9322            }
9323            depth.increment()?;
9324            let envelope_size = 8;
9325            let bytes_len = max_ordinal as usize * envelope_size;
9326            #[allow(unused_variables)]
9327            let offset = encoder.out_of_line_offset(bytes_len);
9328            let mut _prev_end_offset: usize = 0;
9329            if 1 > max_ordinal {
9330                return Ok(());
9331            }
9332
9333            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9334            // are envelope_size bytes.
9335            let cur_offset: usize = (1 - 1) * envelope_size;
9336
9337            // Zero reserved fields.
9338            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9339
9340            // Safety:
9341            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9342            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9343            //   envelope_size bytes, there is always sufficient room.
9344            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9345                self.surface_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9346                encoder,
9347                offset + cur_offset,
9348                depth,
9349            )?;
9350
9351            _prev_end_offset = cur_offset + envelope_size;
9352            if 2 > max_ordinal {
9353                return Ok(());
9354            }
9355
9356            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9357            // are envelope_size bytes.
9358            let cur_offset: usize = (2 - 1) * envelope_size;
9359
9360            // Zero reserved fields.
9361            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9362
9363            // Safety:
9364            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9365            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9366            //   envelope_size bytes, there is always sufficient room.
9367            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9368                self.button_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9369                encoder,
9370                offset + cur_offset,
9371                depth,
9372            )?;
9373
9374            _prev_end_offset = cur_offset + envelope_size;
9375
9376            Ok(())
9377        }
9378    }
9379
9380    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9381        for SelectiveReportingFeatureReport
9382    {
9383        #[inline(always)]
9384        fn new_empty() -> Self {
9385            Self::default()
9386        }
9387
9388        unsafe fn decode(
9389            &mut self,
9390            decoder: &mut fidl::encoding::Decoder<'_, D>,
9391            offset: usize,
9392            mut depth: fidl::encoding::Depth,
9393        ) -> fidl::Result<()> {
9394            decoder.debug_check_bounds::<Self>(offset);
9395            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9396                None => return Err(fidl::Error::NotNullable),
9397                Some(len) => len,
9398            };
9399            // Calling decoder.out_of_line_offset(0) is not allowed.
9400            if len == 0 {
9401                return Ok(());
9402            };
9403            depth.increment()?;
9404            let envelope_size = 8;
9405            let bytes_len = len * envelope_size;
9406            let offset = decoder.out_of_line_offset(bytes_len)?;
9407            // Decode the envelope for each type.
9408            let mut _next_ordinal_to_read = 0;
9409            let mut next_offset = offset;
9410            let end_offset = offset + bytes_len;
9411            _next_ordinal_to_read += 1;
9412            if next_offset >= end_offset {
9413                return Ok(());
9414            }
9415
9416            // Decode unknown envelopes for gaps in ordinals.
9417            while _next_ordinal_to_read < 1 {
9418                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9419                _next_ordinal_to_read += 1;
9420                next_offset += envelope_size;
9421            }
9422
9423            let next_out_of_line = decoder.next_out_of_line();
9424            let handles_before = decoder.remaining_handles();
9425            if let Some((inlined, num_bytes, num_handles)) =
9426                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9427            {
9428                let member_inline_size =
9429                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9430                if inlined != (member_inline_size <= 4) {
9431                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9432                }
9433                let inner_offset;
9434                let mut inner_depth = depth.clone();
9435                if inlined {
9436                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9437                    inner_offset = next_offset;
9438                } else {
9439                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9440                    inner_depth.increment()?;
9441                }
9442                let val_ref = self.surface_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9443                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9444                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9445                {
9446                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9447                }
9448                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9449                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9450                }
9451            }
9452
9453            next_offset += envelope_size;
9454            _next_ordinal_to_read += 1;
9455            if next_offset >= end_offset {
9456                return Ok(());
9457            }
9458
9459            // Decode unknown envelopes for gaps in ordinals.
9460            while _next_ordinal_to_read < 2 {
9461                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9462                _next_ordinal_to_read += 1;
9463                next_offset += envelope_size;
9464            }
9465
9466            let next_out_of_line = decoder.next_out_of_line();
9467            let handles_before = decoder.remaining_handles();
9468            if let Some((inlined, num_bytes, num_handles)) =
9469                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9470            {
9471                let member_inline_size =
9472                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9473                if inlined != (member_inline_size <= 4) {
9474                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9475                }
9476                let inner_offset;
9477                let mut inner_depth = depth.clone();
9478                if inlined {
9479                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9480                    inner_offset = next_offset;
9481                } else {
9482                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9483                    inner_depth.increment()?;
9484                }
9485                let val_ref = self.button_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9486                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9487                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9488                {
9489                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9490                }
9491                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9492                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9493                }
9494            }
9495
9496            next_offset += envelope_size;
9497
9498            // Decode the remaining unknown envelopes.
9499            while next_offset < end_offset {
9500                _next_ordinal_to_read += 1;
9501                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9502                next_offset += envelope_size;
9503            }
9504
9505            Ok(())
9506        }
9507    }
9508
9509    impl SensorDescriptor {
9510        #[inline(always)]
9511        fn max_ordinal_present(&self) -> u64 {
9512            if let Some(_) = self.feature {
9513                return 2;
9514            }
9515            if let Some(_) = self.input {
9516                return 1;
9517            }
9518            0
9519        }
9520    }
9521
9522    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
9523        type Borrowed<'a> = &'a Self;
9524        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9525            value
9526        }
9527    }
9528
9529    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
9530        type Owned = Self;
9531
9532        #[inline(always)]
9533        fn inline_align(_context: fidl::encoding::Context) -> usize {
9534            8
9535        }
9536
9537        #[inline(always)]
9538        fn inline_size(_context: fidl::encoding::Context) -> usize {
9539            16
9540        }
9541    }
9542
9543    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
9544        for &SensorDescriptor
9545    {
9546        unsafe fn encode(
9547            self,
9548            encoder: &mut fidl::encoding::Encoder<'_, D>,
9549            offset: usize,
9550            mut depth: fidl::encoding::Depth,
9551        ) -> fidl::Result<()> {
9552            encoder.debug_check_bounds::<SensorDescriptor>(offset);
9553            // Vector header
9554            let max_ordinal: u64 = self.max_ordinal_present();
9555            encoder.write_num(max_ordinal, offset);
9556            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9557            // Calling encoder.out_of_line_offset(0) is not allowed.
9558            if max_ordinal == 0 {
9559                return Ok(());
9560            }
9561            depth.increment()?;
9562            let envelope_size = 8;
9563            let bytes_len = max_ordinal as usize * envelope_size;
9564            #[allow(unused_variables)]
9565            let offset = encoder.out_of_line_offset(bytes_len);
9566            let mut _prev_end_offset: usize = 0;
9567            if 1 > max_ordinal {
9568                return Ok(());
9569            }
9570
9571            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9572            // are envelope_size bytes.
9573            let cur_offset: usize = (1 - 1) * envelope_size;
9574
9575            // Zero reserved fields.
9576            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9577
9578            // Safety:
9579            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9580            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9581            //   envelope_size bytes, there is always sufficient room.
9582            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorInputDescriptor, 255>, D>(
9583            self.input.as_ref().map(<fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9584            encoder, offset + cur_offset, depth
9585        )?;
9586
9587            _prev_end_offset = cur_offset + envelope_size;
9588            if 2 > max_ordinal {
9589                return Ok(());
9590            }
9591
9592            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9593            // are envelope_size bytes.
9594            let cur_offset: usize = (2 - 1) * envelope_size;
9595
9596            // Zero reserved fields.
9597            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9598
9599            // Safety:
9600            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9601            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9602            //   envelope_size bytes, there is always sufficient room.
9603            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D>(
9604            self.feature.as_ref().map(<fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9605            encoder, offset + cur_offset, depth
9606        )?;
9607
9608            _prev_end_offset = cur_offset + envelope_size;
9609
9610            Ok(())
9611        }
9612    }
9613
9614    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
9615        #[inline(always)]
9616        fn new_empty() -> Self {
9617            Self::default()
9618        }
9619
9620        unsafe fn decode(
9621            &mut self,
9622            decoder: &mut fidl::encoding::Decoder<'_, D>,
9623            offset: usize,
9624            mut depth: fidl::encoding::Depth,
9625        ) -> fidl::Result<()> {
9626            decoder.debug_check_bounds::<Self>(offset);
9627            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9628                None => return Err(fidl::Error::NotNullable),
9629                Some(len) => len,
9630            };
9631            // Calling decoder.out_of_line_offset(0) is not allowed.
9632            if len == 0 {
9633                return Ok(());
9634            };
9635            depth.increment()?;
9636            let envelope_size = 8;
9637            let bytes_len = len * envelope_size;
9638            let offset = decoder.out_of_line_offset(bytes_len)?;
9639            // Decode the envelope for each type.
9640            let mut _next_ordinal_to_read = 0;
9641            let mut next_offset = offset;
9642            let end_offset = offset + bytes_len;
9643            _next_ordinal_to_read += 1;
9644            if next_offset >= end_offset {
9645                return Ok(());
9646            }
9647
9648            // Decode unknown envelopes for gaps in ordinals.
9649            while _next_ordinal_to_read < 1 {
9650                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9651                _next_ordinal_to_read += 1;
9652                next_offset += envelope_size;
9653            }
9654
9655            let next_out_of_line = decoder.next_out_of_line();
9656            let handles_before = decoder.remaining_handles();
9657            if let Some((inlined, num_bytes, num_handles)) =
9658                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9659            {
9660                let member_inline_size = <fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9661                if inlined != (member_inline_size <= 4) {
9662                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9663                }
9664                let inner_offset;
9665                let mut inner_depth = depth.clone();
9666                if inlined {
9667                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9668                    inner_offset = next_offset;
9669                } else {
9670                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9671                    inner_depth.increment()?;
9672                }
9673                let val_ref = self.input.get_or_insert_with(
9674                    || fidl::new_empty!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D),
9675                );
9676                fidl::decode!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9677                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9678                {
9679                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9680                }
9681                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9682                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9683                }
9684            }
9685
9686            next_offset += envelope_size;
9687            _next_ordinal_to_read += 1;
9688            if next_offset >= end_offset {
9689                return Ok(());
9690            }
9691
9692            // Decode unknown envelopes for gaps in ordinals.
9693            while _next_ordinal_to_read < 2 {
9694                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9695                _next_ordinal_to_read += 1;
9696                next_offset += envelope_size;
9697            }
9698
9699            let next_out_of_line = decoder.next_out_of_line();
9700            let handles_before = decoder.remaining_handles();
9701            if let Some((inlined, num_bytes, num_handles)) =
9702                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9703            {
9704                let member_inline_size = <fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9705                if inlined != (member_inline_size <= 4) {
9706                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9707                }
9708                let inner_offset;
9709                let mut inner_depth = depth.clone();
9710                if inlined {
9711                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9712                    inner_offset = next_offset;
9713                } else {
9714                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9715                    inner_depth.increment()?;
9716                }
9717                let val_ref = self.feature.get_or_insert_with(
9718                    || fidl::new_empty!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D),
9719                );
9720                fidl::decode!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9721                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9722                {
9723                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9724                }
9725                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9726                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9727                }
9728            }
9729
9730            next_offset += envelope_size;
9731
9732            // Decode the remaining unknown envelopes.
9733            while next_offset < end_offset {
9734                _next_ordinal_to_read += 1;
9735                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9736                next_offset += envelope_size;
9737            }
9738
9739            Ok(())
9740        }
9741    }
9742
9743    impl SensorFeatureDescriptor {
9744        #[inline(always)]
9745        fn max_ordinal_present(&self) -> u64 {
9746            if let Some(_) = self.report_id {
9747                return 7;
9748            }
9749            if let Some(_) = self.sampling_rate {
9750                return 6;
9751            }
9752            if let Some(_) = self.threshold_low {
9753                return 5;
9754            }
9755            if let Some(_) = self.threshold_high {
9756                return 4;
9757            }
9758            if let Some(_) = self.supports_reporting_state {
9759                return 3;
9760            }
9761            if let Some(_) = self.sensitivity {
9762                return 2;
9763            }
9764            if let Some(_) = self.report_interval {
9765                return 1;
9766            }
9767            0
9768        }
9769    }
9770
9771    impl fidl::encoding::ValueTypeMarker for SensorFeatureDescriptor {
9772        type Borrowed<'a> = &'a Self;
9773        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9774            value
9775        }
9776    }
9777
9778    unsafe impl fidl::encoding::TypeMarker for SensorFeatureDescriptor {
9779        type Owned = Self;
9780
9781        #[inline(always)]
9782        fn inline_align(_context: fidl::encoding::Context) -> usize {
9783            8
9784        }
9785
9786        #[inline(always)]
9787        fn inline_size(_context: fidl::encoding::Context) -> usize {
9788            16
9789        }
9790    }
9791
9792    unsafe impl<D: fidl::encoding::ResourceDialect>
9793        fidl::encoding::Encode<SensorFeatureDescriptor, D> for &SensorFeatureDescriptor
9794    {
9795        unsafe fn encode(
9796            self,
9797            encoder: &mut fidl::encoding::Encoder<'_, D>,
9798            offset: usize,
9799            mut depth: fidl::encoding::Depth,
9800        ) -> fidl::Result<()> {
9801            encoder.debug_check_bounds::<SensorFeatureDescriptor>(offset);
9802            // Vector header
9803            let max_ordinal: u64 = self.max_ordinal_present();
9804            encoder.write_num(max_ordinal, offset);
9805            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9806            // Calling encoder.out_of_line_offset(0) is not allowed.
9807            if max_ordinal == 0 {
9808                return Ok(());
9809            }
9810            depth.increment()?;
9811            let envelope_size = 8;
9812            let bytes_len = max_ordinal as usize * envelope_size;
9813            #[allow(unused_variables)]
9814            let offset = encoder.out_of_line_offset(bytes_len);
9815            let mut _prev_end_offset: usize = 0;
9816            if 1 > max_ordinal {
9817                return Ok(());
9818            }
9819
9820            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9821            // are envelope_size bytes.
9822            let cur_offset: usize = (1 - 1) * envelope_size;
9823
9824            // Zero reserved fields.
9825            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9826
9827            // Safety:
9828            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9829            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9830            //   envelope_size bytes, there is always sufficient room.
9831            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
9832                self.report_interval
9833                    .as_ref()
9834                    .map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
9835                encoder,
9836                offset + cur_offset,
9837                depth,
9838            )?;
9839
9840            _prev_end_offset = cur_offset + envelope_size;
9841            if 2 > max_ordinal {
9842                return Ok(());
9843            }
9844
9845            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9846            // are envelope_size bytes.
9847            let cur_offset: usize = (2 - 1) * envelope_size;
9848
9849            // Zero reserved fields.
9850            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9851
9852            // Safety:
9853            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9854            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9855            //   envelope_size bytes, there is always sufficient room.
9856            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9857            self.sensitivity.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9858            encoder, offset + cur_offset, depth
9859        )?;
9860
9861            _prev_end_offset = cur_offset + envelope_size;
9862            if 3 > max_ordinal {
9863                return Ok(());
9864            }
9865
9866            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9867            // are envelope_size bytes.
9868            let cur_offset: usize = (3 - 1) * envelope_size;
9869
9870            // Zero reserved fields.
9871            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9872
9873            // Safety:
9874            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9875            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9876            //   envelope_size bytes, there is always sufficient room.
9877            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9878                self.supports_reporting_state
9879                    .as_ref()
9880                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9881                encoder,
9882                offset + cur_offset,
9883                depth,
9884            )?;
9885
9886            _prev_end_offset = cur_offset + envelope_size;
9887            if 4 > max_ordinal {
9888                return Ok(());
9889            }
9890
9891            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9892            // are envelope_size bytes.
9893            let cur_offset: usize = (4 - 1) * envelope_size;
9894
9895            // Zero reserved fields.
9896            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9897
9898            // Safety:
9899            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9900            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9901            //   envelope_size bytes, there is always sufficient room.
9902            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9903            self.threshold_high.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9904            encoder, offset + cur_offset, depth
9905        )?;
9906
9907            _prev_end_offset = cur_offset + envelope_size;
9908            if 5 > max_ordinal {
9909                return Ok(());
9910            }
9911
9912            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9913            // are envelope_size bytes.
9914            let cur_offset: usize = (5 - 1) * envelope_size;
9915
9916            // Zero reserved fields.
9917            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9918
9919            // Safety:
9920            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9921            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9922            //   envelope_size bytes, there is always sufficient room.
9923            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9924            self.threshold_low.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9925            encoder, offset + cur_offset, depth
9926        )?;
9927
9928            _prev_end_offset = cur_offset + envelope_size;
9929            if 6 > max_ordinal {
9930                return Ok(());
9931            }
9932
9933            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9934            // are envelope_size bytes.
9935            let cur_offset: usize = (6 - 1) * envelope_size;
9936
9937            // Zero reserved fields.
9938            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9939
9940            // Safety:
9941            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9942            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9943            //   envelope_size bytes, there is always sufficient room.
9944            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
9945                self.sampling_rate.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
9946                encoder,
9947                offset + cur_offset,
9948                depth,
9949            )?;
9950
9951            _prev_end_offset = cur_offset + envelope_size;
9952            if 7 > max_ordinal {
9953                return Ok(());
9954            }
9955
9956            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9957            // are envelope_size bytes.
9958            let cur_offset: usize = (7 - 1) * envelope_size;
9959
9960            // Zero reserved fields.
9961            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9962
9963            // Safety:
9964            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9965            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9966            //   envelope_size bytes, there is always sufficient room.
9967            fidl::encoding::encode_in_envelope_optional::<u8, D>(
9968                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
9969                encoder,
9970                offset + cur_offset,
9971                depth,
9972            )?;
9973
9974            _prev_end_offset = cur_offset + envelope_size;
9975
9976            Ok(())
9977        }
9978    }
9979
9980    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9981        for SensorFeatureDescriptor
9982    {
9983        #[inline(always)]
9984        fn new_empty() -> Self {
9985            Self::default()
9986        }
9987
9988        unsafe fn decode(
9989            &mut self,
9990            decoder: &mut fidl::encoding::Decoder<'_, D>,
9991            offset: usize,
9992            mut depth: fidl::encoding::Depth,
9993        ) -> fidl::Result<()> {
9994            decoder.debug_check_bounds::<Self>(offset);
9995            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9996                None => return Err(fidl::Error::NotNullable),
9997                Some(len) => len,
9998            };
9999            // Calling decoder.out_of_line_offset(0) is not allowed.
10000            if len == 0 {
10001                return Ok(());
10002            };
10003            depth.increment()?;
10004            let envelope_size = 8;
10005            let bytes_len = len * envelope_size;
10006            let offset = decoder.out_of_line_offset(bytes_len)?;
10007            // Decode the envelope for each type.
10008            let mut _next_ordinal_to_read = 0;
10009            let mut next_offset = offset;
10010            let end_offset = offset + bytes_len;
10011            _next_ordinal_to_read += 1;
10012            if next_offset >= end_offset {
10013                return Ok(());
10014            }
10015
10016            // Decode unknown envelopes for gaps in ordinals.
10017            while _next_ordinal_to_read < 1 {
10018                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10019                _next_ordinal_to_read += 1;
10020                next_offset += envelope_size;
10021            }
10022
10023            let next_out_of_line = decoder.next_out_of_line();
10024            let handles_before = decoder.remaining_handles();
10025            if let Some((inlined, num_bytes, num_handles)) =
10026                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10027            {
10028                let member_inline_size =
10029                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10030                if inlined != (member_inline_size <= 4) {
10031                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10032                }
10033                let inner_offset;
10034                let mut inner_depth = depth.clone();
10035                if inlined {
10036                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10037                    inner_offset = next_offset;
10038                } else {
10039                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10040                    inner_depth.increment()?;
10041                }
10042                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10043                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10044                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10045                {
10046                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10047                }
10048                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10049                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10050                }
10051            }
10052
10053            next_offset += envelope_size;
10054            _next_ordinal_to_read += 1;
10055            if next_offset >= end_offset {
10056                return Ok(());
10057            }
10058
10059            // Decode unknown envelopes for gaps in ordinals.
10060            while _next_ordinal_to_read < 2 {
10061                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10062                _next_ordinal_to_read += 1;
10063                next_offset += envelope_size;
10064            }
10065
10066            let next_out_of_line = decoder.next_out_of_line();
10067            let handles_before = decoder.remaining_handles();
10068            if let Some((inlined, num_bytes, num_handles)) =
10069                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10070            {
10071                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10072                if inlined != (member_inline_size <= 4) {
10073                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10074                }
10075                let inner_offset;
10076                let mut inner_depth = depth.clone();
10077                if inlined {
10078                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10079                    inner_offset = next_offset;
10080                } else {
10081                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10082                    inner_depth.increment()?;
10083                }
10084                let val_ref = self.sensitivity.get_or_insert_with(
10085                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10086                );
10087                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10088                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10089                {
10090                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10091                }
10092                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10093                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10094                }
10095            }
10096
10097            next_offset += envelope_size;
10098            _next_ordinal_to_read += 1;
10099            if next_offset >= end_offset {
10100                return Ok(());
10101            }
10102
10103            // Decode unknown envelopes for gaps in ordinals.
10104            while _next_ordinal_to_read < 3 {
10105                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10106                _next_ordinal_to_read += 1;
10107                next_offset += envelope_size;
10108            }
10109
10110            let next_out_of_line = decoder.next_out_of_line();
10111            let handles_before = decoder.remaining_handles();
10112            if let Some((inlined, num_bytes, num_handles)) =
10113                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10114            {
10115                let member_inline_size =
10116                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10117                if inlined != (member_inline_size <= 4) {
10118                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10119                }
10120                let inner_offset;
10121                let mut inner_depth = depth.clone();
10122                if inlined {
10123                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10124                    inner_offset = next_offset;
10125                } else {
10126                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10127                    inner_depth.increment()?;
10128                }
10129                let val_ref =
10130                    self.supports_reporting_state.get_or_insert_with(|| fidl::new_empty!(bool, D));
10131                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10132                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10133                {
10134                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10135                }
10136                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10137                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10138                }
10139            }
10140
10141            next_offset += envelope_size;
10142            _next_ordinal_to_read += 1;
10143            if next_offset >= end_offset {
10144                return Ok(());
10145            }
10146
10147            // Decode unknown envelopes for gaps in ordinals.
10148            while _next_ordinal_to_read < 4 {
10149                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10150                _next_ordinal_to_read += 1;
10151                next_offset += envelope_size;
10152            }
10153
10154            let next_out_of_line = decoder.next_out_of_line();
10155            let handles_before = decoder.remaining_handles();
10156            if let Some((inlined, num_bytes, num_handles)) =
10157                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10158            {
10159                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10160                if inlined != (member_inline_size <= 4) {
10161                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10162                }
10163                let inner_offset;
10164                let mut inner_depth = depth.clone();
10165                if inlined {
10166                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10167                    inner_offset = next_offset;
10168                } else {
10169                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10170                    inner_depth.increment()?;
10171                }
10172                let val_ref = self.threshold_high.get_or_insert_with(
10173                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10174                );
10175                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10176                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10177                {
10178                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10179                }
10180                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10181                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10182                }
10183            }
10184
10185            next_offset += envelope_size;
10186            _next_ordinal_to_read += 1;
10187            if next_offset >= end_offset {
10188                return Ok(());
10189            }
10190
10191            // Decode unknown envelopes for gaps in ordinals.
10192            while _next_ordinal_to_read < 5 {
10193                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10194                _next_ordinal_to_read += 1;
10195                next_offset += envelope_size;
10196            }
10197
10198            let next_out_of_line = decoder.next_out_of_line();
10199            let handles_before = decoder.remaining_handles();
10200            if let Some((inlined, num_bytes, num_handles)) =
10201                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10202            {
10203                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10204                if inlined != (member_inline_size <= 4) {
10205                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10206                }
10207                let inner_offset;
10208                let mut inner_depth = depth.clone();
10209                if inlined {
10210                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10211                    inner_offset = next_offset;
10212                } else {
10213                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10214                    inner_depth.increment()?;
10215                }
10216                let val_ref = self.threshold_low.get_or_insert_with(
10217                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10218                );
10219                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10220                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10221                {
10222                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10223                }
10224                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10225                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10226                }
10227            }
10228
10229            next_offset += envelope_size;
10230            _next_ordinal_to_read += 1;
10231            if next_offset >= end_offset {
10232                return Ok(());
10233            }
10234
10235            // Decode unknown envelopes for gaps in ordinals.
10236            while _next_ordinal_to_read < 6 {
10237                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10238                _next_ordinal_to_read += 1;
10239                next_offset += envelope_size;
10240            }
10241
10242            let next_out_of_line = decoder.next_out_of_line();
10243            let handles_before = decoder.remaining_handles();
10244            if let Some((inlined, num_bytes, num_handles)) =
10245                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10246            {
10247                let member_inline_size =
10248                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10249                if inlined != (member_inline_size <= 4) {
10250                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10251                }
10252                let inner_offset;
10253                let mut inner_depth = depth.clone();
10254                if inlined {
10255                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10256                    inner_offset = next_offset;
10257                } else {
10258                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10259                    inner_depth.increment()?;
10260                }
10261                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10262                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10263                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10264                {
10265                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10266                }
10267                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10268                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10269                }
10270            }
10271
10272            next_offset += envelope_size;
10273            _next_ordinal_to_read += 1;
10274            if next_offset >= end_offset {
10275                return Ok(());
10276            }
10277
10278            // Decode unknown envelopes for gaps in ordinals.
10279            while _next_ordinal_to_read < 7 {
10280                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10281                _next_ordinal_to_read += 1;
10282                next_offset += envelope_size;
10283            }
10284
10285            let next_out_of_line = decoder.next_out_of_line();
10286            let handles_before = decoder.remaining_handles();
10287            if let Some((inlined, num_bytes, num_handles)) =
10288                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10289            {
10290                let member_inline_size =
10291                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10292                if inlined != (member_inline_size <= 4) {
10293                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10294                }
10295                let inner_offset;
10296                let mut inner_depth = depth.clone();
10297                if inlined {
10298                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10299                    inner_offset = next_offset;
10300                } else {
10301                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10302                    inner_depth.increment()?;
10303                }
10304                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
10305                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
10306                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10307                {
10308                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10309                }
10310                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10311                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10312                }
10313            }
10314
10315            next_offset += envelope_size;
10316
10317            // Decode the remaining unknown envelopes.
10318            while next_offset < end_offset {
10319                _next_ordinal_to_read += 1;
10320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10321                next_offset += envelope_size;
10322            }
10323
10324            Ok(())
10325        }
10326    }
10327
10328    impl SensorFeatureReport {
10329        #[inline(always)]
10330        fn max_ordinal_present(&self) -> u64 {
10331            if let Some(_) = self.sampling_rate {
10332                return 6;
10333            }
10334            if let Some(_) = self.threshold_low {
10335                return 5;
10336            }
10337            if let Some(_) = self.threshold_high {
10338                return 4;
10339            }
10340            if let Some(_) = self.reporting_state {
10341                return 3;
10342            }
10343            if let Some(_) = self.sensitivity {
10344                return 2;
10345            }
10346            if let Some(_) = self.report_interval {
10347                return 1;
10348            }
10349            0
10350        }
10351    }
10352
10353    impl fidl::encoding::ValueTypeMarker for SensorFeatureReport {
10354        type Borrowed<'a> = &'a Self;
10355        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10356            value
10357        }
10358    }
10359
10360    unsafe impl fidl::encoding::TypeMarker for SensorFeatureReport {
10361        type Owned = Self;
10362
10363        #[inline(always)]
10364        fn inline_align(_context: fidl::encoding::Context) -> usize {
10365            8
10366        }
10367
10368        #[inline(always)]
10369        fn inline_size(_context: fidl::encoding::Context) -> usize {
10370            16
10371        }
10372    }
10373
10374    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorFeatureReport, D>
10375        for &SensorFeatureReport
10376    {
10377        unsafe fn encode(
10378            self,
10379            encoder: &mut fidl::encoding::Encoder<'_, D>,
10380            offset: usize,
10381            mut depth: fidl::encoding::Depth,
10382        ) -> fidl::Result<()> {
10383            encoder.debug_check_bounds::<SensorFeatureReport>(offset);
10384            // Vector header
10385            let max_ordinal: u64 = self.max_ordinal_present();
10386            encoder.write_num(max_ordinal, offset);
10387            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10388            // Calling encoder.out_of_line_offset(0) is not allowed.
10389            if max_ordinal == 0 {
10390                return Ok(());
10391            }
10392            depth.increment()?;
10393            let envelope_size = 8;
10394            let bytes_len = max_ordinal as usize * envelope_size;
10395            #[allow(unused_variables)]
10396            let offset = encoder.out_of_line_offset(bytes_len);
10397            let mut _prev_end_offset: usize = 0;
10398            if 1 > max_ordinal {
10399                return Ok(());
10400            }
10401
10402            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10403            // are envelope_size bytes.
10404            let cur_offset: usize = (1 - 1) * envelope_size;
10405
10406            // Zero reserved fields.
10407            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10408
10409            // Safety:
10410            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10411            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10412            //   envelope_size bytes, there is always sufficient room.
10413            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10414                self.report_interval.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10415                encoder,
10416                offset + cur_offset,
10417                depth,
10418            )?;
10419
10420            _prev_end_offset = cur_offset + envelope_size;
10421            if 2 > max_ordinal {
10422                return Ok(());
10423            }
10424
10425            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10426            // are envelope_size bytes.
10427            let cur_offset: usize = (2 - 1) * envelope_size;
10428
10429            // Zero reserved fields.
10430            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10431
10432            // Safety:
10433            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10434            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10435            //   envelope_size bytes, there is always sufficient room.
10436            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10437                self.sensitivity.as_ref().map(
10438                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10439                ),
10440                encoder,
10441                offset + cur_offset,
10442                depth,
10443            )?;
10444
10445            _prev_end_offset = cur_offset + envelope_size;
10446            if 3 > max_ordinal {
10447                return Ok(());
10448            }
10449
10450            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10451            // are envelope_size bytes.
10452            let cur_offset: usize = (3 - 1) * envelope_size;
10453
10454            // Zero reserved fields.
10455            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10456
10457            // Safety:
10458            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10459            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10460            //   envelope_size bytes, there is always sufficient room.
10461            fidl::encoding::encode_in_envelope_optional::<SensorReportingState, D>(
10462                self.reporting_state
10463                    .as_ref()
10464                    .map(<SensorReportingState as fidl::encoding::ValueTypeMarker>::borrow),
10465                encoder,
10466                offset + cur_offset,
10467                depth,
10468            )?;
10469
10470            _prev_end_offset = cur_offset + envelope_size;
10471            if 4 > max_ordinal {
10472                return Ok(());
10473            }
10474
10475            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10476            // are envelope_size bytes.
10477            let cur_offset: usize = (4 - 1) * envelope_size;
10478
10479            // Zero reserved fields.
10480            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10481
10482            // Safety:
10483            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10484            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10485            //   envelope_size bytes, there is always sufficient room.
10486            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10487                self.threshold_high.as_ref().map(
10488                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10489                ),
10490                encoder,
10491                offset + cur_offset,
10492                depth,
10493            )?;
10494
10495            _prev_end_offset = cur_offset + envelope_size;
10496            if 5 > max_ordinal {
10497                return Ok(());
10498            }
10499
10500            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10501            // are envelope_size bytes.
10502            let cur_offset: usize = (5 - 1) * envelope_size;
10503
10504            // Zero reserved fields.
10505            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10506
10507            // Safety:
10508            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10509            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10510            //   envelope_size bytes, there is always sufficient room.
10511            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10512                self.threshold_low.as_ref().map(
10513                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10514                ),
10515                encoder,
10516                offset + cur_offset,
10517                depth,
10518            )?;
10519
10520            _prev_end_offset = cur_offset + envelope_size;
10521            if 6 > max_ordinal {
10522                return Ok(());
10523            }
10524
10525            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10526            // are envelope_size bytes.
10527            let cur_offset: usize = (6 - 1) * envelope_size;
10528
10529            // Zero reserved fields.
10530            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10531
10532            // Safety:
10533            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10534            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10535            //   envelope_size bytes, there is always sufficient room.
10536            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10537                self.sampling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10538                encoder,
10539                offset + cur_offset,
10540                depth,
10541            )?;
10542
10543            _prev_end_offset = cur_offset + envelope_size;
10544
10545            Ok(())
10546        }
10547    }
10548
10549    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorFeatureReport {
10550        #[inline(always)]
10551        fn new_empty() -> Self {
10552            Self::default()
10553        }
10554
10555        unsafe fn decode(
10556            &mut self,
10557            decoder: &mut fidl::encoding::Decoder<'_, D>,
10558            offset: usize,
10559            mut depth: fidl::encoding::Depth,
10560        ) -> fidl::Result<()> {
10561            decoder.debug_check_bounds::<Self>(offset);
10562            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10563                None => return Err(fidl::Error::NotNullable),
10564                Some(len) => len,
10565            };
10566            // Calling decoder.out_of_line_offset(0) is not allowed.
10567            if len == 0 {
10568                return Ok(());
10569            };
10570            depth.increment()?;
10571            let envelope_size = 8;
10572            let bytes_len = len * envelope_size;
10573            let offset = decoder.out_of_line_offset(bytes_len)?;
10574            // Decode the envelope for each type.
10575            let mut _next_ordinal_to_read = 0;
10576            let mut next_offset = offset;
10577            let end_offset = offset + bytes_len;
10578            _next_ordinal_to_read += 1;
10579            if next_offset >= end_offset {
10580                return Ok(());
10581            }
10582
10583            // Decode unknown envelopes for gaps in ordinals.
10584            while _next_ordinal_to_read < 1 {
10585                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10586                _next_ordinal_to_read += 1;
10587                next_offset += envelope_size;
10588            }
10589
10590            let next_out_of_line = decoder.next_out_of_line();
10591            let handles_before = decoder.remaining_handles();
10592            if let Some((inlined, num_bytes, num_handles)) =
10593                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10594            {
10595                let member_inline_size =
10596                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10597                if inlined != (member_inline_size <= 4) {
10598                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10599                }
10600                let inner_offset;
10601                let mut inner_depth = depth.clone();
10602                if inlined {
10603                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10604                    inner_offset = next_offset;
10605                } else {
10606                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10607                    inner_depth.increment()?;
10608                }
10609                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(i64, D));
10610                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10612                {
10613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10614                }
10615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10617                }
10618            }
10619
10620            next_offset += envelope_size;
10621            _next_ordinal_to_read += 1;
10622            if next_offset >= end_offset {
10623                return Ok(());
10624            }
10625
10626            // Decode unknown envelopes for gaps in ordinals.
10627            while _next_ordinal_to_read < 2 {
10628                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10629                _next_ordinal_to_read += 1;
10630                next_offset += envelope_size;
10631            }
10632
10633            let next_out_of_line = decoder.next_out_of_line();
10634            let handles_before = decoder.remaining_handles();
10635            if let Some((inlined, num_bytes, num_handles)) =
10636                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10637            {
10638                let member_inline_size =
10639                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10640                        decoder.context,
10641                    );
10642                if inlined != (member_inline_size <= 4) {
10643                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10644                }
10645                let inner_offset;
10646                let mut inner_depth = depth.clone();
10647                if inlined {
10648                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10649                    inner_offset = next_offset;
10650                } else {
10651                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10652                    inner_depth.increment()?;
10653                }
10654                let val_ref = self
10655                    .sensitivity
10656                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10657                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10659                {
10660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10661                }
10662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10664                }
10665            }
10666
10667            next_offset += envelope_size;
10668            _next_ordinal_to_read += 1;
10669            if next_offset >= end_offset {
10670                return Ok(());
10671            }
10672
10673            // Decode unknown envelopes for gaps in ordinals.
10674            while _next_ordinal_to_read < 3 {
10675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10676                _next_ordinal_to_read += 1;
10677                next_offset += envelope_size;
10678            }
10679
10680            let next_out_of_line = decoder.next_out_of_line();
10681            let handles_before = decoder.remaining_handles();
10682            if let Some((inlined, num_bytes, num_handles)) =
10683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10684            {
10685                let member_inline_size =
10686                    <SensorReportingState as fidl::encoding::TypeMarker>::inline_size(
10687                        decoder.context,
10688                    );
10689                if inlined != (member_inline_size <= 4) {
10690                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10691                }
10692                let inner_offset;
10693                let mut inner_depth = depth.clone();
10694                if inlined {
10695                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10696                    inner_offset = next_offset;
10697                } else {
10698                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10699                    inner_depth.increment()?;
10700                }
10701                let val_ref = self
10702                    .reporting_state
10703                    .get_or_insert_with(|| fidl::new_empty!(SensorReportingState, D));
10704                fidl::decode!(
10705                    SensorReportingState,
10706                    D,
10707                    val_ref,
10708                    decoder,
10709                    inner_offset,
10710                    inner_depth
10711                )?;
10712                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10713                {
10714                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10715                }
10716                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10717                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10718                }
10719            }
10720
10721            next_offset += envelope_size;
10722            _next_ordinal_to_read += 1;
10723            if next_offset >= end_offset {
10724                return Ok(());
10725            }
10726
10727            // Decode unknown envelopes for gaps in ordinals.
10728            while _next_ordinal_to_read < 4 {
10729                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10730                _next_ordinal_to_read += 1;
10731                next_offset += envelope_size;
10732            }
10733
10734            let next_out_of_line = decoder.next_out_of_line();
10735            let handles_before = decoder.remaining_handles();
10736            if let Some((inlined, num_bytes, num_handles)) =
10737                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10738            {
10739                let member_inline_size =
10740                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10741                        decoder.context,
10742                    );
10743                if inlined != (member_inline_size <= 4) {
10744                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10745                }
10746                let inner_offset;
10747                let mut inner_depth = depth.clone();
10748                if inlined {
10749                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10750                    inner_offset = next_offset;
10751                } else {
10752                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10753                    inner_depth.increment()?;
10754                }
10755                let val_ref = self
10756                    .threshold_high
10757                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10758                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10759                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10760                {
10761                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10762                }
10763                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10764                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10765                }
10766            }
10767
10768            next_offset += envelope_size;
10769            _next_ordinal_to_read += 1;
10770            if next_offset >= end_offset {
10771                return Ok(());
10772            }
10773
10774            // Decode unknown envelopes for gaps in ordinals.
10775            while _next_ordinal_to_read < 5 {
10776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10777                _next_ordinal_to_read += 1;
10778                next_offset += envelope_size;
10779            }
10780
10781            let next_out_of_line = decoder.next_out_of_line();
10782            let handles_before = decoder.remaining_handles();
10783            if let Some((inlined, num_bytes, num_handles)) =
10784                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10785            {
10786                let member_inline_size =
10787                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10788                        decoder.context,
10789                    );
10790                if inlined != (member_inline_size <= 4) {
10791                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10792                }
10793                let inner_offset;
10794                let mut inner_depth = depth.clone();
10795                if inlined {
10796                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10797                    inner_offset = next_offset;
10798                } else {
10799                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10800                    inner_depth.increment()?;
10801                }
10802                let val_ref = self
10803                    .threshold_low
10804                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10805                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10806                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10807                {
10808                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10809                }
10810                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10811                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10812                }
10813            }
10814
10815            next_offset += envelope_size;
10816            _next_ordinal_to_read += 1;
10817            if next_offset >= end_offset {
10818                return Ok(());
10819            }
10820
10821            // Decode unknown envelopes for gaps in ordinals.
10822            while _next_ordinal_to_read < 6 {
10823                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10824                _next_ordinal_to_read += 1;
10825                next_offset += envelope_size;
10826            }
10827
10828            let next_out_of_line = decoder.next_out_of_line();
10829            let handles_before = decoder.remaining_handles();
10830            if let Some((inlined, num_bytes, num_handles)) =
10831                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10832            {
10833                let member_inline_size =
10834                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10835                if inlined != (member_inline_size <= 4) {
10836                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10837                }
10838                let inner_offset;
10839                let mut inner_depth = depth.clone();
10840                if inlined {
10841                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10842                    inner_offset = next_offset;
10843                } else {
10844                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10845                    inner_depth.increment()?;
10846                }
10847                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
10848                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10849                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10850                {
10851                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10852                }
10853                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10854                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10855                }
10856            }
10857
10858            next_offset += envelope_size;
10859
10860            // Decode the remaining unknown envelopes.
10861            while next_offset < end_offset {
10862                _next_ordinal_to_read += 1;
10863                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10864                next_offset += envelope_size;
10865            }
10866
10867            Ok(())
10868        }
10869    }
10870
10871    impl SensorInputDescriptor {
10872        #[inline(always)]
10873        fn max_ordinal_present(&self) -> u64 {
10874            if let Some(_) = self.report_id {
10875                return 2;
10876            }
10877            if let Some(_) = self.values {
10878                return 1;
10879            }
10880            0
10881        }
10882    }
10883
10884    impl fidl::encoding::ValueTypeMarker for SensorInputDescriptor {
10885        type Borrowed<'a> = &'a Self;
10886        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10887            value
10888        }
10889    }
10890
10891    unsafe impl fidl::encoding::TypeMarker for SensorInputDescriptor {
10892        type Owned = Self;
10893
10894        #[inline(always)]
10895        fn inline_align(_context: fidl::encoding::Context) -> usize {
10896            8
10897        }
10898
10899        #[inline(always)]
10900        fn inline_size(_context: fidl::encoding::Context) -> usize {
10901            16
10902        }
10903    }
10904
10905    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputDescriptor, D>
10906        for &SensorInputDescriptor
10907    {
10908        unsafe fn encode(
10909            self,
10910            encoder: &mut fidl::encoding::Encoder<'_, D>,
10911            offset: usize,
10912            mut depth: fidl::encoding::Depth,
10913        ) -> fidl::Result<()> {
10914            encoder.debug_check_bounds::<SensorInputDescriptor>(offset);
10915            // Vector header
10916            let max_ordinal: u64 = self.max_ordinal_present();
10917            encoder.write_num(max_ordinal, offset);
10918            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10919            // Calling encoder.out_of_line_offset(0) is not allowed.
10920            if max_ordinal == 0 {
10921                return Ok(());
10922            }
10923            depth.increment()?;
10924            let envelope_size = 8;
10925            let bytes_len = max_ordinal as usize * envelope_size;
10926            #[allow(unused_variables)]
10927            let offset = encoder.out_of_line_offset(bytes_len);
10928            let mut _prev_end_offset: usize = 0;
10929            if 1 > max_ordinal {
10930                return Ok(());
10931            }
10932
10933            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10934            // are envelope_size bytes.
10935            let cur_offset: usize = (1 - 1) * envelope_size;
10936
10937            // Zero reserved fields.
10938            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10939
10940            // Safety:
10941            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10942            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10943            //   envelope_size bytes, there is always sufficient room.
10944            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
10945            self.values.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
10946            encoder, offset + cur_offset, depth
10947        )?;
10948
10949            _prev_end_offset = cur_offset + envelope_size;
10950            if 2 > max_ordinal {
10951                return Ok(());
10952            }
10953
10954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10955            // are envelope_size bytes.
10956            let cur_offset: usize = (2 - 1) * envelope_size;
10957
10958            // Zero reserved fields.
10959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10960
10961            // Safety:
10962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10964            //   envelope_size bytes, there is always sufficient room.
10965            fidl::encoding::encode_in_envelope_optional::<u8, D>(
10966                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
10967                encoder,
10968                offset + cur_offset,
10969                depth,
10970            )?;
10971
10972            _prev_end_offset = cur_offset + envelope_size;
10973
10974            Ok(())
10975        }
10976    }
10977
10978    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputDescriptor {
10979        #[inline(always)]
10980        fn new_empty() -> Self {
10981            Self::default()
10982        }
10983
10984        unsafe fn decode(
10985            &mut self,
10986            decoder: &mut fidl::encoding::Decoder<'_, D>,
10987            offset: usize,
10988            mut depth: fidl::encoding::Depth,
10989        ) -> fidl::Result<()> {
10990            decoder.debug_check_bounds::<Self>(offset);
10991            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10992                None => return Err(fidl::Error::NotNullable),
10993                Some(len) => len,
10994            };
10995            // Calling decoder.out_of_line_offset(0) is not allowed.
10996            if len == 0 {
10997                return Ok(());
10998            };
10999            depth.increment()?;
11000            let envelope_size = 8;
11001            let bytes_len = len * envelope_size;
11002            let offset = decoder.out_of_line_offset(bytes_len)?;
11003            // Decode the envelope for each type.
11004            let mut _next_ordinal_to_read = 0;
11005            let mut next_offset = offset;
11006            let end_offset = offset + bytes_len;
11007            _next_ordinal_to_read += 1;
11008            if next_offset >= end_offset {
11009                return Ok(());
11010            }
11011
11012            // Decode unknown envelopes for gaps in ordinals.
11013            while _next_ordinal_to_read < 1 {
11014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11015                _next_ordinal_to_read += 1;
11016                next_offset += envelope_size;
11017            }
11018
11019            let next_out_of_line = decoder.next_out_of_line();
11020            let handles_before = decoder.remaining_handles();
11021            if let Some((inlined, num_bytes, num_handles)) =
11022                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11023            {
11024                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11025                if inlined != (member_inline_size <= 4) {
11026                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11027                }
11028                let inner_offset;
11029                let mut inner_depth = depth.clone();
11030                if inlined {
11031                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11032                    inner_offset = next_offset;
11033                } else {
11034                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11035                    inner_depth.increment()?;
11036                }
11037                let val_ref = self.values.get_or_insert_with(
11038                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
11039                );
11040                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11041                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11042                {
11043                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11044                }
11045                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11046                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11047                }
11048            }
11049
11050            next_offset += envelope_size;
11051            _next_ordinal_to_read += 1;
11052            if next_offset >= end_offset {
11053                return Ok(());
11054            }
11055
11056            // Decode unknown envelopes for gaps in ordinals.
11057            while _next_ordinal_to_read < 2 {
11058                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11059                _next_ordinal_to_read += 1;
11060                next_offset += envelope_size;
11061            }
11062
11063            let next_out_of_line = decoder.next_out_of_line();
11064            let handles_before = decoder.remaining_handles();
11065            if let Some((inlined, num_bytes, num_handles)) =
11066                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11067            {
11068                let member_inline_size =
11069                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11070                if inlined != (member_inline_size <= 4) {
11071                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11072                }
11073                let inner_offset;
11074                let mut inner_depth = depth.clone();
11075                if inlined {
11076                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11077                    inner_offset = next_offset;
11078                } else {
11079                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11080                    inner_depth.increment()?;
11081                }
11082                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
11083                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
11084                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11085                {
11086                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11087                }
11088                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11089                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11090                }
11091            }
11092
11093            next_offset += envelope_size;
11094
11095            // Decode the remaining unknown envelopes.
11096            while next_offset < end_offset {
11097                _next_ordinal_to_read += 1;
11098                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11099                next_offset += envelope_size;
11100            }
11101
11102            Ok(())
11103        }
11104    }
11105
11106    impl SensorInputReport {
11107        #[inline(always)]
11108        fn max_ordinal_present(&self) -> u64 {
11109            if let Some(_) = self.values {
11110                return 1;
11111            }
11112            0
11113        }
11114    }
11115
11116    impl fidl::encoding::ValueTypeMarker for SensorInputReport {
11117        type Borrowed<'a> = &'a Self;
11118        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11119            value
11120        }
11121    }
11122
11123    unsafe impl fidl::encoding::TypeMarker for SensorInputReport {
11124        type Owned = Self;
11125
11126        #[inline(always)]
11127        fn inline_align(_context: fidl::encoding::Context) -> usize {
11128            8
11129        }
11130
11131        #[inline(always)]
11132        fn inline_size(_context: fidl::encoding::Context) -> usize {
11133            16
11134        }
11135    }
11136
11137    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputReport, D>
11138        for &SensorInputReport
11139    {
11140        unsafe fn encode(
11141            self,
11142            encoder: &mut fidl::encoding::Encoder<'_, D>,
11143            offset: usize,
11144            mut depth: fidl::encoding::Depth,
11145        ) -> fidl::Result<()> {
11146            encoder.debug_check_bounds::<SensorInputReport>(offset);
11147            // Vector header
11148            let max_ordinal: u64 = self.max_ordinal_present();
11149            encoder.write_num(max_ordinal, offset);
11150            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11151            // Calling encoder.out_of_line_offset(0) is not allowed.
11152            if max_ordinal == 0 {
11153                return Ok(());
11154            }
11155            depth.increment()?;
11156            let envelope_size = 8;
11157            let bytes_len = max_ordinal as usize * envelope_size;
11158            #[allow(unused_variables)]
11159            let offset = encoder.out_of_line_offset(bytes_len);
11160            let mut _prev_end_offset: usize = 0;
11161            if 1 > max_ordinal {
11162                return Ok(());
11163            }
11164
11165            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11166            // are envelope_size bytes.
11167            let cur_offset: usize = (1 - 1) * envelope_size;
11168
11169            // Zero reserved fields.
11170            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11171
11172            // Safety:
11173            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11174            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11175            //   envelope_size bytes, there is always sufficient room.
11176            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
11177                self.values.as_ref().map(
11178                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
11179                ),
11180                encoder,
11181                offset + cur_offset,
11182                depth,
11183            )?;
11184
11185            _prev_end_offset = cur_offset + envelope_size;
11186
11187            Ok(())
11188        }
11189    }
11190
11191    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputReport {
11192        #[inline(always)]
11193        fn new_empty() -> Self {
11194            Self::default()
11195        }
11196
11197        unsafe fn decode(
11198            &mut self,
11199            decoder: &mut fidl::encoding::Decoder<'_, D>,
11200            offset: usize,
11201            mut depth: fidl::encoding::Depth,
11202        ) -> fidl::Result<()> {
11203            decoder.debug_check_bounds::<Self>(offset);
11204            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11205                None => return Err(fidl::Error::NotNullable),
11206                Some(len) => len,
11207            };
11208            // Calling decoder.out_of_line_offset(0) is not allowed.
11209            if len == 0 {
11210                return Ok(());
11211            };
11212            depth.increment()?;
11213            let envelope_size = 8;
11214            let bytes_len = len * envelope_size;
11215            let offset = decoder.out_of_line_offset(bytes_len)?;
11216            // Decode the envelope for each type.
11217            let mut _next_ordinal_to_read = 0;
11218            let mut next_offset = offset;
11219            let end_offset = offset + bytes_len;
11220            _next_ordinal_to_read += 1;
11221            if next_offset >= end_offset {
11222                return Ok(());
11223            }
11224
11225            // Decode unknown envelopes for gaps in ordinals.
11226            while _next_ordinal_to_read < 1 {
11227                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11228                _next_ordinal_to_read += 1;
11229                next_offset += envelope_size;
11230            }
11231
11232            let next_out_of_line = decoder.next_out_of_line();
11233            let handles_before = decoder.remaining_handles();
11234            if let Some((inlined, num_bytes, num_handles)) =
11235                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11236            {
11237                let member_inline_size =
11238                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
11239                        decoder.context,
11240                    );
11241                if inlined != (member_inline_size <= 4) {
11242                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11243                }
11244                let inner_offset;
11245                let mut inner_depth = depth.clone();
11246                if inlined {
11247                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11248                    inner_offset = next_offset;
11249                } else {
11250                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11251                    inner_depth.increment()?;
11252                }
11253                let val_ref = self
11254                    .values
11255                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
11256                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11257                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11258                {
11259                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11260                }
11261                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11262                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11263                }
11264            }
11265
11266            next_offset += envelope_size;
11267
11268            // Decode the remaining unknown envelopes.
11269            while next_offset < end_offset {
11270                _next_ordinal_to_read += 1;
11271                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11272                next_offset += envelope_size;
11273            }
11274
11275            Ok(())
11276        }
11277    }
11278
11279    impl TouchDescriptor {
11280        #[inline(always)]
11281        fn max_ordinal_present(&self) -> u64 {
11282            if let Some(_) = self.feature {
11283                return 2;
11284            }
11285            if let Some(_) = self.input {
11286                return 1;
11287            }
11288            0
11289        }
11290    }
11291
11292    impl fidl::encoding::ValueTypeMarker for TouchDescriptor {
11293        type Borrowed<'a> = &'a Self;
11294        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11295            value
11296        }
11297    }
11298
11299    unsafe impl fidl::encoding::TypeMarker for TouchDescriptor {
11300        type Owned = Self;
11301
11302        #[inline(always)]
11303        fn inline_align(_context: fidl::encoding::Context) -> usize {
11304            8
11305        }
11306
11307        #[inline(always)]
11308        fn inline_size(_context: fidl::encoding::Context) -> usize {
11309            16
11310        }
11311    }
11312
11313    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDescriptor, D>
11314        for &TouchDescriptor
11315    {
11316        unsafe fn encode(
11317            self,
11318            encoder: &mut fidl::encoding::Encoder<'_, D>,
11319            offset: usize,
11320            mut depth: fidl::encoding::Depth,
11321        ) -> fidl::Result<()> {
11322            encoder.debug_check_bounds::<TouchDescriptor>(offset);
11323            // Vector header
11324            let max_ordinal: u64 = self.max_ordinal_present();
11325            encoder.write_num(max_ordinal, offset);
11326            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11327            // Calling encoder.out_of_line_offset(0) is not allowed.
11328            if max_ordinal == 0 {
11329                return Ok(());
11330            }
11331            depth.increment()?;
11332            let envelope_size = 8;
11333            let bytes_len = max_ordinal as usize * envelope_size;
11334            #[allow(unused_variables)]
11335            let offset = encoder.out_of_line_offset(bytes_len);
11336            let mut _prev_end_offset: usize = 0;
11337            if 1 > max_ordinal {
11338                return Ok(());
11339            }
11340
11341            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11342            // are envelope_size bytes.
11343            let cur_offset: usize = (1 - 1) * envelope_size;
11344
11345            // Zero reserved fields.
11346            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11347
11348            // Safety:
11349            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11350            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11351            //   envelope_size bytes, there is always sufficient room.
11352            fidl::encoding::encode_in_envelope_optional::<TouchInputDescriptor, D>(
11353                self.input
11354                    .as_ref()
11355                    .map(<TouchInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11356                encoder,
11357                offset + cur_offset,
11358                depth,
11359            )?;
11360
11361            _prev_end_offset = cur_offset + envelope_size;
11362            if 2 > max_ordinal {
11363                return Ok(());
11364            }
11365
11366            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11367            // are envelope_size bytes.
11368            let cur_offset: usize = (2 - 1) * envelope_size;
11369
11370            // Zero reserved fields.
11371            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11372
11373            // Safety:
11374            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11375            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11376            //   envelope_size bytes, there is always sufficient room.
11377            fidl::encoding::encode_in_envelope_optional::<TouchFeatureDescriptor, D>(
11378                self.feature
11379                    .as_ref()
11380                    .map(<TouchFeatureDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11381                encoder,
11382                offset + cur_offset,
11383                depth,
11384            )?;
11385
11386            _prev_end_offset = cur_offset + envelope_size;
11387
11388            Ok(())
11389        }
11390    }
11391
11392    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDescriptor {
11393        #[inline(always)]
11394        fn new_empty() -> Self {
11395            Self::default()
11396        }
11397
11398        unsafe fn decode(
11399            &mut self,
11400            decoder: &mut fidl::encoding::Decoder<'_, D>,
11401            offset: usize,
11402            mut depth: fidl::encoding::Depth,
11403        ) -> fidl::Result<()> {
11404            decoder.debug_check_bounds::<Self>(offset);
11405            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11406                None => return Err(fidl::Error::NotNullable),
11407                Some(len) => len,
11408            };
11409            // Calling decoder.out_of_line_offset(0) is not allowed.
11410            if len == 0 {
11411                return Ok(());
11412            };
11413            depth.increment()?;
11414            let envelope_size = 8;
11415            let bytes_len = len * envelope_size;
11416            let offset = decoder.out_of_line_offset(bytes_len)?;
11417            // Decode the envelope for each type.
11418            let mut _next_ordinal_to_read = 0;
11419            let mut next_offset = offset;
11420            let end_offset = offset + bytes_len;
11421            _next_ordinal_to_read += 1;
11422            if next_offset >= end_offset {
11423                return Ok(());
11424            }
11425
11426            // Decode unknown envelopes for gaps in ordinals.
11427            while _next_ordinal_to_read < 1 {
11428                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11429                _next_ordinal_to_read += 1;
11430                next_offset += envelope_size;
11431            }
11432
11433            let next_out_of_line = decoder.next_out_of_line();
11434            let handles_before = decoder.remaining_handles();
11435            if let Some((inlined, num_bytes, num_handles)) =
11436                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11437            {
11438                let member_inline_size =
11439                    <TouchInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
11440                        decoder.context,
11441                    );
11442                if inlined != (member_inline_size <= 4) {
11443                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11444                }
11445                let inner_offset;
11446                let mut inner_depth = depth.clone();
11447                if inlined {
11448                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11449                    inner_offset = next_offset;
11450                } else {
11451                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11452                    inner_depth.increment()?;
11453                }
11454                let val_ref =
11455                    self.input.get_or_insert_with(|| fidl::new_empty!(TouchInputDescriptor, D));
11456                fidl::decode!(
11457                    TouchInputDescriptor,
11458                    D,
11459                    val_ref,
11460                    decoder,
11461                    inner_offset,
11462                    inner_depth
11463                )?;
11464                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11465                {
11466                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11467                }
11468                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11469                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11470                }
11471            }
11472
11473            next_offset += envelope_size;
11474            _next_ordinal_to_read += 1;
11475            if next_offset >= end_offset {
11476                return Ok(());
11477            }
11478
11479            // Decode unknown envelopes for gaps in ordinals.
11480            while _next_ordinal_to_read < 2 {
11481                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11482                _next_ordinal_to_read += 1;
11483                next_offset += envelope_size;
11484            }
11485
11486            let next_out_of_line = decoder.next_out_of_line();
11487            let handles_before = decoder.remaining_handles();
11488            if let Some((inlined, num_bytes, num_handles)) =
11489                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11490            {
11491                let member_inline_size =
11492                    <TouchFeatureDescriptor as fidl::encoding::TypeMarker>::inline_size(
11493                        decoder.context,
11494                    );
11495                if inlined != (member_inline_size <= 4) {
11496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11497                }
11498                let inner_offset;
11499                let mut inner_depth = depth.clone();
11500                if inlined {
11501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11502                    inner_offset = next_offset;
11503                } else {
11504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11505                    inner_depth.increment()?;
11506                }
11507                let val_ref =
11508                    self.feature.get_or_insert_with(|| fidl::new_empty!(TouchFeatureDescriptor, D));
11509                fidl::decode!(
11510                    TouchFeatureDescriptor,
11511                    D,
11512                    val_ref,
11513                    decoder,
11514                    inner_offset,
11515                    inner_depth
11516                )?;
11517                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11518                {
11519                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11520                }
11521                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11522                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11523                }
11524            }
11525
11526            next_offset += envelope_size;
11527
11528            // Decode the remaining unknown envelopes.
11529            while next_offset < end_offset {
11530                _next_ordinal_to_read += 1;
11531                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11532                next_offset += envelope_size;
11533            }
11534
11535            Ok(())
11536        }
11537    }
11538
11539    impl TouchFeatureDescriptor {
11540        #[inline(always)]
11541        fn max_ordinal_present(&self) -> u64 {
11542            if let Some(_) = self.supports_selective_reporting {
11543                return 2;
11544            }
11545            if let Some(_) = self.supports_input_mode {
11546                return 1;
11547            }
11548            0
11549        }
11550    }
11551
11552    impl fidl::encoding::ValueTypeMarker for TouchFeatureDescriptor {
11553        type Borrowed<'a> = &'a Self;
11554        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11555            value
11556        }
11557    }
11558
11559    unsafe impl fidl::encoding::TypeMarker for TouchFeatureDescriptor {
11560        type Owned = Self;
11561
11562        #[inline(always)]
11563        fn inline_align(_context: fidl::encoding::Context) -> usize {
11564            8
11565        }
11566
11567        #[inline(always)]
11568        fn inline_size(_context: fidl::encoding::Context) -> usize {
11569            16
11570        }
11571    }
11572
11573    unsafe impl<D: fidl::encoding::ResourceDialect>
11574        fidl::encoding::Encode<TouchFeatureDescriptor, D> for &TouchFeatureDescriptor
11575    {
11576        unsafe fn encode(
11577            self,
11578            encoder: &mut fidl::encoding::Encoder<'_, D>,
11579            offset: usize,
11580            mut depth: fidl::encoding::Depth,
11581        ) -> fidl::Result<()> {
11582            encoder.debug_check_bounds::<TouchFeatureDescriptor>(offset);
11583            // Vector header
11584            let max_ordinal: u64 = self.max_ordinal_present();
11585            encoder.write_num(max_ordinal, offset);
11586            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11587            // Calling encoder.out_of_line_offset(0) is not allowed.
11588            if max_ordinal == 0 {
11589                return Ok(());
11590            }
11591            depth.increment()?;
11592            let envelope_size = 8;
11593            let bytes_len = max_ordinal as usize * envelope_size;
11594            #[allow(unused_variables)]
11595            let offset = encoder.out_of_line_offset(bytes_len);
11596            let mut _prev_end_offset: usize = 0;
11597            if 1 > max_ordinal {
11598                return Ok(());
11599            }
11600
11601            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11602            // are envelope_size bytes.
11603            let cur_offset: usize = (1 - 1) * envelope_size;
11604
11605            // Zero reserved fields.
11606            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11607
11608            // Safety:
11609            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11610            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11611            //   envelope_size bytes, there is always sufficient room.
11612            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11613                self.supports_input_mode
11614                    .as_ref()
11615                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11616                encoder,
11617                offset + cur_offset,
11618                depth,
11619            )?;
11620
11621            _prev_end_offset = cur_offset + envelope_size;
11622            if 2 > max_ordinal {
11623                return Ok(());
11624            }
11625
11626            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11627            // are envelope_size bytes.
11628            let cur_offset: usize = (2 - 1) * envelope_size;
11629
11630            // Zero reserved fields.
11631            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11632
11633            // Safety:
11634            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11635            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11636            //   envelope_size bytes, there is always sufficient room.
11637            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11638                self.supports_selective_reporting
11639                    .as_ref()
11640                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11641                encoder,
11642                offset + cur_offset,
11643                depth,
11644            )?;
11645
11646            _prev_end_offset = cur_offset + envelope_size;
11647
11648            Ok(())
11649        }
11650    }
11651
11652    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11653        for TouchFeatureDescriptor
11654    {
11655        #[inline(always)]
11656        fn new_empty() -> Self {
11657            Self::default()
11658        }
11659
11660        unsafe fn decode(
11661            &mut self,
11662            decoder: &mut fidl::encoding::Decoder<'_, D>,
11663            offset: usize,
11664            mut depth: fidl::encoding::Depth,
11665        ) -> fidl::Result<()> {
11666            decoder.debug_check_bounds::<Self>(offset);
11667            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11668                None => return Err(fidl::Error::NotNullable),
11669                Some(len) => len,
11670            };
11671            // Calling decoder.out_of_line_offset(0) is not allowed.
11672            if len == 0 {
11673                return Ok(());
11674            };
11675            depth.increment()?;
11676            let envelope_size = 8;
11677            let bytes_len = len * envelope_size;
11678            let offset = decoder.out_of_line_offset(bytes_len)?;
11679            // Decode the envelope for each type.
11680            let mut _next_ordinal_to_read = 0;
11681            let mut next_offset = offset;
11682            let end_offset = offset + bytes_len;
11683            _next_ordinal_to_read += 1;
11684            if next_offset >= end_offset {
11685                return Ok(());
11686            }
11687
11688            // Decode unknown envelopes for gaps in ordinals.
11689            while _next_ordinal_to_read < 1 {
11690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11691                _next_ordinal_to_read += 1;
11692                next_offset += envelope_size;
11693            }
11694
11695            let next_out_of_line = decoder.next_out_of_line();
11696            let handles_before = decoder.remaining_handles();
11697            if let Some((inlined, num_bytes, num_handles)) =
11698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11699            {
11700                let member_inline_size =
11701                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11702                if inlined != (member_inline_size <= 4) {
11703                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11704                }
11705                let inner_offset;
11706                let mut inner_depth = depth.clone();
11707                if inlined {
11708                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11709                    inner_offset = next_offset;
11710                } else {
11711                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11712                    inner_depth.increment()?;
11713                }
11714                let val_ref =
11715                    self.supports_input_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
11716                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11717                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11718                {
11719                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11720                }
11721                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11722                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11723                }
11724            }
11725
11726            next_offset += envelope_size;
11727            _next_ordinal_to_read += 1;
11728            if next_offset >= end_offset {
11729                return Ok(());
11730            }
11731
11732            // Decode unknown envelopes for gaps in ordinals.
11733            while _next_ordinal_to_read < 2 {
11734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11735                _next_ordinal_to_read += 1;
11736                next_offset += envelope_size;
11737            }
11738
11739            let next_out_of_line = decoder.next_out_of_line();
11740            let handles_before = decoder.remaining_handles();
11741            if let Some((inlined, num_bytes, num_handles)) =
11742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11743            {
11744                let member_inline_size =
11745                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11746                if inlined != (member_inline_size <= 4) {
11747                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11748                }
11749                let inner_offset;
11750                let mut inner_depth = depth.clone();
11751                if inlined {
11752                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11753                    inner_offset = next_offset;
11754                } else {
11755                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11756                    inner_depth.increment()?;
11757                }
11758                let val_ref = self
11759                    .supports_selective_reporting
11760                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
11761                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11762                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11763                {
11764                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11765                }
11766                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11767                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11768                }
11769            }
11770
11771            next_offset += envelope_size;
11772
11773            // Decode the remaining unknown envelopes.
11774            while next_offset < end_offset {
11775                _next_ordinal_to_read += 1;
11776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11777                next_offset += envelope_size;
11778            }
11779
11780            Ok(())
11781        }
11782    }
11783
11784    impl TouchFeatureReport {
11785        #[inline(always)]
11786        fn max_ordinal_present(&self) -> u64 {
11787            if let Some(_) = self.selective_reporting {
11788                return 2;
11789            }
11790            if let Some(_) = self.input_mode {
11791                return 1;
11792            }
11793            0
11794        }
11795    }
11796
11797    impl fidl::encoding::ValueTypeMarker for TouchFeatureReport {
11798        type Borrowed<'a> = &'a Self;
11799        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11800            value
11801        }
11802    }
11803
11804    unsafe impl fidl::encoding::TypeMarker for TouchFeatureReport {
11805        type Owned = Self;
11806
11807        #[inline(always)]
11808        fn inline_align(_context: fidl::encoding::Context) -> usize {
11809            8
11810        }
11811
11812        #[inline(always)]
11813        fn inline_size(_context: fidl::encoding::Context) -> usize {
11814            16
11815        }
11816    }
11817
11818    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchFeatureReport, D>
11819        for &TouchFeatureReport
11820    {
11821        unsafe fn encode(
11822            self,
11823            encoder: &mut fidl::encoding::Encoder<'_, D>,
11824            offset: usize,
11825            mut depth: fidl::encoding::Depth,
11826        ) -> fidl::Result<()> {
11827            encoder.debug_check_bounds::<TouchFeatureReport>(offset);
11828            // Vector header
11829            let max_ordinal: u64 = self.max_ordinal_present();
11830            encoder.write_num(max_ordinal, offset);
11831            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11832            // Calling encoder.out_of_line_offset(0) is not allowed.
11833            if max_ordinal == 0 {
11834                return Ok(());
11835            }
11836            depth.increment()?;
11837            let envelope_size = 8;
11838            let bytes_len = max_ordinal as usize * envelope_size;
11839            #[allow(unused_variables)]
11840            let offset = encoder.out_of_line_offset(bytes_len);
11841            let mut _prev_end_offset: usize = 0;
11842            if 1 > max_ordinal {
11843                return Ok(());
11844            }
11845
11846            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11847            // are envelope_size bytes.
11848            let cur_offset: usize = (1 - 1) * envelope_size;
11849
11850            // Zero reserved fields.
11851            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11852
11853            // Safety:
11854            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11855            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11856            //   envelope_size bytes, there is always sufficient room.
11857            fidl::encoding::encode_in_envelope_optional::<TouchConfigurationInputMode, D>(
11858                self.input_mode
11859                    .as_ref()
11860                    .map(<TouchConfigurationInputMode as fidl::encoding::ValueTypeMarker>::borrow),
11861                encoder,
11862                offset + cur_offset,
11863                depth,
11864            )?;
11865
11866            _prev_end_offset = cur_offset + envelope_size;
11867            if 2 > max_ordinal {
11868                return Ok(());
11869            }
11870
11871            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11872            // are envelope_size bytes.
11873            let cur_offset: usize = (2 - 1) * envelope_size;
11874
11875            // Zero reserved fields.
11876            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11877
11878            // Safety:
11879            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11880            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11881            //   envelope_size bytes, there is always sufficient room.
11882            fidl::encoding::encode_in_envelope_optional::<SelectiveReportingFeatureReport, D>(
11883                self.selective_reporting.as_ref().map(
11884                    <SelectiveReportingFeatureReport as fidl::encoding::ValueTypeMarker>::borrow,
11885                ),
11886                encoder,
11887                offset + cur_offset,
11888                depth,
11889            )?;
11890
11891            _prev_end_offset = cur_offset + envelope_size;
11892
11893            Ok(())
11894        }
11895    }
11896
11897    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchFeatureReport {
11898        #[inline(always)]
11899        fn new_empty() -> Self {
11900            Self::default()
11901        }
11902
11903        unsafe fn decode(
11904            &mut self,
11905            decoder: &mut fidl::encoding::Decoder<'_, D>,
11906            offset: usize,
11907            mut depth: fidl::encoding::Depth,
11908        ) -> fidl::Result<()> {
11909            decoder.debug_check_bounds::<Self>(offset);
11910            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11911                None => return Err(fidl::Error::NotNullable),
11912                Some(len) => len,
11913            };
11914            // Calling decoder.out_of_line_offset(0) is not allowed.
11915            if len == 0 {
11916                return Ok(());
11917            };
11918            depth.increment()?;
11919            let envelope_size = 8;
11920            let bytes_len = len * envelope_size;
11921            let offset = decoder.out_of_line_offset(bytes_len)?;
11922            // Decode the envelope for each type.
11923            let mut _next_ordinal_to_read = 0;
11924            let mut next_offset = offset;
11925            let end_offset = offset + bytes_len;
11926            _next_ordinal_to_read += 1;
11927            if next_offset >= end_offset {
11928                return Ok(());
11929            }
11930
11931            // Decode unknown envelopes for gaps in ordinals.
11932            while _next_ordinal_to_read < 1 {
11933                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11934                _next_ordinal_to_read += 1;
11935                next_offset += envelope_size;
11936            }
11937
11938            let next_out_of_line = decoder.next_out_of_line();
11939            let handles_before = decoder.remaining_handles();
11940            if let Some((inlined, num_bytes, num_handles)) =
11941                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11942            {
11943                let member_inline_size =
11944                    <TouchConfigurationInputMode as fidl::encoding::TypeMarker>::inline_size(
11945                        decoder.context,
11946                    );
11947                if inlined != (member_inline_size <= 4) {
11948                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11949                }
11950                let inner_offset;
11951                let mut inner_depth = depth.clone();
11952                if inlined {
11953                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11954                    inner_offset = next_offset;
11955                } else {
11956                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11957                    inner_depth.increment()?;
11958                }
11959                let val_ref = self
11960                    .input_mode
11961                    .get_or_insert_with(|| fidl::new_empty!(TouchConfigurationInputMode, D));
11962                fidl::decode!(
11963                    TouchConfigurationInputMode,
11964                    D,
11965                    val_ref,
11966                    decoder,
11967                    inner_offset,
11968                    inner_depth
11969                )?;
11970                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11971                {
11972                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11973                }
11974                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11975                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11976                }
11977            }
11978
11979            next_offset += envelope_size;
11980            _next_ordinal_to_read += 1;
11981            if next_offset >= end_offset {
11982                return Ok(());
11983            }
11984
11985            // Decode unknown envelopes for gaps in ordinals.
11986            while _next_ordinal_to_read < 2 {
11987                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11988                _next_ordinal_to_read += 1;
11989                next_offset += envelope_size;
11990            }
11991
11992            let next_out_of_line = decoder.next_out_of_line();
11993            let handles_before = decoder.remaining_handles();
11994            if let Some((inlined, num_bytes, num_handles)) =
11995                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11996            {
11997                let member_inline_size =
11998                    <SelectiveReportingFeatureReport as fidl::encoding::TypeMarker>::inline_size(
11999                        decoder.context,
12000                    );
12001                if inlined != (member_inline_size <= 4) {
12002                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12003                }
12004                let inner_offset;
12005                let mut inner_depth = depth.clone();
12006                if inlined {
12007                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12008                    inner_offset = next_offset;
12009                } else {
12010                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12011                    inner_depth.increment()?;
12012                }
12013                let val_ref = self
12014                    .selective_reporting
12015                    .get_or_insert_with(|| fidl::new_empty!(SelectiveReportingFeatureReport, D));
12016                fidl::decode!(
12017                    SelectiveReportingFeatureReport,
12018                    D,
12019                    val_ref,
12020                    decoder,
12021                    inner_offset,
12022                    inner_depth
12023                )?;
12024                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12025                {
12026                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12027                }
12028                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12029                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12030                }
12031            }
12032
12033            next_offset += envelope_size;
12034
12035            // Decode the remaining unknown envelopes.
12036            while next_offset < end_offset {
12037                _next_ordinal_to_read += 1;
12038                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12039                next_offset += envelope_size;
12040            }
12041
12042            Ok(())
12043        }
12044    }
12045
12046    impl TouchInputDescriptor {
12047        #[inline(always)]
12048        fn max_ordinal_present(&self) -> u64 {
12049            if let Some(_) = self.buttons {
12050                return 4;
12051            }
12052            if let Some(_) = self.touch_type {
12053                return 3;
12054            }
12055            if let Some(_) = self.max_contacts {
12056                return 2;
12057            }
12058            if let Some(_) = self.contacts {
12059                return 1;
12060            }
12061            0
12062        }
12063    }
12064
12065    impl fidl::encoding::ValueTypeMarker for TouchInputDescriptor {
12066        type Borrowed<'a> = &'a Self;
12067        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12068            value
12069        }
12070    }
12071
12072    unsafe impl fidl::encoding::TypeMarker for TouchInputDescriptor {
12073        type Owned = Self;
12074
12075        #[inline(always)]
12076        fn inline_align(_context: fidl::encoding::Context) -> usize {
12077            8
12078        }
12079
12080        #[inline(always)]
12081        fn inline_size(_context: fidl::encoding::Context) -> usize {
12082            16
12083        }
12084    }
12085
12086    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputDescriptor, D>
12087        for &TouchInputDescriptor
12088    {
12089        unsafe fn encode(
12090            self,
12091            encoder: &mut fidl::encoding::Encoder<'_, D>,
12092            offset: usize,
12093            mut depth: fidl::encoding::Depth,
12094        ) -> fidl::Result<()> {
12095            encoder.debug_check_bounds::<TouchInputDescriptor>(offset);
12096            // Vector header
12097            let max_ordinal: u64 = self.max_ordinal_present();
12098            encoder.write_num(max_ordinal, offset);
12099            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12100            // Calling encoder.out_of_line_offset(0) is not allowed.
12101            if max_ordinal == 0 {
12102                return Ok(());
12103            }
12104            depth.increment()?;
12105            let envelope_size = 8;
12106            let bytes_len = max_ordinal as usize * envelope_size;
12107            #[allow(unused_variables)]
12108            let offset = encoder.out_of_line_offset(bytes_len);
12109            let mut _prev_end_offset: usize = 0;
12110            if 1 > max_ordinal {
12111                return Ok(());
12112            }
12113
12114            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12115            // are envelope_size bytes.
12116            let cur_offset: usize = (1 - 1) * envelope_size;
12117
12118            // Zero reserved fields.
12119            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12120
12121            // Safety:
12122            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12123            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12124            //   envelope_size bytes, there is always sufficient room.
12125            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputDescriptor, 10>, D>(
12126            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12127            encoder, offset + cur_offset, depth
12128        )?;
12129
12130            _prev_end_offset = cur_offset + envelope_size;
12131            if 2 > max_ordinal {
12132                return Ok(());
12133            }
12134
12135            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12136            // are envelope_size bytes.
12137            let cur_offset: usize = (2 - 1) * envelope_size;
12138
12139            // Zero reserved fields.
12140            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12141
12142            // Safety:
12143            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12144            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12145            //   envelope_size bytes, there is always sufficient room.
12146            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12147                self.max_contacts.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12148                encoder,
12149                offset + cur_offset,
12150                depth,
12151            )?;
12152
12153            _prev_end_offset = cur_offset + envelope_size;
12154            if 3 > max_ordinal {
12155                return Ok(());
12156            }
12157
12158            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12159            // are envelope_size bytes.
12160            let cur_offset: usize = (3 - 1) * envelope_size;
12161
12162            // Zero reserved fields.
12163            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12164
12165            // Safety:
12166            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12167            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12168            //   envelope_size bytes, there is always sufficient room.
12169            fidl::encoding::encode_in_envelope_optional::<TouchType, D>(
12170                self.touch_type
12171                    .as_ref()
12172                    .map(<TouchType as fidl::encoding::ValueTypeMarker>::borrow),
12173                encoder,
12174                offset + cur_offset,
12175                depth,
12176            )?;
12177
12178            _prev_end_offset = cur_offset + envelope_size;
12179            if 4 > max_ordinal {
12180                return Ok(());
12181            }
12182
12183            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12184            // are envelope_size bytes.
12185            let cur_offset: usize = (4 - 1) * envelope_size;
12186
12187            // Zero reserved fields.
12188            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12189
12190            // Safety:
12191            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12192            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12193            //   envelope_size bytes, there is always sufficient room.
12194            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TouchButton, 10>, D>(
12195            self.buttons.as_ref().map(<fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12196            encoder, offset + cur_offset, depth
12197        )?;
12198
12199            _prev_end_offset = cur_offset + envelope_size;
12200
12201            Ok(())
12202        }
12203    }
12204
12205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputDescriptor {
12206        #[inline(always)]
12207        fn new_empty() -> Self {
12208            Self::default()
12209        }
12210
12211        unsafe fn decode(
12212            &mut self,
12213            decoder: &mut fidl::encoding::Decoder<'_, D>,
12214            offset: usize,
12215            mut depth: fidl::encoding::Depth,
12216        ) -> fidl::Result<()> {
12217            decoder.debug_check_bounds::<Self>(offset);
12218            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12219                None => return Err(fidl::Error::NotNullable),
12220                Some(len) => len,
12221            };
12222            // Calling decoder.out_of_line_offset(0) is not allowed.
12223            if len == 0 {
12224                return Ok(());
12225            };
12226            depth.increment()?;
12227            let envelope_size = 8;
12228            let bytes_len = len * envelope_size;
12229            let offset = decoder.out_of_line_offset(bytes_len)?;
12230            // Decode the envelope for each type.
12231            let mut _next_ordinal_to_read = 0;
12232            let mut next_offset = offset;
12233            let end_offset = offset + bytes_len;
12234            _next_ordinal_to_read += 1;
12235            if next_offset >= end_offset {
12236                return Ok(());
12237            }
12238
12239            // Decode unknown envelopes for gaps in ordinals.
12240            while _next_ordinal_to_read < 1 {
12241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12242                _next_ordinal_to_read += 1;
12243                next_offset += envelope_size;
12244            }
12245
12246            let next_out_of_line = decoder.next_out_of_line();
12247            let handles_before = decoder.remaining_handles();
12248            if let Some((inlined, num_bytes, num_handles)) =
12249                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12250            {
12251                let member_inline_size = <fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12252                if inlined != (member_inline_size <= 4) {
12253                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12254                }
12255                let inner_offset;
12256                let mut inner_depth = depth.clone();
12257                if inlined {
12258                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12259                    inner_offset = next_offset;
12260                } else {
12261                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12262                    inner_depth.increment()?;
12263                }
12264                let val_ref = self.contacts.get_or_insert_with(
12265                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D),
12266                );
12267                fidl::decode!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12268                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12269                {
12270                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12271                }
12272                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12273                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12274                }
12275            }
12276
12277            next_offset += envelope_size;
12278            _next_ordinal_to_read += 1;
12279            if next_offset >= end_offset {
12280                return Ok(());
12281            }
12282
12283            // Decode unknown envelopes for gaps in ordinals.
12284            while _next_ordinal_to_read < 2 {
12285                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12286                _next_ordinal_to_read += 1;
12287                next_offset += envelope_size;
12288            }
12289
12290            let next_out_of_line = decoder.next_out_of_line();
12291            let handles_before = decoder.remaining_handles();
12292            if let Some((inlined, num_bytes, num_handles)) =
12293                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12294            {
12295                let member_inline_size =
12296                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12297                if inlined != (member_inline_size <= 4) {
12298                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12299                }
12300                let inner_offset;
12301                let mut inner_depth = depth.clone();
12302                if inlined {
12303                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12304                    inner_offset = next_offset;
12305                } else {
12306                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12307                    inner_depth.increment()?;
12308                }
12309                let val_ref = self.max_contacts.get_or_insert_with(|| fidl::new_empty!(u32, D));
12310                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12311                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12312                {
12313                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12314                }
12315                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12316                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12317                }
12318            }
12319
12320            next_offset += envelope_size;
12321            _next_ordinal_to_read += 1;
12322            if next_offset >= end_offset {
12323                return Ok(());
12324            }
12325
12326            // Decode unknown envelopes for gaps in ordinals.
12327            while _next_ordinal_to_read < 3 {
12328                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12329                _next_ordinal_to_read += 1;
12330                next_offset += envelope_size;
12331            }
12332
12333            let next_out_of_line = decoder.next_out_of_line();
12334            let handles_before = decoder.remaining_handles();
12335            if let Some((inlined, num_bytes, num_handles)) =
12336                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12337            {
12338                let member_inline_size =
12339                    <TouchType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12340                if inlined != (member_inline_size <= 4) {
12341                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12342                }
12343                let inner_offset;
12344                let mut inner_depth = depth.clone();
12345                if inlined {
12346                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12347                    inner_offset = next_offset;
12348                } else {
12349                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12350                    inner_depth.increment()?;
12351                }
12352                let val_ref = self.touch_type.get_or_insert_with(|| fidl::new_empty!(TouchType, D));
12353                fidl::decode!(TouchType, D, val_ref, decoder, inner_offset, inner_depth)?;
12354                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12355                {
12356                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12357                }
12358                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12359                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12360                }
12361            }
12362
12363            next_offset += envelope_size;
12364            _next_ordinal_to_read += 1;
12365            if next_offset >= end_offset {
12366                return Ok(());
12367            }
12368
12369            // Decode unknown envelopes for gaps in ordinals.
12370            while _next_ordinal_to_read < 4 {
12371                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12372                _next_ordinal_to_read += 1;
12373                next_offset += envelope_size;
12374            }
12375
12376            let next_out_of_line = decoder.next_out_of_line();
12377            let handles_before = decoder.remaining_handles();
12378            if let Some((inlined, num_bytes, num_handles)) =
12379                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12380            {
12381                let member_inline_size = <fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12382                if inlined != (member_inline_size <= 4) {
12383                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12384                }
12385                let inner_offset;
12386                let mut inner_depth = depth.clone();
12387                if inlined {
12388                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12389                    inner_offset = next_offset;
12390                } else {
12391                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12392                    inner_depth.increment()?;
12393                }
12394                let val_ref = self.buttons.get_or_insert_with(
12395                    || fidl::new_empty!(fidl::encoding::Vector<TouchButton, 10>, D),
12396                );
12397                fidl::decode!(fidl::encoding::Vector<TouchButton, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12398                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12399                {
12400                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12401                }
12402                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12403                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12404                }
12405            }
12406
12407            next_offset += envelope_size;
12408
12409            // Decode the remaining unknown envelopes.
12410            while next_offset < end_offset {
12411                _next_ordinal_to_read += 1;
12412                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12413                next_offset += envelope_size;
12414            }
12415
12416            Ok(())
12417        }
12418    }
12419
12420    impl TouchInputReport {
12421        #[inline(always)]
12422        fn max_ordinal_present(&self) -> u64 {
12423            if let Some(_) = self.pressed_buttons {
12424                return 2;
12425            }
12426            if let Some(_) = self.contacts {
12427                return 1;
12428            }
12429            0
12430        }
12431    }
12432
12433    impl fidl::encoding::ValueTypeMarker for TouchInputReport {
12434        type Borrowed<'a> = &'a Self;
12435        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12436            value
12437        }
12438    }
12439
12440    unsafe impl fidl::encoding::TypeMarker for TouchInputReport {
12441        type Owned = Self;
12442
12443        #[inline(always)]
12444        fn inline_align(_context: fidl::encoding::Context) -> usize {
12445            8
12446        }
12447
12448        #[inline(always)]
12449        fn inline_size(_context: fidl::encoding::Context) -> usize {
12450            16
12451        }
12452    }
12453
12454    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputReport, D>
12455        for &TouchInputReport
12456    {
12457        unsafe fn encode(
12458            self,
12459            encoder: &mut fidl::encoding::Encoder<'_, D>,
12460            offset: usize,
12461            mut depth: fidl::encoding::Depth,
12462        ) -> fidl::Result<()> {
12463            encoder.debug_check_bounds::<TouchInputReport>(offset);
12464            // Vector header
12465            let max_ordinal: u64 = self.max_ordinal_present();
12466            encoder.write_num(max_ordinal, offset);
12467            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12468            // Calling encoder.out_of_line_offset(0) is not allowed.
12469            if max_ordinal == 0 {
12470                return Ok(());
12471            }
12472            depth.increment()?;
12473            let envelope_size = 8;
12474            let bytes_len = max_ordinal as usize * envelope_size;
12475            #[allow(unused_variables)]
12476            let offset = encoder.out_of_line_offset(bytes_len);
12477            let mut _prev_end_offset: usize = 0;
12478            if 1 > max_ordinal {
12479                return Ok(());
12480            }
12481
12482            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12483            // are envelope_size bytes.
12484            let cur_offset: usize = (1 - 1) * envelope_size;
12485
12486            // Zero reserved fields.
12487            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12488
12489            // Safety:
12490            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12491            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12492            //   envelope_size bytes, there is always sufficient room.
12493            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputReport, 10>, D>(
12494            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12495            encoder, offset + cur_offset, depth
12496        )?;
12497
12498            _prev_end_offset = cur_offset + envelope_size;
12499            if 2 > max_ordinal {
12500                return Ok(());
12501            }
12502
12503            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12504            // are envelope_size bytes.
12505            let cur_offset: usize = (2 - 1) * envelope_size;
12506
12507            // Zero reserved fields.
12508            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12509
12510            // Safety:
12511            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12512            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12513            //   envelope_size bytes, there is always sufficient room.
12514            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TouchButton, 10>, D>(
12515            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12516            encoder, offset + cur_offset, depth
12517        )?;
12518
12519            _prev_end_offset = cur_offset + envelope_size;
12520
12521            Ok(())
12522        }
12523    }
12524
12525    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputReport {
12526        #[inline(always)]
12527        fn new_empty() -> Self {
12528            Self::default()
12529        }
12530
12531        unsafe fn decode(
12532            &mut self,
12533            decoder: &mut fidl::encoding::Decoder<'_, D>,
12534            offset: usize,
12535            mut depth: fidl::encoding::Depth,
12536        ) -> fidl::Result<()> {
12537            decoder.debug_check_bounds::<Self>(offset);
12538            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12539                None => return Err(fidl::Error::NotNullable),
12540                Some(len) => len,
12541            };
12542            // Calling decoder.out_of_line_offset(0) is not allowed.
12543            if len == 0 {
12544                return Ok(());
12545            };
12546            depth.increment()?;
12547            let envelope_size = 8;
12548            let bytes_len = len * envelope_size;
12549            let offset = decoder.out_of_line_offset(bytes_len)?;
12550            // Decode the envelope for each type.
12551            let mut _next_ordinal_to_read = 0;
12552            let mut next_offset = offset;
12553            let end_offset = offset + bytes_len;
12554            _next_ordinal_to_read += 1;
12555            if next_offset >= end_offset {
12556                return Ok(());
12557            }
12558
12559            // Decode unknown envelopes for gaps in ordinals.
12560            while _next_ordinal_to_read < 1 {
12561                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12562                _next_ordinal_to_read += 1;
12563                next_offset += envelope_size;
12564            }
12565
12566            let next_out_of_line = decoder.next_out_of_line();
12567            let handles_before = decoder.remaining_handles();
12568            if let Some((inlined, num_bytes, num_handles)) =
12569                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12570            {
12571                let member_inline_size = <fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12572                if inlined != (member_inline_size <= 4) {
12573                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12574                }
12575                let inner_offset;
12576                let mut inner_depth = depth.clone();
12577                if inlined {
12578                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12579                    inner_offset = next_offset;
12580                } else {
12581                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12582                    inner_depth.increment()?;
12583                }
12584                let val_ref = self.contacts.get_or_insert_with(
12585                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputReport, 10>, D),
12586                );
12587                fidl::decode!(fidl::encoding::Vector<ContactInputReport, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12588                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12589                {
12590                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12591                }
12592                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12593                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12594                }
12595            }
12596
12597            next_offset += envelope_size;
12598            _next_ordinal_to_read += 1;
12599            if next_offset >= end_offset {
12600                return Ok(());
12601            }
12602
12603            // Decode unknown envelopes for gaps in ordinals.
12604            while _next_ordinal_to_read < 2 {
12605                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12606                _next_ordinal_to_read += 1;
12607                next_offset += envelope_size;
12608            }
12609
12610            let next_out_of_line = decoder.next_out_of_line();
12611            let handles_before = decoder.remaining_handles();
12612            if let Some((inlined, num_bytes, num_handles)) =
12613                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12614            {
12615                let member_inline_size = <fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12616                if inlined != (member_inline_size <= 4) {
12617                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12618                }
12619                let inner_offset;
12620                let mut inner_depth = depth.clone();
12621                if inlined {
12622                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12623                    inner_offset = next_offset;
12624                } else {
12625                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12626                    inner_depth.increment()?;
12627                }
12628                let val_ref = self.pressed_buttons.get_or_insert_with(
12629                    || fidl::new_empty!(fidl::encoding::Vector<TouchButton, 10>, D),
12630                );
12631                fidl::decode!(fidl::encoding::Vector<TouchButton, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12632                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12633                {
12634                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12635                }
12636                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12637                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12638                }
12639            }
12640
12641            next_offset += envelope_size;
12642
12643            // Decode the remaining unknown envelopes.
12644            while next_offset < end_offset {
12645                _next_ordinal_to_read += 1;
12646                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12647                next_offset += envelope_size;
12648            }
12649
12650            Ok(())
12651        }
12652    }
12653}