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