Skip to main content

fidl_fuchsia_input_report_common/
fidl_fuchsia_input_report_common.rs

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