fidl_fuchsia_input_report__common/
fidl_fuchsia_input_report__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Hardcoded max sizes for ConsumerControl vectors. These sizes should be increased
12/// if we ever see a device with more objects than can be represented.
13pub const CONSUMER_CONTROL_MAX_NUM_BUTTONS: u32 = 255;
14
15/// Hardcoded max sizes for keyboard vectors. These sizes should be increased
16/// if we ever see keyboards with more objects than can be represented.
17pub const KEYBOARD_MAX_NUM_KEYS: u32 = 256;
18
19pub const KEYBOARD_MAX_NUM_LEDS: u32 = 256;
20
21pub const KEYBOARD_MAX_PRESSED_KEYS: u32 = 256;
22
23pub const MAX_DEVICE_REPORT_COUNT: u32 = 50;
24
25/// A hardcoded number of max reports. Because report ID is only 8 bits, only 255
26/// different reports are allowed at a time.
27pub const MAX_REPORT_COUNT: u32 = 255;
28
29/// A hardcoded number of max mouse buttons. This should be increased in the future
30/// if we ever see mice with more buttons.
31pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
32
33/// A hardcoded number of max sensor values. This should be increased in the future
34/// if we ever see a sensor with more values.
35pub const SENSOR_MAX_VALUES: u32 = 100;
36
37/// A hardcoded number of max contacts per report. This should be increased in the future if
38/// we see devices with more than the max amount.
39pub const TOUCH_MAX_CONTACTS: u32 = 10;
40
41pub const TOUCH_MAX_NUM_BUTTONS: u32 = 10;
42
43/// These ControlButtons represent on/off buttons whose purpose is to change
44/// the host's configuration.
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub enum ConsumerControlButton {
47    /// This button represents increasing volume.
48    VolumeUp,
49    /// This button represents decreasing volume.
50    VolumeDown,
51    /// This button represents pausing.
52    Pause,
53    /// This button represents factory resetting the host.
54    FactoryReset,
55    /// This button represents muting the microphone on the host.
56    MicMute,
57    /// This button represents rebooting the host.
58    Reboot,
59    /// This button represents disabling the camera on the host.
60    CameraDisable,
61    /// This button represents a function.
62    Function,
63    /// This button represents a power button.
64    Power,
65    #[doc(hidden)]
66    __SourceBreaking { unknown_ordinal: u32 },
67}
68
69/// Pattern that matches an unknown `ConsumerControlButton` member.
70#[macro_export]
71macro_rules! ConsumerControlButtonUnknown {
72    () => {
73        _
74    };
75}
76
77impl ConsumerControlButton {
78    #[inline]
79    pub fn from_primitive(prim: u32) -> Option<Self> {
80        match prim {
81            1 => Some(Self::VolumeUp),
82            2 => Some(Self::VolumeDown),
83            3 => Some(Self::Pause),
84            4 => Some(Self::FactoryReset),
85            5 => Some(Self::MicMute),
86            6 => Some(Self::Reboot),
87            7 => Some(Self::CameraDisable),
88            8 => Some(Self::Function),
89            9 => Some(Self::Power),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96        match prim {
97            1 => Self::VolumeUp,
98            2 => Self::VolumeDown,
99            3 => Self::Pause,
100            4 => Self::FactoryReset,
101            5 => Self::MicMute,
102            6 => Self::Reboot,
103            7 => Self::CameraDisable,
104            8 => Self::Function,
105            9 => Self::Power,
106            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107        }
108    }
109
110    #[inline]
111    pub fn unknown() -> Self {
112        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        match self {
118            Self::VolumeUp => 1,
119            Self::VolumeDown => 2,
120            Self::Pause => 3,
121            Self::FactoryReset => 4,
122            Self::MicMute => 5,
123            Self::Reboot => 6,
124            Self::CameraDisable => 7,
125            Self::Function => 8,
126            Self::Power => 9,
127            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128        }
129    }
130
131    #[inline]
132    pub fn is_unknown(&self) -> bool {
133        match self {
134            Self::__SourceBreaking { unknown_ordinal: _ } => true,
135            _ => false,
136        }
137    }
138}
139
140/// The InputReport field to be populated by InputDevice.GetInputReport.
141#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
142pub enum DeviceType {
143    Mouse,
144    Sensor,
145    Touch,
146    Keyboard,
147    ConsumerControl,
148    #[doc(hidden)]
149    __SourceBreaking {
150        unknown_ordinal: u32,
151    },
152}
153
154/// Pattern that matches an unknown `DeviceType` member.
155#[macro_export]
156macro_rules! DeviceTypeUnknown {
157    () => {
158        _
159    };
160}
161
162impl DeviceType {
163    #[inline]
164    pub fn from_primitive(prim: u32) -> Option<Self> {
165        match prim {
166            0 => Some(Self::Mouse),
167            1 => Some(Self::Sensor),
168            2 => Some(Self::Touch),
169            3 => Some(Self::Keyboard),
170            4 => Some(Self::ConsumerControl),
171            _ => None,
172        }
173    }
174
175    #[inline]
176    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
177        match prim {
178            0 => Self::Mouse,
179            1 => Self::Sensor,
180            2 => Self::Touch,
181            3 => Self::Keyboard,
182            4 => Self::ConsumerControl,
183            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
184        }
185    }
186
187    #[inline]
188    pub fn unknown() -> Self {
189        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
190    }
191
192    #[inline]
193    pub const fn into_primitive(self) -> u32 {
194        match self {
195            Self::Mouse => 0,
196            Self::Sensor => 1,
197            Self::Touch => 2,
198            Self::Keyboard => 3,
199            Self::ConsumerControl => 4,
200            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
201        }
202    }
203
204    #[inline]
205    pub fn is_unknown(&self) -> bool {
206        match self {
207            Self::__SourceBreaking { unknown_ordinal: _ } => true,
208            _ => false,
209        }
210    }
211}
212
213/// An LedType represents an LED on a device that can be turned on or off.
214/// When applicable, the definition of each LED is derived from one of the
215/// following sources albeit with a Fuchsia-specific numeric value:
216/// - USB HID usage codes for usage page 0x0008 (LED)
217#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
218pub enum LedType {
219    /// LED to indicate a Keyboard's number lock is enabled.
220    /// Corresponds to USB HID page 0x0008 usage 0x0001
221    NumLock,
222    /// LED to indicate a Keyboard's capital lock is enabled.
223    /// Corresponds to USB HID page 0x0008 usage 0x0002
224    CapsLock,
225    /// LED to indicate a Keyboard's scroll lock is enabled.
226    /// Corresponds to USB HID page 0x0008 usage 0x0003
227    ScrollLock,
228    /// LED to indicate a Keyboard's composition mode is enabled.
229    /// Corresponds to USB HID page 0x0008 usage 0x0004
230    Compose,
231    /// LED to indicate a Keyboard's Kana mode is enabled.
232    /// Corresponds to USB HID page 0x0008 usage 0x0005
233    Kana,
234    #[doc(hidden)]
235    __SourceBreaking { unknown_ordinal: u32 },
236}
237
238/// Pattern that matches an unknown `LedType` member.
239#[macro_export]
240macro_rules! LedTypeUnknown {
241    () => {
242        _
243    };
244}
245
246impl LedType {
247    #[inline]
248    pub fn from_primitive(prim: u32) -> Option<Self> {
249        match prim {
250            1 => Some(Self::NumLock),
251            2 => Some(Self::CapsLock),
252            3 => Some(Self::ScrollLock),
253            4 => Some(Self::Compose),
254            5 => Some(Self::Kana),
255            _ => None,
256        }
257    }
258
259    #[inline]
260    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
261        match prim {
262            1 => Self::NumLock,
263            2 => Self::CapsLock,
264            3 => Self::ScrollLock,
265            4 => Self::Compose,
266            5 => Self::Kana,
267            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
268        }
269    }
270
271    #[inline]
272    pub fn unknown() -> Self {
273        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
274    }
275
276    #[inline]
277    pub const fn into_primitive(self) -> u32 {
278        match self {
279            Self::NumLock => 1,
280            Self::CapsLock => 2,
281            Self::ScrollLock => 3,
282            Self::Compose => 4,
283            Self::Kana => 5,
284            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
285        }
286    }
287
288    #[inline]
289    pub fn is_unknown(&self) -> bool {
290        match self {
291            Self::__SourceBreaking { unknown_ordinal: _ } => true,
292            _ => false,
293        }
294    }
295}
296
297/// `SensorReportingState` determines when a sensor will send reports.
298#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
299pub enum SensorReportingState {
300    /// No events will be sent from the sensor.
301    ReportNoEvents,
302    /// All events will be sent from the sensor. For most sensors, this
303    /// frequency can be set by `report_interval`.
304    ReportAllEvents,
305    /// Only events that cross a threshold will be reported.
306    ReportThresholdEvents,
307    #[doc(hidden)]
308    __SourceBreaking { unknown_ordinal: u32 },
309}
310
311/// Pattern that matches an unknown `SensorReportingState` member.
312#[macro_export]
313macro_rules! SensorReportingStateUnknown {
314    () => {
315        _
316    };
317}
318
319impl SensorReportingState {
320    #[inline]
321    pub fn from_primitive(prim: u32) -> Option<Self> {
322        match prim {
323            1 => Some(Self::ReportNoEvents),
324            2 => Some(Self::ReportAllEvents),
325            3 => Some(Self::ReportThresholdEvents),
326            _ => None,
327        }
328    }
329
330    #[inline]
331    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
332        match prim {
333            1 => Self::ReportNoEvents,
334            2 => Self::ReportAllEvents,
335            3 => Self::ReportThresholdEvents,
336            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337        }
338    }
339
340    #[inline]
341    pub fn unknown() -> Self {
342        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
343    }
344
345    #[inline]
346    pub const fn into_primitive(self) -> u32 {
347        match self {
348            Self::ReportNoEvents => 1,
349            Self::ReportAllEvents => 2,
350            Self::ReportThresholdEvents => 3,
351            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
352        }
353    }
354
355    #[inline]
356    pub fn is_unknown(&self) -> bool {
357        match self {
358            Self::__SourceBreaking { unknown_ordinal: _ } => true,
359            _ => false,
360        }
361    }
362}
363
364/// Each sensor value has a corresponding SensorType, which explains what the
365/// value is measuring in the world.
366#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
367pub enum SensorType {
368    /// Acceleration on the X axis.
369    AccelerometerX,
370    /// Acceleration on the Y axis.
371    AccelerometerY,
372    /// Acceleration on the Z axis.
373    AccelerometerZ,
374    /// Strength of the Magnetic Field in the X axis.
375    MagnetometerX,
376    /// Strength of the Magnetic Field in the Y axis.
377    MagnetometerY,
378    /// Strength of the Magnetic Field in the Z axis.
379    MagnetometerZ,
380    /// Angular Velocity in the X direction moving counter-clockwise.
381    GyroscopeX,
382    /// Angular Velocity in the Y direction moving counter-clockwise.
383    GyroscopeY,
384    /// Angular Velocity in the Z direction moving counter-clockwise.
385    GyroscopeZ,
386    /// Ambient level of Light.
387    LightIlluminance,
388    /// Ambient level of Red Light.
389    LightRed,
390    /// Ambient level of Green Light.
391    LightGreen,
392    /// Ambient level of Blue Light.
393    LightBlue,
394    #[doc(hidden)]
395    __SourceBreaking { unknown_ordinal: u32 },
396}
397
398/// Pattern that matches an unknown `SensorType` member.
399#[macro_export]
400macro_rules! SensorTypeUnknown {
401    () => {
402        _
403    };
404}
405
406impl SensorType {
407    #[inline]
408    pub fn from_primitive(prim: u32) -> Option<Self> {
409        match prim {
410            1 => Some(Self::AccelerometerX),
411            2 => Some(Self::AccelerometerY),
412            3 => Some(Self::AccelerometerZ),
413            4 => Some(Self::MagnetometerX),
414            5 => Some(Self::MagnetometerY),
415            6 => Some(Self::MagnetometerZ),
416            7 => Some(Self::GyroscopeX),
417            8 => Some(Self::GyroscopeY),
418            9 => Some(Self::GyroscopeZ),
419            10 => Some(Self::LightIlluminance),
420            11 => Some(Self::LightRed),
421            12 => Some(Self::LightGreen),
422            13 => Some(Self::LightBlue),
423            _ => None,
424        }
425    }
426
427    #[inline]
428    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
429        match prim {
430            1 => Self::AccelerometerX,
431            2 => Self::AccelerometerY,
432            3 => Self::AccelerometerZ,
433            4 => Self::MagnetometerX,
434            5 => Self::MagnetometerY,
435            6 => Self::MagnetometerZ,
436            7 => Self::GyroscopeX,
437            8 => Self::GyroscopeY,
438            9 => Self::GyroscopeZ,
439            10 => Self::LightIlluminance,
440            11 => Self::LightRed,
441            12 => Self::LightGreen,
442            13 => Self::LightBlue,
443            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
444        }
445    }
446
447    #[inline]
448    pub fn unknown() -> Self {
449        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
450    }
451
452    #[inline]
453    pub const fn into_primitive(self) -> u32 {
454        match self {
455            Self::AccelerometerX => 1,
456            Self::AccelerometerY => 2,
457            Self::AccelerometerZ => 3,
458            Self::MagnetometerX => 4,
459            Self::MagnetometerY => 5,
460            Self::MagnetometerZ => 6,
461            Self::GyroscopeX => 7,
462            Self::GyroscopeY => 8,
463            Self::GyroscopeZ => 9,
464            Self::LightIlluminance => 10,
465            Self::LightRed => 11,
466            Self::LightGreen => 12,
467            Self::LightBlue => 13,
468            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
469        }
470    }
471
472    #[inline]
473    pub fn is_unknown(&self) -> bool {
474        match self {
475            Self::__SourceBreaking { unknown_ordinal: _ } => true,
476            _ => false,
477        }
478    }
479}
480
481/// Input mode indicating which top-level collection should be used for input reporting.
482/// These values must correspond to the input modes defined in 16.7 of the HID Usage Tables
483/// for Universal Serial Bus (USB) Spec (https://usb.org/sites/default/files/hut1_22.pdf).
484#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
485pub enum TouchConfigurationInputMode {
486    /// Use the Mouse Collection for reporting data.
487    MouseCollection,
488    /// Use the Windows Precision Touchpad Collection for reporting data. Defined by Windows
489    /// Precision Touchpad Required HID Top-Level Collections: https://docs.microsoft.com/
490    /// en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required
491    /// -hid-top-level-collections).
492    WindowsPrecisionTouchpadCollection,
493    #[doc(hidden)]
494    __SourceBreaking { unknown_ordinal: u32 },
495}
496
497/// Pattern that matches an unknown `TouchConfigurationInputMode` member.
498#[macro_export]
499macro_rules! TouchConfigurationInputModeUnknown {
500    () => {
501        _
502    };
503}
504
505impl TouchConfigurationInputMode {
506    #[inline]
507    pub fn from_primitive(prim: u32) -> Option<Self> {
508        match prim {
509            0 => Some(Self::MouseCollection),
510            3 => Some(Self::WindowsPrecisionTouchpadCollection),
511            _ => None,
512        }
513    }
514
515    #[inline]
516    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
517        match prim {
518            0 => Self::MouseCollection,
519            3 => Self::WindowsPrecisionTouchpadCollection,
520            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
521        }
522    }
523
524    #[inline]
525    pub fn unknown() -> Self {
526        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
527    }
528
529    #[inline]
530    pub const fn into_primitive(self) -> u32 {
531        match self {
532            Self::MouseCollection => 0,
533            Self::WindowsPrecisionTouchpadCollection => 3,
534            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
535        }
536    }
537
538    #[inline]
539    pub fn is_unknown(&self) -> bool {
540        match self {
541            Self::__SourceBreaking { unknown_ordinal: _ } => true,
542            _ => false,
543        }
544    }
545}
546
547/// The device type from which the touch originated.
548#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
549pub enum TouchType {
550    /// A touch screen has direct finger input associated with a display.
551    Touchscreen,
552    /// A touch pad is a pointer device that tracks finger positions.
553    Touchpad,
554    #[doc(hidden)]
555    __SourceBreaking { unknown_ordinal: u32 },
556}
557
558/// Pattern that matches an unknown `TouchType` member.
559#[macro_export]
560macro_rules! TouchTypeUnknown {
561    () => {
562        _
563    };
564}
565
566impl TouchType {
567    #[inline]
568    pub fn from_primitive(prim: u32) -> Option<Self> {
569        match prim {
570            1 => Some(Self::Touchscreen),
571            2 => Some(Self::Touchpad),
572            _ => None,
573        }
574    }
575
576    #[inline]
577    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
578        match prim {
579            1 => Self::Touchscreen,
580            2 => Self::Touchpad,
581            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
582        }
583    }
584
585    #[inline]
586    pub fn unknown() -> Self {
587        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
588    }
589
590    #[inline]
591    pub const fn into_primitive(self) -> u32 {
592        match self {
593            Self::Touchscreen => 1,
594            Self::Touchpad => 2,
595            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
596        }
597    }
598
599    #[inline]
600    pub fn is_unknown(&self) -> bool {
601        match self {
602            Self::__SourceBreaking { unknown_ordinal: _ } => true,
603            _ => false,
604        }
605    }
606}
607
608/// This provides an easy, standardized way to specify units. New units can
609/// be added as needed. Each UnitType should be named after a specific unit that
610/// should be fully distinguished by the name (E.g: Use METERS instead of
611/// DISTANCE). More complicated units that need to be differentiated should
612/// begin with SI_ (for Internation System of Units) or ENGLISH_ (for English
613/// System of Units).
614#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
615pub enum UnitType {
616    /// The device did not specify units.
617    None,
618    /// The device specified units that are not convertible to any of the other units.
619    Other,
620    /// A measurement of distance in meters.
621    Meters,
622    /// A measurement of mass in grams.
623    Grams,
624    /// A measurement of rotation in degrees.
625    Degrees,
626    /// A measurement of angular velocity in degrees per second.
627    EnglishAngularVelocity,
628    /// A measurement of linear velocity in meters per second.
629    SiLinearVelocity,
630    /// A measurement of acceleration in meters per second squared.
631    SiLinearAcceleration,
632    /// A measure of magnetic flux in webers.
633    Webers,
634    /// A measurement of luminous intensity in candelas.
635    Candelas,
636    /// A measurement of pressure in pascals.
637    Pascals,
638    Lux,
639    Seconds,
640    #[doc(hidden)]
641    __SourceBreaking {
642        unknown_ordinal: u32,
643    },
644}
645
646/// Pattern that matches an unknown `UnitType` member.
647#[macro_export]
648macro_rules! UnitTypeUnknown {
649    () => {
650        _
651    };
652}
653
654impl UnitType {
655    #[inline]
656    pub fn from_primitive(prim: u32) -> Option<Self> {
657        match prim {
658            0 => Some(Self::None),
659            1 => Some(Self::Other),
660            2 => Some(Self::Meters),
661            3 => Some(Self::Grams),
662            4 => Some(Self::Degrees),
663            5 => Some(Self::EnglishAngularVelocity),
664            6 => Some(Self::SiLinearVelocity),
665            7 => Some(Self::SiLinearAcceleration),
666            8 => Some(Self::Webers),
667            9 => Some(Self::Candelas),
668            10 => Some(Self::Pascals),
669            11 => Some(Self::Lux),
670            12 => Some(Self::Seconds),
671            _ => None,
672        }
673    }
674
675    #[inline]
676    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
677        match prim {
678            0 => Self::None,
679            1 => Self::Other,
680            2 => Self::Meters,
681            3 => Self::Grams,
682            4 => Self::Degrees,
683            5 => Self::EnglishAngularVelocity,
684            6 => Self::SiLinearVelocity,
685            7 => Self::SiLinearAcceleration,
686            8 => Self::Webers,
687            9 => Self::Candelas,
688            10 => Self::Pascals,
689            11 => Self::Lux,
690            12 => Self::Seconds,
691            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
692        }
693    }
694
695    #[inline]
696    pub fn unknown() -> Self {
697        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
698    }
699
700    #[inline]
701    pub const fn into_primitive(self) -> u32 {
702        match self {
703            Self::None => 0,
704            Self::Other => 1,
705            Self::Meters => 2,
706            Self::Grams => 3,
707            Self::Degrees => 4,
708            Self::EnglishAngularVelocity => 5,
709            Self::SiLinearVelocity => 6,
710            Self::SiLinearAcceleration => 7,
711            Self::Webers => 8,
712            Self::Candelas => 9,
713            Self::Pascals => 10,
714            Self::Lux => 11,
715            Self::Seconds => 12,
716            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
717        }
718    }
719
720    #[inline]
721    pub fn is_unknown(&self) -> bool {
722        match self {
723            Self::__SourceBreaking { unknown_ordinal: _ } => true,
724            _ => false,
725        }
726    }
727}
728
729/// Below are ProductIds which represents which product this Input device represents. If the
730/// Input device is a HID device, the ProductId maps directly to the HID
731/// ProductId. If the Input device is not a HID device, then the ProductId
732/// will be greater than 0xFFFF, which is the max HID ProductId.
733#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
734pub enum VendorGoogleProductId {
735    /// Below are the non-HID VendorIds
736    FocaltechTouchscreen,
737    AmsLightSensor,
738    PcPs2Keyboard,
739    PcPs2Mouse,
740    AdcButtons,
741    GoodixTouchscreen,
742    HidButtons,
743    VirtioMouse,
744    VirtioKeyboard,
745    VirtioTouchscreen,
746    GoldfishAccelerationSensor,
747    GoldfishGyroscopeSensor,
748    GoldfishRgbcLightSensor,
749    #[doc(hidden)]
750    __SourceBreaking {
751        unknown_ordinal: u32,
752    },
753}
754
755/// Pattern that matches an unknown `VendorGoogleProductId` member.
756#[macro_export]
757macro_rules! VendorGoogleProductIdUnknown {
758    () => {
759        _
760    };
761}
762
763impl VendorGoogleProductId {
764    #[inline]
765    pub fn from_primitive(prim: u32) -> Option<Self> {
766        match prim {
767            65537 => Some(Self::FocaltechTouchscreen),
768            65538 => Some(Self::AmsLightSensor),
769            65539 => Some(Self::PcPs2Keyboard),
770            65540 => Some(Self::PcPs2Mouse),
771            65541 => Some(Self::AdcButtons),
772            65542 => Some(Self::GoodixTouchscreen),
773            65543 => Some(Self::HidButtons),
774            65544 => Some(Self::VirtioMouse),
775            65545 => Some(Self::VirtioKeyboard),
776            65546 => Some(Self::VirtioTouchscreen),
777            2417819649 => Some(Self::GoldfishAccelerationSensor),
778            2417819650 => Some(Self::GoldfishGyroscopeSensor),
779            2417819651 => Some(Self::GoldfishRgbcLightSensor),
780            _ => None,
781        }
782    }
783
784    #[inline]
785    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
786        match prim {
787            65537 => Self::FocaltechTouchscreen,
788            65538 => Self::AmsLightSensor,
789            65539 => Self::PcPs2Keyboard,
790            65540 => Self::PcPs2Mouse,
791            65541 => Self::AdcButtons,
792            65542 => Self::GoodixTouchscreen,
793            65543 => Self::HidButtons,
794            65544 => Self::VirtioMouse,
795            65545 => Self::VirtioKeyboard,
796            65546 => Self::VirtioTouchscreen,
797            2417819649 => Self::GoldfishAccelerationSensor,
798            2417819650 => Self::GoldfishGyroscopeSensor,
799            2417819651 => Self::GoldfishRgbcLightSensor,
800            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
801        }
802    }
803
804    #[inline]
805    pub fn unknown() -> Self {
806        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
807    }
808
809    #[inline]
810    pub const fn into_primitive(self) -> u32 {
811        match self {
812            Self::FocaltechTouchscreen => 65537,
813            Self::AmsLightSensor => 65538,
814            Self::PcPs2Keyboard => 65539,
815            Self::PcPs2Mouse => 65540,
816            Self::AdcButtons => 65541,
817            Self::GoodixTouchscreen => 65542,
818            Self::HidButtons => 65543,
819            Self::VirtioMouse => 65544,
820            Self::VirtioKeyboard => 65545,
821            Self::VirtioTouchscreen => 65546,
822            Self::GoldfishAccelerationSensor => 2417819649,
823            Self::GoldfishGyroscopeSensor => 2417819650,
824            Self::GoldfishRgbcLightSensor => 2417819651,
825            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
826        }
827    }
828
829    #[inline]
830    pub fn is_unknown(&self) -> bool {
831        match self {
832            Self::__SourceBreaking { unknown_ordinal: _ } => true,
833            _ => false,
834        }
835    }
836}
837
838/// The VendorId represents the vendor that created this Input device. If the
839/// Input device is a HID device, the VendorId maps directly to the HID
840/// VendorId. If the Input device is not a HID device, then the VendorId
841/// will be greater than 0xFFFF, which is the max HID VendorId.
842#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
843pub enum VendorId {
844    /// Below are the HID VendorIds, range 0x0000 - 0xFFFF.
845    Google,
846    #[doc(hidden)]
847    __SourceBreaking { unknown_ordinal: u32 },
848}
849
850/// Pattern that matches an unknown `VendorId` member.
851#[macro_export]
852macro_rules! VendorIdUnknown {
853    () => {
854        _
855    };
856}
857
858impl VendorId {
859    #[inline]
860    pub fn from_primitive(prim: u32) -> Option<Self> {
861        match prim {
862            6353 => Some(Self::Google),
863            _ => None,
864        }
865    }
866
867    #[inline]
868    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
869        match prim {
870            6353 => Self::Google,
871            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
872        }
873    }
874
875    #[inline]
876    pub fn unknown() -> Self {
877        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
878    }
879
880    #[inline]
881    pub const fn into_primitive(self) -> u32 {
882        match self {
883            Self::Google => 6353,
884            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
885        }
886    }
887
888    #[inline]
889    pub fn is_unknown(&self) -> bool {
890        match self {
891            Self::__SourceBreaking { unknown_ordinal: _ } => true,
892            _ => false,
893        }
894    }
895}
896
897/// An `Axis` is defined as a `range` and a `unit`.
898#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
899pub struct Axis {
900    pub range: Range,
901    pub unit: Unit,
902}
903
904impl fidl::Persistable for Axis {}
905
906/// DeviceInfo provides more information about the device and lets a client
907/// distinguish between devices (e.g between two touchscreens that come from
908/// different vendors). If the device is a HID device, then the id information
909/// will come from the device itself. Other, non-HID devices may assign the
910/// ids in the driver, so it will be the driver author's responsibility to
911/// assign sensible ids.
912#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
913#[repr(C)]
914pub struct DeviceInfo {
915    pub vendor_id: u32,
916    pub product_id: u32,
917    pub version: u32,
918}
919
920impl fidl::Persistable for DeviceInfo {}
921
922#[derive(Clone, Debug, PartialEq)]
923pub struct InputDeviceGetDescriptorResponse {
924    pub descriptor: DeviceDescriptor,
925}
926
927impl fidl::Persistable for InputDeviceGetDescriptorResponse {}
928
929#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
930pub struct InputDeviceGetInputReportRequest {
931    pub device_type: DeviceType,
932}
933
934impl fidl::Persistable for InputDeviceGetInputReportRequest {}
935
936#[derive(Clone, Debug, PartialEq)]
937pub struct InputDeviceSendOutputReportRequest {
938    pub report: OutputReport,
939}
940
941impl fidl::Persistable for InputDeviceSendOutputReportRequest {}
942
943#[derive(Clone, Debug, PartialEq)]
944pub struct InputDeviceSetFeatureReportRequest {
945    pub report: FeatureReport,
946}
947
948impl fidl::Persistable for InputDeviceSetFeatureReportRequest {}
949
950#[derive(Clone, Debug, PartialEq)]
951pub struct InputDeviceGetFeatureReportResponse {
952    pub report: FeatureReport,
953}
954
955impl fidl::Persistable for InputDeviceGetFeatureReportResponse {}
956
957#[derive(Clone, Debug, PartialEq)]
958pub struct InputDeviceGetInputReportResponse {
959    pub report: InputReport,
960}
961
962impl fidl::Persistable for InputDeviceGetInputReportResponse {}
963
964#[derive(Clone, Debug, PartialEq)]
965pub struct InputReportsReaderReadInputReportsResponse {
966    pub reports: Vec<InputReport>,
967}
968
969impl fidl::Persistable for InputReportsReaderReadInputReportsResponse {}
970
971/// Describe a `Range` of values.
972#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
973#[repr(C)]
974pub struct Range {
975    pub min: i64,
976    pub max: i64,
977}
978
979impl fidl::Persistable for Range {}
980
981/// A `SensorAxis` is a normal `Axis` with an additional `SensorType` to describe what the
982/// axis is measuring.
983#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
984pub struct SensorAxis {
985    pub axis: Axis,
986    pub type_: SensorType,
987}
988
989impl fidl::Persistable for SensorAxis {}
990
991/// Describes a given unit by giving the unit and the unit's exponent.
992/// E.g: Nanometers would have type METERS and exponent -9.
993#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
994pub struct Unit {
995    pub type_: UnitType,
996    pub exponent: i32,
997}
998
999impl fidl::Persistable for Unit {}
1000
1001/// A Fuchsia ConsumerControl represents a device thats purpose is to change
1002/// values on the host. Typical controls are Volume, Power, Media Playback.
1003/// (Consider a TV remote to be a typical ConsumerControl).
1004#[derive(Clone, Debug, Default, PartialEq)]
1005pub struct ConsumerControlDescriptor {
1006    pub input: Option<ConsumerControlInputDescriptor>,
1007    #[doc(hidden)]
1008    pub __source_breaking: fidl::marker::SourceBreaking,
1009}
1010
1011impl fidl::Persistable for ConsumerControlDescriptor {}
1012
1013/// Describes the format of the input report that will be sent from the
1014/// ConsumerControl device to the host.
1015#[derive(Clone, Debug, Default, PartialEq)]
1016pub struct ConsumerControlInputDescriptor {
1017    /// The list of buttons that this device contains.
1018    pub buttons: Option<Vec<ConsumerControlButton>>,
1019    #[doc(hidden)]
1020    pub __source_breaking: fidl::marker::SourceBreaking,
1021}
1022
1023impl fidl::Persistable for ConsumerControlInputDescriptor {}
1024
1025/// A single report created by a ConsumerControl device.
1026#[derive(Clone, Debug, Default, PartialEq)]
1027pub struct ConsumerControlInputReport {
1028    /// The list of buttons that are currently pressed down.
1029    pub pressed_buttons: Option<Vec<ConsumerControlButton>>,
1030    #[doc(hidden)]
1031    pub __source_breaking: fidl::marker::SourceBreaking,
1032}
1033
1034impl fidl::Persistable for ConsumerControlInputReport {}
1035
1036/// `ContactInputDescriptor` describes the fields associated with a touch on a touch device.
1037#[derive(Clone, Debug, Default, PartialEq)]
1038pub struct ContactInputDescriptor {
1039    /// Describes the reporting of the x-axis.
1040    pub position_x: Option<Axis>,
1041    /// Describes the reporting of the y-axis.
1042    pub position_y: Option<Axis>,
1043    /// Pressure of the contact.
1044    pub pressure: Option<Axis>,
1045    /// Width of the area of contact.
1046    pub contact_width: Option<Axis>,
1047    /// Height of the area of contact.
1048    pub contact_height: Option<Axis>,
1049    #[doc(hidden)]
1050    pub __source_breaking: fidl::marker::SourceBreaking,
1051}
1052
1053impl fidl::Persistable for ContactInputDescriptor {}
1054
1055/// `ContactInputReport` describes one touch on a touch device.
1056#[derive(Clone, Debug, Default, PartialEq)]
1057pub struct ContactInputReport {
1058    /// Identifier for this contact.
1059    pub contact_id: Option<u32>,
1060    /// A contact's position on the x axis.
1061    pub position_x: Option<i64>,
1062    /// A contact's position on the y axis.
1063    pub position_y: Option<i64>,
1064    /// Pressure of the contact.
1065    pub pressure: Option<i64>,
1066    /// Width of the bounding box around the touch contact. Combined with
1067    /// `contact_height`, this describes the area of the touch contact.
1068    /// `contact_width` and `contact_height` should both have units of distance,
1069    /// and they should be in the same units as `position_x` and `position_y`.
1070    pub contact_width: Option<i64>,
1071    /// Height of the bounding box around the touch contact. Combined with
1072    /// `contact_width`, this describes the area of the touch contact.
1073    /// `contact_width` and `contact_height` should both have units of distance,
1074    /// and they should be in the same units as `position_x` and `position_y`.
1075    pub contact_height: Option<i64>,
1076    /// Also known as touch valid. Indicates the device’s confidence that the touch
1077    /// contact was an intended, valid contact. The device should report 0 if the
1078    /// contact is not a valid touch. The device should report 1 if the contact is
1079    /// intended and valid (e.g. a pointing touch)
1080    pub confidence: Option<bool>,
1081    #[doc(hidden)]
1082    pub __source_breaking: fidl::marker::SourceBreaking,
1083}
1084
1085impl fidl::Persistable for ContactInputReport {}
1086
1087/// `DeviceDescriptor` describes a physical input device. Some physical devices may
1088/// send multiple types of reports (E.g: a physical touchscreen can send touch and
1089/// stylus reports, so it will have both a TouchDescriptor and a StylusDescriptor).
1090#[derive(Clone, Debug, Default, PartialEq)]
1091pub struct DeviceDescriptor {
1092    /// This field is removed. Use device_information instead.
1093    pub device_info: Option<DeviceInfo>,
1094    /// When `mouse` is present the device has a mouse.
1095    pub mouse: Option<MouseDescriptor>,
1096    /// When `sensor` is present the device has a sensor.
1097    pub sensor: Option<SensorDescriptor>,
1098    /// When `touch` is present the device has a touch device.
1099    /// (E.g: Touchscreen, touchpad).
1100    pub touch: Option<TouchDescriptor>,
1101    /// When `keyboard` is present the device has a keyboard.
1102    pub keyboard: Option<KeyboardDescriptor>,
1103    /// When `consumer_control` is present the device has a ConsumerControl
1104    /// device.
1105    pub consumer_control: Option<ConsumerControlDescriptor>,
1106    /// `device_information` should always be present to help distinguish
1107    /// between physical devices.
1108    pub device_information: Option<DeviceInformation>,
1109    #[doc(hidden)]
1110    pub __source_breaking: fidl::marker::SourceBreaking,
1111}
1112
1113impl fidl::Persistable for DeviceDescriptor {}
1114
1115/// DeviceInformation provides more information about the device and lets a
1116/// client distinguish between devices (e.g between two touchscreens that come
1117/// from different vendors). If the device is a HID device, then the id
1118/// information will come from the device itself. Other, non-HID devices may
1119/// assign the ids in the driver, so it will be the driver author's
1120/// responsibility to assign sensible ids.
1121#[derive(Clone, Debug, Default, PartialEq)]
1122pub struct DeviceInformation {
1123    pub vendor_id: Option<u32>,
1124    pub product_id: Option<u32>,
1125    pub version: Option<u32>,
1126    pub polling_rate: Option<i64>,
1127    #[doc(hidden)]
1128    pub __source_breaking: fidl::marker::SourceBreaking,
1129}
1130
1131impl fidl::Persistable for DeviceInformation {}
1132
1133/// A single report containing the feature information for an input device.
1134/// Feature reports obtained from the device show the current state of the
1135/// device. Sending a feature report to the device sets the device in that
1136/// state.
1137#[derive(Clone, Debug, Default, PartialEq)]
1138pub struct FeatureReport {
1139    pub sensor: Option<SensorFeatureReport>,
1140    pub touch: Option<TouchFeatureReport>,
1141    #[doc(hidden)]
1142    pub __source_breaking: fidl::marker::SourceBreaking,
1143}
1144
1145impl fidl::Persistable for FeatureReport {}
1146
1147/// `InputReport` is a single report that is created by an input device.
1148#[derive(Clone, Debug, Default, PartialEq)]
1149pub struct InputReport {
1150    /// `event_time` is in nanoseconds when the event was recorded.
1151    pub event_time: Option<i64>,
1152    /// `mouse` is the report generated if the device contains a mouse.
1153    pub mouse: Option<MouseInputReport>,
1154    /// Unique ID to connect trace async begin/end events.
1155    pub trace_id: Option<u64>,
1156    /// `sensor` is the report generated if the device contains a sensor.
1157    pub sensor: Option<SensorInputReport>,
1158    /// `touch` is the report generated if the device contains a touch device.
1159    pub touch: Option<TouchInputReport>,
1160    /// `keyboard` is the report generated if the device contains a keyboard.
1161    pub keyboard: Option<KeyboardInputReport>,
1162    /// `consumer_controls` is the report generated if the device contains a
1163    /// ConsumerControl device.
1164    pub consumer_control: Option<ConsumerControlInputReport>,
1165    /// The Descriptor that describes this InputReport will have a matching
1166    /// ReportID. If this doesn't exist, report_id is 0.
1167    pub report_id: Option<u8>,
1168    #[doc(hidden)]
1169    pub __source_breaking: fidl::marker::SourceBreaking,
1170}
1171
1172impl fidl::Persistable for InputReport {}
1173
1174/// The capabilities of a keyboard device.
1175#[derive(Clone, Debug, Default, PartialEq)]
1176pub struct KeyboardDescriptor {
1177    pub input: Option<KeyboardInputDescriptor>,
1178    pub output: Option<KeyboardOutputDescriptor>,
1179    #[doc(hidden)]
1180    pub __source_breaking: fidl::marker::SourceBreaking,
1181}
1182
1183impl fidl::Persistable for KeyboardDescriptor {}
1184
1185/// Describes the format of the input report that will be sent from the keyboard
1186/// to the device.
1187#[derive(Clone, Debug, Default, PartialEq)]
1188pub struct KeyboardInputDescriptor {
1189    /// The list of keys that this keyboard contains.
1190    pub keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1191    #[doc(hidden)]
1192    pub __source_breaking: fidl::marker::SourceBreaking,
1193}
1194
1195impl fidl::Persistable for KeyboardInputDescriptor {}
1196
1197/// A single report created by a keyboard device.
1198#[derive(Clone, Debug, Default, PartialEq)]
1199pub struct KeyboardInputReport {
1200    /// The list of keys that are currently pressed down.
1201    pub pressed_keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1202    #[doc(hidden)]
1203    pub __source_breaking: fidl::marker::SourceBreaking,
1204}
1205
1206impl fidl::Persistable for KeyboardInputReport {}
1207
1208/// Describes the format of the output report that can be sent to the keyboard..
1209#[derive(Clone, Debug, Default, PartialEq)]
1210pub struct KeyboardOutputDescriptor {
1211    /// The list of keyboard LEDs that can be toggled.
1212    pub leds: Option<Vec<LedType>>,
1213    #[doc(hidden)]
1214    pub __source_breaking: fidl::marker::SourceBreaking,
1215}
1216
1217impl fidl::Persistable for KeyboardOutputDescriptor {}
1218
1219/// A single report containing output information for a keyboard.
1220#[derive(Clone, Debug, Default, PartialEq)]
1221pub struct KeyboardOutputReport {
1222    /// Each LED in this list will be turned on. Any LED not in this list will be
1223    /// turned off.
1224    pub enabled_leds: Option<Vec<LedType>>,
1225    #[doc(hidden)]
1226    pub __source_breaking: fidl::marker::SourceBreaking,
1227}
1228
1229impl fidl::Persistable for KeyboardOutputReport {}
1230
1231/// The capabilities of a mouse device.
1232#[derive(Clone, Debug, Default, PartialEq)]
1233pub struct MouseDescriptor {
1234    pub input: Option<MouseInputDescriptor>,
1235    #[doc(hidden)]
1236    pub __source_breaking: fidl::marker::SourceBreaking,
1237}
1238
1239impl fidl::Persistable for MouseDescriptor {}
1240
1241/// Describes the format of the input report that will be sent from the mouse
1242/// to the device.
1243#[derive(Clone, Debug, Default, PartialEq)]
1244pub struct MouseInputDescriptor {
1245    /// The range of relative X movement.
1246    pub movement_x: Option<Axis>,
1247    /// The range of relative Y movement.
1248    pub movement_y: Option<Axis>,
1249    /// The range of relative vertical scroll.
1250    pub scroll_v: Option<Axis>,
1251    /// The range of relative horizontal scroll.
1252    pub scroll_h: Option<Axis>,
1253    /// This is a vector of ids for the mouse buttons.
1254    pub buttons: Option<Vec<u8>>,
1255    /// The range of the position of X.
1256    /// The main use of position is from virtual mice like over VNC.
1257    pub position_x: Option<Axis>,
1258    /// The range of the position of Y.
1259    /// The main use of position is from virtual mice like over VNC.
1260    pub position_y: Option<Axis>,
1261    #[doc(hidden)]
1262    pub __source_breaking: fidl::marker::SourceBreaking,
1263}
1264
1265impl fidl::Persistable for MouseInputDescriptor {}
1266
1267/// `MouseReport` gives the relative movement of the mouse and currently
1268/// pressed buttons. Relative means the movement seen between the previous
1269/// report and this report. The client is responsible for tracking this and
1270/// converting it to absolute movement.
1271#[derive(Clone, Debug, Default, PartialEq)]
1272pub struct MouseInputReport {
1273    /// Relative X positional displacement.
1274    pub movement_x: Option<i64>,
1275    /// Relative Y positional displacement.
1276    pub movement_y: Option<i64>,
1277    /// Relative vertical scrolling displacement.
1278    pub scroll_v: Option<i64>,
1279    /// Relative horizontal scrolling displacement.
1280    pub scroll_h: Option<i64>,
1281    /// A list of currently pressed buttons.
1282    pub pressed_buttons: Option<Vec<u8>>,
1283    /// The position of X.
1284    /// The main use of position is from virtual mice like over VNC.
1285    pub position_x: Option<i64>,
1286    /// The position of Y.
1287    /// The main use of position is from virtual mice like over VNC.
1288    pub position_y: Option<i64>,
1289    #[doc(hidden)]
1290    pub __source_breaking: fidl::marker::SourceBreaking,
1291}
1292
1293impl fidl::Persistable for MouseInputReport {}
1294
1295/// Describes the output reports that a physical input device will accept.
1296/// Output information typically represents device output to the user
1297/// (E.g: LEDs, tactile feedback, etc).
1298#[derive(Clone, Debug, Default, PartialEq)]
1299pub struct OutputDescriptor {
1300    pub keyboard: Option<KeyboardOutputDescriptor>,
1301    #[doc(hidden)]
1302    pub __source_breaking: fidl::marker::SourceBreaking,
1303}
1304
1305impl fidl::Persistable for OutputDescriptor {}
1306
1307/// A single report containing output information for an input device.
1308/// Output information typically represents device output to the user
1309/// (E.g: LEDs, tactile feedback, etc).
1310#[derive(Clone, Debug, Default, PartialEq)]
1311pub struct OutputReport {
1312    pub keyboard: Option<KeyboardOutputReport>,
1313    #[doc(hidden)]
1314    pub __source_breaking: fidl::marker::SourceBreaking,
1315}
1316
1317impl fidl::Persistable for OutputReport {}
1318
1319/// Selective Reporting Feature Report indicating which types of input are reported.
1320#[derive(Clone, Debug, Default, PartialEq)]
1321pub struct SelectiveReportingFeatureReport {
1322    /// If this is true, the device will report surface contacts.
1323    pub surface_switch: Option<bool>,
1324    /// If this is true, the device will report button state.
1325    pub button_switch: Option<bool>,
1326    #[doc(hidden)]
1327    pub __source_breaking: fidl::marker::SourceBreaking,
1328}
1329
1330impl fidl::Persistable for SelectiveReportingFeatureReport {}
1331
1332/// The capabilities of a sensor device.
1333#[derive(Clone, Debug, Default, PartialEq)]
1334pub struct SensorDescriptor {
1335    pub input: Option<Vec<SensorInputDescriptor>>,
1336    pub feature: Option<Vec<SensorFeatureDescriptor>>,
1337    #[doc(hidden)]
1338    pub __source_breaking: fidl::marker::SourceBreaking,
1339}
1340
1341impl fidl::Persistable for SensorDescriptor {}
1342
1343/// Describes the format of the sensor's feature report. Feature reports can be
1344/// requested from the sensor, or sent to the sensor.
1345#[derive(Clone, Debug, Default, PartialEq)]
1346pub struct SensorFeatureDescriptor {
1347    /// Describes the minimum and maximum reporting interval this sensor
1348    /// supports.
1349    pub report_interval: Option<Axis>,
1350    /// Sets the sensitivity for the given `SensorType`.
1351    pub sensitivity: Option<Vec<SensorAxis>>,
1352    /// If this is true then SensorFeatureReport supports setting a
1353    /// SensorReportingState.
1354    pub supports_reporting_state: Option<bool>,
1355    /// Sets the high threshold values for the given `SensorType`.
1356    pub threshold_high: Option<Vec<SensorAxis>>,
1357    /// Sets the low threshold values for the given `SensorType`.
1358    pub threshold_low: Option<Vec<SensorAxis>>,
1359    /// Describes the minimum and maximum sampling rate this sensor supports.
1360    pub sampling_rate: Option<Axis>,
1361    /// ReportID of current descriptor. Report with same report ID should be
1362    /// associated with this descriptor.
1363    pub report_id: Option<u8>,
1364    #[doc(hidden)]
1365    pub __source_breaking: fidl::marker::SourceBreaking,
1366}
1367
1368impl fidl::Persistable for SensorFeatureDescriptor {}
1369
1370/// A SensorFeatureReport describes the features of a given sensor. If a
1371/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1372/// If a FeatureReport is requested from the Input Device it shows the device's
1373/// current configuration.
1374#[derive(Clone, Debug, Default, PartialEq)]
1375pub struct SensorFeatureReport {
1376    /// The time between reports sent by the sensor.
1377    pub report_interval: Option<i64>,
1378    /// The sensitivity for various `SensorType`. This vector must be given in
1379    /// the order of the descriptor's `sensitivity` vector.
1380    pub sensitivity: Option<Vec<i64>>,
1381    /// This determines when the sensor will send reports.
1382    pub reporting_state: Option<SensorReportingState>,
1383    /// The high thresholds for various `SensorType`. This vector must be given in
1384    /// the order of the descriptor's `threshold_high` vector.
1385    pub threshold_high: Option<Vec<i64>>,
1386    /// The low thresholds for various `SensorType`. This vector must be given in
1387    /// the order of the descriptor's `threshold_low` vector.
1388    pub threshold_low: Option<Vec<i64>>,
1389    /// The rate at which the sensor is sampled.
1390    pub sampling_rate: Option<i64>,
1391    #[doc(hidden)]
1392    pub __source_breaking: fidl::marker::SourceBreaking,
1393}
1394
1395impl fidl::Persistable for SensorFeatureReport {}
1396
1397/// Describes the format of the input report that will be sent from the sensor
1398/// to the device.
1399#[derive(Clone, Debug, Default, PartialEq)]
1400pub struct SensorInputDescriptor {
1401    /// Each `SensorAxis` in `values` describes what a sensor is measuring and its range.
1402    /// These will directly correspond to the values in `SensorReport`.
1403    pub values: Option<Vec<SensorAxis>>,
1404    /// ReportID of current descriptor. Report with same report ID should be
1405    /// associated with this descriptor.
1406    pub report_id: Option<u8>,
1407    #[doc(hidden)]
1408    pub __source_breaking: fidl::marker::SourceBreaking,
1409}
1410
1411impl fidl::Persistable for SensorInputDescriptor {}
1412
1413/// `SensorReport` gives the values measured by a sensor at a given point in time.
1414#[derive(Clone, Debug, Default, PartialEq)]
1415pub struct SensorInputReport {
1416    /// The ordering of `values` will always directly correspond to the ordering of
1417    /// the values in `SensorDescriptor`.
1418    pub values: Option<Vec<i64>>,
1419    #[doc(hidden)]
1420    pub __source_breaking: fidl::marker::SourceBreaking,
1421}
1422
1423impl fidl::Persistable for SensorInputReport {}
1424
1425/// The capabilities of a touch device.
1426#[derive(Clone, Debug, Default, PartialEq)]
1427pub struct TouchDescriptor {
1428    pub input: Option<TouchInputDescriptor>,
1429    pub feature: Option<TouchFeatureDescriptor>,
1430    #[doc(hidden)]
1431    pub __source_breaking: fidl::marker::SourceBreaking,
1432}
1433
1434impl fidl::Persistable for TouchDescriptor {}
1435
1436/// Describes the format of the touchpad configuration's feature report. Feature reports
1437/// can be requested from the touchpad, or sent to the touchpad.
1438#[derive(Clone, Debug, Default, PartialEq)]
1439pub struct TouchFeatureDescriptor {
1440    /// Indicates whether or not touch feature descriptor supports different input modes.
1441    pub supports_input_mode: Option<bool>,
1442    /// Indicates whether or not touch feature descriptor supports selective reporting.
1443    pub supports_selective_reporting: Option<bool>,
1444    #[doc(hidden)]
1445    pub __source_breaking: fidl::marker::SourceBreaking,
1446}
1447
1448impl fidl::Persistable for TouchFeatureDescriptor {}
1449
1450/// A TouchFeatureReport describes the features of a given touch device. If a
1451/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1452/// If a FeatureReport is requested from the Input Device it shows the device's
1453/// current configuration.
1454#[derive(Clone, Debug, Default, PartialEq)]
1455pub struct TouchFeatureReport {
1456    /// The input mode currently reporting.
1457    pub input_mode: Option<TouchConfigurationInputMode>,
1458    /// The current report types being reported.
1459    pub selective_reporting: Option<SelectiveReportingFeatureReport>,
1460    #[doc(hidden)]
1461    pub __source_breaking: fidl::marker::SourceBreaking,
1462}
1463
1464impl fidl::Persistable for TouchFeatureReport {}
1465
1466/// Describes the format of the input report that will be sent from the keyboard
1467/// to the device.
1468#[derive(Clone, Debug, Default, PartialEq)]
1469pub struct TouchInputDescriptor {
1470    /// The contact descriptors associated with this touch descriptor.
1471    pub contacts: Option<Vec<ContactInputDescriptor>>,
1472    /// The max number of contacts that this touch device can report at once.
1473    pub max_contacts: Option<u32>,
1474    /// The type of touch device being used.
1475    pub touch_type: Option<TouchType>,
1476    /// Identifiers for the physical buttons on a touch device.
1477    pub buttons: Option<Vec<u8>>,
1478    #[doc(hidden)]
1479    pub __source_breaking: fidl::marker::SourceBreaking,
1480}
1481
1482impl fidl::Persistable for TouchInputDescriptor {}
1483
1484/// `TouchInputReport` describes the current contacts recorded by the touchscreen.
1485#[derive(Clone, Debug, Default, PartialEq)]
1486pub struct TouchInputReport {
1487    /// The contacts currently being reported by the device.
1488    pub contacts: Option<Vec<ContactInputReport>>,
1489    /// Identifiers for currently pressed buttons.
1490    pub pressed_buttons: Option<Vec<u8>>,
1491    #[doc(hidden)]
1492    pub __source_breaking: fidl::marker::SourceBreaking,
1493}
1494
1495impl fidl::Persistable for TouchInputReport {}
1496
1497pub mod input_device_ordinals {
1498    pub const GET_INPUT_REPORTS_READER: u64 = 0x68d9cf83e397ab41;
1499    pub const GET_DESCRIPTOR: u64 = 0x3d76420f2ff8ad32;
1500    pub const SEND_OUTPUT_REPORT: u64 = 0x67a4888774e6f3a;
1501    pub const GET_FEATURE_REPORT: u64 = 0x497a7d98d9391f16;
1502    pub const SET_FEATURE_REPORT: u64 = 0x7679a2f5a42842ef;
1503    pub const GET_INPUT_REPORT: u64 = 0x4752ccab96c10248;
1504}
1505
1506pub mod input_reports_reader_ordinals {
1507    pub const READ_INPUT_REPORTS: u64 = 0x3595efdc88842559;
1508}
1509
1510mod internal {
1511    use super::*;
1512    unsafe impl fidl::encoding::TypeMarker for ConsumerControlButton {
1513        type Owned = Self;
1514
1515        #[inline(always)]
1516        fn inline_align(_context: fidl::encoding::Context) -> usize {
1517            std::mem::align_of::<u32>()
1518        }
1519
1520        #[inline(always)]
1521        fn inline_size(_context: fidl::encoding::Context) -> usize {
1522            std::mem::size_of::<u32>()
1523        }
1524
1525        #[inline(always)]
1526        fn encode_is_copy() -> bool {
1527            false
1528        }
1529
1530        #[inline(always)]
1531        fn decode_is_copy() -> bool {
1532            false
1533        }
1534    }
1535
1536    impl fidl::encoding::ValueTypeMarker for ConsumerControlButton {
1537        type Borrowed<'a> = Self;
1538        #[inline(always)]
1539        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1540            *value
1541        }
1542    }
1543
1544    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1545        for ConsumerControlButton
1546    {
1547        #[inline]
1548        unsafe fn encode(
1549            self,
1550            encoder: &mut fidl::encoding::Encoder<'_, D>,
1551            offset: usize,
1552            _depth: fidl::encoding::Depth,
1553        ) -> fidl::Result<()> {
1554            encoder.debug_check_bounds::<Self>(offset);
1555            encoder.write_num(self.into_primitive(), offset);
1556            Ok(())
1557        }
1558    }
1559
1560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsumerControlButton {
1561        #[inline(always)]
1562        fn new_empty() -> Self {
1563            Self::unknown()
1564        }
1565
1566        #[inline]
1567        unsafe fn decode(
1568            &mut self,
1569            decoder: &mut fidl::encoding::Decoder<'_, D>,
1570            offset: usize,
1571            _depth: fidl::encoding::Depth,
1572        ) -> fidl::Result<()> {
1573            decoder.debug_check_bounds::<Self>(offset);
1574            let prim = decoder.read_num::<u32>(offset);
1575
1576            *self = Self::from_primitive_allow_unknown(prim);
1577            Ok(())
1578        }
1579    }
1580    unsafe impl fidl::encoding::TypeMarker for DeviceType {
1581        type Owned = Self;
1582
1583        #[inline(always)]
1584        fn inline_align(_context: fidl::encoding::Context) -> usize {
1585            std::mem::align_of::<u32>()
1586        }
1587
1588        #[inline(always)]
1589        fn inline_size(_context: fidl::encoding::Context) -> usize {
1590            std::mem::size_of::<u32>()
1591        }
1592
1593        #[inline(always)]
1594        fn encode_is_copy() -> bool {
1595            false
1596        }
1597
1598        #[inline(always)]
1599        fn decode_is_copy() -> bool {
1600            false
1601        }
1602    }
1603
1604    impl fidl::encoding::ValueTypeMarker for DeviceType {
1605        type Borrowed<'a> = Self;
1606        #[inline(always)]
1607        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1608            *value
1609        }
1610    }
1611
1612    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
1613        #[inline]
1614        unsafe fn encode(
1615            self,
1616            encoder: &mut fidl::encoding::Encoder<'_, D>,
1617            offset: usize,
1618            _depth: fidl::encoding::Depth,
1619        ) -> fidl::Result<()> {
1620            encoder.debug_check_bounds::<Self>(offset);
1621            encoder.write_num(self.into_primitive(), offset);
1622            Ok(())
1623        }
1624    }
1625
1626    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
1627        #[inline(always)]
1628        fn new_empty() -> Self {
1629            Self::unknown()
1630        }
1631
1632        #[inline]
1633        unsafe fn decode(
1634            &mut self,
1635            decoder: &mut fidl::encoding::Decoder<'_, D>,
1636            offset: usize,
1637            _depth: fidl::encoding::Depth,
1638        ) -> fidl::Result<()> {
1639            decoder.debug_check_bounds::<Self>(offset);
1640            let prim = decoder.read_num::<u32>(offset);
1641
1642            *self = Self::from_primitive_allow_unknown(prim);
1643            Ok(())
1644        }
1645    }
1646    unsafe impl fidl::encoding::TypeMarker for LedType {
1647        type Owned = Self;
1648
1649        #[inline(always)]
1650        fn inline_align(_context: fidl::encoding::Context) -> usize {
1651            std::mem::align_of::<u32>()
1652        }
1653
1654        #[inline(always)]
1655        fn inline_size(_context: fidl::encoding::Context) -> usize {
1656            std::mem::size_of::<u32>()
1657        }
1658
1659        #[inline(always)]
1660        fn encode_is_copy() -> bool {
1661            false
1662        }
1663
1664        #[inline(always)]
1665        fn decode_is_copy() -> bool {
1666            false
1667        }
1668    }
1669
1670    impl fidl::encoding::ValueTypeMarker for LedType {
1671        type Borrowed<'a> = Self;
1672        #[inline(always)]
1673        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1674            *value
1675        }
1676    }
1677
1678    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LedType {
1679        #[inline]
1680        unsafe fn encode(
1681            self,
1682            encoder: &mut fidl::encoding::Encoder<'_, D>,
1683            offset: usize,
1684            _depth: fidl::encoding::Depth,
1685        ) -> fidl::Result<()> {
1686            encoder.debug_check_bounds::<Self>(offset);
1687            encoder.write_num(self.into_primitive(), offset);
1688            Ok(())
1689        }
1690    }
1691
1692    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LedType {
1693        #[inline(always)]
1694        fn new_empty() -> Self {
1695            Self::unknown()
1696        }
1697
1698        #[inline]
1699        unsafe fn decode(
1700            &mut self,
1701            decoder: &mut fidl::encoding::Decoder<'_, D>,
1702            offset: usize,
1703            _depth: fidl::encoding::Depth,
1704        ) -> fidl::Result<()> {
1705            decoder.debug_check_bounds::<Self>(offset);
1706            let prim = decoder.read_num::<u32>(offset);
1707
1708            *self = Self::from_primitive_allow_unknown(prim);
1709            Ok(())
1710        }
1711    }
1712    unsafe impl fidl::encoding::TypeMarker for SensorReportingState {
1713        type Owned = Self;
1714
1715        #[inline(always)]
1716        fn inline_align(_context: fidl::encoding::Context) -> usize {
1717            std::mem::align_of::<u32>()
1718        }
1719
1720        #[inline(always)]
1721        fn inline_size(_context: fidl::encoding::Context) -> usize {
1722            std::mem::size_of::<u32>()
1723        }
1724
1725        #[inline(always)]
1726        fn encode_is_copy() -> bool {
1727            false
1728        }
1729
1730        #[inline(always)]
1731        fn decode_is_copy() -> bool {
1732            false
1733        }
1734    }
1735
1736    impl fidl::encoding::ValueTypeMarker for SensorReportingState {
1737        type Borrowed<'a> = Self;
1738        #[inline(always)]
1739        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1740            *value
1741        }
1742    }
1743
1744    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1745        for SensorReportingState
1746    {
1747        #[inline]
1748        unsafe fn encode(
1749            self,
1750            encoder: &mut fidl::encoding::Encoder<'_, D>,
1751            offset: usize,
1752            _depth: fidl::encoding::Depth,
1753        ) -> fidl::Result<()> {
1754            encoder.debug_check_bounds::<Self>(offset);
1755            encoder.write_num(self.into_primitive(), offset);
1756            Ok(())
1757        }
1758    }
1759
1760    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReportingState {
1761        #[inline(always)]
1762        fn new_empty() -> Self {
1763            Self::unknown()
1764        }
1765
1766        #[inline]
1767        unsafe fn decode(
1768            &mut self,
1769            decoder: &mut fidl::encoding::Decoder<'_, D>,
1770            offset: usize,
1771            _depth: fidl::encoding::Depth,
1772        ) -> fidl::Result<()> {
1773            decoder.debug_check_bounds::<Self>(offset);
1774            let prim = decoder.read_num::<u32>(offset);
1775
1776            *self = Self::from_primitive_allow_unknown(prim);
1777            Ok(())
1778        }
1779    }
1780    unsafe impl fidl::encoding::TypeMarker for SensorType {
1781        type Owned = Self;
1782
1783        #[inline(always)]
1784        fn inline_align(_context: fidl::encoding::Context) -> usize {
1785            std::mem::align_of::<u32>()
1786        }
1787
1788        #[inline(always)]
1789        fn inline_size(_context: fidl::encoding::Context) -> usize {
1790            std::mem::size_of::<u32>()
1791        }
1792
1793        #[inline(always)]
1794        fn encode_is_copy() -> bool {
1795            false
1796        }
1797
1798        #[inline(always)]
1799        fn decode_is_copy() -> bool {
1800            false
1801        }
1802    }
1803
1804    impl fidl::encoding::ValueTypeMarker for SensorType {
1805        type Borrowed<'a> = Self;
1806        #[inline(always)]
1807        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1808            *value
1809        }
1810    }
1811
1812    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1813        #[inline]
1814        unsafe fn encode(
1815            self,
1816            encoder: &mut fidl::encoding::Encoder<'_, D>,
1817            offset: usize,
1818            _depth: fidl::encoding::Depth,
1819        ) -> fidl::Result<()> {
1820            encoder.debug_check_bounds::<Self>(offset);
1821            encoder.write_num(self.into_primitive(), offset);
1822            Ok(())
1823        }
1824    }
1825
1826    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1827        #[inline(always)]
1828        fn new_empty() -> Self {
1829            Self::unknown()
1830        }
1831
1832        #[inline]
1833        unsafe fn decode(
1834            &mut self,
1835            decoder: &mut fidl::encoding::Decoder<'_, D>,
1836            offset: usize,
1837            _depth: fidl::encoding::Depth,
1838        ) -> fidl::Result<()> {
1839            decoder.debug_check_bounds::<Self>(offset);
1840            let prim = decoder.read_num::<u32>(offset);
1841
1842            *self = Self::from_primitive_allow_unknown(prim);
1843            Ok(())
1844        }
1845    }
1846    unsafe impl fidl::encoding::TypeMarker for TouchConfigurationInputMode {
1847        type Owned = Self;
1848
1849        #[inline(always)]
1850        fn inline_align(_context: fidl::encoding::Context) -> usize {
1851            std::mem::align_of::<u32>()
1852        }
1853
1854        #[inline(always)]
1855        fn inline_size(_context: fidl::encoding::Context) -> usize {
1856            std::mem::size_of::<u32>()
1857        }
1858
1859        #[inline(always)]
1860        fn encode_is_copy() -> bool {
1861            false
1862        }
1863
1864        #[inline(always)]
1865        fn decode_is_copy() -> bool {
1866            false
1867        }
1868    }
1869
1870    impl fidl::encoding::ValueTypeMarker for TouchConfigurationInputMode {
1871        type Borrowed<'a> = Self;
1872        #[inline(always)]
1873        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1874            *value
1875        }
1876    }
1877
1878    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1879        for TouchConfigurationInputMode
1880    {
1881        #[inline]
1882        unsafe fn encode(
1883            self,
1884            encoder: &mut fidl::encoding::Encoder<'_, D>,
1885            offset: usize,
1886            _depth: fidl::encoding::Depth,
1887        ) -> fidl::Result<()> {
1888            encoder.debug_check_bounds::<Self>(offset);
1889            encoder.write_num(self.into_primitive(), offset);
1890            Ok(())
1891        }
1892    }
1893
1894    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1895        for TouchConfigurationInputMode
1896    {
1897        #[inline(always)]
1898        fn new_empty() -> Self {
1899            Self::unknown()
1900        }
1901
1902        #[inline]
1903        unsafe fn decode(
1904            &mut self,
1905            decoder: &mut fidl::encoding::Decoder<'_, D>,
1906            offset: usize,
1907            _depth: fidl::encoding::Depth,
1908        ) -> fidl::Result<()> {
1909            decoder.debug_check_bounds::<Self>(offset);
1910            let prim = decoder.read_num::<u32>(offset);
1911
1912            *self = Self::from_primitive_allow_unknown(prim);
1913            Ok(())
1914        }
1915    }
1916    unsafe impl fidl::encoding::TypeMarker for TouchType {
1917        type Owned = Self;
1918
1919        #[inline(always)]
1920        fn inline_align(_context: fidl::encoding::Context) -> usize {
1921            std::mem::align_of::<u32>()
1922        }
1923
1924        #[inline(always)]
1925        fn inline_size(_context: fidl::encoding::Context) -> usize {
1926            std::mem::size_of::<u32>()
1927        }
1928
1929        #[inline(always)]
1930        fn encode_is_copy() -> bool {
1931            false
1932        }
1933
1934        #[inline(always)]
1935        fn decode_is_copy() -> bool {
1936            false
1937        }
1938    }
1939
1940    impl fidl::encoding::ValueTypeMarker for TouchType {
1941        type Borrowed<'a> = Self;
1942        #[inline(always)]
1943        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1944            *value
1945        }
1946    }
1947
1948    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchType {
1949        #[inline]
1950        unsafe fn encode(
1951            self,
1952            encoder: &mut fidl::encoding::Encoder<'_, D>,
1953            offset: usize,
1954            _depth: fidl::encoding::Depth,
1955        ) -> fidl::Result<()> {
1956            encoder.debug_check_bounds::<Self>(offset);
1957            encoder.write_num(self.into_primitive(), offset);
1958            Ok(())
1959        }
1960    }
1961
1962    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchType {
1963        #[inline(always)]
1964        fn new_empty() -> Self {
1965            Self::unknown()
1966        }
1967
1968        #[inline]
1969        unsafe fn decode(
1970            &mut self,
1971            decoder: &mut fidl::encoding::Decoder<'_, D>,
1972            offset: usize,
1973            _depth: fidl::encoding::Depth,
1974        ) -> fidl::Result<()> {
1975            decoder.debug_check_bounds::<Self>(offset);
1976            let prim = decoder.read_num::<u32>(offset);
1977
1978            *self = Self::from_primitive_allow_unknown(prim);
1979            Ok(())
1980        }
1981    }
1982    unsafe impl fidl::encoding::TypeMarker for UnitType {
1983        type Owned = Self;
1984
1985        #[inline(always)]
1986        fn inline_align(_context: fidl::encoding::Context) -> usize {
1987            std::mem::align_of::<u32>()
1988        }
1989
1990        #[inline(always)]
1991        fn inline_size(_context: fidl::encoding::Context) -> usize {
1992            std::mem::size_of::<u32>()
1993        }
1994
1995        #[inline(always)]
1996        fn encode_is_copy() -> bool {
1997            false
1998        }
1999
2000        #[inline(always)]
2001        fn decode_is_copy() -> bool {
2002            false
2003        }
2004    }
2005
2006    impl fidl::encoding::ValueTypeMarker for UnitType {
2007        type Borrowed<'a> = Self;
2008        #[inline(always)]
2009        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2010            *value
2011        }
2012    }
2013
2014    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UnitType {
2015        #[inline]
2016        unsafe fn encode(
2017            self,
2018            encoder: &mut fidl::encoding::Encoder<'_, D>,
2019            offset: usize,
2020            _depth: fidl::encoding::Depth,
2021        ) -> fidl::Result<()> {
2022            encoder.debug_check_bounds::<Self>(offset);
2023            encoder.write_num(self.into_primitive(), offset);
2024            Ok(())
2025        }
2026    }
2027
2028    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnitType {
2029        #[inline(always)]
2030        fn new_empty() -> Self {
2031            Self::unknown()
2032        }
2033
2034        #[inline]
2035        unsafe fn decode(
2036            &mut self,
2037            decoder: &mut fidl::encoding::Decoder<'_, D>,
2038            offset: usize,
2039            _depth: fidl::encoding::Depth,
2040        ) -> fidl::Result<()> {
2041            decoder.debug_check_bounds::<Self>(offset);
2042            let prim = decoder.read_num::<u32>(offset);
2043
2044            *self = Self::from_primitive_allow_unknown(prim);
2045            Ok(())
2046        }
2047    }
2048    unsafe impl fidl::encoding::TypeMarker for VendorGoogleProductId {
2049        type Owned = Self;
2050
2051        #[inline(always)]
2052        fn inline_align(_context: fidl::encoding::Context) -> usize {
2053            std::mem::align_of::<u32>()
2054        }
2055
2056        #[inline(always)]
2057        fn inline_size(_context: fidl::encoding::Context) -> usize {
2058            std::mem::size_of::<u32>()
2059        }
2060
2061        #[inline(always)]
2062        fn encode_is_copy() -> bool {
2063            false
2064        }
2065
2066        #[inline(always)]
2067        fn decode_is_copy() -> bool {
2068            false
2069        }
2070    }
2071
2072    impl fidl::encoding::ValueTypeMarker for VendorGoogleProductId {
2073        type Borrowed<'a> = Self;
2074        #[inline(always)]
2075        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2076            *value
2077        }
2078    }
2079
2080    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2081        for VendorGoogleProductId
2082    {
2083        #[inline]
2084        unsafe fn encode(
2085            self,
2086            encoder: &mut fidl::encoding::Encoder<'_, D>,
2087            offset: usize,
2088            _depth: fidl::encoding::Depth,
2089        ) -> fidl::Result<()> {
2090            encoder.debug_check_bounds::<Self>(offset);
2091            encoder.write_num(self.into_primitive(), offset);
2092            Ok(())
2093        }
2094    }
2095
2096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorGoogleProductId {
2097        #[inline(always)]
2098        fn new_empty() -> Self {
2099            Self::unknown()
2100        }
2101
2102        #[inline]
2103        unsafe fn decode(
2104            &mut self,
2105            decoder: &mut fidl::encoding::Decoder<'_, D>,
2106            offset: usize,
2107            _depth: fidl::encoding::Depth,
2108        ) -> fidl::Result<()> {
2109            decoder.debug_check_bounds::<Self>(offset);
2110            let prim = decoder.read_num::<u32>(offset);
2111
2112            *self = Self::from_primitive_allow_unknown(prim);
2113            Ok(())
2114        }
2115    }
2116    unsafe impl fidl::encoding::TypeMarker for VendorId {
2117        type Owned = Self;
2118
2119        #[inline(always)]
2120        fn inline_align(_context: fidl::encoding::Context) -> usize {
2121            std::mem::align_of::<u32>()
2122        }
2123
2124        #[inline(always)]
2125        fn inline_size(_context: fidl::encoding::Context) -> usize {
2126            std::mem::size_of::<u32>()
2127        }
2128
2129        #[inline(always)]
2130        fn encode_is_copy() -> bool {
2131            false
2132        }
2133
2134        #[inline(always)]
2135        fn decode_is_copy() -> bool {
2136            false
2137        }
2138    }
2139
2140    impl fidl::encoding::ValueTypeMarker for VendorId {
2141        type Borrowed<'a> = Self;
2142        #[inline(always)]
2143        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2144            *value
2145        }
2146    }
2147
2148    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for VendorId {
2149        #[inline]
2150        unsafe fn encode(
2151            self,
2152            encoder: &mut fidl::encoding::Encoder<'_, D>,
2153            offset: usize,
2154            _depth: fidl::encoding::Depth,
2155        ) -> fidl::Result<()> {
2156            encoder.debug_check_bounds::<Self>(offset);
2157            encoder.write_num(self.into_primitive(), offset);
2158            Ok(())
2159        }
2160    }
2161
2162    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorId {
2163        #[inline(always)]
2164        fn new_empty() -> Self {
2165            Self::unknown()
2166        }
2167
2168        #[inline]
2169        unsafe fn decode(
2170            &mut self,
2171            decoder: &mut fidl::encoding::Decoder<'_, D>,
2172            offset: usize,
2173            _depth: fidl::encoding::Depth,
2174        ) -> fidl::Result<()> {
2175            decoder.debug_check_bounds::<Self>(offset);
2176            let prim = decoder.read_num::<u32>(offset);
2177
2178            *self = Self::from_primitive_allow_unknown(prim);
2179            Ok(())
2180        }
2181    }
2182
2183    impl fidl::encoding::ValueTypeMarker for Axis {
2184        type Borrowed<'a> = &'a Self;
2185        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2186            value
2187        }
2188    }
2189
2190    unsafe impl fidl::encoding::TypeMarker for Axis {
2191        type Owned = Self;
2192
2193        #[inline(always)]
2194        fn inline_align(_context: fidl::encoding::Context) -> usize {
2195            8
2196        }
2197
2198        #[inline(always)]
2199        fn inline_size(_context: fidl::encoding::Context) -> usize {
2200            24
2201        }
2202    }
2203
2204    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
2205        #[inline]
2206        unsafe fn encode(
2207            self,
2208            encoder: &mut fidl::encoding::Encoder<'_, D>,
2209            offset: usize,
2210            _depth: fidl::encoding::Depth,
2211        ) -> fidl::Result<()> {
2212            encoder.debug_check_bounds::<Axis>(offset);
2213            // Delegate to tuple encoding.
2214            fidl::encoding::Encode::<Axis, D>::encode(
2215                (
2216                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2217                    <Unit as fidl::encoding::ValueTypeMarker>::borrow(&self.unit),
2218                ),
2219                encoder,
2220                offset,
2221                _depth,
2222            )
2223        }
2224    }
2225    unsafe impl<
2226            D: fidl::encoding::ResourceDialect,
2227            T0: fidl::encoding::Encode<Range, D>,
2228            T1: fidl::encoding::Encode<Unit, D>,
2229        > fidl::encoding::Encode<Axis, D> for (T0, T1)
2230    {
2231        #[inline]
2232        unsafe fn encode(
2233            self,
2234            encoder: &mut fidl::encoding::Encoder<'_, D>,
2235            offset: usize,
2236            depth: fidl::encoding::Depth,
2237        ) -> fidl::Result<()> {
2238            encoder.debug_check_bounds::<Axis>(offset);
2239            // Zero out padding regions. There's no need to apply masks
2240            // because the unmasked parts will be overwritten by fields.
2241            // Write the fields.
2242            self.0.encode(encoder, offset + 0, depth)?;
2243            self.1.encode(encoder, offset + 16, depth)?;
2244            Ok(())
2245        }
2246    }
2247
2248    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
2249        #[inline(always)]
2250        fn new_empty() -> Self {
2251            Self { range: fidl::new_empty!(Range, D), unit: fidl::new_empty!(Unit, D) }
2252        }
2253
2254        #[inline]
2255        unsafe fn decode(
2256            &mut self,
2257            decoder: &mut fidl::encoding::Decoder<'_, D>,
2258            offset: usize,
2259            _depth: fidl::encoding::Depth,
2260        ) -> fidl::Result<()> {
2261            decoder.debug_check_bounds::<Self>(offset);
2262            // Verify that padding bytes are zero.
2263            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
2264            fidl::decode!(Unit, D, &mut self.unit, decoder, offset + 16, _depth)?;
2265            Ok(())
2266        }
2267    }
2268
2269    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2270        type Borrowed<'a> = &'a Self;
2271        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2272            value
2273        }
2274    }
2275
2276    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2277        type Owned = Self;
2278
2279        #[inline(always)]
2280        fn inline_align(_context: fidl::encoding::Context) -> usize {
2281            4
2282        }
2283
2284        #[inline(always)]
2285        fn inline_size(_context: fidl::encoding::Context) -> usize {
2286            12
2287        }
2288        #[inline(always)]
2289        fn encode_is_copy() -> bool {
2290            true
2291        }
2292
2293        #[inline(always)]
2294        fn decode_is_copy() -> bool {
2295            true
2296        }
2297    }
2298
2299    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2300        for &DeviceInfo
2301    {
2302        #[inline]
2303        unsafe fn encode(
2304            self,
2305            encoder: &mut fidl::encoding::Encoder<'_, D>,
2306            offset: usize,
2307            _depth: fidl::encoding::Depth,
2308        ) -> fidl::Result<()> {
2309            encoder.debug_check_bounds::<DeviceInfo>(offset);
2310            unsafe {
2311                // Copy the object into the buffer.
2312                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2313                (buf_ptr as *mut DeviceInfo).write_unaligned((self as *const DeviceInfo).read());
2314                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2315                // done second because the memcpy will write garbage to these bytes.
2316            }
2317            Ok(())
2318        }
2319    }
2320    unsafe impl<
2321            D: fidl::encoding::ResourceDialect,
2322            T0: fidl::encoding::Encode<u32, D>,
2323            T1: fidl::encoding::Encode<u32, D>,
2324            T2: fidl::encoding::Encode<u32, D>,
2325        > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2)
2326    {
2327        #[inline]
2328        unsafe fn encode(
2329            self,
2330            encoder: &mut fidl::encoding::Encoder<'_, D>,
2331            offset: usize,
2332            depth: fidl::encoding::Depth,
2333        ) -> fidl::Result<()> {
2334            encoder.debug_check_bounds::<DeviceInfo>(offset);
2335            // Zero out padding regions. There's no need to apply masks
2336            // because the unmasked parts will be overwritten by fields.
2337            // Write the fields.
2338            self.0.encode(encoder, offset + 0, depth)?;
2339            self.1.encode(encoder, offset + 4, depth)?;
2340            self.2.encode(encoder, offset + 8, depth)?;
2341            Ok(())
2342        }
2343    }
2344
2345    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2346        #[inline(always)]
2347        fn new_empty() -> Self {
2348            Self {
2349                vendor_id: fidl::new_empty!(u32, D),
2350                product_id: fidl::new_empty!(u32, D),
2351                version: fidl::new_empty!(u32, D),
2352            }
2353        }
2354
2355        #[inline]
2356        unsafe fn decode(
2357            &mut self,
2358            decoder: &mut fidl::encoding::Decoder<'_, D>,
2359            offset: usize,
2360            _depth: fidl::encoding::Depth,
2361        ) -> fidl::Result<()> {
2362            decoder.debug_check_bounds::<Self>(offset);
2363            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2364            // Verify that padding bytes are zero.
2365            // Copy from the buffer into the object.
2366            unsafe {
2367                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2368            }
2369            Ok(())
2370        }
2371    }
2372
2373    impl fidl::encoding::ValueTypeMarker for InputDeviceGetDescriptorResponse {
2374        type Borrowed<'a> = &'a Self;
2375        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2376            value
2377        }
2378    }
2379
2380    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetDescriptorResponse {
2381        type Owned = Self;
2382
2383        #[inline(always)]
2384        fn inline_align(_context: fidl::encoding::Context) -> usize {
2385            8
2386        }
2387
2388        #[inline(always)]
2389        fn inline_size(_context: fidl::encoding::Context) -> usize {
2390            16
2391        }
2392    }
2393
2394    unsafe impl<D: fidl::encoding::ResourceDialect>
2395        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D>
2396        for &InputDeviceGetDescriptorResponse
2397    {
2398        #[inline]
2399        unsafe fn encode(
2400            self,
2401            encoder: &mut fidl::encoding::Encoder<'_, D>,
2402            offset: usize,
2403            _depth: fidl::encoding::Depth,
2404        ) -> fidl::Result<()> {
2405            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2406            // Delegate to tuple encoding.
2407            fidl::encoding::Encode::<InputDeviceGetDescriptorResponse, D>::encode(
2408                (<DeviceDescriptor as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptor),),
2409                encoder,
2410                offset,
2411                _depth,
2412            )
2413        }
2414    }
2415    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceDescriptor, D>>
2416        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D> for (T0,)
2417    {
2418        #[inline]
2419        unsafe fn encode(
2420            self,
2421            encoder: &mut fidl::encoding::Encoder<'_, D>,
2422            offset: usize,
2423            depth: fidl::encoding::Depth,
2424        ) -> fidl::Result<()> {
2425            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2426            // Zero out padding regions. There's no need to apply masks
2427            // because the unmasked parts will be overwritten by fields.
2428            // Write the fields.
2429            self.0.encode(encoder, offset + 0, depth)?;
2430            Ok(())
2431        }
2432    }
2433
2434    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2435        for InputDeviceGetDescriptorResponse
2436    {
2437        #[inline(always)]
2438        fn new_empty() -> Self {
2439            Self { descriptor: fidl::new_empty!(DeviceDescriptor, D) }
2440        }
2441
2442        #[inline]
2443        unsafe fn decode(
2444            &mut self,
2445            decoder: &mut fidl::encoding::Decoder<'_, D>,
2446            offset: usize,
2447            _depth: fidl::encoding::Depth,
2448        ) -> fidl::Result<()> {
2449            decoder.debug_check_bounds::<Self>(offset);
2450            // Verify that padding bytes are zero.
2451            fidl::decode!(DeviceDescriptor, D, &mut self.descriptor, decoder, offset + 0, _depth)?;
2452            Ok(())
2453        }
2454    }
2455
2456    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportRequest {
2457        type Borrowed<'a> = &'a Self;
2458        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2459            value
2460        }
2461    }
2462
2463    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportRequest {
2464        type Owned = Self;
2465
2466        #[inline(always)]
2467        fn inline_align(_context: fidl::encoding::Context) -> usize {
2468            4
2469        }
2470
2471        #[inline(always)]
2472        fn inline_size(_context: fidl::encoding::Context) -> usize {
2473            4
2474        }
2475    }
2476
2477    unsafe impl<D: fidl::encoding::ResourceDialect>
2478        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D>
2479        for &InputDeviceGetInputReportRequest
2480    {
2481        #[inline]
2482        unsafe fn encode(
2483            self,
2484            encoder: &mut fidl::encoding::Encoder<'_, D>,
2485            offset: usize,
2486            _depth: fidl::encoding::Depth,
2487        ) -> fidl::Result<()> {
2488            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2489            // Delegate to tuple encoding.
2490            fidl::encoding::Encode::<InputDeviceGetInputReportRequest, D>::encode(
2491                (<DeviceType as fidl::encoding::ValueTypeMarker>::borrow(&self.device_type),),
2492                encoder,
2493                offset,
2494                _depth,
2495            )
2496        }
2497    }
2498    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceType, D>>
2499        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D> for (T0,)
2500    {
2501        #[inline]
2502        unsafe fn encode(
2503            self,
2504            encoder: &mut fidl::encoding::Encoder<'_, D>,
2505            offset: usize,
2506            depth: fidl::encoding::Depth,
2507        ) -> fidl::Result<()> {
2508            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2509            // Zero out padding regions. There's no need to apply masks
2510            // because the unmasked parts will be overwritten by fields.
2511            // Write the fields.
2512            self.0.encode(encoder, offset + 0, depth)?;
2513            Ok(())
2514        }
2515    }
2516
2517    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2518        for InputDeviceGetInputReportRequest
2519    {
2520        #[inline(always)]
2521        fn new_empty() -> Self {
2522            Self { device_type: fidl::new_empty!(DeviceType, D) }
2523        }
2524
2525        #[inline]
2526        unsafe fn decode(
2527            &mut self,
2528            decoder: &mut fidl::encoding::Decoder<'_, D>,
2529            offset: usize,
2530            _depth: fidl::encoding::Depth,
2531        ) -> fidl::Result<()> {
2532            decoder.debug_check_bounds::<Self>(offset);
2533            // Verify that padding bytes are zero.
2534            fidl::decode!(DeviceType, D, &mut self.device_type, decoder, offset + 0, _depth)?;
2535            Ok(())
2536        }
2537    }
2538
2539    impl fidl::encoding::ValueTypeMarker for InputDeviceSendOutputReportRequest {
2540        type Borrowed<'a> = &'a Self;
2541        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2542            value
2543        }
2544    }
2545
2546    unsafe impl fidl::encoding::TypeMarker for InputDeviceSendOutputReportRequest {
2547        type Owned = Self;
2548
2549        #[inline(always)]
2550        fn inline_align(_context: fidl::encoding::Context) -> usize {
2551            8
2552        }
2553
2554        #[inline(always)]
2555        fn inline_size(_context: fidl::encoding::Context) -> usize {
2556            16
2557        }
2558    }
2559
2560    unsafe impl<D: fidl::encoding::ResourceDialect>
2561        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D>
2562        for &InputDeviceSendOutputReportRequest
2563    {
2564        #[inline]
2565        unsafe fn encode(
2566            self,
2567            encoder: &mut fidl::encoding::Encoder<'_, D>,
2568            offset: usize,
2569            _depth: fidl::encoding::Depth,
2570        ) -> fidl::Result<()> {
2571            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2572            // Delegate to tuple encoding.
2573            fidl::encoding::Encode::<InputDeviceSendOutputReportRequest, D>::encode(
2574                (<OutputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2575                encoder,
2576                offset,
2577                _depth,
2578            )
2579        }
2580    }
2581    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OutputReport, D>>
2582        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D> for (T0,)
2583    {
2584        #[inline]
2585        unsafe fn encode(
2586            self,
2587            encoder: &mut fidl::encoding::Encoder<'_, D>,
2588            offset: usize,
2589            depth: fidl::encoding::Depth,
2590        ) -> fidl::Result<()> {
2591            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2592            // Zero out padding regions. There's no need to apply masks
2593            // because the unmasked parts will be overwritten by fields.
2594            // Write the fields.
2595            self.0.encode(encoder, offset + 0, depth)?;
2596            Ok(())
2597        }
2598    }
2599
2600    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2601        for InputDeviceSendOutputReportRequest
2602    {
2603        #[inline(always)]
2604        fn new_empty() -> Self {
2605            Self { report: fidl::new_empty!(OutputReport, D) }
2606        }
2607
2608        #[inline]
2609        unsafe fn decode(
2610            &mut self,
2611            decoder: &mut fidl::encoding::Decoder<'_, D>,
2612            offset: usize,
2613            _depth: fidl::encoding::Depth,
2614        ) -> fidl::Result<()> {
2615            decoder.debug_check_bounds::<Self>(offset);
2616            // Verify that padding bytes are zero.
2617            fidl::decode!(OutputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2618            Ok(())
2619        }
2620    }
2621
2622    impl fidl::encoding::ValueTypeMarker for InputDeviceSetFeatureReportRequest {
2623        type Borrowed<'a> = &'a Self;
2624        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2625            value
2626        }
2627    }
2628
2629    unsafe impl fidl::encoding::TypeMarker for InputDeviceSetFeatureReportRequest {
2630        type Owned = Self;
2631
2632        #[inline(always)]
2633        fn inline_align(_context: fidl::encoding::Context) -> usize {
2634            8
2635        }
2636
2637        #[inline(always)]
2638        fn inline_size(_context: fidl::encoding::Context) -> usize {
2639            16
2640        }
2641    }
2642
2643    unsafe impl<D: fidl::encoding::ResourceDialect>
2644        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D>
2645        for &InputDeviceSetFeatureReportRequest
2646    {
2647        #[inline]
2648        unsafe fn encode(
2649            self,
2650            encoder: &mut fidl::encoding::Encoder<'_, D>,
2651            offset: usize,
2652            _depth: fidl::encoding::Depth,
2653        ) -> fidl::Result<()> {
2654            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2655            // Delegate to tuple encoding.
2656            fidl::encoding::Encode::<InputDeviceSetFeatureReportRequest, D>::encode(
2657                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2658                encoder,
2659                offset,
2660                _depth,
2661            )
2662        }
2663    }
2664    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2665        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D> for (T0,)
2666    {
2667        #[inline]
2668        unsafe fn encode(
2669            self,
2670            encoder: &mut fidl::encoding::Encoder<'_, D>,
2671            offset: usize,
2672            depth: fidl::encoding::Depth,
2673        ) -> fidl::Result<()> {
2674            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2675            // Zero out padding regions. There's no need to apply masks
2676            // because the unmasked parts will be overwritten by fields.
2677            // Write the fields.
2678            self.0.encode(encoder, offset + 0, depth)?;
2679            Ok(())
2680        }
2681    }
2682
2683    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2684        for InputDeviceSetFeatureReportRequest
2685    {
2686        #[inline(always)]
2687        fn new_empty() -> Self {
2688            Self { report: fidl::new_empty!(FeatureReport, D) }
2689        }
2690
2691        #[inline]
2692        unsafe fn decode(
2693            &mut self,
2694            decoder: &mut fidl::encoding::Decoder<'_, D>,
2695            offset: usize,
2696            _depth: fidl::encoding::Depth,
2697        ) -> fidl::Result<()> {
2698            decoder.debug_check_bounds::<Self>(offset);
2699            // Verify that padding bytes are zero.
2700            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2701            Ok(())
2702        }
2703    }
2704
2705    impl fidl::encoding::ValueTypeMarker for InputDeviceGetFeatureReportResponse {
2706        type Borrowed<'a> = &'a Self;
2707        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2708            value
2709        }
2710    }
2711
2712    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetFeatureReportResponse {
2713        type Owned = Self;
2714
2715        #[inline(always)]
2716        fn inline_align(_context: fidl::encoding::Context) -> usize {
2717            8
2718        }
2719
2720        #[inline(always)]
2721        fn inline_size(_context: fidl::encoding::Context) -> usize {
2722            16
2723        }
2724    }
2725
2726    unsafe impl<D: fidl::encoding::ResourceDialect>
2727        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D>
2728        for &InputDeviceGetFeatureReportResponse
2729    {
2730        #[inline]
2731        unsafe fn encode(
2732            self,
2733            encoder: &mut fidl::encoding::Encoder<'_, D>,
2734            offset: usize,
2735            _depth: fidl::encoding::Depth,
2736        ) -> fidl::Result<()> {
2737            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2738            // Delegate to tuple encoding.
2739            fidl::encoding::Encode::<InputDeviceGetFeatureReportResponse, D>::encode(
2740                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2741                encoder,
2742                offset,
2743                _depth,
2744            )
2745        }
2746    }
2747    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2748        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D> for (T0,)
2749    {
2750        #[inline]
2751        unsafe fn encode(
2752            self,
2753            encoder: &mut fidl::encoding::Encoder<'_, D>,
2754            offset: usize,
2755            depth: fidl::encoding::Depth,
2756        ) -> fidl::Result<()> {
2757            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2758            // Zero out padding regions. There's no need to apply masks
2759            // because the unmasked parts will be overwritten by fields.
2760            // Write the fields.
2761            self.0.encode(encoder, offset + 0, depth)?;
2762            Ok(())
2763        }
2764    }
2765
2766    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2767        for InputDeviceGetFeatureReportResponse
2768    {
2769        #[inline(always)]
2770        fn new_empty() -> Self {
2771            Self { report: fidl::new_empty!(FeatureReport, D) }
2772        }
2773
2774        #[inline]
2775        unsafe fn decode(
2776            &mut self,
2777            decoder: &mut fidl::encoding::Decoder<'_, D>,
2778            offset: usize,
2779            _depth: fidl::encoding::Depth,
2780        ) -> fidl::Result<()> {
2781            decoder.debug_check_bounds::<Self>(offset);
2782            // Verify that padding bytes are zero.
2783            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2784            Ok(())
2785        }
2786    }
2787
2788    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportResponse {
2789        type Borrowed<'a> = &'a Self;
2790        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2791            value
2792        }
2793    }
2794
2795    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2796        type Owned = Self;
2797
2798        #[inline(always)]
2799        fn inline_align(_context: fidl::encoding::Context) -> usize {
2800            8
2801        }
2802
2803        #[inline(always)]
2804        fn inline_size(_context: fidl::encoding::Context) -> usize {
2805            16
2806        }
2807    }
2808
2809    unsafe impl<D: fidl::encoding::ResourceDialect>
2810        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D>
2811        for &InputDeviceGetInputReportResponse
2812    {
2813        #[inline]
2814        unsafe fn encode(
2815            self,
2816            encoder: &mut fidl::encoding::Encoder<'_, D>,
2817            offset: usize,
2818            _depth: fidl::encoding::Depth,
2819        ) -> fidl::Result<()> {
2820            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2821            // Delegate to tuple encoding.
2822            fidl::encoding::Encode::<InputDeviceGetInputReportResponse, D>::encode(
2823                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2824                encoder,
2825                offset,
2826                _depth,
2827            )
2828        }
2829    }
2830    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2831        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D> for (T0,)
2832    {
2833        #[inline]
2834        unsafe fn encode(
2835            self,
2836            encoder: &mut fidl::encoding::Encoder<'_, D>,
2837            offset: usize,
2838            depth: fidl::encoding::Depth,
2839        ) -> fidl::Result<()> {
2840            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2841            // Zero out padding regions. There's no need to apply masks
2842            // because the unmasked parts will be overwritten by fields.
2843            // Write the fields.
2844            self.0.encode(encoder, offset + 0, depth)?;
2845            Ok(())
2846        }
2847    }
2848
2849    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2850        for InputDeviceGetInputReportResponse
2851    {
2852        #[inline(always)]
2853        fn new_empty() -> Self {
2854            Self { report: fidl::new_empty!(InputReport, D) }
2855        }
2856
2857        #[inline]
2858        unsafe fn decode(
2859            &mut self,
2860            decoder: &mut fidl::encoding::Decoder<'_, D>,
2861            offset: usize,
2862            _depth: fidl::encoding::Depth,
2863        ) -> fidl::Result<()> {
2864            decoder.debug_check_bounds::<Self>(offset);
2865            // Verify that padding bytes are zero.
2866            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2867            Ok(())
2868        }
2869    }
2870
2871    impl fidl::encoding::ValueTypeMarker for InputReportsReaderReadInputReportsResponse {
2872        type Borrowed<'a> = &'a Self;
2873        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2874            value
2875        }
2876    }
2877
2878    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2879        type Owned = Self;
2880
2881        #[inline(always)]
2882        fn inline_align(_context: fidl::encoding::Context) -> usize {
2883            8
2884        }
2885
2886        #[inline(always)]
2887        fn inline_size(_context: fidl::encoding::Context) -> usize {
2888            16
2889        }
2890    }
2891
2892    unsafe impl<D: fidl::encoding::ResourceDialect>
2893        fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D>
2894        for &InputReportsReaderReadInputReportsResponse
2895    {
2896        #[inline]
2897        unsafe fn encode(
2898            self,
2899            encoder: &mut fidl::encoding::Encoder<'_, D>,
2900            offset: usize,
2901            _depth: fidl::encoding::Depth,
2902        ) -> fidl::Result<()> {
2903            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2904            // Delegate to tuple encoding.
2905            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, D>::encode(
2906                (
2907                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.reports),
2908                ),
2909                encoder, offset, _depth
2910            )
2911        }
2912    }
2913    unsafe impl<
2914            D: fidl::encoding::ResourceDialect,
2915            T0: fidl::encoding::Encode<fidl::encoding::Vector<InputReport, 50>, D>,
2916        > fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D> for (T0,)
2917    {
2918        #[inline]
2919        unsafe fn encode(
2920            self,
2921            encoder: &mut fidl::encoding::Encoder<'_, D>,
2922            offset: usize,
2923            depth: fidl::encoding::Depth,
2924        ) -> fidl::Result<()> {
2925            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2926            // Zero out padding regions. There's no need to apply masks
2927            // because the unmasked parts will be overwritten by fields.
2928            // Write the fields.
2929            self.0.encode(encoder, offset + 0, depth)?;
2930            Ok(())
2931        }
2932    }
2933
2934    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2935        for InputReportsReaderReadInputReportsResponse
2936    {
2937        #[inline(always)]
2938        fn new_empty() -> Self {
2939            Self { reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, D) }
2940        }
2941
2942        #[inline]
2943        unsafe fn decode(
2944            &mut self,
2945            decoder: &mut fidl::encoding::Decoder<'_, D>,
2946            offset: usize,
2947            _depth: fidl::encoding::Depth,
2948        ) -> fidl::Result<()> {
2949            decoder.debug_check_bounds::<Self>(offset);
2950            // Verify that padding bytes are zero.
2951            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, D, &mut self.reports, decoder, offset + 0, _depth)?;
2952            Ok(())
2953        }
2954    }
2955
2956    impl fidl::encoding::ValueTypeMarker for Range {
2957        type Borrowed<'a> = &'a Self;
2958        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2959            value
2960        }
2961    }
2962
2963    unsafe impl fidl::encoding::TypeMarker for Range {
2964        type Owned = Self;
2965
2966        #[inline(always)]
2967        fn inline_align(_context: fidl::encoding::Context) -> usize {
2968            8
2969        }
2970
2971        #[inline(always)]
2972        fn inline_size(_context: fidl::encoding::Context) -> usize {
2973            16
2974        }
2975        #[inline(always)]
2976        fn encode_is_copy() -> bool {
2977            true
2978        }
2979
2980        #[inline(always)]
2981        fn decode_is_copy() -> bool {
2982            true
2983        }
2984    }
2985
2986    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
2987        #[inline]
2988        unsafe fn encode(
2989            self,
2990            encoder: &mut fidl::encoding::Encoder<'_, D>,
2991            offset: usize,
2992            _depth: fidl::encoding::Depth,
2993        ) -> fidl::Result<()> {
2994            encoder.debug_check_bounds::<Range>(offset);
2995            unsafe {
2996                // Copy the object into the buffer.
2997                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2998                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
2999                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3000                // done second because the memcpy will write garbage to these bytes.
3001            }
3002            Ok(())
3003        }
3004    }
3005    unsafe impl<
3006            D: fidl::encoding::ResourceDialect,
3007            T0: fidl::encoding::Encode<i64, D>,
3008            T1: fidl::encoding::Encode<i64, D>,
3009        > fidl::encoding::Encode<Range, D> for (T0, T1)
3010    {
3011        #[inline]
3012        unsafe fn encode(
3013            self,
3014            encoder: &mut fidl::encoding::Encoder<'_, D>,
3015            offset: usize,
3016            depth: fidl::encoding::Depth,
3017        ) -> fidl::Result<()> {
3018            encoder.debug_check_bounds::<Range>(offset);
3019            // Zero out padding regions. There's no need to apply masks
3020            // because the unmasked parts will be overwritten by fields.
3021            // Write the fields.
3022            self.0.encode(encoder, offset + 0, depth)?;
3023            self.1.encode(encoder, offset + 8, depth)?;
3024            Ok(())
3025        }
3026    }
3027
3028    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
3029        #[inline(always)]
3030        fn new_empty() -> Self {
3031            Self { min: fidl::new_empty!(i64, D), max: fidl::new_empty!(i64, D) }
3032        }
3033
3034        #[inline]
3035        unsafe fn decode(
3036            &mut self,
3037            decoder: &mut fidl::encoding::Decoder<'_, D>,
3038            offset: usize,
3039            _depth: fidl::encoding::Depth,
3040        ) -> fidl::Result<()> {
3041            decoder.debug_check_bounds::<Self>(offset);
3042            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3043            // Verify that padding bytes are zero.
3044            // Copy from the buffer into the object.
3045            unsafe {
3046                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3047            }
3048            Ok(())
3049        }
3050    }
3051
3052    impl fidl::encoding::ValueTypeMarker for SensorAxis {
3053        type Borrowed<'a> = &'a Self;
3054        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3055            value
3056        }
3057    }
3058
3059    unsafe impl fidl::encoding::TypeMarker for SensorAxis {
3060        type Owned = Self;
3061
3062        #[inline(always)]
3063        fn inline_align(_context: fidl::encoding::Context) -> usize {
3064            8
3065        }
3066
3067        #[inline(always)]
3068        fn inline_size(_context: fidl::encoding::Context) -> usize {
3069            32
3070        }
3071    }
3072
3073    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorAxis, D>
3074        for &SensorAxis
3075    {
3076        #[inline]
3077        unsafe fn encode(
3078            self,
3079            encoder: &mut fidl::encoding::Encoder<'_, D>,
3080            offset: usize,
3081            _depth: fidl::encoding::Depth,
3082        ) -> fidl::Result<()> {
3083            encoder.debug_check_bounds::<SensorAxis>(offset);
3084            // Delegate to tuple encoding.
3085            fidl::encoding::Encode::<SensorAxis, D>::encode(
3086                (
3087                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.axis),
3088                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3089                ),
3090                encoder,
3091                offset,
3092                _depth,
3093            )
3094        }
3095    }
3096    unsafe impl<
3097            D: fidl::encoding::ResourceDialect,
3098            T0: fidl::encoding::Encode<Axis, D>,
3099            T1: fidl::encoding::Encode<SensorType, D>,
3100        > fidl::encoding::Encode<SensorAxis, D> for (T0, T1)
3101    {
3102        #[inline]
3103        unsafe fn encode(
3104            self,
3105            encoder: &mut fidl::encoding::Encoder<'_, D>,
3106            offset: usize,
3107            depth: fidl::encoding::Depth,
3108        ) -> fidl::Result<()> {
3109            encoder.debug_check_bounds::<SensorAxis>(offset);
3110            // Zero out padding regions. There's no need to apply masks
3111            // because the unmasked parts will be overwritten by fields.
3112            unsafe {
3113                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3114                (ptr as *mut u64).write_unaligned(0);
3115            }
3116            // Write the fields.
3117            self.0.encode(encoder, offset + 0, depth)?;
3118            self.1.encode(encoder, offset + 24, depth)?;
3119            Ok(())
3120        }
3121    }
3122
3123    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorAxis {
3124        #[inline(always)]
3125        fn new_empty() -> Self {
3126            Self { axis: fidl::new_empty!(Axis, D), type_: fidl::new_empty!(SensorType, D) }
3127        }
3128
3129        #[inline]
3130        unsafe fn decode(
3131            &mut self,
3132            decoder: &mut fidl::encoding::Decoder<'_, D>,
3133            offset: usize,
3134            _depth: fidl::encoding::Depth,
3135        ) -> fidl::Result<()> {
3136            decoder.debug_check_bounds::<Self>(offset);
3137            // Verify that padding bytes are zero.
3138            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3139            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3140            let mask = 0xffffffff00000000u64;
3141            let maskedval = padval & mask;
3142            if maskedval != 0 {
3143                return Err(fidl::Error::NonZeroPadding {
3144                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3145                });
3146            }
3147            fidl::decode!(Axis, D, &mut self.axis, decoder, offset + 0, _depth)?;
3148            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 24, _depth)?;
3149            Ok(())
3150        }
3151    }
3152
3153    impl fidl::encoding::ValueTypeMarker for Unit {
3154        type Borrowed<'a> = &'a Self;
3155        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3156            value
3157        }
3158    }
3159
3160    unsafe impl fidl::encoding::TypeMarker for Unit {
3161        type Owned = Self;
3162
3163        #[inline(always)]
3164        fn inline_align(_context: fidl::encoding::Context) -> usize {
3165            4
3166        }
3167
3168        #[inline(always)]
3169        fn inline_size(_context: fidl::encoding::Context) -> usize {
3170            8
3171        }
3172    }
3173
3174    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
3175        #[inline]
3176        unsafe fn encode(
3177            self,
3178            encoder: &mut fidl::encoding::Encoder<'_, D>,
3179            offset: usize,
3180            _depth: fidl::encoding::Depth,
3181        ) -> fidl::Result<()> {
3182            encoder.debug_check_bounds::<Unit>(offset);
3183            // Delegate to tuple encoding.
3184            fidl::encoding::Encode::<Unit, D>::encode(
3185                (
3186                    <UnitType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3187                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
3188                ),
3189                encoder,
3190                offset,
3191                _depth,
3192            )
3193        }
3194    }
3195    unsafe impl<
3196            D: fidl::encoding::ResourceDialect,
3197            T0: fidl::encoding::Encode<UnitType, D>,
3198            T1: fidl::encoding::Encode<i32, D>,
3199        > fidl::encoding::Encode<Unit, D> for (T0, T1)
3200    {
3201        #[inline]
3202        unsafe fn encode(
3203            self,
3204            encoder: &mut fidl::encoding::Encoder<'_, D>,
3205            offset: usize,
3206            depth: fidl::encoding::Depth,
3207        ) -> fidl::Result<()> {
3208            encoder.debug_check_bounds::<Unit>(offset);
3209            // Zero out padding regions. There's no need to apply masks
3210            // because the unmasked parts will be overwritten by fields.
3211            // Write the fields.
3212            self.0.encode(encoder, offset + 0, depth)?;
3213            self.1.encode(encoder, offset + 4, depth)?;
3214            Ok(())
3215        }
3216    }
3217
3218    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
3219        #[inline(always)]
3220        fn new_empty() -> Self {
3221            Self { type_: fidl::new_empty!(UnitType, D), exponent: fidl::new_empty!(i32, D) }
3222        }
3223
3224        #[inline]
3225        unsafe fn decode(
3226            &mut self,
3227            decoder: &mut fidl::encoding::Decoder<'_, D>,
3228            offset: usize,
3229            _depth: fidl::encoding::Depth,
3230        ) -> fidl::Result<()> {
3231            decoder.debug_check_bounds::<Self>(offset);
3232            // Verify that padding bytes are zero.
3233            fidl::decode!(UnitType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3234            fidl::decode!(i32, D, &mut self.exponent, decoder, offset + 4, _depth)?;
3235            Ok(())
3236        }
3237    }
3238
3239    impl ConsumerControlDescriptor {
3240        #[inline(always)]
3241        fn max_ordinal_present(&self) -> u64 {
3242            if let Some(_) = self.input {
3243                return 1;
3244            }
3245            0
3246        }
3247    }
3248
3249    impl fidl::encoding::ValueTypeMarker for ConsumerControlDescriptor {
3250        type Borrowed<'a> = &'a Self;
3251        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3252            value
3253        }
3254    }
3255
3256    unsafe impl fidl::encoding::TypeMarker for ConsumerControlDescriptor {
3257        type Owned = Self;
3258
3259        #[inline(always)]
3260        fn inline_align(_context: fidl::encoding::Context) -> usize {
3261            8
3262        }
3263
3264        #[inline(always)]
3265        fn inline_size(_context: fidl::encoding::Context) -> usize {
3266            16
3267        }
3268    }
3269
3270    unsafe impl<D: fidl::encoding::ResourceDialect>
3271        fidl::encoding::Encode<ConsumerControlDescriptor, D> for &ConsumerControlDescriptor
3272    {
3273        unsafe fn encode(
3274            self,
3275            encoder: &mut fidl::encoding::Encoder<'_, D>,
3276            offset: usize,
3277            mut depth: fidl::encoding::Depth,
3278        ) -> fidl::Result<()> {
3279            encoder.debug_check_bounds::<ConsumerControlDescriptor>(offset);
3280            // Vector header
3281            let max_ordinal: u64 = self.max_ordinal_present();
3282            encoder.write_num(max_ordinal, offset);
3283            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3284            // Calling encoder.out_of_line_offset(0) is not allowed.
3285            if max_ordinal == 0 {
3286                return Ok(());
3287            }
3288            depth.increment()?;
3289            let envelope_size = 8;
3290            let bytes_len = max_ordinal as usize * envelope_size;
3291            #[allow(unused_variables)]
3292            let offset = encoder.out_of_line_offset(bytes_len);
3293            let mut _prev_end_offset: usize = 0;
3294            if 1 > max_ordinal {
3295                return Ok(());
3296            }
3297
3298            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3299            // are envelope_size bytes.
3300            let cur_offset: usize = (1 - 1) * envelope_size;
3301
3302            // Zero reserved fields.
3303            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3304
3305            // Safety:
3306            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3307            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3308            //   envelope_size bytes, there is always sufficient room.
3309            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputDescriptor, D>(
3310                self.input.as_ref().map(
3311                    <ConsumerControlInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow,
3312                ),
3313                encoder,
3314                offset + cur_offset,
3315                depth,
3316            )?;
3317
3318            _prev_end_offset = cur_offset + envelope_size;
3319
3320            Ok(())
3321        }
3322    }
3323
3324    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3325        for ConsumerControlDescriptor
3326    {
3327        #[inline(always)]
3328        fn new_empty() -> Self {
3329            Self::default()
3330        }
3331
3332        unsafe fn decode(
3333            &mut self,
3334            decoder: &mut fidl::encoding::Decoder<'_, D>,
3335            offset: usize,
3336            mut depth: fidl::encoding::Depth,
3337        ) -> fidl::Result<()> {
3338            decoder.debug_check_bounds::<Self>(offset);
3339            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3340                None => return Err(fidl::Error::NotNullable),
3341                Some(len) => len,
3342            };
3343            // Calling decoder.out_of_line_offset(0) is not allowed.
3344            if len == 0 {
3345                return Ok(());
3346            };
3347            depth.increment()?;
3348            let envelope_size = 8;
3349            let bytes_len = len * envelope_size;
3350            let offset = decoder.out_of_line_offset(bytes_len)?;
3351            // Decode the envelope for each type.
3352            let mut _next_ordinal_to_read = 0;
3353            let mut next_offset = offset;
3354            let end_offset = offset + bytes_len;
3355            _next_ordinal_to_read += 1;
3356            if next_offset >= end_offset {
3357                return Ok(());
3358            }
3359
3360            // Decode unknown envelopes for gaps in ordinals.
3361            while _next_ordinal_to_read < 1 {
3362                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3363                _next_ordinal_to_read += 1;
3364                next_offset += envelope_size;
3365            }
3366
3367            let next_out_of_line = decoder.next_out_of_line();
3368            let handles_before = decoder.remaining_handles();
3369            if let Some((inlined, num_bytes, num_handles)) =
3370                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3371            {
3372                let member_inline_size =
3373                    <ConsumerControlInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
3374                        decoder.context,
3375                    );
3376                if inlined != (member_inline_size <= 4) {
3377                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3378                }
3379                let inner_offset;
3380                let mut inner_depth = depth.clone();
3381                if inlined {
3382                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3383                    inner_offset = next_offset;
3384                } else {
3385                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3386                    inner_depth.increment()?;
3387                }
3388                let val_ref = self
3389                    .input
3390                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputDescriptor, D));
3391                fidl::decode!(
3392                    ConsumerControlInputDescriptor,
3393                    D,
3394                    val_ref,
3395                    decoder,
3396                    inner_offset,
3397                    inner_depth
3398                )?;
3399                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3400                {
3401                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3402                }
3403                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3404                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3405                }
3406            }
3407
3408            next_offset += envelope_size;
3409
3410            // Decode the remaining unknown envelopes.
3411            while next_offset < end_offset {
3412                _next_ordinal_to_read += 1;
3413                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3414                next_offset += envelope_size;
3415            }
3416
3417            Ok(())
3418        }
3419    }
3420
3421    impl ConsumerControlInputDescriptor {
3422        #[inline(always)]
3423        fn max_ordinal_present(&self) -> u64 {
3424            if let Some(_) = self.buttons {
3425                return 1;
3426            }
3427            0
3428        }
3429    }
3430
3431    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputDescriptor {
3432        type Borrowed<'a> = &'a Self;
3433        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3434            value
3435        }
3436    }
3437
3438    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputDescriptor {
3439        type Owned = Self;
3440
3441        #[inline(always)]
3442        fn inline_align(_context: fidl::encoding::Context) -> usize {
3443            8
3444        }
3445
3446        #[inline(always)]
3447        fn inline_size(_context: fidl::encoding::Context) -> usize {
3448            16
3449        }
3450    }
3451
3452    unsafe impl<D: fidl::encoding::ResourceDialect>
3453        fidl::encoding::Encode<ConsumerControlInputDescriptor, D>
3454        for &ConsumerControlInputDescriptor
3455    {
3456        unsafe fn encode(
3457            self,
3458            encoder: &mut fidl::encoding::Encoder<'_, D>,
3459            offset: usize,
3460            mut depth: fidl::encoding::Depth,
3461        ) -> fidl::Result<()> {
3462            encoder.debug_check_bounds::<ConsumerControlInputDescriptor>(offset);
3463            // Vector header
3464            let max_ordinal: u64 = self.max_ordinal_present();
3465            encoder.write_num(max_ordinal, offset);
3466            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3467            // Calling encoder.out_of_line_offset(0) is not allowed.
3468            if max_ordinal == 0 {
3469                return Ok(());
3470            }
3471            depth.increment()?;
3472            let envelope_size = 8;
3473            let bytes_len = max_ordinal as usize * envelope_size;
3474            #[allow(unused_variables)]
3475            let offset = encoder.out_of_line_offset(bytes_len);
3476            let mut _prev_end_offset: usize = 0;
3477            if 1 > max_ordinal {
3478                return Ok(());
3479            }
3480
3481            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3482            // are envelope_size bytes.
3483            let cur_offset: usize = (1 - 1) * envelope_size;
3484
3485            // Zero reserved fields.
3486            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3487
3488            // Safety:
3489            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3490            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3491            //   envelope_size bytes, there is always sufficient room.
3492            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3493            self.buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3494            encoder, offset + cur_offset, depth
3495        )?;
3496
3497            _prev_end_offset = cur_offset + envelope_size;
3498
3499            Ok(())
3500        }
3501    }
3502
3503    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3504        for ConsumerControlInputDescriptor
3505    {
3506        #[inline(always)]
3507        fn new_empty() -> Self {
3508            Self::default()
3509        }
3510
3511        unsafe fn decode(
3512            &mut self,
3513            decoder: &mut fidl::encoding::Decoder<'_, D>,
3514            offset: usize,
3515            mut depth: fidl::encoding::Depth,
3516        ) -> fidl::Result<()> {
3517            decoder.debug_check_bounds::<Self>(offset);
3518            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3519                None => return Err(fidl::Error::NotNullable),
3520                Some(len) => len,
3521            };
3522            // Calling decoder.out_of_line_offset(0) is not allowed.
3523            if len == 0 {
3524                return Ok(());
3525            };
3526            depth.increment()?;
3527            let envelope_size = 8;
3528            let bytes_len = len * envelope_size;
3529            let offset = decoder.out_of_line_offset(bytes_len)?;
3530            // Decode the envelope for each type.
3531            let mut _next_ordinal_to_read = 0;
3532            let mut next_offset = offset;
3533            let end_offset = offset + bytes_len;
3534            _next_ordinal_to_read += 1;
3535            if next_offset >= end_offset {
3536                return Ok(());
3537            }
3538
3539            // Decode unknown envelopes for gaps in ordinals.
3540            while _next_ordinal_to_read < 1 {
3541                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3542                _next_ordinal_to_read += 1;
3543                next_offset += envelope_size;
3544            }
3545
3546            let next_out_of_line = decoder.next_out_of_line();
3547            let handles_before = decoder.remaining_handles();
3548            if let Some((inlined, num_bytes, num_handles)) =
3549                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3550            {
3551                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3552                if inlined != (member_inline_size <= 4) {
3553                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3554                }
3555                let inner_offset;
3556                let mut inner_depth = depth.clone();
3557                if inlined {
3558                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3559                    inner_offset = next_offset;
3560                } else {
3561                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3562                    inner_depth.increment()?;
3563                }
3564                let val_ref = self.buttons.get_or_insert_with(
3565                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3566                );
3567                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3568                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3569                {
3570                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3571                }
3572                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3573                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3574                }
3575            }
3576
3577            next_offset += envelope_size;
3578
3579            // Decode the remaining unknown envelopes.
3580            while next_offset < end_offset {
3581                _next_ordinal_to_read += 1;
3582                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3583                next_offset += envelope_size;
3584            }
3585
3586            Ok(())
3587        }
3588    }
3589
3590    impl ConsumerControlInputReport {
3591        #[inline(always)]
3592        fn max_ordinal_present(&self) -> u64 {
3593            if let Some(_) = self.pressed_buttons {
3594                return 1;
3595            }
3596            0
3597        }
3598    }
3599
3600    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputReport {
3601        type Borrowed<'a> = &'a Self;
3602        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3603            value
3604        }
3605    }
3606
3607    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputReport {
3608        type Owned = Self;
3609
3610        #[inline(always)]
3611        fn inline_align(_context: fidl::encoding::Context) -> usize {
3612            8
3613        }
3614
3615        #[inline(always)]
3616        fn inline_size(_context: fidl::encoding::Context) -> usize {
3617            16
3618        }
3619    }
3620
3621    unsafe impl<D: fidl::encoding::ResourceDialect>
3622        fidl::encoding::Encode<ConsumerControlInputReport, D> for &ConsumerControlInputReport
3623    {
3624        unsafe fn encode(
3625            self,
3626            encoder: &mut fidl::encoding::Encoder<'_, D>,
3627            offset: usize,
3628            mut depth: fidl::encoding::Depth,
3629        ) -> fidl::Result<()> {
3630            encoder.debug_check_bounds::<ConsumerControlInputReport>(offset);
3631            // Vector header
3632            let max_ordinal: u64 = self.max_ordinal_present();
3633            encoder.write_num(max_ordinal, offset);
3634            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3635            // Calling encoder.out_of_line_offset(0) is not allowed.
3636            if max_ordinal == 0 {
3637                return Ok(());
3638            }
3639            depth.increment()?;
3640            let envelope_size = 8;
3641            let bytes_len = max_ordinal as usize * envelope_size;
3642            #[allow(unused_variables)]
3643            let offset = encoder.out_of_line_offset(bytes_len);
3644            let mut _prev_end_offset: usize = 0;
3645            if 1 > max_ordinal {
3646                return Ok(());
3647            }
3648
3649            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3650            // are envelope_size bytes.
3651            let cur_offset: usize = (1 - 1) * envelope_size;
3652
3653            // Zero reserved fields.
3654            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3655
3656            // Safety:
3657            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3658            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3659            //   envelope_size bytes, there is always sufficient room.
3660            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3661            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3662            encoder, offset + cur_offset, depth
3663        )?;
3664
3665            _prev_end_offset = cur_offset + envelope_size;
3666
3667            Ok(())
3668        }
3669    }
3670
3671    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3672        for ConsumerControlInputReport
3673    {
3674        #[inline(always)]
3675        fn new_empty() -> Self {
3676            Self::default()
3677        }
3678
3679        unsafe fn decode(
3680            &mut self,
3681            decoder: &mut fidl::encoding::Decoder<'_, D>,
3682            offset: usize,
3683            mut depth: fidl::encoding::Depth,
3684        ) -> fidl::Result<()> {
3685            decoder.debug_check_bounds::<Self>(offset);
3686            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3687                None => return Err(fidl::Error::NotNullable),
3688                Some(len) => len,
3689            };
3690            // Calling decoder.out_of_line_offset(0) is not allowed.
3691            if len == 0 {
3692                return Ok(());
3693            };
3694            depth.increment()?;
3695            let envelope_size = 8;
3696            let bytes_len = len * envelope_size;
3697            let offset = decoder.out_of_line_offset(bytes_len)?;
3698            // Decode the envelope for each type.
3699            let mut _next_ordinal_to_read = 0;
3700            let mut next_offset = offset;
3701            let end_offset = offset + bytes_len;
3702            _next_ordinal_to_read += 1;
3703            if next_offset >= end_offset {
3704                return Ok(());
3705            }
3706
3707            // Decode unknown envelopes for gaps in ordinals.
3708            while _next_ordinal_to_read < 1 {
3709                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3710                _next_ordinal_to_read += 1;
3711                next_offset += envelope_size;
3712            }
3713
3714            let next_out_of_line = decoder.next_out_of_line();
3715            let handles_before = decoder.remaining_handles();
3716            if let Some((inlined, num_bytes, num_handles)) =
3717                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3718            {
3719                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3720                if inlined != (member_inline_size <= 4) {
3721                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3722                }
3723                let inner_offset;
3724                let mut inner_depth = depth.clone();
3725                if inlined {
3726                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3727                    inner_offset = next_offset;
3728                } else {
3729                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3730                    inner_depth.increment()?;
3731                }
3732                let val_ref = self.pressed_buttons.get_or_insert_with(
3733                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3734                );
3735                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3736                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3737                {
3738                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3739                }
3740                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3741                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3742                }
3743            }
3744
3745            next_offset += envelope_size;
3746
3747            // Decode the remaining unknown envelopes.
3748            while next_offset < end_offset {
3749                _next_ordinal_to_read += 1;
3750                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3751                next_offset += envelope_size;
3752            }
3753
3754            Ok(())
3755        }
3756    }
3757
3758    impl ContactInputDescriptor {
3759        #[inline(always)]
3760        fn max_ordinal_present(&self) -> u64 {
3761            if let Some(_) = self.contact_height {
3762                return 5;
3763            }
3764            if let Some(_) = self.contact_width {
3765                return 4;
3766            }
3767            if let Some(_) = self.pressure {
3768                return 3;
3769            }
3770            if let Some(_) = self.position_y {
3771                return 2;
3772            }
3773            if let Some(_) = self.position_x {
3774                return 1;
3775            }
3776            0
3777        }
3778    }
3779
3780    impl fidl::encoding::ValueTypeMarker for ContactInputDescriptor {
3781        type Borrowed<'a> = &'a Self;
3782        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3783            value
3784        }
3785    }
3786
3787    unsafe impl fidl::encoding::TypeMarker for ContactInputDescriptor {
3788        type Owned = Self;
3789
3790        #[inline(always)]
3791        fn inline_align(_context: fidl::encoding::Context) -> usize {
3792            8
3793        }
3794
3795        #[inline(always)]
3796        fn inline_size(_context: fidl::encoding::Context) -> usize {
3797            16
3798        }
3799    }
3800
3801    unsafe impl<D: fidl::encoding::ResourceDialect>
3802        fidl::encoding::Encode<ContactInputDescriptor, D> for &ContactInputDescriptor
3803    {
3804        unsafe fn encode(
3805            self,
3806            encoder: &mut fidl::encoding::Encoder<'_, D>,
3807            offset: usize,
3808            mut depth: fidl::encoding::Depth,
3809        ) -> fidl::Result<()> {
3810            encoder.debug_check_bounds::<ContactInputDescriptor>(offset);
3811            // Vector header
3812            let max_ordinal: u64 = self.max_ordinal_present();
3813            encoder.write_num(max_ordinal, offset);
3814            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3815            // Calling encoder.out_of_line_offset(0) is not allowed.
3816            if max_ordinal == 0 {
3817                return Ok(());
3818            }
3819            depth.increment()?;
3820            let envelope_size = 8;
3821            let bytes_len = max_ordinal as usize * envelope_size;
3822            #[allow(unused_variables)]
3823            let offset = encoder.out_of_line_offset(bytes_len);
3824            let mut _prev_end_offset: usize = 0;
3825            if 1 > max_ordinal {
3826                return Ok(());
3827            }
3828
3829            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3830            // are envelope_size bytes.
3831            let cur_offset: usize = (1 - 1) * envelope_size;
3832
3833            // Zero reserved fields.
3834            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3835
3836            // Safety:
3837            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3838            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3839            //   envelope_size bytes, there is always sufficient room.
3840            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3841                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3842                encoder,
3843                offset + cur_offset,
3844                depth,
3845            )?;
3846
3847            _prev_end_offset = cur_offset + envelope_size;
3848            if 2 > max_ordinal {
3849                return Ok(());
3850            }
3851
3852            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3853            // are envelope_size bytes.
3854            let cur_offset: usize = (2 - 1) * envelope_size;
3855
3856            // Zero reserved fields.
3857            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3858
3859            // Safety:
3860            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3861            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3862            //   envelope_size bytes, there is always sufficient room.
3863            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3864                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3865                encoder,
3866                offset + cur_offset,
3867                depth,
3868            )?;
3869
3870            _prev_end_offset = cur_offset + envelope_size;
3871            if 3 > max_ordinal {
3872                return Ok(());
3873            }
3874
3875            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3876            // are envelope_size bytes.
3877            let cur_offset: usize = (3 - 1) * envelope_size;
3878
3879            // Zero reserved fields.
3880            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3881
3882            // Safety:
3883            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3884            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3885            //   envelope_size bytes, there is always sufficient room.
3886            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3887                self.pressure.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3888                encoder,
3889                offset + cur_offset,
3890                depth,
3891            )?;
3892
3893            _prev_end_offset = cur_offset + envelope_size;
3894            if 4 > max_ordinal {
3895                return Ok(());
3896            }
3897
3898            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3899            // are envelope_size bytes.
3900            let cur_offset: usize = (4 - 1) * envelope_size;
3901
3902            // Zero reserved fields.
3903            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3904
3905            // Safety:
3906            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3907            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3908            //   envelope_size bytes, there is always sufficient room.
3909            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3910                self.contact_width.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3911                encoder,
3912                offset + cur_offset,
3913                depth,
3914            )?;
3915
3916            _prev_end_offset = cur_offset + envelope_size;
3917            if 5 > max_ordinal {
3918                return Ok(());
3919            }
3920
3921            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3922            // are envelope_size bytes.
3923            let cur_offset: usize = (5 - 1) * envelope_size;
3924
3925            // Zero reserved fields.
3926            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3927
3928            // Safety:
3929            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3930            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3931            //   envelope_size bytes, there is always sufficient room.
3932            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3933                self.contact_height.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3934                encoder,
3935                offset + cur_offset,
3936                depth,
3937            )?;
3938
3939            _prev_end_offset = cur_offset + envelope_size;
3940
3941            Ok(())
3942        }
3943    }
3944
3945    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3946        for ContactInputDescriptor
3947    {
3948        #[inline(always)]
3949        fn new_empty() -> Self {
3950            Self::default()
3951        }
3952
3953        unsafe fn decode(
3954            &mut self,
3955            decoder: &mut fidl::encoding::Decoder<'_, D>,
3956            offset: usize,
3957            mut depth: fidl::encoding::Depth,
3958        ) -> fidl::Result<()> {
3959            decoder.debug_check_bounds::<Self>(offset);
3960            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3961                None => return Err(fidl::Error::NotNullable),
3962                Some(len) => len,
3963            };
3964            // Calling decoder.out_of_line_offset(0) is not allowed.
3965            if len == 0 {
3966                return Ok(());
3967            };
3968            depth.increment()?;
3969            let envelope_size = 8;
3970            let bytes_len = len * envelope_size;
3971            let offset = decoder.out_of_line_offset(bytes_len)?;
3972            // Decode the envelope for each type.
3973            let mut _next_ordinal_to_read = 0;
3974            let mut next_offset = offset;
3975            let end_offset = offset + bytes_len;
3976            _next_ordinal_to_read += 1;
3977            if next_offset >= end_offset {
3978                return Ok(());
3979            }
3980
3981            // Decode unknown envelopes for gaps in ordinals.
3982            while _next_ordinal_to_read < 1 {
3983                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3984                _next_ordinal_to_read += 1;
3985                next_offset += envelope_size;
3986            }
3987
3988            let next_out_of_line = decoder.next_out_of_line();
3989            let handles_before = decoder.remaining_handles();
3990            if let Some((inlined, num_bytes, num_handles)) =
3991                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3992            {
3993                let member_inline_size =
3994                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3995                if inlined != (member_inline_size <= 4) {
3996                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3997                }
3998                let inner_offset;
3999                let mut inner_depth = depth.clone();
4000                if inlined {
4001                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4002                    inner_offset = next_offset;
4003                } else {
4004                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4005                    inner_depth.increment()?;
4006                }
4007                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4008                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4009                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4010                {
4011                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4012                }
4013                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4014                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4015                }
4016            }
4017
4018            next_offset += envelope_size;
4019            _next_ordinal_to_read += 1;
4020            if next_offset >= end_offset {
4021                return Ok(());
4022            }
4023
4024            // Decode unknown envelopes for gaps in ordinals.
4025            while _next_ordinal_to_read < 2 {
4026                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4027                _next_ordinal_to_read += 1;
4028                next_offset += envelope_size;
4029            }
4030
4031            let next_out_of_line = decoder.next_out_of_line();
4032            let handles_before = decoder.remaining_handles();
4033            if let Some((inlined, num_bytes, num_handles)) =
4034                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4035            {
4036                let member_inline_size =
4037                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4038                if inlined != (member_inline_size <= 4) {
4039                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4040                }
4041                let inner_offset;
4042                let mut inner_depth = depth.clone();
4043                if inlined {
4044                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4045                    inner_offset = next_offset;
4046                } else {
4047                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4048                    inner_depth.increment()?;
4049                }
4050                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4051                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4052                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4053                {
4054                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4055                }
4056                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4057                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4058                }
4059            }
4060
4061            next_offset += envelope_size;
4062            _next_ordinal_to_read += 1;
4063            if next_offset >= end_offset {
4064                return Ok(());
4065            }
4066
4067            // Decode unknown envelopes for gaps in ordinals.
4068            while _next_ordinal_to_read < 3 {
4069                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4070                _next_ordinal_to_read += 1;
4071                next_offset += envelope_size;
4072            }
4073
4074            let next_out_of_line = decoder.next_out_of_line();
4075            let handles_before = decoder.remaining_handles();
4076            if let Some((inlined, num_bytes, num_handles)) =
4077                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4078            {
4079                let member_inline_size =
4080                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4081                if inlined != (member_inline_size <= 4) {
4082                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4083                }
4084                let inner_offset;
4085                let mut inner_depth = depth.clone();
4086                if inlined {
4087                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4088                    inner_offset = next_offset;
4089                } else {
4090                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4091                    inner_depth.increment()?;
4092                }
4093                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4094                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4095                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4096                {
4097                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4098                }
4099                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4100                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4101                }
4102            }
4103
4104            next_offset += envelope_size;
4105            _next_ordinal_to_read += 1;
4106            if next_offset >= end_offset {
4107                return Ok(());
4108            }
4109
4110            // Decode unknown envelopes for gaps in ordinals.
4111            while _next_ordinal_to_read < 4 {
4112                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4113                _next_ordinal_to_read += 1;
4114                next_offset += envelope_size;
4115            }
4116
4117            let next_out_of_line = decoder.next_out_of_line();
4118            let handles_before = decoder.remaining_handles();
4119            if let Some((inlined, num_bytes, num_handles)) =
4120                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4121            {
4122                let member_inline_size =
4123                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4124                if inlined != (member_inline_size <= 4) {
4125                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4126                }
4127                let inner_offset;
4128                let mut inner_depth = depth.clone();
4129                if inlined {
4130                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4131                    inner_offset = next_offset;
4132                } else {
4133                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4134                    inner_depth.increment()?;
4135                }
4136                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4137                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4138                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4139                {
4140                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4141                }
4142                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4143                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4144                }
4145            }
4146
4147            next_offset += envelope_size;
4148            _next_ordinal_to_read += 1;
4149            if next_offset >= end_offset {
4150                return Ok(());
4151            }
4152
4153            // Decode unknown envelopes for gaps in ordinals.
4154            while _next_ordinal_to_read < 5 {
4155                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4156                _next_ordinal_to_read += 1;
4157                next_offset += envelope_size;
4158            }
4159
4160            let next_out_of_line = decoder.next_out_of_line();
4161            let handles_before = decoder.remaining_handles();
4162            if let Some((inlined, num_bytes, num_handles)) =
4163                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4164            {
4165                let member_inline_size =
4166                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4167                if inlined != (member_inline_size <= 4) {
4168                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4169                }
4170                let inner_offset;
4171                let mut inner_depth = depth.clone();
4172                if inlined {
4173                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4174                    inner_offset = next_offset;
4175                } else {
4176                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4177                    inner_depth.increment()?;
4178                }
4179                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4180                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4181                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4182                {
4183                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4184                }
4185                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4186                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4187                }
4188            }
4189
4190            next_offset += envelope_size;
4191
4192            // Decode the remaining unknown envelopes.
4193            while next_offset < end_offset {
4194                _next_ordinal_to_read += 1;
4195                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4196                next_offset += envelope_size;
4197            }
4198
4199            Ok(())
4200        }
4201    }
4202
4203    impl ContactInputReport {
4204        #[inline(always)]
4205        fn max_ordinal_present(&self) -> u64 {
4206            if let Some(_) = self.confidence {
4207                return 7;
4208            }
4209            if let Some(_) = self.contact_height {
4210                return 6;
4211            }
4212            if let Some(_) = self.contact_width {
4213                return 5;
4214            }
4215            if let Some(_) = self.pressure {
4216                return 4;
4217            }
4218            if let Some(_) = self.position_y {
4219                return 3;
4220            }
4221            if let Some(_) = self.position_x {
4222                return 2;
4223            }
4224            if let Some(_) = self.contact_id {
4225                return 1;
4226            }
4227            0
4228        }
4229    }
4230
4231    impl fidl::encoding::ValueTypeMarker for ContactInputReport {
4232        type Borrowed<'a> = &'a Self;
4233        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4234            value
4235        }
4236    }
4237
4238    unsafe impl fidl::encoding::TypeMarker for ContactInputReport {
4239        type Owned = Self;
4240
4241        #[inline(always)]
4242        fn inline_align(_context: fidl::encoding::Context) -> usize {
4243            8
4244        }
4245
4246        #[inline(always)]
4247        fn inline_size(_context: fidl::encoding::Context) -> usize {
4248            16
4249        }
4250    }
4251
4252    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContactInputReport, D>
4253        for &ContactInputReport
4254    {
4255        unsafe fn encode(
4256            self,
4257            encoder: &mut fidl::encoding::Encoder<'_, D>,
4258            offset: usize,
4259            mut depth: fidl::encoding::Depth,
4260        ) -> fidl::Result<()> {
4261            encoder.debug_check_bounds::<ContactInputReport>(offset);
4262            // Vector header
4263            let max_ordinal: u64 = self.max_ordinal_present();
4264            encoder.write_num(max_ordinal, offset);
4265            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4266            // Calling encoder.out_of_line_offset(0) is not allowed.
4267            if max_ordinal == 0 {
4268                return Ok(());
4269            }
4270            depth.increment()?;
4271            let envelope_size = 8;
4272            let bytes_len = max_ordinal as usize * envelope_size;
4273            #[allow(unused_variables)]
4274            let offset = encoder.out_of_line_offset(bytes_len);
4275            let mut _prev_end_offset: usize = 0;
4276            if 1 > max_ordinal {
4277                return Ok(());
4278            }
4279
4280            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4281            // are envelope_size bytes.
4282            let cur_offset: usize = (1 - 1) * envelope_size;
4283
4284            // Zero reserved fields.
4285            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4286
4287            // Safety:
4288            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4289            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4290            //   envelope_size bytes, there is always sufficient room.
4291            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4292                self.contact_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4293                encoder,
4294                offset + cur_offset,
4295                depth,
4296            )?;
4297
4298            _prev_end_offset = cur_offset + envelope_size;
4299            if 2 > max_ordinal {
4300                return Ok(());
4301            }
4302
4303            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4304            // are envelope_size bytes.
4305            let cur_offset: usize = (2 - 1) * envelope_size;
4306
4307            // Zero reserved fields.
4308            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4309
4310            // Safety:
4311            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4312            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4313            //   envelope_size bytes, there is always sufficient room.
4314            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4315                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4316                encoder,
4317                offset + cur_offset,
4318                depth,
4319            )?;
4320
4321            _prev_end_offset = cur_offset + envelope_size;
4322            if 3 > max_ordinal {
4323                return Ok(());
4324            }
4325
4326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4327            // are envelope_size bytes.
4328            let cur_offset: usize = (3 - 1) * envelope_size;
4329
4330            // Zero reserved fields.
4331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4332
4333            // Safety:
4334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4336            //   envelope_size bytes, there is always sufficient room.
4337            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4338                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4339                encoder,
4340                offset + cur_offset,
4341                depth,
4342            )?;
4343
4344            _prev_end_offset = cur_offset + envelope_size;
4345            if 4 > max_ordinal {
4346                return Ok(());
4347            }
4348
4349            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4350            // are envelope_size bytes.
4351            let cur_offset: usize = (4 - 1) * envelope_size;
4352
4353            // Zero reserved fields.
4354            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4355
4356            // Safety:
4357            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4358            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4359            //   envelope_size bytes, there is always sufficient room.
4360            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4361                self.pressure.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4362                encoder,
4363                offset + cur_offset,
4364                depth,
4365            )?;
4366
4367            _prev_end_offset = cur_offset + envelope_size;
4368            if 5 > max_ordinal {
4369                return Ok(());
4370            }
4371
4372            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4373            // are envelope_size bytes.
4374            let cur_offset: usize = (5 - 1) * envelope_size;
4375
4376            // Zero reserved fields.
4377            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4378
4379            // Safety:
4380            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4381            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4382            //   envelope_size bytes, there is always sufficient room.
4383            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4384                self.contact_width.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4385                encoder,
4386                offset + cur_offset,
4387                depth,
4388            )?;
4389
4390            _prev_end_offset = cur_offset + envelope_size;
4391            if 6 > max_ordinal {
4392                return Ok(());
4393            }
4394
4395            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4396            // are envelope_size bytes.
4397            let cur_offset: usize = (6 - 1) * envelope_size;
4398
4399            // Zero reserved fields.
4400            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4401
4402            // Safety:
4403            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4404            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4405            //   envelope_size bytes, there is always sufficient room.
4406            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4407                self.contact_height.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4408                encoder,
4409                offset + cur_offset,
4410                depth,
4411            )?;
4412
4413            _prev_end_offset = cur_offset + envelope_size;
4414            if 7 > max_ordinal {
4415                return Ok(());
4416            }
4417
4418            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4419            // are envelope_size bytes.
4420            let cur_offset: usize = (7 - 1) * envelope_size;
4421
4422            // Zero reserved fields.
4423            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4424
4425            // Safety:
4426            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4427            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4428            //   envelope_size bytes, there is always sufficient room.
4429            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4430                self.confidence.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4431                encoder,
4432                offset + cur_offset,
4433                depth,
4434            )?;
4435
4436            _prev_end_offset = cur_offset + envelope_size;
4437
4438            Ok(())
4439        }
4440    }
4441
4442    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContactInputReport {
4443        #[inline(always)]
4444        fn new_empty() -> Self {
4445            Self::default()
4446        }
4447
4448        unsafe fn decode(
4449            &mut self,
4450            decoder: &mut fidl::encoding::Decoder<'_, D>,
4451            offset: usize,
4452            mut depth: fidl::encoding::Depth,
4453        ) -> fidl::Result<()> {
4454            decoder.debug_check_bounds::<Self>(offset);
4455            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4456                None => return Err(fidl::Error::NotNullable),
4457                Some(len) => len,
4458            };
4459            // Calling decoder.out_of_line_offset(0) is not allowed.
4460            if len == 0 {
4461                return Ok(());
4462            };
4463            depth.increment()?;
4464            let envelope_size = 8;
4465            let bytes_len = len * envelope_size;
4466            let offset = decoder.out_of_line_offset(bytes_len)?;
4467            // Decode the envelope for each type.
4468            let mut _next_ordinal_to_read = 0;
4469            let mut next_offset = offset;
4470            let end_offset = offset + bytes_len;
4471            _next_ordinal_to_read += 1;
4472            if next_offset >= end_offset {
4473                return Ok(());
4474            }
4475
4476            // Decode unknown envelopes for gaps in ordinals.
4477            while _next_ordinal_to_read < 1 {
4478                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4479                _next_ordinal_to_read += 1;
4480                next_offset += envelope_size;
4481            }
4482
4483            let next_out_of_line = decoder.next_out_of_line();
4484            let handles_before = decoder.remaining_handles();
4485            if let Some((inlined, num_bytes, num_handles)) =
4486                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4487            {
4488                let member_inline_size =
4489                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4490                if inlined != (member_inline_size <= 4) {
4491                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4492                }
4493                let inner_offset;
4494                let mut inner_depth = depth.clone();
4495                if inlined {
4496                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4497                    inner_offset = next_offset;
4498                } else {
4499                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4500                    inner_depth.increment()?;
4501                }
4502                let val_ref = self.contact_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4503                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4504                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4505                {
4506                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4507                }
4508                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4509                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4510                }
4511            }
4512
4513            next_offset += envelope_size;
4514            _next_ordinal_to_read += 1;
4515            if next_offset >= end_offset {
4516                return Ok(());
4517            }
4518
4519            // Decode unknown envelopes for gaps in ordinals.
4520            while _next_ordinal_to_read < 2 {
4521                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4522                _next_ordinal_to_read += 1;
4523                next_offset += envelope_size;
4524            }
4525
4526            let next_out_of_line = decoder.next_out_of_line();
4527            let handles_before = decoder.remaining_handles();
4528            if let Some((inlined, num_bytes, num_handles)) =
4529                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4530            {
4531                let member_inline_size =
4532                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4533                if inlined != (member_inline_size <= 4) {
4534                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4535                }
4536                let inner_offset;
4537                let mut inner_depth = depth.clone();
4538                if inlined {
4539                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4540                    inner_offset = next_offset;
4541                } else {
4542                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4543                    inner_depth.increment()?;
4544                }
4545                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
4546                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4547                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4548                {
4549                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4550                }
4551                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4552                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4553                }
4554            }
4555
4556            next_offset += envelope_size;
4557            _next_ordinal_to_read += 1;
4558            if next_offset >= end_offset {
4559                return Ok(());
4560            }
4561
4562            // Decode unknown envelopes for gaps in ordinals.
4563            while _next_ordinal_to_read < 3 {
4564                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4565                _next_ordinal_to_read += 1;
4566                next_offset += envelope_size;
4567            }
4568
4569            let next_out_of_line = decoder.next_out_of_line();
4570            let handles_before = decoder.remaining_handles();
4571            if let Some((inlined, num_bytes, num_handles)) =
4572                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4573            {
4574                let member_inline_size =
4575                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4576                if inlined != (member_inline_size <= 4) {
4577                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4578                }
4579                let inner_offset;
4580                let mut inner_depth = depth.clone();
4581                if inlined {
4582                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4583                    inner_offset = next_offset;
4584                } else {
4585                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4586                    inner_depth.increment()?;
4587                }
4588                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
4589                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4590                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4591                {
4592                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4593                }
4594                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4595                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4596                }
4597            }
4598
4599            next_offset += envelope_size;
4600            _next_ordinal_to_read += 1;
4601            if next_offset >= end_offset {
4602                return Ok(());
4603            }
4604
4605            // Decode unknown envelopes for gaps in ordinals.
4606            while _next_ordinal_to_read < 4 {
4607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4608                _next_ordinal_to_read += 1;
4609                next_offset += envelope_size;
4610            }
4611
4612            let next_out_of_line = decoder.next_out_of_line();
4613            let handles_before = decoder.remaining_handles();
4614            if let Some((inlined, num_bytes, num_handles)) =
4615                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4616            {
4617                let member_inline_size =
4618                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4619                if inlined != (member_inline_size <= 4) {
4620                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4621                }
4622                let inner_offset;
4623                let mut inner_depth = depth.clone();
4624                if inlined {
4625                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4626                    inner_offset = next_offset;
4627                } else {
4628                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4629                    inner_depth.increment()?;
4630                }
4631                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(i64, D));
4632                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4633                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4634                {
4635                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4636                }
4637                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4638                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4639                }
4640            }
4641
4642            next_offset += envelope_size;
4643            _next_ordinal_to_read += 1;
4644            if next_offset >= end_offset {
4645                return Ok(());
4646            }
4647
4648            // Decode unknown envelopes for gaps in ordinals.
4649            while _next_ordinal_to_read < 5 {
4650                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4651                _next_ordinal_to_read += 1;
4652                next_offset += envelope_size;
4653            }
4654
4655            let next_out_of_line = decoder.next_out_of_line();
4656            let handles_before = decoder.remaining_handles();
4657            if let Some((inlined, num_bytes, num_handles)) =
4658                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4659            {
4660                let member_inline_size =
4661                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4662                if inlined != (member_inline_size <= 4) {
4663                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4664                }
4665                let inner_offset;
4666                let mut inner_depth = depth.clone();
4667                if inlined {
4668                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4669                    inner_offset = next_offset;
4670                } else {
4671                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4672                    inner_depth.increment()?;
4673                }
4674                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(i64, D));
4675                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4676                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4677                {
4678                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4679                }
4680                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4681                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4682                }
4683            }
4684
4685            next_offset += envelope_size;
4686            _next_ordinal_to_read += 1;
4687            if next_offset >= end_offset {
4688                return Ok(());
4689            }
4690
4691            // Decode unknown envelopes for gaps in ordinals.
4692            while _next_ordinal_to_read < 6 {
4693                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4694                _next_ordinal_to_read += 1;
4695                next_offset += envelope_size;
4696            }
4697
4698            let next_out_of_line = decoder.next_out_of_line();
4699            let handles_before = decoder.remaining_handles();
4700            if let Some((inlined, num_bytes, num_handles)) =
4701                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4702            {
4703                let member_inline_size =
4704                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4705                if inlined != (member_inline_size <= 4) {
4706                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4707                }
4708                let inner_offset;
4709                let mut inner_depth = depth.clone();
4710                if inlined {
4711                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4712                    inner_offset = next_offset;
4713                } else {
4714                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4715                    inner_depth.increment()?;
4716                }
4717                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(i64, D));
4718                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4719                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4720                {
4721                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4722                }
4723                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4724                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4725                }
4726            }
4727
4728            next_offset += envelope_size;
4729            _next_ordinal_to_read += 1;
4730            if next_offset >= end_offset {
4731                return Ok(());
4732            }
4733
4734            // Decode unknown envelopes for gaps in ordinals.
4735            while _next_ordinal_to_read < 7 {
4736                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4737                _next_ordinal_to_read += 1;
4738                next_offset += envelope_size;
4739            }
4740
4741            let next_out_of_line = decoder.next_out_of_line();
4742            let handles_before = decoder.remaining_handles();
4743            if let Some((inlined, num_bytes, num_handles)) =
4744                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4745            {
4746                let member_inline_size =
4747                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4748                if inlined != (member_inline_size <= 4) {
4749                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4750                }
4751                let inner_offset;
4752                let mut inner_depth = depth.clone();
4753                if inlined {
4754                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4755                    inner_offset = next_offset;
4756                } else {
4757                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4758                    inner_depth.increment()?;
4759                }
4760                let val_ref = self.confidence.get_or_insert_with(|| fidl::new_empty!(bool, D));
4761                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4762                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4763                {
4764                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4765                }
4766                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4767                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4768                }
4769            }
4770
4771            next_offset += envelope_size;
4772
4773            // Decode the remaining unknown envelopes.
4774            while next_offset < end_offset {
4775                _next_ordinal_to_read += 1;
4776                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4777                next_offset += envelope_size;
4778            }
4779
4780            Ok(())
4781        }
4782    }
4783
4784    impl DeviceDescriptor {
4785        #[inline(always)]
4786        fn max_ordinal_present(&self) -> u64 {
4787            if let Some(_) = self.device_information {
4788                return 7;
4789            }
4790            if let Some(_) = self.consumer_control {
4791                return 6;
4792            }
4793            if let Some(_) = self.keyboard {
4794                return 5;
4795            }
4796            if let Some(_) = self.touch {
4797                return 4;
4798            }
4799            if let Some(_) = self.sensor {
4800                return 3;
4801            }
4802            if let Some(_) = self.mouse {
4803                return 2;
4804            }
4805            if let Some(_) = self.device_info {
4806                return 1;
4807            }
4808            0
4809        }
4810    }
4811
4812    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
4813        type Borrowed<'a> = &'a Self;
4814        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4815            value
4816        }
4817    }
4818
4819    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
4820        type Owned = Self;
4821
4822        #[inline(always)]
4823        fn inline_align(_context: fidl::encoding::Context) -> usize {
4824            8
4825        }
4826
4827        #[inline(always)]
4828        fn inline_size(_context: fidl::encoding::Context) -> usize {
4829            16
4830        }
4831    }
4832
4833    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
4834        for &DeviceDescriptor
4835    {
4836        unsafe fn encode(
4837            self,
4838            encoder: &mut fidl::encoding::Encoder<'_, D>,
4839            offset: usize,
4840            mut depth: fidl::encoding::Depth,
4841        ) -> fidl::Result<()> {
4842            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
4843            // Vector header
4844            let max_ordinal: u64 = self.max_ordinal_present();
4845            encoder.write_num(max_ordinal, offset);
4846            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4847            // Calling encoder.out_of_line_offset(0) is not allowed.
4848            if max_ordinal == 0 {
4849                return Ok(());
4850            }
4851            depth.increment()?;
4852            let envelope_size = 8;
4853            let bytes_len = max_ordinal as usize * envelope_size;
4854            #[allow(unused_variables)]
4855            let offset = encoder.out_of_line_offset(bytes_len);
4856            let mut _prev_end_offset: usize = 0;
4857            if 1 > max_ordinal {
4858                return Ok(());
4859            }
4860
4861            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4862            // are envelope_size bytes.
4863            let cur_offset: usize = (1 - 1) * envelope_size;
4864
4865            // Zero reserved fields.
4866            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4867
4868            // Safety:
4869            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4870            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4871            //   envelope_size bytes, there is always sufficient room.
4872            fidl::encoding::encode_in_envelope_optional::<DeviceInfo, D>(
4873                self.device_info
4874                    .as_ref()
4875                    .map(<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
4876                encoder,
4877                offset + cur_offset,
4878                depth,
4879            )?;
4880
4881            _prev_end_offset = cur_offset + envelope_size;
4882            if 2 > max_ordinal {
4883                return Ok(());
4884            }
4885
4886            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4887            // are envelope_size bytes.
4888            let cur_offset: usize = (2 - 1) * envelope_size;
4889
4890            // Zero reserved fields.
4891            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4892
4893            // Safety:
4894            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4895            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4896            //   envelope_size bytes, there is always sufficient room.
4897            fidl::encoding::encode_in_envelope_optional::<MouseDescriptor, D>(
4898                self.mouse
4899                    .as_ref()
4900                    .map(<MouseDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4901                encoder,
4902                offset + cur_offset,
4903                depth,
4904            )?;
4905
4906            _prev_end_offset = cur_offset + envelope_size;
4907            if 3 > max_ordinal {
4908                return Ok(());
4909            }
4910
4911            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4912            // are envelope_size bytes.
4913            let cur_offset: usize = (3 - 1) * envelope_size;
4914
4915            // Zero reserved fields.
4916            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4917
4918            // Safety:
4919            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4920            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4921            //   envelope_size bytes, there is always sufficient room.
4922            fidl::encoding::encode_in_envelope_optional::<SensorDescriptor, D>(
4923                self.sensor
4924                    .as_ref()
4925                    .map(<SensorDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4926                encoder,
4927                offset + cur_offset,
4928                depth,
4929            )?;
4930
4931            _prev_end_offset = cur_offset + envelope_size;
4932            if 4 > max_ordinal {
4933                return Ok(());
4934            }
4935
4936            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4937            // are envelope_size bytes.
4938            let cur_offset: usize = (4 - 1) * envelope_size;
4939
4940            // Zero reserved fields.
4941            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4942
4943            // Safety:
4944            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4945            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4946            //   envelope_size bytes, there is always sufficient room.
4947            fidl::encoding::encode_in_envelope_optional::<TouchDescriptor, D>(
4948                self.touch
4949                    .as_ref()
4950                    .map(<TouchDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4951                encoder,
4952                offset + cur_offset,
4953                depth,
4954            )?;
4955
4956            _prev_end_offset = cur_offset + envelope_size;
4957            if 5 > max_ordinal {
4958                return Ok(());
4959            }
4960
4961            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4962            // are envelope_size bytes.
4963            let cur_offset: usize = (5 - 1) * envelope_size;
4964
4965            // Zero reserved fields.
4966            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4967
4968            // Safety:
4969            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4970            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4971            //   envelope_size bytes, there is always sufficient room.
4972            fidl::encoding::encode_in_envelope_optional::<KeyboardDescriptor, D>(
4973                self.keyboard
4974                    .as_ref()
4975                    .map(<KeyboardDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4976                encoder,
4977                offset + cur_offset,
4978                depth,
4979            )?;
4980
4981            _prev_end_offset = cur_offset + envelope_size;
4982            if 6 > max_ordinal {
4983                return Ok(());
4984            }
4985
4986            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4987            // are envelope_size bytes.
4988            let cur_offset: usize = (6 - 1) * envelope_size;
4989
4990            // Zero reserved fields.
4991            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4992
4993            // Safety:
4994            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4995            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4996            //   envelope_size bytes, there is always sufficient room.
4997            fidl::encoding::encode_in_envelope_optional::<ConsumerControlDescriptor, D>(
4998                self.consumer_control
4999                    .as_ref()
5000                    .map(<ConsumerControlDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
5001                encoder,
5002                offset + cur_offset,
5003                depth,
5004            )?;
5005
5006            _prev_end_offset = cur_offset + envelope_size;
5007            if 7 > max_ordinal {
5008                return Ok(());
5009            }
5010
5011            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5012            // are envelope_size bytes.
5013            let cur_offset: usize = (7 - 1) * envelope_size;
5014
5015            // Zero reserved fields.
5016            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5017
5018            // Safety:
5019            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5020            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5021            //   envelope_size bytes, there is always sufficient room.
5022            fidl::encoding::encode_in_envelope_optional::<DeviceInformation, D>(
5023                self.device_information
5024                    .as_ref()
5025                    .map(<DeviceInformation as fidl::encoding::ValueTypeMarker>::borrow),
5026                encoder,
5027                offset + cur_offset,
5028                depth,
5029            )?;
5030
5031            _prev_end_offset = cur_offset + envelope_size;
5032
5033            Ok(())
5034        }
5035    }
5036
5037    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
5038        #[inline(always)]
5039        fn new_empty() -> Self {
5040            Self::default()
5041        }
5042
5043        unsafe fn decode(
5044            &mut self,
5045            decoder: &mut fidl::encoding::Decoder<'_, D>,
5046            offset: usize,
5047            mut depth: fidl::encoding::Depth,
5048        ) -> fidl::Result<()> {
5049            decoder.debug_check_bounds::<Self>(offset);
5050            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5051                None => return Err(fidl::Error::NotNullable),
5052                Some(len) => len,
5053            };
5054            // Calling decoder.out_of_line_offset(0) is not allowed.
5055            if len == 0 {
5056                return Ok(());
5057            };
5058            depth.increment()?;
5059            let envelope_size = 8;
5060            let bytes_len = len * envelope_size;
5061            let offset = decoder.out_of_line_offset(bytes_len)?;
5062            // Decode the envelope for each type.
5063            let mut _next_ordinal_to_read = 0;
5064            let mut next_offset = offset;
5065            let end_offset = offset + bytes_len;
5066            _next_ordinal_to_read += 1;
5067            if next_offset >= end_offset {
5068                return Ok(());
5069            }
5070
5071            // Decode unknown envelopes for gaps in ordinals.
5072            while _next_ordinal_to_read < 1 {
5073                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5074                _next_ordinal_to_read += 1;
5075                next_offset += envelope_size;
5076            }
5077
5078            let next_out_of_line = decoder.next_out_of_line();
5079            let handles_before = decoder.remaining_handles();
5080            if let Some((inlined, num_bytes, num_handles)) =
5081                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5082            {
5083                let member_inline_size =
5084                    <DeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5085                if inlined != (member_inline_size <= 4) {
5086                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5087                }
5088                let inner_offset;
5089                let mut inner_depth = depth.clone();
5090                if inlined {
5091                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5092                    inner_offset = next_offset;
5093                } else {
5094                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5095                    inner_depth.increment()?;
5096                }
5097                let val_ref =
5098                    self.device_info.get_or_insert_with(|| fidl::new_empty!(DeviceInfo, D));
5099                fidl::decode!(DeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5100                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5101                {
5102                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5103                }
5104                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5105                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5106                }
5107            }
5108
5109            next_offset += envelope_size;
5110            _next_ordinal_to_read += 1;
5111            if next_offset >= end_offset {
5112                return Ok(());
5113            }
5114
5115            // Decode unknown envelopes for gaps in ordinals.
5116            while _next_ordinal_to_read < 2 {
5117                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5118                _next_ordinal_to_read += 1;
5119                next_offset += envelope_size;
5120            }
5121
5122            let next_out_of_line = decoder.next_out_of_line();
5123            let handles_before = decoder.remaining_handles();
5124            if let Some((inlined, num_bytes, num_handles)) =
5125                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5126            {
5127                let member_inline_size =
5128                    <MouseDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5129                if inlined != (member_inline_size <= 4) {
5130                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5131                }
5132                let inner_offset;
5133                let mut inner_depth = depth.clone();
5134                if inlined {
5135                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5136                    inner_offset = next_offset;
5137                } else {
5138                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5139                    inner_depth.increment()?;
5140                }
5141                let val_ref =
5142                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseDescriptor, D));
5143                fidl::decode!(MouseDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5144                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5145                {
5146                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5147                }
5148                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5149                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5150                }
5151            }
5152
5153            next_offset += envelope_size;
5154            _next_ordinal_to_read += 1;
5155            if next_offset >= end_offset {
5156                return Ok(());
5157            }
5158
5159            // Decode unknown envelopes for gaps in ordinals.
5160            while _next_ordinal_to_read < 3 {
5161                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5162                _next_ordinal_to_read += 1;
5163                next_offset += envelope_size;
5164            }
5165
5166            let next_out_of_line = decoder.next_out_of_line();
5167            let handles_before = decoder.remaining_handles();
5168            if let Some((inlined, num_bytes, num_handles)) =
5169                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5170            {
5171                let member_inline_size =
5172                    <SensorDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5173                if inlined != (member_inline_size <= 4) {
5174                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5175                }
5176                let inner_offset;
5177                let mut inner_depth = depth.clone();
5178                if inlined {
5179                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5180                    inner_offset = next_offset;
5181                } else {
5182                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5183                    inner_depth.increment()?;
5184                }
5185                let val_ref =
5186                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorDescriptor, D));
5187                fidl::decode!(SensorDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5188                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5189                {
5190                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5191                }
5192                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5193                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5194                }
5195            }
5196
5197            next_offset += envelope_size;
5198            _next_ordinal_to_read += 1;
5199            if next_offset >= end_offset {
5200                return Ok(());
5201            }
5202
5203            // Decode unknown envelopes for gaps in ordinals.
5204            while _next_ordinal_to_read < 4 {
5205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5206                _next_ordinal_to_read += 1;
5207                next_offset += envelope_size;
5208            }
5209
5210            let next_out_of_line = decoder.next_out_of_line();
5211            let handles_before = decoder.remaining_handles();
5212            if let Some((inlined, num_bytes, num_handles)) =
5213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5214            {
5215                let member_inline_size =
5216                    <TouchDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5217                if inlined != (member_inline_size <= 4) {
5218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5219                }
5220                let inner_offset;
5221                let mut inner_depth = depth.clone();
5222                if inlined {
5223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5224                    inner_offset = next_offset;
5225                } else {
5226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5227                    inner_depth.increment()?;
5228                }
5229                let val_ref =
5230                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchDescriptor, D));
5231                fidl::decode!(TouchDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5232                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5233                {
5234                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5235                }
5236                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5237                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5238                }
5239            }
5240
5241            next_offset += envelope_size;
5242            _next_ordinal_to_read += 1;
5243            if next_offset >= end_offset {
5244                return Ok(());
5245            }
5246
5247            // Decode unknown envelopes for gaps in ordinals.
5248            while _next_ordinal_to_read < 5 {
5249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5250                _next_ordinal_to_read += 1;
5251                next_offset += envelope_size;
5252            }
5253
5254            let next_out_of_line = decoder.next_out_of_line();
5255            let handles_before = decoder.remaining_handles();
5256            if let Some((inlined, num_bytes, num_handles)) =
5257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5258            {
5259                let member_inline_size =
5260                    <KeyboardDescriptor as fidl::encoding::TypeMarker>::inline_size(
5261                        decoder.context,
5262                    );
5263                if inlined != (member_inline_size <= 4) {
5264                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5265                }
5266                let inner_offset;
5267                let mut inner_depth = depth.clone();
5268                if inlined {
5269                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5270                    inner_offset = next_offset;
5271                } else {
5272                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5273                    inner_depth.increment()?;
5274                }
5275                let val_ref =
5276                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardDescriptor, D));
5277                fidl::decode!(KeyboardDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5279                {
5280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5281                }
5282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5284                }
5285            }
5286
5287            next_offset += envelope_size;
5288            _next_ordinal_to_read += 1;
5289            if next_offset >= end_offset {
5290                return Ok(());
5291            }
5292
5293            // Decode unknown envelopes for gaps in ordinals.
5294            while _next_ordinal_to_read < 6 {
5295                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5296                _next_ordinal_to_read += 1;
5297                next_offset += envelope_size;
5298            }
5299
5300            let next_out_of_line = decoder.next_out_of_line();
5301            let handles_before = decoder.remaining_handles();
5302            if let Some((inlined, num_bytes, num_handles)) =
5303                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5304            {
5305                let member_inline_size =
5306                    <ConsumerControlDescriptor as fidl::encoding::TypeMarker>::inline_size(
5307                        decoder.context,
5308                    );
5309                if inlined != (member_inline_size <= 4) {
5310                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5311                }
5312                let inner_offset;
5313                let mut inner_depth = depth.clone();
5314                if inlined {
5315                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5316                    inner_offset = next_offset;
5317                } else {
5318                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5319                    inner_depth.increment()?;
5320                }
5321                let val_ref = self
5322                    .consumer_control
5323                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlDescriptor, D));
5324                fidl::decode!(
5325                    ConsumerControlDescriptor,
5326                    D,
5327                    val_ref,
5328                    decoder,
5329                    inner_offset,
5330                    inner_depth
5331                )?;
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 < 7 {
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                    <DeviceInformation 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
5374                    .device_information
5375                    .get_or_insert_with(|| fidl::new_empty!(DeviceInformation, D));
5376                fidl::decode!(DeviceInformation, D, val_ref, decoder, inner_offset, inner_depth)?;
5377                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5378                {
5379                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5380                }
5381                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5382                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5383                }
5384            }
5385
5386            next_offset += envelope_size;
5387
5388            // Decode the remaining unknown envelopes.
5389            while next_offset < end_offset {
5390                _next_ordinal_to_read += 1;
5391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5392                next_offset += envelope_size;
5393            }
5394
5395            Ok(())
5396        }
5397    }
5398
5399    impl DeviceInformation {
5400        #[inline(always)]
5401        fn max_ordinal_present(&self) -> u64 {
5402            if let Some(_) = self.polling_rate {
5403                return 4;
5404            }
5405            if let Some(_) = self.version {
5406                return 3;
5407            }
5408            if let Some(_) = self.product_id {
5409                return 2;
5410            }
5411            if let Some(_) = self.vendor_id {
5412                return 1;
5413            }
5414            0
5415        }
5416    }
5417
5418    impl fidl::encoding::ValueTypeMarker for DeviceInformation {
5419        type Borrowed<'a> = &'a Self;
5420        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5421            value
5422        }
5423    }
5424
5425    unsafe impl fidl::encoding::TypeMarker for DeviceInformation {
5426        type Owned = Self;
5427
5428        #[inline(always)]
5429        fn inline_align(_context: fidl::encoding::Context) -> usize {
5430            8
5431        }
5432
5433        #[inline(always)]
5434        fn inline_size(_context: fidl::encoding::Context) -> usize {
5435            16
5436        }
5437    }
5438
5439    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInformation, D>
5440        for &DeviceInformation
5441    {
5442        unsafe fn encode(
5443            self,
5444            encoder: &mut fidl::encoding::Encoder<'_, D>,
5445            offset: usize,
5446            mut depth: fidl::encoding::Depth,
5447        ) -> fidl::Result<()> {
5448            encoder.debug_check_bounds::<DeviceInformation>(offset);
5449            // Vector header
5450            let max_ordinal: u64 = self.max_ordinal_present();
5451            encoder.write_num(max_ordinal, offset);
5452            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5453            // Calling encoder.out_of_line_offset(0) is not allowed.
5454            if max_ordinal == 0 {
5455                return Ok(());
5456            }
5457            depth.increment()?;
5458            let envelope_size = 8;
5459            let bytes_len = max_ordinal as usize * envelope_size;
5460            #[allow(unused_variables)]
5461            let offset = encoder.out_of_line_offset(bytes_len);
5462            let mut _prev_end_offset: usize = 0;
5463            if 1 > max_ordinal {
5464                return Ok(());
5465            }
5466
5467            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5468            // are envelope_size bytes.
5469            let cur_offset: usize = (1 - 1) * envelope_size;
5470
5471            // Zero reserved fields.
5472            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5473
5474            // Safety:
5475            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5476            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5477            //   envelope_size bytes, there is always sufficient room.
5478            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5479                self.vendor_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5480                encoder,
5481                offset + cur_offset,
5482                depth,
5483            )?;
5484
5485            _prev_end_offset = cur_offset + envelope_size;
5486            if 2 > max_ordinal {
5487                return Ok(());
5488            }
5489
5490            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5491            // are envelope_size bytes.
5492            let cur_offset: usize = (2 - 1) * envelope_size;
5493
5494            // Zero reserved fields.
5495            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5496
5497            // Safety:
5498            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5499            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5500            //   envelope_size bytes, there is always sufficient room.
5501            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5502                self.product_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5503                encoder,
5504                offset + cur_offset,
5505                depth,
5506            )?;
5507
5508            _prev_end_offset = cur_offset + envelope_size;
5509            if 3 > max_ordinal {
5510                return Ok(());
5511            }
5512
5513            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5514            // are envelope_size bytes.
5515            let cur_offset: usize = (3 - 1) * envelope_size;
5516
5517            // Zero reserved fields.
5518            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5519
5520            // Safety:
5521            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5522            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5523            //   envelope_size bytes, there is always sufficient room.
5524            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5525                self.version.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5526                encoder,
5527                offset + cur_offset,
5528                depth,
5529            )?;
5530
5531            _prev_end_offset = cur_offset + envelope_size;
5532            if 4 > max_ordinal {
5533                return Ok(());
5534            }
5535
5536            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5537            // are envelope_size bytes.
5538            let cur_offset: usize = (4 - 1) * envelope_size;
5539
5540            // Zero reserved fields.
5541            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5542
5543            // Safety:
5544            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5545            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5546            //   envelope_size bytes, there is always sufficient room.
5547            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5548                self.polling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5549                encoder,
5550                offset + cur_offset,
5551                depth,
5552            )?;
5553
5554            _prev_end_offset = cur_offset + envelope_size;
5555
5556            Ok(())
5557        }
5558    }
5559
5560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInformation {
5561        #[inline(always)]
5562        fn new_empty() -> Self {
5563            Self::default()
5564        }
5565
5566        unsafe fn decode(
5567            &mut self,
5568            decoder: &mut fidl::encoding::Decoder<'_, D>,
5569            offset: usize,
5570            mut depth: fidl::encoding::Depth,
5571        ) -> fidl::Result<()> {
5572            decoder.debug_check_bounds::<Self>(offset);
5573            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5574                None => return Err(fidl::Error::NotNullable),
5575                Some(len) => len,
5576            };
5577            // Calling decoder.out_of_line_offset(0) is not allowed.
5578            if len == 0 {
5579                return Ok(());
5580            };
5581            depth.increment()?;
5582            let envelope_size = 8;
5583            let bytes_len = len * envelope_size;
5584            let offset = decoder.out_of_line_offset(bytes_len)?;
5585            // Decode the envelope for each type.
5586            let mut _next_ordinal_to_read = 0;
5587            let mut next_offset = offset;
5588            let end_offset = offset + bytes_len;
5589            _next_ordinal_to_read += 1;
5590            if next_offset >= end_offset {
5591                return Ok(());
5592            }
5593
5594            // Decode unknown envelopes for gaps in ordinals.
5595            while _next_ordinal_to_read < 1 {
5596                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5597                _next_ordinal_to_read += 1;
5598                next_offset += envelope_size;
5599            }
5600
5601            let next_out_of_line = decoder.next_out_of_line();
5602            let handles_before = decoder.remaining_handles();
5603            if let Some((inlined, num_bytes, num_handles)) =
5604                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5605            {
5606                let member_inline_size =
5607                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5608                if inlined != (member_inline_size <= 4) {
5609                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5610                }
5611                let inner_offset;
5612                let mut inner_depth = depth.clone();
5613                if inlined {
5614                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5615                    inner_offset = next_offset;
5616                } else {
5617                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5618                    inner_depth.increment()?;
5619                }
5620                let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5621                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5622                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5623                {
5624                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5625                }
5626                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5627                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5628                }
5629            }
5630
5631            next_offset += envelope_size;
5632            _next_ordinal_to_read += 1;
5633            if next_offset >= end_offset {
5634                return Ok(());
5635            }
5636
5637            // Decode unknown envelopes for gaps in ordinals.
5638            while _next_ordinal_to_read < 2 {
5639                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5640                _next_ordinal_to_read += 1;
5641                next_offset += envelope_size;
5642            }
5643
5644            let next_out_of_line = decoder.next_out_of_line();
5645            let handles_before = decoder.remaining_handles();
5646            if let Some((inlined, num_bytes, num_handles)) =
5647                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5648            {
5649                let member_inline_size =
5650                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5651                if inlined != (member_inline_size <= 4) {
5652                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5653                }
5654                let inner_offset;
5655                let mut inner_depth = depth.clone();
5656                if inlined {
5657                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5658                    inner_offset = next_offset;
5659                } else {
5660                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5661                    inner_depth.increment()?;
5662                }
5663                let val_ref = self.product_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5664                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5665                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5666                {
5667                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5668                }
5669                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5670                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5671                }
5672            }
5673
5674            next_offset += envelope_size;
5675            _next_ordinal_to_read += 1;
5676            if next_offset >= end_offset {
5677                return Ok(());
5678            }
5679
5680            // Decode unknown envelopes for gaps in ordinals.
5681            while _next_ordinal_to_read < 3 {
5682                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5683                _next_ordinal_to_read += 1;
5684                next_offset += envelope_size;
5685            }
5686
5687            let next_out_of_line = decoder.next_out_of_line();
5688            let handles_before = decoder.remaining_handles();
5689            if let Some((inlined, num_bytes, num_handles)) =
5690                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5691            {
5692                let member_inline_size =
5693                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5694                if inlined != (member_inline_size <= 4) {
5695                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5696                }
5697                let inner_offset;
5698                let mut inner_depth = depth.clone();
5699                if inlined {
5700                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5701                    inner_offset = next_offset;
5702                } else {
5703                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5704                    inner_depth.increment()?;
5705                }
5706                let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(u32, D));
5707                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5708                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5709                {
5710                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5711                }
5712                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5713                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5714                }
5715            }
5716
5717            next_offset += envelope_size;
5718            _next_ordinal_to_read += 1;
5719            if next_offset >= end_offset {
5720                return Ok(());
5721            }
5722
5723            // Decode unknown envelopes for gaps in ordinals.
5724            while _next_ordinal_to_read < 4 {
5725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5726                _next_ordinal_to_read += 1;
5727                next_offset += envelope_size;
5728            }
5729
5730            let next_out_of_line = decoder.next_out_of_line();
5731            let handles_before = decoder.remaining_handles();
5732            if let Some((inlined, num_bytes, num_handles)) =
5733                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5734            {
5735                let member_inline_size =
5736                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5737                if inlined != (member_inline_size <= 4) {
5738                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5739                }
5740                let inner_offset;
5741                let mut inner_depth = depth.clone();
5742                if inlined {
5743                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5744                    inner_offset = next_offset;
5745                } else {
5746                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5747                    inner_depth.increment()?;
5748                }
5749                let val_ref = self.polling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
5750                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5751                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5752                {
5753                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5754                }
5755                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5756                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5757                }
5758            }
5759
5760            next_offset += envelope_size;
5761
5762            // Decode the remaining unknown envelopes.
5763            while next_offset < end_offset {
5764                _next_ordinal_to_read += 1;
5765                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5766                next_offset += envelope_size;
5767            }
5768
5769            Ok(())
5770        }
5771    }
5772
5773    impl FeatureReport {
5774        #[inline(always)]
5775        fn max_ordinal_present(&self) -> u64 {
5776            if let Some(_) = self.touch {
5777                return 2;
5778            }
5779            if let Some(_) = self.sensor {
5780                return 1;
5781            }
5782            0
5783        }
5784    }
5785
5786    impl fidl::encoding::ValueTypeMarker for FeatureReport {
5787        type Borrowed<'a> = &'a Self;
5788        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5789            value
5790        }
5791    }
5792
5793    unsafe impl fidl::encoding::TypeMarker for FeatureReport {
5794        type Owned = Self;
5795
5796        #[inline(always)]
5797        fn inline_align(_context: fidl::encoding::Context) -> usize {
5798            8
5799        }
5800
5801        #[inline(always)]
5802        fn inline_size(_context: fidl::encoding::Context) -> usize {
5803            16
5804        }
5805    }
5806
5807    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FeatureReport, D>
5808        for &FeatureReport
5809    {
5810        unsafe fn encode(
5811            self,
5812            encoder: &mut fidl::encoding::Encoder<'_, D>,
5813            offset: usize,
5814            mut depth: fidl::encoding::Depth,
5815        ) -> fidl::Result<()> {
5816            encoder.debug_check_bounds::<FeatureReport>(offset);
5817            // Vector header
5818            let max_ordinal: u64 = self.max_ordinal_present();
5819            encoder.write_num(max_ordinal, offset);
5820            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5821            // Calling encoder.out_of_line_offset(0) is not allowed.
5822            if max_ordinal == 0 {
5823                return Ok(());
5824            }
5825            depth.increment()?;
5826            let envelope_size = 8;
5827            let bytes_len = max_ordinal as usize * envelope_size;
5828            #[allow(unused_variables)]
5829            let offset = encoder.out_of_line_offset(bytes_len);
5830            let mut _prev_end_offset: usize = 0;
5831            if 1 > max_ordinal {
5832                return Ok(());
5833            }
5834
5835            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5836            // are envelope_size bytes.
5837            let cur_offset: usize = (1 - 1) * envelope_size;
5838
5839            // Zero reserved fields.
5840            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5841
5842            // Safety:
5843            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5844            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5845            //   envelope_size bytes, there is always sufficient room.
5846            fidl::encoding::encode_in_envelope_optional::<SensorFeatureReport, D>(
5847                self.sensor
5848                    .as_ref()
5849                    .map(<SensorFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5850                encoder,
5851                offset + cur_offset,
5852                depth,
5853            )?;
5854
5855            _prev_end_offset = cur_offset + envelope_size;
5856            if 2 > max_ordinal {
5857                return Ok(());
5858            }
5859
5860            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5861            // are envelope_size bytes.
5862            let cur_offset: usize = (2 - 1) * envelope_size;
5863
5864            // Zero reserved fields.
5865            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5866
5867            // Safety:
5868            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5869            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5870            //   envelope_size bytes, there is always sufficient room.
5871            fidl::encoding::encode_in_envelope_optional::<TouchFeatureReport, D>(
5872                self.touch
5873                    .as_ref()
5874                    .map(<TouchFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5875                encoder,
5876                offset + cur_offset,
5877                depth,
5878            )?;
5879
5880            _prev_end_offset = cur_offset + envelope_size;
5881
5882            Ok(())
5883        }
5884    }
5885
5886    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FeatureReport {
5887        #[inline(always)]
5888        fn new_empty() -> Self {
5889            Self::default()
5890        }
5891
5892        unsafe fn decode(
5893            &mut self,
5894            decoder: &mut fidl::encoding::Decoder<'_, D>,
5895            offset: usize,
5896            mut depth: fidl::encoding::Depth,
5897        ) -> fidl::Result<()> {
5898            decoder.debug_check_bounds::<Self>(offset);
5899            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5900                None => return Err(fidl::Error::NotNullable),
5901                Some(len) => len,
5902            };
5903            // Calling decoder.out_of_line_offset(0) is not allowed.
5904            if len == 0 {
5905                return Ok(());
5906            };
5907            depth.increment()?;
5908            let envelope_size = 8;
5909            let bytes_len = len * envelope_size;
5910            let offset = decoder.out_of_line_offset(bytes_len)?;
5911            // Decode the envelope for each type.
5912            let mut _next_ordinal_to_read = 0;
5913            let mut next_offset = offset;
5914            let end_offset = offset + bytes_len;
5915            _next_ordinal_to_read += 1;
5916            if next_offset >= end_offset {
5917                return Ok(());
5918            }
5919
5920            // Decode unknown envelopes for gaps in ordinals.
5921            while _next_ordinal_to_read < 1 {
5922                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5923                _next_ordinal_to_read += 1;
5924                next_offset += envelope_size;
5925            }
5926
5927            let next_out_of_line = decoder.next_out_of_line();
5928            let handles_before = decoder.remaining_handles();
5929            if let Some((inlined, num_bytes, num_handles)) =
5930                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5931            {
5932                let member_inline_size =
5933                    <SensorFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5934                        decoder.context,
5935                    );
5936                if inlined != (member_inline_size <= 4) {
5937                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5938                }
5939                let inner_offset;
5940                let mut inner_depth = depth.clone();
5941                if inlined {
5942                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5943                    inner_offset = next_offset;
5944                } else {
5945                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5946                    inner_depth.increment()?;
5947                }
5948                let val_ref =
5949                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorFeatureReport, D));
5950                fidl::decode!(SensorFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5951                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5952                {
5953                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5954                }
5955                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5956                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5957                }
5958            }
5959
5960            next_offset += envelope_size;
5961            _next_ordinal_to_read += 1;
5962            if next_offset >= end_offset {
5963                return Ok(());
5964            }
5965
5966            // Decode unknown envelopes for gaps in ordinals.
5967            while _next_ordinal_to_read < 2 {
5968                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5969                _next_ordinal_to_read += 1;
5970                next_offset += envelope_size;
5971            }
5972
5973            let next_out_of_line = decoder.next_out_of_line();
5974            let handles_before = decoder.remaining_handles();
5975            if let Some((inlined, num_bytes, num_handles)) =
5976                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5977            {
5978                let member_inline_size =
5979                    <TouchFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5980                        decoder.context,
5981                    );
5982                if inlined != (member_inline_size <= 4) {
5983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5984                }
5985                let inner_offset;
5986                let mut inner_depth = depth.clone();
5987                if inlined {
5988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5989                    inner_offset = next_offset;
5990                } else {
5991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5992                    inner_depth.increment()?;
5993                }
5994                let val_ref =
5995                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchFeatureReport, D));
5996                fidl::decode!(TouchFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5997                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5998                {
5999                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6000                }
6001                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6002                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6003                }
6004            }
6005
6006            next_offset += envelope_size;
6007
6008            // Decode the remaining unknown envelopes.
6009            while next_offset < end_offset {
6010                _next_ordinal_to_read += 1;
6011                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6012                next_offset += envelope_size;
6013            }
6014
6015            Ok(())
6016        }
6017    }
6018
6019    impl InputReport {
6020        #[inline(always)]
6021        fn max_ordinal_present(&self) -> u64 {
6022            if let Some(_) = self.report_id {
6023                return 8;
6024            }
6025            if let Some(_) = self.consumer_control {
6026                return 7;
6027            }
6028            if let Some(_) = self.keyboard {
6029                return 6;
6030            }
6031            if let Some(_) = self.touch {
6032                return 5;
6033            }
6034            if let Some(_) = self.sensor {
6035                return 4;
6036            }
6037            if let Some(_) = self.trace_id {
6038                return 3;
6039            }
6040            if let Some(_) = self.mouse {
6041                return 2;
6042            }
6043            if let Some(_) = self.event_time {
6044                return 1;
6045            }
6046            0
6047        }
6048    }
6049
6050    impl fidl::encoding::ValueTypeMarker for InputReport {
6051        type Borrowed<'a> = &'a Self;
6052        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6053            value
6054        }
6055    }
6056
6057    unsafe impl fidl::encoding::TypeMarker for InputReport {
6058        type Owned = Self;
6059
6060        #[inline(always)]
6061        fn inline_align(_context: fidl::encoding::Context) -> usize {
6062            8
6063        }
6064
6065        #[inline(always)]
6066        fn inline_size(_context: fidl::encoding::Context) -> usize {
6067            16
6068        }
6069    }
6070
6071    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
6072        for &InputReport
6073    {
6074        unsafe fn encode(
6075            self,
6076            encoder: &mut fidl::encoding::Encoder<'_, D>,
6077            offset: usize,
6078            mut depth: fidl::encoding::Depth,
6079        ) -> fidl::Result<()> {
6080            encoder.debug_check_bounds::<InputReport>(offset);
6081            // Vector header
6082            let max_ordinal: u64 = self.max_ordinal_present();
6083            encoder.write_num(max_ordinal, offset);
6084            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6085            // Calling encoder.out_of_line_offset(0) is not allowed.
6086            if max_ordinal == 0 {
6087                return Ok(());
6088            }
6089            depth.increment()?;
6090            let envelope_size = 8;
6091            let bytes_len = max_ordinal as usize * envelope_size;
6092            #[allow(unused_variables)]
6093            let offset = encoder.out_of_line_offset(bytes_len);
6094            let mut _prev_end_offset: usize = 0;
6095            if 1 > max_ordinal {
6096                return Ok(());
6097            }
6098
6099            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6100            // are envelope_size bytes.
6101            let cur_offset: usize = (1 - 1) * envelope_size;
6102
6103            // Zero reserved fields.
6104            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6105
6106            // Safety:
6107            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6108            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6109            //   envelope_size bytes, there is always sufficient room.
6110            fidl::encoding::encode_in_envelope_optional::<i64, D>(
6111                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6112                encoder,
6113                offset + cur_offset,
6114                depth,
6115            )?;
6116
6117            _prev_end_offset = cur_offset + envelope_size;
6118            if 2 > max_ordinal {
6119                return Ok(());
6120            }
6121
6122            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6123            // are envelope_size bytes.
6124            let cur_offset: usize = (2 - 1) * envelope_size;
6125
6126            // Zero reserved fields.
6127            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6128
6129            // Safety:
6130            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6131            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6132            //   envelope_size bytes, there is always sufficient room.
6133            fidl::encoding::encode_in_envelope_optional::<MouseInputReport, D>(
6134                self.mouse
6135                    .as_ref()
6136                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6137                encoder,
6138                offset + cur_offset,
6139                depth,
6140            )?;
6141
6142            _prev_end_offset = cur_offset + envelope_size;
6143            if 3 > max_ordinal {
6144                return Ok(());
6145            }
6146
6147            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6148            // are envelope_size bytes.
6149            let cur_offset: usize = (3 - 1) * envelope_size;
6150
6151            // Zero reserved fields.
6152            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6153
6154            // Safety:
6155            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6156            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6157            //   envelope_size bytes, there is always sufficient room.
6158            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6159                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6160                encoder,
6161                offset + cur_offset,
6162                depth,
6163            )?;
6164
6165            _prev_end_offset = cur_offset + envelope_size;
6166            if 4 > max_ordinal {
6167                return Ok(());
6168            }
6169
6170            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6171            // are envelope_size bytes.
6172            let cur_offset: usize = (4 - 1) * envelope_size;
6173
6174            // Zero reserved fields.
6175            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6176
6177            // Safety:
6178            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6179            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6180            //   envelope_size bytes, there is always sufficient room.
6181            fidl::encoding::encode_in_envelope_optional::<SensorInputReport, D>(
6182                self.sensor
6183                    .as_ref()
6184                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6185                encoder,
6186                offset + cur_offset,
6187                depth,
6188            )?;
6189
6190            _prev_end_offset = cur_offset + envelope_size;
6191            if 5 > max_ordinal {
6192                return Ok(());
6193            }
6194
6195            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6196            // are envelope_size bytes.
6197            let cur_offset: usize = (5 - 1) * envelope_size;
6198
6199            // Zero reserved fields.
6200            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6201
6202            // Safety:
6203            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6204            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6205            //   envelope_size bytes, there is always sufficient room.
6206            fidl::encoding::encode_in_envelope_optional::<TouchInputReport, D>(
6207                self.touch
6208                    .as_ref()
6209                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6210                encoder,
6211                offset + cur_offset,
6212                depth,
6213            )?;
6214
6215            _prev_end_offset = cur_offset + envelope_size;
6216            if 6 > max_ordinal {
6217                return Ok(());
6218            }
6219
6220            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6221            // are envelope_size bytes.
6222            let cur_offset: usize = (6 - 1) * envelope_size;
6223
6224            // Zero reserved fields.
6225            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6226
6227            // Safety:
6228            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6229            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6230            //   envelope_size bytes, there is always sufficient room.
6231            fidl::encoding::encode_in_envelope_optional::<KeyboardInputReport, D>(
6232                self.keyboard
6233                    .as_ref()
6234                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6235                encoder,
6236                offset + cur_offset,
6237                depth,
6238            )?;
6239
6240            _prev_end_offset = cur_offset + envelope_size;
6241            if 7 > max_ordinal {
6242                return Ok(());
6243            }
6244
6245            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6246            // are envelope_size bytes.
6247            let cur_offset: usize = (7 - 1) * envelope_size;
6248
6249            // Zero reserved fields.
6250            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6251
6252            // Safety:
6253            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6254            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6255            //   envelope_size bytes, there is always sufficient room.
6256            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputReport, D>(
6257                self.consumer_control
6258                    .as_ref()
6259                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6260                encoder,
6261                offset + cur_offset,
6262                depth,
6263            )?;
6264
6265            _prev_end_offset = cur_offset + envelope_size;
6266            if 8 > max_ordinal {
6267                return Ok(());
6268            }
6269
6270            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6271            // are envelope_size bytes.
6272            let cur_offset: usize = (8 - 1) * envelope_size;
6273
6274            // Zero reserved fields.
6275            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6276
6277            // Safety:
6278            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6279            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6280            //   envelope_size bytes, there is always sufficient room.
6281            fidl::encoding::encode_in_envelope_optional::<u8, D>(
6282                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
6283                encoder,
6284                offset + cur_offset,
6285                depth,
6286            )?;
6287
6288            _prev_end_offset = cur_offset + envelope_size;
6289
6290            Ok(())
6291        }
6292    }
6293
6294    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
6295        #[inline(always)]
6296        fn new_empty() -> Self {
6297            Self::default()
6298        }
6299
6300        unsafe fn decode(
6301            &mut self,
6302            decoder: &mut fidl::encoding::Decoder<'_, D>,
6303            offset: usize,
6304            mut depth: fidl::encoding::Depth,
6305        ) -> fidl::Result<()> {
6306            decoder.debug_check_bounds::<Self>(offset);
6307            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6308                None => return Err(fidl::Error::NotNullable),
6309                Some(len) => len,
6310            };
6311            // Calling decoder.out_of_line_offset(0) is not allowed.
6312            if len == 0 {
6313                return Ok(());
6314            };
6315            depth.increment()?;
6316            let envelope_size = 8;
6317            let bytes_len = len * envelope_size;
6318            let offset = decoder.out_of_line_offset(bytes_len)?;
6319            // Decode the envelope for each type.
6320            let mut _next_ordinal_to_read = 0;
6321            let mut next_offset = offset;
6322            let end_offset = offset + bytes_len;
6323            _next_ordinal_to_read += 1;
6324            if next_offset >= end_offset {
6325                return Ok(());
6326            }
6327
6328            // Decode unknown envelopes for gaps in ordinals.
6329            while _next_ordinal_to_read < 1 {
6330                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6331                _next_ordinal_to_read += 1;
6332                next_offset += envelope_size;
6333            }
6334
6335            let next_out_of_line = decoder.next_out_of_line();
6336            let handles_before = decoder.remaining_handles();
6337            if let Some((inlined, num_bytes, num_handles)) =
6338                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6339            {
6340                let member_inline_size =
6341                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6342                if inlined != (member_inline_size <= 4) {
6343                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6344                }
6345                let inner_offset;
6346                let mut inner_depth = depth.clone();
6347                if inlined {
6348                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6349                    inner_offset = next_offset;
6350                } else {
6351                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6352                    inner_depth.increment()?;
6353                }
6354                let val_ref = self.event_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
6355                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6356                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6357                {
6358                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6359                }
6360                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6361                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6362                }
6363            }
6364
6365            next_offset += envelope_size;
6366            _next_ordinal_to_read += 1;
6367            if next_offset >= end_offset {
6368                return Ok(());
6369            }
6370
6371            // Decode unknown envelopes for gaps in ordinals.
6372            while _next_ordinal_to_read < 2 {
6373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6374                _next_ordinal_to_read += 1;
6375                next_offset += envelope_size;
6376            }
6377
6378            let next_out_of_line = decoder.next_out_of_line();
6379            let handles_before = decoder.remaining_handles();
6380            if let Some((inlined, num_bytes, num_handles)) =
6381                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6382            {
6383                let member_inline_size =
6384                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6385                if inlined != (member_inline_size <= 4) {
6386                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6387                }
6388                let inner_offset;
6389                let mut inner_depth = depth.clone();
6390                if inlined {
6391                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6392                    inner_offset = next_offset;
6393                } else {
6394                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6395                    inner_depth.increment()?;
6396                }
6397                let val_ref =
6398                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseInputReport, D));
6399                fidl::decode!(MouseInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6400                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6401                {
6402                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6403                }
6404                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6405                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6406                }
6407            }
6408
6409            next_offset += envelope_size;
6410            _next_ordinal_to_read += 1;
6411            if next_offset >= end_offset {
6412                return Ok(());
6413            }
6414
6415            // Decode unknown envelopes for gaps in ordinals.
6416            while _next_ordinal_to_read < 3 {
6417                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6418                _next_ordinal_to_read += 1;
6419                next_offset += envelope_size;
6420            }
6421
6422            let next_out_of_line = decoder.next_out_of_line();
6423            let handles_before = decoder.remaining_handles();
6424            if let Some((inlined, num_bytes, num_handles)) =
6425                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6426            {
6427                let member_inline_size =
6428                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6429                if inlined != (member_inline_size <= 4) {
6430                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6431                }
6432                let inner_offset;
6433                let mut inner_depth = depth.clone();
6434                if inlined {
6435                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6436                    inner_offset = next_offset;
6437                } else {
6438                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6439                    inner_depth.increment()?;
6440                }
6441                let val_ref = self.trace_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
6442                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6443                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6444                {
6445                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6446                }
6447                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6448                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6449                }
6450            }
6451
6452            next_offset += envelope_size;
6453            _next_ordinal_to_read += 1;
6454            if next_offset >= end_offset {
6455                return Ok(());
6456            }
6457
6458            // Decode unknown envelopes for gaps in ordinals.
6459            while _next_ordinal_to_read < 4 {
6460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6461                _next_ordinal_to_read += 1;
6462                next_offset += envelope_size;
6463            }
6464
6465            let next_out_of_line = decoder.next_out_of_line();
6466            let handles_before = decoder.remaining_handles();
6467            if let Some((inlined, num_bytes, num_handles)) =
6468                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6469            {
6470                let member_inline_size =
6471                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6472                if inlined != (member_inline_size <= 4) {
6473                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6474                }
6475                let inner_offset;
6476                let mut inner_depth = depth.clone();
6477                if inlined {
6478                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6479                    inner_offset = next_offset;
6480                } else {
6481                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6482                    inner_depth.increment()?;
6483                }
6484                let val_ref =
6485                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorInputReport, D));
6486                fidl::decode!(SensorInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6487                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6488                {
6489                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6490                }
6491                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6492                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6493                }
6494            }
6495
6496            next_offset += envelope_size;
6497            _next_ordinal_to_read += 1;
6498            if next_offset >= end_offset {
6499                return Ok(());
6500            }
6501
6502            // Decode unknown envelopes for gaps in ordinals.
6503            while _next_ordinal_to_read < 5 {
6504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6505                _next_ordinal_to_read += 1;
6506                next_offset += envelope_size;
6507            }
6508
6509            let next_out_of_line = decoder.next_out_of_line();
6510            let handles_before = decoder.remaining_handles();
6511            if let Some((inlined, num_bytes, num_handles)) =
6512                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6513            {
6514                let member_inline_size =
6515                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6516                if inlined != (member_inline_size <= 4) {
6517                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6518                }
6519                let inner_offset;
6520                let mut inner_depth = depth.clone();
6521                if inlined {
6522                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6523                    inner_offset = next_offset;
6524                } else {
6525                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6526                    inner_depth.increment()?;
6527                }
6528                let val_ref =
6529                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchInputReport, D));
6530                fidl::decode!(TouchInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6531                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6532                {
6533                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6534                }
6535                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6536                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6537                }
6538            }
6539
6540            next_offset += envelope_size;
6541            _next_ordinal_to_read += 1;
6542            if next_offset >= end_offset {
6543                return Ok(());
6544            }
6545
6546            // Decode unknown envelopes for gaps in ordinals.
6547            while _next_ordinal_to_read < 6 {
6548                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6549                _next_ordinal_to_read += 1;
6550                next_offset += envelope_size;
6551            }
6552
6553            let next_out_of_line = decoder.next_out_of_line();
6554            let handles_before = decoder.remaining_handles();
6555            if let Some((inlined, num_bytes, num_handles)) =
6556                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6557            {
6558                let member_inline_size =
6559                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
6560                        decoder.context,
6561                    );
6562                if inlined != (member_inline_size <= 4) {
6563                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6564                }
6565                let inner_offset;
6566                let mut inner_depth = depth.clone();
6567                if inlined {
6568                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6569                    inner_offset = next_offset;
6570                } else {
6571                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6572                    inner_depth.increment()?;
6573                }
6574                let val_ref =
6575                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardInputReport, D));
6576                fidl::decode!(KeyboardInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6577                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6578                {
6579                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6580                }
6581                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6582                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6583                }
6584            }
6585
6586            next_offset += envelope_size;
6587            _next_ordinal_to_read += 1;
6588            if next_offset >= end_offset {
6589                return Ok(());
6590            }
6591
6592            // Decode unknown envelopes for gaps in ordinals.
6593            while _next_ordinal_to_read < 7 {
6594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6595                _next_ordinal_to_read += 1;
6596                next_offset += envelope_size;
6597            }
6598
6599            let next_out_of_line = decoder.next_out_of_line();
6600            let handles_before = decoder.remaining_handles();
6601            if let Some((inlined, num_bytes, num_handles)) =
6602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6603            {
6604                let member_inline_size =
6605                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
6606                        decoder.context,
6607                    );
6608                if inlined != (member_inline_size <= 4) {
6609                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6610                }
6611                let inner_offset;
6612                let mut inner_depth = depth.clone();
6613                if inlined {
6614                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6615                    inner_offset = next_offset;
6616                } else {
6617                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6618                    inner_depth.increment()?;
6619                }
6620                let val_ref = self
6621                    .consumer_control
6622                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputReport, D));
6623                fidl::decode!(
6624                    ConsumerControlInputReport,
6625                    D,
6626                    val_ref,
6627                    decoder,
6628                    inner_offset,
6629                    inner_depth
6630                )?;
6631                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6632                {
6633                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6634                }
6635                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6636                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6637                }
6638            }
6639
6640            next_offset += envelope_size;
6641            _next_ordinal_to_read += 1;
6642            if next_offset >= end_offset {
6643                return Ok(());
6644            }
6645
6646            // Decode unknown envelopes for gaps in ordinals.
6647            while _next_ordinal_to_read < 8 {
6648                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6649                _next_ordinal_to_read += 1;
6650                next_offset += envelope_size;
6651            }
6652
6653            let next_out_of_line = decoder.next_out_of_line();
6654            let handles_before = decoder.remaining_handles();
6655            if let Some((inlined, num_bytes, num_handles)) =
6656                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6657            {
6658                let member_inline_size =
6659                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6660                if inlined != (member_inline_size <= 4) {
6661                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6662                }
6663                let inner_offset;
6664                let mut inner_depth = depth.clone();
6665                if inlined {
6666                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6667                    inner_offset = next_offset;
6668                } else {
6669                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6670                    inner_depth.increment()?;
6671                }
6672                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
6673                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6675                {
6676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6677                }
6678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6680                }
6681            }
6682
6683            next_offset += envelope_size;
6684
6685            // Decode the remaining unknown envelopes.
6686            while next_offset < end_offset {
6687                _next_ordinal_to_read += 1;
6688                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6689                next_offset += envelope_size;
6690            }
6691
6692            Ok(())
6693        }
6694    }
6695
6696    impl KeyboardDescriptor {
6697        #[inline(always)]
6698        fn max_ordinal_present(&self) -> u64 {
6699            if let Some(_) = self.output {
6700                return 2;
6701            }
6702            if let Some(_) = self.input {
6703                return 1;
6704            }
6705            0
6706        }
6707    }
6708
6709    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
6710        type Borrowed<'a> = &'a Self;
6711        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6712            value
6713        }
6714    }
6715
6716    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
6717        type Owned = Self;
6718
6719        #[inline(always)]
6720        fn inline_align(_context: fidl::encoding::Context) -> usize {
6721            8
6722        }
6723
6724        #[inline(always)]
6725        fn inline_size(_context: fidl::encoding::Context) -> usize {
6726            16
6727        }
6728    }
6729
6730    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
6731        for &KeyboardDescriptor
6732    {
6733        unsafe fn encode(
6734            self,
6735            encoder: &mut fidl::encoding::Encoder<'_, D>,
6736            offset: usize,
6737            mut depth: fidl::encoding::Depth,
6738        ) -> fidl::Result<()> {
6739            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
6740            // Vector header
6741            let max_ordinal: u64 = self.max_ordinal_present();
6742            encoder.write_num(max_ordinal, offset);
6743            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6744            // Calling encoder.out_of_line_offset(0) is not allowed.
6745            if max_ordinal == 0 {
6746                return Ok(());
6747            }
6748            depth.increment()?;
6749            let envelope_size = 8;
6750            let bytes_len = max_ordinal as usize * envelope_size;
6751            #[allow(unused_variables)]
6752            let offset = encoder.out_of_line_offset(bytes_len);
6753            let mut _prev_end_offset: usize = 0;
6754            if 1 > max_ordinal {
6755                return Ok(());
6756            }
6757
6758            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6759            // are envelope_size bytes.
6760            let cur_offset: usize = (1 - 1) * envelope_size;
6761
6762            // Zero reserved fields.
6763            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6764
6765            // Safety:
6766            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6767            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6768            //   envelope_size bytes, there is always sufficient room.
6769            fidl::encoding::encode_in_envelope_optional::<KeyboardInputDescriptor, D>(
6770                self.input
6771                    .as_ref()
6772                    .map(<KeyboardInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6773                encoder,
6774                offset + cur_offset,
6775                depth,
6776            )?;
6777
6778            _prev_end_offset = cur_offset + envelope_size;
6779            if 2 > max_ordinal {
6780                return Ok(());
6781            }
6782
6783            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6784            // are envelope_size bytes.
6785            let cur_offset: usize = (2 - 1) * envelope_size;
6786
6787            // Zero reserved fields.
6788            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6789
6790            // Safety:
6791            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6792            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6793            //   envelope_size bytes, there is always sufficient room.
6794            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
6795                self.output
6796                    .as_ref()
6797                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6798                encoder,
6799                offset + cur_offset,
6800                depth,
6801            )?;
6802
6803            _prev_end_offset = cur_offset + envelope_size;
6804
6805            Ok(())
6806        }
6807    }
6808
6809    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
6810        #[inline(always)]
6811        fn new_empty() -> Self {
6812            Self::default()
6813        }
6814
6815        unsafe fn decode(
6816            &mut self,
6817            decoder: &mut fidl::encoding::Decoder<'_, D>,
6818            offset: usize,
6819            mut depth: fidl::encoding::Depth,
6820        ) -> fidl::Result<()> {
6821            decoder.debug_check_bounds::<Self>(offset);
6822            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6823                None => return Err(fidl::Error::NotNullable),
6824                Some(len) => len,
6825            };
6826            // Calling decoder.out_of_line_offset(0) is not allowed.
6827            if len == 0 {
6828                return Ok(());
6829            };
6830            depth.increment()?;
6831            let envelope_size = 8;
6832            let bytes_len = len * envelope_size;
6833            let offset = decoder.out_of_line_offset(bytes_len)?;
6834            // Decode the envelope for each type.
6835            let mut _next_ordinal_to_read = 0;
6836            let mut next_offset = offset;
6837            let end_offset = offset + bytes_len;
6838            _next_ordinal_to_read += 1;
6839            if next_offset >= end_offset {
6840                return Ok(());
6841            }
6842
6843            // Decode unknown envelopes for gaps in ordinals.
6844            while _next_ordinal_to_read < 1 {
6845                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6846                _next_ordinal_to_read += 1;
6847                next_offset += envelope_size;
6848            }
6849
6850            let next_out_of_line = decoder.next_out_of_line();
6851            let handles_before = decoder.remaining_handles();
6852            if let Some((inlined, num_bytes, num_handles)) =
6853                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6854            {
6855                let member_inline_size =
6856                    <KeyboardInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6857                        decoder.context,
6858                    );
6859                if inlined != (member_inline_size <= 4) {
6860                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6861                }
6862                let inner_offset;
6863                let mut inner_depth = depth.clone();
6864                if inlined {
6865                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6866                    inner_offset = next_offset;
6867                } else {
6868                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6869                    inner_depth.increment()?;
6870                }
6871                let val_ref =
6872                    self.input.get_or_insert_with(|| fidl::new_empty!(KeyboardInputDescriptor, D));
6873                fidl::decode!(
6874                    KeyboardInputDescriptor,
6875                    D,
6876                    val_ref,
6877                    decoder,
6878                    inner_offset,
6879                    inner_depth
6880                )?;
6881                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6882                {
6883                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6884                }
6885                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6886                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6887                }
6888            }
6889
6890            next_offset += envelope_size;
6891            _next_ordinal_to_read += 1;
6892            if next_offset >= end_offset {
6893                return Ok(());
6894            }
6895
6896            // Decode unknown envelopes for gaps in ordinals.
6897            while _next_ordinal_to_read < 2 {
6898                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6899                _next_ordinal_to_read += 1;
6900                next_offset += envelope_size;
6901            }
6902
6903            let next_out_of_line = decoder.next_out_of_line();
6904            let handles_before = decoder.remaining_handles();
6905            if let Some((inlined, num_bytes, num_handles)) =
6906                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6907            {
6908                let member_inline_size =
6909                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6910                        decoder.context,
6911                    );
6912                if inlined != (member_inline_size <= 4) {
6913                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6914                }
6915                let inner_offset;
6916                let mut inner_depth = depth.clone();
6917                if inlined {
6918                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6919                    inner_offset = next_offset;
6920                } else {
6921                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6922                    inner_depth.increment()?;
6923                }
6924                let val_ref = self
6925                    .output
6926                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
6927                fidl::decode!(
6928                    KeyboardOutputDescriptor,
6929                    D,
6930                    val_ref,
6931                    decoder,
6932                    inner_offset,
6933                    inner_depth
6934                )?;
6935                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6936                {
6937                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6938                }
6939                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6940                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6941                }
6942            }
6943
6944            next_offset += envelope_size;
6945
6946            // Decode the remaining unknown envelopes.
6947            while next_offset < end_offset {
6948                _next_ordinal_to_read += 1;
6949                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6950                next_offset += envelope_size;
6951            }
6952
6953            Ok(())
6954        }
6955    }
6956
6957    impl KeyboardInputDescriptor {
6958        #[inline(always)]
6959        fn max_ordinal_present(&self) -> u64 {
6960            if let Some(_) = self.keys3 {
6961                return 2;
6962            }
6963            0
6964        }
6965    }
6966
6967    impl fidl::encoding::ValueTypeMarker for KeyboardInputDescriptor {
6968        type Borrowed<'a> = &'a Self;
6969        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6970            value
6971        }
6972    }
6973
6974    unsafe impl fidl::encoding::TypeMarker for KeyboardInputDescriptor {
6975        type Owned = Self;
6976
6977        #[inline(always)]
6978        fn inline_align(_context: fidl::encoding::Context) -> usize {
6979            8
6980        }
6981
6982        #[inline(always)]
6983        fn inline_size(_context: fidl::encoding::Context) -> usize {
6984            16
6985        }
6986    }
6987
6988    unsafe impl<D: fidl::encoding::ResourceDialect>
6989        fidl::encoding::Encode<KeyboardInputDescriptor, D> for &KeyboardInputDescriptor
6990    {
6991        unsafe fn encode(
6992            self,
6993            encoder: &mut fidl::encoding::Encoder<'_, D>,
6994            offset: usize,
6995            mut depth: fidl::encoding::Depth,
6996        ) -> fidl::Result<()> {
6997            encoder.debug_check_bounds::<KeyboardInputDescriptor>(offset);
6998            // Vector header
6999            let max_ordinal: u64 = self.max_ordinal_present();
7000            encoder.write_num(max_ordinal, offset);
7001            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7002            // Calling encoder.out_of_line_offset(0) is not allowed.
7003            if max_ordinal == 0 {
7004                return Ok(());
7005            }
7006            depth.increment()?;
7007            let envelope_size = 8;
7008            let bytes_len = max_ordinal as usize * envelope_size;
7009            #[allow(unused_variables)]
7010            let offset = encoder.out_of_line_offset(bytes_len);
7011            let mut _prev_end_offset: usize = 0;
7012            if 2 > max_ordinal {
7013                return Ok(());
7014            }
7015
7016            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7017            // are envelope_size bytes.
7018            let cur_offset: usize = (2 - 1) * envelope_size;
7019
7020            // Zero reserved fields.
7021            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7022
7023            // Safety:
7024            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7025            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7026            //   envelope_size bytes, there is always sufficient room.
7027            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7028            self.keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7029            encoder, offset + cur_offset, depth
7030        )?;
7031
7032            _prev_end_offset = cur_offset + envelope_size;
7033
7034            Ok(())
7035        }
7036    }
7037
7038    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7039        for KeyboardInputDescriptor
7040    {
7041        #[inline(always)]
7042        fn new_empty() -> Self {
7043            Self::default()
7044        }
7045
7046        unsafe fn decode(
7047            &mut self,
7048            decoder: &mut fidl::encoding::Decoder<'_, D>,
7049            offset: usize,
7050            mut depth: fidl::encoding::Depth,
7051        ) -> fidl::Result<()> {
7052            decoder.debug_check_bounds::<Self>(offset);
7053            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7054                None => return Err(fidl::Error::NotNullable),
7055                Some(len) => len,
7056            };
7057            // Calling decoder.out_of_line_offset(0) is not allowed.
7058            if len == 0 {
7059                return Ok(());
7060            };
7061            depth.increment()?;
7062            let envelope_size = 8;
7063            let bytes_len = len * envelope_size;
7064            let offset = decoder.out_of_line_offset(bytes_len)?;
7065            // Decode the envelope for each type.
7066            let mut _next_ordinal_to_read = 0;
7067            let mut next_offset = offset;
7068            let end_offset = offset + bytes_len;
7069            _next_ordinal_to_read += 1;
7070            if next_offset >= end_offset {
7071                return Ok(());
7072            }
7073
7074            // Decode unknown envelopes for gaps in ordinals.
7075            while _next_ordinal_to_read < 2 {
7076                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7077                _next_ordinal_to_read += 1;
7078                next_offset += envelope_size;
7079            }
7080
7081            let next_out_of_line = decoder.next_out_of_line();
7082            let handles_before = decoder.remaining_handles();
7083            if let Some((inlined, num_bytes, num_handles)) =
7084                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7085            {
7086                let member_inline_size = <fidl::encoding::Vector<
7087                    fidl_fuchsia_input__common::Key,
7088                    256,
7089                > as fidl::encoding::TypeMarker>::inline_size(
7090                    decoder.context
7091                );
7092                if inlined != (member_inline_size <= 4) {
7093                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7094                }
7095                let inner_offset;
7096                let mut inner_depth = depth.clone();
7097                if inlined {
7098                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7099                    inner_offset = next_offset;
7100                } else {
7101                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7102                    inner_depth.increment()?;
7103                }
7104                let val_ref =
7105                self.keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7106                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7107                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7108                {
7109                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7110                }
7111                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7112                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7113                }
7114            }
7115
7116            next_offset += envelope_size;
7117
7118            // Decode the remaining unknown envelopes.
7119            while next_offset < end_offset {
7120                _next_ordinal_to_read += 1;
7121                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7122                next_offset += envelope_size;
7123            }
7124
7125            Ok(())
7126        }
7127    }
7128
7129    impl KeyboardInputReport {
7130        #[inline(always)]
7131        fn max_ordinal_present(&self) -> u64 {
7132            if let Some(_) = self.pressed_keys3 {
7133                return 2;
7134            }
7135            0
7136        }
7137    }
7138
7139    impl fidl::encoding::ValueTypeMarker for KeyboardInputReport {
7140        type Borrowed<'a> = &'a Self;
7141        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7142            value
7143        }
7144    }
7145
7146    unsafe impl fidl::encoding::TypeMarker for KeyboardInputReport {
7147        type Owned = Self;
7148
7149        #[inline(always)]
7150        fn inline_align(_context: fidl::encoding::Context) -> usize {
7151            8
7152        }
7153
7154        #[inline(always)]
7155        fn inline_size(_context: fidl::encoding::Context) -> usize {
7156            16
7157        }
7158    }
7159
7160    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardInputReport, D>
7161        for &KeyboardInputReport
7162    {
7163        unsafe fn encode(
7164            self,
7165            encoder: &mut fidl::encoding::Encoder<'_, D>,
7166            offset: usize,
7167            mut depth: fidl::encoding::Depth,
7168        ) -> fidl::Result<()> {
7169            encoder.debug_check_bounds::<KeyboardInputReport>(offset);
7170            // Vector header
7171            let max_ordinal: u64 = self.max_ordinal_present();
7172            encoder.write_num(max_ordinal, offset);
7173            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7174            // Calling encoder.out_of_line_offset(0) is not allowed.
7175            if max_ordinal == 0 {
7176                return Ok(());
7177            }
7178            depth.increment()?;
7179            let envelope_size = 8;
7180            let bytes_len = max_ordinal as usize * envelope_size;
7181            #[allow(unused_variables)]
7182            let offset = encoder.out_of_line_offset(bytes_len);
7183            let mut _prev_end_offset: usize = 0;
7184            if 2 > max_ordinal {
7185                return Ok(());
7186            }
7187
7188            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7189            // are envelope_size bytes.
7190            let cur_offset: usize = (2 - 1) * envelope_size;
7191
7192            // Zero reserved fields.
7193            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7194
7195            // Safety:
7196            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7197            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7198            //   envelope_size bytes, there is always sufficient room.
7199            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7200            self.pressed_keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7201            encoder, offset + cur_offset, depth
7202        )?;
7203
7204            _prev_end_offset = cur_offset + envelope_size;
7205
7206            Ok(())
7207        }
7208    }
7209
7210    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardInputReport {
7211        #[inline(always)]
7212        fn new_empty() -> Self {
7213            Self::default()
7214        }
7215
7216        unsafe fn decode(
7217            &mut self,
7218            decoder: &mut fidl::encoding::Decoder<'_, D>,
7219            offset: usize,
7220            mut depth: fidl::encoding::Depth,
7221        ) -> fidl::Result<()> {
7222            decoder.debug_check_bounds::<Self>(offset);
7223            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7224                None => return Err(fidl::Error::NotNullable),
7225                Some(len) => len,
7226            };
7227            // Calling decoder.out_of_line_offset(0) is not allowed.
7228            if len == 0 {
7229                return Ok(());
7230            };
7231            depth.increment()?;
7232            let envelope_size = 8;
7233            let bytes_len = len * envelope_size;
7234            let offset = decoder.out_of_line_offset(bytes_len)?;
7235            // Decode the envelope for each type.
7236            let mut _next_ordinal_to_read = 0;
7237            let mut next_offset = offset;
7238            let end_offset = offset + bytes_len;
7239            _next_ordinal_to_read += 1;
7240            if next_offset >= end_offset {
7241                return Ok(());
7242            }
7243
7244            // Decode unknown envelopes for gaps in ordinals.
7245            while _next_ordinal_to_read < 2 {
7246                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7247                _next_ordinal_to_read += 1;
7248                next_offset += envelope_size;
7249            }
7250
7251            let next_out_of_line = decoder.next_out_of_line();
7252            let handles_before = decoder.remaining_handles();
7253            if let Some((inlined, num_bytes, num_handles)) =
7254                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7255            {
7256                let member_inline_size = <fidl::encoding::Vector<
7257                    fidl_fuchsia_input__common::Key,
7258                    256,
7259                > as fidl::encoding::TypeMarker>::inline_size(
7260                    decoder.context
7261                );
7262                if inlined != (member_inline_size <= 4) {
7263                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7264                }
7265                let inner_offset;
7266                let mut inner_depth = depth.clone();
7267                if inlined {
7268                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7269                    inner_offset = next_offset;
7270                } else {
7271                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7272                    inner_depth.increment()?;
7273                }
7274                let val_ref =
7275                self.pressed_keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7276                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7277                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7278                {
7279                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7280                }
7281                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7282                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7283                }
7284            }
7285
7286            next_offset += envelope_size;
7287
7288            // Decode the remaining unknown envelopes.
7289            while next_offset < end_offset {
7290                _next_ordinal_to_read += 1;
7291                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7292                next_offset += envelope_size;
7293            }
7294
7295            Ok(())
7296        }
7297    }
7298
7299    impl KeyboardOutputDescriptor {
7300        #[inline(always)]
7301        fn max_ordinal_present(&self) -> u64 {
7302            if let Some(_) = self.leds {
7303                return 1;
7304            }
7305            0
7306        }
7307    }
7308
7309    impl fidl::encoding::ValueTypeMarker for KeyboardOutputDescriptor {
7310        type Borrowed<'a> = &'a Self;
7311        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7312            value
7313        }
7314    }
7315
7316    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputDescriptor {
7317        type Owned = Self;
7318
7319        #[inline(always)]
7320        fn inline_align(_context: fidl::encoding::Context) -> usize {
7321            8
7322        }
7323
7324        #[inline(always)]
7325        fn inline_size(_context: fidl::encoding::Context) -> usize {
7326            16
7327        }
7328    }
7329
7330    unsafe impl<D: fidl::encoding::ResourceDialect>
7331        fidl::encoding::Encode<KeyboardOutputDescriptor, D> for &KeyboardOutputDescriptor
7332    {
7333        unsafe fn encode(
7334            self,
7335            encoder: &mut fidl::encoding::Encoder<'_, D>,
7336            offset: usize,
7337            mut depth: fidl::encoding::Depth,
7338        ) -> fidl::Result<()> {
7339            encoder.debug_check_bounds::<KeyboardOutputDescriptor>(offset);
7340            // Vector header
7341            let max_ordinal: u64 = self.max_ordinal_present();
7342            encoder.write_num(max_ordinal, offset);
7343            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7344            // Calling encoder.out_of_line_offset(0) is not allowed.
7345            if max_ordinal == 0 {
7346                return Ok(());
7347            }
7348            depth.increment()?;
7349            let envelope_size = 8;
7350            let bytes_len = max_ordinal as usize * envelope_size;
7351            #[allow(unused_variables)]
7352            let offset = encoder.out_of_line_offset(bytes_len);
7353            let mut _prev_end_offset: usize = 0;
7354            if 1 > max_ordinal {
7355                return Ok(());
7356            }
7357
7358            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7359            // are envelope_size bytes.
7360            let cur_offset: usize = (1 - 1) * envelope_size;
7361
7362            // Zero reserved fields.
7363            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7364
7365            // Safety:
7366            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7367            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7368            //   envelope_size bytes, there is always sufficient room.
7369            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7370            self.leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7371            encoder, offset + cur_offset, depth
7372        )?;
7373
7374            _prev_end_offset = cur_offset + envelope_size;
7375
7376            Ok(())
7377        }
7378    }
7379
7380    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7381        for KeyboardOutputDescriptor
7382    {
7383        #[inline(always)]
7384        fn new_empty() -> Self {
7385            Self::default()
7386        }
7387
7388        unsafe fn decode(
7389            &mut self,
7390            decoder: &mut fidl::encoding::Decoder<'_, D>,
7391            offset: usize,
7392            mut depth: fidl::encoding::Depth,
7393        ) -> fidl::Result<()> {
7394            decoder.debug_check_bounds::<Self>(offset);
7395            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7396                None => return Err(fidl::Error::NotNullable),
7397                Some(len) => len,
7398            };
7399            // Calling decoder.out_of_line_offset(0) is not allowed.
7400            if len == 0 {
7401                return Ok(());
7402            };
7403            depth.increment()?;
7404            let envelope_size = 8;
7405            let bytes_len = len * envelope_size;
7406            let offset = decoder.out_of_line_offset(bytes_len)?;
7407            // Decode the envelope for each type.
7408            let mut _next_ordinal_to_read = 0;
7409            let mut next_offset = offset;
7410            let end_offset = offset + bytes_len;
7411            _next_ordinal_to_read += 1;
7412            if next_offset >= end_offset {
7413                return Ok(());
7414            }
7415
7416            // Decode unknown envelopes for gaps in ordinals.
7417            while _next_ordinal_to_read < 1 {
7418                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7419                _next_ordinal_to_read += 1;
7420                next_offset += envelope_size;
7421            }
7422
7423            let next_out_of_line = decoder.next_out_of_line();
7424            let handles_before = decoder.remaining_handles();
7425            if let Some((inlined, num_bytes, num_handles)) =
7426                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7427            {
7428                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
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.leds.get_or_insert_with(
7442                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7443                );
7444                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7445                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7446                {
7447                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7448                }
7449                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7450                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7451                }
7452            }
7453
7454            next_offset += envelope_size;
7455
7456            // Decode the remaining unknown envelopes.
7457            while next_offset < end_offset {
7458                _next_ordinal_to_read += 1;
7459                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7460                next_offset += envelope_size;
7461            }
7462
7463            Ok(())
7464        }
7465    }
7466
7467    impl KeyboardOutputReport {
7468        #[inline(always)]
7469        fn max_ordinal_present(&self) -> u64 {
7470            if let Some(_) = self.enabled_leds {
7471                return 1;
7472            }
7473            0
7474        }
7475    }
7476
7477    impl fidl::encoding::ValueTypeMarker for KeyboardOutputReport {
7478        type Borrowed<'a> = &'a Self;
7479        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7480            value
7481        }
7482    }
7483
7484    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputReport {
7485        type Owned = Self;
7486
7487        #[inline(always)]
7488        fn inline_align(_context: fidl::encoding::Context) -> usize {
7489            8
7490        }
7491
7492        #[inline(always)]
7493        fn inline_size(_context: fidl::encoding::Context) -> usize {
7494            16
7495        }
7496    }
7497
7498    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardOutputReport, D>
7499        for &KeyboardOutputReport
7500    {
7501        unsafe fn encode(
7502            self,
7503            encoder: &mut fidl::encoding::Encoder<'_, D>,
7504            offset: usize,
7505            mut depth: fidl::encoding::Depth,
7506        ) -> fidl::Result<()> {
7507            encoder.debug_check_bounds::<KeyboardOutputReport>(offset);
7508            // Vector header
7509            let max_ordinal: u64 = self.max_ordinal_present();
7510            encoder.write_num(max_ordinal, offset);
7511            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7512            // Calling encoder.out_of_line_offset(0) is not allowed.
7513            if max_ordinal == 0 {
7514                return Ok(());
7515            }
7516            depth.increment()?;
7517            let envelope_size = 8;
7518            let bytes_len = max_ordinal as usize * envelope_size;
7519            #[allow(unused_variables)]
7520            let offset = encoder.out_of_line_offset(bytes_len);
7521            let mut _prev_end_offset: usize = 0;
7522            if 1 > max_ordinal {
7523                return Ok(());
7524            }
7525
7526            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7527            // are envelope_size bytes.
7528            let cur_offset: usize = (1 - 1) * envelope_size;
7529
7530            // Zero reserved fields.
7531            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7532
7533            // Safety:
7534            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7535            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7536            //   envelope_size bytes, there is always sufficient room.
7537            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7538            self.enabled_leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7539            encoder, offset + cur_offset, depth
7540        )?;
7541
7542            _prev_end_offset = cur_offset + envelope_size;
7543
7544            Ok(())
7545        }
7546    }
7547
7548    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardOutputReport {
7549        #[inline(always)]
7550        fn new_empty() -> Self {
7551            Self::default()
7552        }
7553
7554        unsafe fn decode(
7555            &mut self,
7556            decoder: &mut fidl::encoding::Decoder<'_, D>,
7557            offset: usize,
7558            mut depth: fidl::encoding::Depth,
7559        ) -> fidl::Result<()> {
7560            decoder.debug_check_bounds::<Self>(offset);
7561            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7562                None => return Err(fidl::Error::NotNullable),
7563                Some(len) => len,
7564            };
7565            // Calling decoder.out_of_line_offset(0) is not allowed.
7566            if len == 0 {
7567                return Ok(());
7568            };
7569            depth.increment()?;
7570            let envelope_size = 8;
7571            let bytes_len = len * envelope_size;
7572            let offset = decoder.out_of_line_offset(bytes_len)?;
7573            // Decode the envelope for each type.
7574            let mut _next_ordinal_to_read = 0;
7575            let mut next_offset = offset;
7576            let end_offset = offset + bytes_len;
7577            _next_ordinal_to_read += 1;
7578            if next_offset >= end_offset {
7579                return Ok(());
7580            }
7581
7582            // Decode unknown envelopes for gaps in ordinals.
7583            while _next_ordinal_to_read < 1 {
7584                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7585                _next_ordinal_to_read += 1;
7586                next_offset += envelope_size;
7587            }
7588
7589            let next_out_of_line = decoder.next_out_of_line();
7590            let handles_before = decoder.remaining_handles();
7591            if let Some((inlined, num_bytes, num_handles)) =
7592                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7593            {
7594                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7595                if inlined != (member_inline_size <= 4) {
7596                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7597                }
7598                let inner_offset;
7599                let mut inner_depth = depth.clone();
7600                if inlined {
7601                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7602                    inner_offset = next_offset;
7603                } else {
7604                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7605                    inner_depth.increment()?;
7606                }
7607                let val_ref = self.enabled_leds.get_or_insert_with(
7608                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7609                );
7610                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7612                {
7613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7614                }
7615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7617                }
7618            }
7619
7620            next_offset += envelope_size;
7621
7622            // Decode the remaining unknown envelopes.
7623            while next_offset < end_offset {
7624                _next_ordinal_to_read += 1;
7625                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7626                next_offset += envelope_size;
7627            }
7628
7629            Ok(())
7630        }
7631    }
7632
7633    impl MouseDescriptor {
7634        #[inline(always)]
7635        fn max_ordinal_present(&self) -> u64 {
7636            if let Some(_) = self.input {
7637                return 1;
7638            }
7639            0
7640        }
7641    }
7642
7643    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
7644        type Borrowed<'a> = &'a Self;
7645        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7646            value
7647        }
7648    }
7649
7650    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
7651        type Owned = Self;
7652
7653        #[inline(always)]
7654        fn inline_align(_context: fidl::encoding::Context) -> usize {
7655            8
7656        }
7657
7658        #[inline(always)]
7659        fn inline_size(_context: fidl::encoding::Context) -> usize {
7660            16
7661        }
7662    }
7663
7664    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
7665        for &MouseDescriptor
7666    {
7667        unsafe fn encode(
7668            self,
7669            encoder: &mut fidl::encoding::Encoder<'_, D>,
7670            offset: usize,
7671            mut depth: fidl::encoding::Depth,
7672        ) -> fidl::Result<()> {
7673            encoder.debug_check_bounds::<MouseDescriptor>(offset);
7674            // Vector header
7675            let max_ordinal: u64 = self.max_ordinal_present();
7676            encoder.write_num(max_ordinal, offset);
7677            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7678            // Calling encoder.out_of_line_offset(0) is not allowed.
7679            if max_ordinal == 0 {
7680                return Ok(());
7681            }
7682            depth.increment()?;
7683            let envelope_size = 8;
7684            let bytes_len = max_ordinal as usize * envelope_size;
7685            #[allow(unused_variables)]
7686            let offset = encoder.out_of_line_offset(bytes_len);
7687            let mut _prev_end_offset: usize = 0;
7688            if 1 > max_ordinal {
7689                return Ok(());
7690            }
7691
7692            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7693            // are envelope_size bytes.
7694            let cur_offset: usize = (1 - 1) * envelope_size;
7695
7696            // Zero reserved fields.
7697            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7698
7699            // Safety:
7700            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7701            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7702            //   envelope_size bytes, there is always sufficient room.
7703            fidl::encoding::encode_in_envelope_optional::<MouseInputDescriptor, D>(
7704                self.input
7705                    .as_ref()
7706                    .map(<MouseInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
7707                encoder,
7708                offset + cur_offset,
7709                depth,
7710            )?;
7711
7712            _prev_end_offset = cur_offset + envelope_size;
7713
7714            Ok(())
7715        }
7716    }
7717
7718    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
7719        #[inline(always)]
7720        fn new_empty() -> Self {
7721            Self::default()
7722        }
7723
7724        unsafe fn decode(
7725            &mut self,
7726            decoder: &mut fidl::encoding::Decoder<'_, D>,
7727            offset: usize,
7728            mut depth: fidl::encoding::Depth,
7729        ) -> fidl::Result<()> {
7730            decoder.debug_check_bounds::<Self>(offset);
7731            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7732                None => return Err(fidl::Error::NotNullable),
7733                Some(len) => len,
7734            };
7735            // Calling decoder.out_of_line_offset(0) is not allowed.
7736            if len == 0 {
7737                return Ok(());
7738            };
7739            depth.increment()?;
7740            let envelope_size = 8;
7741            let bytes_len = len * envelope_size;
7742            let offset = decoder.out_of_line_offset(bytes_len)?;
7743            // Decode the envelope for each type.
7744            let mut _next_ordinal_to_read = 0;
7745            let mut next_offset = offset;
7746            let end_offset = offset + bytes_len;
7747            _next_ordinal_to_read += 1;
7748            if next_offset >= end_offset {
7749                return Ok(());
7750            }
7751
7752            // Decode unknown envelopes for gaps in ordinals.
7753            while _next_ordinal_to_read < 1 {
7754                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7755                _next_ordinal_to_read += 1;
7756                next_offset += envelope_size;
7757            }
7758
7759            let next_out_of_line = decoder.next_out_of_line();
7760            let handles_before = decoder.remaining_handles();
7761            if let Some((inlined, num_bytes, num_handles)) =
7762                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7763            {
7764                let member_inline_size =
7765                    <MouseInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
7766                        decoder.context,
7767                    );
7768                if inlined != (member_inline_size <= 4) {
7769                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7770                }
7771                let inner_offset;
7772                let mut inner_depth = depth.clone();
7773                if inlined {
7774                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7775                    inner_offset = next_offset;
7776                } else {
7777                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7778                    inner_depth.increment()?;
7779                }
7780                let val_ref =
7781                    self.input.get_or_insert_with(|| fidl::new_empty!(MouseInputDescriptor, D));
7782                fidl::decode!(
7783                    MouseInputDescriptor,
7784                    D,
7785                    val_ref,
7786                    decoder,
7787                    inner_offset,
7788                    inner_depth
7789                )?;
7790                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7791                {
7792                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7793                }
7794                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7795                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7796                }
7797            }
7798
7799            next_offset += envelope_size;
7800
7801            // Decode the remaining unknown envelopes.
7802            while next_offset < end_offset {
7803                _next_ordinal_to_read += 1;
7804                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7805                next_offset += envelope_size;
7806            }
7807
7808            Ok(())
7809        }
7810    }
7811
7812    impl MouseInputDescriptor {
7813        #[inline(always)]
7814        fn max_ordinal_present(&self) -> u64 {
7815            if let Some(_) = self.position_y {
7816                return 7;
7817            }
7818            if let Some(_) = self.position_x {
7819                return 6;
7820            }
7821            if let Some(_) = self.buttons {
7822                return 5;
7823            }
7824            if let Some(_) = self.scroll_h {
7825                return 4;
7826            }
7827            if let Some(_) = self.scroll_v {
7828                return 3;
7829            }
7830            if let Some(_) = self.movement_y {
7831                return 2;
7832            }
7833            if let Some(_) = self.movement_x {
7834                return 1;
7835            }
7836            0
7837        }
7838    }
7839
7840    impl fidl::encoding::ValueTypeMarker for MouseInputDescriptor {
7841        type Borrowed<'a> = &'a Self;
7842        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7843            value
7844        }
7845    }
7846
7847    unsafe impl fidl::encoding::TypeMarker for MouseInputDescriptor {
7848        type Owned = Self;
7849
7850        #[inline(always)]
7851        fn inline_align(_context: fidl::encoding::Context) -> usize {
7852            8
7853        }
7854
7855        #[inline(always)]
7856        fn inline_size(_context: fidl::encoding::Context) -> usize {
7857            16
7858        }
7859    }
7860
7861    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputDescriptor, D>
7862        for &MouseInputDescriptor
7863    {
7864        unsafe fn encode(
7865            self,
7866            encoder: &mut fidl::encoding::Encoder<'_, D>,
7867            offset: usize,
7868            mut depth: fidl::encoding::Depth,
7869        ) -> fidl::Result<()> {
7870            encoder.debug_check_bounds::<MouseInputDescriptor>(offset);
7871            // Vector header
7872            let max_ordinal: u64 = self.max_ordinal_present();
7873            encoder.write_num(max_ordinal, offset);
7874            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7875            // Calling encoder.out_of_line_offset(0) is not allowed.
7876            if max_ordinal == 0 {
7877                return Ok(());
7878            }
7879            depth.increment()?;
7880            let envelope_size = 8;
7881            let bytes_len = max_ordinal as usize * envelope_size;
7882            #[allow(unused_variables)]
7883            let offset = encoder.out_of_line_offset(bytes_len);
7884            let mut _prev_end_offset: usize = 0;
7885            if 1 > max_ordinal {
7886                return Ok(());
7887            }
7888
7889            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7890            // are envelope_size bytes.
7891            let cur_offset: usize = (1 - 1) * envelope_size;
7892
7893            // Zero reserved fields.
7894            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7895
7896            // Safety:
7897            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7898            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7899            //   envelope_size bytes, there is always sufficient room.
7900            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7901                self.movement_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7902                encoder,
7903                offset + cur_offset,
7904                depth,
7905            )?;
7906
7907            _prev_end_offset = cur_offset + envelope_size;
7908            if 2 > max_ordinal {
7909                return Ok(());
7910            }
7911
7912            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7913            // are envelope_size bytes.
7914            let cur_offset: usize = (2 - 1) * envelope_size;
7915
7916            // Zero reserved fields.
7917            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7918
7919            // Safety:
7920            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7921            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7922            //   envelope_size bytes, there is always sufficient room.
7923            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7924                self.movement_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7925                encoder,
7926                offset + cur_offset,
7927                depth,
7928            )?;
7929
7930            _prev_end_offset = cur_offset + envelope_size;
7931            if 3 > max_ordinal {
7932                return Ok(());
7933            }
7934
7935            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7936            // are envelope_size bytes.
7937            let cur_offset: usize = (3 - 1) * envelope_size;
7938
7939            // Zero reserved fields.
7940            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7941
7942            // Safety:
7943            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7944            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7945            //   envelope_size bytes, there is always sufficient room.
7946            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7947                self.scroll_v.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7948                encoder,
7949                offset + cur_offset,
7950                depth,
7951            )?;
7952
7953            _prev_end_offset = cur_offset + envelope_size;
7954            if 4 > max_ordinal {
7955                return Ok(());
7956            }
7957
7958            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7959            // are envelope_size bytes.
7960            let cur_offset: usize = (4 - 1) * envelope_size;
7961
7962            // Zero reserved fields.
7963            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7964
7965            // Safety:
7966            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7967            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7968            //   envelope_size bytes, there is always sufficient room.
7969            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7970                self.scroll_h.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7971                encoder,
7972                offset + cur_offset,
7973                depth,
7974            )?;
7975
7976            _prev_end_offset = cur_offset + envelope_size;
7977            if 5 > max_ordinal {
7978                return Ok(());
7979            }
7980
7981            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7982            // are envelope_size bytes.
7983            let cur_offset: usize = (5 - 1) * envelope_size;
7984
7985            // Zero reserved fields.
7986            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7987
7988            // Safety:
7989            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7990            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7991            //   envelope_size bytes, there is always sufficient room.
7992            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
7993                self.buttons.as_ref().map(
7994                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
7995                ),
7996                encoder,
7997                offset + cur_offset,
7998                depth,
7999            )?;
8000
8001            _prev_end_offset = cur_offset + envelope_size;
8002            if 6 > max_ordinal {
8003                return Ok(());
8004            }
8005
8006            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8007            // are envelope_size bytes.
8008            let cur_offset: usize = (6 - 1) * envelope_size;
8009
8010            // Zero reserved fields.
8011            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8012
8013            // Safety:
8014            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8015            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8016            //   envelope_size bytes, there is always sufficient room.
8017            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8018                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8019                encoder,
8020                offset + cur_offset,
8021                depth,
8022            )?;
8023
8024            _prev_end_offset = cur_offset + envelope_size;
8025            if 7 > max_ordinal {
8026                return Ok(());
8027            }
8028
8029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8030            // are envelope_size bytes.
8031            let cur_offset: usize = (7 - 1) * envelope_size;
8032
8033            // Zero reserved fields.
8034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8035
8036            // Safety:
8037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8039            //   envelope_size bytes, there is always sufficient room.
8040            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8041                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8042                encoder,
8043                offset + cur_offset,
8044                depth,
8045            )?;
8046
8047            _prev_end_offset = cur_offset + envelope_size;
8048
8049            Ok(())
8050        }
8051    }
8052
8053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputDescriptor {
8054        #[inline(always)]
8055        fn new_empty() -> Self {
8056            Self::default()
8057        }
8058
8059        unsafe fn decode(
8060            &mut self,
8061            decoder: &mut fidl::encoding::Decoder<'_, D>,
8062            offset: usize,
8063            mut depth: fidl::encoding::Depth,
8064        ) -> fidl::Result<()> {
8065            decoder.debug_check_bounds::<Self>(offset);
8066            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8067                None => return Err(fidl::Error::NotNullable),
8068                Some(len) => len,
8069            };
8070            // Calling decoder.out_of_line_offset(0) is not allowed.
8071            if len == 0 {
8072                return Ok(());
8073            };
8074            depth.increment()?;
8075            let envelope_size = 8;
8076            let bytes_len = len * envelope_size;
8077            let offset = decoder.out_of_line_offset(bytes_len)?;
8078            // Decode the envelope for each type.
8079            let mut _next_ordinal_to_read = 0;
8080            let mut next_offset = offset;
8081            let end_offset = offset + bytes_len;
8082            _next_ordinal_to_read += 1;
8083            if next_offset >= end_offset {
8084                return Ok(());
8085            }
8086
8087            // Decode unknown envelopes for gaps in ordinals.
8088            while _next_ordinal_to_read < 1 {
8089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8090                _next_ordinal_to_read += 1;
8091                next_offset += envelope_size;
8092            }
8093
8094            let next_out_of_line = decoder.next_out_of_line();
8095            let handles_before = decoder.remaining_handles();
8096            if let Some((inlined, num_bytes, num_handles)) =
8097                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8098            {
8099                let member_inline_size =
8100                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8101                if inlined != (member_inline_size <= 4) {
8102                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8103                }
8104                let inner_offset;
8105                let mut inner_depth = depth.clone();
8106                if inlined {
8107                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8108                    inner_offset = next_offset;
8109                } else {
8110                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8111                    inner_depth.increment()?;
8112                }
8113                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8114                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8115                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8116                {
8117                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8118                }
8119                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8120                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8121                }
8122            }
8123
8124            next_offset += envelope_size;
8125            _next_ordinal_to_read += 1;
8126            if next_offset >= end_offset {
8127                return Ok(());
8128            }
8129
8130            // Decode unknown envelopes for gaps in ordinals.
8131            while _next_ordinal_to_read < 2 {
8132                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8133                _next_ordinal_to_read += 1;
8134                next_offset += envelope_size;
8135            }
8136
8137            let next_out_of_line = decoder.next_out_of_line();
8138            let handles_before = decoder.remaining_handles();
8139            if let Some((inlined, num_bytes, num_handles)) =
8140                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8141            {
8142                let member_inline_size =
8143                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8144                if inlined != (member_inline_size <= 4) {
8145                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8146                }
8147                let inner_offset;
8148                let mut inner_depth = depth.clone();
8149                if inlined {
8150                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8151                    inner_offset = next_offset;
8152                } else {
8153                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8154                    inner_depth.increment()?;
8155                }
8156                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8157                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8158                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8159                {
8160                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8161                }
8162                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8163                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8164                }
8165            }
8166
8167            next_offset += envelope_size;
8168            _next_ordinal_to_read += 1;
8169            if next_offset >= end_offset {
8170                return Ok(());
8171            }
8172
8173            // Decode unknown envelopes for gaps in ordinals.
8174            while _next_ordinal_to_read < 3 {
8175                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8176                _next_ordinal_to_read += 1;
8177                next_offset += envelope_size;
8178            }
8179
8180            let next_out_of_line = decoder.next_out_of_line();
8181            let handles_before = decoder.remaining_handles();
8182            if let Some((inlined, num_bytes, num_handles)) =
8183                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8184            {
8185                let member_inline_size =
8186                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8187                if inlined != (member_inline_size <= 4) {
8188                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8189                }
8190                let inner_offset;
8191                let mut inner_depth = depth.clone();
8192                if inlined {
8193                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8194                    inner_offset = next_offset;
8195                } else {
8196                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8197                    inner_depth.increment()?;
8198                }
8199                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8200                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8201                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8202                {
8203                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8204                }
8205                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8206                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8207                }
8208            }
8209
8210            next_offset += envelope_size;
8211            _next_ordinal_to_read += 1;
8212            if next_offset >= end_offset {
8213                return Ok(());
8214            }
8215
8216            // Decode unknown envelopes for gaps in ordinals.
8217            while _next_ordinal_to_read < 4 {
8218                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8219                _next_ordinal_to_read += 1;
8220                next_offset += envelope_size;
8221            }
8222
8223            let next_out_of_line = decoder.next_out_of_line();
8224            let handles_before = decoder.remaining_handles();
8225            if let Some((inlined, num_bytes, num_handles)) =
8226                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8227            {
8228                let member_inline_size =
8229                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8230                if inlined != (member_inline_size <= 4) {
8231                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8232                }
8233                let inner_offset;
8234                let mut inner_depth = depth.clone();
8235                if inlined {
8236                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8237                    inner_offset = next_offset;
8238                } else {
8239                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8240                    inner_depth.increment()?;
8241                }
8242                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8243                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8244                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8245                {
8246                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8247                }
8248                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8249                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8250                }
8251            }
8252
8253            next_offset += envelope_size;
8254            _next_ordinal_to_read += 1;
8255            if next_offset >= end_offset {
8256                return Ok(());
8257            }
8258
8259            // Decode unknown envelopes for gaps in ordinals.
8260            while _next_ordinal_to_read < 5 {
8261                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8262                _next_ordinal_to_read += 1;
8263                next_offset += envelope_size;
8264            }
8265
8266            let next_out_of_line = decoder.next_out_of_line();
8267            let handles_before = decoder.remaining_handles();
8268            if let Some((inlined, num_bytes, num_handles)) =
8269                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8270            {
8271                let member_inline_size =
8272                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8273                        decoder.context,
8274                    );
8275                if inlined != (member_inline_size <= 4) {
8276                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8277                }
8278                let inner_offset;
8279                let mut inner_depth = depth.clone();
8280                if inlined {
8281                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8282                    inner_offset = next_offset;
8283                } else {
8284                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8285                    inner_depth.increment()?;
8286                }
8287                let val_ref = self
8288                    .buttons
8289                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8290                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8291                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8292                {
8293                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8294                }
8295                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8296                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8297                }
8298            }
8299
8300            next_offset += envelope_size;
8301            _next_ordinal_to_read += 1;
8302            if next_offset >= end_offset {
8303                return Ok(());
8304            }
8305
8306            // Decode unknown envelopes for gaps in ordinals.
8307            while _next_ordinal_to_read < 6 {
8308                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8309                _next_ordinal_to_read += 1;
8310                next_offset += envelope_size;
8311            }
8312
8313            let next_out_of_line = decoder.next_out_of_line();
8314            let handles_before = decoder.remaining_handles();
8315            if let Some((inlined, num_bytes, num_handles)) =
8316                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8317            {
8318                let member_inline_size =
8319                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8320                if inlined != (member_inline_size <= 4) {
8321                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8322                }
8323                let inner_offset;
8324                let mut inner_depth = depth.clone();
8325                if inlined {
8326                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8327                    inner_offset = next_offset;
8328                } else {
8329                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8330                    inner_depth.increment()?;
8331                }
8332                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8333                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8334                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8335                {
8336                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8337                }
8338                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8339                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8340                }
8341            }
8342
8343            next_offset += envelope_size;
8344            _next_ordinal_to_read += 1;
8345            if next_offset >= end_offset {
8346                return Ok(());
8347            }
8348
8349            // Decode unknown envelopes for gaps in ordinals.
8350            while _next_ordinal_to_read < 7 {
8351                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8352                _next_ordinal_to_read += 1;
8353                next_offset += envelope_size;
8354            }
8355
8356            let next_out_of_line = decoder.next_out_of_line();
8357            let handles_before = decoder.remaining_handles();
8358            if let Some((inlined, num_bytes, num_handles)) =
8359                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8360            {
8361                let member_inline_size =
8362                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8363                if inlined != (member_inline_size <= 4) {
8364                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8365                }
8366                let inner_offset;
8367                let mut inner_depth = depth.clone();
8368                if inlined {
8369                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8370                    inner_offset = next_offset;
8371                } else {
8372                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8373                    inner_depth.increment()?;
8374                }
8375                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8376                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8377                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8378                {
8379                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8380                }
8381                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8382                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8383                }
8384            }
8385
8386            next_offset += envelope_size;
8387
8388            // Decode the remaining unknown envelopes.
8389            while next_offset < end_offset {
8390                _next_ordinal_to_read += 1;
8391                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8392                next_offset += envelope_size;
8393            }
8394
8395            Ok(())
8396        }
8397    }
8398
8399    impl MouseInputReport {
8400        #[inline(always)]
8401        fn max_ordinal_present(&self) -> u64 {
8402            if let Some(_) = self.position_y {
8403                return 7;
8404            }
8405            if let Some(_) = self.position_x {
8406                return 6;
8407            }
8408            if let Some(_) = self.pressed_buttons {
8409                return 5;
8410            }
8411            if let Some(_) = self.scroll_h {
8412                return 4;
8413            }
8414            if let Some(_) = self.scroll_v {
8415                return 3;
8416            }
8417            if let Some(_) = self.movement_y {
8418                return 2;
8419            }
8420            if let Some(_) = self.movement_x {
8421                return 1;
8422            }
8423            0
8424        }
8425    }
8426
8427    impl fidl::encoding::ValueTypeMarker for MouseInputReport {
8428        type Borrowed<'a> = &'a Self;
8429        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8430            value
8431        }
8432    }
8433
8434    unsafe impl fidl::encoding::TypeMarker for MouseInputReport {
8435        type Owned = Self;
8436
8437        #[inline(always)]
8438        fn inline_align(_context: fidl::encoding::Context) -> usize {
8439            8
8440        }
8441
8442        #[inline(always)]
8443        fn inline_size(_context: fidl::encoding::Context) -> usize {
8444            16
8445        }
8446    }
8447
8448    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputReport, D>
8449        for &MouseInputReport
8450    {
8451        unsafe fn encode(
8452            self,
8453            encoder: &mut fidl::encoding::Encoder<'_, D>,
8454            offset: usize,
8455            mut depth: fidl::encoding::Depth,
8456        ) -> fidl::Result<()> {
8457            encoder.debug_check_bounds::<MouseInputReport>(offset);
8458            // Vector header
8459            let max_ordinal: u64 = self.max_ordinal_present();
8460            encoder.write_num(max_ordinal, offset);
8461            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8462            // Calling encoder.out_of_line_offset(0) is not allowed.
8463            if max_ordinal == 0 {
8464                return Ok(());
8465            }
8466            depth.increment()?;
8467            let envelope_size = 8;
8468            let bytes_len = max_ordinal as usize * envelope_size;
8469            #[allow(unused_variables)]
8470            let offset = encoder.out_of_line_offset(bytes_len);
8471            let mut _prev_end_offset: usize = 0;
8472            if 1 > max_ordinal {
8473                return Ok(());
8474            }
8475
8476            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8477            // are envelope_size bytes.
8478            let cur_offset: usize = (1 - 1) * envelope_size;
8479
8480            // Zero reserved fields.
8481            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8482
8483            // Safety:
8484            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8485            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8486            //   envelope_size bytes, there is always sufficient room.
8487            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8488                self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8489                encoder,
8490                offset + cur_offset,
8491                depth,
8492            )?;
8493
8494            _prev_end_offset = cur_offset + envelope_size;
8495            if 2 > max_ordinal {
8496                return Ok(());
8497            }
8498
8499            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8500            // are envelope_size bytes.
8501            let cur_offset: usize = (2 - 1) * envelope_size;
8502
8503            // Zero reserved fields.
8504            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8505
8506            // Safety:
8507            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8508            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8509            //   envelope_size bytes, there is always sufficient room.
8510            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8511                self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8512                encoder,
8513                offset + cur_offset,
8514                depth,
8515            )?;
8516
8517            _prev_end_offset = cur_offset + envelope_size;
8518            if 3 > max_ordinal {
8519                return Ok(());
8520            }
8521
8522            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8523            // are envelope_size bytes.
8524            let cur_offset: usize = (3 - 1) * envelope_size;
8525
8526            // Zero reserved fields.
8527            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8528
8529            // Safety:
8530            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8531            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8532            //   envelope_size bytes, there is always sufficient room.
8533            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8534                self.scroll_v.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8535                encoder,
8536                offset + cur_offset,
8537                depth,
8538            )?;
8539
8540            _prev_end_offset = cur_offset + envelope_size;
8541            if 4 > max_ordinal {
8542                return Ok(());
8543            }
8544
8545            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8546            // are envelope_size bytes.
8547            let cur_offset: usize = (4 - 1) * envelope_size;
8548
8549            // Zero reserved fields.
8550            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8551
8552            // Safety:
8553            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8554            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8555            //   envelope_size bytes, there is always sufficient room.
8556            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8557                self.scroll_h.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8558                encoder,
8559                offset + cur_offset,
8560                depth,
8561            )?;
8562
8563            _prev_end_offset = cur_offset + envelope_size;
8564            if 5 > max_ordinal {
8565                return Ok(());
8566            }
8567
8568            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8569            // are envelope_size bytes.
8570            let cur_offset: usize = (5 - 1) * envelope_size;
8571
8572            // Zero reserved fields.
8573            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8574
8575            // Safety:
8576            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8577            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8578            //   envelope_size bytes, there is always sufficient room.
8579            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
8580                self.pressed_buttons.as_ref().map(
8581                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
8582                ),
8583                encoder,
8584                offset + cur_offset,
8585                depth,
8586            )?;
8587
8588            _prev_end_offset = cur_offset + envelope_size;
8589            if 6 > max_ordinal {
8590                return Ok(());
8591            }
8592
8593            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8594            // are envelope_size bytes.
8595            let cur_offset: usize = (6 - 1) * envelope_size;
8596
8597            // Zero reserved fields.
8598            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8599
8600            // Safety:
8601            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8602            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8603            //   envelope_size bytes, there is always sufficient room.
8604            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8605                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8606                encoder,
8607                offset + cur_offset,
8608                depth,
8609            )?;
8610
8611            _prev_end_offset = cur_offset + envelope_size;
8612            if 7 > max_ordinal {
8613                return Ok(());
8614            }
8615
8616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8617            // are envelope_size bytes.
8618            let cur_offset: usize = (7 - 1) * envelope_size;
8619
8620            // Zero reserved fields.
8621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8622
8623            // Safety:
8624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8626            //   envelope_size bytes, there is always sufficient room.
8627            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8628                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8629                encoder,
8630                offset + cur_offset,
8631                depth,
8632            )?;
8633
8634            _prev_end_offset = cur_offset + envelope_size;
8635
8636            Ok(())
8637        }
8638    }
8639
8640    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputReport {
8641        #[inline(always)]
8642        fn new_empty() -> Self {
8643            Self::default()
8644        }
8645
8646        unsafe fn decode(
8647            &mut self,
8648            decoder: &mut fidl::encoding::Decoder<'_, D>,
8649            offset: usize,
8650            mut depth: fidl::encoding::Depth,
8651        ) -> fidl::Result<()> {
8652            decoder.debug_check_bounds::<Self>(offset);
8653            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8654                None => return Err(fidl::Error::NotNullable),
8655                Some(len) => len,
8656            };
8657            // Calling decoder.out_of_line_offset(0) is not allowed.
8658            if len == 0 {
8659                return Ok(());
8660            };
8661            depth.increment()?;
8662            let envelope_size = 8;
8663            let bytes_len = len * envelope_size;
8664            let offset = decoder.out_of_line_offset(bytes_len)?;
8665            // Decode the envelope for each type.
8666            let mut _next_ordinal_to_read = 0;
8667            let mut next_offset = offset;
8668            let end_offset = offset + bytes_len;
8669            _next_ordinal_to_read += 1;
8670            if next_offset >= end_offset {
8671                return Ok(());
8672            }
8673
8674            // Decode unknown envelopes for gaps in ordinals.
8675            while _next_ordinal_to_read < 1 {
8676                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8677                _next_ordinal_to_read += 1;
8678                next_offset += envelope_size;
8679            }
8680
8681            let next_out_of_line = decoder.next_out_of_line();
8682            let handles_before = decoder.remaining_handles();
8683            if let Some((inlined, num_bytes, num_handles)) =
8684                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8685            {
8686                let member_inline_size =
8687                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8688                if inlined != (member_inline_size <= 4) {
8689                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8690                }
8691                let inner_offset;
8692                let mut inner_depth = depth.clone();
8693                if inlined {
8694                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8695                    inner_offset = next_offset;
8696                } else {
8697                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8698                    inner_depth.increment()?;
8699                }
8700                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8701                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8702                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8703                {
8704                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8705                }
8706                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8707                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8708                }
8709            }
8710
8711            next_offset += envelope_size;
8712            _next_ordinal_to_read += 1;
8713            if next_offset >= end_offset {
8714                return Ok(());
8715            }
8716
8717            // Decode unknown envelopes for gaps in ordinals.
8718            while _next_ordinal_to_read < 2 {
8719                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8720                _next_ordinal_to_read += 1;
8721                next_offset += envelope_size;
8722            }
8723
8724            let next_out_of_line = decoder.next_out_of_line();
8725            let handles_before = decoder.remaining_handles();
8726            if let Some((inlined, num_bytes, num_handles)) =
8727                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8728            {
8729                let member_inline_size =
8730                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8731                if inlined != (member_inline_size <= 4) {
8732                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8733                }
8734                let inner_offset;
8735                let mut inner_depth = depth.clone();
8736                if inlined {
8737                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8738                    inner_offset = next_offset;
8739                } else {
8740                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8741                    inner_depth.increment()?;
8742                }
8743                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8744                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8745                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8746                {
8747                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8748                }
8749                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8750                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8751                }
8752            }
8753
8754            next_offset += envelope_size;
8755            _next_ordinal_to_read += 1;
8756            if next_offset >= end_offset {
8757                return Ok(());
8758            }
8759
8760            // Decode unknown envelopes for gaps in ordinals.
8761            while _next_ordinal_to_read < 3 {
8762                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8763                _next_ordinal_to_read += 1;
8764                next_offset += envelope_size;
8765            }
8766
8767            let next_out_of_line = decoder.next_out_of_line();
8768            let handles_before = decoder.remaining_handles();
8769            if let Some((inlined, num_bytes, num_handles)) =
8770                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8771            {
8772                let member_inline_size =
8773                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8774                if inlined != (member_inline_size <= 4) {
8775                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8776                }
8777                let inner_offset;
8778                let mut inner_depth = depth.clone();
8779                if inlined {
8780                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8781                    inner_offset = next_offset;
8782                } else {
8783                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8784                    inner_depth.increment()?;
8785                }
8786                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(i64, D));
8787                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8788                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8789                {
8790                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8791                }
8792                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8793                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8794                }
8795            }
8796
8797            next_offset += envelope_size;
8798            _next_ordinal_to_read += 1;
8799            if next_offset >= end_offset {
8800                return Ok(());
8801            }
8802
8803            // Decode unknown envelopes for gaps in ordinals.
8804            while _next_ordinal_to_read < 4 {
8805                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8806                _next_ordinal_to_read += 1;
8807                next_offset += envelope_size;
8808            }
8809
8810            let next_out_of_line = decoder.next_out_of_line();
8811            let handles_before = decoder.remaining_handles();
8812            if let Some((inlined, num_bytes, num_handles)) =
8813                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8814            {
8815                let member_inline_size =
8816                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8817                if inlined != (member_inline_size <= 4) {
8818                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8819                }
8820                let inner_offset;
8821                let mut inner_depth = depth.clone();
8822                if inlined {
8823                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8824                    inner_offset = next_offset;
8825                } else {
8826                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8827                    inner_depth.increment()?;
8828                }
8829                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(i64, D));
8830                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8831                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8832                {
8833                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8834                }
8835                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8836                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8837                }
8838            }
8839
8840            next_offset += envelope_size;
8841            _next_ordinal_to_read += 1;
8842            if next_offset >= end_offset {
8843                return Ok(());
8844            }
8845
8846            // Decode unknown envelopes for gaps in ordinals.
8847            while _next_ordinal_to_read < 5 {
8848                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8849                _next_ordinal_to_read += 1;
8850                next_offset += envelope_size;
8851            }
8852
8853            let next_out_of_line = decoder.next_out_of_line();
8854            let handles_before = decoder.remaining_handles();
8855            if let Some((inlined, num_bytes, num_handles)) =
8856                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8857            {
8858                let member_inline_size =
8859                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8860                        decoder.context,
8861                    );
8862                if inlined != (member_inline_size <= 4) {
8863                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8864                }
8865                let inner_offset;
8866                let mut inner_depth = depth.clone();
8867                if inlined {
8868                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8869                    inner_offset = next_offset;
8870                } else {
8871                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8872                    inner_depth.increment()?;
8873                }
8874                let val_ref = self
8875                    .pressed_buttons
8876                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8877                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8878                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8879                {
8880                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8881                }
8882                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8883                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8884                }
8885            }
8886
8887            next_offset += envelope_size;
8888            _next_ordinal_to_read += 1;
8889            if next_offset >= end_offset {
8890                return Ok(());
8891            }
8892
8893            // Decode unknown envelopes for gaps in ordinals.
8894            while _next_ordinal_to_read < 6 {
8895                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8896                _next_ordinal_to_read += 1;
8897                next_offset += envelope_size;
8898            }
8899
8900            let next_out_of_line = decoder.next_out_of_line();
8901            let handles_before = decoder.remaining_handles();
8902            if let Some((inlined, num_bytes, num_handles)) =
8903                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8904            {
8905                let member_inline_size =
8906                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8907                if inlined != (member_inline_size <= 4) {
8908                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8909                }
8910                let inner_offset;
8911                let mut inner_depth = depth.clone();
8912                if inlined {
8913                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8914                    inner_offset = next_offset;
8915                } else {
8916                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8917                    inner_depth.increment()?;
8918                }
8919                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8920                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8921                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8922                {
8923                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8924                }
8925                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8926                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8927                }
8928            }
8929
8930            next_offset += envelope_size;
8931            _next_ordinal_to_read += 1;
8932            if next_offset >= end_offset {
8933                return Ok(());
8934            }
8935
8936            // Decode unknown envelopes for gaps in ordinals.
8937            while _next_ordinal_to_read < 7 {
8938                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8939                _next_ordinal_to_read += 1;
8940                next_offset += envelope_size;
8941            }
8942
8943            let next_out_of_line = decoder.next_out_of_line();
8944            let handles_before = decoder.remaining_handles();
8945            if let Some((inlined, num_bytes, num_handles)) =
8946                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8947            {
8948                let member_inline_size =
8949                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8950                if inlined != (member_inline_size <= 4) {
8951                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8952                }
8953                let inner_offset;
8954                let mut inner_depth = depth.clone();
8955                if inlined {
8956                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8957                    inner_offset = next_offset;
8958                } else {
8959                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8960                    inner_depth.increment()?;
8961                }
8962                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8963                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8964                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8965                {
8966                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8967                }
8968                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8969                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8970                }
8971            }
8972
8973            next_offset += envelope_size;
8974
8975            // Decode the remaining unknown envelopes.
8976            while next_offset < end_offset {
8977                _next_ordinal_to_read += 1;
8978                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8979                next_offset += envelope_size;
8980            }
8981
8982            Ok(())
8983        }
8984    }
8985
8986    impl OutputDescriptor {
8987        #[inline(always)]
8988        fn max_ordinal_present(&self) -> u64 {
8989            if let Some(_) = self.keyboard {
8990                return 1;
8991            }
8992            0
8993        }
8994    }
8995
8996    impl fidl::encoding::ValueTypeMarker for OutputDescriptor {
8997        type Borrowed<'a> = &'a Self;
8998        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8999            value
9000        }
9001    }
9002
9003    unsafe impl fidl::encoding::TypeMarker for OutputDescriptor {
9004        type Owned = Self;
9005
9006        #[inline(always)]
9007        fn inline_align(_context: fidl::encoding::Context) -> usize {
9008            8
9009        }
9010
9011        #[inline(always)]
9012        fn inline_size(_context: fidl::encoding::Context) -> usize {
9013            16
9014        }
9015    }
9016
9017    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputDescriptor, D>
9018        for &OutputDescriptor
9019    {
9020        unsafe fn encode(
9021            self,
9022            encoder: &mut fidl::encoding::Encoder<'_, D>,
9023            offset: usize,
9024            mut depth: fidl::encoding::Depth,
9025        ) -> fidl::Result<()> {
9026            encoder.debug_check_bounds::<OutputDescriptor>(offset);
9027            // Vector header
9028            let max_ordinal: u64 = self.max_ordinal_present();
9029            encoder.write_num(max_ordinal, offset);
9030            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9031            // Calling encoder.out_of_line_offset(0) is not allowed.
9032            if max_ordinal == 0 {
9033                return Ok(());
9034            }
9035            depth.increment()?;
9036            let envelope_size = 8;
9037            let bytes_len = max_ordinal as usize * envelope_size;
9038            #[allow(unused_variables)]
9039            let offset = encoder.out_of_line_offset(bytes_len);
9040            let mut _prev_end_offset: usize = 0;
9041            if 1 > max_ordinal {
9042                return Ok(());
9043            }
9044
9045            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9046            // are envelope_size bytes.
9047            let cur_offset: usize = (1 - 1) * envelope_size;
9048
9049            // Zero reserved fields.
9050            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9051
9052            // Safety:
9053            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9054            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9055            //   envelope_size bytes, there is always sufficient room.
9056            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
9057                self.keyboard
9058                    .as_ref()
9059                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
9060                encoder,
9061                offset + cur_offset,
9062                depth,
9063            )?;
9064
9065            _prev_end_offset = cur_offset + envelope_size;
9066
9067            Ok(())
9068        }
9069    }
9070
9071    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputDescriptor {
9072        #[inline(always)]
9073        fn new_empty() -> Self {
9074            Self::default()
9075        }
9076
9077        unsafe fn decode(
9078            &mut self,
9079            decoder: &mut fidl::encoding::Decoder<'_, D>,
9080            offset: usize,
9081            mut depth: fidl::encoding::Depth,
9082        ) -> fidl::Result<()> {
9083            decoder.debug_check_bounds::<Self>(offset);
9084            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9085                None => return Err(fidl::Error::NotNullable),
9086                Some(len) => len,
9087            };
9088            // Calling decoder.out_of_line_offset(0) is not allowed.
9089            if len == 0 {
9090                return Ok(());
9091            };
9092            depth.increment()?;
9093            let envelope_size = 8;
9094            let bytes_len = len * envelope_size;
9095            let offset = decoder.out_of_line_offset(bytes_len)?;
9096            // Decode the envelope for each type.
9097            let mut _next_ordinal_to_read = 0;
9098            let mut next_offset = offset;
9099            let end_offset = offset + bytes_len;
9100            _next_ordinal_to_read += 1;
9101            if next_offset >= end_offset {
9102                return Ok(());
9103            }
9104
9105            // Decode unknown envelopes for gaps in ordinals.
9106            while _next_ordinal_to_read < 1 {
9107                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9108                _next_ordinal_to_read += 1;
9109                next_offset += envelope_size;
9110            }
9111
9112            let next_out_of_line = decoder.next_out_of_line();
9113            let handles_before = decoder.remaining_handles();
9114            if let Some((inlined, num_bytes, num_handles)) =
9115                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9116            {
9117                let member_inline_size =
9118                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
9119                        decoder.context,
9120                    );
9121                if inlined != (member_inline_size <= 4) {
9122                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9123                }
9124                let inner_offset;
9125                let mut inner_depth = depth.clone();
9126                if inlined {
9127                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9128                    inner_offset = next_offset;
9129                } else {
9130                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9131                    inner_depth.increment()?;
9132                }
9133                let val_ref = self
9134                    .keyboard
9135                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
9136                fidl::decode!(
9137                    KeyboardOutputDescriptor,
9138                    D,
9139                    val_ref,
9140                    decoder,
9141                    inner_offset,
9142                    inner_depth
9143                )?;
9144                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9145                {
9146                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9147                }
9148                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9149                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9150                }
9151            }
9152
9153            next_offset += envelope_size;
9154
9155            // Decode the remaining unknown envelopes.
9156            while next_offset < end_offset {
9157                _next_ordinal_to_read += 1;
9158                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9159                next_offset += envelope_size;
9160            }
9161
9162            Ok(())
9163        }
9164    }
9165
9166    impl OutputReport {
9167        #[inline(always)]
9168        fn max_ordinal_present(&self) -> u64 {
9169            if let Some(_) = self.keyboard {
9170                return 1;
9171            }
9172            0
9173        }
9174    }
9175
9176    impl fidl::encoding::ValueTypeMarker for OutputReport {
9177        type Borrowed<'a> = &'a Self;
9178        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9179            value
9180        }
9181    }
9182
9183    unsafe impl fidl::encoding::TypeMarker for OutputReport {
9184        type Owned = Self;
9185
9186        #[inline(always)]
9187        fn inline_align(_context: fidl::encoding::Context) -> usize {
9188            8
9189        }
9190
9191        #[inline(always)]
9192        fn inline_size(_context: fidl::encoding::Context) -> usize {
9193            16
9194        }
9195    }
9196
9197    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputReport, D>
9198        for &OutputReport
9199    {
9200        unsafe fn encode(
9201            self,
9202            encoder: &mut fidl::encoding::Encoder<'_, D>,
9203            offset: usize,
9204            mut depth: fidl::encoding::Depth,
9205        ) -> fidl::Result<()> {
9206            encoder.debug_check_bounds::<OutputReport>(offset);
9207            // Vector header
9208            let max_ordinal: u64 = self.max_ordinal_present();
9209            encoder.write_num(max_ordinal, offset);
9210            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9211            // Calling encoder.out_of_line_offset(0) is not allowed.
9212            if max_ordinal == 0 {
9213                return Ok(());
9214            }
9215            depth.increment()?;
9216            let envelope_size = 8;
9217            let bytes_len = max_ordinal as usize * envelope_size;
9218            #[allow(unused_variables)]
9219            let offset = encoder.out_of_line_offset(bytes_len);
9220            let mut _prev_end_offset: usize = 0;
9221            if 1 > max_ordinal {
9222                return Ok(());
9223            }
9224
9225            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9226            // are envelope_size bytes.
9227            let cur_offset: usize = (1 - 1) * envelope_size;
9228
9229            // Zero reserved fields.
9230            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9231
9232            // Safety:
9233            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9234            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9235            //   envelope_size bytes, there is always sufficient room.
9236            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputReport, D>(
9237                self.keyboard
9238                    .as_ref()
9239                    .map(<KeyboardOutputReport as fidl::encoding::ValueTypeMarker>::borrow),
9240                encoder,
9241                offset + cur_offset,
9242                depth,
9243            )?;
9244
9245            _prev_end_offset = cur_offset + envelope_size;
9246
9247            Ok(())
9248        }
9249    }
9250
9251    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputReport {
9252        #[inline(always)]
9253        fn new_empty() -> Self {
9254            Self::default()
9255        }
9256
9257        unsafe fn decode(
9258            &mut self,
9259            decoder: &mut fidl::encoding::Decoder<'_, D>,
9260            offset: usize,
9261            mut depth: fidl::encoding::Depth,
9262        ) -> fidl::Result<()> {
9263            decoder.debug_check_bounds::<Self>(offset);
9264            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9265                None => return Err(fidl::Error::NotNullable),
9266                Some(len) => len,
9267            };
9268            // Calling decoder.out_of_line_offset(0) is not allowed.
9269            if len == 0 {
9270                return Ok(());
9271            };
9272            depth.increment()?;
9273            let envelope_size = 8;
9274            let bytes_len = len * envelope_size;
9275            let offset = decoder.out_of_line_offset(bytes_len)?;
9276            // Decode the envelope for each type.
9277            let mut _next_ordinal_to_read = 0;
9278            let mut next_offset = offset;
9279            let end_offset = offset + bytes_len;
9280            _next_ordinal_to_read += 1;
9281            if next_offset >= end_offset {
9282                return Ok(());
9283            }
9284
9285            // Decode unknown envelopes for gaps in ordinals.
9286            while _next_ordinal_to_read < 1 {
9287                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9288                _next_ordinal_to_read += 1;
9289                next_offset += envelope_size;
9290            }
9291
9292            let next_out_of_line = decoder.next_out_of_line();
9293            let handles_before = decoder.remaining_handles();
9294            if let Some((inlined, num_bytes, num_handles)) =
9295                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9296            {
9297                let member_inline_size =
9298                    <KeyboardOutputReport as fidl::encoding::TypeMarker>::inline_size(
9299                        decoder.context,
9300                    );
9301                if inlined != (member_inline_size <= 4) {
9302                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9303                }
9304                let inner_offset;
9305                let mut inner_depth = depth.clone();
9306                if inlined {
9307                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9308                    inner_offset = next_offset;
9309                } else {
9310                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9311                    inner_depth.increment()?;
9312                }
9313                let val_ref =
9314                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardOutputReport, D));
9315                fidl::decode!(
9316                    KeyboardOutputReport,
9317                    D,
9318                    val_ref,
9319                    decoder,
9320                    inner_offset,
9321                    inner_depth
9322                )?;
9323                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9324                {
9325                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9326                }
9327                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9328                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9329                }
9330            }
9331
9332            next_offset += envelope_size;
9333
9334            // Decode the remaining unknown envelopes.
9335            while next_offset < end_offset {
9336                _next_ordinal_to_read += 1;
9337                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9338                next_offset += envelope_size;
9339            }
9340
9341            Ok(())
9342        }
9343    }
9344
9345    impl SelectiveReportingFeatureReport {
9346        #[inline(always)]
9347        fn max_ordinal_present(&self) -> u64 {
9348            if let Some(_) = self.button_switch {
9349                return 2;
9350            }
9351            if let Some(_) = self.surface_switch {
9352                return 1;
9353            }
9354            0
9355        }
9356    }
9357
9358    impl fidl::encoding::ValueTypeMarker for SelectiveReportingFeatureReport {
9359        type Borrowed<'a> = &'a Self;
9360        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9361            value
9362        }
9363    }
9364
9365    unsafe impl fidl::encoding::TypeMarker for SelectiveReportingFeatureReport {
9366        type Owned = Self;
9367
9368        #[inline(always)]
9369        fn inline_align(_context: fidl::encoding::Context) -> usize {
9370            8
9371        }
9372
9373        #[inline(always)]
9374        fn inline_size(_context: fidl::encoding::Context) -> usize {
9375            16
9376        }
9377    }
9378
9379    unsafe impl<D: fidl::encoding::ResourceDialect>
9380        fidl::encoding::Encode<SelectiveReportingFeatureReport, D>
9381        for &SelectiveReportingFeatureReport
9382    {
9383        unsafe fn encode(
9384            self,
9385            encoder: &mut fidl::encoding::Encoder<'_, D>,
9386            offset: usize,
9387            mut depth: fidl::encoding::Depth,
9388        ) -> fidl::Result<()> {
9389            encoder.debug_check_bounds::<SelectiveReportingFeatureReport>(offset);
9390            // Vector header
9391            let max_ordinal: u64 = self.max_ordinal_present();
9392            encoder.write_num(max_ordinal, offset);
9393            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9394            // Calling encoder.out_of_line_offset(0) is not allowed.
9395            if max_ordinal == 0 {
9396                return Ok(());
9397            }
9398            depth.increment()?;
9399            let envelope_size = 8;
9400            let bytes_len = max_ordinal as usize * envelope_size;
9401            #[allow(unused_variables)]
9402            let offset = encoder.out_of_line_offset(bytes_len);
9403            let mut _prev_end_offset: usize = 0;
9404            if 1 > max_ordinal {
9405                return Ok(());
9406            }
9407
9408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9409            // are envelope_size bytes.
9410            let cur_offset: usize = (1 - 1) * envelope_size;
9411
9412            // Zero reserved fields.
9413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9414
9415            // Safety:
9416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9418            //   envelope_size bytes, there is always sufficient room.
9419            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9420                self.surface_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9421                encoder,
9422                offset + cur_offset,
9423                depth,
9424            )?;
9425
9426            _prev_end_offset = cur_offset + envelope_size;
9427            if 2 > max_ordinal {
9428                return Ok(());
9429            }
9430
9431            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9432            // are envelope_size bytes.
9433            let cur_offset: usize = (2 - 1) * envelope_size;
9434
9435            // Zero reserved fields.
9436            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9437
9438            // Safety:
9439            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9440            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9441            //   envelope_size bytes, there is always sufficient room.
9442            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9443                self.button_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9444                encoder,
9445                offset + cur_offset,
9446                depth,
9447            )?;
9448
9449            _prev_end_offset = cur_offset + envelope_size;
9450
9451            Ok(())
9452        }
9453    }
9454
9455    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9456        for SelectiveReportingFeatureReport
9457    {
9458        #[inline(always)]
9459        fn new_empty() -> Self {
9460            Self::default()
9461        }
9462
9463        unsafe fn decode(
9464            &mut self,
9465            decoder: &mut fidl::encoding::Decoder<'_, D>,
9466            offset: usize,
9467            mut depth: fidl::encoding::Depth,
9468        ) -> fidl::Result<()> {
9469            decoder.debug_check_bounds::<Self>(offset);
9470            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9471                None => return Err(fidl::Error::NotNullable),
9472                Some(len) => len,
9473            };
9474            // Calling decoder.out_of_line_offset(0) is not allowed.
9475            if len == 0 {
9476                return Ok(());
9477            };
9478            depth.increment()?;
9479            let envelope_size = 8;
9480            let bytes_len = len * envelope_size;
9481            let offset = decoder.out_of_line_offset(bytes_len)?;
9482            // Decode the envelope for each type.
9483            let mut _next_ordinal_to_read = 0;
9484            let mut next_offset = offset;
9485            let end_offset = offset + bytes_len;
9486            _next_ordinal_to_read += 1;
9487            if next_offset >= end_offset {
9488                return Ok(());
9489            }
9490
9491            // Decode unknown envelopes for gaps in ordinals.
9492            while _next_ordinal_to_read < 1 {
9493                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9494                _next_ordinal_to_read += 1;
9495                next_offset += envelope_size;
9496            }
9497
9498            let next_out_of_line = decoder.next_out_of_line();
9499            let handles_before = decoder.remaining_handles();
9500            if let Some((inlined, num_bytes, num_handles)) =
9501                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9502            {
9503                let member_inline_size =
9504                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9505                if inlined != (member_inline_size <= 4) {
9506                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9507                }
9508                let inner_offset;
9509                let mut inner_depth = depth.clone();
9510                if inlined {
9511                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9512                    inner_offset = next_offset;
9513                } else {
9514                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9515                    inner_depth.increment()?;
9516                }
9517                let val_ref = self.surface_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9518                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9519                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9520                {
9521                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9522                }
9523                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9524                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9525                }
9526            }
9527
9528            next_offset += envelope_size;
9529            _next_ordinal_to_read += 1;
9530            if next_offset >= end_offset {
9531                return Ok(());
9532            }
9533
9534            // Decode unknown envelopes for gaps in ordinals.
9535            while _next_ordinal_to_read < 2 {
9536                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9537                _next_ordinal_to_read += 1;
9538                next_offset += envelope_size;
9539            }
9540
9541            let next_out_of_line = decoder.next_out_of_line();
9542            let handles_before = decoder.remaining_handles();
9543            if let Some((inlined, num_bytes, num_handles)) =
9544                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9545            {
9546                let member_inline_size =
9547                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9548                if inlined != (member_inline_size <= 4) {
9549                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9550                }
9551                let inner_offset;
9552                let mut inner_depth = depth.clone();
9553                if inlined {
9554                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9555                    inner_offset = next_offset;
9556                } else {
9557                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9558                    inner_depth.increment()?;
9559                }
9560                let val_ref = self.button_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9561                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9562                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9563                {
9564                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9565                }
9566                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9567                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9568                }
9569            }
9570
9571            next_offset += envelope_size;
9572
9573            // Decode the remaining unknown envelopes.
9574            while next_offset < end_offset {
9575                _next_ordinal_to_read += 1;
9576                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9577                next_offset += envelope_size;
9578            }
9579
9580            Ok(())
9581        }
9582    }
9583
9584    impl SensorDescriptor {
9585        #[inline(always)]
9586        fn max_ordinal_present(&self) -> u64 {
9587            if let Some(_) = self.feature {
9588                return 2;
9589            }
9590            if let Some(_) = self.input {
9591                return 1;
9592            }
9593            0
9594        }
9595    }
9596
9597    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
9598        type Borrowed<'a> = &'a Self;
9599        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9600            value
9601        }
9602    }
9603
9604    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
9605        type Owned = Self;
9606
9607        #[inline(always)]
9608        fn inline_align(_context: fidl::encoding::Context) -> usize {
9609            8
9610        }
9611
9612        #[inline(always)]
9613        fn inline_size(_context: fidl::encoding::Context) -> usize {
9614            16
9615        }
9616    }
9617
9618    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
9619        for &SensorDescriptor
9620    {
9621        unsafe fn encode(
9622            self,
9623            encoder: &mut fidl::encoding::Encoder<'_, D>,
9624            offset: usize,
9625            mut depth: fidl::encoding::Depth,
9626        ) -> fidl::Result<()> {
9627            encoder.debug_check_bounds::<SensorDescriptor>(offset);
9628            // Vector header
9629            let max_ordinal: u64 = self.max_ordinal_present();
9630            encoder.write_num(max_ordinal, offset);
9631            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9632            // Calling encoder.out_of_line_offset(0) is not allowed.
9633            if max_ordinal == 0 {
9634                return Ok(());
9635            }
9636            depth.increment()?;
9637            let envelope_size = 8;
9638            let bytes_len = max_ordinal as usize * envelope_size;
9639            #[allow(unused_variables)]
9640            let offset = encoder.out_of_line_offset(bytes_len);
9641            let mut _prev_end_offset: usize = 0;
9642            if 1 > max_ordinal {
9643                return Ok(());
9644            }
9645
9646            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9647            // are envelope_size bytes.
9648            let cur_offset: usize = (1 - 1) * envelope_size;
9649
9650            // Zero reserved fields.
9651            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9652
9653            // Safety:
9654            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9655            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9656            //   envelope_size bytes, there is always sufficient room.
9657            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorInputDescriptor, 255>, D>(
9658            self.input.as_ref().map(<fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9659            encoder, offset + cur_offset, depth
9660        )?;
9661
9662            _prev_end_offset = cur_offset + envelope_size;
9663            if 2 > max_ordinal {
9664                return Ok(());
9665            }
9666
9667            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9668            // are envelope_size bytes.
9669            let cur_offset: usize = (2 - 1) * envelope_size;
9670
9671            // Zero reserved fields.
9672            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9673
9674            // Safety:
9675            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9676            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9677            //   envelope_size bytes, there is always sufficient room.
9678            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D>(
9679            self.feature.as_ref().map(<fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9680            encoder, offset + cur_offset, depth
9681        )?;
9682
9683            _prev_end_offset = cur_offset + envelope_size;
9684
9685            Ok(())
9686        }
9687    }
9688
9689    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
9690        #[inline(always)]
9691        fn new_empty() -> Self {
9692            Self::default()
9693        }
9694
9695        unsafe fn decode(
9696            &mut self,
9697            decoder: &mut fidl::encoding::Decoder<'_, D>,
9698            offset: usize,
9699            mut depth: fidl::encoding::Depth,
9700        ) -> fidl::Result<()> {
9701            decoder.debug_check_bounds::<Self>(offset);
9702            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9703                None => return Err(fidl::Error::NotNullable),
9704                Some(len) => len,
9705            };
9706            // Calling decoder.out_of_line_offset(0) is not allowed.
9707            if len == 0 {
9708                return Ok(());
9709            };
9710            depth.increment()?;
9711            let envelope_size = 8;
9712            let bytes_len = len * envelope_size;
9713            let offset = decoder.out_of_line_offset(bytes_len)?;
9714            // Decode the envelope for each type.
9715            let mut _next_ordinal_to_read = 0;
9716            let mut next_offset = offset;
9717            let end_offset = offset + bytes_len;
9718            _next_ordinal_to_read += 1;
9719            if next_offset >= end_offset {
9720                return Ok(());
9721            }
9722
9723            // Decode unknown envelopes for gaps in ordinals.
9724            while _next_ordinal_to_read < 1 {
9725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9726                _next_ordinal_to_read += 1;
9727                next_offset += envelope_size;
9728            }
9729
9730            let next_out_of_line = decoder.next_out_of_line();
9731            let handles_before = decoder.remaining_handles();
9732            if let Some((inlined, num_bytes, num_handles)) =
9733                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9734            {
9735                let member_inline_size = <fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9736                if inlined != (member_inline_size <= 4) {
9737                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9738                }
9739                let inner_offset;
9740                let mut inner_depth = depth.clone();
9741                if inlined {
9742                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9743                    inner_offset = next_offset;
9744                } else {
9745                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9746                    inner_depth.increment()?;
9747                }
9748                let val_ref = self.input.get_or_insert_with(
9749                    || fidl::new_empty!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D),
9750                );
9751                fidl::decode!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9752                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9753                {
9754                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9755                }
9756                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9757                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9758                }
9759            }
9760
9761            next_offset += envelope_size;
9762            _next_ordinal_to_read += 1;
9763            if next_offset >= end_offset {
9764                return Ok(());
9765            }
9766
9767            // Decode unknown envelopes for gaps in ordinals.
9768            while _next_ordinal_to_read < 2 {
9769                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9770                _next_ordinal_to_read += 1;
9771                next_offset += envelope_size;
9772            }
9773
9774            let next_out_of_line = decoder.next_out_of_line();
9775            let handles_before = decoder.remaining_handles();
9776            if let Some((inlined, num_bytes, num_handles)) =
9777                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9778            {
9779                let member_inline_size = <fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9780                if inlined != (member_inline_size <= 4) {
9781                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9782                }
9783                let inner_offset;
9784                let mut inner_depth = depth.clone();
9785                if inlined {
9786                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9787                    inner_offset = next_offset;
9788                } else {
9789                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9790                    inner_depth.increment()?;
9791                }
9792                let val_ref = self.feature.get_or_insert_with(
9793                    || fidl::new_empty!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D),
9794                );
9795                fidl::decode!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9796                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9797                {
9798                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9799                }
9800                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9801                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9802                }
9803            }
9804
9805            next_offset += envelope_size;
9806
9807            // Decode the remaining unknown envelopes.
9808            while next_offset < end_offset {
9809                _next_ordinal_to_read += 1;
9810                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9811                next_offset += envelope_size;
9812            }
9813
9814            Ok(())
9815        }
9816    }
9817
9818    impl SensorFeatureDescriptor {
9819        #[inline(always)]
9820        fn max_ordinal_present(&self) -> u64 {
9821            if let Some(_) = self.report_id {
9822                return 7;
9823            }
9824            if let Some(_) = self.sampling_rate {
9825                return 6;
9826            }
9827            if let Some(_) = self.threshold_low {
9828                return 5;
9829            }
9830            if let Some(_) = self.threshold_high {
9831                return 4;
9832            }
9833            if let Some(_) = self.supports_reporting_state {
9834                return 3;
9835            }
9836            if let Some(_) = self.sensitivity {
9837                return 2;
9838            }
9839            if let Some(_) = self.report_interval {
9840                return 1;
9841            }
9842            0
9843        }
9844    }
9845
9846    impl fidl::encoding::ValueTypeMarker for SensorFeatureDescriptor {
9847        type Borrowed<'a> = &'a Self;
9848        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9849            value
9850        }
9851    }
9852
9853    unsafe impl fidl::encoding::TypeMarker for SensorFeatureDescriptor {
9854        type Owned = Self;
9855
9856        #[inline(always)]
9857        fn inline_align(_context: fidl::encoding::Context) -> usize {
9858            8
9859        }
9860
9861        #[inline(always)]
9862        fn inline_size(_context: fidl::encoding::Context) -> usize {
9863            16
9864        }
9865    }
9866
9867    unsafe impl<D: fidl::encoding::ResourceDialect>
9868        fidl::encoding::Encode<SensorFeatureDescriptor, D> for &SensorFeatureDescriptor
9869    {
9870        unsafe fn encode(
9871            self,
9872            encoder: &mut fidl::encoding::Encoder<'_, D>,
9873            offset: usize,
9874            mut depth: fidl::encoding::Depth,
9875        ) -> fidl::Result<()> {
9876            encoder.debug_check_bounds::<SensorFeatureDescriptor>(offset);
9877            // Vector header
9878            let max_ordinal: u64 = self.max_ordinal_present();
9879            encoder.write_num(max_ordinal, offset);
9880            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9881            // Calling encoder.out_of_line_offset(0) is not allowed.
9882            if max_ordinal == 0 {
9883                return Ok(());
9884            }
9885            depth.increment()?;
9886            let envelope_size = 8;
9887            let bytes_len = max_ordinal as usize * envelope_size;
9888            #[allow(unused_variables)]
9889            let offset = encoder.out_of_line_offset(bytes_len);
9890            let mut _prev_end_offset: usize = 0;
9891            if 1 > max_ordinal {
9892                return Ok(());
9893            }
9894
9895            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9896            // are envelope_size bytes.
9897            let cur_offset: usize = (1 - 1) * envelope_size;
9898
9899            // Zero reserved fields.
9900            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9901
9902            // Safety:
9903            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9904            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9905            //   envelope_size bytes, there is always sufficient room.
9906            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
9907                self.report_interval
9908                    .as_ref()
9909                    .map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
9910                encoder,
9911                offset + cur_offset,
9912                depth,
9913            )?;
9914
9915            _prev_end_offset = cur_offset + envelope_size;
9916            if 2 > max_ordinal {
9917                return Ok(());
9918            }
9919
9920            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9921            // are envelope_size bytes.
9922            let cur_offset: usize = (2 - 1) * envelope_size;
9923
9924            // Zero reserved fields.
9925            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9926
9927            // Safety:
9928            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9929            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9930            //   envelope_size bytes, there is always sufficient room.
9931            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9932            self.sensitivity.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9933            encoder, offset + cur_offset, depth
9934        )?;
9935
9936            _prev_end_offset = cur_offset + envelope_size;
9937            if 3 > max_ordinal {
9938                return Ok(());
9939            }
9940
9941            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9942            // are envelope_size bytes.
9943            let cur_offset: usize = (3 - 1) * envelope_size;
9944
9945            // Zero reserved fields.
9946            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9947
9948            // Safety:
9949            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9950            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9951            //   envelope_size bytes, there is always sufficient room.
9952            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9953                self.supports_reporting_state
9954                    .as_ref()
9955                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9956                encoder,
9957                offset + cur_offset,
9958                depth,
9959            )?;
9960
9961            _prev_end_offset = cur_offset + envelope_size;
9962            if 4 > max_ordinal {
9963                return Ok(());
9964            }
9965
9966            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9967            // are envelope_size bytes.
9968            let cur_offset: usize = (4 - 1) * envelope_size;
9969
9970            // Zero reserved fields.
9971            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9972
9973            // Safety:
9974            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9975            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9976            //   envelope_size bytes, there is always sufficient room.
9977            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9978            self.threshold_high.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9979            encoder, offset + cur_offset, depth
9980        )?;
9981
9982            _prev_end_offset = cur_offset + envelope_size;
9983            if 5 > max_ordinal {
9984                return Ok(());
9985            }
9986
9987            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9988            // are envelope_size bytes.
9989            let cur_offset: usize = (5 - 1) * envelope_size;
9990
9991            // Zero reserved fields.
9992            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9993
9994            // Safety:
9995            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9996            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9997            //   envelope_size bytes, there is always sufficient room.
9998            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9999            self.threshold_low.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
10000            encoder, offset + cur_offset, depth
10001        )?;
10002
10003            _prev_end_offset = cur_offset + envelope_size;
10004            if 6 > max_ordinal {
10005                return Ok(());
10006            }
10007
10008            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10009            // are envelope_size bytes.
10010            let cur_offset: usize = (6 - 1) * envelope_size;
10011
10012            // Zero reserved fields.
10013            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10014
10015            // Safety:
10016            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10017            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10018            //   envelope_size bytes, there is always sufficient room.
10019            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
10020                self.sampling_rate.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
10021                encoder,
10022                offset + cur_offset,
10023                depth,
10024            )?;
10025
10026            _prev_end_offset = cur_offset + envelope_size;
10027            if 7 > max_ordinal {
10028                return Ok(());
10029            }
10030
10031            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10032            // are envelope_size bytes.
10033            let cur_offset: usize = (7 - 1) * envelope_size;
10034
10035            // Zero reserved fields.
10036            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10037
10038            // Safety:
10039            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10040            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10041            //   envelope_size bytes, there is always sufficient room.
10042            fidl::encoding::encode_in_envelope_optional::<u8, D>(
10043                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
10044                encoder,
10045                offset + cur_offset,
10046                depth,
10047            )?;
10048
10049            _prev_end_offset = cur_offset + envelope_size;
10050
10051            Ok(())
10052        }
10053    }
10054
10055    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10056        for SensorFeatureDescriptor
10057    {
10058        #[inline(always)]
10059        fn new_empty() -> Self {
10060            Self::default()
10061        }
10062
10063        unsafe fn decode(
10064            &mut self,
10065            decoder: &mut fidl::encoding::Decoder<'_, D>,
10066            offset: usize,
10067            mut depth: fidl::encoding::Depth,
10068        ) -> fidl::Result<()> {
10069            decoder.debug_check_bounds::<Self>(offset);
10070            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10071                None => return Err(fidl::Error::NotNullable),
10072                Some(len) => len,
10073            };
10074            // Calling decoder.out_of_line_offset(0) is not allowed.
10075            if len == 0 {
10076                return Ok(());
10077            };
10078            depth.increment()?;
10079            let envelope_size = 8;
10080            let bytes_len = len * envelope_size;
10081            let offset = decoder.out_of_line_offset(bytes_len)?;
10082            // Decode the envelope for each type.
10083            let mut _next_ordinal_to_read = 0;
10084            let mut next_offset = offset;
10085            let end_offset = offset + bytes_len;
10086            _next_ordinal_to_read += 1;
10087            if next_offset >= end_offset {
10088                return Ok(());
10089            }
10090
10091            // Decode unknown envelopes for gaps in ordinals.
10092            while _next_ordinal_to_read < 1 {
10093                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10094                _next_ordinal_to_read += 1;
10095                next_offset += envelope_size;
10096            }
10097
10098            let next_out_of_line = decoder.next_out_of_line();
10099            let handles_before = decoder.remaining_handles();
10100            if let Some((inlined, num_bytes, num_handles)) =
10101                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10102            {
10103                let member_inline_size =
10104                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10105                if inlined != (member_inline_size <= 4) {
10106                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10107                }
10108                let inner_offset;
10109                let mut inner_depth = depth.clone();
10110                if inlined {
10111                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10112                    inner_offset = next_offset;
10113                } else {
10114                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10115                    inner_depth.increment()?;
10116                }
10117                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10118                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10119                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10120                {
10121                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10122                }
10123                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10124                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10125                }
10126            }
10127
10128            next_offset += envelope_size;
10129            _next_ordinal_to_read += 1;
10130            if next_offset >= end_offset {
10131                return Ok(());
10132            }
10133
10134            // Decode unknown envelopes for gaps in ordinals.
10135            while _next_ordinal_to_read < 2 {
10136                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10137                _next_ordinal_to_read += 1;
10138                next_offset += envelope_size;
10139            }
10140
10141            let next_out_of_line = decoder.next_out_of_line();
10142            let handles_before = decoder.remaining_handles();
10143            if let Some((inlined, num_bytes, num_handles)) =
10144                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10145            {
10146                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10147                if inlined != (member_inline_size <= 4) {
10148                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10149                }
10150                let inner_offset;
10151                let mut inner_depth = depth.clone();
10152                if inlined {
10153                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10154                    inner_offset = next_offset;
10155                } else {
10156                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10157                    inner_depth.increment()?;
10158                }
10159                let val_ref = self.sensitivity.get_or_insert_with(
10160                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10161                );
10162                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10163                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10164                {
10165                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10166                }
10167                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10168                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10169                }
10170            }
10171
10172            next_offset += envelope_size;
10173            _next_ordinal_to_read += 1;
10174            if next_offset >= end_offset {
10175                return Ok(());
10176            }
10177
10178            // Decode unknown envelopes for gaps in ordinals.
10179            while _next_ordinal_to_read < 3 {
10180                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10181                _next_ordinal_to_read += 1;
10182                next_offset += envelope_size;
10183            }
10184
10185            let next_out_of_line = decoder.next_out_of_line();
10186            let handles_before = decoder.remaining_handles();
10187            if let Some((inlined, num_bytes, num_handles)) =
10188                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10189            {
10190                let member_inline_size =
10191                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10192                if inlined != (member_inline_size <= 4) {
10193                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10194                }
10195                let inner_offset;
10196                let mut inner_depth = depth.clone();
10197                if inlined {
10198                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10199                    inner_offset = next_offset;
10200                } else {
10201                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10202                    inner_depth.increment()?;
10203                }
10204                let val_ref =
10205                    self.supports_reporting_state.get_or_insert_with(|| fidl::new_empty!(bool, D));
10206                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10207                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10208                {
10209                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10210                }
10211                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10212                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10213                }
10214            }
10215
10216            next_offset += envelope_size;
10217            _next_ordinal_to_read += 1;
10218            if next_offset >= end_offset {
10219                return Ok(());
10220            }
10221
10222            // Decode unknown envelopes for gaps in ordinals.
10223            while _next_ordinal_to_read < 4 {
10224                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10225                _next_ordinal_to_read += 1;
10226                next_offset += envelope_size;
10227            }
10228
10229            let next_out_of_line = decoder.next_out_of_line();
10230            let handles_before = decoder.remaining_handles();
10231            if let Some((inlined, num_bytes, num_handles)) =
10232                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10233            {
10234                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10235                if inlined != (member_inline_size <= 4) {
10236                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10237                }
10238                let inner_offset;
10239                let mut inner_depth = depth.clone();
10240                if inlined {
10241                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10242                    inner_offset = next_offset;
10243                } else {
10244                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10245                    inner_depth.increment()?;
10246                }
10247                let val_ref = self.threshold_high.get_or_insert_with(
10248                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10249                );
10250                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10251                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10252                {
10253                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10254                }
10255                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10256                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10257                }
10258            }
10259
10260            next_offset += envelope_size;
10261            _next_ordinal_to_read += 1;
10262            if next_offset >= end_offset {
10263                return Ok(());
10264            }
10265
10266            // Decode unknown envelopes for gaps in ordinals.
10267            while _next_ordinal_to_read < 5 {
10268                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10269                _next_ordinal_to_read += 1;
10270                next_offset += envelope_size;
10271            }
10272
10273            let next_out_of_line = decoder.next_out_of_line();
10274            let handles_before = decoder.remaining_handles();
10275            if let Some((inlined, num_bytes, num_handles)) =
10276                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10277            {
10278                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10279                if inlined != (member_inline_size <= 4) {
10280                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10281                }
10282                let inner_offset;
10283                let mut inner_depth = depth.clone();
10284                if inlined {
10285                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10286                    inner_offset = next_offset;
10287                } else {
10288                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10289                    inner_depth.increment()?;
10290                }
10291                let val_ref = self.threshold_low.get_or_insert_with(
10292                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10293                );
10294                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10295                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10296                {
10297                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10298                }
10299                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10300                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10301                }
10302            }
10303
10304            next_offset += envelope_size;
10305            _next_ordinal_to_read += 1;
10306            if next_offset >= end_offset {
10307                return Ok(());
10308            }
10309
10310            // Decode unknown envelopes for gaps in ordinals.
10311            while _next_ordinal_to_read < 6 {
10312                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10313                _next_ordinal_to_read += 1;
10314                next_offset += envelope_size;
10315            }
10316
10317            let next_out_of_line = decoder.next_out_of_line();
10318            let handles_before = decoder.remaining_handles();
10319            if let Some((inlined, num_bytes, num_handles)) =
10320                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10321            {
10322                let member_inline_size =
10323                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10324                if inlined != (member_inline_size <= 4) {
10325                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10326                }
10327                let inner_offset;
10328                let mut inner_depth = depth.clone();
10329                if inlined {
10330                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10331                    inner_offset = next_offset;
10332                } else {
10333                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10334                    inner_depth.increment()?;
10335                }
10336                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10337                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10338                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10339                {
10340                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10341                }
10342                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10343                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10344                }
10345            }
10346
10347            next_offset += envelope_size;
10348            _next_ordinal_to_read += 1;
10349            if next_offset >= end_offset {
10350                return Ok(());
10351            }
10352
10353            // Decode unknown envelopes for gaps in ordinals.
10354            while _next_ordinal_to_read < 7 {
10355                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10356                _next_ordinal_to_read += 1;
10357                next_offset += envelope_size;
10358            }
10359
10360            let next_out_of_line = decoder.next_out_of_line();
10361            let handles_before = decoder.remaining_handles();
10362            if let Some((inlined, num_bytes, num_handles)) =
10363                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10364            {
10365                let member_inline_size =
10366                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10367                if inlined != (member_inline_size <= 4) {
10368                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10369                }
10370                let inner_offset;
10371                let mut inner_depth = depth.clone();
10372                if inlined {
10373                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10374                    inner_offset = next_offset;
10375                } else {
10376                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10377                    inner_depth.increment()?;
10378                }
10379                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
10380                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
10381                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10382                {
10383                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10384                }
10385                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10386                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10387                }
10388            }
10389
10390            next_offset += envelope_size;
10391
10392            // Decode the remaining unknown envelopes.
10393            while next_offset < end_offset {
10394                _next_ordinal_to_read += 1;
10395                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10396                next_offset += envelope_size;
10397            }
10398
10399            Ok(())
10400        }
10401    }
10402
10403    impl SensorFeatureReport {
10404        #[inline(always)]
10405        fn max_ordinal_present(&self) -> u64 {
10406            if let Some(_) = self.sampling_rate {
10407                return 6;
10408            }
10409            if let Some(_) = self.threshold_low {
10410                return 5;
10411            }
10412            if let Some(_) = self.threshold_high {
10413                return 4;
10414            }
10415            if let Some(_) = self.reporting_state {
10416                return 3;
10417            }
10418            if let Some(_) = self.sensitivity {
10419                return 2;
10420            }
10421            if let Some(_) = self.report_interval {
10422                return 1;
10423            }
10424            0
10425        }
10426    }
10427
10428    impl fidl::encoding::ValueTypeMarker for SensorFeatureReport {
10429        type Borrowed<'a> = &'a Self;
10430        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10431            value
10432        }
10433    }
10434
10435    unsafe impl fidl::encoding::TypeMarker for SensorFeatureReport {
10436        type Owned = Self;
10437
10438        #[inline(always)]
10439        fn inline_align(_context: fidl::encoding::Context) -> usize {
10440            8
10441        }
10442
10443        #[inline(always)]
10444        fn inline_size(_context: fidl::encoding::Context) -> usize {
10445            16
10446        }
10447    }
10448
10449    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorFeatureReport, D>
10450        for &SensorFeatureReport
10451    {
10452        unsafe fn encode(
10453            self,
10454            encoder: &mut fidl::encoding::Encoder<'_, D>,
10455            offset: usize,
10456            mut depth: fidl::encoding::Depth,
10457        ) -> fidl::Result<()> {
10458            encoder.debug_check_bounds::<SensorFeatureReport>(offset);
10459            // Vector header
10460            let max_ordinal: u64 = self.max_ordinal_present();
10461            encoder.write_num(max_ordinal, offset);
10462            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10463            // Calling encoder.out_of_line_offset(0) is not allowed.
10464            if max_ordinal == 0 {
10465                return Ok(());
10466            }
10467            depth.increment()?;
10468            let envelope_size = 8;
10469            let bytes_len = max_ordinal as usize * envelope_size;
10470            #[allow(unused_variables)]
10471            let offset = encoder.out_of_line_offset(bytes_len);
10472            let mut _prev_end_offset: usize = 0;
10473            if 1 > max_ordinal {
10474                return Ok(());
10475            }
10476
10477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10478            // are envelope_size bytes.
10479            let cur_offset: usize = (1 - 1) * envelope_size;
10480
10481            // Zero reserved fields.
10482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10483
10484            // Safety:
10485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10487            //   envelope_size bytes, there is always sufficient room.
10488            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10489                self.report_interval.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10490                encoder,
10491                offset + cur_offset,
10492                depth,
10493            )?;
10494
10495            _prev_end_offset = cur_offset + envelope_size;
10496            if 2 > max_ordinal {
10497                return Ok(());
10498            }
10499
10500            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10501            // are envelope_size bytes.
10502            let cur_offset: usize = (2 - 1) * envelope_size;
10503
10504            // Zero reserved fields.
10505            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10506
10507            // Safety:
10508            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10509            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10510            //   envelope_size bytes, there is always sufficient room.
10511            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10512                self.sensitivity.as_ref().map(
10513                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10514                ),
10515                encoder,
10516                offset + cur_offset,
10517                depth,
10518            )?;
10519
10520            _prev_end_offset = cur_offset + envelope_size;
10521            if 3 > max_ordinal {
10522                return Ok(());
10523            }
10524
10525            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10526            // are envelope_size bytes.
10527            let cur_offset: usize = (3 - 1) * envelope_size;
10528
10529            // Zero reserved fields.
10530            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10531
10532            // Safety:
10533            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10534            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10535            //   envelope_size bytes, there is always sufficient room.
10536            fidl::encoding::encode_in_envelope_optional::<SensorReportingState, D>(
10537                self.reporting_state
10538                    .as_ref()
10539                    .map(<SensorReportingState as fidl::encoding::ValueTypeMarker>::borrow),
10540                encoder,
10541                offset + cur_offset,
10542                depth,
10543            )?;
10544
10545            _prev_end_offset = cur_offset + envelope_size;
10546            if 4 > max_ordinal {
10547                return Ok(());
10548            }
10549
10550            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10551            // are envelope_size bytes.
10552            let cur_offset: usize = (4 - 1) * envelope_size;
10553
10554            // Zero reserved fields.
10555            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10556
10557            // Safety:
10558            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10559            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10560            //   envelope_size bytes, there is always sufficient room.
10561            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10562                self.threshold_high.as_ref().map(
10563                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10564                ),
10565                encoder,
10566                offset + cur_offset,
10567                depth,
10568            )?;
10569
10570            _prev_end_offset = cur_offset + envelope_size;
10571            if 5 > max_ordinal {
10572                return Ok(());
10573            }
10574
10575            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10576            // are envelope_size bytes.
10577            let cur_offset: usize = (5 - 1) * envelope_size;
10578
10579            // Zero reserved fields.
10580            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10581
10582            // Safety:
10583            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10584            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10585            //   envelope_size bytes, there is always sufficient room.
10586            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10587                self.threshold_low.as_ref().map(
10588                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10589                ),
10590                encoder,
10591                offset + cur_offset,
10592                depth,
10593            )?;
10594
10595            _prev_end_offset = cur_offset + envelope_size;
10596            if 6 > max_ordinal {
10597                return Ok(());
10598            }
10599
10600            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10601            // are envelope_size bytes.
10602            let cur_offset: usize = (6 - 1) * envelope_size;
10603
10604            // Zero reserved fields.
10605            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10606
10607            // Safety:
10608            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10609            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10610            //   envelope_size bytes, there is always sufficient room.
10611            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10612                self.sampling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10613                encoder,
10614                offset + cur_offset,
10615                depth,
10616            )?;
10617
10618            _prev_end_offset = cur_offset + envelope_size;
10619
10620            Ok(())
10621        }
10622    }
10623
10624    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorFeatureReport {
10625        #[inline(always)]
10626        fn new_empty() -> Self {
10627            Self::default()
10628        }
10629
10630        unsafe fn decode(
10631            &mut self,
10632            decoder: &mut fidl::encoding::Decoder<'_, D>,
10633            offset: usize,
10634            mut depth: fidl::encoding::Depth,
10635        ) -> fidl::Result<()> {
10636            decoder.debug_check_bounds::<Self>(offset);
10637            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10638                None => return Err(fidl::Error::NotNullable),
10639                Some(len) => len,
10640            };
10641            // Calling decoder.out_of_line_offset(0) is not allowed.
10642            if len == 0 {
10643                return Ok(());
10644            };
10645            depth.increment()?;
10646            let envelope_size = 8;
10647            let bytes_len = len * envelope_size;
10648            let offset = decoder.out_of_line_offset(bytes_len)?;
10649            // Decode the envelope for each type.
10650            let mut _next_ordinal_to_read = 0;
10651            let mut next_offset = offset;
10652            let end_offset = offset + bytes_len;
10653            _next_ordinal_to_read += 1;
10654            if next_offset >= end_offset {
10655                return Ok(());
10656            }
10657
10658            // Decode unknown envelopes for gaps in ordinals.
10659            while _next_ordinal_to_read < 1 {
10660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10661                _next_ordinal_to_read += 1;
10662                next_offset += envelope_size;
10663            }
10664
10665            let next_out_of_line = decoder.next_out_of_line();
10666            let handles_before = decoder.remaining_handles();
10667            if let Some((inlined, num_bytes, num_handles)) =
10668                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10669            {
10670                let member_inline_size =
10671                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10672                if inlined != (member_inline_size <= 4) {
10673                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10674                }
10675                let inner_offset;
10676                let mut inner_depth = depth.clone();
10677                if inlined {
10678                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10679                    inner_offset = next_offset;
10680                } else {
10681                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10682                    inner_depth.increment()?;
10683                }
10684                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(i64, D));
10685                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10686                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10687                {
10688                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10689                }
10690                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10691                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10692                }
10693            }
10694
10695            next_offset += envelope_size;
10696            _next_ordinal_to_read += 1;
10697            if next_offset >= end_offset {
10698                return Ok(());
10699            }
10700
10701            // Decode unknown envelopes for gaps in ordinals.
10702            while _next_ordinal_to_read < 2 {
10703                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10704                _next_ordinal_to_read += 1;
10705                next_offset += envelope_size;
10706            }
10707
10708            let next_out_of_line = decoder.next_out_of_line();
10709            let handles_before = decoder.remaining_handles();
10710            if let Some((inlined, num_bytes, num_handles)) =
10711                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10712            {
10713                let member_inline_size =
10714                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10715                        decoder.context,
10716                    );
10717                if inlined != (member_inline_size <= 4) {
10718                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10719                }
10720                let inner_offset;
10721                let mut inner_depth = depth.clone();
10722                if inlined {
10723                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10724                    inner_offset = next_offset;
10725                } else {
10726                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10727                    inner_depth.increment()?;
10728                }
10729                let val_ref = self
10730                    .sensitivity
10731                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10732                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10733                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10734                {
10735                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10736                }
10737                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10738                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10739                }
10740            }
10741
10742            next_offset += envelope_size;
10743            _next_ordinal_to_read += 1;
10744            if next_offset >= end_offset {
10745                return Ok(());
10746            }
10747
10748            // Decode unknown envelopes for gaps in ordinals.
10749            while _next_ordinal_to_read < 3 {
10750                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10751                _next_ordinal_to_read += 1;
10752                next_offset += envelope_size;
10753            }
10754
10755            let next_out_of_line = decoder.next_out_of_line();
10756            let handles_before = decoder.remaining_handles();
10757            if let Some((inlined, num_bytes, num_handles)) =
10758                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10759            {
10760                let member_inline_size =
10761                    <SensorReportingState as fidl::encoding::TypeMarker>::inline_size(
10762                        decoder.context,
10763                    );
10764                if inlined != (member_inline_size <= 4) {
10765                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10766                }
10767                let inner_offset;
10768                let mut inner_depth = depth.clone();
10769                if inlined {
10770                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10771                    inner_offset = next_offset;
10772                } else {
10773                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10774                    inner_depth.increment()?;
10775                }
10776                let val_ref = self
10777                    .reporting_state
10778                    .get_or_insert_with(|| fidl::new_empty!(SensorReportingState, D));
10779                fidl::decode!(
10780                    SensorReportingState,
10781                    D,
10782                    val_ref,
10783                    decoder,
10784                    inner_offset,
10785                    inner_depth
10786                )?;
10787                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10788                {
10789                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10790                }
10791                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10792                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10793                }
10794            }
10795
10796            next_offset += envelope_size;
10797            _next_ordinal_to_read += 1;
10798            if next_offset >= end_offset {
10799                return Ok(());
10800            }
10801
10802            // Decode unknown envelopes for gaps in ordinals.
10803            while _next_ordinal_to_read < 4 {
10804                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10805                _next_ordinal_to_read += 1;
10806                next_offset += envelope_size;
10807            }
10808
10809            let next_out_of_line = decoder.next_out_of_line();
10810            let handles_before = decoder.remaining_handles();
10811            if let Some((inlined, num_bytes, num_handles)) =
10812                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10813            {
10814                let member_inline_size =
10815                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10816                        decoder.context,
10817                    );
10818                if inlined != (member_inline_size <= 4) {
10819                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10820                }
10821                let inner_offset;
10822                let mut inner_depth = depth.clone();
10823                if inlined {
10824                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10825                    inner_offset = next_offset;
10826                } else {
10827                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10828                    inner_depth.increment()?;
10829                }
10830                let val_ref = self
10831                    .threshold_high
10832                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10833                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10834                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10835                {
10836                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10837                }
10838                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10839                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10840                }
10841            }
10842
10843            next_offset += envelope_size;
10844            _next_ordinal_to_read += 1;
10845            if next_offset >= end_offset {
10846                return Ok(());
10847            }
10848
10849            // Decode unknown envelopes for gaps in ordinals.
10850            while _next_ordinal_to_read < 5 {
10851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10852                _next_ordinal_to_read += 1;
10853                next_offset += envelope_size;
10854            }
10855
10856            let next_out_of_line = decoder.next_out_of_line();
10857            let handles_before = decoder.remaining_handles();
10858            if let Some((inlined, num_bytes, num_handles)) =
10859                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10860            {
10861                let member_inline_size =
10862                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10863                        decoder.context,
10864                    );
10865                if inlined != (member_inline_size <= 4) {
10866                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10867                }
10868                let inner_offset;
10869                let mut inner_depth = depth.clone();
10870                if inlined {
10871                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10872                    inner_offset = next_offset;
10873                } else {
10874                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10875                    inner_depth.increment()?;
10876                }
10877                let val_ref = self
10878                    .threshold_low
10879                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10880                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10881                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10882                {
10883                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10884                }
10885                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10886                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10887                }
10888            }
10889
10890            next_offset += envelope_size;
10891            _next_ordinal_to_read += 1;
10892            if next_offset >= end_offset {
10893                return Ok(());
10894            }
10895
10896            // Decode unknown envelopes for gaps in ordinals.
10897            while _next_ordinal_to_read < 6 {
10898                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10899                _next_ordinal_to_read += 1;
10900                next_offset += envelope_size;
10901            }
10902
10903            let next_out_of_line = decoder.next_out_of_line();
10904            let handles_before = decoder.remaining_handles();
10905            if let Some((inlined, num_bytes, num_handles)) =
10906                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10907            {
10908                let member_inline_size =
10909                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10910                if inlined != (member_inline_size <= 4) {
10911                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10912                }
10913                let inner_offset;
10914                let mut inner_depth = depth.clone();
10915                if inlined {
10916                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10917                    inner_offset = next_offset;
10918                } else {
10919                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10920                    inner_depth.increment()?;
10921                }
10922                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
10923                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10924                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10925                {
10926                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10927                }
10928                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10929                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10930                }
10931            }
10932
10933            next_offset += envelope_size;
10934
10935            // Decode the remaining unknown envelopes.
10936            while next_offset < end_offset {
10937                _next_ordinal_to_read += 1;
10938                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10939                next_offset += envelope_size;
10940            }
10941
10942            Ok(())
10943        }
10944    }
10945
10946    impl SensorInputDescriptor {
10947        #[inline(always)]
10948        fn max_ordinal_present(&self) -> u64 {
10949            if let Some(_) = self.report_id {
10950                return 2;
10951            }
10952            if let Some(_) = self.values {
10953                return 1;
10954            }
10955            0
10956        }
10957    }
10958
10959    impl fidl::encoding::ValueTypeMarker for SensorInputDescriptor {
10960        type Borrowed<'a> = &'a Self;
10961        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10962            value
10963        }
10964    }
10965
10966    unsafe impl fidl::encoding::TypeMarker for SensorInputDescriptor {
10967        type Owned = Self;
10968
10969        #[inline(always)]
10970        fn inline_align(_context: fidl::encoding::Context) -> usize {
10971            8
10972        }
10973
10974        #[inline(always)]
10975        fn inline_size(_context: fidl::encoding::Context) -> usize {
10976            16
10977        }
10978    }
10979
10980    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputDescriptor, D>
10981        for &SensorInputDescriptor
10982    {
10983        unsafe fn encode(
10984            self,
10985            encoder: &mut fidl::encoding::Encoder<'_, D>,
10986            offset: usize,
10987            mut depth: fidl::encoding::Depth,
10988        ) -> fidl::Result<()> {
10989            encoder.debug_check_bounds::<SensorInputDescriptor>(offset);
10990            // Vector header
10991            let max_ordinal: u64 = self.max_ordinal_present();
10992            encoder.write_num(max_ordinal, offset);
10993            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10994            // Calling encoder.out_of_line_offset(0) is not allowed.
10995            if max_ordinal == 0 {
10996                return Ok(());
10997            }
10998            depth.increment()?;
10999            let envelope_size = 8;
11000            let bytes_len = max_ordinal as usize * envelope_size;
11001            #[allow(unused_variables)]
11002            let offset = encoder.out_of_line_offset(bytes_len);
11003            let mut _prev_end_offset: usize = 0;
11004            if 1 > max_ordinal {
11005                return Ok(());
11006            }
11007
11008            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11009            // are envelope_size bytes.
11010            let cur_offset: usize = (1 - 1) * envelope_size;
11011
11012            // Zero reserved fields.
11013            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11014
11015            // Safety:
11016            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11017            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11018            //   envelope_size bytes, there is always sufficient room.
11019            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
11020            self.values.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
11021            encoder, offset + cur_offset, depth
11022        )?;
11023
11024            _prev_end_offset = cur_offset + envelope_size;
11025            if 2 > max_ordinal {
11026                return Ok(());
11027            }
11028
11029            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11030            // are envelope_size bytes.
11031            let cur_offset: usize = (2 - 1) * envelope_size;
11032
11033            // Zero reserved fields.
11034            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11035
11036            // Safety:
11037            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11038            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11039            //   envelope_size bytes, there is always sufficient room.
11040            fidl::encoding::encode_in_envelope_optional::<u8, D>(
11041                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11042                encoder,
11043                offset + cur_offset,
11044                depth,
11045            )?;
11046
11047            _prev_end_offset = cur_offset + envelope_size;
11048
11049            Ok(())
11050        }
11051    }
11052
11053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputDescriptor {
11054        #[inline(always)]
11055        fn new_empty() -> Self {
11056            Self::default()
11057        }
11058
11059        unsafe fn decode(
11060            &mut self,
11061            decoder: &mut fidl::encoding::Decoder<'_, D>,
11062            offset: usize,
11063            mut depth: fidl::encoding::Depth,
11064        ) -> fidl::Result<()> {
11065            decoder.debug_check_bounds::<Self>(offset);
11066            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11067                None => return Err(fidl::Error::NotNullable),
11068                Some(len) => len,
11069            };
11070            // Calling decoder.out_of_line_offset(0) is not allowed.
11071            if len == 0 {
11072                return Ok(());
11073            };
11074            depth.increment()?;
11075            let envelope_size = 8;
11076            let bytes_len = len * envelope_size;
11077            let offset = decoder.out_of_line_offset(bytes_len)?;
11078            // Decode the envelope for each type.
11079            let mut _next_ordinal_to_read = 0;
11080            let mut next_offset = offset;
11081            let end_offset = offset + bytes_len;
11082            _next_ordinal_to_read += 1;
11083            if next_offset >= end_offset {
11084                return Ok(());
11085            }
11086
11087            // Decode unknown envelopes for gaps in ordinals.
11088            while _next_ordinal_to_read < 1 {
11089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11090                _next_ordinal_to_read += 1;
11091                next_offset += envelope_size;
11092            }
11093
11094            let next_out_of_line = decoder.next_out_of_line();
11095            let handles_before = decoder.remaining_handles();
11096            if let Some((inlined, num_bytes, num_handles)) =
11097                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11098            {
11099                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11100                if inlined != (member_inline_size <= 4) {
11101                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11102                }
11103                let inner_offset;
11104                let mut inner_depth = depth.clone();
11105                if inlined {
11106                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11107                    inner_offset = next_offset;
11108                } else {
11109                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11110                    inner_depth.increment()?;
11111                }
11112                let val_ref = self.values.get_or_insert_with(
11113                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
11114                );
11115                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11116                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11117                {
11118                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11119                }
11120                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11121                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11122                }
11123            }
11124
11125            next_offset += envelope_size;
11126            _next_ordinal_to_read += 1;
11127            if next_offset >= end_offset {
11128                return Ok(());
11129            }
11130
11131            // Decode unknown envelopes for gaps in ordinals.
11132            while _next_ordinal_to_read < 2 {
11133                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11134                _next_ordinal_to_read += 1;
11135                next_offset += envelope_size;
11136            }
11137
11138            let next_out_of_line = decoder.next_out_of_line();
11139            let handles_before = decoder.remaining_handles();
11140            if let Some((inlined, num_bytes, num_handles)) =
11141                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11142            {
11143                let member_inline_size =
11144                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11145                if inlined != (member_inline_size <= 4) {
11146                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11147                }
11148                let inner_offset;
11149                let mut inner_depth = depth.clone();
11150                if inlined {
11151                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11152                    inner_offset = next_offset;
11153                } else {
11154                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11155                    inner_depth.increment()?;
11156                }
11157                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
11158                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
11159                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11160                {
11161                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11162                }
11163                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11164                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11165                }
11166            }
11167
11168            next_offset += envelope_size;
11169
11170            // Decode the remaining unknown envelopes.
11171            while next_offset < end_offset {
11172                _next_ordinal_to_read += 1;
11173                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11174                next_offset += envelope_size;
11175            }
11176
11177            Ok(())
11178        }
11179    }
11180
11181    impl SensorInputReport {
11182        #[inline(always)]
11183        fn max_ordinal_present(&self) -> u64 {
11184            if let Some(_) = self.values {
11185                return 1;
11186            }
11187            0
11188        }
11189    }
11190
11191    impl fidl::encoding::ValueTypeMarker for SensorInputReport {
11192        type Borrowed<'a> = &'a Self;
11193        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11194            value
11195        }
11196    }
11197
11198    unsafe impl fidl::encoding::TypeMarker for SensorInputReport {
11199        type Owned = Self;
11200
11201        #[inline(always)]
11202        fn inline_align(_context: fidl::encoding::Context) -> usize {
11203            8
11204        }
11205
11206        #[inline(always)]
11207        fn inline_size(_context: fidl::encoding::Context) -> usize {
11208            16
11209        }
11210    }
11211
11212    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputReport, D>
11213        for &SensorInputReport
11214    {
11215        unsafe fn encode(
11216            self,
11217            encoder: &mut fidl::encoding::Encoder<'_, D>,
11218            offset: usize,
11219            mut depth: fidl::encoding::Depth,
11220        ) -> fidl::Result<()> {
11221            encoder.debug_check_bounds::<SensorInputReport>(offset);
11222            // Vector header
11223            let max_ordinal: u64 = self.max_ordinal_present();
11224            encoder.write_num(max_ordinal, offset);
11225            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11226            // Calling encoder.out_of_line_offset(0) is not allowed.
11227            if max_ordinal == 0 {
11228                return Ok(());
11229            }
11230            depth.increment()?;
11231            let envelope_size = 8;
11232            let bytes_len = max_ordinal as usize * envelope_size;
11233            #[allow(unused_variables)]
11234            let offset = encoder.out_of_line_offset(bytes_len);
11235            let mut _prev_end_offset: usize = 0;
11236            if 1 > max_ordinal {
11237                return Ok(());
11238            }
11239
11240            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11241            // are envelope_size bytes.
11242            let cur_offset: usize = (1 - 1) * envelope_size;
11243
11244            // Zero reserved fields.
11245            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11246
11247            // Safety:
11248            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11249            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11250            //   envelope_size bytes, there is always sufficient room.
11251            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
11252                self.values.as_ref().map(
11253                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
11254                ),
11255                encoder,
11256                offset + cur_offset,
11257                depth,
11258            )?;
11259
11260            _prev_end_offset = cur_offset + envelope_size;
11261
11262            Ok(())
11263        }
11264    }
11265
11266    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputReport {
11267        #[inline(always)]
11268        fn new_empty() -> Self {
11269            Self::default()
11270        }
11271
11272        unsafe fn decode(
11273            &mut self,
11274            decoder: &mut fidl::encoding::Decoder<'_, D>,
11275            offset: usize,
11276            mut depth: fidl::encoding::Depth,
11277        ) -> fidl::Result<()> {
11278            decoder.debug_check_bounds::<Self>(offset);
11279            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11280                None => return Err(fidl::Error::NotNullable),
11281                Some(len) => len,
11282            };
11283            // Calling decoder.out_of_line_offset(0) is not allowed.
11284            if len == 0 {
11285                return Ok(());
11286            };
11287            depth.increment()?;
11288            let envelope_size = 8;
11289            let bytes_len = len * envelope_size;
11290            let offset = decoder.out_of_line_offset(bytes_len)?;
11291            // Decode the envelope for each type.
11292            let mut _next_ordinal_to_read = 0;
11293            let mut next_offset = offset;
11294            let end_offset = offset + bytes_len;
11295            _next_ordinal_to_read += 1;
11296            if next_offset >= end_offset {
11297                return Ok(());
11298            }
11299
11300            // Decode unknown envelopes for gaps in ordinals.
11301            while _next_ordinal_to_read < 1 {
11302                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11303                _next_ordinal_to_read += 1;
11304                next_offset += envelope_size;
11305            }
11306
11307            let next_out_of_line = decoder.next_out_of_line();
11308            let handles_before = decoder.remaining_handles();
11309            if let Some((inlined, num_bytes, num_handles)) =
11310                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11311            {
11312                let member_inline_size =
11313                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
11314                        decoder.context,
11315                    );
11316                if inlined != (member_inline_size <= 4) {
11317                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11318                }
11319                let inner_offset;
11320                let mut inner_depth = depth.clone();
11321                if inlined {
11322                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11323                    inner_offset = next_offset;
11324                } else {
11325                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11326                    inner_depth.increment()?;
11327                }
11328                let val_ref = self
11329                    .values
11330                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
11331                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11332                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11333                {
11334                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11335                }
11336                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11337                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11338                }
11339            }
11340
11341            next_offset += envelope_size;
11342
11343            // Decode the remaining unknown envelopes.
11344            while next_offset < end_offset {
11345                _next_ordinal_to_read += 1;
11346                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11347                next_offset += envelope_size;
11348            }
11349
11350            Ok(())
11351        }
11352    }
11353
11354    impl TouchDescriptor {
11355        #[inline(always)]
11356        fn max_ordinal_present(&self) -> u64 {
11357            if let Some(_) = self.feature {
11358                return 2;
11359            }
11360            if let Some(_) = self.input {
11361                return 1;
11362            }
11363            0
11364        }
11365    }
11366
11367    impl fidl::encoding::ValueTypeMarker for TouchDescriptor {
11368        type Borrowed<'a> = &'a Self;
11369        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11370            value
11371        }
11372    }
11373
11374    unsafe impl fidl::encoding::TypeMarker for TouchDescriptor {
11375        type Owned = Self;
11376
11377        #[inline(always)]
11378        fn inline_align(_context: fidl::encoding::Context) -> usize {
11379            8
11380        }
11381
11382        #[inline(always)]
11383        fn inline_size(_context: fidl::encoding::Context) -> usize {
11384            16
11385        }
11386    }
11387
11388    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDescriptor, D>
11389        for &TouchDescriptor
11390    {
11391        unsafe fn encode(
11392            self,
11393            encoder: &mut fidl::encoding::Encoder<'_, D>,
11394            offset: usize,
11395            mut depth: fidl::encoding::Depth,
11396        ) -> fidl::Result<()> {
11397            encoder.debug_check_bounds::<TouchDescriptor>(offset);
11398            // Vector header
11399            let max_ordinal: u64 = self.max_ordinal_present();
11400            encoder.write_num(max_ordinal, offset);
11401            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11402            // Calling encoder.out_of_line_offset(0) is not allowed.
11403            if max_ordinal == 0 {
11404                return Ok(());
11405            }
11406            depth.increment()?;
11407            let envelope_size = 8;
11408            let bytes_len = max_ordinal as usize * envelope_size;
11409            #[allow(unused_variables)]
11410            let offset = encoder.out_of_line_offset(bytes_len);
11411            let mut _prev_end_offset: usize = 0;
11412            if 1 > max_ordinal {
11413                return Ok(());
11414            }
11415
11416            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11417            // are envelope_size bytes.
11418            let cur_offset: usize = (1 - 1) * envelope_size;
11419
11420            // Zero reserved fields.
11421            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11422
11423            // Safety:
11424            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11425            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11426            //   envelope_size bytes, there is always sufficient room.
11427            fidl::encoding::encode_in_envelope_optional::<TouchInputDescriptor, D>(
11428                self.input
11429                    .as_ref()
11430                    .map(<TouchInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11431                encoder,
11432                offset + cur_offset,
11433                depth,
11434            )?;
11435
11436            _prev_end_offset = cur_offset + envelope_size;
11437            if 2 > max_ordinal {
11438                return Ok(());
11439            }
11440
11441            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11442            // are envelope_size bytes.
11443            let cur_offset: usize = (2 - 1) * envelope_size;
11444
11445            // Zero reserved fields.
11446            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11447
11448            // Safety:
11449            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11450            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11451            //   envelope_size bytes, there is always sufficient room.
11452            fidl::encoding::encode_in_envelope_optional::<TouchFeatureDescriptor, D>(
11453                self.feature
11454                    .as_ref()
11455                    .map(<TouchFeatureDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11456                encoder,
11457                offset + cur_offset,
11458                depth,
11459            )?;
11460
11461            _prev_end_offset = cur_offset + envelope_size;
11462
11463            Ok(())
11464        }
11465    }
11466
11467    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDescriptor {
11468        #[inline(always)]
11469        fn new_empty() -> Self {
11470            Self::default()
11471        }
11472
11473        unsafe fn decode(
11474            &mut self,
11475            decoder: &mut fidl::encoding::Decoder<'_, D>,
11476            offset: usize,
11477            mut depth: fidl::encoding::Depth,
11478        ) -> fidl::Result<()> {
11479            decoder.debug_check_bounds::<Self>(offset);
11480            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11481                None => return Err(fidl::Error::NotNullable),
11482                Some(len) => len,
11483            };
11484            // Calling decoder.out_of_line_offset(0) is not allowed.
11485            if len == 0 {
11486                return Ok(());
11487            };
11488            depth.increment()?;
11489            let envelope_size = 8;
11490            let bytes_len = len * envelope_size;
11491            let offset = decoder.out_of_line_offset(bytes_len)?;
11492            // Decode the envelope for each type.
11493            let mut _next_ordinal_to_read = 0;
11494            let mut next_offset = offset;
11495            let end_offset = offset + bytes_len;
11496            _next_ordinal_to_read += 1;
11497            if next_offset >= end_offset {
11498                return Ok(());
11499            }
11500
11501            // Decode unknown envelopes for gaps in ordinals.
11502            while _next_ordinal_to_read < 1 {
11503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11504                _next_ordinal_to_read += 1;
11505                next_offset += envelope_size;
11506            }
11507
11508            let next_out_of_line = decoder.next_out_of_line();
11509            let handles_before = decoder.remaining_handles();
11510            if let Some((inlined, num_bytes, num_handles)) =
11511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11512            {
11513                let member_inline_size =
11514                    <TouchInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
11515                        decoder.context,
11516                    );
11517                if inlined != (member_inline_size <= 4) {
11518                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11519                }
11520                let inner_offset;
11521                let mut inner_depth = depth.clone();
11522                if inlined {
11523                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11524                    inner_offset = next_offset;
11525                } else {
11526                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11527                    inner_depth.increment()?;
11528                }
11529                let val_ref =
11530                    self.input.get_or_insert_with(|| fidl::new_empty!(TouchInputDescriptor, D));
11531                fidl::decode!(
11532                    TouchInputDescriptor,
11533                    D,
11534                    val_ref,
11535                    decoder,
11536                    inner_offset,
11537                    inner_depth
11538                )?;
11539                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11540                {
11541                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11542                }
11543                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11544                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11545                }
11546            }
11547
11548            next_offset += envelope_size;
11549            _next_ordinal_to_read += 1;
11550            if next_offset >= end_offset {
11551                return Ok(());
11552            }
11553
11554            // Decode unknown envelopes for gaps in ordinals.
11555            while _next_ordinal_to_read < 2 {
11556                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11557                _next_ordinal_to_read += 1;
11558                next_offset += envelope_size;
11559            }
11560
11561            let next_out_of_line = decoder.next_out_of_line();
11562            let handles_before = decoder.remaining_handles();
11563            if let Some((inlined, num_bytes, num_handles)) =
11564                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11565            {
11566                let member_inline_size =
11567                    <TouchFeatureDescriptor as fidl::encoding::TypeMarker>::inline_size(
11568                        decoder.context,
11569                    );
11570                if inlined != (member_inline_size <= 4) {
11571                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11572                }
11573                let inner_offset;
11574                let mut inner_depth = depth.clone();
11575                if inlined {
11576                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11577                    inner_offset = next_offset;
11578                } else {
11579                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11580                    inner_depth.increment()?;
11581                }
11582                let val_ref =
11583                    self.feature.get_or_insert_with(|| fidl::new_empty!(TouchFeatureDescriptor, D));
11584                fidl::decode!(
11585                    TouchFeatureDescriptor,
11586                    D,
11587                    val_ref,
11588                    decoder,
11589                    inner_offset,
11590                    inner_depth
11591                )?;
11592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11593                {
11594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11595                }
11596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11598                }
11599            }
11600
11601            next_offset += envelope_size;
11602
11603            // Decode the remaining unknown envelopes.
11604            while next_offset < end_offset {
11605                _next_ordinal_to_read += 1;
11606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11607                next_offset += envelope_size;
11608            }
11609
11610            Ok(())
11611        }
11612    }
11613
11614    impl TouchFeatureDescriptor {
11615        #[inline(always)]
11616        fn max_ordinal_present(&self) -> u64 {
11617            if let Some(_) = self.supports_selective_reporting {
11618                return 2;
11619            }
11620            if let Some(_) = self.supports_input_mode {
11621                return 1;
11622            }
11623            0
11624        }
11625    }
11626
11627    impl fidl::encoding::ValueTypeMarker for TouchFeatureDescriptor {
11628        type Borrowed<'a> = &'a Self;
11629        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11630            value
11631        }
11632    }
11633
11634    unsafe impl fidl::encoding::TypeMarker for TouchFeatureDescriptor {
11635        type Owned = Self;
11636
11637        #[inline(always)]
11638        fn inline_align(_context: fidl::encoding::Context) -> usize {
11639            8
11640        }
11641
11642        #[inline(always)]
11643        fn inline_size(_context: fidl::encoding::Context) -> usize {
11644            16
11645        }
11646    }
11647
11648    unsafe impl<D: fidl::encoding::ResourceDialect>
11649        fidl::encoding::Encode<TouchFeatureDescriptor, D> for &TouchFeatureDescriptor
11650    {
11651        unsafe fn encode(
11652            self,
11653            encoder: &mut fidl::encoding::Encoder<'_, D>,
11654            offset: usize,
11655            mut depth: fidl::encoding::Depth,
11656        ) -> fidl::Result<()> {
11657            encoder.debug_check_bounds::<TouchFeatureDescriptor>(offset);
11658            // Vector header
11659            let max_ordinal: u64 = self.max_ordinal_present();
11660            encoder.write_num(max_ordinal, offset);
11661            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11662            // Calling encoder.out_of_line_offset(0) is not allowed.
11663            if max_ordinal == 0 {
11664                return Ok(());
11665            }
11666            depth.increment()?;
11667            let envelope_size = 8;
11668            let bytes_len = max_ordinal as usize * envelope_size;
11669            #[allow(unused_variables)]
11670            let offset = encoder.out_of_line_offset(bytes_len);
11671            let mut _prev_end_offset: usize = 0;
11672            if 1 > max_ordinal {
11673                return Ok(());
11674            }
11675
11676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11677            // are envelope_size bytes.
11678            let cur_offset: usize = (1 - 1) * envelope_size;
11679
11680            // Zero reserved fields.
11681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11682
11683            // Safety:
11684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11686            //   envelope_size bytes, there is always sufficient room.
11687            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11688                self.supports_input_mode
11689                    .as_ref()
11690                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11691                encoder,
11692                offset + cur_offset,
11693                depth,
11694            )?;
11695
11696            _prev_end_offset = cur_offset + envelope_size;
11697            if 2 > max_ordinal {
11698                return Ok(());
11699            }
11700
11701            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11702            // are envelope_size bytes.
11703            let cur_offset: usize = (2 - 1) * envelope_size;
11704
11705            // Zero reserved fields.
11706            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11707
11708            // Safety:
11709            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11710            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11711            //   envelope_size bytes, there is always sufficient room.
11712            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11713                self.supports_selective_reporting
11714                    .as_ref()
11715                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11716                encoder,
11717                offset + cur_offset,
11718                depth,
11719            )?;
11720
11721            _prev_end_offset = cur_offset + envelope_size;
11722
11723            Ok(())
11724        }
11725    }
11726
11727    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11728        for TouchFeatureDescriptor
11729    {
11730        #[inline(always)]
11731        fn new_empty() -> Self {
11732            Self::default()
11733        }
11734
11735        unsafe fn decode(
11736            &mut self,
11737            decoder: &mut fidl::encoding::Decoder<'_, D>,
11738            offset: usize,
11739            mut depth: fidl::encoding::Depth,
11740        ) -> fidl::Result<()> {
11741            decoder.debug_check_bounds::<Self>(offset);
11742            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11743                None => return Err(fidl::Error::NotNullable),
11744                Some(len) => len,
11745            };
11746            // Calling decoder.out_of_line_offset(0) is not allowed.
11747            if len == 0 {
11748                return Ok(());
11749            };
11750            depth.increment()?;
11751            let envelope_size = 8;
11752            let bytes_len = len * envelope_size;
11753            let offset = decoder.out_of_line_offset(bytes_len)?;
11754            // Decode the envelope for each type.
11755            let mut _next_ordinal_to_read = 0;
11756            let mut next_offset = offset;
11757            let end_offset = offset + bytes_len;
11758            _next_ordinal_to_read += 1;
11759            if next_offset >= end_offset {
11760                return Ok(());
11761            }
11762
11763            // Decode unknown envelopes for gaps in ordinals.
11764            while _next_ordinal_to_read < 1 {
11765                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11766                _next_ordinal_to_read += 1;
11767                next_offset += envelope_size;
11768            }
11769
11770            let next_out_of_line = decoder.next_out_of_line();
11771            let handles_before = decoder.remaining_handles();
11772            if let Some((inlined, num_bytes, num_handles)) =
11773                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11774            {
11775                let member_inline_size =
11776                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11777                if inlined != (member_inline_size <= 4) {
11778                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11779                }
11780                let inner_offset;
11781                let mut inner_depth = depth.clone();
11782                if inlined {
11783                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11784                    inner_offset = next_offset;
11785                } else {
11786                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11787                    inner_depth.increment()?;
11788                }
11789                let val_ref =
11790                    self.supports_input_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
11791                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11792                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11793                {
11794                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11795                }
11796                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11797                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11798                }
11799            }
11800
11801            next_offset += envelope_size;
11802            _next_ordinal_to_read += 1;
11803            if next_offset >= end_offset {
11804                return Ok(());
11805            }
11806
11807            // Decode unknown envelopes for gaps in ordinals.
11808            while _next_ordinal_to_read < 2 {
11809                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11810                _next_ordinal_to_read += 1;
11811                next_offset += envelope_size;
11812            }
11813
11814            let next_out_of_line = decoder.next_out_of_line();
11815            let handles_before = decoder.remaining_handles();
11816            if let Some((inlined, num_bytes, num_handles)) =
11817                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11818            {
11819                let member_inline_size =
11820                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11821                if inlined != (member_inline_size <= 4) {
11822                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11823                }
11824                let inner_offset;
11825                let mut inner_depth = depth.clone();
11826                if inlined {
11827                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11828                    inner_offset = next_offset;
11829                } else {
11830                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11831                    inner_depth.increment()?;
11832                }
11833                let val_ref = self
11834                    .supports_selective_reporting
11835                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
11836                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11837                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11838                {
11839                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11840                }
11841                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11842                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11843                }
11844            }
11845
11846            next_offset += envelope_size;
11847
11848            // Decode the remaining unknown envelopes.
11849            while next_offset < end_offset {
11850                _next_ordinal_to_read += 1;
11851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11852                next_offset += envelope_size;
11853            }
11854
11855            Ok(())
11856        }
11857    }
11858
11859    impl TouchFeatureReport {
11860        #[inline(always)]
11861        fn max_ordinal_present(&self) -> u64 {
11862            if let Some(_) = self.selective_reporting {
11863                return 2;
11864            }
11865            if let Some(_) = self.input_mode {
11866                return 1;
11867            }
11868            0
11869        }
11870    }
11871
11872    impl fidl::encoding::ValueTypeMarker for TouchFeatureReport {
11873        type Borrowed<'a> = &'a Self;
11874        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11875            value
11876        }
11877    }
11878
11879    unsafe impl fidl::encoding::TypeMarker for TouchFeatureReport {
11880        type Owned = Self;
11881
11882        #[inline(always)]
11883        fn inline_align(_context: fidl::encoding::Context) -> usize {
11884            8
11885        }
11886
11887        #[inline(always)]
11888        fn inline_size(_context: fidl::encoding::Context) -> usize {
11889            16
11890        }
11891    }
11892
11893    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchFeatureReport, D>
11894        for &TouchFeatureReport
11895    {
11896        unsafe fn encode(
11897            self,
11898            encoder: &mut fidl::encoding::Encoder<'_, D>,
11899            offset: usize,
11900            mut depth: fidl::encoding::Depth,
11901        ) -> fidl::Result<()> {
11902            encoder.debug_check_bounds::<TouchFeatureReport>(offset);
11903            // Vector header
11904            let max_ordinal: u64 = self.max_ordinal_present();
11905            encoder.write_num(max_ordinal, offset);
11906            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11907            // Calling encoder.out_of_line_offset(0) is not allowed.
11908            if max_ordinal == 0 {
11909                return Ok(());
11910            }
11911            depth.increment()?;
11912            let envelope_size = 8;
11913            let bytes_len = max_ordinal as usize * envelope_size;
11914            #[allow(unused_variables)]
11915            let offset = encoder.out_of_line_offset(bytes_len);
11916            let mut _prev_end_offset: usize = 0;
11917            if 1 > max_ordinal {
11918                return Ok(());
11919            }
11920
11921            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11922            // are envelope_size bytes.
11923            let cur_offset: usize = (1 - 1) * envelope_size;
11924
11925            // Zero reserved fields.
11926            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11927
11928            // Safety:
11929            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11930            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11931            //   envelope_size bytes, there is always sufficient room.
11932            fidl::encoding::encode_in_envelope_optional::<TouchConfigurationInputMode, D>(
11933                self.input_mode
11934                    .as_ref()
11935                    .map(<TouchConfigurationInputMode as fidl::encoding::ValueTypeMarker>::borrow),
11936                encoder,
11937                offset + cur_offset,
11938                depth,
11939            )?;
11940
11941            _prev_end_offset = cur_offset + envelope_size;
11942            if 2 > max_ordinal {
11943                return Ok(());
11944            }
11945
11946            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11947            // are envelope_size bytes.
11948            let cur_offset: usize = (2 - 1) * envelope_size;
11949
11950            // Zero reserved fields.
11951            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11952
11953            // Safety:
11954            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11955            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11956            //   envelope_size bytes, there is always sufficient room.
11957            fidl::encoding::encode_in_envelope_optional::<SelectiveReportingFeatureReport, D>(
11958                self.selective_reporting.as_ref().map(
11959                    <SelectiveReportingFeatureReport as fidl::encoding::ValueTypeMarker>::borrow,
11960                ),
11961                encoder,
11962                offset + cur_offset,
11963                depth,
11964            )?;
11965
11966            _prev_end_offset = cur_offset + envelope_size;
11967
11968            Ok(())
11969        }
11970    }
11971
11972    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchFeatureReport {
11973        #[inline(always)]
11974        fn new_empty() -> Self {
11975            Self::default()
11976        }
11977
11978        unsafe fn decode(
11979            &mut self,
11980            decoder: &mut fidl::encoding::Decoder<'_, D>,
11981            offset: usize,
11982            mut depth: fidl::encoding::Depth,
11983        ) -> fidl::Result<()> {
11984            decoder.debug_check_bounds::<Self>(offset);
11985            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11986                None => return Err(fidl::Error::NotNullable),
11987                Some(len) => len,
11988            };
11989            // Calling decoder.out_of_line_offset(0) is not allowed.
11990            if len == 0 {
11991                return Ok(());
11992            };
11993            depth.increment()?;
11994            let envelope_size = 8;
11995            let bytes_len = len * envelope_size;
11996            let offset = decoder.out_of_line_offset(bytes_len)?;
11997            // Decode the envelope for each type.
11998            let mut _next_ordinal_to_read = 0;
11999            let mut next_offset = offset;
12000            let end_offset = offset + bytes_len;
12001            _next_ordinal_to_read += 1;
12002            if next_offset >= end_offset {
12003                return Ok(());
12004            }
12005
12006            // Decode unknown envelopes for gaps in ordinals.
12007            while _next_ordinal_to_read < 1 {
12008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12009                _next_ordinal_to_read += 1;
12010                next_offset += envelope_size;
12011            }
12012
12013            let next_out_of_line = decoder.next_out_of_line();
12014            let handles_before = decoder.remaining_handles();
12015            if let Some((inlined, num_bytes, num_handles)) =
12016                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12017            {
12018                let member_inline_size =
12019                    <TouchConfigurationInputMode as fidl::encoding::TypeMarker>::inline_size(
12020                        decoder.context,
12021                    );
12022                if inlined != (member_inline_size <= 4) {
12023                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12024                }
12025                let inner_offset;
12026                let mut inner_depth = depth.clone();
12027                if inlined {
12028                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12029                    inner_offset = next_offset;
12030                } else {
12031                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12032                    inner_depth.increment()?;
12033                }
12034                let val_ref = self
12035                    .input_mode
12036                    .get_or_insert_with(|| fidl::new_empty!(TouchConfigurationInputMode, D));
12037                fidl::decode!(
12038                    TouchConfigurationInputMode,
12039                    D,
12040                    val_ref,
12041                    decoder,
12042                    inner_offset,
12043                    inner_depth
12044                )?;
12045                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12046                {
12047                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12048                }
12049                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12050                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12051                }
12052            }
12053
12054            next_offset += envelope_size;
12055            _next_ordinal_to_read += 1;
12056            if next_offset >= end_offset {
12057                return Ok(());
12058            }
12059
12060            // Decode unknown envelopes for gaps in ordinals.
12061            while _next_ordinal_to_read < 2 {
12062                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12063                _next_ordinal_to_read += 1;
12064                next_offset += envelope_size;
12065            }
12066
12067            let next_out_of_line = decoder.next_out_of_line();
12068            let handles_before = decoder.remaining_handles();
12069            if let Some((inlined, num_bytes, num_handles)) =
12070                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12071            {
12072                let member_inline_size =
12073                    <SelectiveReportingFeatureReport as fidl::encoding::TypeMarker>::inline_size(
12074                        decoder.context,
12075                    );
12076                if inlined != (member_inline_size <= 4) {
12077                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12078                }
12079                let inner_offset;
12080                let mut inner_depth = depth.clone();
12081                if inlined {
12082                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12083                    inner_offset = next_offset;
12084                } else {
12085                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12086                    inner_depth.increment()?;
12087                }
12088                let val_ref = self
12089                    .selective_reporting
12090                    .get_or_insert_with(|| fidl::new_empty!(SelectiveReportingFeatureReport, D));
12091                fidl::decode!(
12092                    SelectiveReportingFeatureReport,
12093                    D,
12094                    val_ref,
12095                    decoder,
12096                    inner_offset,
12097                    inner_depth
12098                )?;
12099                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12100                {
12101                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12102                }
12103                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12104                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12105                }
12106            }
12107
12108            next_offset += envelope_size;
12109
12110            // Decode the remaining unknown envelopes.
12111            while next_offset < end_offset {
12112                _next_ordinal_to_read += 1;
12113                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12114                next_offset += envelope_size;
12115            }
12116
12117            Ok(())
12118        }
12119    }
12120
12121    impl TouchInputDescriptor {
12122        #[inline(always)]
12123        fn max_ordinal_present(&self) -> u64 {
12124            if let Some(_) = self.buttons {
12125                return 4;
12126            }
12127            if let Some(_) = self.touch_type {
12128                return 3;
12129            }
12130            if let Some(_) = self.max_contacts {
12131                return 2;
12132            }
12133            if let Some(_) = self.contacts {
12134                return 1;
12135            }
12136            0
12137        }
12138    }
12139
12140    impl fidl::encoding::ValueTypeMarker for TouchInputDescriptor {
12141        type Borrowed<'a> = &'a Self;
12142        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12143            value
12144        }
12145    }
12146
12147    unsafe impl fidl::encoding::TypeMarker for TouchInputDescriptor {
12148        type Owned = Self;
12149
12150        #[inline(always)]
12151        fn inline_align(_context: fidl::encoding::Context) -> usize {
12152            8
12153        }
12154
12155        #[inline(always)]
12156        fn inline_size(_context: fidl::encoding::Context) -> usize {
12157            16
12158        }
12159    }
12160
12161    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputDescriptor, D>
12162        for &TouchInputDescriptor
12163    {
12164        unsafe fn encode(
12165            self,
12166            encoder: &mut fidl::encoding::Encoder<'_, D>,
12167            offset: usize,
12168            mut depth: fidl::encoding::Depth,
12169        ) -> fidl::Result<()> {
12170            encoder.debug_check_bounds::<TouchInputDescriptor>(offset);
12171            // Vector header
12172            let max_ordinal: u64 = self.max_ordinal_present();
12173            encoder.write_num(max_ordinal, offset);
12174            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12175            // Calling encoder.out_of_line_offset(0) is not allowed.
12176            if max_ordinal == 0 {
12177                return Ok(());
12178            }
12179            depth.increment()?;
12180            let envelope_size = 8;
12181            let bytes_len = max_ordinal as usize * envelope_size;
12182            #[allow(unused_variables)]
12183            let offset = encoder.out_of_line_offset(bytes_len);
12184            let mut _prev_end_offset: usize = 0;
12185            if 1 > max_ordinal {
12186                return Ok(());
12187            }
12188
12189            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12190            // are envelope_size bytes.
12191            let cur_offset: usize = (1 - 1) * envelope_size;
12192
12193            // Zero reserved fields.
12194            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12195
12196            // Safety:
12197            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12198            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12199            //   envelope_size bytes, there is always sufficient room.
12200            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputDescriptor, 10>, D>(
12201            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12202            encoder, offset + cur_offset, depth
12203        )?;
12204
12205            _prev_end_offset = cur_offset + envelope_size;
12206            if 2 > max_ordinal {
12207                return Ok(());
12208            }
12209
12210            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12211            // are envelope_size bytes.
12212            let cur_offset: usize = (2 - 1) * envelope_size;
12213
12214            // Zero reserved fields.
12215            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12216
12217            // Safety:
12218            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12219            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12220            //   envelope_size bytes, there is always sufficient room.
12221            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12222                self.max_contacts.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12223                encoder,
12224                offset + cur_offset,
12225                depth,
12226            )?;
12227
12228            _prev_end_offset = cur_offset + envelope_size;
12229            if 3 > max_ordinal {
12230                return Ok(());
12231            }
12232
12233            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12234            // are envelope_size bytes.
12235            let cur_offset: usize = (3 - 1) * envelope_size;
12236
12237            // Zero reserved fields.
12238            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12239
12240            // Safety:
12241            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12242            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12243            //   envelope_size bytes, there is always sufficient room.
12244            fidl::encoding::encode_in_envelope_optional::<TouchType, D>(
12245                self.touch_type
12246                    .as_ref()
12247                    .map(<TouchType as fidl::encoding::ValueTypeMarker>::borrow),
12248                encoder,
12249                offset + cur_offset,
12250                depth,
12251            )?;
12252
12253            _prev_end_offset = cur_offset + envelope_size;
12254            if 4 > max_ordinal {
12255                return Ok(());
12256            }
12257
12258            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12259            // are envelope_size bytes.
12260            let cur_offset: usize = (4 - 1) * envelope_size;
12261
12262            // Zero reserved fields.
12263            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12264
12265            // Safety:
12266            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12267            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12268            //   envelope_size bytes, there is always sufficient room.
12269            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
12270                self.buttons.as_ref().map(
12271                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
12272                ),
12273                encoder,
12274                offset + cur_offset,
12275                depth,
12276            )?;
12277
12278            _prev_end_offset = cur_offset + envelope_size;
12279
12280            Ok(())
12281        }
12282    }
12283
12284    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputDescriptor {
12285        #[inline(always)]
12286        fn new_empty() -> Self {
12287            Self::default()
12288        }
12289
12290        unsafe fn decode(
12291            &mut self,
12292            decoder: &mut fidl::encoding::Decoder<'_, D>,
12293            offset: usize,
12294            mut depth: fidl::encoding::Depth,
12295        ) -> fidl::Result<()> {
12296            decoder.debug_check_bounds::<Self>(offset);
12297            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12298                None => return Err(fidl::Error::NotNullable),
12299                Some(len) => len,
12300            };
12301            // Calling decoder.out_of_line_offset(0) is not allowed.
12302            if len == 0 {
12303                return Ok(());
12304            };
12305            depth.increment()?;
12306            let envelope_size = 8;
12307            let bytes_len = len * envelope_size;
12308            let offset = decoder.out_of_line_offset(bytes_len)?;
12309            // Decode the envelope for each type.
12310            let mut _next_ordinal_to_read = 0;
12311            let mut next_offset = offset;
12312            let end_offset = offset + bytes_len;
12313            _next_ordinal_to_read += 1;
12314            if next_offset >= end_offset {
12315                return Ok(());
12316            }
12317
12318            // Decode unknown envelopes for gaps in ordinals.
12319            while _next_ordinal_to_read < 1 {
12320                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12321                _next_ordinal_to_read += 1;
12322                next_offset += envelope_size;
12323            }
12324
12325            let next_out_of_line = decoder.next_out_of_line();
12326            let handles_before = decoder.remaining_handles();
12327            if let Some((inlined, num_bytes, num_handles)) =
12328                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12329            {
12330                let member_inline_size = <fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12331                if inlined != (member_inline_size <= 4) {
12332                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12333                }
12334                let inner_offset;
12335                let mut inner_depth = depth.clone();
12336                if inlined {
12337                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12338                    inner_offset = next_offset;
12339                } else {
12340                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12341                    inner_depth.increment()?;
12342                }
12343                let val_ref = self.contacts.get_or_insert_with(
12344                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D),
12345                );
12346                fidl::decode!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12347                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12348                {
12349                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12350                }
12351                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12352                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12353                }
12354            }
12355
12356            next_offset += envelope_size;
12357            _next_ordinal_to_read += 1;
12358            if next_offset >= end_offset {
12359                return Ok(());
12360            }
12361
12362            // Decode unknown envelopes for gaps in ordinals.
12363            while _next_ordinal_to_read < 2 {
12364                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12365                _next_ordinal_to_read += 1;
12366                next_offset += envelope_size;
12367            }
12368
12369            let next_out_of_line = decoder.next_out_of_line();
12370            let handles_before = decoder.remaining_handles();
12371            if let Some((inlined, num_bytes, num_handles)) =
12372                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12373            {
12374                let member_inline_size =
12375                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12376                if inlined != (member_inline_size <= 4) {
12377                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12378                }
12379                let inner_offset;
12380                let mut inner_depth = depth.clone();
12381                if inlined {
12382                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12383                    inner_offset = next_offset;
12384                } else {
12385                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12386                    inner_depth.increment()?;
12387                }
12388                let val_ref = self.max_contacts.get_or_insert_with(|| fidl::new_empty!(u32, D));
12389                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12390                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12391                {
12392                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12393                }
12394                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12395                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12396                }
12397            }
12398
12399            next_offset += envelope_size;
12400            _next_ordinal_to_read += 1;
12401            if next_offset >= end_offset {
12402                return Ok(());
12403            }
12404
12405            // Decode unknown envelopes for gaps in ordinals.
12406            while _next_ordinal_to_read < 3 {
12407                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12408                _next_ordinal_to_read += 1;
12409                next_offset += envelope_size;
12410            }
12411
12412            let next_out_of_line = decoder.next_out_of_line();
12413            let handles_before = decoder.remaining_handles();
12414            if let Some((inlined, num_bytes, num_handles)) =
12415                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12416            {
12417                let member_inline_size =
12418                    <TouchType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12419                if inlined != (member_inline_size <= 4) {
12420                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12421                }
12422                let inner_offset;
12423                let mut inner_depth = depth.clone();
12424                if inlined {
12425                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12426                    inner_offset = next_offset;
12427                } else {
12428                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12429                    inner_depth.increment()?;
12430                }
12431                let val_ref = self.touch_type.get_or_insert_with(|| fidl::new_empty!(TouchType, D));
12432                fidl::decode!(TouchType, D, val_ref, decoder, inner_offset, inner_depth)?;
12433                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12434                {
12435                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12436                }
12437                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12438                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12439                }
12440            }
12441
12442            next_offset += envelope_size;
12443            _next_ordinal_to_read += 1;
12444            if next_offset >= end_offset {
12445                return Ok(());
12446            }
12447
12448            // Decode unknown envelopes for gaps in ordinals.
12449            while _next_ordinal_to_read < 4 {
12450                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12451                _next_ordinal_to_read += 1;
12452                next_offset += envelope_size;
12453            }
12454
12455            let next_out_of_line = decoder.next_out_of_line();
12456            let handles_before = decoder.remaining_handles();
12457            if let Some((inlined, num_bytes, num_handles)) =
12458                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12459            {
12460                let member_inline_size =
12461                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
12462                        decoder.context,
12463                    );
12464                if inlined != (member_inline_size <= 4) {
12465                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12466                }
12467                let inner_offset;
12468                let mut inner_depth = depth.clone();
12469                if inlined {
12470                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12471                    inner_offset = next_offset;
12472                } else {
12473                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12474                    inner_depth.increment()?;
12475                }
12476                let val_ref = self
12477                    .buttons
12478                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
12479                fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12480                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12481                {
12482                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12483                }
12484                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12485                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12486                }
12487            }
12488
12489            next_offset += envelope_size;
12490
12491            // Decode the remaining unknown envelopes.
12492            while next_offset < end_offset {
12493                _next_ordinal_to_read += 1;
12494                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12495                next_offset += envelope_size;
12496            }
12497
12498            Ok(())
12499        }
12500    }
12501
12502    impl TouchInputReport {
12503        #[inline(always)]
12504        fn max_ordinal_present(&self) -> u64 {
12505            if let Some(_) = self.pressed_buttons {
12506                return 2;
12507            }
12508            if let Some(_) = self.contacts {
12509                return 1;
12510            }
12511            0
12512        }
12513    }
12514
12515    impl fidl::encoding::ValueTypeMarker for TouchInputReport {
12516        type Borrowed<'a> = &'a Self;
12517        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12518            value
12519        }
12520    }
12521
12522    unsafe impl fidl::encoding::TypeMarker for TouchInputReport {
12523        type Owned = Self;
12524
12525        #[inline(always)]
12526        fn inline_align(_context: fidl::encoding::Context) -> usize {
12527            8
12528        }
12529
12530        #[inline(always)]
12531        fn inline_size(_context: fidl::encoding::Context) -> usize {
12532            16
12533        }
12534    }
12535
12536    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputReport, D>
12537        for &TouchInputReport
12538    {
12539        unsafe fn encode(
12540            self,
12541            encoder: &mut fidl::encoding::Encoder<'_, D>,
12542            offset: usize,
12543            mut depth: fidl::encoding::Depth,
12544        ) -> fidl::Result<()> {
12545            encoder.debug_check_bounds::<TouchInputReport>(offset);
12546            // Vector header
12547            let max_ordinal: u64 = self.max_ordinal_present();
12548            encoder.write_num(max_ordinal, offset);
12549            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12550            // Calling encoder.out_of_line_offset(0) is not allowed.
12551            if max_ordinal == 0 {
12552                return Ok(());
12553            }
12554            depth.increment()?;
12555            let envelope_size = 8;
12556            let bytes_len = max_ordinal as usize * envelope_size;
12557            #[allow(unused_variables)]
12558            let offset = encoder.out_of_line_offset(bytes_len);
12559            let mut _prev_end_offset: usize = 0;
12560            if 1 > max_ordinal {
12561                return Ok(());
12562            }
12563
12564            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12565            // are envelope_size bytes.
12566            let cur_offset: usize = (1 - 1) * envelope_size;
12567
12568            // Zero reserved fields.
12569            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12570
12571            // Safety:
12572            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12573            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12574            //   envelope_size bytes, there is always sufficient room.
12575            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputReport, 10>, D>(
12576            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12577            encoder, offset + cur_offset, depth
12578        )?;
12579
12580            _prev_end_offset = cur_offset + envelope_size;
12581            if 2 > max_ordinal {
12582                return Ok(());
12583            }
12584
12585            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12586            // are envelope_size bytes.
12587            let cur_offset: usize = (2 - 1) * envelope_size;
12588
12589            // Zero reserved fields.
12590            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12591
12592            // Safety:
12593            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12594            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12595            //   envelope_size bytes, there is always sufficient room.
12596            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
12597                self.pressed_buttons.as_ref().map(
12598                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
12599                ),
12600                encoder,
12601                offset + cur_offset,
12602                depth,
12603            )?;
12604
12605            _prev_end_offset = cur_offset + envelope_size;
12606
12607            Ok(())
12608        }
12609    }
12610
12611    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputReport {
12612        #[inline(always)]
12613        fn new_empty() -> Self {
12614            Self::default()
12615        }
12616
12617        unsafe fn decode(
12618            &mut self,
12619            decoder: &mut fidl::encoding::Decoder<'_, D>,
12620            offset: usize,
12621            mut depth: fidl::encoding::Depth,
12622        ) -> fidl::Result<()> {
12623            decoder.debug_check_bounds::<Self>(offset);
12624            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12625                None => return Err(fidl::Error::NotNullable),
12626                Some(len) => len,
12627            };
12628            // Calling decoder.out_of_line_offset(0) is not allowed.
12629            if len == 0 {
12630                return Ok(());
12631            };
12632            depth.increment()?;
12633            let envelope_size = 8;
12634            let bytes_len = len * envelope_size;
12635            let offset = decoder.out_of_line_offset(bytes_len)?;
12636            // Decode the envelope for each type.
12637            let mut _next_ordinal_to_read = 0;
12638            let mut next_offset = offset;
12639            let end_offset = offset + bytes_len;
12640            _next_ordinal_to_read += 1;
12641            if next_offset >= end_offset {
12642                return Ok(());
12643            }
12644
12645            // Decode unknown envelopes for gaps in ordinals.
12646            while _next_ordinal_to_read < 1 {
12647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12648                _next_ordinal_to_read += 1;
12649                next_offset += envelope_size;
12650            }
12651
12652            let next_out_of_line = decoder.next_out_of_line();
12653            let handles_before = decoder.remaining_handles();
12654            if let Some((inlined, num_bytes, num_handles)) =
12655                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12656            {
12657                let member_inline_size = <fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12658                if inlined != (member_inline_size <= 4) {
12659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12660                }
12661                let inner_offset;
12662                let mut inner_depth = depth.clone();
12663                if inlined {
12664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12665                    inner_offset = next_offset;
12666                } else {
12667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12668                    inner_depth.increment()?;
12669                }
12670                let val_ref = self.contacts.get_or_insert_with(
12671                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputReport, 10>, D),
12672                );
12673                fidl::decode!(fidl::encoding::Vector<ContactInputReport, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12675                {
12676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12677                }
12678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12680                }
12681            }
12682
12683            next_offset += envelope_size;
12684            _next_ordinal_to_read += 1;
12685            if next_offset >= end_offset {
12686                return Ok(());
12687            }
12688
12689            // Decode unknown envelopes for gaps in ordinals.
12690            while _next_ordinal_to_read < 2 {
12691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12692                _next_ordinal_to_read += 1;
12693                next_offset += envelope_size;
12694            }
12695
12696            let next_out_of_line = decoder.next_out_of_line();
12697            let handles_before = decoder.remaining_handles();
12698            if let Some((inlined, num_bytes, num_handles)) =
12699                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12700            {
12701                let member_inline_size =
12702                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
12703                        decoder.context,
12704                    );
12705                if inlined != (member_inline_size <= 4) {
12706                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12707                }
12708                let inner_offset;
12709                let mut inner_depth = depth.clone();
12710                if inlined {
12711                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12712                    inner_offset = next_offset;
12713                } else {
12714                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12715                    inner_depth.increment()?;
12716                }
12717                let val_ref = self
12718                    .pressed_buttons
12719                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
12720                fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12721                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12722                {
12723                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12724                }
12725                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12726                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12727                }
12728            }
12729
12730            next_offset += envelope_size;
12731
12732            // Decode the remaining unknown envelopes.
12733            while next_offset < end_offset {
12734                _next_ordinal_to_read += 1;
12735                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12736                next_offset += envelope_size;
12737            }
12738
12739            Ok(())
12740        }
12741    }
12742}