fidl_fuchsia_input_report__common/
fidl_fuchsia_input_report__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Hardcoded max sizes for ConsumerControl vectors. These sizes should be increased
12/// if we ever see a device with more objects than can be represented.
13pub const CONSUMER_CONTROL_MAX_NUM_BUTTONS: u32 = 255;
14
15/// Hardcoded max sizes for keyboard vectors. These sizes should be increased
16/// if we ever see keyboards with more objects than can be represented.
17pub const KEYBOARD_MAX_NUM_KEYS: u32 = 256;
18
19pub const KEYBOARD_MAX_NUM_LEDS: u32 = 256;
20
21pub const KEYBOARD_MAX_PRESSED_KEYS: u32 = 256;
22
23pub const MAX_DEVICE_REPORT_COUNT: u32 = 50;
24
25/// A hardcoded number of max reports. Because report ID is only 8 bits, only 255
26/// different reports are allowed at a time.
27pub const MAX_REPORT_COUNT: u32 = 255;
28
29/// A hardcoded number of max mouse buttons. This should be increased in the future
30/// if we ever see mice with more buttons.
31pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
32
33/// A hardcoded number of max sensor values. This should be increased in the future
34/// if we ever see a sensor with more values.
35pub const SENSOR_MAX_VALUES: u32 = 100;
36
37/// A hardcoded number of max contacts per report. This should be increased in the future if
38/// we see devices with more than the max amount.
39pub const TOUCH_MAX_CONTACTS: u32 = 10;
40
41pub const TOUCH_MAX_NUM_BUTTONS: u32 = 10;
42
43/// These ControlButtons represent on/off buttons whose purpose is to change
44/// the host's configuration.
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub enum ConsumerControlButton {
47    /// This button represents increasing volume.
48    VolumeUp,
49    /// This button represents decreasing volume.
50    VolumeDown,
51    /// This button represents pausing.
52    Pause,
53    /// This button represents factory resetting the host.
54    FactoryReset,
55    /// This button represents muting the microphone on the host.
56    MicMute,
57    /// This button represents rebooting the host.
58    Reboot,
59    /// This button represents disabling the camera on the host.
60    CameraDisable,
61    /// This button represents a function.
62    Function,
63    /// This button represents a power button.
64    Power,
65    #[doc(hidden)]
66    __SourceBreaking { unknown_ordinal: u32 },
67}
68
69/// Pattern that matches an unknown `ConsumerControlButton` member.
70#[macro_export]
71macro_rules! ConsumerControlButtonUnknown {
72    () => {
73        _
74    };
75}
76
77impl ConsumerControlButton {
78    #[inline]
79    pub fn from_primitive(prim: u32) -> Option<Self> {
80        match prim {
81            1 => Some(Self::VolumeUp),
82            2 => Some(Self::VolumeDown),
83            3 => Some(Self::Pause),
84            4 => Some(Self::FactoryReset),
85            5 => Some(Self::MicMute),
86            6 => Some(Self::Reboot),
87            7 => Some(Self::CameraDisable),
88            8 => Some(Self::Function),
89            9 => Some(Self::Power),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96        match prim {
97            1 => Self::VolumeUp,
98            2 => Self::VolumeDown,
99            3 => Self::Pause,
100            4 => Self::FactoryReset,
101            5 => Self::MicMute,
102            6 => Self::Reboot,
103            7 => Self::CameraDisable,
104            8 => Self::Function,
105            9 => Self::Power,
106            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107        }
108    }
109
110    #[inline]
111    pub fn unknown() -> Self {
112        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        match self {
118            Self::VolumeUp => 1,
119            Self::VolumeDown => 2,
120            Self::Pause => 3,
121            Self::FactoryReset => 4,
122            Self::MicMute => 5,
123            Self::Reboot => 6,
124            Self::CameraDisable => 7,
125            Self::Function => 8,
126            Self::Power => 9,
127            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128        }
129    }
130
131    #[inline]
132    pub fn is_unknown(&self) -> bool {
133        match self {
134            Self::__SourceBreaking { unknown_ordinal: _ } => true,
135            _ => false,
136        }
137    }
138}
139
140/// The InputReport field to be populated by InputDevice.GetInputReport.
141#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
142pub enum DeviceType {
143    Mouse,
144    Sensor,
145    Touch,
146    Keyboard,
147    ConsumerControl,
148    #[doc(hidden)]
149    __SourceBreaking {
150        unknown_ordinal: u32,
151    },
152}
153
154/// Pattern that matches an unknown `DeviceType` member.
155#[macro_export]
156macro_rules! DeviceTypeUnknown {
157    () => {
158        _
159    };
160}
161
162impl DeviceType {
163    #[inline]
164    pub fn from_primitive(prim: u32) -> Option<Self> {
165        match prim {
166            0 => Some(Self::Mouse),
167            1 => Some(Self::Sensor),
168            2 => Some(Self::Touch),
169            3 => Some(Self::Keyboard),
170            4 => Some(Self::ConsumerControl),
171            _ => None,
172        }
173    }
174
175    #[inline]
176    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
177        match prim {
178            0 => Self::Mouse,
179            1 => Self::Sensor,
180            2 => Self::Touch,
181            3 => Self::Keyboard,
182            4 => Self::ConsumerControl,
183            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
184        }
185    }
186
187    #[inline]
188    pub fn unknown() -> Self {
189        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
190    }
191
192    #[inline]
193    pub const fn into_primitive(self) -> u32 {
194        match self {
195            Self::Mouse => 0,
196            Self::Sensor => 1,
197            Self::Touch => 2,
198            Self::Keyboard => 3,
199            Self::ConsumerControl => 4,
200            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
201        }
202    }
203
204    #[inline]
205    pub fn is_unknown(&self) -> bool {
206        match self {
207            Self::__SourceBreaking { unknown_ordinal: _ } => true,
208            _ => false,
209        }
210    }
211}
212
213/// An LedType represents an LED on a device that can be turned on or off.
214/// When applicable, the definition of each LED is derived from one of the
215/// following sources albeit with a Fuchsia-specific numeric value:
216/// - USB HID usage codes for usage page 0x0008 (LED)
217#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
218pub enum LedType {
219    /// LED to indicate a Keyboard's number lock is enabled.
220    /// Corresponds to USB HID page 0x0008 usage 0x0001
221    NumLock,
222    /// LED to indicate a Keyboard's capital lock is enabled.
223    /// Corresponds to USB HID page 0x0008 usage 0x0002
224    CapsLock,
225    /// LED to indicate a Keyboard's scroll lock is enabled.
226    /// Corresponds to USB HID page 0x0008 usage 0x0003
227    ScrollLock,
228    /// LED to indicate a Keyboard's composition mode is enabled.
229    /// Corresponds to USB HID page 0x0008 usage 0x0004
230    Compose,
231    /// LED to indicate a Keyboard's Kana mode is enabled.
232    /// Corresponds to USB HID page 0x0008 usage 0x0005
233    Kana,
234    #[doc(hidden)]
235    __SourceBreaking { unknown_ordinal: u32 },
236}
237
238/// Pattern that matches an unknown `LedType` member.
239#[macro_export]
240macro_rules! LedTypeUnknown {
241    () => {
242        _
243    };
244}
245
246impl LedType {
247    #[inline]
248    pub fn from_primitive(prim: u32) -> Option<Self> {
249        match prim {
250            1 => Some(Self::NumLock),
251            2 => Some(Self::CapsLock),
252            3 => Some(Self::ScrollLock),
253            4 => Some(Self::Compose),
254            5 => Some(Self::Kana),
255            _ => None,
256        }
257    }
258
259    #[inline]
260    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
261        match prim {
262            1 => Self::NumLock,
263            2 => Self::CapsLock,
264            3 => Self::ScrollLock,
265            4 => Self::Compose,
266            5 => Self::Kana,
267            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
268        }
269    }
270
271    #[inline]
272    pub fn unknown() -> Self {
273        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
274    }
275
276    #[inline]
277    pub const fn into_primitive(self) -> u32 {
278        match self {
279            Self::NumLock => 1,
280            Self::CapsLock => 2,
281            Self::ScrollLock => 3,
282            Self::Compose => 4,
283            Self::Kana => 5,
284            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
285        }
286    }
287
288    #[inline]
289    pub fn is_unknown(&self) -> bool {
290        match self {
291            Self::__SourceBreaking { unknown_ordinal: _ } => true,
292            _ => false,
293        }
294    }
295}
296
297/// `SensorReportingState` determines when a sensor will send reports.
298#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
299pub enum SensorReportingState {
300    /// No events will be sent from the sensor.
301    ReportNoEvents,
302    /// All events will be sent from the sensor. For most sensors, this
303    /// frequency can be set by `report_interval`.
304    ReportAllEvents,
305    /// Only events that cross a threshold will be reported.
306    ReportThresholdEvents,
307    #[doc(hidden)]
308    __SourceBreaking { unknown_ordinal: u32 },
309}
310
311/// Pattern that matches an unknown `SensorReportingState` member.
312#[macro_export]
313macro_rules! SensorReportingStateUnknown {
314    () => {
315        _
316    };
317}
318
319impl SensorReportingState {
320    #[inline]
321    pub fn from_primitive(prim: u32) -> Option<Self> {
322        match prim {
323            1 => Some(Self::ReportNoEvents),
324            2 => Some(Self::ReportAllEvents),
325            3 => Some(Self::ReportThresholdEvents),
326            _ => None,
327        }
328    }
329
330    #[inline]
331    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
332        match prim {
333            1 => Self::ReportNoEvents,
334            2 => Self::ReportAllEvents,
335            3 => Self::ReportThresholdEvents,
336            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337        }
338    }
339
340    #[inline]
341    pub fn unknown() -> Self {
342        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
343    }
344
345    #[inline]
346    pub const fn into_primitive(self) -> u32 {
347        match self {
348            Self::ReportNoEvents => 1,
349            Self::ReportAllEvents => 2,
350            Self::ReportThresholdEvents => 3,
351            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
352        }
353    }
354
355    #[inline]
356    pub fn is_unknown(&self) -> bool {
357        match self {
358            Self::__SourceBreaking { unknown_ordinal: _ } => true,
359            _ => false,
360        }
361    }
362}
363
364/// Each sensor value has a corresponding SensorType, which explains what the
365/// value is measuring in the world.
366#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
367pub enum SensorType {
368    /// Acceleration on the X axis.
369    AccelerometerX,
370    /// Acceleration on the Y axis.
371    AccelerometerY,
372    /// Acceleration on the Z axis.
373    AccelerometerZ,
374    /// Strength of the Magnetic Field in the X axis.
375    MagnetometerX,
376    /// Strength of the Magnetic Field in the Y axis.
377    MagnetometerY,
378    /// Strength of the Magnetic Field in the Z axis.
379    MagnetometerZ,
380    /// Angular Velocity in the X direction moving counter-clockwise.
381    GyroscopeX,
382    /// Angular Velocity in the Y direction moving counter-clockwise.
383    GyroscopeY,
384    /// Angular Velocity in the Z direction moving counter-clockwise.
385    GyroscopeZ,
386    /// Ambient level of Light.
387    LightIlluminance,
388    /// Ambient level of Red Light.
389    LightRed,
390    /// Ambient level of Green Light.
391    LightGreen,
392    /// Ambient level of Blue Light.
393    LightBlue,
394    #[doc(hidden)]
395    __SourceBreaking { unknown_ordinal: u32 },
396}
397
398/// Pattern that matches an unknown `SensorType` member.
399#[macro_export]
400macro_rules! SensorTypeUnknown {
401    () => {
402        _
403    };
404}
405
406impl SensorType {
407    #[inline]
408    pub fn from_primitive(prim: u32) -> Option<Self> {
409        match prim {
410            1 => Some(Self::AccelerometerX),
411            2 => Some(Self::AccelerometerY),
412            3 => Some(Self::AccelerometerZ),
413            4 => Some(Self::MagnetometerX),
414            5 => Some(Self::MagnetometerY),
415            6 => Some(Self::MagnetometerZ),
416            7 => Some(Self::GyroscopeX),
417            8 => Some(Self::GyroscopeY),
418            9 => Some(Self::GyroscopeZ),
419            10 => Some(Self::LightIlluminance),
420            11 => Some(Self::LightRed),
421            12 => Some(Self::LightGreen),
422            13 => Some(Self::LightBlue),
423            _ => None,
424        }
425    }
426
427    #[inline]
428    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
429        match prim {
430            1 => Self::AccelerometerX,
431            2 => Self::AccelerometerY,
432            3 => Self::AccelerometerZ,
433            4 => Self::MagnetometerX,
434            5 => Self::MagnetometerY,
435            6 => Self::MagnetometerZ,
436            7 => Self::GyroscopeX,
437            8 => Self::GyroscopeY,
438            9 => Self::GyroscopeZ,
439            10 => Self::LightIlluminance,
440            11 => Self::LightRed,
441            12 => Self::LightGreen,
442            13 => Self::LightBlue,
443            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
444        }
445    }
446
447    #[inline]
448    pub fn unknown() -> Self {
449        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
450    }
451
452    #[inline]
453    pub const fn into_primitive(self) -> u32 {
454        match self {
455            Self::AccelerometerX => 1,
456            Self::AccelerometerY => 2,
457            Self::AccelerometerZ => 3,
458            Self::MagnetometerX => 4,
459            Self::MagnetometerY => 5,
460            Self::MagnetometerZ => 6,
461            Self::GyroscopeX => 7,
462            Self::GyroscopeY => 8,
463            Self::GyroscopeZ => 9,
464            Self::LightIlluminance => 10,
465            Self::LightRed => 11,
466            Self::LightGreen => 12,
467            Self::LightBlue => 13,
468            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
469        }
470    }
471
472    #[inline]
473    pub fn is_unknown(&self) -> bool {
474        match self {
475            Self::__SourceBreaking { unknown_ordinal: _ } => true,
476            _ => false,
477        }
478    }
479}
480
481#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
482pub enum TouchButton {
483    /// Represents palm on touchscreen.
484    Palm,
485    #[doc(hidden)]
486    __SourceBreaking { unknown_ordinal: u8 },
487}
488
489/// Pattern that matches an unknown `TouchButton` member.
490#[macro_export]
491macro_rules! TouchButtonUnknown {
492    () => {
493        _
494    };
495}
496
497impl TouchButton {
498    #[inline]
499    pub fn from_primitive(prim: u8) -> Option<Self> {
500        match prim {
501            1 => Some(Self::Palm),
502            _ => None,
503        }
504    }
505
506    #[inline]
507    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
508        match prim {
509            1 => Self::Palm,
510            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
511        }
512    }
513
514    #[inline]
515    pub fn unknown() -> Self {
516        Self::__SourceBreaking { unknown_ordinal: 0xff }
517    }
518
519    #[inline]
520    pub const fn into_primitive(self) -> u8 {
521        match self {
522            Self::Palm => 1,
523            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
524        }
525    }
526
527    #[inline]
528    pub fn is_unknown(&self) -> bool {
529        match self {
530            Self::__SourceBreaking { unknown_ordinal: _ } => true,
531            _ => false,
532        }
533    }
534}
535
536/// Input mode indicating which top-level collection should be used for input reporting.
537/// These values must correspond to the input modes defined in 16.7 of the HID Usage Tables
538/// for Universal Serial Bus (USB) Spec (https://usb.org/sites/default/files/hut1_22.pdf).
539#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
540pub enum TouchConfigurationInputMode {
541    /// Use the Mouse Collection for reporting data.
542    MouseCollection,
543    /// Use the Windows Precision Touchpad Collection for reporting data. Defined by Windows
544    /// Precision Touchpad Required HID Top-Level Collections: https://docs.microsoft.com/
545    /// en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required
546    /// -hid-top-level-collections).
547    WindowsPrecisionTouchpadCollection,
548    #[doc(hidden)]
549    __SourceBreaking { unknown_ordinal: u32 },
550}
551
552/// Pattern that matches an unknown `TouchConfigurationInputMode` member.
553#[macro_export]
554macro_rules! TouchConfigurationInputModeUnknown {
555    () => {
556        _
557    };
558}
559
560impl TouchConfigurationInputMode {
561    #[inline]
562    pub fn from_primitive(prim: u32) -> Option<Self> {
563        match prim {
564            0 => Some(Self::MouseCollection),
565            3 => Some(Self::WindowsPrecisionTouchpadCollection),
566            _ => None,
567        }
568    }
569
570    #[inline]
571    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
572        match prim {
573            0 => Self::MouseCollection,
574            3 => Self::WindowsPrecisionTouchpadCollection,
575            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
576        }
577    }
578
579    #[inline]
580    pub fn unknown() -> Self {
581        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
582    }
583
584    #[inline]
585    pub const fn into_primitive(self) -> u32 {
586        match self {
587            Self::MouseCollection => 0,
588            Self::WindowsPrecisionTouchpadCollection => 3,
589            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
590        }
591    }
592
593    #[inline]
594    pub fn is_unknown(&self) -> bool {
595        match self {
596            Self::__SourceBreaking { unknown_ordinal: _ } => true,
597            _ => false,
598        }
599    }
600}
601
602/// The device type from which the touch originated.
603#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
604pub enum TouchType {
605    /// A touch screen has direct finger input associated with a display.
606    Touchscreen,
607    /// A touch pad is a pointer device that tracks finger positions.
608    Touchpad,
609    #[doc(hidden)]
610    __SourceBreaking { unknown_ordinal: u32 },
611}
612
613/// Pattern that matches an unknown `TouchType` member.
614#[macro_export]
615macro_rules! TouchTypeUnknown {
616    () => {
617        _
618    };
619}
620
621impl TouchType {
622    #[inline]
623    pub fn from_primitive(prim: u32) -> Option<Self> {
624        match prim {
625            1 => Some(Self::Touchscreen),
626            2 => Some(Self::Touchpad),
627            _ => None,
628        }
629    }
630
631    #[inline]
632    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
633        match prim {
634            1 => Self::Touchscreen,
635            2 => Self::Touchpad,
636            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
637        }
638    }
639
640    #[inline]
641    pub fn unknown() -> Self {
642        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
643    }
644
645    #[inline]
646    pub const fn into_primitive(self) -> u32 {
647        match self {
648            Self::Touchscreen => 1,
649            Self::Touchpad => 2,
650            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
651        }
652    }
653
654    #[inline]
655    pub fn is_unknown(&self) -> bool {
656        match self {
657            Self::__SourceBreaking { unknown_ordinal: _ } => true,
658            _ => false,
659        }
660    }
661}
662
663/// This provides an easy, standardized way to specify units. New units can
664/// be added as needed. Each UnitType should be named after a specific unit that
665/// should be fully distinguished by the name (E.g: Use METERS instead of
666/// DISTANCE). More complicated units that need to be differentiated should
667/// begin with SI_ (for Internation System of Units) or ENGLISH_ (for English
668/// System of Units).
669#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
670pub enum UnitType {
671    /// The device did not specify units.
672    None,
673    /// The device specified units that are not convertible to any of the other units.
674    Other,
675    /// A measurement of distance in meters.
676    Meters,
677    /// A measurement of mass in grams.
678    Grams,
679    /// A measurement of rotation in degrees.
680    Degrees,
681    /// A measurement of angular velocity in degrees per second.
682    EnglishAngularVelocity,
683    /// A measurement of linear velocity in meters per second.
684    SiLinearVelocity,
685    /// A measurement of acceleration in meters per second squared.
686    SiLinearAcceleration,
687    /// A measure of magnetic flux in webers.
688    Webers,
689    /// A measurement of luminous intensity in candelas.
690    Candelas,
691    /// A measurement of pressure in pascals.
692    Pascals,
693    Lux,
694    Seconds,
695    #[doc(hidden)]
696    __SourceBreaking {
697        unknown_ordinal: u32,
698    },
699}
700
701/// Pattern that matches an unknown `UnitType` member.
702#[macro_export]
703macro_rules! UnitTypeUnknown {
704    () => {
705        _
706    };
707}
708
709impl UnitType {
710    #[inline]
711    pub fn from_primitive(prim: u32) -> Option<Self> {
712        match prim {
713            0 => Some(Self::None),
714            1 => Some(Self::Other),
715            2 => Some(Self::Meters),
716            3 => Some(Self::Grams),
717            4 => Some(Self::Degrees),
718            5 => Some(Self::EnglishAngularVelocity),
719            6 => Some(Self::SiLinearVelocity),
720            7 => Some(Self::SiLinearAcceleration),
721            8 => Some(Self::Webers),
722            9 => Some(Self::Candelas),
723            10 => Some(Self::Pascals),
724            11 => Some(Self::Lux),
725            12 => Some(Self::Seconds),
726            _ => None,
727        }
728    }
729
730    #[inline]
731    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
732        match prim {
733            0 => Self::None,
734            1 => Self::Other,
735            2 => Self::Meters,
736            3 => Self::Grams,
737            4 => Self::Degrees,
738            5 => Self::EnglishAngularVelocity,
739            6 => Self::SiLinearVelocity,
740            7 => Self::SiLinearAcceleration,
741            8 => Self::Webers,
742            9 => Self::Candelas,
743            10 => Self::Pascals,
744            11 => Self::Lux,
745            12 => Self::Seconds,
746            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
747        }
748    }
749
750    #[inline]
751    pub fn unknown() -> Self {
752        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
753    }
754
755    #[inline]
756    pub const fn into_primitive(self) -> u32 {
757        match self {
758            Self::None => 0,
759            Self::Other => 1,
760            Self::Meters => 2,
761            Self::Grams => 3,
762            Self::Degrees => 4,
763            Self::EnglishAngularVelocity => 5,
764            Self::SiLinearVelocity => 6,
765            Self::SiLinearAcceleration => 7,
766            Self::Webers => 8,
767            Self::Candelas => 9,
768            Self::Pascals => 10,
769            Self::Lux => 11,
770            Self::Seconds => 12,
771            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
772        }
773    }
774
775    #[inline]
776    pub fn is_unknown(&self) -> bool {
777        match self {
778            Self::__SourceBreaking { unknown_ordinal: _ } => true,
779            _ => false,
780        }
781    }
782}
783
784/// Below are ProductIds which represents which product this Input device represents. If the
785/// Input device is a HID device, the ProductId maps directly to the HID
786/// ProductId. If the Input device is not a HID device, then the ProductId
787/// will be greater than 0xFFFF, which is the max HID ProductId.
788#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
789pub enum VendorGoogleProductId {
790    /// Below are the non-HID VendorIds
791    FocaltechTouchscreen,
792    AmsLightSensor,
793    PcPs2Keyboard,
794    PcPs2Mouse,
795    AdcButtons,
796    GoodixTouchscreen,
797    HidButtons,
798    VirtioMouse,
799    VirtioKeyboard,
800    VirtioTouchscreen,
801    GoldfishAccelerationSensor,
802    GoldfishGyroscopeSensor,
803    GoldfishRgbcLightSensor,
804    #[doc(hidden)]
805    __SourceBreaking {
806        unknown_ordinal: u32,
807    },
808}
809
810/// Pattern that matches an unknown `VendorGoogleProductId` member.
811#[macro_export]
812macro_rules! VendorGoogleProductIdUnknown {
813    () => {
814        _
815    };
816}
817
818impl VendorGoogleProductId {
819    #[inline]
820    pub fn from_primitive(prim: u32) -> Option<Self> {
821        match prim {
822            65537 => Some(Self::FocaltechTouchscreen),
823            65538 => Some(Self::AmsLightSensor),
824            65539 => Some(Self::PcPs2Keyboard),
825            65540 => Some(Self::PcPs2Mouse),
826            65541 => Some(Self::AdcButtons),
827            65542 => Some(Self::GoodixTouchscreen),
828            65543 => Some(Self::HidButtons),
829            65544 => Some(Self::VirtioMouse),
830            65545 => Some(Self::VirtioKeyboard),
831            65546 => Some(Self::VirtioTouchscreen),
832            2417819649 => Some(Self::GoldfishAccelerationSensor),
833            2417819650 => Some(Self::GoldfishGyroscopeSensor),
834            2417819651 => Some(Self::GoldfishRgbcLightSensor),
835            _ => None,
836        }
837    }
838
839    #[inline]
840    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
841        match prim {
842            65537 => Self::FocaltechTouchscreen,
843            65538 => Self::AmsLightSensor,
844            65539 => Self::PcPs2Keyboard,
845            65540 => Self::PcPs2Mouse,
846            65541 => Self::AdcButtons,
847            65542 => Self::GoodixTouchscreen,
848            65543 => Self::HidButtons,
849            65544 => Self::VirtioMouse,
850            65545 => Self::VirtioKeyboard,
851            65546 => Self::VirtioTouchscreen,
852            2417819649 => Self::GoldfishAccelerationSensor,
853            2417819650 => Self::GoldfishGyroscopeSensor,
854            2417819651 => Self::GoldfishRgbcLightSensor,
855            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
856        }
857    }
858
859    #[inline]
860    pub fn unknown() -> Self {
861        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
862    }
863
864    #[inline]
865    pub const fn into_primitive(self) -> u32 {
866        match self {
867            Self::FocaltechTouchscreen => 65537,
868            Self::AmsLightSensor => 65538,
869            Self::PcPs2Keyboard => 65539,
870            Self::PcPs2Mouse => 65540,
871            Self::AdcButtons => 65541,
872            Self::GoodixTouchscreen => 65542,
873            Self::HidButtons => 65543,
874            Self::VirtioMouse => 65544,
875            Self::VirtioKeyboard => 65545,
876            Self::VirtioTouchscreen => 65546,
877            Self::GoldfishAccelerationSensor => 2417819649,
878            Self::GoldfishGyroscopeSensor => 2417819650,
879            Self::GoldfishRgbcLightSensor => 2417819651,
880            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
881        }
882    }
883
884    #[inline]
885    pub fn is_unknown(&self) -> bool {
886        match self {
887            Self::__SourceBreaking { unknown_ordinal: _ } => true,
888            _ => false,
889        }
890    }
891}
892
893/// The VendorId represents the vendor that created this Input device. If the
894/// Input device is a HID device, the VendorId maps directly to the HID
895/// VendorId. If the Input device is not a HID device, then the VendorId
896/// will be greater than 0xFFFF, which is the max HID VendorId.
897#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
898pub enum VendorId {
899    /// Below are the HID VendorIds, range 0x0000 - 0xFFFF.
900    Google,
901    #[doc(hidden)]
902    __SourceBreaking { unknown_ordinal: u32 },
903}
904
905/// Pattern that matches an unknown `VendorId` member.
906#[macro_export]
907macro_rules! VendorIdUnknown {
908    () => {
909        _
910    };
911}
912
913impl VendorId {
914    #[inline]
915    pub fn from_primitive(prim: u32) -> Option<Self> {
916        match prim {
917            6353 => Some(Self::Google),
918            _ => None,
919        }
920    }
921
922    #[inline]
923    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
924        match prim {
925            6353 => Self::Google,
926            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
927        }
928    }
929
930    #[inline]
931    pub fn unknown() -> Self {
932        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
933    }
934
935    #[inline]
936    pub const fn into_primitive(self) -> u32 {
937        match self {
938            Self::Google => 6353,
939            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
940        }
941    }
942
943    #[inline]
944    pub fn is_unknown(&self) -> bool {
945        match self {
946            Self::__SourceBreaking { unknown_ordinal: _ } => true,
947            _ => false,
948        }
949    }
950}
951
952/// An `Axis` is defined as a `range` and a `unit`.
953#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
954pub struct Axis {
955    pub range: Range,
956    pub unit: Unit,
957}
958
959impl fidl::Persistable for Axis {}
960
961/// DeviceInfo provides more information about the device and lets a client
962/// distinguish between devices (e.g between two touchscreens that come from
963/// different vendors). If the device is a HID device, then the id information
964/// will come from the device itself. Other, non-HID devices may assign the
965/// ids in the driver, so it will be the driver author's responsibility to
966/// assign sensible ids.
967#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
968#[repr(C)]
969pub struct DeviceInfo {
970    pub vendor_id: u32,
971    pub product_id: u32,
972    pub version: u32,
973}
974
975impl fidl::Persistable for DeviceInfo {}
976
977#[derive(Clone, Debug, PartialEq)]
978pub struct InputDeviceGetDescriptorResponse {
979    pub descriptor: DeviceDescriptor,
980}
981
982impl fidl::Persistable for InputDeviceGetDescriptorResponse {}
983
984#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
985pub struct InputDeviceGetInputReportRequest {
986    pub device_type: DeviceType,
987}
988
989impl fidl::Persistable for InputDeviceGetInputReportRequest {}
990
991#[derive(Clone, Debug, PartialEq)]
992pub struct InputDeviceSendOutputReportRequest {
993    pub report: OutputReport,
994}
995
996impl fidl::Persistable for InputDeviceSendOutputReportRequest {}
997
998#[derive(Clone, Debug, PartialEq)]
999pub struct InputDeviceSetFeatureReportRequest {
1000    pub report: FeatureReport,
1001}
1002
1003impl fidl::Persistable for InputDeviceSetFeatureReportRequest {}
1004
1005#[derive(Clone, Debug, PartialEq)]
1006pub struct InputDeviceGetFeatureReportResponse {
1007    pub report: FeatureReport,
1008}
1009
1010impl fidl::Persistable for InputDeviceGetFeatureReportResponse {}
1011
1012#[derive(Clone, Debug, PartialEq)]
1013pub struct InputDeviceGetInputReportResponse {
1014    pub report: InputReport,
1015}
1016
1017impl fidl::Persistable for InputDeviceGetInputReportResponse {}
1018
1019#[derive(Clone, Debug, PartialEq)]
1020pub struct InputReportsReaderReadInputReportsResponse {
1021    pub reports: Vec<InputReport>,
1022}
1023
1024impl fidl::Persistable for InputReportsReaderReadInputReportsResponse {}
1025
1026/// Describe a `Range` of values.
1027#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1028#[repr(C)]
1029pub struct Range {
1030    pub min: i64,
1031    pub max: i64,
1032}
1033
1034impl fidl::Persistable for Range {}
1035
1036/// A `SensorAxis` is a normal `Axis` with an additional `SensorType` to describe what the
1037/// axis is measuring.
1038#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1039pub struct SensorAxis {
1040    pub axis: Axis,
1041    pub type_: SensorType,
1042}
1043
1044impl fidl::Persistable for SensorAxis {}
1045
1046/// Describes a given unit by giving the unit and the unit's exponent.
1047/// E.g: Nanometers would have type METERS and exponent -9.
1048#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1049pub struct Unit {
1050    pub type_: UnitType,
1051    pub exponent: i32,
1052}
1053
1054impl fidl::Persistable for Unit {}
1055
1056/// A Fuchsia ConsumerControl represents a device thats purpose is to change
1057/// values on the host. Typical controls are Volume, Power, Media Playback.
1058/// (Consider a TV remote to be a typical ConsumerControl).
1059#[derive(Clone, Debug, Default, PartialEq)]
1060pub struct ConsumerControlDescriptor {
1061    pub input: Option<ConsumerControlInputDescriptor>,
1062    #[doc(hidden)]
1063    pub __source_breaking: fidl::marker::SourceBreaking,
1064}
1065
1066impl fidl::Persistable for ConsumerControlDescriptor {}
1067
1068/// Describes the format of the input report that will be sent from the
1069/// ConsumerControl device to the host.
1070#[derive(Clone, Debug, Default, PartialEq)]
1071pub struct ConsumerControlInputDescriptor {
1072    /// The list of buttons that this device contains.
1073    pub buttons: Option<Vec<ConsumerControlButton>>,
1074    #[doc(hidden)]
1075    pub __source_breaking: fidl::marker::SourceBreaking,
1076}
1077
1078impl fidl::Persistable for ConsumerControlInputDescriptor {}
1079
1080/// A single report created by a ConsumerControl device.
1081#[derive(Clone, Debug, Default, PartialEq)]
1082pub struct ConsumerControlInputReport {
1083    /// The list of buttons that are currently pressed down.
1084    pub pressed_buttons: Option<Vec<ConsumerControlButton>>,
1085    #[doc(hidden)]
1086    pub __source_breaking: fidl::marker::SourceBreaking,
1087}
1088
1089impl fidl::Persistable for ConsumerControlInputReport {}
1090
1091/// `ContactInputDescriptor` describes the fields associated with a touch on a touch device.
1092#[derive(Clone, Debug, Default, PartialEq)]
1093pub struct ContactInputDescriptor {
1094    /// Describes the reporting of the x-axis.
1095    pub position_x: Option<Axis>,
1096    /// Describes the reporting of the y-axis.
1097    pub position_y: Option<Axis>,
1098    /// Pressure of the contact.
1099    pub pressure: Option<Axis>,
1100    /// Width of the area of contact.
1101    pub contact_width: Option<Axis>,
1102    /// Height of the area of contact.
1103    pub contact_height: Option<Axis>,
1104    #[doc(hidden)]
1105    pub __source_breaking: fidl::marker::SourceBreaking,
1106}
1107
1108impl fidl::Persistable for ContactInputDescriptor {}
1109
1110/// `ContactInputReport` describes one touch on a touch device.
1111#[derive(Clone, Debug, Default, PartialEq)]
1112pub struct ContactInputReport {
1113    /// Identifier for this contact.
1114    pub contact_id: Option<u32>,
1115    /// A contact's position on the x axis.
1116    pub position_x: Option<i64>,
1117    /// A contact's position on the y axis.
1118    pub position_y: Option<i64>,
1119    /// Pressure of the contact.
1120    pub pressure: Option<i64>,
1121    /// Width of the bounding box around the touch contact. Combined with
1122    /// `contact_height`, this describes the area of the touch contact.
1123    /// `contact_width` and `contact_height` should both have units of distance,
1124    /// and they should be in the same units as `position_x` and `position_y`.
1125    pub contact_width: Option<i64>,
1126    /// Height of the bounding box around the touch contact. Combined with
1127    /// `contact_width`, this describes the area of the touch contact.
1128    /// `contact_width` and `contact_height` should both have units of distance,
1129    /// and they should be in the same units as `position_x` and `position_y`.
1130    pub contact_height: Option<i64>,
1131    /// Also known as touch valid. Indicates the device’s confidence that the touch
1132    /// contact was an intended, valid contact. The device should report 0 if the
1133    /// contact is not a valid touch. The device should report 1 if the contact is
1134    /// intended and valid (e.g. a pointing touch)
1135    pub confidence: Option<bool>,
1136    #[doc(hidden)]
1137    pub __source_breaking: fidl::marker::SourceBreaking,
1138}
1139
1140impl fidl::Persistable for ContactInputReport {}
1141
1142/// `DeviceDescriptor` describes a physical input device. Some physical devices may
1143/// send multiple types of reports (E.g: a physical touchscreen can send touch and
1144/// stylus reports, so it will have both a TouchDescriptor and a StylusDescriptor).
1145#[derive(Clone, Debug, Default, PartialEq)]
1146pub struct DeviceDescriptor {
1147    /// This field is removed. Use device_information instead.
1148    pub device_info: Option<DeviceInfo>,
1149    /// When `mouse` is present the device has a mouse.
1150    pub mouse: Option<MouseDescriptor>,
1151    /// When `sensor` is present the device has a sensor.
1152    pub sensor: Option<SensorDescriptor>,
1153    /// When `touch` is present the device has a touch device.
1154    /// (E.g: Touchscreen, touchpad).
1155    pub touch: Option<TouchDescriptor>,
1156    /// When `keyboard` is present the device has a keyboard.
1157    pub keyboard: Option<KeyboardDescriptor>,
1158    /// When `consumer_control` is present the device has a ConsumerControl
1159    /// device.
1160    pub consumer_control: Option<ConsumerControlDescriptor>,
1161    /// `device_information` should always be present to help distinguish
1162    /// between physical devices.
1163    pub device_information: Option<DeviceInformation>,
1164    #[doc(hidden)]
1165    pub __source_breaking: fidl::marker::SourceBreaking,
1166}
1167
1168impl fidl::Persistable for DeviceDescriptor {}
1169
1170/// DeviceInformation provides more information about the device and lets a
1171/// client distinguish between devices (e.g between two touchscreens that come
1172/// from different vendors). If the device is a HID device, then the id
1173/// information will come from the device itself. Other, non-HID devices may
1174/// assign the ids in the driver, so it will be the driver author's
1175/// responsibility to assign sensible ids.
1176#[derive(Clone, Debug, Default, PartialEq)]
1177pub struct DeviceInformation {
1178    pub vendor_id: Option<u32>,
1179    pub product_id: Option<u32>,
1180    pub version: Option<u32>,
1181    pub polling_rate: Option<i64>,
1182    #[doc(hidden)]
1183    pub __source_breaking: fidl::marker::SourceBreaking,
1184}
1185
1186impl fidl::Persistable for DeviceInformation {}
1187
1188/// A single report containing the feature information for an input device.
1189/// Feature reports obtained from the device show the current state of the
1190/// device. Sending a feature report to the device sets the device in that
1191/// state.
1192#[derive(Clone, Debug, Default, PartialEq)]
1193pub struct FeatureReport {
1194    pub sensor: Option<SensorFeatureReport>,
1195    pub touch: Option<TouchFeatureReport>,
1196    #[doc(hidden)]
1197    pub __source_breaking: fidl::marker::SourceBreaking,
1198}
1199
1200impl fidl::Persistable for FeatureReport {}
1201
1202/// `InputReport` is a single report that is created by an input device.
1203#[derive(Clone, Debug, Default, PartialEq)]
1204pub struct InputReport {
1205    /// `event_time` is in nanoseconds when the event was recorded.
1206    pub event_time: Option<i64>,
1207    /// `mouse` is the report generated if the device contains a mouse.
1208    pub mouse: Option<MouseInputReport>,
1209    /// Unique ID to connect trace async begin/end events.
1210    pub trace_id: Option<u64>,
1211    /// `sensor` is the report generated if the device contains a sensor.
1212    pub sensor: Option<SensorInputReport>,
1213    /// `touch` is the report generated if the device contains a touch device.
1214    pub touch: Option<TouchInputReport>,
1215    /// `keyboard` is the report generated if the device contains a keyboard.
1216    pub keyboard: Option<KeyboardInputReport>,
1217    /// `consumer_controls` is the report generated if the device contains a
1218    /// ConsumerControl device.
1219    pub consumer_control: Option<ConsumerControlInputReport>,
1220    /// The Descriptor that describes this InputReport will have a matching
1221    /// ReportID. If this doesn't exist, report_id is 0.
1222    pub report_id: Option<u8>,
1223    #[doc(hidden)]
1224    pub __source_breaking: fidl::marker::SourceBreaking,
1225}
1226
1227impl fidl::Persistable for InputReport {}
1228
1229/// The capabilities of a keyboard device.
1230#[derive(Clone, Debug, Default, PartialEq)]
1231pub struct KeyboardDescriptor {
1232    pub input: Option<KeyboardInputDescriptor>,
1233    pub output: Option<KeyboardOutputDescriptor>,
1234    #[doc(hidden)]
1235    pub __source_breaking: fidl::marker::SourceBreaking,
1236}
1237
1238impl fidl::Persistable for KeyboardDescriptor {}
1239
1240/// Describes the format of the input report that will be sent from the keyboard
1241/// to the device.
1242#[derive(Clone, Debug, Default, PartialEq)]
1243pub struct KeyboardInputDescriptor {
1244    /// The list of keys that this keyboard contains.
1245    pub keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1246    #[doc(hidden)]
1247    pub __source_breaking: fidl::marker::SourceBreaking,
1248}
1249
1250impl fidl::Persistable for KeyboardInputDescriptor {}
1251
1252/// A single report created by a keyboard device.
1253#[derive(Clone, Debug, Default, PartialEq)]
1254pub struct KeyboardInputReport {
1255    /// The list of keys that are currently pressed down.
1256    pub pressed_keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1257    #[doc(hidden)]
1258    pub __source_breaking: fidl::marker::SourceBreaking,
1259}
1260
1261impl fidl::Persistable for KeyboardInputReport {}
1262
1263/// Describes the format of the output report that can be sent to the keyboard..
1264#[derive(Clone, Debug, Default, PartialEq)]
1265pub struct KeyboardOutputDescriptor {
1266    /// The list of keyboard LEDs that can be toggled.
1267    pub leds: Option<Vec<LedType>>,
1268    #[doc(hidden)]
1269    pub __source_breaking: fidl::marker::SourceBreaking,
1270}
1271
1272impl fidl::Persistable for KeyboardOutputDescriptor {}
1273
1274/// A single report containing output information for a keyboard.
1275#[derive(Clone, Debug, Default, PartialEq)]
1276pub struct KeyboardOutputReport {
1277    /// Each LED in this list will be turned on. Any LED not in this list will be
1278    /// turned off.
1279    pub enabled_leds: Option<Vec<LedType>>,
1280    #[doc(hidden)]
1281    pub __source_breaking: fidl::marker::SourceBreaking,
1282}
1283
1284impl fidl::Persistable for KeyboardOutputReport {}
1285
1286/// The capabilities of a mouse device.
1287#[derive(Clone, Debug, Default, PartialEq)]
1288pub struct MouseDescriptor {
1289    pub input: Option<MouseInputDescriptor>,
1290    #[doc(hidden)]
1291    pub __source_breaking: fidl::marker::SourceBreaking,
1292}
1293
1294impl fidl::Persistable for MouseDescriptor {}
1295
1296/// Describes the format of the input report that will be sent from the mouse
1297/// to the device.
1298#[derive(Clone, Debug, Default, PartialEq)]
1299pub struct MouseInputDescriptor {
1300    /// The range of relative X movement.
1301    pub movement_x: Option<Axis>,
1302    /// The range of relative Y movement.
1303    pub movement_y: Option<Axis>,
1304    /// The range of relative vertical scroll.
1305    pub scroll_v: Option<Axis>,
1306    /// The range of relative horizontal scroll.
1307    pub scroll_h: Option<Axis>,
1308    /// This is a vector of ids for the mouse buttons.
1309    pub buttons: Option<Vec<u8>>,
1310    /// The range of the position of X.
1311    /// The main use of position is from virtual mice like over VNC.
1312    pub position_x: Option<Axis>,
1313    /// The range of the position of Y.
1314    /// The main use of position is from virtual mice like over VNC.
1315    pub position_y: Option<Axis>,
1316    #[doc(hidden)]
1317    pub __source_breaking: fidl::marker::SourceBreaking,
1318}
1319
1320impl fidl::Persistable for MouseInputDescriptor {}
1321
1322/// `MouseReport` gives the relative movement of the mouse and currently
1323/// pressed buttons. Relative means the movement seen between the previous
1324/// report and this report. The client is responsible for tracking this and
1325/// converting it to absolute movement.
1326#[derive(Clone, Debug, Default, PartialEq)]
1327pub struct MouseInputReport {
1328    /// Relative X positional displacement.
1329    pub movement_x: Option<i64>,
1330    /// Relative Y positional displacement.
1331    pub movement_y: Option<i64>,
1332    /// Relative vertical scrolling displacement.
1333    pub scroll_v: Option<i64>,
1334    /// Relative horizontal scrolling displacement.
1335    pub scroll_h: Option<i64>,
1336    /// A list of currently pressed buttons.
1337    pub pressed_buttons: Option<Vec<u8>>,
1338    /// The position of X.
1339    /// The main use of position is from virtual mice like over VNC.
1340    pub position_x: Option<i64>,
1341    /// The position of Y.
1342    /// The main use of position is from virtual mice like over VNC.
1343    pub position_y: Option<i64>,
1344    #[doc(hidden)]
1345    pub __source_breaking: fidl::marker::SourceBreaking,
1346}
1347
1348impl fidl::Persistable for MouseInputReport {}
1349
1350/// Describes the output reports that a physical input device will accept.
1351/// Output information typically represents device output to the user
1352/// (E.g: LEDs, tactile feedback, etc).
1353#[derive(Clone, Debug, Default, PartialEq)]
1354pub struct OutputDescriptor {
1355    pub keyboard: Option<KeyboardOutputDescriptor>,
1356    #[doc(hidden)]
1357    pub __source_breaking: fidl::marker::SourceBreaking,
1358}
1359
1360impl fidl::Persistable for OutputDescriptor {}
1361
1362/// A single report containing output information for an input device.
1363/// Output information typically represents device output to the user
1364/// (E.g: LEDs, tactile feedback, etc).
1365#[derive(Clone, Debug, Default, PartialEq)]
1366pub struct OutputReport {
1367    pub keyboard: Option<KeyboardOutputReport>,
1368    #[doc(hidden)]
1369    pub __source_breaking: fidl::marker::SourceBreaking,
1370}
1371
1372impl fidl::Persistable for OutputReport {}
1373
1374/// Selective Reporting Feature Report indicating which types of input are reported.
1375#[derive(Clone, Debug, Default, PartialEq)]
1376pub struct SelectiveReportingFeatureReport {
1377    /// If this is true, the device will report surface contacts.
1378    pub surface_switch: Option<bool>,
1379    /// If this is true, the device will report button state.
1380    pub button_switch: Option<bool>,
1381    #[doc(hidden)]
1382    pub __source_breaking: fidl::marker::SourceBreaking,
1383}
1384
1385impl fidl::Persistable for SelectiveReportingFeatureReport {}
1386
1387/// The capabilities of a sensor device.
1388#[derive(Clone, Debug, Default, PartialEq)]
1389pub struct SensorDescriptor {
1390    pub input: Option<Vec<SensorInputDescriptor>>,
1391    pub feature: Option<Vec<SensorFeatureDescriptor>>,
1392    #[doc(hidden)]
1393    pub __source_breaking: fidl::marker::SourceBreaking,
1394}
1395
1396impl fidl::Persistable for SensorDescriptor {}
1397
1398/// Describes the format of the sensor's feature report. Feature reports can be
1399/// requested from the sensor, or sent to the sensor.
1400#[derive(Clone, Debug, Default, PartialEq)]
1401pub struct SensorFeatureDescriptor {
1402    /// Describes the minimum and maximum reporting interval this sensor
1403    /// supports.
1404    pub report_interval: Option<Axis>,
1405    /// Sets the sensitivity for the given `SensorType`.
1406    pub sensitivity: Option<Vec<SensorAxis>>,
1407    /// If this is true then SensorFeatureReport supports setting a
1408    /// SensorReportingState.
1409    pub supports_reporting_state: Option<bool>,
1410    /// Sets the high threshold values for the given `SensorType`.
1411    pub threshold_high: Option<Vec<SensorAxis>>,
1412    /// Sets the low threshold values for the given `SensorType`.
1413    pub threshold_low: Option<Vec<SensorAxis>>,
1414    /// Describes the minimum and maximum sampling rate this sensor supports.
1415    pub sampling_rate: Option<Axis>,
1416    /// ReportID of current descriptor. Report with same report ID should be
1417    /// associated with this descriptor.
1418    pub report_id: Option<u8>,
1419    #[doc(hidden)]
1420    pub __source_breaking: fidl::marker::SourceBreaking,
1421}
1422
1423impl fidl::Persistable for SensorFeatureDescriptor {}
1424
1425/// A SensorFeatureReport describes the features of a given sensor. If a
1426/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1427/// If a FeatureReport is requested from the Input Device it shows the device's
1428/// current configuration.
1429#[derive(Clone, Debug, Default, PartialEq)]
1430pub struct SensorFeatureReport {
1431    /// The time between reports sent by the sensor.
1432    pub report_interval: Option<i64>,
1433    /// The sensitivity for various `SensorType`. This vector must be given in
1434    /// the order of the descriptor's `sensitivity` vector.
1435    pub sensitivity: Option<Vec<i64>>,
1436    /// This determines when the sensor will send reports.
1437    pub reporting_state: Option<SensorReportingState>,
1438    /// The high thresholds for various `SensorType`. This vector must be given in
1439    /// the order of the descriptor's `threshold_high` vector.
1440    pub threshold_high: Option<Vec<i64>>,
1441    /// The low thresholds for various `SensorType`. This vector must be given in
1442    /// the order of the descriptor's `threshold_low` vector.
1443    pub threshold_low: Option<Vec<i64>>,
1444    /// The rate at which the sensor is sampled.
1445    pub sampling_rate: Option<i64>,
1446    #[doc(hidden)]
1447    pub __source_breaking: fidl::marker::SourceBreaking,
1448}
1449
1450impl fidl::Persistable for SensorFeatureReport {}
1451
1452/// Describes the format of the input report that will be sent from the sensor
1453/// to the device.
1454#[derive(Clone, Debug, Default, PartialEq)]
1455pub struct SensorInputDescriptor {
1456    /// Each `SensorAxis` in `values` describes what a sensor is measuring and its range.
1457    /// These will directly correspond to the values in `SensorReport`.
1458    pub values: Option<Vec<SensorAxis>>,
1459    /// ReportID of current descriptor. Report with same report ID should be
1460    /// associated with this descriptor.
1461    pub report_id: Option<u8>,
1462    #[doc(hidden)]
1463    pub __source_breaking: fidl::marker::SourceBreaking,
1464}
1465
1466impl fidl::Persistable for SensorInputDescriptor {}
1467
1468/// `SensorReport` gives the values measured by a sensor at a given point in time.
1469#[derive(Clone, Debug, Default, PartialEq)]
1470pub struct SensorInputReport {
1471    /// The ordering of `values` will always directly correspond to the ordering of
1472    /// the values in `SensorDescriptor`.
1473    pub values: Option<Vec<i64>>,
1474    #[doc(hidden)]
1475    pub __source_breaking: fidl::marker::SourceBreaking,
1476}
1477
1478impl fidl::Persistable for SensorInputReport {}
1479
1480/// The capabilities of a touch device.
1481#[derive(Clone, Debug, Default, PartialEq)]
1482pub struct TouchDescriptor {
1483    pub input: Option<TouchInputDescriptor>,
1484    pub feature: Option<TouchFeatureDescriptor>,
1485    #[doc(hidden)]
1486    pub __source_breaking: fidl::marker::SourceBreaking,
1487}
1488
1489impl fidl::Persistable for TouchDescriptor {}
1490
1491/// Describes the format of the touchpad configuration's feature report. Feature reports
1492/// can be requested from the touchpad, or sent to the touchpad.
1493#[derive(Clone, Debug, Default, PartialEq)]
1494pub struct TouchFeatureDescriptor {
1495    /// Indicates whether or not touch feature descriptor supports different input modes.
1496    pub supports_input_mode: Option<bool>,
1497    /// Indicates whether or not touch feature descriptor supports selective reporting.
1498    pub supports_selective_reporting: Option<bool>,
1499    #[doc(hidden)]
1500    pub __source_breaking: fidl::marker::SourceBreaking,
1501}
1502
1503impl fidl::Persistable for TouchFeatureDescriptor {}
1504
1505/// A TouchFeatureReport describes the features of a given touch device. If a
1506/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1507/// If a FeatureReport is requested from the Input Device it shows the device's
1508/// current configuration.
1509#[derive(Clone, Debug, Default, PartialEq)]
1510pub struct TouchFeatureReport {
1511    /// The input mode currently reporting.
1512    pub input_mode: Option<TouchConfigurationInputMode>,
1513    /// The current report types being reported.
1514    pub selective_reporting: Option<SelectiveReportingFeatureReport>,
1515    #[doc(hidden)]
1516    pub __source_breaking: fidl::marker::SourceBreaking,
1517}
1518
1519impl fidl::Persistable for TouchFeatureReport {}
1520
1521/// Describes the format of the input report that will be sent from the keyboard
1522/// to the device.
1523#[derive(Clone, Debug, Default, PartialEq)]
1524pub struct TouchInputDescriptor {
1525    /// The contact descriptors associated with this touch descriptor.
1526    pub contacts: Option<Vec<ContactInputDescriptor>>,
1527    /// The max number of contacts that this touch device can report at once.
1528    pub max_contacts: Option<u32>,
1529    /// The type of touch device being used.
1530    pub touch_type: Option<TouchType>,
1531    pub buttons: Option<Vec<TouchButton>>,
1532    #[doc(hidden)]
1533    pub __source_breaking: fidl::marker::SourceBreaking,
1534}
1535
1536impl fidl::Persistable for TouchInputDescriptor {}
1537
1538/// `TouchInputReport` describes the current contacts recorded by the touchscreen.
1539#[derive(Clone, Debug, Default, PartialEq)]
1540pub struct TouchInputReport {
1541    /// The contacts currently being reported by the device.
1542    pub contacts: Option<Vec<ContactInputReport>>,
1543    pub pressed_buttons: Option<Vec<TouchButton>>,
1544    #[doc(hidden)]
1545    pub __source_breaking: fidl::marker::SourceBreaking,
1546}
1547
1548impl fidl::Persistable for TouchInputReport {}
1549
1550pub mod input_device_ordinals {
1551    pub const GET_INPUT_REPORTS_READER: u64 = 0x68d9cf83e397ab41;
1552    pub const GET_DESCRIPTOR: u64 = 0x3d76420f2ff8ad32;
1553    pub const SEND_OUTPUT_REPORT: u64 = 0x67a4888774e6f3a;
1554    pub const GET_FEATURE_REPORT: u64 = 0x497a7d98d9391f16;
1555    pub const SET_FEATURE_REPORT: u64 = 0x7679a2f5a42842ef;
1556    pub const GET_INPUT_REPORT: u64 = 0x4752ccab96c10248;
1557}
1558
1559pub mod input_reports_reader_ordinals {
1560    pub const READ_INPUT_REPORTS: u64 = 0x3595efdc88842559;
1561}
1562
1563mod internal {
1564    use super::*;
1565    unsafe impl fidl::encoding::TypeMarker for ConsumerControlButton {
1566        type Owned = Self;
1567
1568        #[inline(always)]
1569        fn inline_align(_context: fidl::encoding::Context) -> usize {
1570            std::mem::align_of::<u32>()
1571        }
1572
1573        #[inline(always)]
1574        fn inline_size(_context: fidl::encoding::Context) -> usize {
1575            std::mem::size_of::<u32>()
1576        }
1577
1578        #[inline(always)]
1579        fn encode_is_copy() -> bool {
1580            false
1581        }
1582
1583        #[inline(always)]
1584        fn decode_is_copy() -> bool {
1585            false
1586        }
1587    }
1588
1589    impl fidl::encoding::ValueTypeMarker for ConsumerControlButton {
1590        type Borrowed<'a> = Self;
1591        #[inline(always)]
1592        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1593            *value
1594        }
1595    }
1596
1597    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1598        for ConsumerControlButton
1599    {
1600        #[inline]
1601        unsafe fn encode(
1602            self,
1603            encoder: &mut fidl::encoding::Encoder<'_, D>,
1604            offset: usize,
1605            _depth: fidl::encoding::Depth,
1606        ) -> fidl::Result<()> {
1607            encoder.debug_check_bounds::<Self>(offset);
1608            encoder.write_num(self.into_primitive(), offset);
1609            Ok(())
1610        }
1611    }
1612
1613    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsumerControlButton {
1614        #[inline(always)]
1615        fn new_empty() -> Self {
1616            Self::unknown()
1617        }
1618
1619        #[inline]
1620        unsafe fn decode(
1621            &mut self,
1622            decoder: &mut fidl::encoding::Decoder<'_, D>,
1623            offset: usize,
1624            _depth: fidl::encoding::Depth,
1625        ) -> fidl::Result<()> {
1626            decoder.debug_check_bounds::<Self>(offset);
1627            let prim = decoder.read_num::<u32>(offset);
1628
1629            *self = Self::from_primitive_allow_unknown(prim);
1630            Ok(())
1631        }
1632    }
1633    unsafe impl fidl::encoding::TypeMarker for DeviceType {
1634        type Owned = Self;
1635
1636        #[inline(always)]
1637        fn inline_align(_context: fidl::encoding::Context) -> usize {
1638            std::mem::align_of::<u32>()
1639        }
1640
1641        #[inline(always)]
1642        fn inline_size(_context: fidl::encoding::Context) -> usize {
1643            std::mem::size_of::<u32>()
1644        }
1645
1646        #[inline(always)]
1647        fn encode_is_copy() -> bool {
1648            false
1649        }
1650
1651        #[inline(always)]
1652        fn decode_is_copy() -> bool {
1653            false
1654        }
1655    }
1656
1657    impl fidl::encoding::ValueTypeMarker for DeviceType {
1658        type Borrowed<'a> = Self;
1659        #[inline(always)]
1660        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1661            *value
1662        }
1663    }
1664
1665    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
1666        #[inline]
1667        unsafe fn encode(
1668            self,
1669            encoder: &mut fidl::encoding::Encoder<'_, D>,
1670            offset: usize,
1671            _depth: fidl::encoding::Depth,
1672        ) -> fidl::Result<()> {
1673            encoder.debug_check_bounds::<Self>(offset);
1674            encoder.write_num(self.into_primitive(), offset);
1675            Ok(())
1676        }
1677    }
1678
1679    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
1680        #[inline(always)]
1681        fn new_empty() -> Self {
1682            Self::unknown()
1683        }
1684
1685        #[inline]
1686        unsafe fn decode(
1687            &mut self,
1688            decoder: &mut fidl::encoding::Decoder<'_, D>,
1689            offset: usize,
1690            _depth: fidl::encoding::Depth,
1691        ) -> fidl::Result<()> {
1692            decoder.debug_check_bounds::<Self>(offset);
1693            let prim = decoder.read_num::<u32>(offset);
1694
1695            *self = Self::from_primitive_allow_unknown(prim);
1696            Ok(())
1697        }
1698    }
1699    unsafe impl fidl::encoding::TypeMarker for LedType {
1700        type Owned = Self;
1701
1702        #[inline(always)]
1703        fn inline_align(_context: fidl::encoding::Context) -> usize {
1704            std::mem::align_of::<u32>()
1705        }
1706
1707        #[inline(always)]
1708        fn inline_size(_context: fidl::encoding::Context) -> usize {
1709            std::mem::size_of::<u32>()
1710        }
1711
1712        #[inline(always)]
1713        fn encode_is_copy() -> bool {
1714            false
1715        }
1716
1717        #[inline(always)]
1718        fn decode_is_copy() -> bool {
1719            false
1720        }
1721    }
1722
1723    impl fidl::encoding::ValueTypeMarker for LedType {
1724        type Borrowed<'a> = Self;
1725        #[inline(always)]
1726        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1727            *value
1728        }
1729    }
1730
1731    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LedType {
1732        #[inline]
1733        unsafe fn encode(
1734            self,
1735            encoder: &mut fidl::encoding::Encoder<'_, D>,
1736            offset: usize,
1737            _depth: fidl::encoding::Depth,
1738        ) -> fidl::Result<()> {
1739            encoder.debug_check_bounds::<Self>(offset);
1740            encoder.write_num(self.into_primitive(), offset);
1741            Ok(())
1742        }
1743    }
1744
1745    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LedType {
1746        #[inline(always)]
1747        fn new_empty() -> Self {
1748            Self::unknown()
1749        }
1750
1751        #[inline]
1752        unsafe fn decode(
1753            &mut self,
1754            decoder: &mut fidl::encoding::Decoder<'_, D>,
1755            offset: usize,
1756            _depth: fidl::encoding::Depth,
1757        ) -> fidl::Result<()> {
1758            decoder.debug_check_bounds::<Self>(offset);
1759            let prim = decoder.read_num::<u32>(offset);
1760
1761            *self = Self::from_primitive_allow_unknown(prim);
1762            Ok(())
1763        }
1764    }
1765    unsafe impl fidl::encoding::TypeMarker for SensorReportingState {
1766        type Owned = Self;
1767
1768        #[inline(always)]
1769        fn inline_align(_context: fidl::encoding::Context) -> usize {
1770            std::mem::align_of::<u32>()
1771        }
1772
1773        #[inline(always)]
1774        fn inline_size(_context: fidl::encoding::Context) -> usize {
1775            std::mem::size_of::<u32>()
1776        }
1777
1778        #[inline(always)]
1779        fn encode_is_copy() -> bool {
1780            false
1781        }
1782
1783        #[inline(always)]
1784        fn decode_is_copy() -> bool {
1785            false
1786        }
1787    }
1788
1789    impl fidl::encoding::ValueTypeMarker for SensorReportingState {
1790        type Borrowed<'a> = Self;
1791        #[inline(always)]
1792        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1793            *value
1794        }
1795    }
1796
1797    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1798        for SensorReportingState
1799    {
1800        #[inline]
1801        unsafe fn encode(
1802            self,
1803            encoder: &mut fidl::encoding::Encoder<'_, D>,
1804            offset: usize,
1805            _depth: fidl::encoding::Depth,
1806        ) -> fidl::Result<()> {
1807            encoder.debug_check_bounds::<Self>(offset);
1808            encoder.write_num(self.into_primitive(), offset);
1809            Ok(())
1810        }
1811    }
1812
1813    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReportingState {
1814        #[inline(always)]
1815        fn new_empty() -> Self {
1816            Self::unknown()
1817        }
1818
1819        #[inline]
1820        unsafe fn decode(
1821            &mut self,
1822            decoder: &mut fidl::encoding::Decoder<'_, D>,
1823            offset: usize,
1824            _depth: fidl::encoding::Depth,
1825        ) -> fidl::Result<()> {
1826            decoder.debug_check_bounds::<Self>(offset);
1827            let prim = decoder.read_num::<u32>(offset);
1828
1829            *self = Self::from_primitive_allow_unknown(prim);
1830            Ok(())
1831        }
1832    }
1833    unsafe impl fidl::encoding::TypeMarker for SensorType {
1834        type Owned = Self;
1835
1836        #[inline(always)]
1837        fn inline_align(_context: fidl::encoding::Context) -> usize {
1838            std::mem::align_of::<u32>()
1839        }
1840
1841        #[inline(always)]
1842        fn inline_size(_context: fidl::encoding::Context) -> usize {
1843            std::mem::size_of::<u32>()
1844        }
1845
1846        #[inline(always)]
1847        fn encode_is_copy() -> bool {
1848            false
1849        }
1850
1851        #[inline(always)]
1852        fn decode_is_copy() -> bool {
1853            false
1854        }
1855    }
1856
1857    impl fidl::encoding::ValueTypeMarker for SensorType {
1858        type Borrowed<'a> = Self;
1859        #[inline(always)]
1860        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1861            *value
1862        }
1863    }
1864
1865    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1866        #[inline]
1867        unsafe fn encode(
1868            self,
1869            encoder: &mut fidl::encoding::Encoder<'_, D>,
1870            offset: usize,
1871            _depth: fidl::encoding::Depth,
1872        ) -> fidl::Result<()> {
1873            encoder.debug_check_bounds::<Self>(offset);
1874            encoder.write_num(self.into_primitive(), offset);
1875            Ok(())
1876        }
1877    }
1878
1879    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1880        #[inline(always)]
1881        fn new_empty() -> Self {
1882            Self::unknown()
1883        }
1884
1885        #[inline]
1886        unsafe fn decode(
1887            &mut self,
1888            decoder: &mut fidl::encoding::Decoder<'_, D>,
1889            offset: usize,
1890            _depth: fidl::encoding::Depth,
1891        ) -> fidl::Result<()> {
1892            decoder.debug_check_bounds::<Self>(offset);
1893            let prim = decoder.read_num::<u32>(offset);
1894
1895            *self = Self::from_primitive_allow_unknown(prim);
1896            Ok(())
1897        }
1898    }
1899    unsafe impl fidl::encoding::TypeMarker for TouchButton {
1900        type Owned = Self;
1901
1902        #[inline(always)]
1903        fn inline_align(_context: fidl::encoding::Context) -> usize {
1904            std::mem::align_of::<u8>()
1905        }
1906
1907        #[inline(always)]
1908        fn inline_size(_context: fidl::encoding::Context) -> usize {
1909            std::mem::size_of::<u8>()
1910        }
1911
1912        #[inline(always)]
1913        fn encode_is_copy() -> bool {
1914            false
1915        }
1916
1917        #[inline(always)]
1918        fn decode_is_copy() -> bool {
1919            false
1920        }
1921    }
1922
1923    impl fidl::encoding::ValueTypeMarker for TouchButton {
1924        type Borrowed<'a> = Self;
1925        #[inline(always)]
1926        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1927            *value
1928        }
1929    }
1930
1931    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchButton {
1932        #[inline]
1933        unsafe fn encode(
1934            self,
1935            encoder: &mut fidl::encoding::Encoder<'_, D>,
1936            offset: usize,
1937            _depth: fidl::encoding::Depth,
1938        ) -> fidl::Result<()> {
1939            encoder.debug_check_bounds::<Self>(offset);
1940            encoder.write_num(self.into_primitive(), offset);
1941            Ok(())
1942        }
1943    }
1944
1945    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchButton {
1946        #[inline(always)]
1947        fn new_empty() -> Self {
1948            Self::unknown()
1949        }
1950
1951        #[inline]
1952        unsafe fn decode(
1953            &mut self,
1954            decoder: &mut fidl::encoding::Decoder<'_, D>,
1955            offset: usize,
1956            _depth: fidl::encoding::Depth,
1957        ) -> fidl::Result<()> {
1958            decoder.debug_check_bounds::<Self>(offset);
1959            let prim = decoder.read_num::<u8>(offset);
1960
1961            *self = Self::from_primitive_allow_unknown(prim);
1962            Ok(())
1963        }
1964    }
1965    unsafe impl fidl::encoding::TypeMarker for TouchConfigurationInputMode {
1966        type Owned = Self;
1967
1968        #[inline(always)]
1969        fn inline_align(_context: fidl::encoding::Context) -> usize {
1970            std::mem::align_of::<u32>()
1971        }
1972
1973        #[inline(always)]
1974        fn inline_size(_context: fidl::encoding::Context) -> usize {
1975            std::mem::size_of::<u32>()
1976        }
1977
1978        #[inline(always)]
1979        fn encode_is_copy() -> bool {
1980            false
1981        }
1982
1983        #[inline(always)]
1984        fn decode_is_copy() -> bool {
1985            false
1986        }
1987    }
1988
1989    impl fidl::encoding::ValueTypeMarker for TouchConfigurationInputMode {
1990        type Borrowed<'a> = Self;
1991        #[inline(always)]
1992        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1993            *value
1994        }
1995    }
1996
1997    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1998        for TouchConfigurationInputMode
1999    {
2000        #[inline]
2001        unsafe fn encode(
2002            self,
2003            encoder: &mut fidl::encoding::Encoder<'_, D>,
2004            offset: usize,
2005            _depth: fidl::encoding::Depth,
2006        ) -> fidl::Result<()> {
2007            encoder.debug_check_bounds::<Self>(offset);
2008            encoder.write_num(self.into_primitive(), offset);
2009            Ok(())
2010        }
2011    }
2012
2013    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2014        for TouchConfigurationInputMode
2015    {
2016        #[inline(always)]
2017        fn new_empty() -> Self {
2018            Self::unknown()
2019        }
2020
2021        #[inline]
2022        unsafe fn decode(
2023            &mut self,
2024            decoder: &mut fidl::encoding::Decoder<'_, D>,
2025            offset: usize,
2026            _depth: fidl::encoding::Depth,
2027        ) -> fidl::Result<()> {
2028            decoder.debug_check_bounds::<Self>(offset);
2029            let prim = decoder.read_num::<u32>(offset);
2030
2031            *self = Self::from_primitive_allow_unknown(prim);
2032            Ok(())
2033        }
2034    }
2035    unsafe impl fidl::encoding::TypeMarker for TouchType {
2036        type Owned = Self;
2037
2038        #[inline(always)]
2039        fn inline_align(_context: fidl::encoding::Context) -> usize {
2040            std::mem::align_of::<u32>()
2041        }
2042
2043        #[inline(always)]
2044        fn inline_size(_context: fidl::encoding::Context) -> usize {
2045            std::mem::size_of::<u32>()
2046        }
2047
2048        #[inline(always)]
2049        fn encode_is_copy() -> bool {
2050            false
2051        }
2052
2053        #[inline(always)]
2054        fn decode_is_copy() -> bool {
2055            false
2056        }
2057    }
2058
2059    impl fidl::encoding::ValueTypeMarker for TouchType {
2060        type Borrowed<'a> = Self;
2061        #[inline(always)]
2062        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2063            *value
2064        }
2065    }
2066
2067    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchType {
2068        #[inline]
2069        unsafe fn encode(
2070            self,
2071            encoder: &mut fidl::encoding::Encoder<'_, D>,
2072            offset: usize,
2073            _depth: fidl::encoding::Depth,
2074        ) -> fidl::Result<()> {
2075            encoder.debug_check_bounds::<Self>(offset);
2076            encoder.write_num(self.into_primitive(), offset);
2077            Ok(())
2078        }
2079    }
2080
2081    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchType {
2082        #[inline(always)]
2083        fn new_empty() -> Self {
2084            Self::unknown()
2085        }
2086
2087        #[inline]
2088        unsafe fn decode(
2089            &mut self,
2090            decoder: &mut fidl::encoding::Decoder<'_, D>,
2091            offset: usize,
2092            _depth: fidl::encoding::Depth,
2093        ) -> fidl::Result<()> {
2094            decoder.debug_check_bounds::<Self>(offset);
2095            let prim = decoder.read_num::<u32>(offset);
2096
2097            *self = Self::from_primitive_allow_unknown(prim);
2098            Ok(())
2099        }
2100    }
2101    unsafe impl fidl::encoding::TypeMarker for UnitType {
2102        type Owned = Self;
2103
2104        #[inline(always)]
2105        fn inline_align(_context: fidl::encoding::Context) -> usize {
2106            std::mem::align_of::<u32>()
2107        }
2108
2109        #[inline(always)]
2110        fn inline_size(_context: fidl::encoding::Context) -> usize {
2111            std::mem::size_of::<u32>()
2112        }
2113
2114        #[inline(always)]
2115        fn encode_is_copy() -> bool {
2116            false
2117        }
2118
2119        #[inline(always)]
2120        fn decode_is_copy() -> bool {
2121            false
2122        }
2123    }
2124
2125    impl fidl::encoding::ValueTypeMarker for UnitType {
2126        type Borrowed<'a> = Self;
2127        #[inline(always)]
2128        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2129            *value
2130        }
2131    }
2132
2133    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UnitType {
2134        #[inline]
2135        unsafe fn encode(
2136            self,
2137            encoder: &mut fidl::encoding::Encoder<'_, D>,
2138            offset: usize,
2139            _depth: fidl::encoding::Depth,
2140        ) -> fidl::Result<()> {
2141            encoder.debug_check_bounds::<Self>(offset);
2142            encoder.write_num(self.into_primitive(), offset);
2143            Ok(())
2144        }
2145    }
2146
2147    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnitType {
2148        #[inline(always)]
2149        fn new_empty() -> Self {
2150            Self::unknown()
2151        }
2152
2153        #[inline]
2154        unsafe fn decode(
2155            &mut self,
2156            decoder: &mut fidl::encoding::Decoder<'_, D>,
2157            offset: usize,
2158            _depth: fidl::encoding::Depth,
2159        ) -> fidl::Result<()> {
2160            decoder.debug_check_bounds::<Self>(offset);
2161            let prim = decoder.read_num::<u32>(offset);
2162
2163            *self = Self::from_primitive_allow_unknown(prim);
2164            Ok(())
2165        }
2166    }
2167    unsafe impl fidl::encoding::TypeMarker for VendorGoogleProductId {
2168        type Owned = Self;
2169
2170        #[inline(always)]
2171        fn inline_align(_context: fidl::encoding::Context) -> usize {
2172            std::mem::align_of::<u32>()
2173        }
2174
2175        #[inline(always)]
2176        fn inline_size(_context: fidl::encoding::Context) -> usize {
2177            std::mem::size_of::<u32>()
2178        }
2179
2180        #[inline(always)]
2181        fn encode_is_copy() -> bool {
2182            false
2183        }
2184
2185        #[inline(always)]
2186        fn decode_is_copy() -> bool {
2187            false
2188        }
2189    }
2190
2191    impl fidl::encoding::ValueTypeMarker for VendorGoogleProductId {
2192        type Borrowed<'a> = Self;
2193        #[inline(always)]
2194        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2195            *value
2196        }
2197    }
2198
2199    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2200        for VendorGoogleProductId
2201    {
2202        #[inline]
2203        unsafe fn encode(
2204            self,
2205            encoder: &mut fidl::encoding::Encoder<'_, D>,
2206            offset: usize,
2207            _depth: fidl::encoding::Depth,
2208        ) -> fidl::Result<()> {
2209            encoder.debug_check_bounds::<Self>(offset);
2210            encoder.write_num(self.into_primitive(), offset);
2211            Ok(())
2212        }
2213    }
2214
2215    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorGoogleProductId {
2216        #[inline(always)]
2217        fn new_empty() -> Self {
2218            Self::unknown()
2219        }
2220
2221        #[inline]
2222        unsafe fn decode(
2223            &mut self,
2224            decoder: &mut fidl::encoding::Decoder<'_, D>,
2225            offset: usize,
2226            _depth: fidl::encoding::Depth,
2227        ) -> fidl::Result<()> {
2228            decoder.debug_check_bounds::<Self>(offset);
2229            let prim = decoder.read_num::<u32>(offset);
2230
2231            *self = Self::from_primitive_allow_unknown(prim);
2232            Ok(())
2233        }
2234    }
2235    unsafe impl fidl::encoding::TypeMarker for VendorId {
2236        type Owned = Self;
2237
2238        #[inline(always)]
2239        fn inline_align(_context: fidl::encoding::Context) -> usize {
2240            std::mem::align_of::<u32>()
2241        }
2242
2243        #[inline(always)]
2244        fn inline_size(_context: fidl::encoding::Context) -> usize {
2245            std::mem::size_of::<u32>()
2246        }
2247
2248        #[inline(always)]
2249        fn encode_is_copy() -> bool {
2250            false
2251        }
2252
2253        #[inline(always)]
2254        fn decode_is_copy() -> bool {
2255            false
2256        }
2257    }
2258
2259    impl fidl::encoding::ValueTypeMarker for VendorId {
2260        type Borrowed<'a> = Self;
2261        #[inline(always)]
2262        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2263            *value
2264        }
2265    }
2266
2267    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for VendorId {
2268        #[inline]
2269        unsafe fn encode(
2270            self,
2271            encoder: &mut fidl::encoding::Encoder<'_, D>,
2272            offset: usize,
2273            _depth: fidl::encoding::Depth,
2274        ) -> fidl::Result<()> {
2275            encoder.debug_check_bounds::<Self>(offset);
2276            encoder.write_num(self.into_primitive(), offset);
2277            Ok(())
2278        }
2279    }
2280
2281    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorId {
2282        #[inline(always)]
2283        fn new_empty() -> Self {
2284            Self::unknown()
2285        }
2286
2287        #[inline]
2288        unsafe fn decode(
2289            &mut self,
2290            decoder: &mut fidl::encoding::Decoder<'_, D>,
2291            offset: usize,
2292            _depth: fidl::encoding::Depth,
2293        ) -> fidl::Result<()> {
2294            decoder.debug_check_bounds::<Self>(offset);
2295            let prim = decoder.read_num::<u32>(offset);
2296
2297            *self = Self::from_primitive_allow_unknown(prim);
2298            Ok(())
2299        }
2300    }
2301
2302    impl fidl::encoding::ValueTypeMarker for Axis {
2303        type Borrowed<'a> = &'a Self;
2304        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2305            value
2306        }
2307    }
2308
2309    unsafe impl fidl::encoding::TypeMarker for Axis {
2310        type Owned = Self;
2311
2312        #[inline(always)]
2313        fn inline_align(_context: fidl::encoding::Context) -> usize {
2314            8
2315        }
2316
2317        #[inline(always)]
2318        fn inline_size(_context: fidl::encoding::Context) -> usize {
2319            24
2320        }
2321    }
2322
2323    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
2324        #[inline]
2325        unsafe fn encode(
2326            self,
2327            encoder: &mut fidl::encoding::Encoder<'_, D>,
2328            offset: usize,
2329            _depth: fidl::encoding::Depth,
2330        ) -> fidl::Result<()> {
2331            encoder.debug_check_bounds::<Axis>(offset);
2332            // Delegate to tuple encoding.
2333            fidl::encoding::Encode::<Axis, D>::encode(
2334                (
2335                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2336                    <Unit as fidl::encoding::ValueTypeMarker>::borrow(&self.unit),
2337                ),
2338                encoder,
2339                offset,
2340                _depth,
2341            )
2342        }
2343    }
2344    unsafe impl<
2345            D: fidl::encoding::ResourceDialect,
2346            T0: fidl::encoding::Encode<Range, D>,
2347            T1: fidl::encoding::Encode<Unit, D>,
2348        > fidl::encoding::Encode<Axis, D> for (T0, T1)
2349    {
2350        #[inline]
2351        unsafe fn encode(
2352            self,
2353            encoder: &mut fidl::encoding::Encoder<'_, D>,
2354            offset: usize,
2355            depth: fidl::encoding::Depth,
2356        ) -> fidl::Result<()> {
2357            encoder.debug_check_bounds::<Axis>(offset);
2358            // Zero out padding regions. There's no need to apply masks
2359            // because the unmasked parts will be overwritten by fields.
2360            // Write the fields.
2361            self.0.encode(encoder, offset + 0, depth)?;
2362            self.1.encode(encoder, offset + 16, depth)?;
2363            Ok(())
2364        }
2365    }
2366
2367    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
2368        #[inline(always)]
2369        fn new_empty() -> Self {
2370            Self { range: fidl::new_empty!(Range, D), unit: fidl::new_empty!(Unit, D) }
2371        }
2372
2373        #[inline]
2374        unsafe fn decode(
2375            &mut self,
2376            decoder: &mut fidl::encoding::Decoder<'_, D>,
2377            offset: usize,
2378            _depth: fidl::encoding::Depth,
2379        ) -> fidl::Result<()> {
2380            decoder.debug_check_bounds::<Self>(offset);
2381            // Verify that padding bytes are zero.
2382            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
2383            fidl::decode!(Unit, D, &mut self.unit, decoder, offset + 16, _depth)?;
2384            Ok(())
2385        }
2386    }
2387
2388    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2389        type Borrowed<'a> = &'a Self;
2390        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2391            value
2392        }
2393    }
2394
2395    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2396        type Owned = Self;
2397
2398        #[inline(always)]
2399        fn inline_align(_context: fidl::encoding::Context) -> usize {
2400            4
2401        }
2402
2403        #[inline(always)]
2404        fn inline_size(_context: fidl::encoding::Context) -> usize {
2405            12
2406        }
2407        #[inline(always)]
2408        fn encode_is_copy() -> bool {
2409            true
2410        }
2411
2412        #[inline(always)]
2413        fn decode_is_copy() -> bool {
2414            true
2415        }
2416    }
2417
2418    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2419        for &DeviceInfo
2420    {
2421        #[inline]
2422        unsafe fn encode(
2423            self,
2424            encoder: &mut fidl::encoding::Encoder<'_, D>,
2425            offset: usize,
2426            _depth: fidl::encoding::Depth,
2427        ) -> fidl::Result<()> {
2428            encoder.debug_check_bounds::<DeviceInfo>(offset);
2429            unsafe {
2430                // Copy the object into the buffer.
2431                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2432                (buf_ptr as *mut DeviceInfo).write_unaligned((self as *const DeviceInfo).read());
2433                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2434                // done second because the memcpy will write garbage to these bytes.
2435            }
2436            Ok(())
2437        }
2438    }
2439    unsafe impl<
2440            D: fidl::encoding::ResourceDialect,
2441            T0: fidl::encoding::Encode<u32, D>,
2442            T1: fidl::encoding::Encode<u32, D>,
2443            T2: fidl::encoding::Encode<u32, D>,
2444        > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2)
2445    {
2446        #[inline]
2447        unsafe fn encode(
2448            self,
2449            encoder: &mut fidl::encoding::Encoder<'_, D>,
2450            offset: usize,
2451            depth: fidl::encoding::Depth,
2452        ) -> fidl::Result<()> {
2453            encoder.debug_check_bounds::<DeviceInfo>(offset);
2454            // Zero out padding regions. There's no need to apply masks
2455            // because the unmasked parts will be overwritten by fields.
2456            // Write the fields.
2457            self.0.encode(encoder, offset + 0, depth)?;
2458            self.1.encode(encoder, offset + 4, depth)?;
2459            self.2.encode(encoder, offset + 8, depth)?;
2460            Ok(())
2461        }
2462    }
2463
2464    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2465        #[inline(always)]
2466        fn new_empty() -> Self {
2467            Self {
2468                vendor_id: fidl::new_empty!(u32, D),
2469                product_id: fidl::new_empty!(u32, D),
2470                version: fidl::new_empty!(u32, D),
2471            }
2472        }
2473
2474        #[inline]
2475        unsafe fn decode(
2476            &mut self,
2477            decoder: &mut fidl::encoding::Decoder<'_, D>,
2478            offset: usize,
2479            _depth: fidl::encoding::Depth,
2480        ) -> fidl::Result<()> {
2481            decoder.debug_check_bounds::<Self>(offset);
2482            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2483            // Verify that padding bytes are zero.
2484            // Copy from the buffer into the object.
2485            unsafe {
2486                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2487            }
2488            Ok(())
2489        }
2490    }
2491
2492    impl fidl::encoding::ValueTypeMarker for InputDeviceGetDescriptorResponse {
2493        type Borrowed<'a> = &'a Self;
2494        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2495            value
2496        }
2497    }
2498
2499    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetDescriptorResponse {
2500        type Owned = Self;
2501
2502        #[inline(always)]
2503        fn inline_align(_context: fidl::encoding::Context) -> usize {
2504            8
2505        }
2506
2507        #[inline(always)]
2508        fn inline_size(_context: fidl::encoding::Context) -> usize {
2509            16
2510        }
2511    }
2512
2513    unsafe impl<D: fidl::encoding::ResourceDialect>
2514        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D>
2515        for &InputDeviceGetDescriptorResponse
2516    {
2517        #[inline]
2518        unsafe fn encode(
2519            self,
2520            encoder: &mut fidl::encoding::Encoder<'_, D>,
2521            offset: usize,
2522            _depth: fidl::encoding::Depth,
2523        ) -> fidl::Result<()> {
2524            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2525            // Delegate to tuple encoding.
2526            fidl::encoding::Encode::<InputDeviceGetDescriptorResponse, D>::encode(
2527                (<DeviceDescriptor as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptor),),
2528                encoder,
2529                offset,
2530                _depth,
2531            )
2532        }
2533    }
2534    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceDescriptor, D>>
2535        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D> for (T0,)
2536    {
2537        #[inline]
2538        unsafe fn encode(
2539            self,
2540            encoder: &mut fidl::encoding::Encoder<'_, D>,
2541            offset: usize,
2542            depth: fidl::encoding::Depth,
2543        ) -> fidl::Result<()> {
2544            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2545            // Zero out padding regions. There's no need to apply masks
2546            // because the unmasked parts will be overwritten by fields.
2547            // Write the fields.
2548            self.0.encode(encoder, offset + 0, depth)?;
2549            Ok(())
2550        }
2551    }
2552
2553    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2554        for InputDeviceGetDescriptorResponse
2555    {
2556        #[inline(always)]
2557        fn new_empty() -> Self {
2558            Self { descriptor: fidl::new_empty!(DeviceDescriptor, D) }
2559        }
2560
2561        #[inline]
2562        unsafe fn decode(
2563            &mut self,
2564            decoder: &mut fidl::encoding::Decoder<'_, D>,
2565            offset: usize,
2566            _depth: fidl::encoding::Depth,
2567        ) -> fidl::Result<()> {
2568            decoder.debug_check_bounds::<Self>(offset);
2569            // Verify that padding bytes are zero.
2570            fidl::decode!(DeviceDescriptor, D, &mut self.descriptor, decoder, offset + 0, _depth)?;
2571            Ok(())
2572        }
2573    }
2574
2575    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportRequest {
2576        type Borrowed<'a> = &'a Self;
2577        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2578            value
2579        }
2580    }
2581
2582    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportRequest {
2583        type Owned = Self;
2584
2585        #[inline(always)]
2586        fn inline_align(_context: fidl::encoding::Context) -> usize {
2587            4
2588        }
2589
2590        #[inline(always)]
2591        fn inline_size(_context: fidl::encoding::Context) -> usize {
2592            4
2593        }
2594    }
2595
2596    unsafe impl<D: fidl::encoding::ResourceDialect>
2597        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D>
2598        for &InputDeviceGetInputReportRequest
2599    {
2600        #[inline]
2601        unsafe fn encode(
2602            self,
2603            encoder: &mut fidl::encoding::Encoder<'_, D>,
2604            offset: usize,
2605            _depth: fidl::encoding::Depth,
2606        ) -> fidl::Result<()> {
2607            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2608            // Delegate to tuple encoding.
2609            fidl::encoding::Encode::<InputDeviceGetInputReportRequest, D>::encode(
2610                (<DeviceType as fidl::encoding::ValueTypeMarker>::borrow(&self.device_type),),
2611                encoder,
2612                offset,
2613                _depth,
2614            )
2615        }
2616    }
2617    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceType, D>>
2618        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D> for (T0,)
2619    {
2620        #[inline]
2621        unsafe fn encode(
2622            self,
2623            encoder: &mut fidl::encoding::Encoder<'_, D>,
2624            offset: usize,
2625            depth: fidl::encoding::Depth,
2626        ) -> fidl::Result<()> {
2627            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2628            // Zero out padding regions. There's no need to apply masks
2629            // because the unmasked parts will be overwritten by fields.
2630            // Write the fields.
2631            self.0.encode(encoder, offset + 0, depth)?;
2632            Ok(())
2633        }
2634    }
2635
2636    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2637        for InputDeviceGetInputReportRequest
2638    {
2639        #[inline(always)]
2640        fn new_empty() -> Self {
2641            Self { device_type: fidl::new_empty!(DeviceType, D) }
2642        }
2643
2644        #[inline]
2645        unsafe fn decode(
2646            &mut self,
2647            decoder: &mut fidl::encoding::Decoder<'_, D>,
2648            offset: usize,
2649            _depth: fidl::encoding::Depth,
2650        ) -> fidl::Result<()> {
2651            decoder.debug_check_bounds::<Self>(offset);
2652            // Verify that padding bytes are zero.
2653            fidl::decode!(DeviceType, D, &mut self.device_type, decoder, offset + 0, _depth)?;
2654            Ok(())
2655        }
2656    }
2657
2658    impl fidl::encoding::ValueTypeMarker for InputDeviceSendOutputReportRequest {
2659        type Borrowed<'a> = &'a Self;
2660        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2661            value
2662        }
2663    }
2664
2665    unsafe impl fidl::encoding::TypeMarker for InputDeviceSendOutputReportRequest {
2666        type Owned = Self;
2667
2668        #[inline(always)]
2669        fn inline_align(_context: fidl::encoding::Context) -> usize {
2670            8
2671        }
2672
2673        #[inline(always)]
2674        fn inline_size(_context: fidl::encoding::Context) -> usize {
2675            16
2676        }
2677    }
2678
2679    unsafe impl<D: fidl::encoding::ResourceDialect>
2680        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D>
2681        for &InputDeviceSendOutputReportRequest
2682    {
2683        #[inline]
2684        unsafe fn encode(
2685            self,
2686            encoder: &mut fidl::encoding::Encoder<'_, D>,
2687            offset: usize,
2688            _depth: fidl::encoding::Depth,
2689        ) -> fidl::Result<()> {
2690            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2691            // Delegate to tuple encoding.
2692            fidl::encoding::Encode::<InputDeviceSendOutputReportRequest, D>::encode(
2693                (<OutputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2694                encoder,
2695                offset,
2696                _depth,
2697            )
2698        }
2699    }
2700    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OutputReport, D>>
2701        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D> for (T0,)
2702    {
2703        #[inline]
2704        unsafe fn encode(
2705            self,
2706            encoder: &mut fidl::encoding::Encoder<'_, D>,
2707            offset: usize,
2708            depth: fidl::encoding::Depth,
2709        ) -> fidl::Result<()> {
2710            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2711            // Zero out padding regions. There's no need to apply masks
2712            // because the unmasked parts will be overwritten by fields.
2713            // Write the fields.
2714            self.0.encode(encoder, offset + 0, depth)?;
2715            Ok(())
2716        }
2717    }
2718
2719    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2720        for InputDeviceSendOutputReportRequest
2721    {
2722        #[inline(always)]
2723        fn new_empty() -> Self {
2724            Self { report: fidl::new_empty!(OutputReport, D) }
2725        }
2726
2727        #[inline]
2728        unsafe fn decode(
2729            &mut self,
2730            decoder: &mut fidl::encoding::Decoder<'_, D>,
2731            offset: usize,
2732            _depth: fidl::encoding::Depth,
2733        ) -> fidl::Result<()> {
2734            decoder.debug_check_bounds::<Self>(offset);
2735            // Verify that padding bytes are zero.
2736            fidl::decode!(OutputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2737            Ok(())
2738        }
2739    }
2740
2741    impl fidl::encoding::ValueTypeMarker for InputDeviceSetFeatureReportRequest {
2742        type Borrowed<'a> = &'a Self;
2743        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2744            value
2745        }
2746    }
2747
2748    unsafe impl fidl::encoding::TypeMarker for InputDeviceSetFeatureReportRequest {
2749        type Owned = Self;
2750
2751        #[inline(always)]
2752        fn inline_align(_context: fidl::encoding::Context) -> usize {
2753            8
2754        }
2755
2756        #[inline(always)]
2757        fn inline_size(_context: fidl::encoding::Context) -> usize {
2758            16
2759        }
2760    }
2761
2762    unsafe impl<D: fidl::encoding::ResourceDialect>
2763        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D>
2764        for &InputDeviceSetFeatureReportRequest
2765    {
2766        #[inline]
2767        unsafe fn encode(
2768            self,
2769            encoder: &mut fidl::encoding::Encoder<'_, D>,
2770            offset: usize,
2771            _depth: fidl::encoding::Depth,
2772        ) -> fidl::Result<()> {
2773            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2774            // Delegate to tuple encoding.
2775            fidl::encoding::Encode::<InputDeviceSetFeatureReportRequest, D>::encode(
2776                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2777                encoder,
2778                offset,
2779                _depth,
2780            )
2781        }
2782    }
2783    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2784        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D> for (T0,)
2785    {
2786        #[inline]
2787        unsafe fn encode(
2788            self,
2789            encoder: &mut fidl::encoding::Encoder<'_, D>,
2790            offset: usize,
2791            depth: fidl::encoding::Depth,
2792        ) -> fidl::Result<()> {
2793            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2794            // Zero out padding regions. There's no need to apply masks
2795            // because the unmasked parts will be overwritten by fields.
2796            // Write the fields.
2797            self.0.encode(encoder, offset + 0, depth)?;
2798            Ok(())
2799        }
2800    }
2801
2802    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2803        for InputDeviceSetFeatureReportRequest
2804    {
2805        #[inline(always)]
2806        fn new_empty() -> Self {
2807            Self { report: fidl::new_empty!(FeatureReport, D) }
2808        }
2809
2810        #[inline]
2811        unsafe fn decode(
2812            &mut self,
2813            decoder: &mut fidl::encoding::Decoder<'_, D>,
2814            offset: usize,
2815            _depth: fidl::encoding::Depth,
2816        ) -> fidl::Result<()> {
2817            decoder.debug_check_bounds::<Self>(offset);
2818            // Verify that padding bytes are zero.
2819            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2820            Ok(())
2821        }
2822    }
2823
2824    impl fidl::encoding::ValueTypeMarker for InputDeviceGetFeatureReportResponse {
2825        type Borrowed<'a> = &'a Self;
2826        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2827            value
2828        }
2829    }
2830
2831    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetFeatureReportResponse {
2832        type Owned = Self;
2833
2834        #[inline(always)]
2835        fn inline_align(_context: fidl::encoding::Context) -> usize {
2836            8
2837        }
2838
2839        #[inline(always)]
2840        fn inline_size(_context: fidl::encoding::Context) -> usize {
2841            16
2842        }
2843    }
2844
2845    unsafe impl<D: fidl::encoding::ResourceDialect>
2846        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D>
2847        for &InputDeviceGetFeatureReportResponse
2848    {
2849        #[inline]
2850        unsafe fn encode(
2851            self,
2852            encoder: &mut fidl::encoding::Encoder<'_, D>,
2853            offset: usize,
2854            _depth: fidl::encoding::Depth,
2855        ) -> fidl::Result<()> {
2856            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2857            // Delegate to tuple encoding.
2858            fidl::encoding::Encode::<InputDeviceGetFeatureReportResponse, D>::encode(
2859                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2860                encoder,
2861                offset,
2862                _depth,
2863            )
2864        }
2865    }
2866    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2867        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D> for (T0,)
2868    {
2869        #[inline]
2870        unsafe fn encode(
2871            self,
2872            encoder: &mut fidl::encoding::Encoder<'_, D>,
2873            offset: usize,
2874            depth: fidl::encoding::Depth,
2875        ) -> fidl::Result<()> {
2876            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2877            // Zero out padding regions. There's no need to apply masks
2878            // because the unmasked parts will be overwritten by fields.
2879            // Write the fields.
2880            self.0.encode(encoder, offset + 0, depth)?;
2881            Ok(())
2882        }
2883    }
2884
2885    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2886        for InputDeviceGetFeatureReportResponse
2887    {
2888        #[inline(always)]
2889        fn new_empty() -> Self {
2890            Self { report: fidl::new_empty!(FeatureReport, D) }
2891        }
2892
2893        #[inline]
2894        unsafe fn decode(
2895            &mut self,
2896            decoder: &mut fidl::encoding::Decoder<'_, D>,
2897            offset: usize,
2898            _depth: fidl::encoding::Depth,
2899        ) -> fidl::Result<()> {
2900            decoder.debug_check_bounds::<Self>(offset);
2901            // Verify that padding bytes are zero.
2902            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2903            Ok(())
2904        }
2905    }
2906
2907    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportResponse {
2908        type Borrowed<'a> = &'a Self;
2909        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2910            value
2911        }
2912    }
2913
2914    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2915        type Owned = Self;
2916
2917        #[inline(always)]
2918        fn inline_align(_context: fidl::encoding::Context) -> usize {
2919            8
2920        }
2921
2922        #[inline(always)]
2923        fn inline_size(_context: fidl::encoding::Context) -> usize {
2924            16
2925        }
2926    }
2927
2928    unsafe impl<D: fidl::encoding::ResourceDialect>
2929        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D>
2930        for &InputDeviceGetInputReportResponse
2931    {
2932        #[inline]
2933        unsafe fn encode(
2934            self,
2935            encoder: &mut fidl::encoding::Encoder<'_, D>,
2936            offset: usize,
2937            _depth: fidl::encoding::Depth,
2938        ) -> fidl::Result<()> {
2939            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2940            // Delegate to tuple encoding.
2941            fidl::encoding::Encode::<InputDeviceGetInputReportResponse, D>::encode(
2942                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2943                encoder,
2944                offset,
2945                _depth,
2946            )
2947        }
2948    }
2949    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2950        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D> for (T0,)
2951    {
2952        #[inline]
2953        unsafe fn encode(
2954            self,
2955            encoder: &mut fidl::encoding::Encoder<'_, D>,
2956            offset: usize,
2957            depth: fidl::encoding::Depth,
2958        ) -> fidl::Result<()> {
2959            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2960            // Zero out padding regions. There's no need to apply masks
2961            // because the unmasked parts will be overwritten by fields.
2962            // Write the fields.
2963            self.0.encode(encoder, offset + 0, depth)?;
2964            Ok(())
2965        }
2966    }
2967
2968    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2969        for InputDeviceGetInputReportResponse
2970    {
2971        #[inline(always)]
2972        fn new_empty() -> Self {
2973            Self { report: fidl::new_empty!(InputReport, D) }
2974        }
2975
2976        #[inline]
2977        unsafe fn decode(
2978            &mut self,
2979            decoder: &mut fidl::encoding::Decoder<'_, D>,
2980            offset: usize,
2981            _depth: fidl::encoding::Depth,
2982        ) -> fidl::Result<()> {
2983            decoder.debug_check_bounds::<Self>(offset);
2984            // Verify that padding bytes are zero.
2985            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2986            Ok(())
2987        }
2988    }
2989
2990    impl fidl::encoding::ValueTypeMarker for InputReportsReaderReadInputReportsResponse {
2991        type Borrowed<'a> = &'a Self;
2992        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2993            value
2994        }
2995    }
2996
2997    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2998        type Owned = Self;
2999
3000        #[inline(always)]
3001        fn inline_align(_context: fidl::encoding::Context) -> usize {
3002            8
3003        }
3004
3005        #[inline(always)]
3006        fn inline_size(_context: fidl::encoding::Context) -> usize {
3007            16
3008        }
3009    }
3010
3011    unsafe impl<D: fidl::encoding::ResourceDialect>
3012        fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D>
3013        for &InputReportsReaderReadInputReportsResponse
3014    {
3015        #[inline]
3016        unsafe fn encode(
3017            self,
3018            encoder: &mut fidl::encoding::Encoder<'_, D>,
3019            offset: usize,
3020            _depth: fidl::encoding::Depth,
3021        ) -> fidl::Result<()> {
3022            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
3023            // Delegate to tuple encoding.
3024            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, D>::encode(
3025                (
3026                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.reports),
3027                ),
3028                encoder, offset, _depth
3029            )
3030        }
3031    }
3032    unsafe impl<
3033            D: fidl::encoding::ResourceDialect,
3034            T0: fidl::encoding::Encode<fidl::encoding::Vector<InputReport, 50>, D>,
3035        > fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D> for (T0,)
3036    {
3037        #[inline]
3038        unsafe fn encode(
3039            self,
3040            encoder: &mut fidl::encoding::Encoder<'_, D>,
3041            offset: usize,
3042            depth: fidl::encoding::Depth,
3043        ) -> fidl::Result<()> {
3044            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
3045            // Zero out padding regions. There's no need to apply masks
3046            // because the unmasked parts will be overwritten by fields.
3047            // Write the fields.
3048            self.0.encode(encoder, offset + 0, depth)?;
3049            Ok(())
3050        }
3051    }
3052
3053    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3054        for InputReportsReaderReadInputReportsResponse
3055    {
3056        #[inline(always)]
3057        fn new_empty() -> Self {
3058            Self { reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, D) }
3059        }
3060
3061        #[inline]
3062        unsafe fn decode(
3063            &mut self,
3064            decoder: &mut fidl::encoding::Decoder<'_, D>,
3065            offset: usize,
3066            _depth: fidl::encoding::Depth,
3067        ) -> fidl::Result<()> {
3068            decoder.debug_check_bounds::<Self>(offset);
3069            // Verify that padding bytes are zero.
3070            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, D, &mut self.reports, decoder, offset + 0, _depth)?;
3071            Ok(())
3072        }
3073    }
3074
3075    impl fidl::encoding::ValueTypeMarker for Range {
3076        type Borrowed<'a> = &'a Self;
3077        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3078            value
3079        }
3080    }
3081
3082    unsafe impl fidl::encoding::TypeMarker for Range {
3083        type Owned = Self;
3084
3085        #[inline(always)]
3086        fn inline_align(_context: fidl::encoding::Context) -> usize {
3087            8
3088        }
3089
3090        #[inline(always)]
3091        fn inline_size(_context: fidl::encoding::Context) -> usize {
3092            16
3093        }
3094        #[inline(always)]
3095        fn encode_is_copy() -> bool {
3096            true
3097        }
3098
3099        #[inline(always)]
3100        fn decode_is_copy() -> bool {
3101            true
3102        }
3103    }
3104
3105    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
3106        #[inline]
3107        unsafe fn encode(
3108            self,
3109            encoder: &mut fidl::encoding::Encoder<'_, D>,
3110            offset: usize,
3111            _depth: fidl::encoding::Depth,
3112        ) -> fidl::Result<()> {
3113            encoder.debug_check_bounds::<Range>(offset);
3114            unsafe {
3115                // Copy the object into the buffer.
3116                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3117                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
3118                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3119                // done second because the memcpy will write garbage to these bytes.
3120            }
3121            Ok(())
3122        }
3123    }
3124    unsafe impl<
3125            D: fidl::encoding::ResourceDialect,
3126            T0: fidl::encoding::Encode<i64, D>,
3127            T1: fidl::encoding::Encode<i64, D>,
3128        > fidl::encoding::Encode<Range, D> for (T0, T1)
3129    {
3130        #[inline]
3131        unsafe fn encode(
3132            self,
3133            encoder: &mut fidl::encoding::Encoder<'_, D>,
3134            offset: usize,
3135            depth: fidl::encoding::Depth,
3136        ) -> fidl::Result<()> {
3137            encoder.debug_check_bounds::<Range>(offset);
3138            // Zero out padding regions. There's no need to apply masks
3139            // because the unmasked parts will be overwritten by fields.
3140            // Write the fields.
3141            self.0.encode(encoder, offset + 0, depth)?;
3142            self.1.encode(encoder, offset + 8, depth)?;
3143            Ok(())
3144        }
3145    }
3146
3147    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
3148        #[inline(always)]
3149        fn new_empty() -> Self {
3150            Self { min: fidl::new_empty!(i64, D), max: fidl::new_empty!(i64, D) }
3151        }
3152
3153        #[inline]
3154        unsafe fn decode(
3155            &mut self,
3156            decoder: &mut fidl::encoding::Decoder<'_, D>,
3157            offset: usize,
3158            _depth: fidl::encoding::Depth,
3159        ) -> fidl::Result<()> {
3160            decoder.debug_check_bounds::<Self>(offset);
3161            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3162            // Verify that padding bytes are zero.
3163            // Copy from the buffer into the object.
3164            unsafe {
3165                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3166            }
3167            Ok(())
3168        }
3169    }
3170
3171    impl fidl::encoding::ValueTypeMarker for SensorAxis {
3172        type Borrowed<'a> = &'a Self;
3173        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3174            value
3175        }
3176    }
3177
3178    unsafe impl fidl::encoding::TypeMarker for SensorAxis {
3179        type Owned = Self;
3180
3181        #[inline(always)]
3182        fn inline_align(_context: fidl::encoding::Context) -> usize {
3183            8
3184        }
3185
3186        #[inline(always)]
3187        fn inline_size(_context: fidl::encoding::Context) -> usize {
3188            32
3189        }
3190    }
3191
3192    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorAxis, D>
3193        for &SensorAxis
3194    {
3195        #[inline]
3196        unsafe fn encode(
3197            self,
3198            encoder: &mut fidl::encoding::Encoder<'_, D>,
3199            offset: usize,
3200            _depth: fidl::encoding::Depth,
3201        ) -> fidl::Result<()> {
3202            encoder.debug_check_bounds::<SensorAxis>(offset);
3203            // Delegate to tuple encoding.
3204            fidl::encoding::Encode::<SensorAxis, D>::encode(
3205                (
3206                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.axis),
3207                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3208                ),
3209                encoder,
3210                offset,
3211                _depth,
3212            )
3213        }
3214    }
3215    unsafe impl<
3216            D: fidl::encoding::ResourceDialect,
3217            T0: fidl::encoding::Encode<Axis, D>,
3218            T1: fidl::encoding::Encode<SensorType, D>,
3219        > fidl::encoding::Encode<SensorAxis, D> for (T0, T1)
3220    {
3221        #[inline]
3222        unsafe fn encode(
3223            self,
3224            encoder: &mut fidl::encoding::Encoder<'_, D>,
3225            offset: usize,
3226            depth: fidl::encoding::Depth,
3227        ) -> fidl::Result<()> {
3228            encoder.debug_check_bounds::<SensorAxis>(offset);
3229            // Zero out padding regions. There's no need to apply masks
3230            // because the unmasked parts will be overwritten by fields.
3231            unsafe {
3232                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3233                (ptr as *mut u64).write_unaligned(0);
3234            }
3235            // Write the fields.
3236            self.0.encode(encoder, offset + 0, depth)?;
3237            self.1.encode(encoder, offset + 24, depth)?;
3238            Ok(())
3239        }
3240    }
3241
3242    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorAxis {
3243        #[inline(always)]
3244        fn new_empty() -> Self {
3245            Self { axis: fidl::new_empty!(Axis, D), type_: fidl::new_empty!(SensorType, D) }
3246        }
3247
3248        #[inline]
3249        unsafe fn decode(
3250            &mut self,
3251            decoder: &mut fidl::encoding::Decoder<'_, D>,
3252            offset: usize,
3253            _depth: fidl::encoding::Depth,
3254        ) -> fidl::Result<()> {
3255            decoder.debug_check_bounds::<Self>(offset);
3256            // Verify that padding bytes are zero.
3257            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3258            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3259            let mask = 0xffffffff00000000u64;
3260            let maskedval = padval & mask;
3261            if maskedval != 0 {
3262                return Err(fidl::Error::NonZeroPadding {
3263                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3264                });
3265            }
3266            fidl::decode!(Axis, D, &mut self.axis, decoder, offset + 0, _depth)?;
3267            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 24, _depth)?;
3268            Ok(())
3269        }
3270    }
3271
3272    impl fidl::encoding::ValueTypeMarker for Unit {
3273        type Borrowed<'a> = &'a Self;
3274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3275            value
3276        }
3277    }
3278
3279    unsafe impl fidl::encoding::TypeMarker for Unit {
3280        type Owned = Self;
3281
3282        #[inline(always)]
3283        fn inline_align(_context: fidl::encoding::Context) -> usize {
3284            4
3285        }
3286
3287        #[inline(always)]
3288        fn inline_size(_context: fidl::encoding::Context) -> usize {
3289            8
3290        }
3291    }
3292
3293    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
3294        #[inline]
3295        unsafe fn encode(
3296            self,
3297            encoder: &mut fidl::encoding::Encoder<'_, D>,
3298            offset: usize,
3299            _depth: fidl::encoding::Depth,
3300        ) -> fidl::Result<()> {
3301            encoder.debug_check_bounds::<Unit>(offset);
3302            // Delegate to tuple encoding.
3303            fidl::encoding::Encode::<Unit, D>::encode(
3304                (
3305                    <UnitType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3306                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
3307                ),
3308                encoder,
3309                offset,
3310                _depth,
3311            )
3312        }
3313    }
3314    unsafe impl<
3315            D: fidl::encoding::ResourceDialect,
3316            T0: fidl::encoding::Encode<UnitType, D>,
3317            T1: fidl::encoding::Encode<i32, D>,
3318        > fidl::encoding::Encode<Unit, D> for (T0, T1)
3319    {
3320        #[inline]
3321        unsafe fn encode(
3322            self,
3323            encoder: &mut fidl::encoding::Encoder<'_, D>,
3324            offset: usize,
3325            depth: fidl::encoding::Depth,
3326        ) -> fidl::Result<()> {
3327            encoder.debug_check_bounds::<Unit>(offset);
3328            // Zero out padding regions. There's no need to apply masks
3329            // because the unmasked parts will be overwritten by fields.
3330            // Write the fields.
3331            self.0.encode(encoder, offset + 0, depth)?;
3332            self.1.encode(encoder, offset + 4, depth)?;
3333            Ok(())
3334        }
3335    }
3336
3337    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
3338        #[inline(always)]
3339        fn new_empty() -> Self {
3340            Self { type_: fidl::new_empty!(UnitType, D), exponent: fidl::new_empty!(i32, D) }
3341        }
3342
3343        #[inline]
3344        unsafe fn decode(
3345            &mut self,
3346            decoder: &mut fidl::encoding::Decoder<'_, D>,
3347            offset: usize,
3348            _depth: fidl::encoding::Depth,
3349        ) -> fidl::Result<()> {
3350            decoder.debug_check_bounds::<Self>(offset);
3351            // Verify that padding bytes are zero.
3352            fidl::decode!(UnitType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3353            fidl::decode!(i32, D, &mut self.exponent, decoder, offset + 4, _depth)?;
3354            Ok(())
3355        }
3356    }
3357
3358    impl ConsumerControlDescriptor {
3359        #[inline(always)]
3360        fn max_ordinal_present(&self) -> u64 {
3361            if let Some(_) = self.input {
3362                return 1;
3363            }
3364            0
3365        }
3366    }
3367
3368    impl fidl::encoding::ValueTypeMarker for ConsumerControlDescriptor {
3369        type Borrowed<'a> = &'a Self;
3370        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3371            value
3372        }
3373    }
3374
3375    unsafe impl fidl::encoding::TypeMarker for ConsumerControlDescriptor {
3376        type Owned = Self;
3377
3378        #[inline(always)]
3379        fn inline_align(_context: fidl::encoding::Context) -> usize {
3380            8
3381        }
3382
3383        #[inline(always)]
3384        fn inline_size(_context: fidl::encoding::Context) -> usize {
3385            16
3386        }
3387    }
3388
3389    unsafe impl<D: fidl::encoding::ResourceDialect>
3390        fidl::encoding::Encode<ConsumerControlDescriptor, D> for &ConsumerControlDescriptor
3391    {
3392        unsafe fn encode(
3393            self,
3394            encoder: &mut fidl::encoding::Encoder<'_, D>,
3395            offset: usize,
3396            mut depth: fidl::encoding::Depth,
3397        ) -> fidl::Result<()> {
3398            encoder.debug_check_bounds::<ConsumerControlDescriptor>(offset);
3399            // Vector header
3400            let max_ordinal: u64 = self.max_ordinal_present();
3401            encoder.write_num(max_ordinal, offset);
3402            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3403            // Calling encoder.out_of_line_offset(0) is not allowed.
3404            if max_ordinal == 0 {
3405                return Ok(());
3406            }
3407            depth.increment()?;
3408            let envelope_size = 8;
3409            let bytes_len = max_ordinal as usize * envelope_size;
3410            #[allow(unused_variables)]
3411            let offset = encoder.out_of_line_offset(bytes_len);
3412            let mut _prev_end_offset: usize = 0;
3413            if 1 > max_ordinal {
3414                return Ok(());
3415            }
3416
3417            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3418            // are envelope_size bytes.
3419            let cur_offset: usize = (1 - 1) * envelope_size;
3420
3421            // Zero reserved fields.
3422            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3423
3424            // Safety:
3425            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3426            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3427            //   envelope_size bytes, there is always sufficient room.
3428            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputDescriptor, D>(
3429                self.input.as_ref().map(
3430                    <ConsumerControlInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow,
3431                ),
3432                encoder,
3433                offset + cur_offset,
3434                depth,
3435            )?;
3436
3437            _prev_end_offset = cur_offset + envelope_size;
3438
3439            Ok(())
3440        }
3441    }
3442
3443    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3444        for ConsumerControlDescriptor
3445    {
3446        #[inline(always)]
3447        fn new_empty() -> Self {
3448            Self::default()
3449        }
3450
3451        unsafe fn decode(
3452            &mut self,
3453            decoder: &mut fidl::encoding::Decoder<'_, D>,
3454            offset: usize,
3455            mut depth: fidl::encoding::Depth,
3456        ) -> fidl::Result<()> {
3457            decoder.debug_check_bounds::<Self>(offset);
3458            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3459                None => return Err(fidl::Error::NotNullable),
3460                Some(len) => len,
3461            };
3462            // Calling decoder.out_of_line_offset(0) is not allowed.
3463            if len == 0 {
3464                return Ok(());
3465            };
3466            depth.increment()?;
3467            let envelope_size = 8;
3468            let bytes_len = len * envelope_size;
3469            let offset = decoder.out_of_line_offset(bytes_len)?;
3470            // Decode the envelope for each type.
3471            let mut _next_ordinal_to_read = 0;
3472            let mut next_offset = offset;
3473            let end_offset = offset + bytes_len;
3474            _next_ordinal_to_read += 1;
3475            if next_offset >= end_offset {
3476                return Ok(());
3477            }
3478
3479            // Decode unknown envelopes for gaps in ordinals.
3480            while _next_ordinal_to_read < 1 {
3481                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3482                _next_ordinal_to_read += 1;
3483                next_offset += envelope_size;
3484            }
3485
3486            let next_out_of_line = decoder.next_out_of_line();
3487            let handles_before = decoder.remaining_handles();
3488            if let Some((inlined, num_bytes, num_handles)) =
3489                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3490            {
3491                let member_inline_size =
3492                    <ConsumerControlInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
3493                        decoder.context,
3494                    );
3495                if inlined != (member_inline_size <= 4) {
3496                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3497                }
3498                let inner_offset;
3499                let mut inner_depth = depth.clone();
3500                if inlined {
3501                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3502                    inner_offset = next_offset;
3503                } else {
3504                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3505                    inner_depth.increment()?;
3506                }
3507                let val_ref = self
3508                    .input
3509                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputDescriptor, D));
3510                fidl::decode!(
3511                    ConsumerControlInputDescriptor,
3512                    D,
3513                    val_ref,
3514                    decoder,
3515                    inner_offset,
3516                    inner_depth
3517                )?;
3518                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3519                {
3520                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3521                }
3522                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3523                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3524                }
3525            }
3526
3527            next_offset += envelope_size;
3528
3529            // Decode the remaining unknown envelopes.
3530            while next_offset < end_offset {
3531                _next_ordinal_to_read += 1;
3532                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3533                next_offset += envelope_size;
3534            }
3535
3536            Ok(())
3537        }
3538    }
3539
3540    impl ConsumerControlInputDescriptor {
3541        #[inline(always)]
3542        fn max_ordinal_present(&self) -> u64 {
3543            if let Some(_) = self.buttons {
3544                return 1;
3545            }
3546            0
3547        }
3548    }
3549
3550    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputDescriptor {
3551        type Borrowed<'a> = &'a Self;
3552        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3553            value
3554        }
3555    }
3556
3557    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputDescriptor {
3558        type Owned = Self;
3559
3560        #[inline(always)]
3561        fn inline_align(_context: fidl::encoding::Context) -> usize {
3562            8
3563        }
3564
3565        #[inline(always)]
3566        fn inline_size(_context: fidl::encoding::Context) -> usize {
3567            16
3568        }
3569    }
3570
3571    unsafe impl<D: fidl::encoding::ResourceDialect>
3572        fidl::encoding::Encode<ConsumerControlInputDescriptor, D>
3573        for &ConsumerControlInputDescriptor
3574    {
3575        unsafe fn encode(
3576            self,
3577            encoder: &mut fidl::encoding::Encoder<'_, D>,
3578            offset: usize,
3579            mut depth: fidl::encoding::Depth,
3580        ) -> fidl::Result<()> {
3581            encoder.debug_check_bounds::<ConsumerControlInputDescriptor>(offset);
3582            // Vector header
3583            let max_ordinal: u64 = self.max_ordinal_present();
3584            encoder.write_num(max_ordinal, offset);
3585            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3586            // Calling encoder.out_of_line_offset(0) is not allowed.
3587            if max_ordinal == 0 {
3588                return Ok(());
3589            }
3590            depth.increment()?;
3591            let envelope_size = 8;
3592            let bytes_len = max_ordinal as usize * envelope_size;
3593            #[allow(unused_variables)]
3594            let offset = encoder.out_of_line_offset(bytes_len);
3595            let mut _prev_end_offset: usize = 0;
3596            if 1 > max_ordinal {
3597                return Ok(());
3598            }
3599
3600            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3601            // are envelope_size bytes.
3602            let cur_offset: usize = (1 - 1) * envelope_size;
3603
3604            // Zero reserved fields.
3605            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3606
3607            // Safety:
3608            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3609            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3610            //   envelope_size bytes, there is always sufficient room.
3611            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3612            self.buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3613            encoder, offset + cur_offset, depth
3614        )?;
3615
3616            _prev_end_offset = cur_offset + envelope_size;
3617
3618            Ok(())
3619        }
3620    }
3621
3622    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3623        for ConsumerControlInputDescriptor
3624    {
3625        #[inline(always)]
3626        fn new_empty() -> Self {
3627            Self::default()
3628        }
3629
3630        unsafe fn decode(
3631            &mut self,
3632            decoder: &mut fidl::encoding::Decoder<'_, D>,
3633            offset: usize,
3634            mut depth: fidl::encoding::Depth,
3635        ) -> fidl::Result<()> {
3636            decoder.debug_check_bounds::<Self>(offset);
3637            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3638                None => return Err(fidl::Error::NotNullable),
3639                Some(len) => len,
3640            };
3641            // Calling decoder.out_of_line_offset(0) is not allowed.
3642            if len == 0 {
3643                return Ok(());
3644            };
3645            depth.increment()?;
3646            let envelope_size = 8;
3647            let bytes_len = len * envelope_size;
3648            let offset = decoder.out_of_line_offset(bytes_len)?;
3649            // Decode the envelope for each type.
3650            let mut _next_ordinal_to_read = 0;
3651            let mut next_offset = offset;
3652            let end_offset = offset + bytes_len;
3653            _next_ordinal_to_read += 1;
3654            if next_offset >= end_offset {
3655                return Ok(());
3656            }
3657
3658            // Decode unknown envelopes for gaps in ordinals.
3659            while _next_ordinal_to_read < 1 {
3660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3661                _next_ordinal_to_read += 1;
3662                next_offset += envelope_size;
3663            }
3664
3665            let next_out_of_line = decoder.next_out_of_line();
3666            let handles_before = decoder.remaining_handles();
3667            if let Some((inlined, num_bytes, num_handles)) =
3668                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3669            {
3670                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3671                if inlined != (member_inline_size <= 4) {
3672                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3673                }
3674                let inner_offset;
3675                let mut inner_depth = depth.clone();
3676                if inlined {
3677                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3678                    inner_offset = next_offset;
3679                } else {
3680                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3681                    inner_depth.increment()?;
3682                }
3683                let val_ref = self.buttons.get_or_insert_with(
3684                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3685                );
3686                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3687                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3688                {
3689                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3690                }
3691                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3692                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3693                }
3694            }
3695
3696            next_offset += envelope_size;
3697
3698            // Decode the remaining unknown envelopes.
3699            while next_offset < end_offset {
3700                _next_ordinal_to_read += 1;
3701                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3702                next_offset += envelope_size;
3703            }
3704
3705            Ok(())
3706        }
3707    }
3708
3709    impl ConsumerControlInputReport {
3710        #[inline(always)]
3711        fn max_ordinal_present(&self) -> u64 {
3712            if let Some(_) = self.pressed_buttons {
3713                return 1;
3714            }
3715            0
3716        }
3717    }
3718
3719    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputReport {
3720        type Borrowed<'a> = &'a Self;
3721        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3722            value
3723        }
3724    }
3725
3726    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputReport {
3727        type Owned = Self;
3728
3729        #[inline(always)]
3730        fn inline_align(_context: fidl::encoding::Context) -> usize {
3731            8
3732        }
3733
3734        #[inline(always)]
3735        fn inline_size(_context: fidl::encoding::Context) -> usize {
3736            16
3737        }
3738    }
3739
3740    unsafe impl<D: fidl::encoding::ResourceDialect>
3741        fidl::encoding::Encode<ConsumerControlInputReport, D> for &ConsumerControlInputReport
3742    {
3743        unsafe fn encode(
3744            self,
3745            encoder: &mut fidl::encoding::Encoder<'_, D>,
3746            offset: usize,
3747            mut depth: fidl::encoding::Depth,
3748        ) -> fidl::Result<()> {
3749            encoder.debug_check_bounds::<ConsumerControlInputReport>(offset);
3750            // Vector header
3751            let max_ordinal: u64 = self.max_ordinal_present();
3752            encoder.write_num(max_ordinal, offset);
3753            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3754            // Calling encoder.out_of_line_offset(0) is not allowed.
3755            if max_ordinal == 0 {
3756                return Ok(());
3757            }
3758            depth.increment()?;
3759            let envelope_size = 8;
3760            let bytes_len = max_ordinal as usize * envelope_size;
3761            #[allow(unused_variables)]
3762            let offset = encoder.out_of_line_offset(bytes_len);
3763            let mut _prev_end_offset: usize = 0;
3764            if 1 > max_ordinal {
3765                return Ok(());
3766            }
3767
3768            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3769            // are envelope_size bytes.
3770            let cur_offset: usize = (1 - 1) * envelope_size;
3771
3772            // Zero reserved fields.
3773            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3774
3775            // Safety:
3776            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3777            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3778            //   envelope_size bytes, there is always sufficient room.
3779            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3780            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3781            encoder, offset + cur_offset, depth
3782        )?;
3783
3784            _prev_end_offset = cur_offset + envelope_size;
3785
3786            Ok(())
3787        }
3788    }
3789
3790    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3791        for ConsumerControlInputReport
3792    {
3793        #[inline(always)]
3794        fn new_empty() -> Self {
3795            Self::default()
3796        }
3797
3798        unsafe fn decode(
3799            &mut self,
3800            decoder: &mut fidl::encoding::Decoder<'_, D>,
3801            offset: usize,
3802            mut depth: fidl::encoding::Depth,
3803        ) -> fidl::Result<()> {
3804            decoder.debug_check_bounds::<Self>(offset);
3805            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3806                None => return Err(fidl::Error::NotNullable),
3807                Some(len) => len,
3808            };
3809            // Calling decoder.out_of_line_offset(0) is not allowed.
3810            if len == 0 {
3811                return Ok(());
3812            };
3813            depth.increment()?;
3814            let envelope_size = 8;
3815            let bytes_len = len * envelope_size;
3816            let offset = decoder.out_of_line_offset(bytes_len)?;
3817            // Decode the envelope for each type.
3818            let mut _next_ordinal_to_read = 0;
3819            let mut next_offset = offset;
3820            let end_offset = offset + bytes_len;
3821            _next_ordinal_to_read += 1;
3822            if next_offset >= end_offset {
3823                return Ok(());
3824            }
3825
3826            // Decode unknown envelopes for gaps in ordinals.
3827            while _next_ordinal_to_read < 1 {
3828                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3829                _next_ordinal_to_read += 1;
3830                next_offset += envelope_size;
3831            }
3832
3833            let next_out_of_line = decoder.next_out_of_line();
3834            let handles_before = decoder.remaining_handles();
3835            if let Some((inlined, num_bytes, num_handles)) =
3836                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3837            {
3838                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3839                if inlined != (member_inline_size <= 4) {
3840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3841                }
3842                let inner_offset;
3843                let mut inner_depth = depth.clone();
3844                if inlined {
3845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3846                    inner_offset = next_offset;
3847                } else {
3848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3849                    inner_depth.increment()?;
3850                }
3851                let val_ref = self.pressed_buttons.get_or_insert_with(
3852                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3853                );
3854                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3855                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3856                {
3857                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3858                }
3859                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3860                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3861                }
3862            }
3863
3864            next_offset += envelope_size;
3865
3866            // Decode the remaining unknown envelopes.
3867            while next_offset < end_offset {
3868                _next_ordinal_to_read += 1;
3869                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3870                next_offset += envelope_size;
3871            }
3872
3873            Ok(())
3874        }
3875    }
3876
3877    impl ContactInputDescriptor {
3878        #[inline(always)]
3879        fn max_ordinal_present(&self) -> u64 {
3880            if let Some(_) = self.contact_height {
3881                return 5;
3882            }
3883            if let Some(_) = self.contact_width {
3884                return 4;
3885            }
3886            if let Some(_) = self.pressure {
3887                return 3;
3888            }
3889            if let Some(_) = self.position_y {
3890                return 2;
3891            }
3892            if let Some(_) = self.position_x {
3893                return 1;
3894            }
3895            0
3896        }
3897    }
3898
3899    impl fidl::encoding::ValueTypeMarker for ContactInputDescriptor {
3900        type Borrowed<'a> = &'a Self;
3901        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3902            value
3903        }
3904    }
3905
3906    unsafe impl fidl::encoding::TypeMarker for ContactInputDescriptor {
3907        type Owned = Self;
3908
3909        #[inline(always)]
3910        fn inline_align(_context: fidl::encoding::Context) -> usize {
3911            8
3912        }
3913
3914        #[inline(always)]
3915        fn inline_size(_context: fidl::encoding::Context) -> usize {
3916            16
3917        }
3918    }
3919
3920    unsafe impl<D: fidl::encoding::ResourceDialect>
3921        fidl::encoding::Encode<ContactInputDescriptor, D> for &ContactInputDescriptor
3922    {
3923        unsafe fn encode(
3924            self,
3925            encoder: &mut fidl::encoding::Encoder<'_, D>,
3926            offset: usize,
3927            mut depth: fidl::encoding::Depth,
3928        ) -> fidl::Result<()> {
3929            encoder.debug_check_bounds::<ContactInputDescriptor>(offset);
3930            // Vector header
3931            let max_ordinal: u64 = self.max_ordinal_present();
3932            encoder.write_num(max_ordinal, offset);
3933            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3934            // Calling encoder.out_of_line_offset(0) is not allowed.
3935            if max_ordinal == 0 {
3936                return Ok(());
3937            }
3938            depth.increment()?;
3939            let envelope_size = 8;
3940            let bytes_len = max_ordinal as usize * envelope_size;
3941            #[allow(unused_variables)]
3942            let offset = encoder.out_of_line_offset(bytes_len);
3943            let mut _prev_end_offset: usize = 0;
3944            if 1 > max_ordinal {
3945                return Ok(());
3946            }
3947
3948            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3949            // are envelope_size bytes.
3950            let cur_offset: usize = (1 - 1) * envelope_size;
3951
3952            // Zero reserved fields.
3953            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3954
3955            // Safety:
3956            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3957            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3958            //   envelope_size bytes, there is always sufficient room.
3959            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3960                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3961                encoder,
3962                offset + cur_offset,
3963                depth,
3964            )?;
3965
3966            _prev_end_offset = cur_offset + envelope_size;
3967            if 2 > max_ordinal {
3968                return Ok(());
3969            }
3970
3971            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3972            // are envelope_size bytes.
3973            let cur_offset: usize = (2 - 1) * envelope_size;
3974
3975            // Zero reserved fields.
3976            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3977
3978            // Safety:
3979            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3980            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3981            //   envelope_size bytes, there is always sufficient room.
3982            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3983                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3984                encoder,
3985                offset + cur_offset,
3986                depth,
3987            )?;
3988
3989            _prev_end_offset = cur_offset + envelope_size;
3990            if 3 > max_ordinal {
3991                return Ok(());
3992            }
3993
3994            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3995            // are envelope_size bytes.
3996            let cur_offset: usize = (3 - 1) * envelope_size;
3997
3998            // Zero reserved fields.
3999            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4000
4001            // Safety:
4002            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4003            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4004            //   envelope_size bytes, there is always sufficient room.
4005            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
4006                self.pressure.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
4007                encoder,
4008                offset + cur_offset,
4009                depth,
4010            )?;
4011
4012            _prev_end_offset = cur_offset + envelope_size;
4013            if 4 > max_ordinal {
4014                return Ok(());
4015            }
4016
4017            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4018            // are envelope_size bytes.
4019            let cur_offset: usize = (4 - 1) * envelope_size;
4020
4021            // Zero reserved fields.
4022            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4023
4024            // Safety:
4025            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4026            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4027            //   envelope_size bytes, there is always sufficient room.
4028            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
4029                self.contact_width.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
4030                encoder,
4031                offset + cur_offset,
4032                depth,
4033            )?;
4034
4035            _prev_end_offset = cur_offset + envelope_size;
4036            if 5 > max_ordinal {
4037                return Ok(());
4038            }
4039
4040            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4041            // are envelope_size bytes.
4042            let cur_offset: usize = (5 - 1) * envelope_size;
4043
4044            // Zero reserved fields.
4045            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4046
4047            // Safety:
4048            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4049            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4050            //   envelope_size bytes, there is always sufficient room.
4051            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
4052                self.contact_height.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
4053                encoder,
4054                offset + cur_offset,
4055                depth,
4056            )?;
4057
4058            _prev_end_offset = cur_offset + envelope_size;
4059
4060            Ok(())
4061        }
4062    }
4063
4064    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4065        for ContactInputDescriptor
4066    {
4067        #[inline(always)]
4068        fn new_empty() -> Self {
4069            Self::default()
4070        }
4071
4072        unsafe fn decode(
4073            &mut self,
4074            decoder: &mut fidl::encoding::Decoder<'_, D>,
4075            offset: usize,
4076            mut depth: fidl::encoding::Depth,
4077        ) -> fidl::Result<()> {
4078            decoder.debug_check_bounds::<Self>(offset);
4079            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4080                None => return Err(fidl::Error::NotNullable),
4081                Some(len) => len,
4082            };
4083            // Calling decoder.out_of_line_offset(0) is not allowed.
4084            if len == 0 {
4085                return Ok(());
4086            };
4087            depth.increment()?;
4088            let envelope_size = 8;
4089            let bytes_len = len * envelope_size;
4090            let offset = decoder.out_of_line_offset(bytes_len)?;
4091            // Decode the envelope for each type.
4092            let mut _next_ordinal_to_read = 0;
4093            let mut next_offset = offset;
4094            let end_offset = offset + bytes_len;
4095            _next_ordinal_to_read += 1;
4096            if next_offset >= end_offset {
4097                return Ok(());
4098            }
4099
4100            // Decode unknown envelopes for gaps in ordinals.
4101            while _next_ordinal_to_read < 1 {
4102                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4103                _next_ordinal_to_read += 1;
4104                next_offset += envelope_size;
4105            }
4106
4107            let next_out_of_line = decoder.next_out_of_line();
4108            let handles_before = decoder.remaining_handles();
4109            if let Some((inlined, num_bytes, num_handles)) =
4110                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4111            {
4112                let member_inline_size =
4113                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4114                if inlined != (member_inline_size <= 4) {
4115                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4116                }
4117                let inner_offset;
4118                let mut inner_depth = depth.clone();
4119                if inlined {
4120                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4121                    inner_offset = next_offset;
4122                } else {
4123                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4124                    inner_depth.increment()?;
4125                }
4126                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4127                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4128                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4129                {
4130                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4131                }
4132                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4133                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4134                }
4135            }
4136
4137            next_offset += envelope_size;
4138            _next_ordinal_to_read += 1;
4139            if next_offset >= end_offset {
4140                return Ok(());
4141            }
4142
4143            // Decode unknown envelopes for gaps in ordinals.
4144            while _next_ordinal_to_read < 2 {
4145                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4146                _next_ordinal_to_read += 1;
4147                next_offset += envelope_size;
4148            }
4149
4150            let next_out_of_line = decoder.next_out_of_line();
4151            let handles_before = decoder.remaining_handles();
4152            if let Some((inlined, num_bytes, num_handles)) =
4153                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4154            {
4155                let member_inline_size =
4156                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4157                if inlined != (member_inline_size <= 4) {
4158                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4159                }
4160                let inner_offset;
4161                let mut inner_depth = depth.clone();
4162                if inlined {
4163                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4164                    inner_offset = next_offset;
4165                } else {
4166                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4167                    inner_depth.increment()?;
4168                }
4169                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4170                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4171                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4172                {
4173                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4174                }
4175                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4176                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4177                }
4178            }
4179
4180            next_offset += envelope_size;
4181            _next_ordinal_to_read += 1;
4182            if next_offset >= end_offset {
4183                return Ok(());
4184            }
4185
4186            // Decode unknown envelopes for gaps in ordinals.
4187            while _next_ordinal_to_read < 3 {
4188                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4189                _next_ordinal_to_read += 1;
4190                next_offset += envelope_size;
4191            }
4192
4193            let next_out_of_line = decoder.next_out_of_line();
4194            let handles_before = decoder.remaining_handles();
4195            if let Some((inlined, num_bytes, num_handles)) =
4196                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4197            {
4198                let member_inline_size =
4199                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4200                if inlined != (member_inline_size <= 4) {
4201                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4202                }
4203                let inner_offset;
4204                let mut inner_depth = depth.clone();
4205                if inlined {
4206                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4207                    inner_offset = next_offset;
4208                } else {
4209                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4210                    inner_depth.increment()?;
4211                }
4212                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4213                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4214                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4215                {
4216                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4217                }
4218                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4219                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4220                }
4221            }
4222
4223            next_offset += envelope_size;
4224            _next_ordinal_to_read += 1;
4225            if next_offset >= end_offset {
4226                return Ok(());
4227            }
4228
4229            // Decode unknown envelopes for gaps in ordinals.
4230            while _next_ordinal_to_read < 4 {
4231                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4232                _next_ordinal_to_read += 1;
4233                next_offset += envelope_size;
4234            }
4235
4236            let next_out_of_line = decoder.next_out_of_line();
4237            let handles_before = decoder.remaining_handles();
4238            if let Some((inlined, num_bytes, num_handles)) =
4239                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4240            {
4241                let member_inline_size =
4242                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4243                if inlined != (member_inline_size <= 4) {
4244                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4245                }
4246                let inner_offset;
4247                let mut inner_depth = depth.clone();
4248                if inlined {
4249                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4250                    inner_offset = next_offset;
4251                } else {
4252                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4253                    inner_depth.increment()?;
4254                }
4255                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4256                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4257                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4258                {
4259                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4260                }
4261                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4262                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4263                }
4264            }
4265
4266            next_offset += envelope_size;
4267            _next_ordinal_to_read += 1;
4268            if next_offset >= end_offset {
4269                return Ok(());
4270            }
4271
4272            // Decode unknown envelopes for gaps in ordinals.
4273            while _next_ordinal_to_read < 5 {
4274                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4275                _next_ordinal_to_read += 1;
4276                next_offset += envelope_size;
4277            }
4278
4279            let next_out_of_line = decoder.next_out_of_line();
4280            let handles_before = decoder.remaining_handles();
4281            if let Some((inlined, num_bytes, num_handles)) =
4282                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4283            {
4284                let member_inline_size =
4285                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4286                if inlined != (member_inline_size <= 4) {
4287                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4288                }
4289                let inner_offset;
4290                let mut inner_depth = depth.clone();
4291                if inlined {
4292                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4293                    inner_offset = next_offset;
4294                } else {
4295                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4296                    inner_depth.increment()?;
4297                }
4298                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4299                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4300                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4301                {
4302                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4303                }
4304                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4305                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4306                }
4307            }
4308
4309            next_offset += envelope_size;
4310
4311            // Decode the remaining unknown envelopes.
4312            while next_offset < end_offset {
4313                _next_ordinal_to_read += 1;
4314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4315                next_offset += envelope_size;
4316            }
4317
4318            Ok(())
4319        }
4320    }
4321
4322    impl ContactInputReport {
4323        #[inline(always)]
4324        fn max_ordinal_present(&self) -> u64 {
4325            if let Some(_) = self.confidence {
4326                return 7;
4327            }
4328            if let Some(_) = self.contact_height {
4329                return 6;
4330            }
4331            if let Some(_) = self.contact_width {
4332                return 5;
4333            }
4334            if let Some(_) = self.pressure {
4335                return 4;
4336            }
4337            if let Some(_) = self.position_y {
4338                return 3;
4339            }
4340            if let Some(_) = self.position_x {
4341                return 2;
4342            }
4343            if let Some(_) = self.contact_id {
4344                return 1;
4345            }
4346            0
4347        }
4348    }
4349
4350    impl fidl::encoding::ValueTypeMarker for ContactInputReport {
4351        type Borrowed<'a> = &'a Self;
4352        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4353            value
4354        }
4355    }
4356
4357    unsafe impl fidl::encoding::TypeMarker for ContactInputReport {
4358        type Owned = Self;
4359
4360        #[inline(always)]
4361        fn inline_align(_context: fidl::encoding::Context) -> usize {
4362            8
4363        }
4364
4365        #[inline(always)]
4366        fn inline_size(_context: fidl::encoding::Context) -> usize {
4367            16
4368        }
4369    }
4370
4371    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContactInputReport, D>
4372        for &ContactInputReport
4373    {
4374        unsafe fn encode(
4375            self,
4376            encoder: &mut fidl::encoding::Encoder<'_, D>,
4377            offset: usize,
4378            mut depth: fidl::encoding::Depth,
4379        ) -> fidl::Result<()> {
4380            encoder.debug_check_bounds::<ContactInputReport>(offset);
4381            // Vector header
4382            let max_ordinal: u64 = self.max_ordinal_present();
4383            encoder.write_num(max_ordinal, offset);
4384            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4385            // Calling encoder.out_of_line_offset(0) is not allowed.
4386            if max_ordinal == 0 {
4387                return Ok(());
4388            }
4389            depth.increment()?;
4390            let envelope_size = 8;
4391            let bytes_len = max_ordinal as usize * envelope_size;
4392            #[allow(unused_variables)]
4393            let offset = encoder.out_of_line_offset(bytes_len);
4394            let mut _prev_end_offset: usize = 0;
4395            if 1 > max_ordinal {
4396                return Ok(());
4397            }
4398
4399            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4400            // are envelope_size bytes.
4401            let cur_offset: usize = (1 - 1) * envelope_size;
4402
4403            // Zero reserved fields.
4404            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4405
4406            // Safety:
4407            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4408            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4409            //   envelope_size bytes, there is always sufficient room.
4410            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4411                self.contact_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4412                encoder,
4413                offset + cur_offset,
4414                depth,
4415            )?;
4416
4417            _prev_end_offset = cur_offset + envelope_size;
4418            if 2 > max_ordinal {
4419                return Ok(());
4420            }
4421
4422            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4423            // are envelope_size bytes.
4424            let cur_offset: usize = (2 - 1) * envelope_size;
4425
4426            // Zero reserved fields.
4427            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4428
4429            // Safety:
4430            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4431            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4432            //   envelope_size bytes, there is always sufficient room.
4433            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4434                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4435                encoder,
4436                offset + cur_offset,
4437                depth,
4438            )?;
4439
4440            _prev_end_offset = cur_offset + envelope_size;
4441            if 3 > max_ordinal {
4442                return Ok(());
4443            }
4444
4445            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4446            // are envelope_size bytes.
4447            let cur_offset: usize = (3 - 1) * envelope_size;
4448
4449            // Zero reserved fields.
4450            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4451
4452            // Safety:
4453            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4454            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4455            //   envelope_size bytes, there is always sufficient room.
4456            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4457                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4458                encoder,
4459                offset + cur_offset,
4460                depth,
4461            )?;
4462
4463            _prev_end_offset = cur_offset + envelope_size;
4464            if 4 > max_ordinal {
4465                return Ok(());
4466            }
4467
4468            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4469            // are envelope_size bytes.
4470            let cur_offset: usize = (4 - 1) * envelope_size;
4471
4472            // Zero reserved fields.
4473            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4474
4475            // Safety:
4476            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4477            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4478            //   envelope_size bytes, there is always sufficient room.
4479            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4480                self.pressure.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4481                encoder,
4482                offset + cur_offset,
4483                depth,
4484            )?;
4485
4486            _prev_end_offset = cur_offset + envelope_size;
4487            if 5 > max_ordinal {
4488                return Ok(());
4489            }
4490
4491            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4492            // are envelope_size bytes.
4493            let cur_offset: usize = (5 - 1) * envelope_size;
4494
4495            // Zero reserved fields.
4496            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4497
4498            // Safety:
4499            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4500            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4501            //   envelope_size bytes, there is always sufficient room.
4502            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4503                self.contact_width.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4504                encoder,
4505                offset + cur_offset,
4506                depth,
4507            )?;
4508
4509            _prev_end_offset = cur_offset + envelope_size;
4510            if 6 > max_ordinal {
4511                return Ok(());
4512            }
4513
4514            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4515            // are envelope_size bytes.
4516            let cur_offset: usize = (6 - 1) * envelope_size;
4517
4518            // Zero reserved fields.
4519            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4520
4521            // Safety:
4522            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4523            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4524            //   envelope_size bytes, there is always sufficient room.
4525            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4526                self.contact_height.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4527                encoder,
4528                offset + cur_offset,
4529                depth,
4530            )?;
4531
4532            _prev_end_offset = cur_offset + envelope_size;
4533            if 7 > max_ordinal {
4534                return Ok(());
4535            }
4536
4537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4538            // are envelope_size bytes.
4539            let cur_offset: usize = (7 - 1) * envelope_size;
4540
4541            // Zero reserved fields.
4542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4543
4544            // Safety:
4545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4547            //   envelope_size bytes, there is always sufficient room.
4548            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4549                self.confidence.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4550                encoder,
4551                offset + cur_offset,
4552                depth,
4553            )?;
4554
4555            _prev_end_offset = cur_offset + envelope_size;
4556
4557            Ok(())
4558        }
4559    }
4560
4561    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContactInputReport {
4562        #[inline(always)]
4563        fn new_empty() -> Self {
4564            Self::default()
4565        }
4566
4567        unsafe fn decode(
4568            &mut self,
4569            decoder: &mut fidl::encoding::Decoder<'_, D>,
4570            offset: usize,
4571            mut depth: fidl::encoding::Depth,
4572        ) -> fidl::Result<()> {
4573            decoder.debug_check_bounds::<Self>(offset);
4574            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4575                None => return Err(fidl::Error::NotNullable),
4576                Some(len) => len,
4577            };
4578            // Calling decoder.out_of_line_offset(0) is not allowed.
4579            if len == 0 {
4580                return Ok(());
4581            };
4582            depth.increment()?;
4583            let envelope_size = 8;
4584            let bytes_len = len * envelope_size;
4585            let offset = decoder.out_of_line_offset(bytes_len)?;
4586            // Decode the envelope for each type.
4587            let mut _next_ordinal_to_read = 0;
4588            let mut next_offset = offset;
4589            let end_offset = offset + bytes_len;
4590            _next_ordinal_to_read += 1;
4591            if next_offset >= end_offset {
4592                return Ok(());
4593            }
4594
4595            // Decode unknown envelopes for gaps in ordinals.
4596            while _next_ordinal_to_read < 1 {
4597                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4598                _next_ordinal_to_read += 1;
4599                next_offset += envelope_size;
4600            }
4601
4602            let next_out_of_line = decoder.next_out_of_line();
4603            let handles_before = decoder.remaining_handles();
4604            if let Some((inlined, num_bytes, num_handles)) =
4605                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4606            {
4607                let member_inline_size =
4608                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4609                if inlined != (member_inline_size <= 4) {
4610                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4611                }
4612                let inner_offset;
4613                let mut inner_depth = depth.clone();
4614                if inlined {
4615                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4616                    inner_offset = next_offset;
4617                } else {
4618                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4619                    inner_depth.increment()?;
4620                }
4621                let val_ref = self.contact_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4622                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4623                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4624                {
4625                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4626                }
4627                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4628                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4629                }
4630            }
4631
4632            next_offset += envelope_size;
4633            _next_ordinal_to_read += 1;
4634            if next_offset >= end_offset {
4635                return Ok(());
4636            }
4637
4638            // Decode unknown envelopes for gaps in ordinals.
4639            while _next_ordinal_to_read < 2 {
4640                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4641                _next_ordinal_to_read += 1;
4642                next_offset += envelope_size;
4643            }
4644
4645            let next_out_of_line = decoder.next_out_of_line();
4646            let handles_before = decoder.remaining_handles();
4647            if let Some((inlined, num_bytes, num_handles)) =
4648                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4649            {
4650                let member_inline_size =
4651                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4652                if inlined != (member_inline_size <= 4) {
4653                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4654                }
4655                let inner_offset;
4656                let mut inner_depth = depth.clone();
4657                if inlined {
4658                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4659                    inner_offset = next_offset;
4660                } else {
4661                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4662                    inner_depth.increment()?;
4663                }
4664                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
4665                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4666                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4667                {
4668                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4669                }
4670                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4671                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4672                }
4673            }
4674
4675            next_offset += envelope_size;
4676            _next_ordinal_to_read += 1;
4677            if next_offset >= end_offset {
4678                return Ok(());
4679            }
4680
4681            // Decode unknown envelopes for gaps in ordinals.
4682            while _next_ordinal_to_read < 3 {
4683                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4684                _next_ordinal_to_read += 1;
4685                next_offset += envelope_size;
4686            }
4687
4688            let next_out_of_line = decoder.next_out_of_line();
4689            let handles_before = decoder.remaining_handles();
4690            if let Some((inlined, num_bytes, num_handles)) =
4691                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4692            {
4693                let member_inline_size =
4694                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4695                if inlined != (member_inline_size <= 4) {
4696                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4697                }
4698                let inner_offset;
4699                let mut inner_depth = depth.clone();
4700                if inlined {
4701                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4702                    inner_offset = next_offset;
4703                } else {
4704                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4705                    inner_depth.increment()?;
4706                }
4707                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
4708                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4709                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4710                {
4711                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4712                }
4713                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4714                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4715                }
4716            }
4717
4718            next_offset += envelope_size;
4719            _next_ordinal_to_read += 1;
4720            if next_offset >= end_offset {
4721                return Ok(());
4722            }
4723
4724            // Decode unknown envelopes for gaps in ordinals.
4725            while _next_ordinal_to_read < 4 {
4726                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4727                _next_ordinal_to_read += 1;
4728                next_offset += envelope_size;
4729            }
4730
4731            let next_out_of_line = decoder.next_out_of_line();
4732            let handles_before = decoder.remaining_handles();
4733            if let Some((inlined, num_bytes, num_handles)) =
4734                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4735            {
4736                let member_inline_size =
4737                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4738                if inlined != (member_inline_size <= 4) {
4739                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4740                }
4741                let inner_offset;
4742                let mut inner_depth = depth.clone();
4743                if inlined {
4744                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4745                    inner_offset = next_offset;
4746                } else {
4747                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4748                    inner_depth.increment()?;
4749                }
4750                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(i64, D));
4751                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4752                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4753                {
4754                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4755                }
4756                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4757                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4758                }
4759            }
4760
4761            next_offset += envelope_size;
4762            _next_ordinal_to_read += 1;
4763            if next_offset >= end_offset {
4764                return Ok(());
4765            }
4766
4767            // Decode unknown envelopes for gaps in ordinals.
4768            while _next_ordinal_to_read < 5 {
4769                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4770                _next_ordinal_to_read += 1;
4771                next_offset += envelope_size;
4772            }
4773
4774            let next_out_of_line = decoder.next_out_of_line();
4775            let handles_before = decoder.remaining_handles();
4776            if let Some((inlined, num_bytes, num_handles)) =
4777                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4778            {
4779                let member_inline_size =
4780                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4781                if inlined != (member_inline_size <= 4) {
4782                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4783                }
4784                let inner_offset;
4785                let mut inner_depth = depth.clone();
4786                if inlined {
4787                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4788                    inner_offset = next_offset;
4789                } else {
4790                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4791                    inner_depth.increment()?;
4792                }
4793                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(i64, D));
4794                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4795                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4796                {
4797                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4798                }
4799                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4800                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4801                }
4802            }
4803
4804            next_offset += envelope_size;
4805            _next_ordinal_to_read += 1;
4806            if next_offset >= end_offset {
4807                return Ok(());
4808            }
4809
4810            // Decode unknown envelopes for gaps in ordinals.
4811            while _next_ordinal_to_read < 6 {
4812                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4813                _next_ordinal_to_read += 1;
4814                next_offset += envelope_size;
4815            }
4816
4817            let next_out_of_line = decoder.next_out_of_line();
4818            let handles_before = decoder.remaining_handles();
4819            if let Some((inlined, num_bytes, num_handles)) =
4820                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4821            {
4822                let member_inline_size =
4823                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4824                if inlined != (member_inline_size <= 4) {
4825                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4826                }
4827                let inner_offset;
4828                let mut inner_depth = depth.clone();
4829                if inlined {
4830                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4831                    inner_offset = next_offset;
4832                } else {
4833                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4834                    inner_depth.increment()?;
4835                }
4836                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(i64, D));
4837                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4838                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4839                {
4840                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4841                }
4842                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4843                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4844                }
4845            }
4846
4847            next_offset += envelope_size;
4848            _next_ordinal_to_read += 1;
4849            if next_offset >= end_offset {
4850                return Ok(());
4851            }
4852
4853            // Decode unknown envelopes for gaps in ordinals.
4854            while _next_ordinal_to_read < 7 {
4855                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4856                _next_ordinal_to_read += 1;
4857                next_offset += envelope_size;
4858            }
4859
4860            let next_out_of_line = decoder.next_out_of_line();
4861            let handles_before = decoder.remaining_handles();
4862            if let Some((inlined, num_bytes, num_handles)) =
4863                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4864            {
4865                let member_inline_size =
4866                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4867                if inlined != (member_inline_size <= 4) {
4868                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4869                }
4870                let inner_offset;
4871                let mut inner_depth = depth.clone();
4872                if inlined {
4873                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4874                    inner_offset = next_offset;
4875                } else {
4876                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4877                    inner_depth.increment()?;
4878                }
4879                let val_ref = self.confidence.get_or_insert_with(|| fidl::new_empty!(bool, D));
4880                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4881                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4882                {
4883                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4884                }
4885                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4886                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4887                }
4888            }
4889
4890            next_offset += envelope_size;
4891
4892            // Decode the remaining unknown envelopes.
4893            while next_offset < end_offset {
4894                _next_ordinal_to_read += 1;
4895                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4896                next_offset += envelope_size;
4897            }
4898
4899            Ok(())
4900        }
4901    }
4902
4903    impl DeviceDescriptor {
4904        #[inline(always)]
4905        fn max_ordinal_present(&self) -> u64 {
4906            if let Some(_) = self.device_information {
4907                return 7;
4908            }
4909            if let Some(_) = self.consumer_control {
4910                return 6;
4911            }
4912            if let Some(_) = self.keyboard {
4913                return 5;
4914            }
4915            if let Some(_) = self.touch {
4916                return 4;
4917            }
4918            if let Some(_) = self.sensor {
4919                return 3;
4920            }
4921            if let Some(_) = self.mouse {
4922                return 2;
4923            }
4924            if let Some(_) = self.device_info {
4925                return 1;
4926            }
4927            0
4928        }
4929    }
4930
4931    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
4932        type Borrowed<'a> = &'a Self;
4933        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4934            value
4935        }
4936    }
4937
4938    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
4939        type Owned = Self;
4940
4941        #[inline(always)]
4942        fn inline_align(_context: fidl::encoding::Context) -> usize {
4943            8
4944        }
4945
4946        #[inline(always)]
4947        fn inline_size(_context: fidl::encoding::Context) -> usize {
4948            16
4949        }
4950    }
4951
4952    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
4953        for &DeviceDescriptor
4954    {
4955        unsafe fn encode(
4956            self,
4957            encoder: &mut fidl::encoding::Encoder<'_, D>,
4958            offset: usize,
4959            mut depth: fidl::encoding::Depth,
4960        ) -> fidl::Result<()> {
4961            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
4962            // Vector header
4963            let max_ordinal: u64 = self.max_ordinal_present();
4964            encoder.write_num(max_ordinal, offset);
4965            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4966            // Calling encoder.out_of_line_offset(0) is not allowed.
4967            if max_ordinal == 0 {
4968                return Ok(());
4969            }
4970            depth.increment()?;
4971            let envelope_size = 8;
4972            let bytes_len = max_ordinal as usize * envelope_size;
4973            #[allow(unused_variables)]
4974            let offset = encoder.out_of_line_offset(bytes_len);
4975            let mut _prev_end_offset: usize = 0;
4976            if 1 > max_ordinal {
4977                return Ok(());
4978            }
4979
4980            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4981            // are envelope_size bytes.
4982            let cur_offset: usize = (1 - 1) * envelope_size;
4983
4984            // Zero reserved fields.
4985            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4986
4987            // Safety:
4988            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4989            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4990            //   envelope_size bytes, there is always sufficient room.
4991            fidl::encoding::encode_in_envelope_optional::<DeviceInfo, D>(
4992                self.device_info
4993                    .as_ref()
4994                    .map(<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
4995                encoder,
4996                offset + cur_offset,
4997                depth,
4998            )?;
4999
5000            _prev_end_offset = cur_offset + envelope_size;
5001            if 2 > max_ordinal {
5002                return Ok(());
5003            }
5004
5005            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5006            // are envelope_size bytes.
5007            let cur_offset: usize = (2 - 1) * envelope_size;
5008
5009            // Zero reserved fields.
5010            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5011
5012            // Safety:
5013            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5014            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5015            //   envelope_size bytes, there is always sufficient room.
5016            fidl::encoding::encode_in_envelope_optional::<MouseDescriptor, D>(
5017                self.mouse
5018                    .as_ref()
5019                    .map(<MouseDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
5020                encoder,
5021                offset + cur_offset,
5022                depth,
5023            )?;
5024
5025            _prev_end_offset = cur_offset + envelope_size;
5026            if 3 > max_ordinal {
5027                return Ok(());
5028            }
5029
5030            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5031            // are envelope_size bytes.
5032            let cur_offset: usize = (3 - 1) * envelope_size;
5033
5034            // Zero reserved fields.
5035            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5036
5037            // Safety:
5038            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5039            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5040            //   envelope_size bytes, there is always sufficient room.
5041            fidl::encoding::encode_in_envelope_optional::<SensorDescriptor, D>(
5042                self.sensor
5043                    .as_ref()
5044                    .map(<SensorDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
5045                encoder,
5046                offset + cur_offset,
5047                depth,
5048            )?;
5049
5050            _prev_end_offset = cur_offset + envelope_size;
5051            if 4 > max_ordinal {
5052                return Ok(());
5053            }
5054
5055            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5056            // are envelope_size bytes.
5057            let cur_offset: usize = (4 - 1) * envelope_size;
5058
5059            // Zero reserved fields.
5060            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5061
5062            // Safety:
5063            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5064            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5065            //   envelope_size bytes, there is always sufficient room.
5066            fidl::encoding::encode_in_envelope_optional::<TouchDescriptor, D>(
5067                self.touch
5068                    .as_ref()
5069                    .map(<TouchDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
5070                encoder,
5071                offset + cur_offset,
5072                depth,
5073            )?;
5074
5075            _prev_end_offset = cur_offset + envelope_size;
5076            if 5 > max_ordinal {
5077                return Ok(());
5078            }
5079
5080            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5081            // are envelope_size bytes.
5082            let cur_offset: usize = (5 - 1) * envelope_size;
5083
5084            // Zero reserved fields.
5085            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5086
5087            // Safety:
5088            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5089            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5090            //   envelope_size bytes, there is always sufficient room.
5091            fidl::encoding::encode_in_envelope_optional::<KeyboardDescriptor, D>(
5092                self.keyboard
5093                    .as_ref()
5094                    .map(<KeyboardDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
5095                encoder,
5096                offset + cur_offset,
5097                depth,
5098            )?;
5099
5100            _prev_end_offset = cur_offset + envelope_size;
5101            if 6 > max_ordinal {
5102                return Ok(());
5103            }
5104
5105            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5106            // are envelope_size bytes.
5107            let cur_offset: usize = (6 - 1) * envelope_size;
5108
5109            // Zero reserved fields.
5110            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5111
5112            // Safety:
5113            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5114            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5115            //   envelope_size bytes, there is always sufficient room.
5116            fidl::encoding::encode_in_envelope_optional::<ConsumerControlDescriptor, D>(
5117                self.consumer_control
5118                    .as_ref()
5119                    .map(<ConsumerControlDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
5120                encoder,
5121                offset + cur_offset,
5122                depth,
5123            )?;
5124
5125            _prev_end_offset = cur_offset + envelope_size;
5126            if 7 > max_ordinal {
5127                return Ok(());
5128            }
5129
5130            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5131            // are envelope_size bytes.
5132            let cur_offset: usize = (7 - 1) * envelope_size;
5133
5134            // Zero reserved fields.
5135            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5136
5137            // Safety:
5138            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5139            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5140            //   envelope_size bytes, there is always sufficient room.
5141            fidl::encoding::encode_in_envelope_optional::<DeviceInformation, D>(
5142                self.device_information
5143                    .as_ref()
5144                    .map(<DeviceInformation as fidl::encoding::ValueTypeMarker>::borrow),
5145                encoder,
5146                offset + cur_offset,
5147                depth,
5148            )?;
5149
5150            _prev_end_offset = cur_offset + envelope_size;
5151
5152            Ok(())
5153        }
5154    }
5155
5156    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
5157        #[inline(always)]
5158        fn new_empty() -> Self {
5159            Self::default()
5160        }
5161
5162        unsafe fn decode(
5163            &mut self,
5164            decoder: &mut fidl::encoding::Decoder<'_, D>,
5165            offset: usize,
5166            mut depth: fidl::encoding::Depth,
5167        ) -> fidl::Result<()> {
5168            decoder.debug_check_bounds::<Self>(offset);
5169            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5170                None => return Err(fidl::Error::NotNullable),
5171                Some(len) => len,
5172            };
5173            // Calling decoder.out_of_line_offset(0) is not allowed.
5174            if len == 0 {
5175                return Ok(());
5176            };
5177            depth.increment()?;
5178            let envelope_size = 8;
5179            let bytes_len = len * envelope_size;
5180            let offset = decoder.out_of_line_offset(bytes_len)?;
5181            // Decode the envelope for each type.
5182            let mut _next_ordinal_to_read = 0;
5183            let mut next_offset = offset;
5184            let end_offset = offset + bytes_len;
5185            _next_ordinal_to_read += 1;
5186            if next_offset >= end_offset {
5187                return Ok(());
5188            }
5189
5190            // Decode unknown envelopes for gaps in ordinals.
5191            while _next_ordinal_to_read < 1 {
5192                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5193                _next_ordinal_to_read += 1;
5194                next_offset += envelope_size;
5195            }
5196
5197            let next_out_of_line = decoder.next_out_of_line();
5198            let handles_before = decoder.remaining_handles();
5199            if let Some((inlined, num_bytes, num_handles)) =
5200                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5201            {
5202                let member_inline_size =
5203                    <DeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5204                if inlined != (member_inline_size <= 4) {
5205                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5206                }
5207                let inner_offset;
5208                let mut inner_depth = depth.clone();
5209                if inlined {
5210                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5211                    inner_offset = next_offset;
5212                } else {
5213                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5214                    inner_depth.increment()?;
5215                }
5216                let val_ref =
5217                    self.device_info.get_or_insert_with(|| fidl::new_empty!(DeviceInfo, D));
5218                fidl::decode!(DeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5219                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5220                {
5221                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5222                }
5223                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5224                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5225                }
5226            }
5227
5228            next_offset += envelope_size;
5229            _next_ordinal_to_read += 1;
5230            if next_offset >= end_offset {
5231                return Ok(());
5232            }
5233
5234            // Decode unknown envelopes for gaps in ordinals.
5235            while _next_ordinal_to_read < 2 {
5236                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5237                _next_ordinal_to_read += 1;
5238                next_offset += envelope_size;
5239            }
5240
5241            let next_out_of_line = decoder.next_out_of_line();
5242            let handles_before = decoder.remaining_handles();
5243            if let Some((inlined, num_bytes, num_handles)) =
5244                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5245            {
5246                let member_inline_size =
5247                    <MouseDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5248                if inlined != (member_inline_size <= 4) {
5249                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5250                }
5251                let inner_offset;
5252                let mut inner_depth = depth.clone();
5253                if inlined {
5254                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5255                    inner_offset = next_offset;
5256                } else {
5257                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5258                    inner_depth.increment()?;
5259                }
5260                let val_ref =
5261                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseDescriptor, D));
5262                fidl::decode!(MouseDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5263                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5264                {
5265                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5266                }
5267                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5268                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5269                }
5270            }
5271
5272            next_offset += envelope_size;
5273            _next_ordinal_to_read += 1;
5274            if next_offset >= end_offset {
5275                return Ok(());
5276            }
5277
5278            // Decode unknown envelopes for gaps in ordinals.
5279            while _next_ordinal_to_read < 3 {
5280                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5281                _next_ordinal_to_read += 1;
5282                next_offset += envelope_size;
5283            }
5284
5285            let next_out_of_line = decoder.next_out_of_line();
5286            let handles_before = decoder.remaining_handles();
5287            if let Some((inlined, num_bytes, num_handles)) =
5288                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5289            {
5290                let member_inline_size =
5291                    <SensorDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5292                if inlined != (member_inline_size <= 4) {
5293                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5294                }
5295                let inner_offset;
5296                let mut inner_depth = depth.clone();
5297                if inlined {
5298                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5299                    inner_offset = next_offset;
5300                } else {
5301                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5302                    inner_depth.increment()?;
5303                }
5304                let val_ref =
5305                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorDescriptor, D));
5306                fidl::decode!(SensorDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5307                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5308                {
5309                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5310                }
5311                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5312                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5313                }
5314            }
5315
5316            next_offset += envelope_size;
5317            _next_ordinal_to_read += 1;
5318            if next_offset >= end_offset {
5319                return Ok(());
5320            }
5321
5322            // Decode unknown envelopes for gaps in ordinals.
5323            while _next_ordinal_to_read < 4 {
5324                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5325                _next_ordinal_to_read += 1;
5326                next_offset += envelope_size;
5327            }
5328
5329            let next_out_of_line = decoder.next_out_of_line();
5330            let handles_before = decoder.remaining_handles();
5331            if let Some((inlined, num_bytes, num_handles)) =
5332                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5333            {
5334                let member_inline_size =
5335                    <TouchDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5336                if inlined != (member_inline_size <= 4) {
5337                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5338                }
5339                let inner_offset;
5340                let mut inner_depth = depth.clone();
5341                if inlined {
5342                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5343                    inner_offset = next_offset;
5344                } else {
5345                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5346                    inner_depth.increment()?;
5347                }
5348                let val_ref =
5349                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchDescriptor, D));
5350                fidl::decode!(TouchDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5351                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5352                {
5353                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5354                }
5355                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5356                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5357                }
5358            }
5359
5360            next_offset += envelope_size;
5361            _next_ordinal_to_read += 1;
5362            if next_offset >= end_offset {
5363                return Ok(());
5364            }
5365
5366            // Decode unknown envelopes for gaps in ordinals.
5367            while _next_ordinal_to_read < 5 {
5368                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5369                _next_ordinal_to_read += 1;
5370                next_offset += envelope_size;
5371            }
5372
5373            let next_out_of_line = decoder.next_out_of_line();
5374            let handles_before = decoder.remaining_handles();
5375            if let Some((inlined, num_bytes, num_handles)) =
5376                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5377            {
5378                let member_inline_size =
5379                    <KeyboardDescriptor as fidl::encoding::TypeMarker>::inline_size(
5380                        decoder.context,
5381                    );
5382                if inlined != (member_inline_size <= 4) {
5383                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5384                }
5385                let inner_offset;
5386                let mut inner_depth = depth.clone();
5387                if inlined {
5388                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5389                    inner_offset = next_offset;
5390                } else {
5391                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5392                    inner_depth.increment()?;
5393                }
5394                let val_ref =
5395                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardDescriptor, D));
5396                fidl::decode!(KeyboardDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5397                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5398                {
5399                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5400                }
5401                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5402                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5403                }
5404            }
5405
5406            next_offset += envelope_size;
5407            _next_ordinal_to_read += 1;
5408            if next_offset >= end_offset {
5409                return Ok(());
5410            }
5411
5412            // Decode unknown envelopes for gaps in ordinals.
5413            while _next_ordinal_to_read < 6 {
5414                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5415                _next_ordinal_to_read += 1;
5416                next_offset += envelope_size;
5417            }
5418
5419            let next_out_of_line = decoder.next_out_of_line();
5420            let handles_before = decoder.remaining_handles();
5421            if let Some((inlined, num_bytes, num_handles)) =
5422                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5423            {
5424                let member_inline_size =
5425                    <ConsumerControlDescriptor as fidl::encoding::TypeMarker>::inline_size(
5426                        decoder.context,
5427                    );
5428                if inlined != (member_inline_size <= 4) {
5429                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5430                }
5431                let inner_offset;
5432                let mut inner_depth = depth.clone();
5433                if inlined {
5434                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5435                    inner_offset = next_offset;
5436                } else {
5437                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5438                    inner_depth.increment()?;
5439                }
5440                let val_ref = self
5441                    .consumer_control
5442                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlDescriptor, D));
5443                fidl::decode!(
5444                    ConsumerControlDescriptor,
5445                    D,
5446                    val_ref,
5447                    decoder,
5448                    inner_offset,
5449                    inner_depth
5450                )?;
5451                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5452                {
5453                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5454                }
5455                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5456                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5457                }
5458            }
5459
5460            next_offset += envelope_size;
5461            _next_ordinal_to_read += 1;
5462            if next_offset >= end_offset {
5463                return Ok(());
5464            }
5465
5466            // Decode unknown envelopes for gaps in ordinals.
5467            while _next_ordinal_to_read < 7 {
5468                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5469                _next_ordinal_to_read += 1;
5470                next_offset += envelope_size;
5471            }
5472
5473            let next_out_of_line = decoder.next_out_of_line();
5474            let handles_before = decoder.remaining_handles();
5475            if let Some((inlined, num_bytes, num_handles)) =
5476                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5477            {
5478                let member_inline_size =
5479                    <DeviceInformation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5480                if inlined != (member_inline_size <= 4) {
5481                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5482                }
5483                let inner_offset;
5484                let mut inner_depth = depth.clone();
5485                if inlined {
5486                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5487                    inner_offset = next_offset;
5488                } else {
5489                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5490                    inner_depth.increment()?;
5491                }
5492                let val_ref = self
5493                    .device_information
5494                    .get_or_insert_with(|| fidl::new_empty!(DeviceInformation, D));
5495                fidl::decode!(DeviceInformation, D, val_ref, decoder, inner_offset, inner_depth)?;
5496                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5497                {
5498                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5499                }
5500                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5501                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5502                }
5503            }
5504
5505            next_offset += envelope_size;
5506
5507            // Decode the remaining unknown envelopes.
5508            while next_offset < end_offset {
5509                _next_ordinal_to_read += 1;
5510                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5511                next_offset += envelope_size;
5512            }
5513
5514            Ok(())
5515        }
5516    }
5517
5518    impl DeviceInformation {
5519        #[inline(always)]
5520        fn max_ordinal_present(&self) -> u64 {
5521            if let Some(_) = self.polling_rate {
5522                return 4;
5523            }
5524            if let Some(_) = self.version {
5525                return 3;
5526            }
5527            if let Some(_) = self.product_id {
5528                return 2;
5529            }
5530            if let Some(_) = self.vendor_id {
5531                return 1;
5532            }
5533            0
5534        }
5535    }
5536
5537    impl fidl::encoding::ValueTypeMarker for DeviceInformation {
5538        type Borrowed<'a> = &'a Self;
5539        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5540            value
5541        }
5542    }
5543
5544    unsafe impl fidl::encoding::TypeMarker for DeviceInformation {
5545        type Owned = Self;
5546
5547        #[inline(always)]
5548        fn inline_align(_context: fidl::encoding::Context) -> usize {
5549            8
5550        }
5551
5552        #[inline(always)]
5553        fn inline_size(_context: fidl::encoding::Context) -> usize {
5554            16
5555        }
5556    }
5557
5558    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInformation, D>
5559        for &DeviceInformation
5560    {
5561        unsafe fn encode(
5562            self,
5563            encoder: &mut fidl::encoding::Encoder<'_, D>,
5564            offset: usize,
5565            mut depth: fidl::encoding::Depth,
5566        ) -> fidl::Result<()> {
5567            encoder.debug_check_bounds::<DeviceInformation>(offset);
5568            // Vector header
5569            let max_ordinal: u64 = self.max_ordinal_present();
5570            encoder.write_num(max_ordinal, offset);
5571            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5572            // Calling encoder.out_of_line_offset(0) is not allowed.
5573            if max_ordinal == 0 {
5574                return Ok(());
5575            }
5576            depth.increment()?;
5577            let envelope_size = 8;
5578            let bytes_len = max_ordinal as usize * envelope_size;
5579            #[allow(unused_variables)]
5580            let offset = encoder.out_of_line_offset(bytes_len);
5581            let mut _prev_end_offset: usize = 0;
5582            if 1 > max_ordinal {
5583                return Ok(());
5584            }
5585
5586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5587            // are envelope_size bytes.
5588            let cur_offset: usize = (1 - 1) * envelope_size;
5589
5590            // Zero reserved fields.
5591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5592
5593            // Safety:
5594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5596            //   envelope_size bytes, there is always sufficient room.
5597            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5598                self.vendor_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5599                encoder,
5600                offset + cur_offset,
5601                depth,
5602            )?;
5603
5604            _prev_end_offset = cur_offset + envelope_size;
5605            if 2 > max_ordinal {
5606                return Ok(());
5607            }
5608
5609            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5610            // are envelope_size bytes.
5611            let cur_offset: usize = (2 - 1) * envelope_size;
5612
5613            // Zero reserved fields.
5614            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5615
5616            // Safety:
5617            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5618            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5619            //   envelope_size bytes, there is always sufficient room.
5620            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5621                self.product_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5622                encoder,
5623                offset + cur_offset,
5624                depth,
5625            )?;
5626
5627            _prev_end_offset = cur_offset + envelope_size;
5628            if 3 > max_ordinal {
5629                return Ok(());
5630            }
5631
5632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5633            // are envelope_size bytes.
5634            let cur_offset: usize = (3 - 1) * envelope_size;
5635
5636            // Zero reserved fields.
5637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5638
5639            // Safety:
5640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5642            //   envelope_size bytes, there is always sufficient room.
5643            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5644                self.version.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5645                encoder,
5646                offset + cur_offset,
5647                depth,
5648            )?;
5649
5650            _prev_end_offset = cur_offset + envelope_size;
5651            if 4 > max_ordinal {
5652                return Ok(());
5653            }
5654
5655            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5656            // are envelope_size bytes.
5657            let cur_offset: usize = (4 - 1) * envelope_size;
5658
5659            // Zero reserved fields.
5660            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5661
5662            // Safety:
5663            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5664            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5665            //   envelope_size bytes, there is always sufficient room.
5666            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5667                self.polling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5668                encoder,
5669                offset + cur_offset,
5670                depth,
5671            )?;
5672
5673            _prev_end_offset = cur_offset + envelope_size;
5674
5675            Ok(())
5676        }
5677    }
5678
5679    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInformation {
5680        #[inline(always)]
5681        fn new_empty() -> Self {
5682            Self::default()
5683        }
5684
5685        unsafe fn decode(
5686            &mut self,
5687            decoder: &mut fidl::encoding::Decoder<'_, D>,
5688            offset: usize,
5689            mut depth: fidl::encoding::Depth,
5690        ) -> fidl::Result<()> {
5691            decoder.debug_check_bounds::<Self>(offset);
5692            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5693                None => return Err(fidl::Error::NotNullable),
5694                Some(len) => len,
5695            };
5696            // Calling decoder.out_of_line_offset(0) is not allowed.
5697            if len == 0 {
5698                return Ok(());
5699            };
5700            depth.increment()?;
5701            let envelope_size = 8;
5702            let bytes_len = len * envelope_size;
5703            let offset = decoder.out_of_line_offset(bytes_len)?;
5704            // Decode the envelope for each type.
5705            let mut _next_ordinal_to_read = 0;
5706            let mut next_offset = offset;
5707            let end_offset = offset + bytes_len;
5708            _next_ordinal_to_read += 1;
5709            if next_offset >= end_offset {
5710                return Ok(());
5711            }
5712
5713            // Decode unknown envelopes for gaps in ordinals.
5714            while _next_ordinal_to_read < 1 {
5715                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5716                _next_ordinal_to_read += 1;
5717                next_offset += envelope_size;
5718            }
5719
5720            let next_out_of_line = decoder.next_out_of_line();
5721            let handles_before = decoder.remaining_handles();
5722            if let Some((inlined, num_bytes, num_handles)) =
5723                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5724            {
5725                let member_inline_size =
5726                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5727                if inlined != (member_inline_size <= 4) {
5728                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5729                }
5730                let inner_offset;
5731                let mut inner_depth = depth.clone();
5732                if inlined {
5733                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5734                    inner_offset = next_offset;
5735                } else {
5736                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5737                    inner_depth.increment()?;
5738                }
5739                let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5740                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5741                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5742                {
5743                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5744                }
5745                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5746                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5747                }
5748            }
5749
5750            next_offset += envelope_size;
5751            _next_ordinal_to_read += 1;
5752            if next_offset >= end_offset {
5753                return Ok(());
5754            }
5755
5756            // Decode unknown envelopes for gaps in ordinals.
5757            while _next_ordinal_to_read < 2 {
5758                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5759                _next_ordinal_to_read += 1;
5760                next_offset += envelope_size;
5761            }
5762
5763            let next_out_of_line = decoder.next_out_of_line();
5764            let handles_before = decoder.remaining_handles();
5765            if let Some((inlined, num_bytes, num_handles)) =
5766                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5767            {
5768                let member_inline_size =
5769                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5770                if inlined != (member_inline_size <= 4) {
5771                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5772                }
5773                let inner_offset;
5774                let mut inner_depth = depth.clone();
5775                if inlined {
5776                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5777                    inner_offset = next_offset;
5778                } else {
5779                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5780                    inner_depth.increment()?;
5781                }
5782                let val_ref = self.product_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5783                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5784                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5785                {
5786                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5787                }
5788                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5789                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5790                }
5791            }
5792
5793            next_offset += envelope_size;
5794            _next_ordinal_to_read += 1;
5795            if next_offset >= end_offset {
5796                return Ok(());
5797            }
5798
5799            // Decode unknown envelopes for gaps in ordinals.
5800            while _next_ordinal_to_read < 3 {
5801                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5802                _next_ordinal_to_read += 1;
5803                next_offset += envelope_size;
5804            }
5805
5806            let next_out_of_line = decoder.next_out_of_line();
5807            let handles_before = decoder.remaining_handles();
5808            if let Some((inlined, num_bytes, num_handles)) =
5809                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5810            {
5811                let member_inline_size =
5812                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5813                if inlined != (member_inline_size <= 4) {
5814                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5815                }
5816                let inner_offset;
5817                let mut inner_depth = depth.clone();
5818                if inlined {
5819                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5820                    inner_offset = next_offset;
5821                } else {
5822                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5823                    inner_depth.increment()?;
5824                }
5825                let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(u32, D));
5826                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5828                {
5829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5830                }
5831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5833                }
5834            }
5835
5836            next_offset += envelope_size;
5837            _next_ordinal_to_read += 1;
5838            if next_offset >= end_offset {
5839                return Ok(());
5840            }
5841
5842            // Decode unknown envelopes for gaps in ordinals.
5843            while _next_ordinal_to_read < 4 {
5844                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5845                _next_ordinal_to_read += 1;
5846                next_offset += envelope_size;
5847            }
5848
5849            let next_out_of_line = decoder.next_out_of_line();
5850            let handles_before = decoder.remaining_handles();
5851            if let Some((inlined, num_bytes, num_handles)) =
5852                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5853            {
5854                let member_inline_size =
5855                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5856                if inlined != (member_inline_size <= 4) {
5857                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5858                }
5859                let inner_offset;
5860                let mut inner_depth = depth.clone();
5861                if inlined {
5862                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5863                    inner_offset = next_offset;
5864                } else {
5865                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5866                    inner_depth.increment()?;
5867                }
5868                let val_ref = self.polling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
5869                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5870                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5871                {
5872                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5873                }
5874                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5875                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5876                }
5877            }
5878
5879            next_offset += envelope_size;
5880
5881            // Decode the remaining unknown envelopes.
5882            while next_offset < end_offset {
5883                _next_ordinal_to_read += 1;
5884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5885                next_offset += envelope_size;
5886            }
5887
5888            Ok(())
5889        }
5890    }
5891
5892    impl FeatureReport {
5893        #[inline(always)]
5894        fn max_ordinal_present(&self) -> u64 {
5895            if let Some(_) = self.touch {
5896                return 2;
5897            }
5898            if let Some(_) = self.sensor {
5899                return 1;
5900            }
5901            0
5902        }
5903    }
5904
5905    impl fidl::encoding::ValueTypeMarker for FeatureReport {
5906        type Borrowed<'a> = &'a Self;
5907        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5908            value
5909        }
5910    }
5911
5912    unsafe impl fidl::encoding::TypeMarker for FeatureReport {
5913        type Owned = Self;
5914
5915        #[inline(always)]
5916        fn inline_align(_context: fidl::encoding::Context) -> usize {
5917            8
5918        }
5919
5920        #[inline(always)]
5921        fn inline_size(_context: fidl::encoding::Context) -> usize {
5922            16
5923        }
5924    }
5925
5926    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FeatureReport, D>
5927        for &FeatureReport
5928    {
5929        unsafe fn encode(
5930            self,
5931            encoder: &mut fidl::encoding::Encoder<'_, D>,
5932            offset: usize,
5933            mut depth: fidl::encoding::Depth,
5934        ) -> fidl::Result<()> {
5935            encoder.debug_check_bounds::<FeatureReport>(offset);
5936            // Vector header
5937            let max_ordinal: u64 = self.max_ordinal_present();
5938            encoder.write_num(max_ordinal, offset);
5939            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5940            // Calling encoder.out_of_line_offset(0) is not allowed.
5941            if max_ordinal == 0 {
5942                return Ok(());
5943            }
5944            depth.increment()?;
5945            let envelope_size = 8;
5946            let bytes_len = max_ordinal as usize * envelope_size;
5947            #[allow(unused_variables)]
5948            let offset = encoder.out_of_line_offset(bytes_len);
5949            let mut _prev_end_offset: usize = 0;
5950            if 1 > max_ordinal {
5951                return Ok(());
5952            }
5953
5954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5955            // are envelope_size bytes.
5956            let cur_offset: usize = (1 - 1) * envelope_size;
5957
5958            // Zero reserved fields.
5959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5960
5961            // Safety:
5962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5964            //   envelope_size bytes, there is always sufficient room.
5965            fidl::encoding::encode_in_envelope_optional::<SensorFeatureReport, D>(
5966                self.sensor
5967                    .as_ref()
5968                    .map(<SensorFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5969                encoder,
5970                offset + cur_offset,
5971                depth,
5972            )?;
5973
5974            _prev_end_offset = cur_offset + envelope_size;
5975            if 2 > max_ordinal {
5976                return Ok(());
5977            }
5978
5979            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5980            // are envelope_size bytes.
5981            let cur_offset: usize = (2 - 1) * envelope_size;
5982
5983            // Zero reserved fields.
5984            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5985
5986            // Safety:
5987            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5988            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5989            //   envelope_size bytes, there is always sufficient room.
5990            fidl::encoding::encode_in_envelope_optional::<TouchFeatureReport, D>(
5991                self.touch
5992                    .as_ref()
5993                    .map(<TouchFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5994                encoder,
5995                offset + cur_offset,
5996                depth,
5997            )?;
5998
5999            _prev_end_offset = cur_offset + envelope_size;
6000
6001            Ok(())
6002        }
6003    }
6004
6005    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FeatureReport {
6006        #[inline(always)]
6007        fn new_empty() -> Self {
6008            Self::default()
6009        }
6010
6011        unsafe fn decode(
6012            &mut self,
6013            decoder: &mut fidl::encoding::Decoder<'_, D>,
6014            offset: usize,
6015            mut depth: fidl::encoding::Depth,
6016        ) -> fidl::Result<()> {
6017            decoder.debug_check_bounds::<Self>(offset);
6018            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6019                None => return Err(fidl::Error::NotNullable),
6020                Some(len) => len,
6021            };
6022            // Calling decoder.out_of_line_offset(0) is not allowed.
6023            if len == 0 {
6024                return Ok(());
6025            };
6026            depth.increment()?;
6027            let envelope_size = 8;
6028            let bytes_len = len * envelope_size;
6029            let offset = decoder.out_of_line_offset(bytes_len)?;
6030            // Decode the envelope for each type.
6031            let mut _next_ordinal_to_read = 0;
6032            let mut next_offset = offset;
6033            let end_offset = offset + bytes_len;
6034            _next_ordinal_to_read += 1;
6035            if next_offset >= end_offset {
6036                return Ok(());
6037            }
6038
6039            // Decode unknown envelopes for gaps in ordinals.
6040            while _next_ordinal_to_read < 1 {
6041                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6042                _next_ordinal_to_read += 1;
6043                next_offset += envelope_size;
6044            }
6045
6046            let next_out_of_line = decoder.next_out_of_line();
6047            let handles_before = decoder.remaining_handles();
6048            if let Some((inlined, num_bytes, num_handles)) =
6049                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6050            {
6051                let member_inline_size =
6052                    <SensorFeatureReport as fidl::encoding::TypeMarker>::inline_size(
6053                        decoder.context,
6054                    );
6055                if inlined != (member_inline_size <= 4) {
6056                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6057                }
6058                let inner_offset;
6059                let mut inner_depth = depth.clone();
6060                if inlined {
6061                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6062                    inner_offset = next_offset;
6063                } else {
6064                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6065                    inner_depth.increment()?;
6066                }
6067                let val_ref =
6068                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorFeatureReport, D));
6069                fidl::decode!(SensorFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6070                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6071                {
6072                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6073                }
6074                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6075                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6076                }
6077            }
6078
6079            next_offset += envelope_size;
6080            _next_ordinal_to_read += 1;
6081            if next_offset >= end_offset {
6082                return Ok(());
6083            }
6084
6085            // Decode unknown envelopes for gaps in ordinals.
6086            while _next_ordinal_to_read < 2 {
6087                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6088                _next_ordinal_to_read += 1;
6089                next_offset += envelope_size;
6090            }
6091
6092            let next_out_of_line = decoder.next_out_of_line();
6093            let handles_before = decoder.remaining_handles();
6094            if let Some((inlined, num_bytes, num_handles)) =
6095                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6096            {
6097                let member_inline_size =
6098                    <TouchFeatureReport as fidl::encoding::TypeMarker>::inline_size(
6099                        decoder.context,
6100                    );
6101                if inlined != (member_inline_size <= 4) {
6102                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6103                }
6104                let inner_offset;
6105                let mut inner_depth = depth.clone();
6106                if inlined {
6107                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6108                    inner_offset = next_offset;
6109                } else {
6110                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6111                    inner_depth.increment()?;
6112                }
6113                let val_ref =
6114                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchFeatureReport, D));
6115                fidl::decode!(TouchFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6116                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6117                {
6118                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6119                }
6120                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6121                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6122                }
6123            }
6124
6125            next_offset += envelope_size;
6126
6127            // Decode the remaining unknown envelopes.
6128            while next_offset < end_offset {
6129                _next_ordinal_to_read += 1;
6130                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6131                next_offset += envelope_size;
6132            }
6133
6134            Ok(())
6135        }
6136    }
6137
6138    impl InputReport {
6139        #[inline(always)]
6140        fn max_ordinal_present(&self) -> u64 {
6141            if let Some(_) = self.report_id {
6142                return 8;
6143            }
6144            if let Some(_) = self.consumer_control {
6145                return 7;
6146            }
6147            if let Some(_) = self.keyboard {
6148                return 6;
6149            }
6150            if let Some(_) = self.touch {
6151                return 5;
6152            }
6153            if let Some(_) = self.sensor {
6154                return 4;
6155            }
6156            if let Some(_) = self.trace_id {
6157                return 3;
6158            }
6159            if let Some(_) = self.mouse {
6160                return 2;
6161            }
6162            if let Some(_) = self.event_time {
6163                return 1;
6164            }
6165            0
6166        }
6167    }
6168
6169    impl fidl::encoding::ValueTypeMarker for InputReport {
6170        type Borrowed<'a> = &'a Self;
6171        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6172            value
6173        }
6174    }
6175
6176    unsafe impl fidl::encoding::TypeMarker for InputReport {
6177        type Owned = Self;
6178
6179        #[inline(always)]
6180        fn inline_align(_context: fidl::encoding::Context) -> usize {
6181            8
6182        }
6183
6184        #[inline(always)]
6185        fn inline_size(_context: fidl::encoding::Context) -> usize {
6186            16
6187        }
6188    }
6189
6190    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
6191        for &InputReport
6192    {
6193        unsafe fn encode(
6194            self,
6195            encoder: &mut fidl::encoding::Encoder<'_, D>,
6196            offset: usize,
6197            mut depth: fidl::encoding::Depth,
6198        ) -> fidl::Result<()> {
6199            encoder.debug_check_bounds::<InputReport>(offset);
6200            // Vector header
6201            let max_ordinal: u64 = self.max_ordinal_present();
6202            encoder.write_num(max_ordinal, offset);
6203            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6204            // Calling encoder.out_of_line_offset(0) is not allowed.
6205            if max_ordinal == 0 {
6206                return Ok(());
6207            }
6208            depth.increment()?;
6209            let envelope_size = 8;
6210            let bytes_len = max_ordinal as usize * envelope_size;
6211            #[allow(unused_variables)]
6212            let offset = encoder.out_of_line_offset(bytes_len);
6213            let mut _prev_end_offset: usize = 0;
6214            if 1 > max_ordinal {
6215                return Ok(());
6216            }
6217
6218            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6219            // are envelope_size bytes.
6220            let cur_offset: usize = (1 - 1) * envelope_size;
6221
6222            // Zero reserved fields.
6223            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6224
6225            // Safety:
6226            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6227            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6228            //   envelope_size bytes, there is always sufficient room.
6229            fidl::encoding::encode_in_envelope_optional::<i64, D>(
6230                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6231                encoder,
6232                offset + cur_offset,
6233                depth,
6234            )?;
6235
6236            _prev_end_offset = cur_offset + envelope_size;
6237            if 2 > max_ordinal {
6238                return Ok(());
6239            }
6240
6241            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6242            // are envelope_size bytes.
6243            let cur_offset: usize = (2 - 1) * envelope_size;
6244
6245            // Zero reserved fields.
6246            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6247
6248            // Safety:
6249            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6250            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6251            //   envelope_size bytes, there is always sufficient room.
6252            fidl::encoding::encode_in_envelope_optional::<MouseInputReport, D>(
6253                self.mouse
6254                    .as_ref()
6255                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6256                encoder,
6257                offset + cur_offset,
6258                depth,
6259            )?;
6260
6261            _prev_end_offset = cur_offset + envelope_size;
6262            if 3 > max_ordinal {
6263                return Ok(());
6264            }
6265
6266            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6267            // are envelope_size bytes.
6268            let cur_offset: usize = (3 - 1) * envelope_size;
6269
6270            // Zero reserved fields.
6271            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6272
6273            // Safety:
6274            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6275            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6276            //   envelope_size bytes, there is always sufficient room.
6277            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6278                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6279                encoder,
6280                offset + cur_offset,
6281                depth,
6282            )?;
6283
6284            _prev_end_offset = cur_offset + envelope_size;
6285            if 4 > max_ordinal {
6286                return Ok(());
6287            }
6288
6289            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6290            // are envelope_size bytes.
6291            let cur_offset: usize = (4 - 1) * envelope_size;
6292
6293            // Zero reserved fields.
6294            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6295
6296            // Safety:
6297            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6298            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6299            //   envelope_size bytes, there is always sufficient room.
6300            fidl::encoding::encode_in_envelope_optional::<SensorInputReport, D>(
6301                self.sensor
6302                    .as_ref()
6303                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6304                encoder,
6305                offset + cur_offset,
6306                depth,
6307            )?;
6308
6309            _prev_end_offset = cur_offset + envelope_size;
6310            if 5 > max_ordinal {
6311                return Ok(());
6312            }
6313
6314            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6315            // are envelope_size bytes.
6316            let cur_offset: usize = (5 - 1) * envelope_size;
6317
6318            // Zero reserved fields.
6319            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6320
6321            // Safety:
6322            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6323            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6324            //   envelope_size bytes, there is always sufficient room.
6325            fidl::encoding::encode_in_envelope_optional::<TouchInputReport, D>(
6326                self.touch
6327                    .as_ref()
6328                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6329                encoder,
6330                offset + cur_offset,
6331                depth,
6332            )?;
6333
6334            _prev_end_offset = cur_offset + envelope_size;
6335            if 6 > max_ordinal {
6336                return Ok(());
6337            }
6338
6339            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6340            // are envelope_size bytes.
6341            let cur_offset: usize = (6 - 1) * envelope_size;
6342
6343            // Zero reserved fields.
6344            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6345
6346            // Safety:
6347            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6348            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6349            //   envelope_size bytes, there is always sufficient room.
6350            fidl::encoding::encode_in_envelope_optional::<KeyboardInputReport, D>(
6351                self.keyboard
6352                    .as_ref()
6353                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6354                encoder,
6355                offset + cur_offset,
6356                depth,
6357            )?;
6358
6359            _prev_end_offset = cur_offset + envelope_size;
6360            if 7 > max_ordinal {
6361                return Ok(());
6362            }
6363
6364            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6365            // are envelope_size bytes.
6366            let cur_offset: usize = (7 - 1) * envelope_size;
6367
6368            // Zero reserved fields.
6369            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6370
6371            // Safety:
6372            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6373            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6374            //   envelope_size bytes, there is always sufficient room.
6375            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputReport, D>(
6376                self.consumer_control
6377                    .as_ref()
6378                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6379                encoder,
6380                offset + cur_offset,
6381                depth,
6382            )?;
6383
6384            _prev_end_offset = cur_offset + envelope_size;
6385            if 8 > max_ordinal {
6386                return Ok(());
6387            }
6388
6389            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6390            // are envelope_size bytes.
6391            let cur_offset: usize = (8 - 1) * envelope_size;
6392
6393            // Zero reserved fields.
6394            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6395
6396            // Safety:
6397            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6398            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6399            //   envelope_size bytes, there is always sufficient room.
6400            fidl::encoding::encode_in_envelope_optional::<u8, D>(
6401                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
6402                encoder,
6403                offset + cur_offset,
6404                depth,
6405            )?;
6406
6407            _prev_end_offset = cur_offset + envelope_size;
6408
6409            Ok(())
6410        }
6411    }
6412
6413    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
6414        #[inline(always)]
6415        fn new_empty() -> Self {
6416            Self::default()
6417        }
6418
6419        unsafe fn decode(
6420            &mut self,
6421            decoder: &mut fidl::encoding::Decoder<'_, D>,
6422            offset: usize,
6423            mut depth: fidl::encoding::Depth,
6424        ) -> fidl::Result<()> {
6425            decoder.debug_check_bounds::<Self>(offset);
6426            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6427                None => return Err(fidl::Error::NotNullable),
6428                Some(len) => len,
6429            };
6430            // Calling decoder.out_of_line_offset(0) is not allowed.
6431            if len == 0 {
6432                return Ok(());
6433            };
6434            depth.increment()?;
6435            let envelope_size = 8;
6436            let bytes_len = len * envelope_size;
6437            let offset = decoder.out_of_line_offset(bytes_len)?;
6438            // Decode the envelope for each type.
6439            let mut _next_ordinal_to_read = 0;
6440            let mut next_offset = offset;
6441            let end_offset = offset + bytes_len;
6442            _next_ordinal_to_read += 1;
6443            if next_offset >= end_offset {
6444                return Ok(());
6445            }
6446
6447            // Decode unknown envelopes for gaps in ordinals.
6448            while _next_ordinal_to_read < 1 {
6449                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6450                _next_ordinal_to_read += 1;
6451                next_offset += envelope_size;
6452            }
6453
6454            let next_out_of_line = decoder.next_out_of_line();
6455            let handles_before = decoder.remaining_handles();
6456            if let Some((inlined, num_bytes, num_handles)) =
6457                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6458            {
6459                let member_inline_size =
6460                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6461                if inlined != (member_inline_size <= 4) {
6462                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6463                }
6464                let inner_offset;
6465                let mut inner_depth = depth.clone();
6466                if inlined {
6467                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6468                    inner_offset = next_offset;
6469                } else {
6470                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6471                    inner_depth.increment()?;
6472                }
6473                let val_ref = self.event_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
6474                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6475                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6476                {
6477                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6478                }
6479                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6480                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6481                }
6482            }
6483
6484            next_offset += envelope_size;
6485            _next_ordinal_to_read += 1;
6486            if next_offset >= end_offset {
6487                return Ok(());
6488            }
6489
6490            // Decode unknown envelopes for gaps in ordinals.
6491            while _next_ordinal_to_read < 2 {
6492                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6493                _next_ordinal_to_read += 1;
6494                next_offset += envelope_size;
6495            }
6496
6497            let next_out_of_line = decoder.next_out_of_line();
6498            let handles_before = decoder.remaining_handles();
6499            if let Some((inlined, num_bytes, num_handles)) =
6500                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6501            {
6502                let member_inline_size =
6503                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6504                if inlined != (member_inline_size <= 4) {
6505                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6506                }
6507                let inner_offset;
6508                let mut inner_depth = depth.clone();
6509                if inlined {
6510                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6511                    inner_offset = next_offset;
6512                } else {
6513                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6514                    inner_depth.increment()?;
6515                }
6516                let val_ref =
6517                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseInputReport, D));
6518                fidl::decode!(MouseInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6519                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6520                {
6521                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6522                }
6523                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6524                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6525                }
6526            }
6527
6528            next_offset += envelope_size;
6529            _next_ordinal_to_read += 1;
6530            if next_offset >= end_offset {
6531                return Ok(());
6532            }
6533
6534            // Decode unknown envelopes for gaps in ordinals.
6535            while _next_ordinal_to_read < 3 {
6536                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6537                _next_ordinal_to_read += 1;
6538                next_offset += envelope_size;
6539            }
6540
6541            let next_out_of_line = decoder.next_out_of_line();
6542            let handles_before = decoder.remaining_handles();
6543            if let Some((inlined, num_bytes, num_handles)) =
6544                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6545            {
6546                let member_inline_size =
6547                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6548                if inlined != (member_inline_size <= 4) {
6549                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6550                }
6551                let inner_offset;
6552                let mut inner_depth = depth.clone();
6553                if inlined {
6554                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6555                    inner_offset = next_offset;
6556                } else {
6557                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6558                    inner_depth.increment()?;
6559                }
6560                let val_ref = self.trace_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
6561                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6562                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6563                {
6564                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6565                }
6566                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6567                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6568                }
6569            }
6570
6571            next_offset += envelope_size;
6572            _next_ordinal_to_read += 1;
6573            if next_offset >= end_offset {
6574                return Ok(());
6575            }
6576
6577            // Decode unknown envelopes for gaps in ordinals.
6578            while _next_ordinal_to_read < 4 {
6579                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6580                _next_ordinal_to_read += 1;
6581                next_offset += envelope_size;
6582            }
6583
6584            let next_out_of_line = decoder.next_out_of_line();
6585            let handles_before = decoder.remaining_handles();
6586            if let Some((inlined, num_bytes, num_handles)) =
6587                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6588            {
6589                let member_inline_size =
6590                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6591                if inlined != (member_inline_size <= 4) {
6592                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6593                }
6594                let inner_offset;
6595                let mut inner_depth = depth.clone();
6596                if inlined {
6597                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6598                    inner_offset = next_offset;
6599                } else {
6600                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6601                    inner_depth.increment()?;
6602                }
6603                let val_ref =
6604                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorInputReport, D));
6605                fidl::decode!(SensorInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6606                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6607                {
6608                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6609                }
6610                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6611                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6612                }
6613            }
6614
6615            next_offset += envelope_size;
6616            _next_ordinal_to_read += 1;
6617            if next_offset >= end_offset {
6618                return Ok(());
6619            }
6620
6621            // Decode unknown envelopes for gaps in ordinals.
6622            while _next_ordinal_to_read < 5 {
6623                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6624                _next_ordinal_to_read += 1;
6625                next_offset += envelope_size;
6626            }
6627
6628            let next_out_of_line = decoder.next_out_of_line();
6629            let handles_before = decoder.remaining_handles();
6630            if let Some((inlined, num_bytes, num_handles)) =
6631                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6632            {
6633                let member_inline_size =
6634                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6635                if inlined != (member_inline_size <= 4) {
6636                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6637                }
6638                let inner_offset;
6639                let mut inner_depth = depth.clone();
6640                if inlined {
6641                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6642                    inner_offset = next_offset;
6643                } else {
6644                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6645                    inner_depth.increment()?;
6646                }
6647                let val_ref =
6648                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchInputReport, D));
6649                fidl::decode!(TouchInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6650                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6651                {
6652                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6653                }
6654                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6655                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6656                }
6657            }
6658
6659            next_offset += envelope_size;
6660            _next_ordinal_to_read += 1;
6661            if next_offset >= end_offset {
6662                return Ok(());
6663            }
6664
6665            // Decode unknown envelopes for gaps in ordinals.
6666            while _next_ordinal_to_read < 6 {
6667                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6668                _next_ordinal_to_read += 1;
6669                next_offset += envelope_size;
6670            }
6671
6672            let next_out_of_line = decoder.next_out_of_line();
6673            let handles_before = decoder.remaining_handles();
6674            if let Some((inlined, num_bytes, num_handles)) =
6675                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6676            {
6677                let member_inline_size =
6678                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
6679                        decoder.context,
6680                    );
6681                if inlined != (member_inline_size <= 4) {
6682                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6683                }
6684                let inner_offset;
6685                let mut inner_depth = depth.clone();
6686                if inlined {
6687                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6688                    inner_offset = next_offset;
6689                } else {
6690                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6691                    inner_depth.increment()?;
6692                }
6693                let val_ref =
6694                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardInputReport, D));
6695                fidl::decode!(KeyboardInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6696                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6697                {
6698                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6699                }
6700                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6701                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6702                }
6703            }
6704
6705            next_offset += envelope_size;
6706            _next_ordinal_to_read += 1;
6707            if next_offset >= end_offset {
6708                return Ok(());
6709            }
6710
6711            // Decode unknown envelopes for gaps in ordinals.
6712            while _next_ordinal_to_read < 7 {
6713                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6714                _next_ordinal_to_read += 1;
6715                next_offset += envelope_size;
6716            }
6717
6718            let next_out_of_line = decoder.next_out_of_line();
6719            let handles_before = decoder.remaining_handles();
6720            if let Some((inlined, num_bytes, num_handles)) =
6721                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6722            {
6723                let member_inline_size =
6724                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
6725                        decoder.context,
6726                    );
6727                if inlined != (member_inline_size <= 4) {
6728                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6729                }
6730                let inner_offset;
6731                let mut inner_depth = depth.clone();
6732                if inlined {
6733                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6734                    inner_offset = next_offset;
6735                } else {
6736                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6737                    inner_depth.increment()?;
6738                }
6739                let val_ref = self
6740                    .consumer_control
6741                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputReport, D));
6742                fidl::decode!(
6743                    ConsumerControlInputReport,
6744                    D,
6745                    val_ref,
6746                    decoder,
6747                    inner_offset,
6748                    inner_depth
6749                )?;
6750                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6751                {
6752                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6753                }
6754                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6755                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6756                }
6757            }
6758
6759            next_offset += envelope_size;
6760            _next_ordinal_to_read += 1;
6761            if next_offset >= end_offset {
6762                return Ok(());
6763            }
6764
6765            // Decode unknown envelopes for gaps in ordinals.
6766            while _next_ordinal_to_read < 8 {
6767                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6768                _next_ordinal_to_read += 1;
6769                next_offset += envelope_size;
6770            }
6771
6772            let next_out_of_line = decoder.next_out_of_line();
6773            let handles_before = decoder.remaining_handles();
6774            if let Some((inlined, num_bytes, num_handles)) =
6775                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6776            {
6777                let member_inline_size =
6778                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6779                if inlined != (member_inline_size <= 4) {
6780                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6781                }
6782                let inner_offset;
6783                let mut inner_depth = depth.clone();
6784                if inlined {
6785                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6786                    inner_offset = next_offset;
6787                } else {
6788                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6789                    inner_depth.increment()?;
6790                }
6791                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
6792                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6793                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6794                {
6795                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6796                }
6797                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6798                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6799                }
6800            }
6801
6802            next_offset += envelope_size;
6803
6804            // Decode the remaining unknown envelopes.
6805            while next_offset < end_offset {
6806                _next_ordinal_to_read += 1;
6807                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6808                next_offset += envelope_size;
6809            }
6810
6811            Ok(())
6812        }
6813    }
6814
6815    impl KeyboardDescriptor {
6816        #[inline(always)]
6817        fn max_ordinal_present(&self) -> u64 {
6818            if let Some(_) = self.output {
6819                return 2;
6820            }
6821            if let Some(_) = self.input {
6822                return 1;
6823            }
6824            0
6825        }
6826    }
6827
6828    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
6829        type Borrowed<'a> = &'a Self;
6830        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6831            value
6832        }
6833    }
6834
6835    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
6836        type Owned = Self;
6837
6838        #[inline(always)]
6839        fn inline_align(_context: fidl::encoding::Context) -> usize {
6840            8
6841        }
6842
6843        #[inline(always)]
6844        fn inline_size(_context: fidl::encoding::Context) -> usize {
6845            16
6846        }
6847    }
6848
6849    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
6850        for &KeyboardDescriptor
6851    {
6852        unsafe fn encode(
6853            self,
6854            encoder: &mut fidl::encoding::Encoder<'_, D>,
6855            offset: usize,
6856            mut depth: fidl::encoding::Depth,
6857        ) -> fidl::Result<()> {
6858            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
6859            // Vector header
6860            let max_ordinal: u64 = self.max_ordinal_present();
6861            encoder.write_num(max_ordinal, offset);
6862            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6863            // Calling encoder.out_of_line_offset(0) is not allowed.
6864            if max_ordinal == 0 {
6865                return Ok(());
6866            }
6867            depth.increment()?;
6868            let envelope_size = 8;
6869            let bytes_len = max_ordinal as usize * envelope_size;
6870            #[allow(unused_variables)]
6871            let offset = encoder.out_of_line_offset(bytes_len);
6872            let mut _prev_end_offset: usize = 0;
6873            if 1 > max_ordinal {
6874                return Ok(());
6875            }
6876
6877            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6878            // are envelope_size bytes.
6879            let cur_offset: usize = (1 - 1) * envelope_size;
6880
6881            // Zero reserved fields.
6882            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6883
6884            // Safety:
6885            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6886            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6887            //   envelope_size bytes, there is always sufficient room.
6888            fidl::encoding::encode_in_envelope_optional::<KeyboardInputDescriptor, D>(
6889                self.input
6890                    .as_ref()
6891                    .map(<KeyboardInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6892                encoder,
6893                offset + cur_offset,
6894                depth,
6895            )?;
6896
6897            _prev_end_offset = cur_offset + envelope_size;
6898            if 2 > max_ordinal {
6899                return Ok(());
6900            }
6901
6902            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6903            // are envelope_size bytes.
6904            let cur_offset: usize = (2 - 1) * envelope_size;
6905
6906            // Zero reserved fields.
6907            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6908
6909            // Safety:
6910            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6911            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6912            //   envelope_size bytes, there is always sufficient room.
6913            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
6914                self.output
6915                    .as_ref()
6916                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6917                encoder,
6918                offset + cur_offset,
6919                depth,
6920            )?;
6921
6922            _prev_end_offset = cur_offset + envelope_size;
6923
6924            Ok(())
6925        }
6926    }
6927
6928    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
6929        #[inline(always)]
6930        fn new_empty() -> Self {
6931            Self::default()
6932        }
6933
6934        unsafe fn decode(
6935            &mut self,
6936            decoder: &mut fidl::encoding::Decoder<'_, D>,
6937            offset: usize,
6938            mut depth: fidl::encoding::Depth,
6939        ) -> fidl::Result<()> {
6940            decoder.debug_check_bounds::<Self>(offset);
6941            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6942                None => return Err(fidl::Error::NotNullable),
6943                Some(len) => len,
6944            };
6945            // Calling decoder.out_of_line_offset(0) is not allowed.
6946            if len == 0 {
6947                return Ok(());
6948            };
6949            depth.increment()?;
6950            let envelope_size = 8;
6951            let bytes_len = len * envelope_size;
6952            let offset = decoder.out_of_line_offset(bytes_len)?;
6953            // Decode the envelope for each type.
6954            let mut _next_ordinal_to_read = 0;
6955            let mut next_offset = offset;
6956            let end_offset = offset + bytes_len;
6957            _next_ordinal_to_read += 1;
6958            if next_offset >= end_offset {
6959                return Ok(());
6960            }
6961
6962            // Decode unknown envelopes for gaps in ordinals.
6963            while _next_ordinal_to_read < 1 {
6964                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6965                _next_ordinal_to_read += 1;
6966                next_offset += envelope_size;
6967            }
6968
6969            let next_out_of_line = decoder.next_out_of_line();
6970            let handles_before = decoder.remaining_handles();
6971            if let Some((inlined, num_bytes, num_handles)) =
6972                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6973            {
6974                let member_inline_size =
6975                    <KeyboardInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6976                        decoder.context,
6977                    );
6978                if inlined != (member_inline_size <= 4) {
6979                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6980                }
6981                let inner_offset;
6982                let mut inner_depth = depth.clone();
6983                if inlined {
6984                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6985                    inner_offset = next_offset;
6986                } else {
6987                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6988                    inner_depth.increment()?;
6989                }
6990                let val_ref =
6991                    self.input.get_or_insert_with(|| fidl::new_empty!(KeyboardInputDescriptor, D));
6992                fidl::decode!(
6993                    KeyboardInputDescriptor,
6994                    D,
6995                    val_ref,
6996                    decoder,
6997                    inner_offset,
6998                    inner_depth
6999                )?;
7000                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7001                {
7002                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7003                }
7004                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7005                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7006                }
7007            }
7008
7009            next_offset += envelope_size;
7010            _next_ordinal_to_read += 1;
7011            if next_offset >= end_offset {
7012                return Ok(());
7013            }
7014
7015            // Decode unknown envelopes for gaps in ordinals.
7016            while _next_ordinal_to_read < 2 {
7017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7018                _next_ordinal_to_read += 1;
7019                next_offset += envelope_size;
7020            }
7021
7022            let next_out_of_line = decoder.next_out_of_line();
7023            let handles_before = decoder.remaining_handles();
7024            if let Some((inlined, num_bytes, num_handles)) =
7025                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7026            {
7027                let member_inline_size =
7028                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
7029                        decoder.context,
7030                    );
7031                if inlined != (member_inline_size <= 4) {
7032                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7033                }
7034                let inner_offset;
7035                let mut inner_depth = depth.clone();
7036                if inlined {
7037                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7038                    inner_offset = next_offset;
7039                } else {
7040                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7041                    inner_depth.increment()?;
7042                }
7043                let val_ref = self
7044                    .output
7045                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
7046                fidl::decode!(
7047                    KeyboardOutputDescriptor,
7048                    D,
7049                    val_ref,
7050                    decoder,
7051                    inner_offset,
7052                    inner_depth
7053                )?;
7054                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7055                {
7056                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7057                }
7058                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7059                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7060                }
7061            }
7062
7063            next_offset += envelope_size;
7064
7065            // Decode the remaining unknown envelopes.
7066            while next_offset < end_offset {
7067                _next_ordinal_to_read += 1;
7068                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7069                next_offset += envelope_size;
7070            }
7071
7072            Ok(())
7073        }
7074    }
7075
7076    impl KeyboardInputDescriptor {
7077        #[inline(always)]
7078        fn max_ordinal_present(&self) -> u64 {
7079            if let Some(_) = self.keys3 {
7080                return 2;
7081            }
7082            0
7083        }
7084    }
7085
7086    impl fidl::encoding::ValueTypeMarker for KeyboardInputDescriptor {
7087        type Borrowed<'a> = &'a Self;
7088        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7089            value
7090        }
7091    }
7092
7093    unsafe impl fidl::encoding::TypeMarker for KeyboardInputDescriptor {
7094        type Owned = Self;
7095
7096        #[inline(always)]
7097        fn inline_align(_context: fidl::encoding::Context) -> usize {
7098            8
7099        }
7100
7101        #[inline(always)]
7102        fn inline_size(_context: fidl::encoding::Context) -> usize {
7103            16
7104        }
7105    }
7106
7107    unsafe impl<D: fidl::encoding::ResourceDialect>
7108        fidl::encoding::Encode<KeyboardInputDescriptor, D> for &KeyboardInputDescriptor
7109    {
7110        unsafe fn encode(
7111            self,
7112            encoder: &mut fidl::encoding::Encoder<'_, D>,
7113            offset: usize,
7114            mut depth: fidl::encoding::Depth,
7115        ) -> fidl::Result<()> {
7116            encoder.debug_check_bounds::<KeyboardInputDescriptor>(offset);
7117            // Vector header
7118            let max_ordinal: u64 = self.max_ordinal_present();
7119            encoder.write_num(max_ordinal, offset);
7120            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7121            // Calling encoder.out_of_line_offset(0) is not allowed.
7122            if max_ordinal == 0 {
7123                return Ok(());
7124            }
7125            depth.increment()?;
7126            let envelope_size = 8;
7127            let bytes_len = max_ordinal as usize * envelope_size;
7128            #[allow(unused_variables)]
7129            let offset = encoder.out_of_line_offset(bytes_len);
7130            let mut _prev_end_offset: usize = 0;
7131            if 2 > max_ordinal {
7132                return Ok(());
7133            }
7134
7135            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7136            // are envelope_size bytes.
7137            let cur_offset: usize = (2 - 1) * envelope_size;
7138
7139            // Zero reserved fields.
7140            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7141
7142            // Safety:
7143            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7144            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7145            //   envelope_size bytes, there is always sufficient room.
7146            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7147            self.keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7148            encoder, offset + cur_offset, depth
7149        )?;
7150
7151            _prev_end_offset = cur_offset + envelope_size;
7152
7153            Ok(())
7154        }
7155    }
7156
7157    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7158        for KeyboardInputDescriptor
7159    {
7160        #[inline(always)]
7161        fn new_empty() -> Self {
7162            Self::default()
7163        }
7164
7165        unsafe fn decode(
7166            &mut self,
7167            decoder: &mut fidl::encoding::Decoder<'_, D>,
7168            offset: usize,
7169            mut depth: fidl::encoding::Depth,
7170        ) -> fidl::Result<()> {
7171            decoder.debug_check_bounds::<Self>(offset);
7172            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7173                None => return Err(fidl::Error::NotNullable),
7174                Some(len) => len,
7175            };
7176            // Calling decoder.out_of_line_offset(0) is not allowed.
7177            if len == 0 {
7178                return Ok(());
7179            };
7180            depth.increment()?;
7181            let envelope_size = 8;
7182            let bytes_len = len * envelope_size;
7183            let offset = decoder.out_of_line_offset(bytes_len)?;
7184            // Decode the envelope for each type.
7185            let mut _next_ordinal_to_read = 0;
7186            let mut next_offset = offset;
7187            let end_offset = offset + bytes_len;
7188            _next_ordinal_to_read += 1;
7189            if next_offset >= end_offset {
7190                return Ok(());
7191            }
7192
7193            // Decode unknown envelopes for gaps in ordinals.
7194            while _next_ordinal_to_read < 2 {
7195                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7196                _next_ordinal_to_read += 1;
7197                next_offset += envelope_size;
7198            }
7199
7200            let next_out_of_line = decoder.next_out_of_line();
7201            let handles_before = decoder.remaining_handles();
7202            if let Some((inlined, num_bytes, num_handles)) =
7203                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7204            {
7205                let member_inline_size = <fidl::encoding::Vector<
7206                    fidl_fuchsia_input__common::Key,
7207                    256,
7208                > as fidl::encoding::TypeMarker>::inline_size(
7209                    decoder.context
7210                );
7211                if inlined != (member_inline_size <= 4) {
7212                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7213                }
7214                let inner_offset;
7215                let mut inner_depth = depth.clone();
7216                if inlined {
7217                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7218                    inner_offset = next_offset;
7219                } else {
7220                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7221                    inner_depth.increment()?;
7222                }
7223                let val_ref =
7224                self.keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7225                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7226                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7227                {
7228                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7229                }
7230                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7231                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7232                }
7233            }
7234
7235            next_offset += envelope_size;
7236
7237            // Decode the remaining unknown envelopes.
7238            while next_offset < end_offset {
7239                _next_ordinal_to_read += 1;
7240                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7241                next_offset += envelope_size;
7242            }
7243
7244            Ok(())
7245        }
7246    }
7247
7248    impl KeyboardInputReport {
7249        #[inline(always)]
7250        fn max_ordinal_present(&self) -> u64 {
7251            if let Some(_) = self.pressed_keys3 {
7252                return 2;
7253            }
7254            0
7255        }
7256    }
7257
7258    impl fidl::encoding::ValueTypeMarker for KeyboardInputReport {
7259        type Borrowed<'a> = &'a Self;
7260        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7261            value
7262        }
7263    }
7264
7265    unsafe impl fidl::encoding::TypeMarker for KeyboardInputReport {
7266        type Owned = Self;
7267
7268        #[inline(always)]
7269        fn inline_align(_context: fidl::encoding::Context) -> usize {
7270            8
7271        }
7272
7273        #[inline(always)]
7274        fn inline_size(_context: fidl::encoding::Context) -> usize {
7275            16
7276        }
7277    }
7278
7279    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardInputReport, D>
7280        for &KeyboardInputReport
7281    {
7282        unsafe fn encode(
7283            self,
7284            encoder: &mut fidl::encoding::Encoder<'_, D>,
7285            offset: usize,
7286            mut depth: fidl::encoding::Depth,
7287        ) -> fidl::Result<()> {
7288            encoder.debug_check_bounds::<KeyboardInputReport>(offset);
7289            // Vector header
7290            let max_ordinal: u64 = self.max_ordinal_present();
7291            encoder.write_num(max_ordinal, offset);
7292            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7293            // Calling encoder.out_of_line_offset(0) is not allowed.
7294            if max_ordinal == 0 {
7295                return Ok(());
7296            }
7297            depth.increment()?;
7298            let envelope_size = 8;
7299            let bytes_len = max_ordinal as usize * envelope_size;
7300            #[allow(unused_variables)]
7301            let offset = encoder.out_of_line_offset(bytes_len);
7302            let mut _prev_end_offset: usize = 0;
7303            if 2 > max_ordinal {
7304                return Ok(());
7305            }
7306
7307            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7308            // are envelope_size bytes.
7309            let cur_offset: usize = (2 - 1) * envelope_size;
7310
7311            // Zero reserved fields.
7312            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7313
7314            // Safety:
7315            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7316            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7317            //   envelope_size bytes, there is always sufficient room.
7318            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7319            self.pressed_keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7320            encoder, offset + cur_offset, depth
7321        )?;
7322
7323            _prev_end_offset = cur_offset + envelope_size;
7324
7325            Ok(())
7326        }
7327    }
7328
7329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardInputReport {
7330        #[inline(always)]
7331        fn new_empty() -> Self {
7332            Self::default()
7333        }
7334
7335        unsafe fn decode(
7336            &mut self,
7337            decoder: &mut fidl::encoding::Decoder<'_, D>,
7338            offset: usize,
7339            mut depth: fidl::encoding::Depth,
7340        ) -> fidl::Result<()> {
7341            decoder.debug_check_bounds::<Self>(offset);
7342            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7343                None => return Err(fidl::Error::NotNullable),
7344                Some(len) => len,
7345            };
7346            // Calling decoder.out_of_line_offset(0) is not allowed.
7347            if len == 0 {
7348                return Ok(());
7349            };
7350            depth.increment()?;
7351            let envelope_size = 8;
7352            let bytes_len = len * envelope_size;
7353            let offset = decoder.out_of_line_offset(bytes_len)?;
7354            // Decode the envelope for each type.
7355            let mut _next_ordinal_to_read = 0;
7356            let mut next_offset = offset;
7357            let end_offset = offset + bytes_len;
7358            _next_ordinal_to_read += 1;
7359            if next_offset >= end_offset {
7360                return Ok(());
7361            }
7362
7363            // Decode unknown envelopes for gaps in ordinals.
7364            while _next_ordinal_to_read < 2 {
7365                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7366                _next_ordinal_to_read += 1;
7367                next_offset += envelope_size;
7368            }
7369
7370            let next_out_of_line = decoder.next_out_of_line();
7371            let handles_before = decoder.remaining_handles();
7372            if let Some((inlined, num_bytes, num_handles)) =
7373                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7374            {
7375                let member_inline_size = <fidl::encoding::Vector<
7376                    fidl_fuchsia_input__common::Key,
7377                    256,
7378                > as fidl::encoding::TypeMarker>::inline_size(
7379                    decoder.context
7380                );
7381                if inlined != (member_inline_size <= 4) {
7382                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7383                }
7384                let inner_offset;
7385                let mut inner_depth = depth.clone();
7386                if inlined {
7387                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7388                    inner_offset = next_offset;
7389                } else {
7390                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7391                    inner_depth.increment()?;
7392                }
7393                let val_ref =
7394                self.pressed_keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7395                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7396                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7397                {
7398                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7399                }
7400                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7401                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7402                }
7403            }
7404
7405            next_offset += envelope_size;
7406
7407            // Decode the remaining unknown envelopes.
7408            while next_offset < end_offset {
7409                _next_ordinal_to_read += 1;
7410                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7411                next_offset += envelope_size;
7412            }
7413
7414            Ok(())
7415        }
7416    }
7417
7418    impl KeyboardOutputDescriptor {
7419        #[inline(always)]
7420        fn max_ordinal_present(&self) -> u64 {
7421            if let Some(_) = self.leds {
7422                return 1;
7423            }
7424            0
7425        }
7426    }
7427
7428    impl fidl::encoding::ValueTypeMarker for KeyboardOutputDescriptor {
7429        type Borrowed<'a> = &'a Self;
7430        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7431            value
7432        }
7433    }
7434
7435    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputDescriptor {
7436        type Owned = Self;
7437
7438        #[inline(always)]
7439        fn inline_align(_context: fidl::encoding::Context) -> usize {
7440            8
7441        }
7442
7443        #[inline(always)]
7444        fn inline_size(_context: fidl::encoding::Context) -> usize {
7445            16
7446        }
7447    }
7448
7449    unsafe impl<D: fidl::encoding::ResourceDialect>
7450        fidl::encoding::Encode<KeyboardOutputDescriptor, D> for &KeyboardOutputDescriptor
7451    {
7452        unsafe fn encode(
7453            self,
7454            encoder: &mut fidl::encoding::Encoder<'_, D>,
7455            offset: usize,
7456            mut depth: fidl::encoding::Depth,
7457        ) -> fidl::Result<()> {
7458            encoder.debug_check_bounds::<KeyboardOutputDescriptor>(offset);
7459            // Vector header
7460            let max_ordinal: u64 = self.max_ordinal_present();
7461            encoder.write_num(max_ordinal, offset);
7462            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7463            // Calling encoder.out_of_line_offset(0) is not allowed.
7464            if max_ordinal == 0 {
7465                return Ok(());
7466            }
7467            depth.increment()?;
7468            let envelope_size = 8;
7469            let bytes_len = max_ordinal as usize * envelope_size;
7470            #[allow(unused_variables)]
7471            let offset = encoder.out_of_line_offset(bytes_len);
7472            let mut _prev_end_offset: usize = 0;
7473            if 1 > max_ordinal {
7474                return Ok(());
7475            }
7476
7477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7478            // are envelope_size bytes.
7479            let cur_offset: usize = (1 - 1) * envelope_size;
7480
7481            // Zero reserved fields.
7482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7483
7484            // Safety:
7485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7487            //   envelope_size bytes, there is always sufficient room.
7488            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7489            self.leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7490            encoder, offset + cur_offset, depth
7491        )?;
7492
7493            _prev_end_offset = cur_offset + envelope_size;
7494
7495            Ok(())
7496        }
7497    }
7498
7499    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7500        for KeyboardOutputDescriptor
7501    {
7502        #[inline(always)]
7503        fn new_empty() -> Self {
7504            Self::default()
7505        }
7506
7507        unsafe fn decode(
7508            &mut self,
7509            decoder: &mut fidl::encoding::Decoder<'_, D>,
7510            offset: usize,
7511            mut depth: fidl::encoding::Depth,
7512        ) -> fidl::Result<()> {
7513            decoder.debug_check_bounds::<Self>(offset);
7514            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7515                None => return Err(fidl::Error::NotNullable),
7516                Some(len) => len,
7517            };
7518            // Calling decoder.out_of_line_offset(0) is not allowed.
7519            if len == 0 {
7520                return Ok(());
7521            };
7522            depth.increment()?;
7523            let envelope_size = 8;
7524            let bytes_len = len * envelope_size;
7525            let offset = decoder.out_of_line_offset(bytes_len)?;
7526            // Decode the envelope for each type.
7527            let mut _next_ordinal_to_read = 0;
7528            let mut next_offset = offset;
7529            let end_offset = offset + bytes_len;
7530            _next_ordinal_to_read += 1;
7531            if next_offset >= end_offset {
7532                return Ok(());
7533            }
7534
7535            // Decode unknown envelopes for gaps in ordinals.
7536            while _next_ordinal_to_read < 1 {
7537                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7538                _next_ordinal_to_read += 1;
7539                next_offset += envelope_size;
7540            }
7541
7542            let next_out_of_line = decoder.next_out_of_line();
7543            let handles_before = decoder.remaining_handles();
7544            if let Some((inlined, num_bytes, num_handles)) =
7545                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7546            {
7547                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7548                if inlined != (member_inline_size <= 4) {
7549                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7550                }
7551                let inner_offset;
7552                let mut inner_depth = depth.clone();
7553                if inlined {
7554                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7555                    inner_offset = next_offset;
7556                } else {
7557                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7558                    inner_depth.increment()?;
7559                }
7560                let val_ref = self.leds.get_or_insert_with(
7561                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7562                );
7563                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7564                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7565                {
7566                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7567                }
7568                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7569                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7570                }
7571            }
7572
7573            next_offset += envelope_size;
7574
7575            // Decode the remaining unknown envelopes.
7576            while next_offset < end_offset {
7577                _next_ordinal_to_read += 1;
7578                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7579                next_offset += envelope_size;
7580            }
7581
7582            Ok(())
7583        }
7584    }
7585
7586    impl KeyboardOutputReport {
7587        #[inline(always)]
7588        fn max_ordinal_present(&self) -> u64 {
7589            if let Some(_) = self.enabled_leds {
7590                return 1;
7591            }
7592            0
7593        }
7594    }
7595
7596    impl fidl::encoding::ValueTypeMarker for KeyboardOutputReport {
7597        type Borrowed<'a> = &'a Self;
7598        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7599            value
7600        }
7601    }
7602
7603    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputReport {
7604        type Owned = Self;
7605
7606        #[inline(always)]
7607        fn inline_align(_context: fidl::encoding::Context) -> usize {
7608            8
7609        }
7610
7611        #[inline(always)]
7612        fn inline_size(_context: fidl::encoding::Context) -> usize {
7613            16
7614        }
7615    }
7616
7617    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardOutputReport, D>
7618        for &KeyboardOutputReport
7619    {
7620        unsafe fn encode(
7621            self,
7622            encoder: &mut fidl::encoding::Encoder<'_, D>,
7623            offset: usize,
7624            mut depth: fidl::encoding::Depth,
7625        ) -> fidl::Result<()> {
7626            encoder.debug_check_bounds::<KeyboardOutputReport>(offset);
7627            // Vector header
7628            let max_ordinal: u64 = self.max_ordinal_present();
7629            encoder.write_num(max_ordinal, offset);
7630            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7631            // Calling encoder.out_of_line_offset(0) is not allowed.
7632            if max_ordinal == 0 {
7633                return Ok(());
7634            }
7635            depth.increment()?;
7636            let envelope_size = 8;
7637            let bytes_len = max_ordinal as usize * envelope_size;
7638            #[allow(unused_variables)]
7639            let offset = encoder.out_of_line_offset(bytes_len);
7640            let mut _prev_end_offset: usize = 0;
7641            if 1 > max_ordinal {
7642                return Ok(());
7643            }
7644
7645            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7646            // are envelope_size bytes.
7647            let cur_offset: usize = (1 - 1) * envelope_size;
7648
7649            // Zero reserved fields.
7650            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7651
7652            // Safety:
7653            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7654            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7655            //   envelope_size bytes, there is always sufficient room.
7656            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7657            self.enabled_leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7658            encoder, offset + cur_offset, depth
7659        )?;
7660
7661            _prev_end_offset = cur_offset + envelope_size;
7662
7663            Ok(())
7664        }
7665    }
7666
7667    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardOutputReport {
7668        #[inline(always)]
7669        fn new_empty() -> Self {
7670            Self::default()
7671        }
7672
7673        unsafe fn decode(
7674            &mut self,
7675            decoder: &mut fidl::encoding::Decoder<'_, D>,
7676            offset: usize,
7677            mut depth: fidl::encoding::Depth,
7678        ) -> fidl::Result<()> {
7679            decoder.debug_check_bounds::<Self>(offset);
7680            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7681                None => return Err(fidl::Error::NotNullable),
7682                Some(len) => len,
7683            };
7684            // Calling decoder.out_of_line_offset(0) is not allowed.
7685            if len == 0 {
7686                return Ok(());
7687            };
7688            depth.increment()?;
7689            let envelope_size = 8;
7690            let bytes_len = len * envelope_size;
7691            let offset = decoder.out_of_line_offset(bytes_len)?;
7692            // Decode the envelope for each type.
7693            let mut _next_ordinal_to_read = 0;
7694            let mut next_offset = offset;
7695            let end_offset = offset + bytes_len;
7696            _next_ordinal_to_read += 1;
7697            if next_offset >= end_offset {
7698                return Ok(());
7699            }
7700
7701            // Decode unknown envelopes for gaps in ordinals.
7702            while _next_ordinal_to_read < 1 {
7703                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7704                _next_ordinal_to_read += 1;
7705                next_offset += envelope_size;
7706            }
7707
7708            let next_out_of_line = decoder.next_out_of_line();
7709            let handles_before = decoder.remaining_handles();
7710            if let Some((inlined, num_bytes, num_handles)) =
7711                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7712            {
7713                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7714                if inlined != (member_inline_size <= 4) {
7715                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7716                }
7717                let inner_offset;
7718                let mut inner_depth = depth.clone();
7719                if inlined {
7720                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7721                    inner_offset = next_offset;
7722                } else {
7723                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7724                    inner_depth.increment()?;
7725                }
7726                let val_ref = self.enabled_leds.get_or_insert_with(
7727                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7728                );
7729                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7730                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7731                {
7732                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7733                }
7734                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7735                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7736                }
7737            }
7738
7739            next_offset += envelope_size;
7740
7741            // Decode the remaining unknown envelopes.
7742            while next_offset < end_offset {
7743                _next_ordinal_to_read += 1;
7744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7745                next_offset += envelope_size;
7746            }
7747
7748            Ok(())
7749        }
7750    }
7751
7752    impl MouseDescriptor {
7753        #[inline(always)]
7754        fn max_ordinal_present(&self) -> u64 {
7755            if let Some(_) = self.input {
7756                return 1;
7757            }
7758            0
7759        }
7760    }
7761
7762    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
7763        type Borrowed<'a> = &'a Self;
7764        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7765            value
7766        }
7767    }
7768
7769    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
7770        type Owned = Self;
7771
7772        #[inline(always)]
7773        fn inline_align(_context: fidl::encoding::Context) -> usize {
7774            8
7775        }
7776
7777        #[inline(always)]
7778        fn inline_size(_context: fidl::encoding::Context) -> usize {
7779            16
7780        }
7781    }
7782
7783    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
7784        for &MouseDescriptor
7785    {
7786        unsafe fn encode(
7787            self,
7788            encoder: &mut fidl::encoding::Encoder<'_, D>,
7789            offset: usize,
7790            mut depth: fidl::encoding::Depth,
7791        ) -> fidl::Result<()> {
7792            encoder.debug_check_bounds::<MouseDescriptor>(offset);
7793            // Vector header
7794            let max_ordinal: u64 = self.max_ordinal_present();
7795            encoder.write_num(max_ordinal, offset);
7796            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7797            // Calling encoder.out_of_line_offset(0) is not allowed.
7798            if max_ordinal == 0 {
7799                return Ok(());
7800            }
7801            depth.increment()?;
7802            let envelope_size = 8;
7803            let bytes_len = max_ordinal as usize * envelope_size;
7804            #[allow(unused_variables)]
7805            let offset = encoder.out_of_line_offset(bytes_len);
7806            let mut _prev_end_offset: usize = 0;
7807            if 1 > max_ordinal {
7808                return Ok(());
7809            }
7810
7811            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7812            // are envelope_size bytes.
7813            let cur_offset: usize = (1 - 1) * envelope_size;
7814
7815            // Zero reserved fields.
7816            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7817
7818            // Safety:
7819            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7820            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7821            //   envelope_size bytes, there is always sufficient room.
7822            fidl::encoding::encode_in_envelope_optional::<MouseInputDescriptor, D>(
7823                self.input
7824                    .as_ref()
7825                    .map(<MouseInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
7826                encoder,
7827                offset + cur_offset,
7828                depth,
7829            )?;
7830
7831            _prev_end_offset = cur_offset + envelope_size;
7832
7833            Ok(())
7834        }
7835    }
7836
7837    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
7838        #[inline(always)]
7839        fn new_empty() -> Self {
7840            Self::default()
7841        }
7842
7843        unsafe fn decode(
7844            &mut self,
7845            decoder: &mut fidl::encoding::Decoder<'_, D>,
7846            offset: usize,
7847            mut depth: fidl::encoding::Depth,
7848        ) -> fidl::Result<()> {
7849            decoder.debug_check_bounds::<Self>(offset);
7850            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7851                None => return Err(fidl::Error::NotNullable),
7852                Some(len) => len,
7853            };
7854            // Calling decoder.out_of_line_offset(0) is not allowed.
7855            if len == 0 {
7856                return Ok(());
7857            };
7858            depth.increment()?;
7859            let envelope_size = 8;
7860            let bytes_len = len * envelope_size;
7861            let offset = decoder.out_of_line_offset(bytes_len)?;
7862            // Decode the envelope for each type.
7863            let mut _next_ordinal_to_read = 0;
7864            let mut next_offset = offset;
7865            let end_offset = offset + bytes_len;
7866            _next_ordinal_to_read += 1;
7867            if next_offset >= end_offset {
7868                return Ok(());
7869            }
7870
7871            // Decode unknown envelopes for gaps in ordinals.
7872            while _next_ordinal_to_read < 1 {
7873                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7874                _next_ordinal_to_read += 1;
7875                next_offset += envelope_size;
7876            }
7877
7878            let next_out_of_line = decoder.next_out_of_line();
7879            let handles_before = decoder.remaining_handles();
7880            if let Some((inlined, num_bytes, num_handles)) =
7881                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7882            {
7883                let member_inline_size =
7884                    <MouseInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
7885                        decoder.context,
7886                    );
7887                if inlined != (member_inline_size <= 4) {
7888                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7889                }
7890                let inner_offset;
7891                let mut inner_depth = depth.clone();
7892                if inlined {
7893                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7894                    inner_offset = next_offset;
7895                } else {
7896                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7897                    inner_depth.increment()?;
7898                }
7899                let val_ref =
7900                    self.input.get_or_insert_with(|| fidl::new_empty!(MouseInputDescriptor, D));
7901                fidl::decode!(
7902                    MouseInputDescriptor,
7903                    D,
7904                    val_ref,
7905                    decoder,
7906                    inner_offset,
7907                    inner_depth
7908                )?;
7909                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7910                {
7911                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7912                }
7913                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7914                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7915                }
7916            }
7917
7918            next_offset += envelope_size;
7919
7920            // Decode the remaining unknown envelopes.
7921            while next_offset < end_offset {
7922                _next_ordinal_to_read += 1;
7923                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7924                next_offset += envelope_size;
7925            }
7926
7927            Ok(())
7928        }
7929    }
7930
7931    impl MouseInputDescriptor {
7932        #[inline(always)]
7933        fn max_ordinal_present(&self) -> u64 {
7934            if let Some(_) = self.position_y {
7935                return 7;
7936            }
7937            if let Some(_) = self.position_x {
7938                return 6;
7939            }
7940            if let Some(_) = self.buttons {
7941                return 5;
7942            }
7943            if let Some(_) = self.scroll_h {
7944                return 4;
7945            }
7946            if let Some(_) = self.scroll_v {
7947                return 3;
7948            }
7949            if let Some(_) = self.movement_y {
7950                return 2;
7951            }
7952            if let Some(_) = self.movement_x {
7953                return 1;
7954            }
7955            0
7956        }
7957    }
7958
7959    impl fidl::encoding::ValueTypeMarker for MouseInputDescriptor {
7960        type Borrowed<'a> = &'a Self;
7961        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7962            value
7963        }
7964    }
7965
7966    unsafe impl fidl::encoding::TypeMarker for MouseInputDescriptor {
7967        type Owned = Self;
7968
7969        #[inline(always)]
7970        fn inline_align(_context: fidl::encoding::Context) -> usize {
7971            8
7972        }
7973
7974        #[inline(always)]
7975        fn inline_size(_context: fidl::encoding::Context) -> usize {
7976            16
7977        }
7978    }
7979
7980    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputDescriptor, D>
7981        for &MouseInputDescriptor
7982    {
7983        unsafe fn encode(
7984            self,
7985            encoder: &mut fidl::encoding::Encoder<'_, D>,
7986            offset: usize,
7987            mut depth: fidl::encoding::Depth,
7988        ) -> fidl::Result<()> {
7989            encoder.debug_check_bounds::<MouseInputDescriptor>(offset);
7990            // Vector header
7991            let max_ordinal: u64 = self.max_ordinal_present();
7992            encoder.write_num(max_ordinal, offset);
7993            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7994            // Calling encoder.out_of_line_offset(0) is not allowed.
7995            if max_ordinal == 0 {
7996                return Ok(());
7997            }
7998            depth.increment()?;
7999            let envelope_size = 8;
8000            let bytes_len = max_ordinal as usize * envelope_size;
8001            #[allow(unused_variables)]
8002            let offset = encoder.out_of_line_offset(bytes_len);
8003            let mut _prev_end_offset: usize = 0;
8004            if 1 > max_ordinal {
8005                return Ok(());
8006            }
8007
8008            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8009            // are envelope_size bytes.
8010            let cur_offset: usize = (1 - 1) * envelope_size;
8011
8012            // Zero reserved fields.
8013            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8014
8015            // Safety:
8016            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8017            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8018            //   envelope_size bytes, there is always sufficient room.
8019            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8020                self.movement_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8021                encoder,
8022                offset + cur_offset,
8023                depth,
8024            )?;
8025
8026            _prev_end_offset = cur_offset + envelope_size;
8027            if 2 > max_ordinal {
8028                return Ok(());
8029            }
8030
8031            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8032            // are envelope_size bytes.
8033            let cur_offset: usize = (2 - 1) * envelope_size;
8034
8035            // Zero reserved fields.
8036            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8037
8038            // Safety:
8039            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8040            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8041            //   envelope_size bytes, there is always sufficient room.
8042            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8043                self.movement_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8044                encoder,
8045                offset + cur_offset,
8046                depth,
8047            )?;
8048
8049            _prev_end_offset = cur_offset + envelope_size;
8050            if 3 > max_ordinal {
8051                return Ok(());
8052            }
8053
8054            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8055            // are envelope_size bytes.
8056            let cur_offset: usize = (3 - 1) * envelope_size;
8057
8058            // Zero reserved fields.
8059            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8060
8061            // Safety:
8062            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8063            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8064            //   envelope_size bytes, there is always sufficient room.
8065            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8066                self.scroll_v.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8067                encoder,
8068                offset + cur_offset,
8069                depth,
8070            )?;
8071
8072            _prev_end_offset = cur_offset + envelope_size;
8073            if 4 > max_ordinal {
8074                return Ok(());
8075            }
8076
8077            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8078            // are envelope_size bytes.
8079            let cur_offset: usize = (4 - 1) * envelope_size;
8080
8081            // Zero reserved fields.
8082            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8083
8084            // Safety:
8085            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8086            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8087            //   envelope_size bytes, there is always sufficient room.
8088            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8089                self.scroll_h.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8090                encoder,
8091                offset + cur_offset,
8092                depth,
8093            )?;
8094
8095            _prev_end_offset = cur_offset + envelope_size;
8096            if 5 > max_ordinal {
8097                return Ok(());
8098            }
8099
8100            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8101            // are envelope_size bytes.
8102            let cur_offset: usize = (5 - 1) * envelope_size;
8103
8104            // Zero reserved fields.
8105            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8106
8107            // Safety:
8108            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8109            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8110            //   envelope_size bytes, there is always sufficient room.
8111            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
8112                self.buttons.as_ref().map(
8113                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
8114                ),
8115                encoder,
8116                offset + cur_offset,
8117                depth,
8118            )?;
8119
8120            _prev_end_offset = cur_offset + envelope_size;
8121            if 6 > max_ordinal {
8122                return Ok(());
8123            }
8124
8125            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8126            // are envelope_size bytes.
8127            let cur_offset: usize = (6 - 1) * envelope_size;
8128
8129            // Zero reserved fields.
8130            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8131
8132            // Safety:
8133            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8134            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8135            //   envelope_size bytes, there is always sufficient room.
8136            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8137                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8138                encoder,
8139                offset + cur_offset,
8140                depth,
8141            )?;
8142
8143            _prev_end_offset = cur_offset + envelope_size;
8144            if 7 > max_ordinal {
8145                return Ok(());
8146            }
8147
8148            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8149            // are envelope_size bytes.
8150            let cur_offset: usize = (7 - 1) * envelope_size;
8151
8152            // Zero reserved fields.
8153            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8154
8155            // Safety:
8156            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8157            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8158            //   envelope_size bytes, there is always sufficient room.
8159            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8160                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8161                encoder,
8162                offset + cur_offset,
8163                depth,
8164            )?;
8165
8166            _prev_end_offset = cur_offset + envelope_size;
8167
8168            Ok(())
8169        }
8170    }
8171
8172    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputDescriptor {
8173        #[inline(always)]
8174        fn new_empty() -> Self {
8175            Self::default()
8176        }
8177
8178        unsafe fn decode(
8179            &mut self,
8180            decoder: &mut fidl::encoding::Decoder<'_, D>,
8181            offset: usize,
8182            mut depth: fidl::encoding::Depth,
8183        ) -> fidl::Result<()> {
8184            decoder.debug_check_bounds::<Self>(offset);
8185            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8186                None => return Err(fidl::Error::NotNullable),
8187                Some(len) => len,
8188            };
8189            // Calling decoder.out_of_line_offset(0) is not allowed.
8190            if len == 0 {
8191                return Ok(());
8192            };
8193            depth.increment()?;
8194            let envelope_size = 8;
8195            let bytes_len = len * envelope_size;
8196            let offset = decoder.out_of_line_offset(bytes_len)?;
8197            // Decode the envelope for each type.
8198            let mut _next_ordinal_to_read = 0;
8199            let mut next_offset = offset;
8200            let end_offset = offset + bytes_len;
8201            _next_ordinal_to_read += 1;
8202            if next_offset >= end_offset {
8203                return Ok(());
8204            }
8205
8206            // Decode unknown envelopes for gaps in ordinals.
8207            while _next_ordinal_to_read < 1 {
8208                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8209                _next_ordinal_to_read += 1;
8210                next_offset += envelope_size;
8211            }
8212
8213            let next_out_of_line = decoder.next_out_of_line();
8214            let handles_before = decoder.remaining_handles();
8215            if let Some((inlined, num_bytes, num_handles)) =
8216                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8217            {
8218                let member_inline_size =
8219                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8220                if inlined != (member_inline_size <= 4) {
8221                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8222                }
8223                let inner_offset;
8224                let mut inner_depth = depth.clone();
8225                if inlined {
8226                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8227                    inner_offset = next_offset;
8228                } else {
8229                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8230                    inner_depth.increment()?;
8231                }
8232                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8233                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8234                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8235                {
8236                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8237                }
8238                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8239                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8240                }
8241            }
8242
8243            next_offset += envelope_size;
8244            _next_ordinal_to_read += 1;
8245            if next_offset >= end_offset {
8246                return Ok(());
8247            }
8248
8249            // Decode unknown envelopes for gaps in ordinals.
8250            while _next_ordinal_to_read < 2 {
8251                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8252                _next_ordinal_to_read += 1;
8253                next_offset += envelope_size;
8254            }
8255
8256            let next_out_of_line = decoder.next_out_of_line();
8257            let handles_before = decoder.remaining_handles();
8258            if let Some((inlined, num_bytes, num_handles)) =
8259                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8260            {
8261                let member_inline_size =
8262                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8263                if inlined != (member_inline_size <= 4) {
8264                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8265                }
8266                let inner_offset;
8267                let mut inner_depth = depth.clone();
8268                if inlined {
8269                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8270                    inner_offset = next_offset;
8271                } else {
8272                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8273                    inner_depth.increment()?;
8274                }
8275                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8276                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8277                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8278                {
8279                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8280                }
8281                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8282                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8283                }
8284            }
8285
8286            next_offset += envelope_size;
8287            _next_ordinal_to_read += 1;
8288            if next_offset >= end_offset {
8289                return Ok(());
8290            }
8291
8292            // Decode unknown envelopes for gaps in ordinals.
8293            while _next_ordinal_to_read < 3 {
8294                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8295                _next_ordinal_to_read += 1;
8296                next_offset += envelope_size;
8297            }
8298
8299            let next_out_of_line = decoder.next_out_of_line();
8300            let handles_before = decoder.remaining_handles();
8301            if let Some((inlined, num_bytes, num_handles)) =
8302                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8303            {
8304                let member_inline_size =
8305                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8306                if inlined != (member_inline_size <= 4) {
8307                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8308                }
8309                let inner_offset;
8310                let mut inner_depth = depth.clone();
8311                if inlined {
8312                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8313                    inner_offset = next_offset;
8314                } else {
8315                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8316                    inner_depth.increment()?;
8317                }
8318                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8319                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8320                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8321                {
8322                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8323                }
8324                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8325                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8326                }
8327            }
8328
8329            next_offset += envelope_size;
8330            _next_ordinal_to_read += 1;
8331            if next_offset >= end_offset {
8332                return Ok(());
8333            }
8334
8335            // Decode unknown envelopes for gaps in ordinals.
8336            while _next_ordinal_to_read < 4 {
8337                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8338                _next_ordinal_to_read += 1;
8339                next_offset += envelope_size;
8340            }
8341
8342            let next_out_of_line = decoder.next_out_of_line();
8343            let handles_before = decoder.remaining_handles();
8344            if let Some((inlined, num_bytes, num_handles)) =
8345                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8346            {
8347                let member_inline_size =
8348                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8349                if inlined != (member_inline_size <= 4) {
8350                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8351                }
8352                let inner_offset;
8353                let mut inner_depth = depth.clone();
8354                if inlined {
8355                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8356                    inner_offset = next_offset;
8357                } else {
8358                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8359                    inner_depth.increment()?;
8360                }
8361                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8362                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8363                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8364                {
8365                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8366                }
8367                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8368                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8369                }
8370            }
8371
8372            next_offset += envelope_size;
8373            _next_ordinal_to_read += 1;
8374            if next_offset >= end_offset {
8375                return Ok(());
8376            }
8377
8378            // Decode unknown envelopes for gaps in ordinals.
8379            while _next_ordinal_to_read < 5 {
8380                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8381                _next_ordinal_to_read += 1;
8382                next_offset += envelope_size;
8383            }
8384
8385            let next_out_of_line = decoder.next_out_of_line();
8386            let handles_before = decoder.remaining_handles();
8387            if let Some((inlined, num_bytes, num_handles)) =
8388                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8389            {
8390                let member_inline_size =
8391                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8392                        decoder.context,
8393                    );
8394                if inlined != (member_inline_size <= 4) {
8395                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8396                }
8397                let inner_offset;
8398                let mut inner_depth = depth.clone();
8399                if inlined {
8400                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8401                    inner_offset = next_offset;
8402                } else {
8403                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8404                    inner_depth.increment()?;
8405                }
8406                let val_ref = self
8407                    .buttons
8408                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8409                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8410                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8411                {
8412                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8413                }
8414                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8415                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8416                }
8417            }
8418
8419            next_offset += envelope_size;
8420            _next_ordinal_to_read += 1;
8421            if next_offset >= end_offset {
8422                return Ok(());
8423            }
8424
8425            // Decode unknown envelopes for gaps in ordinals.
8426            while _next_ordinal_to_read < 6 {
8427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8428                _next_ordinal_to_read += 1;
8429                next_offset += envelope_size;
8430            }
8431
8432            let next_out_of_line = decoder.next_out_of_line();
8433            let handles_before = decoder.remaining_handles();
8434            if let Some((inlined, num_bytes, num_handles)) =
8435                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8436            {
8437                let member_inline_size =
8438                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8439                if inlined != (member_inline_size <= 4) {
8440                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8441                }
8442                let inner_offset;
8443                let mut inner_depth = depth.clone();
8444                if inlined {
8445                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8446                    inner_offset = next_offset;
8447                } else {
8448                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8449                    inner_depth.increment()?;
8450                }
8451                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8452                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8453                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8454                {
8455                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8456                }
8457                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8458                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8459                }
8460            }
8461
8462            next_offset += envelope_size;
8463            _next_ordinal_to_read += 1;
8464            if next_offset >= end_offset {
8465                return Ok(());
8466            }
8467
8468            // Decode unknown envelopes for gaps in ordinals.
8469            while _next_ordinal_to_read < 7 {
8470                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8471                _next_ordinal_to_read += 1;
8472                next_offset += envelope_size;
8473            }
8474
8475            let next_out_of_line = decoder.next_out_of_line();
8476            let handles_before = decoder.remaining_handles();
8477            if let Some((inlined, num_bytes, num_handles)) =
8478                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8479            {
8480                let member_inline_size =
8481                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8482                if inlined != (member_inline_size <= 4) {
8483                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8484                }
8485                let inner_offset;
8486                let mut inner_depth = depth.clone();
8487                if inlined {
8488                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8489                    inner_offset = next_offset;
8490                } else {
8491                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8492                    inner_depth.increment()?;
8493                }
8494                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8495                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8496                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8497                {
8498                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8499                }
8500                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8501                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8502                }
8503            }
8504
8505            next_offset += envelope_size;
8506
8507            // Decode the remaining unknown envelopes.
8508            while next_offset < end_offset {
8509                _next_ordinal_to_read += 1;
8510                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8511                next_offset += envelope_size;
8512            }
8513
8514            Ok(())
8515        }
8516    }
8517
8518    impl MouseInputReport {
8519        #[inline(always)]
8520        fn max_ordinal_present(&self) -> u64 {
8521            if let Some(_) = self.position_y {
8522                return 7;
8523            }
8524            if let Some(_) = self.position_x {
8525                return 6;
8526            }
8527            if let Some(_) = self.pressed_buttons {
8528                return 5;
8529            }
8530            if let Some(_) = self.scroll_h {
8531                return 4;
8532            }
8533            if let Some(_) = self.scroll_v {
8534                return 3;
8535            }
8536            if let Some(_) = self.movement_y {
8537                return 2;
8538            }
8539            if let Some(_) = self.movement_x {
8540                return 1;
8541            }
8542            0
8543        }
8544    }
8545
8546    impl fidl::encoding::ValueTypeMarker for MouseInputReport {
8547        type Borrowed<'a> = &'a Self;
8548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8549            value
8550        }
8551    }
8552
8553    unsafe impl fidl::encoding::TypeMarker for MouseInputReport {
8554        type Owned = Self;
8555
8556        #[inline(always)]
8557        fn inline_align(_context: fidl::encoding::Context) -> usize {
8558            8
8559        }
8560
8561        #[inline(always)]
8562        fn inline_size(_context: fidl::encoding::Context) -> usize {
8563            16
8564        }
8565    }
8566
8567    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputReport, D>
8568        for &MouseInputReport
8569    {
8570        unsafe fn encode(
8571            self,
8572            encoder: &mut fidl::encoding::Encoder<'_, D>,
8573            offset: usize,
8574            mut depth: fidl::encoding::Depth,
8575        ) -> fidl::Result<()> {
8576            encoder.debug_check_bounds::<MouseInputReport>(offset);
8577            // Vector header
8578            let max_ordinal: u64 = self.max_ordinal_present();
8579            encoder.write_num(max_ordinal, offset);
8580            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8581            // Calling encoder.out_of_line_offset(0) is not allowed.
8582            if max_ordinal == 0 {
8583                return Ok(());
8584            }
8585            depth.increment()?;
8586            let envelope_size = 8;
8587            let bytes_len = max_ordinal as usize * envelope_size;
8588            #[allow(unused_variables)]
8589            let offset = encoder.out_of_line_offset(bytes_len);
8590            let mut _prev_end_offset: usize = 0;
8591            if 1 > max_ordinal {
8592                return Ok(());
8593            }
8594
8595            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8596            // are envelope_size bytes.
8597            let cur_offset: usize = (1 - 1) * envelope_size;
8598
8599            // Zero reserved fields.
8600            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8601
8602            // Safety:
8603            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8604            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8605            //   envelope_size bytes, there is always sufficient room.
8606            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8607                self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8608                encoder,
8609                offset + cur_offset,
8610                depth,
8611            )?;
8612
8613            _prev_end_offset = cur_offset + envelope_size;
8614            if 2 > max_ordinal {
8615                return Ok(());
8616            }
8617
8618            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8619            // are envelope_size bytes.
8620            let cur_offset: usize = (2 - 1) * envelope_size;
8621
8622            // Zero reserved fields.
8623            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8624
8625            // Safety:
8626            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8627            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8628            //   envelope_size bytes, there is always sufficient room.
8629            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8630                self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8631                encoder,
8632                offset + cur_offset,
8633                depth,
8634            )?;
8635
8636            _prev_end_offset = cur_offset + envelope_size;
8637            if 3 > max_ordinal {
8638                return Ok(());
8639            }
8640
8641            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8642            // are envelope_size bytes.
8643            let cur_offset: usize = (3 - 1) * envelope_size;
8644
8645            // Zero reserved fields.
8646            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8647
8648            // Safety:
8649            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8650            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8651            //   envelope_size bytes, there is always sufficient room.
8652            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8653                self.scroll_v.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8654                encoder,
8655                offset + cur_offset,
8656                depth,
8657            )?;
8658
8659            _prev_end_offset = cur_offset + envelope_size;
8660            if 4 > max_ordinal {
8661                return Ok(());
8662            }
8663
8664            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8665            // are envelope_size bytes.
8666            let cur_offset: usize = (4 - 1) * envelope_size;
8667
8668            // Zero reserved fields.
8669            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8670
8671            // Safety:
8672            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8673            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8674            //   envelope_size bytes, there is always sufficient room.
8675            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8676                self.scroll_h.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8677                encoder,
8678                offset + cur_offset,
8679                depth,
8680            )?;
8681
8682            _prev_end_offset = cur_offset + envelope_size;
8683            if 5 > max_ordinal {
8684                return Ok(());
8685            }
8686
8687            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8688            // are envelope_size bytes.
8689            let cur_offset: usize = (5 - 1) * envelope_size;
8690
8691            // Zero reserved fields.
8692            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8693
8694            // Safety:
8695            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8696            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8697            //   envelope_size bytes, there is always sufficient room.
8698            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
8699                self.pressed_buttons.as_ref().map(
8700                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
8701                ),
8702                encoder,
8703                offset + cur_offset,
8704                depth,
8705            )?;
8706
8707            _prev_end_offset = cur_offset + envelope_size;
8708            if 6 > max_ordinal {
8709                return Ok(());
8710            }
8711
8712            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8713            // are envelope_size bytes.
8714            let cur_offset: usize = (6 - 1) * envelope_size;
8715
8716            // Zero reserved fields.
8717            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8718
8719            // Safety:
8720            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8721            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8722            //   envelope_size bytes, there is always sufficient room.
8723            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8724                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8725                encoder,
8726                offset + cur_offset,
8727                depth,
8728            )?;
8729
8730            _prev_end_offset = cur_offset + envelope_size;
8731            if 7 > max_ordinal {
8732                return Ok(());
8733            }
8734
8735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8736            // are envelope_size bytes.
8737            let cur_offset: usize = (7 - 1) * envelope_size;
8738
8739            // Zero reserved fields.
8740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8741
8742            // Safety:
8743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8745            //   envelope_size bytes, there is always sufficient room.
8746            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8747                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8748                encoder,
8749                offset + cur_offset,
8750                depth,
8751            )?;
8752
8753            _prev_end_offset = cur_offset + envelope_size;
8754
8755            Ok(())
8756        }
8757    }
8758
8759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputReport {
8760        #[inline(always)]
8761        fn new_empty() -> Self {
8762            Self::default()
8763        }
8764
8765        unsafe fn decode(
8766            &mut self,
8767            decoder: &mut fidl::encoding::Decoder<'_, D>,
8768            offset: usize,
8769            mut depth: fidl::encoding::Depth,
8770        ) -> fidl::Result<()> {
8771            decoder.debug_check_bounds::<Self>(offset);
8772            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8773                None => return Err(fidl::Error::NotNullable),
8774                Some(len) => len,
8775            };
8776            // Calling decoder.out_of_line_offset(0) is not allowed.
8777            if len == 0 {
8778                return Ok(());
8779            };
8780            depth.increment()?;
8781            let envelope_size = 8;
8782            let bytes_len = len * envelope_size;
8783            let offset = decoder.out_of_line_offset(bytes_len)?;
8784            // Decode the envelope for each type.
8785            let mut _next_ordinal_to_read = 0;
8786            let mut next_offset = offset;
8787            let end_offset = offset + bytes_len;
8788            _next_ordinal_to_read += 1;
8789            if next_offset >= end_offset {
8790                return Ok(());
8791            }
8792
8793            // Decode unknown envelopes for gaps in ordinals.
8794            while _next_ordinal_to_read < 1 {
8795                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8796                _next_ordinal_to_read += 1;
8797                next_offset += envelope_size;
8798            }
8799
8800            let next_out_of_line = decoder.next_out_of_line();
8801            let handles_before = decoder.remaining_handles();
8802            if let Some((inlined, num_bytes, num_handles)) =
8803                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8804            {
8805                let member_inline_size =
8806                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8807                if inlined != (member_inline_size <= 4) {
8808                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8809                }
8810                let inner_offset;
8811                let mut inner_depth = depth.clone();
8812                if inlined {
8813                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8814                    inner_offset = next_offset;
8815                } else {
8816                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8817                    inner_depth.increment()?;
8818                }
8819                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8820                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8821                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8822                {
8823                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8824                }
8825                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8826                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8827                }
8828            }
8829
8830            next_offset += envelope_size;
8831            _next_ordinal_to_read += 1;
8832            if next_offset >= end_offset {
8833                return Ok(());
8834            }
8835
8836            // Decode unknown envelopes for gaps in ordinals.
8837            while _next_ordinal_to_read < 2 {
8838                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8839                _next_ordinal_to_read += 1;
8840                next_offset += envelope_size;
8841            }
8842
8843            let next_out_of_line = decoder.next_out_of_line();
8844            let handles_before = decoder.remaining_handles();
8845            if let Some((inlined, num_bytes, num_handles)) =
8846                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8847            {
8848                let member_inline_size =
8849                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8850                if inlined != (member_inline_size <= 4) {
8851                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8852                }
8853                let inner_offset;
8854                let mut inner_depth = depth.clone();
8855                if inlined {
8856                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8857                    inner_offset = next_offset;
8858                } else {
8859                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8860                    inner_depth.increment()?;
8861                }
8862                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8863                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8864                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8865                {
8866                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8867                }
8868                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8869                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8870                }
8871            }
8872
8873            next_offset += envelope_size;
8874            _next_ordinal_to_read += 1;
8875            if next_offset >= end_offset {
8876                return Ok(());
8877            }
8878
8879            // Decode unknown envelopes for gaps in ordinals.
8880            while _next_ordinal_to_read < 3 {
8881                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8882                _next_ordinal_to_read += 1;
8883                next_offset += envelope_size;
8884            }
8885
8886            let next_out_of_line = decoder.next_out_of_line();
8887            let handles_before = decoder.remaining_handles();
8888            if let Some((inlined, num_bytes, num_handles)) =
8889                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8890            {
8891                let member_inline_size =
8892                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8893                if inlined != (member_inline_size <= 4) {
8894                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8895                }
8896                let inner_offset;
8897                let mut inner_depth = depth.clone();
8898                if inlined {
8899                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8900                    inner_offset = next_offset;
8901                } else {
8902                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8903                    inner_depth.increment()?;
8904                }
8905                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(i64, D));
8906                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8907                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8908                {
8909                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8910                }
8911                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8912                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8913                }
8914            }
8915
8916            next_offset += envelope_size;
8917            _next_ordinal_to_read += 1;
8918            if next_offset >= end_offset {
8919                return Ok(());
8920            }
8921
8922            // Decode unknown envelopes for gaps in ordinals.
8923            while _next_ordinal_to_read < 4 {
8924                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8925                _next_ordinal_to_read += 1;
8926                next_offset += envelope_size;
8927            }
8928
8929            let next_out_of_line = decoder.next_out_of_line();
8930            let handles_before = decoder.remaining_handles();
8931            if let Some((inlined, num_bytes, num_handles)) =
8932                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8933            {
8934                let member_inline_size =
8935                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8936                if inlined != (member_inline_size <= 4) {
8937                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8938                }
8939                let inner_offset;
8940                let mut inner_depth = depth.clone();
8941                if inlined {
8942                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8943                    inner_offset = next_offset;
8944                } else {
8945                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8946                    inner_depth.increment()?;
8947                }
8948                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(i64, D));
8949                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8950                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8951                {
8952                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8953                }
8954                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8955                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8956                }
8957            }
8958
8959            next_offset += envelope_size;
8960            _next_ordinal_to_read += 1;
8961            if next_offset >= end_offset {
8962                return Ok(());
8963            }
8964
8965            // Decode unknown envelopes for gaps in ordinals.
8966            while _next_ordinal_to_read < 5 {
8967                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8968                _next_ordinal_to_read += 1;
8969                next_offset += envelope_size;
8970            }
8971
8972            let next_out_of_line = decoder.next_out_of_line();
8973            let handles_before = decoder.remaining_handles();
8974            if let Some((inlined, num_bytes, num_handles)) =
8975                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8976            {
8977                let member_inline_size =
8978                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8979                        decoder.context,
8980                    );
8981                if inlined != (member_inline_size <= 4) {
8982                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8983                }
8984                let inner_offset;
8985                let mut inner_depth = depth.clone();
8986                if inlined {
8987                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8988                    inner_offset = next_offset;
8989                } else {
8990                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8991                    inner_depth.increment()?;
8992                }
8993                let val_ref = self
8994                    .pressed_buttons
8995                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8996                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8997                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8998                {
8999                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9000                }
9001                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9002                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9003                }
9004            }
9005
9006            next_offset += envelope_size;
9007            _next_ordinal_to_read += 1;
9008            if next_offset >= end_offset {
9009                return Ok(());
9010            }
9011
9012            // Decode unknown envelopes for gaps in ordinals.
9013            while _next_ordinal_to_read < 6 {
9014                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9015                _next_ordinal_to_read += 1;
9016                next_offset += envelope_size;
9017            }
9018
9019            let next_out_of_line = decoder.next_out_of_line();
9020            let handles_before = decoder.remaining_handles();
9021            if let Some((inlined, num_bytes, num_handles)) =
9022                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9023            {
9024                let member_inline_size =
9025                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9026                if inlined != (member_inline_size <= 4) {
9027                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9028                }
9029                let inner_offset;
9030                let mut inner_depth = depth.clone();
9031                if inlined {
9032                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9033                    inner_offset = next_offset;
9034                } else {
9035                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9036                    inner_depth.increment()?;
9037                }
9038                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
9039                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
9040                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9041                {
9042                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9043                }
9044                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9045                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9046                }
9047            }
9048
9049            next_offset += envelope_size;
9050            _next_ordinal_to_read += 1;
9051            if next_offset >= end_offset {
9052                return Ok(());
9053            }
9054
9055            // Decode unknown envelopes for gaps in ordinals.
9056            while _next_ordinal_to_read < 7 {
9057                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9058                _next_ordinal_to_read += 1;
9059                next_offset += envelope_size;
9060            }
9061
9062            let next_out_of_line = decoder.next_out_of_line();
9063            let handles_before = decoder.remaining_handles();
9064            if let Some((inlined, num_bytes, num_handles)) =
9065                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9066            {
9067                let member_inline_size =
9068                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9069                if inlined != (member_inline_size <= 4) {
9070                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9071                }
9072                let inner_offset;
9073                let mut inner_depth = depth.clone();
9074                if inlined {
9075                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9076                    inner_offset = next_offset;
9077                } else {
9078                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9079                    inner_depth.increment()?;
9080                }
9081                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
9082                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
9083                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9084                {
9085                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9086                }
9087                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9088                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9089                }
9090            }
9091
9092            next_offset += envelope_size;
9093
9094            // Decode the remaining unknown envelopes.
9095            while next_offset < end_offset {
9096                _next_ordinal_to_read += 1;
9097                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9098                next_offset += envelope_size;
9099            }
9100
9101            Ok(())
9102        }
9103    }
9104
9105    impl OutputDescriptor {
9106        #[inline(always)]
9107        fn max_ordinal_present(&self) -> u64 {
9108            if let Some(_) = self.keyboard {
9109                return 1;
9110            }
9111            0
9112        }
9113    }
9114
9115    impl fidl::encoding::ValueTypeMarker for OutputDescriptor {
9116        type Borrowed<'a> = &'a Self;
9117        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9118            value
9119        }
9120    }
9121
9122    unsafe impl fidl::encoding::TypeMarker for OutputDescriptor {
9123        type Owned = Self;
9124
9125        #[inline(always)]
9126        fn inline_align(_context: fidl::encoding::Context) -> usize {
9127            8
9128        }
9129
9130        #[inline(always)]
9131        fn inline_size(_context: fidl::encoding::Context) -> usize {
9132            16
9133        }
9134    }
9135
9136    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputDescriptor, D>
9137        for &OutputDescriptor
9138    {
9139        unsafe fn encode(
9140            self,
9141            encoder: &mut fidl::encoding::Encoder<'_, D>,
9142            offset: usize,
9143            mut depth: fidl::encoding::Depth,
9144        ) -> fidl::Result<()> {
9145            encoder.debug_check_bounds::<OutputDescriptor>(offset);
9146            // Vector header
9147            let max_ordinal: u64 = self.max_ordinal_present();
9148            encoder.write_num(max_ordinal, offset);
9149            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9150            // Calling encoder.out_of_line_offset(0) is not allowed.
9151            if max_ordinal == 0 {
9152                return Ok(());
9153            }
9154            depth.increment()?;
9155            let envelope_size = 8;
9156            let bytes_len = max_ordinal as usize * envelope_size;
9157            #[allow(unused_variables)]
9158            let offset = encoder.out_of_line_offset(bytes_len);
9159            let mut _prev_end_offset: usize = 0;
9160            if 1 > max_ordinal {
9161                return Ok(());
9162            }
9163
9164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9165            // are envelope_size bytes.
9166            let cur_offset: usize = (1 - 1) * envelope_size;
9167
9168            // Zero reserved fields.
9169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9170
9171            // Safety:
9172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9174            //   envelope_size bytes, there is always sufficient room.
9175            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
9176                self.keyboard
9177                    .as_ref()
9178                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
9179                encoder,
9180                offset + cur_offset,
9181                depth,
9182            )?;
9183
9184            _prev_end_offset = cur_offset + envelope_size;
9185
9186            Ok(())
9187        }
9188    }
9189
9190    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputDescriptor {
9191        #[inline(always)]
9192        fn new_empty() -> Self {
9193            Self::default()
9194        }
9195
9196        unsafe fn decode(
9197            &mut self,
9198            decoder: &mut fidl::encoding::Decoder<'_, D>,
9199            offset: usize,
9200            mut depth: fidl::encoding::Depth,
9201        ) -> fidl::Result<()> {
9202            decoder.debug_check_bounds::<Self>(offset);
9203            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9204                None => return Err(fidl::Error::NotNullable),
9205                Some(len) => len,
9206            };
9207            // Calling decoder.out_of_line_offset(0) is not allowed.
9208            if len == 0 {
9209                return Ok(());
9210            };
9211            depth.increment()?;
9212            let envelope_size = 8;
9213            let bytes_len = len * envelope_size;
9214            let offset = decoder.out_of_line_offset(bytes_len)?;
9215            // Decode the envelope for each type.
9216            let mut _next_ordinal_to_read = 0;
9217            let mut next_offset = offset;
9218            let end_offset = offset + bytes_len;
9219            _next_ordinal_to_read += 1;
9220            if next_offset >= end_offset {
9221                return Ok(());
9222            }
9223
9224            // Decode unknown envelopes for gaps in ordinals.
9225            while _next_ordinal_to_read < 1 {
9226                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9227                _next_ordinal_to_read += 1;
9228                next_offset += envelope_size;
9229            }
9230
9231            let next_out_of_line = decoder.next_out_of_line();
9232            let handles_before = decoder.remaining_handles();
9233            if let Some((inlined, num_bytes, num_handles)) =
9234                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9235            {
9236                let member_inline_size =
9237                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
9238                        decoder.context,
9239                    );
9240                if inlined != (member_inline_size <= 4) {
9241                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9242                }
9243                let inner_offset;
9244                let mut inner_depth = depth.clone();
9245                if inlined {
9246                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9247                    inner_offset = next_offset;
9248                } else {
9249                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9250                    inner_depth.increment()?;
9251                }
9252                let val_ref = self
9253                    .keyboard
9254                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
9255                fidl::decode!(
9256                    KeyboardOutputDescriptor,
9257                    D,
9258                    val_ref,
9259                    decoder,
9260                    inner_offset,
9261                    inner_depth
9262                )?;
9263                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9264                {
9265                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9266                }
9267                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9268                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9269                }
9270            }
9271
9272            next_offset += envelope_size;
9273
9274            // Decode the remaining unknown envelopes.
9275            while next_offset < end_offset {
9276                _next_ordinal_to_read += 1;
9277                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9278                next_offset += envelope_size;
9279            }
9280
9281            Ok(())
9282        }
9283    }
9284
9285    impl OutputReport {
9286        #[inline(always)]
9287        fn max_ordinal_present(&self) -> u64 {
9288            if let Some(_) = self.keyboard {
9289                return 1;
9290            }
9291            0
9292        }
9293    }
9294
9295    impl fidl::encoding::ValueTypeMarker for OutputReport {
9296        type Borrowed<'a> = &'a Self;
9297        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9298            value
9299        }
9300    }
9301
9302    unsafe impl fidl::encoding::TypeMarker for OutputReport {
9303        type Owned = Self;
9304
9305        #[inline(always)]
9306        fn inline_align(_context: fidl::encoding::Context) -> usize {
9307            8
9308        }
9309
9310        #[inline(always)]
9311        fn inline_size(_context: fidl::encoding::Context) -> usize {
9312            16
9313        }
9314    }
9315
9316    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputReport, D>
9317        for &OutputReport
9318    {
9319        unsafe fn encode(
9320            self,
9321            encoder: &mut fidl::encoding::Encoder<'_, D>,
9322            offset: usize,
9323            mut depth: fidl::encoding::Depth,
9324        ) -> fidl::Result<()> {
9325            encoder.debug_check_bounds::<OutputReport>(offset);
9326            // Vector header
9327            let max_ordinal: u64 = self.max_ordinal_present();
9328            encoder.write_num(max_ordinal, offset);
9329            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9330            // Calling encoder.out_of_line_offset(0) is not allowed.
9331            if max_ordinal == 0 {
9332                return Ok(());
9333            }
9334            depth.increment()?;
9335            let envelope_size = 8;
9336            let bytes_len = max_ordinal as usize * envelope_size;
9337            #[allow(unused_variables)]
9338            let offset = encoder.out_of_line_offset(bytes_len);
9339            let mut _prev_end_offset: usize = 0;
9340            if 1 > max_ordinal {
9341                return Ok(());
9342            }
9343
9344            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9345            // are envelope_size bytes.
9346            let cur_offset: usize = (1 - 1) * envelope_size;
9347
9348            // Zero reserved fields.
9349            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9350
9351            // Safety:
9352            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9353            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9354            //   envelope_size bytes, there is always sufficient room.
9355            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputReport, D>(
9356                self.keyboard
9357                    .as_ref()
9358                    .map(<KeyboardOutputReport as fidl::encoding::ValueTypeMarker>::borrow),
9359                encoder,
9360                offset + cur_offset,
9361                depth,
9362            )?;
9363
9364            _prev_end_offset = cur_offset + envelope_size;
9365
9366            Ok(())
9367        }
9368    }
9369
9370    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputReport {
9371        #[inline(always)]
9372        fn new_empty() -> Self {
9373            Self::default()
9374        }
9375
9376        unsafe fn decode(
9377            &mut self,
9378            decoder: &mut fidl::encoding::Decoder<'_, D>,
9379            offset: usize,
9380            mut depth: fidl::encoding::Depth,
9381        ) -> fidl::Result<()> {
9382            decoder.debug_check_bounds::<Self>(offset);
9383            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9384                None => return Err(fidl::Error::NotNullable),
9385                Some(len) => len,
9386            };
9387            // Calling decoder.out_of_line_offset(0) is not allowed.
9388            if len == 0 {
9389                return Ok(());
9390            };
9391            depth.increment()?;
9392            let envelope_size = 8;
9393            let bytes_len = len * envelope_size;
9394            let offset = decoder.out_of_line_offset(bytes_len)?;
9395            // Decode the envelope for each type.
9396            let mut _next_ordinal_to_read = 0;
9397            let mut next_offset = offset;
9398            let end_offset = offset + bytes_len;
9399            _next_ordinal_to_read += 1;
9400            if next_offset >= end_offset {
9401                return Ok(());
9402            }
9403
9404            // Decode unknown envelopes for gaps in ordinals.
9405            while _next_ordinal_to_read < 1 {
9406                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9407                _next_ordinal_to_read += 1;
9408                next_offset += envelope_size;
9409            }
9410
9411            let next_out_of_line = decoder.next_out_of_line();
9412            let handles_before = decoder.remaining_handles();
9413            if let Some((inlined, num_bytes, num_handles)) =
9414                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9415            {
9416                let member_inline_size =
9417                    <KeyboardOutputReport as fidl::encoding::TypeMarker>::inline_size(
9418                        decoder.context,
9419                    );
9420                if inlined != (member_inline_size <= 4) {
9421                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9422                }
9423                let inner_offset;
9424                let mut inner_depth = depth.clone();
9425                if inlined {
9426                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9427                    inner_offset = next_offset;
9428                } else {
9429                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9430                    inner_depth.increment()?;
9431                }
9432                let val_ref =
9433                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardOutputReport, D));
9434                fidl::decode!(
9435                    KeyboardOutputReport,
9436                    D,
9437                    val_ref,
9438                    decoder,
9439                    inner_offset,
9440                    inner_depth
9441                )?;
9442                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9443                {
9444                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9445                }
9446                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9447                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9448                }
9449            }
9450
9451            next_offset += envelope_size;
9452
9453            // Decode the remaining unknown envelopes.
9454            while next_offset < end_offset {
9455                _next_ordinal_to_read += 1;
9456                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9457                next_offset += envelope_size;
9458            }
9459
9460            Ok(())
9461        }
9462    }
9463
9464    impl SelectiveReportingFeatureReport {
9465        #[inline(always)]
9466        fn max_ordinal_present(&self) -> u64 {
9467            if let Some(_) = self.button_switch {
9468                return 2;
9469            }
9470            if let Some(_) = self.surface_switch {
9471                return 1;
9472            }
9473            0
9474        }
9475    }
9476
9477    impl fidl::encoding::ValueTypeMarker for SelectiveReportingFeatureReport {
9478        type Borrowed<'a> = &'a Self;
9479        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9480            value
9481        }
9482    }
9483
9484    unsafe impl fidl::encoding::TypeMarker for SelectiveReportingFeatureReport {
9485        type Owned = Self;
9486
9487        #[inline(always)]
9488        fn inline_align(_context: fidl::encoding::Context) -> usize {
9489            8
9490        }
9491
9492        #[inline(always)]
9493        fn inline_size(_context: fidl::encoding::Context) -> usize {
9494            16
9495        }
9496    }
9497
9498    unsafe impl<D: fidl::encoding::ResourceDialect>
9499        fidl::encoding::Encode<SelectiveReportingFeatureReport, D>
9500        for &SelectiveReportingFeatureReport
9501    {
9502        unsafe fn encode(
9503            self,
9504            encoder: &mut fidl::encoding::Encoder<'_, D>,
9505            offset: usize,
9506            mut depth: fidl::encoding::Depth,
9507        ) -> fidl::Result<()> {
9508            encoder.debug_check_bounds::<SelectiveReportingFeatureReport>(offset);
9509            // Vector header
9510            let max_ordinal: u64 = self.max_ordinal_present();
9511            encoder.write_num(max_ordinal, offset);
9512            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9513            // Calling encoder.out_of_line_offset(0) is not allowed.
9514            if max_ordinal == 0 {
9515                return Ok(());
9516            }
9517            depth.increment()?;
9518            let envelope_size = 8;
9519            let bytes_len = max_ordinal as usize * envelope_size;
9520            #[allow(unused_variables)]
9521            let offset = encoder.out_of_line_offset(bytes_len);
9522            let mut _prev_end_offset: usize = 0;
9523            if 1 > max_ordinal {
9524                return Ok(());
9525            }
9526
9527            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9528            // are envelope_size bytes.
9529            let cur_offset: usize = (1 - 1) * envelope_size;
9530
9531            // Zero reserved fields.
9532            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9533
9534            // Safety:
9535            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9536            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9537            //   envelope_size bytes, there is always sufficient room.
9538            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9539                self.surface_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9540                encoder,
9541                offset + cur_offset,
9542                depth,
9543            )?;
9544
9545            _prev_end_offset = cur_offset + envelope_size;
9546            if 2 > max_ordinal {
9547                return Ok(());
9548            }
9549
9550            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9551            // are envelope_size bytes.
9552            let cur_offset: usize = (2 - 1) * envelope_size;
9553
9554            // Zero reserved fields.
9555            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9556
9557            // Safety:
9558            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9559            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9560            //   envelope_size bytes, there is always sufficient room.
9561            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9562                self.button_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9563                encoder,
9564                offset + cur_offset,
9565                depth,
9566            )?;
9567
9568            _prev_end_offset = cur_offset + envelope_size;
9569
9570            Ok(())
9571        }
9572    }
9573
9574    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9575        for SelectiveReportingFeatureReport
9576    {
9577        #[inline(always)]
9578        fn new_empty() -> Self {
9579            Self::default()
9580        }
9581
9582        unsafe fn decode(
9583            &mut self,
9584            decoder: &mut fidl::encoding::Decoder<'_, D>,
9585            offset: usize,
9586            mut depth: fidl::encoding::Depth,
9587        ) -> fidl::Result<()> {
9588            decoder.debug_check_bounds::<Self>(offset);
9589            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9590                None => return Err(fidl::Error::NotNullable),
9591                Some(len) => len,
9592            };
9593            // Calling decoder.out_of_line_offset(0) is not allowed.
9594            if len == 0 {
9595                return Ok(());
9596            };
9597            depth.increment()?;
9598            let envelope_size = 8;
9599            let bytes_len = len * envelope_size;
9600            let offset = decoder.out_of_line_offset(bytes_len)?;
9601            // Decode the envelope for each type.
9602            let mut _next_ordinal_to_read = 0;
9603            let mut next_offset = offset;
9604            let end_offset = offset + bytes_len;
9605            _next_ordinal_to_read += 1;
9606            if next_offset >= end_offset {
9607                return Ok(());
9608            }
9609
9610            // Decode unknown envelopes for gaps in ordinals.
9611            while _next_ordinal_to_read < 1 {
9612                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9613                _next_ordinal_to_read += 1;
9614                next_offset += envelope_size;
9615            }
9616
9617            let next_out_of_line = decoder.next_out_of_line();
9618            let handles_before = decoder.remaining_handles();
9619            if let Some((inlined, num_bytes, num_handles)) =
9620                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9621            {
9622                let member_inline_size =
9623                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9624                if inlined != (member_inline_size <= 4) {
9625                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9626                }
9627                let inner_offset;
9628                let mut inner_depth = depth.clone();
9629                if inlined {
9630                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9631                    inner_offset = next_offset;
9632                } else {
9633                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9634                    inner_depth.increment()?;
9635                }
9636                let val_ref = self.surface_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9637                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9638                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9639                {
9640                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9641                }
9642                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9643                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9644                }
9645            }
9646
9647            next_offset += envelope_size;
9648            _next_ordinal_to_read += 1;
9649            if next_offset >= end_offset {
9650                return Ok(());
9651            }
9652
9653            // Decode unknown envelopes for gaps in ordinals.
9654            while _next_ordinal_to_read < 2 {
9655                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9656                _next_ordinal_to_read += 1;
9657                next_offset += envelope_size;
9658            }
9659
9660            let next_out_of_line = decoder.next_out_of_line();
9661            let handles_before = decoder.remaining_handles();
9662            if let Some((inlined, num_bytes, num_handles)) =
9663                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9664            {
9665                let member_inline_size =
9666                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9667                if inlined != (member_inline_size <= 4) {
9668                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9669                }
9670                let inner_offset;
9671                let mut inner_depth = depth.clone();
9672                if inlined {
9673                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9674                    inner_offset = next_offset;
9675                } else {
9676                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9677                    inner_depth.increment()?;
9678                }
9679                let val_ref = self.button_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9680                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9681                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9682                {
9683                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9684                }
9685                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9686                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9687                }
9688            }
9689
9690            next_offset += envelope_size;
9691
9692            // Decode the remaining unknown envelopes.
9693            while next_offset < end_offset {
9694                _next_ordinal_to_read += 1;
9695                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9696                next_offset += envelope_size;
9697            }
9698
9699            Ok(())
9700        }
9701    }
9702
9703    impl SensorDescriptor {
9704        #[inline(always)]
9705        fn max_ordinal_present(&self) -> u64 {
9706            if let Some(_) = self.feature {
9707                return 2;
9708            }
9709            if let Some(_) = self.input {
9710                return 1;
9711            }
9712            0
9713        }
9714    }
9715
9716    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
9717        type Borrowed<'a> = &'a Self;
9718        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9719            value
9720        }
9721    }
9722
9723    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
9724        type Owned = Self;
9725
9726        #[inline(always)]
9727        fn inline_align(_context: fidl::encoding::Context) -> usize {
9728            8
9729        }
9730
9731        #[inline(always)]
9732        fn inline_size(_context: fidl::encoding::Context) -> usize {
9733            16
9734        }
9735    }
9736
9737    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
9738        for &SensorDescriptor
9739    {
9740        unsafe fn encode(
9741            self,
9742            encoder: &mut fidl::encoding::Encoder<'_, D>,
9743            offset: usize,
9744            mut depth: fidl::encoding::Depth,
9745        ) -> fidl::Result<()> {
9746            encoder.debug_check_bounds::<SensorDescriptor>(offset);
9747            // Vector header
9748            let max_ordinal: u64 = self.max_ordinal_present();
9749            encoder.write_num(max_ordinal, offset);
9750            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9751            // Calling encoder.out_of_line_offset(0) is not allowed.
9752            if max_ordinal == 0 {
9753                return Ok(());
9754            }
9755            depth.increment()?;
9756            let envelope_size = 8;
9757            let bytes_len = max_ordinal as usize * envelope_size;
9758            #[allow(unused_variables)]
9759            let offset = encoder.out_of_line_offset(bytes_len);
9760            let mut _prev_end_offset: usize = 0;
9761            if 1 > max_ordinal {
9762                return Ok(());
9763            }
9764
9765            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9766            // are envelope_size bytes.
9767            let cur_offset: usize = (1 - 1) * envelope_size;
9768
9769            // Zero reserved fields.
9770            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9771
9772            // Safety:
9773            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9774            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9775            //   envelope_size bytes, there is always sufficient room.
9776            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorInputDescriptor, 255>, D>(
9777            self.input.as_ref().map(<fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9778            encoder, offset + cur_offset, depth
9779        )?;
9780
9781            _prev_end_offset = cur_offset + envelope_size;
9782            if 2 > max_ordinal {
9783                return Ok(());
9784            }
9785
9786            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9787            // are envelope_size bytes.
9788            let cur_offset: usize = (2 - 1) * envelope_size;
9789
9790            // Zero reserved fields.
9791            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9792
9793            // Safety:
9794            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9795            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9796            //   envelope_size bytes, there is always sufficient room.
9797            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D>(
9798            self.feature.as_ref().map(<fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9799            encoder, offset + cur_offset, depth
9800        )?;
9801
9802            _prev_end_offset = cur_offset + envelope_size;
9803
9804            Ok(())
9805        }
9806    }
9807
9808    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
9809        #[inline(always)]
9810        fn new_empty() -> Self {
9811            Self::default()
9812        }
9813
9814        unsafe fn decode(
9815            &mut self,
9816            decoder: &mut fidl::encoding::Decoder<'_, D>,
9817            offset: usize,
9818            mut depth: fidl::encoding::Depth,
9819        ) -> fidl::Result<()> {
9820            decoder.debug_check_bounds::<Self>(offset);
9821            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9822                None => return Err(fidl::Error::NotNullable),
9823                Some(len) => len,
9824            };
9825            // Calling decoder.out_of_line_offset(0) is not allowed.
9826            if len == 0 {
9827                return Ok(());
9828            };
9829            depth.increment()?;
9830            let envelope_size = 8;
9831            let bytes_len = len * envelope_size;
9832            let offset = decoder.out_of_line_offset(bytes_len)?;
9833            // Decode the envelope for each type.
9834            let mut _next_ordinal_to_read = 0;
9835            let mut next_offset = offset;
9836            let end_offset = offset + bytes_len;
9837            _next_ordinal_to_read += 1;
9838            if next_offset >= end_offset {
9839                return Ok(());
9840            }
9841
9842            // Decode unknown envelopes for gaps in ordinals.
9843            while _next_ordinal_to_read < 1 {
9844                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9845                _next_ordinal_to_read += 1;
9846                next_offset += envelope_size;
9847            }
9848
9849            let next_out_of_line = decoder.next_out_of_line();
9850            let handles_before = decoder.remaining_handles();
9851            if let Some((inlined, num_bytes, num_handles)) =
9852                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9853            {
9854                let member_inline_size = <fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9855                if inlined != (member_inline_size <= 4) {
9856                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9857                }
9858                let inner_offset;
9859                let mut inner_depth = depth.clone();
9860                if inlined {
9861                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9862                    inner_offset = next_offset;
9863                } else {
9864                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9865                    inner_depth.increment()?;
9866                }
9867                let val_ref = self.input.get_or_insert_with(
9868                    || fidl::new_empty!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D),
9869                );
9870                fidl::decode!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9871                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9872                {
9873                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9874                }
9875                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9876                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9877                }
9878            }
9879
9880            next_offset += envelope_size;
9881            _next_ordinal_to_read += 1;
9882            if next_offset >= end_offset {
9883                return Ok(());
9884            }
9885
9886            // Decode unknown envelopes for gaps in ordinals.
9887            while _next_ordinal_to_read < 2 {
9888                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9889                _next_ordinal_to_read += 1;
9890                next_offset += envelope_size;
9891            }
9892
9893            let next_out_of_line = decoder.next_out_of_line();
9894            let handles_before = decoder.remaining_handles();
9895            if let Some((inlined, num_bytes, num_handles)) =
9896                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9897            {
9898                let member_inline_size = <fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9899                if inlined != (member_inline_size <= 4) {
9900                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9901                }
9902                let inner_offset;
9903                let mut inner_depth = depth.clone();
9904                if inlined {
9905                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9906                    inner_offset = next_offset;
9907                } else {
9908                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9909                    inner_depth.increment()?;
9910                }
9911                let val_ref = self.feature.get_or_insert_with(
9912                    || fidl::new_empty!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D),
9913                );
9914                fidl::decode!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9915                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9916                {
9917                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9918                }
9919                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9920                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9921                }
9922            }
9923
9924            next_offset += envelope_size;
9925
9926            // Decode the remaining unknown envelopes.
9927            while next_offset < end_offset {
9928                _next_ordinal_to_read += 1;
9929                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9930                next_offset += envelope_size;
9931            }
9932
9933            Ok(())
9934        }
9935    }
9936
9937    impl SensorFeatureDescriptor {
9938        #[inline(always)]
9939        fn max_ordinal_present(&self) -> u64 {
9940            if let Some(_) = self.report_id {
9941                return 7;
9942            }
9943            if let Some(_) = self.sampling_rate {
9944                return 6;
9945            }
9946            if let Some(_) = self.threshold_low {
9947                return 5;
9948            }
9949            if let Some(_) = self.threshold_high {
9950                return 4;
9951            }
9952            if let Some(_) = self.supports_reporting_state {
9953                return 3;
9954            }
9955            if let Some(_) = self.sensitivity {
9956                return 2;
9957            }
9958            if let Some(_) = self.report_interval {
9959                return 1;
9960            }
9961            0
9962        }
9963    }
9964
9965    impl fidl::encoding::ValueTypeMarker for SensorFeatureDescriptor {
9966        type Borrowed<'a> = &'a Self;
9967        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9968            value
9969        }
9970    }
9971
9972    unsafe impl fidl::encoding::TypeMarker for SensorFeatureDescriptor {
9973        type Owned = Self;
9974
9975        #[inline(always)]
9976        fn inline_align(_context: fidl::encoding::Context) -> usize {
9977            8
9978        }
9979
9980        #[inline(always)]
9981        fn inline_size(_context: fidl::encoding::Context) -> usize {
9982            16
9983        }
9984    }
9985
9986    unsafe impl<D: fidl::encoding::ResourceDialect>
9987        fidl::encoding::Encode<SensorFeatureDescriptor, D> for &SensorFeatureDescriptor
9988    {
9989        unsafe fn encode(
9990            self,
9991            encoder: &mut fidl::encoding::Encoder<'_, D>,
9992            offset: usize,
9993            mut depth: fidl::encoding::Depth,
9994        ) -> fidl::Result<()> {
9995            encoder.debug_check_bounds::<SensorFeatureDescriptor>(offset);
9996            // Vector header
9997            let max_ordinal: u64 = self.max_ordinal_present();
9998            encoder.write_num(max_ordinal, offset);
9999            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10000            // Calling encoder.out_of_line_offset(0) is not allowed.
10001            if max_ordinal == 0 {
10002                return Ok(());
10003            }
10004            depth.increment()?;
10005            let envelope_size = 8;
10006            let bytes_len = max_ordinal as usize * envelope_size;
10007            #[allow(unused_variables)]
10008            let offset = encoder.out_of_line_offset(bytes_len);
10009            let mut _prev_end_offset: usize = 0;
10010            if 1 > max_ordinal {
10011                return Ok(());
10012            }
10013
10014            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10015            // are envelope_size bytes.
10016            let cur_offset: usize = (1 - 1) * envelope_size;
10017
10018            // Zero reserved fields.
10019            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10020
10021            // Safety:
10022            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10023            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10024            //   envelope_size bytes, there is always sufficient room.
10025            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
10026                self.report_interval
10027                    .as_ref()
10028                    .map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
10029                encoder,
10030                offset + cur_offset,
10031                depth,
10032            )?;
10033
10034            _prev_end_offset = cur_offset + envelope_size;
10035            if 2 > max_ordinal {
10036                return Ok(());
10037            }
10038
10039            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10040            // are envelope_size bytes.
10041            let cur_offset: usize = (2 - 1) * envelope_size;
10042
10043            // Zero reserved fields.
10044            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10045
10046            // Safety:
10047            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10048            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10049            //   envelope_size bytes, there is always sufficient room.
10050            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
10051            self.sensitivity.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
10052            encoder, offset + cur_offset, depth
10053        )?;
10054
10055            _prev_end_offset = cur_offset + envelope_size;
10056            if 3 > max_ordinal {
10057                return Ok(());
10058            }
10059
10060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10061            // are envelope_size bytes.
10062            let cur_offset: usize = (3 - 1) * envelope_size;
10063
10064            // Zero reserved fields.
10065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10066
10067            // Safety:
10068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10070            //   envelope_size bytes, there is always sufficient room.
10071            fidl::encoding::encode_in_envelope_optional::<bool, D>(
10072                self.supports_reporting_state
10073                    .as_ref()
10074                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10075                encoder,
10076                offset + cur_offset,
10077                depth,
10078            )?;
10079
10080            _prev_end_offset = cur_offset + envelope_size;
10081            if 4 > max_ordinal {
10082                return Ok(());
10083            }
10084
10085            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10086            // are envelope_size bytes.
10087            let cur_offset: usize = (4 - 1) * envelope_size;
10088
10089            // Zero reserved fields.
10090            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10091
10092            // Safety:
10093            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10094            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10095            //   envelope_size bytes, there is always sufficient room.
10096            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
10097            self.threshold_high.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
10098            encoder, offset + cur_offset, depth
10099        )?;
10100
10101            _prev_end_offset = cur_offset + envelope_size;
10102            if 5 > max_ordinal {
10103                return Ok(());
10104            }
10105
10106            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10107            // are envelope_size bytes.
10108            let cur_offset: usize = (5 - 1) * envelope_size;
10109
10110            // Zero reserved fields.
10111            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10112
10113            // Safety:
10114            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10115            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10116            //   envelope_size bytes, there is always sufficient room.
10117            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
10118            self.threshold_low.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
10119            encoder, offset + cur_offset, depth
10120        )?;
10121
10122            _prev_end_offset = cur_offset + envelope_size;
10123            if 6 > max_ordinal {
10124                return Ok(());
10125            }
10126
10127            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10128            // are envelope_size bytes.
10129            let cur_offset: usize = (6 - 1) * envelope_size;
10130
10131            // Zero reserved fields.
10132            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10133
10134            // Safety:
10135            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10136            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10137            //   envelope_size bytes, there is always sufficient room.
10138            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
10139                self.sampling_rate.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
10140                encoder,
10141                offset + cur_offset,
10142                depth,
10143            )?;
10144
10145            _prev_end_offset = cur_offset + envelope_size;
10146            if 7 > max_ordinal {
10147                return Ok(());
10148            }
10149
10150            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10151            // are envelope_size bytes.
10152            let cur_offset: usize = (7 - 1) * envelope_size;
10153
10154            // Zero reserved fields.
10155            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10156
10157            // Safety:
10158            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10159            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10160            //   envelope_size bytes, there is always sufficient room.
10161            fidl::encoding::encode_in_envelope_optional::<u8, D>(
10162                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
10163                encoder,
10164                offset + cur_offset,
10165                depth,
10166            )?;
10167
10168            _prev_end_offset = cur_offset + envelope_size;
10169
10170            Ok(())
10171        }
10172    }
10173
10174    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10175        for SensorFeatureDescriptor
10176    {
10177        #[inline(always)]
10178        fn new_empty() -> Self {
10179            Self::default()
10180        }
10181
10182        unsafe fn decode(
10183            &mut self,
10184            decoder: &mut fidl::encoding::Decoder<'_, D>,
10185            offset: usize,
10186            mut depth: fidl::encoding::Depth,
10187        ) -> fidl::Result<()> {
10188            decoder.debug_check_bounds::<Self>(offset);
10189            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10190                None => return Err(fidl::Error::NotNullable),
10191                Some(len) => len,
10192            };
10193            // Calling decoder.out_of_line_offset(0) is not allowed.
10194            if len == 0 {
10195                return Ok(());
10196            };
10197            depth.increment()?;
10198            let envelope_size = 8;
10199            let bytes_len = len * envelope_size;
10200            let offset = decoder.out_of_line_offset(bytes_len)?;
10201            // Decode the envelope for each type.
10202            let mut _next_ordinal_to_read = 0;
10203            let mut next_offset = offset;
10204            let end_offset = offset + bytes_len;
10205            _next_ordinal_to_read += 1;
10206            if next_offset >= end_offset {
10207                return Ok(());
10208            }
10209
10210            // Decode unknown envelopes for gaps in ordinals.
10211            while _next_ordinal_to_read < 1 {
10212                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10213                _next_ordinal_to_read += 1;
10214                next_offset += envelope_size;
10215            }
10216
10217            let next_out_of_line = decoder.next_out_of_line();
10218            let handles_before = decoder.remaining_handles();
10219            if let Some((inlined, num_bytes, num_handles)) =
10220                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10221            {
10222                let member_inline_size =
10223                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10224                if inlined != (member_inline_size <= 4) {
10225                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10226                }
10227                let inner_offset;
10228                let mut inner_depth = depth.clone();
10229                if inlined {
10230                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10231                    inner_offset = next_offset;
10232                } else {
10233                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10234                    inner_depth.increment()?;
10235                }
10236                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10237                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10238                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10239                {
10240                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10241                }
10242                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10243                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10244                }
10245            }
10246
10247            next_offset += envelope_size;
10248            _next_ordinal_to_read += 1;
10249            if next_offset >= end_offset {
10250                return Ok(());
10251            }
10252
10253            // Decode unknown envelopes for gaps in ordinals.
10254            while _next_ordinal_to_read < 2 {
10255                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10256                _next_ordinal_to_read += 1;
10257                next_offset += envelope_size;
10258            }
10259
10260            let next_out_of_line = decoder.next_out_of_line();
10261            let handles_before = decoder.remaining_handles();
10262            if let Some((inlined, num_bytes, num_handles)) =
10263                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10264            {
10265                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10266                if inlined != (member_inline_size <= 4) {
10267                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10268                }
10269                let inner_offset;
10270                let mut inner_depth = depth.clone();
10271                if inlined {
10272                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10273                    inner_offset = next_offset;
10274                } else {
10275                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10276                    inner_depth.increment()?;
10277                }
10278                let val_ref = self.sensitivity.get_or_insert_with(
10279                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10280                );
10281                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10282                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10283                {
10284                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10285                }
10286                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10287                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10288                }
10289            }
10290
10291            next_offset += envelope_size;
10292            _next_ordinal_to_read += 1;
10293            if next_offset >= end_offset {
10294                return Ok(());
10295            }
10296
10297            // Decode unknown envelopes for gaps in ordinals.
10298            while _next_ordinal_to_read < 3 {
10299                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10300                _next_ordinal_to_read += 1;
10301                next_offset += envelope_size;
10302            }
10303
10304            let next_out_of_line = decoder.next_out_of_line();
10305            let handles_before = decoder.remaining_handles();
10306            if let Some((inlined, num_bytes, num_handles)) =
10307                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10308            {
10309                let member_inline_size =
10310                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10311                if inlined != (member_inline_size <= 4) {
10312                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10313                }
10314                let inner_offset;
10315                let mut inner_depth = depth.clone();
10316                if inlined {
10317                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10318                    inner_offset = next_offset;
10319                } else {
10320                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10321                    inner_depth.increment()?;
10322                }
10323                let val_ref =
10324                    self.supports_reporting_state.get_or_insert_with(|| fidl::new_empty!(bool, D));
10325                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10326                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10327                {
10328                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10329                }
10330                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10331                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10332                }
10333            }
10334
10335            next_offset += envelope_size;
10336            _next_ordinal_to_read += 1;
10337            if next_offset >= end_offset {
10338                return Ok(());
10339            }
10340
10341            // Decode unknown envelopes for gaps in ordinals.
10342            while _next_ordinal_to_read < 4 {
10343                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10344                _next_ordinal_to_read += 1;
10345                next_offset += envelope_size;
10346            }
10347
10348            let next_out_of_line = decoder.next_out_of_line();
10349            let handles_before = decoder.remaining_handles();
10350            if let Some((inlined, num_bytes, num_handles)) =
10351                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10352            {
10353                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10354                if inlined != (member_inline_size <= 4) {
10355                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10356                }
10357                let inner_offset;
10358                let mut inner_depth = depth.clone();
10359                if inlined {
10360                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10361                    inner_offset = next_offset;
10362                } else {
10363                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10364                    inner_depth.increment()?;
10365                }
10366                let val_ref = self.threshold_high.get_or_insert_with(
10367                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10368                );
10369                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10370                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10371                {
10372                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10373                }
10374                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10375                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10376                }
10377            }
10378
10379            next_offset += envelope_size;
10380            _next_ordinal_to_read += 1;
10381            if next_offset >= end_offset {
10382                return Ok(());
10383            }
10384
10385            // Decode unknown envelopes for gaps in ordinals.
10386            while _next_ordinal_to_read < 5 {
10387                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10388                _next_ordinal_to_read += 1;
10389                next_offset += envelope_size;
10390            }
10391
10392            let next_out_of_line = decoder.next_out_of_line();
10393            let handles_before = decoder.remaining_handles();
10394            if let Some((inlined, num_bytes, num_handles)) =
10395                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10396            {
10397                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10398                if inlined != (member_inline_size <= 4) {
10399                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10400                }
10401                let inner_offset;
10402                let mut inner_depth = depth.clone();
10403                if inlined {
10404                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10405                    inner_offset = next_offset;
10406                } else {
10407                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10408                    inner_depth.increment()?;
10409                }
10410                let val_ref = self.threshold_low.get_or_insert_with(
10411                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10412                );
10413                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10414                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10415                {
10416                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10417                }
10418                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10419                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10420                }
10421            }
10422
10423            next_offset += envelope_size;
10424            _next_ordinal_to_read += 1;
10425            if next_offset >= end_offset {
10426                return Ok(());
10427            }
10428
10429            // Decode unknown envelopes for gaps in ordinals.
10430            while _next_ordinal_to_read < 6 {
10431                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10432                _next_ordinal_to_read += 1;
10433                next_offset += envelope_size;
10434            }
10435
10436            let next_out_of_line = decoder.next_out_of_line();
10437            let handles_before = decoder.remaining_handles();
10438            if let Some((inlined, num_bytes, num_handles)) =
10439                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10440            {
10441                let member_inline_size =
10442                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10443                if inlined != (member_inline_size <= 4) {
10444                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10445                }
10446                let inner_offset;
10447                let mut inner_depth = depth.clone();
10448                if inlined {
10449                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10450                    inner_offset = next_offset;
10451                } else {
10452                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10453                    inner_depth.increment()?;
10454                }
10455                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10456                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10457                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10458                {
10459                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10460                }
10461                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10462                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10463                }
10464            }
10465
10466            next_offset += envelope_size;
10467            _next_ordinal_to_read += 1;
10468            if next_offset >= end_offset {
10469                return Ok(());
10470            }
10471
10472            // Decode unknown envelopes for gaps in ordinals.
10473            while _next_ordinal_to_read < 7 {
10474                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10475                _next_ordinal_to_read += 1;
10476                next_offset += envelope_size;
10477            }
10478
10479            let next_out_of_line = decoder.next_out_of_line();
10480            let handles_before = decoder.remaining_handles();
10481            if let Some((inlined, num_bytes, num_handles)) =
10482                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10483            {
10484                let member_inline_size =
10485                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10486                if inlined != (member_inline_size <= 4) {
10487                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10488                }
10489                let inner_offset;
10490                let mut inner_depth = depth.clone();
10491                if inlined {
10492                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10493                    inner_offset = next_offset;
10494                } else {
10495                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10496                    inner_depth.increment()?;
10497                }
10498                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
10499                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
10500                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10501                {
10502                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10503                }
10504                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10505                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10506                }
10507            }
10508
10509            next_offset += envelope_size;
10510
10511            // Decode the remaining unknown envelopes.
10512            while next_offset < end_offset {
10513                _next_ordinal_to_read += 1;
10514                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10515                next_offset += envelope_size;
10516            }
10517
10518            Ok(())
10519        }
10520    }
10521
10522    impl SensorFeatureReport {
10523        #[inline(always)]
10524        fn max_ordinal_present(&self) -> u64 {
10525            if let Some(_) = self.sampling_rate {
10526                return 6;
10527            }
10528            if let Some(_) = self.threshold_low {
10529                return 5;
10530            }
10531            if let Some(_) = self.threshold_high {
10532                return 4;
10533            }
10534            if let Some(_) = self.reporting_state {
10535                return 3;
10536            }
10537            if let Some(_) = self.sensitivity {
10538                return 2;
10539            }
10540            if let Some(_) = self.report_interval {
10541                return 1;
10542            }
10543            0
10544        }
10545    }
10546
10547    impl fidl::encoding::ValueTypeMarker for SensorFeatureReport {
10548        type Borrowed<'a> = &'a Self;
10549        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10550            value
10551        }
10552    }
10553
10554    unsafe impl fidl::encoding::TypeMarker for SensorFeatureReport {
10555        type Owned = Self;
10556
10557        #[inline(always)]
10558        fn inline_align(_context: fidl::encoding::Context) -> usize {
10559            8
10560        }
10561
10562        #[inline(always)]
10563        fn inline_size(_context: fidl::encoding::Context) -> usize {
10564            16
10565        }
10566    }
10567
10568    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorFeatureReport, D>
10569        for &SensorFeatureReport
10570    {
10571        unsafe fn encode(
10572            self,
10573            encoder: &mut fidl::encoding::Encoder<'_, D>,
10574            offset: usize,
10575            mut depth: fidl::encoding::Depth,
10576        ) -> fidl::Result<()> {
10577            encoder.debug_check_bounds::<SensorFeatureReport>(offset);
10578            // Vector header
10579            let max_ordinal: u64 = self.max_ordinal_present();
10580            encoder.write_num(max_ordinal, offset);
10581            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10582            // Calling encoder.out_of_line_offset(0) is not allowed.
10583            if max_ordinal == 0 {
10584                return Ok(());
10585            }
10586            depth.increment()?;
10587            let envelope_size = 8;
10588            let bytes_len = max_ordinal as usize * envelope_size;
10589            #[allow(unused_variables)]
10590            let offset = encoder.out_of_line_offset(bytes_len);
10591            let mut _prev_end_offset: usize = 0;
10592            if 1 > max_ordinal {
10593                return Ok(());
10594            }
10595
10596            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10597            // are envelope_size bytes.
10598            let cur_offset: usize = (1 - 1) * envelope_size;
10599
10600            // Zero reserved fields.
10601            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10602
10603            // Safety:
10604            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10605            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10606            //   envelope_size bytes, there is always sufficient room.
10607            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10608                self.report_interval.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10609                encoder,
10610                offset + cur_offset,
10611                depth,
10612            )?;
10613
10614            _prev_end_offset = cur_offset + envelope_size;
10615            if 2 > max_ordinal {
10616                return Ok(());
10617            }
10618
10619            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10620            // are envelope_size bytes.
10621            let cur_offset: usize = (2 - 1) * envelope_size;
10622
10623            // Zero reserved fields.
10624            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10625
10626            // Safety:
10627            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10628            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10629            //   envelope_size bytes, there is always sufficient room.
10630            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10631                self.sensitivity.as_ref().map(
10632                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10633                ),
10634                encoder,
10635                offset + cur_offset,
10636                depth,
10637            )?;
10638
10639            _prev_end_offset = cur_offset + envelope_size;
10640            if 3 > max_ordinal {
10641                return Ok(());
10642            }
10643
10644            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10645            // are envelope_size bytes.
10646            let cur_offset: usize = (3 - 1) * envelope_size;
10647
10648            // Zero reserved fields.
10649            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10650
10651            // Safety:
10652            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10653            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10654            //   envelope_size bytes, there is always sufficient room.
10655            fidl::encoding::encode_in_envelope_optional::<SensorReportingState, D>(
10656                self.reporting_state
10657                    .as_ref()
10658                    .map(<SensorReportingState as fidl::encoding::ValueTypeMarker>::borrow),
10659                encoder,
10660                offset + cur_offset,
10661                depth,
10662            )?;
10663
10664            _prev_end_offset = cur_offset + envelope_size;
10665            if 4 > max_ordinal {
10666                return Ok(());
10667            }
10668
10669            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10670            // are envelope_size bytes.
10671            let cur_offset: usize = (4 - 1) * envelope_size;
10672
10673            // Zero reserved fields.
10674            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10675
10676            // Safety:
10677            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10678            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10679            //   envelope_size bytes, there is always sufficient room.
10680            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10681                self.threshold_high.as_ref().map(
10682                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10683                ),
10684                encoder,
10685                offset + cur_offset,
10686                depth,
10687            )?;
10688
10689            _prev_end_offset = cur_offset + envelope_size;
10690            if 5 > max_ordinal {
10691                return Ok(());
10692            }
10693
10694            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10695            // are envelope_size bytes.
10696            let cur_offset: usize = (5 - 1) * envelope_size;
10697
10698            // Zero reserved fields.
10699            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10700
10701            // Safety:
10702            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10703            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10704            //   envelope_size bytes, there is always sufficient room.
10705            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10706                self.threshold_low.as_ref().map(
10707                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10708                ),
10709                encoder,
10710                offset + cur_offset,
10711                depth,
10712            )?;
10713
10714            _prev_end_offset = cur_offset + envelope_size;
10715            if 6 > max_ordinal {
10716                return Ok(());
10717            }
10718
10719            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10720            // are envelope_size bytes.
10721            let cur_offset: usize = (6 - 1) * envelope_size;
10722
10723            // Zero reserved fields.
10724            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10725
10726            // Safety:
10727            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10728            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10729            //   envelope_size bytes, there is always sufficient room.
10730            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10731                self.sampling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10732                encoder,
10733                offset + cur_offset,
10734                depth,
10735            )?;
10736
10737            _prev_end_offset = cur_offset + envelope_size;
10738
10739            Ok(())
10740        }
10741    }
10742
10743    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorFeatureReport {
10744        #[inline(always)]
10745        fn new_empty() -> Self {
10746            Self::default()
10747        }
10748
10749        unsafe fn decode(
10750            &mut self,
10751            decoder: &mut fidl::encoding::Decoder<'_, D>,
10752            offset: usize,
10753            mut depth: fidl::encoding::Depth,
10754        ) -> fidl::Result<()> {
10755            decoder.debug_check_bounds::<Self>(offset);
10756            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10757                None => return Err(fidl::Error::NotNullable),
10758                Some(len) => len,
10759            };
10760            // Calling decoder.out_of_line_offset(0) is not allowed.
10761            if len == 0 {
10762                return Ok(());
10763            };
10764            depth.increment()?;
10765            let envelope_size = 8;
10766            let bytes_len = len * envelope_size;
10767            let offset = decoder.out_of_line_offset(bytes_len)?;
10768            // Decode the envelope for each type.
10769            let mut _next_ordinal_to_read = 0;
10770            let mut next_offset = offset;
10771            let end_offset = offset + bytes_len;
10772            _next_ordinal_to_read += 1;
10773            if next_offset >= end_offset {
10774                return Ok(());
10775            }
10776
10777            // Decode unknown envelopes for gaps in ordinals.
10778            while _next_ordinal_to_read < 1 {
10779                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10780                _next_ordinal_to_read += 1;
10781                next_offset += envelope_size;
10782            }
10783
10784            let next_out_of_line = decoder.next_out_of_line();
10785            let handles_before = decoder.remaining_handles();
10786            if let Some((inlined, num_bytes, num_handles)) =
10787                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10788            {
10789                let member_inline_size =
10790                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10791                if inlined != (member_inline_size <= 4) {
10792                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10793                }
10794                let inner_offset;
10795                let mut inner_depth = depth.clone();
10796                if inlined {
10797                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10798                    inner_offset = next_offset;
10799                } else {
10800                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10801                    inner_depth.increment()?;
10802                }
10803                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(i64, D));
10804                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10805                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10806                {
10807                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10808                }
10809                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10810                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10811                }
10812            }
10813
10814            next_offset += envelope_size;
10815            _next_ordinal_to_read += 1;
10816            if next_offset >= end_offset {
10817                return Ok(());
10818            }
10819
10820            // Decode unknown envelopes for gaps in ordinals.
10821            while _next_ordinal_to_read < 2 {
10822                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10823                _next_ordinal_to_read += 1;
10824                next_offset += envelope_size;
10825            }
10826
10827            let next_out_of_line = decoder.next_out_of_line();
10828            let handles_before = decoder.remaining_handles();
10829            if let Some((inlined, num_bytes, num_handles)) =
10830                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10831            {
10832                let member_inline_size =
10833                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10834                        decoder.context,
10835                    );
10836                if inlined != (member_inline_size <= 4) {
10837                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10838                }
10839                let inner_offset;
10840                let mut inner_depth = depth.clone();
10841                if inlined {
10842                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10843                    inner_offset = next_offset;
10844                } else {
10845                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10846                    inner_depth.increment()?;
10847                }
10848                let val_ref = self
10849                    .sensitivity
10850                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10851                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10852                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10853                {
10854                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10855                }
10856                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10857                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10858                }
10859            }
10860
10861            next_offset += envelope_size;
10862            _next_ordinal_to_read += 1;
10863            if next_offset >= end_offset {
10864                return Ok(());
10865            }
10866
10867            // Decode unknown envelopes for gaps in ordinals.
10868            while _next_ordinal_to_read < 3 {
10869                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10870                _next_ordinal_to_read += 1;
10871                next_offset += envelope_size;
10872            }
10873
10874            let next_out_of_line = decoder.next_out_of_line();
10875            let handles_before = decoder.remaining_handles();
10876            if let Some((inlined, num_bytes, num_handles)) =
10877                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10878            {
10879                let member_inline_size =
10880                    <SensorReportingState as fidl::encoding::TypeMarker>::inline_size(
10881                        decoder.context,
10882                    );
10883                if inlined != (member_inline_size <= 4) {
10884                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10885                }
10886                let inner_offset;
10887                let mut inner_depth = depth.clone();
10888                if inlined {
10889                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10890                    inner_offset = next_offset;
10891                } else {
10892                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10893                    inner_depth.increment()?;
10894                }
10895                let val_ref = self
10896                    .reporting_state
10897                    .get_or_insert_with(|| fidl::new_empty!(SensorReportingState, D));
10898                fidl::decode!(
10899                    SensorReportingState,
10900                    D,
10901                    val_ref,
10902                    decoder,
10903                    inner_offset,
10904                    inner_depth
10905                )?;
10906                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10907                {
10908                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10909                }
10910                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10911                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10912                }
10913            }
10914
10915            next_offset += envelope_size;
10916            _next_ordinal_to_read += 1;
10917            if next_offset >= end_offset {
10918                return Ok(());
10919            }
10920
10921            // Decode unknown envelopes for gaps in ordinals.
10922            while _next_ordinal_to_read < 4 {
10923                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10924                _next_ordinal_to_read += 1;
10925                next_offset += envelope_size;
10926            }
10927
10928            let next_out_of_line = decoder.next_out_of_line();
10929            let handles_before = decoder.remaining_handles();
10930            if let Some((inlined, num_bytes, num_handles)) =
10931                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10932            {
10933                let member_inline_size =
10934                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10935                        decoder.context,
10936                    );
10937                if inlined != (member_inline_size <= 4) {
10938                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10939                }
10940                let inner_offset;
10941                let mut inner_depth = depth.clone();
10942                if inlined {
10943                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10944                    inner_offset = next_offset;
10945                } else {
10946                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10947                    inner_depth.increment()?;
10948                }
10949                let val_ref = self
10950                    .threshold_high
10951                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10952                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10953                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10954                {
10955                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10956                }
10957                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10958                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10959                }
10960            }
10961
10962            next_offset += envelope_size;
10963            _next_ordinal_to_read += 1;
10964            if next_offset >= end_offset {
10965                return Ok(());
10966            }
10967
10968            // Decode unknown envelopes for gaps in ordinals.
10969            while _next_ordinal_to_read < 5 {
10970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10971                _next_ordinal_to_read += 1;
10972                next_offset += envelope_size;
10973            }
10974
10975            let next_out_of_line = decoder.next_out_of_line();
10976            let handles_before = decoder.remaining_handles();
10977            if let Some((inlined, num_bytes, num_handles)) =
10978                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10979            {
10980                let member_inline_size =
10981                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10982                        decoder.context,
10983                    );
10984                if inlined != (member_inline_size <= 4) {
10985                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10986                }
10987                let inner_offset;
10988                let mut inner_depth = depth.clone();
10989                if inlined {
10990                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10991                    inner_offset = next_offset;
10992                } else {
10993                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10994                    inner_depth.increment()?;
10995                }
10996                let val_ref = self
10997                    .threshold_low
10998                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10999                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11000                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11001                {
11002                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11003                }
11004                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11005                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11006                }
11007            }
11008
11009            next_offset += envelope_size;
11010            _next_ordinal_to_read += 1;
11011            if next_offset >= end_offset {
11012                return Ok(());
11013            }
11014
11015            // Decode unknown envelopes for gaps in ordinals.
11016            while _next_ordinal_to_read < 6 {
11017                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11018                _next_ordinal_to_read += 1;
11019                next_offset += envelope_size;
11020            }
11021
11022            let next_out_of_line = decoder.next_out_of_line();
11023            let handles_before = decoder.remaining_handles();
11024            if let Some((inlined, num_bytes, num_handles)) =
11025                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11026            {
11027                let member_inline_size =
11028                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11029                if inlined != (member_inline_size <= 4) {
11030                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11031                }
11032                let inner_offset;
11033                let mut inner_depth = depth.clone();
11034                if inlined {
11035                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11036                    inner_offset = next_offset;
11037                } else {
11038                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11039                    inner_depth.increment()?;
11040                }
11041                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
11042                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
11043                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11044                {
11045                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11046                }
11047                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11048                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11049                }
11050            }
11051
11052            next_offset += envelope_size;
11053
11054            // Decode the remaining unknown envelopes.
11055            while next_offset < end_offset {
11056                _next_ordinal_to_read += 1;
11057                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11058                next_offset += envelope_size;
11059            }
11060
11061            Ok(())
11062        }
11063    }
11064
11065    impl SensorInputDescriptor {
11066        #[inline(always)]
11067        fn max_ordinal_present(&self) -> u64 {
11068            if let Some(_) = self.report_id {
11069                return 2;
11070            }
11071            if let Some(_) = self.values {
11072                return 1;
11073            }
11074            0
11075        }
11076    }
11077
11078    impl fidl::encoding::ValueTypeMarker for SensorInputDescriptor {
11079        type Borrowed<'a> = &'a Self;
11080        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11081            value
11082        }
11083    }
11084
11085    unsafe impl fidl::encoding::TypeMarker for SensorInputDescriptor {
11086        type Owned = Self;
11087
11088        #[inline(always)]
11089        fn inline_align(_context: fidl::encoding::Context) -> usize {
11090            8
11091        }
11092
11093        #[inline(always)]
11094        fn inline_size(_context: fidl::encoding::Context) -> usize {
11095            16
11096        }
11097    }
11098
11099    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputDescriptor, D>
11100        for &SensorInputDescriptor
11101    {
11102        unsafe fn encode(
11103            self,
11104            encoder: &mut fidl::encoding::Encoder<'_, D>,
11105            offset: usize,
11106            mut depth: fidl::encoding::Depth,
11107        ) -> fidl::Result<()> {
11108            encoder.debug_check_bounds::<SensorInputDescriptor>(offset);
11109            // Vector header
11110            let max_ordinal: u64 = self.max_ordinal_present();
11111            encoder.write_num(max_ordinal, offset);
11112            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11113            // Calling encoder.out_of_line_offset(0) is not allowed.
11114            if max_ordinal == 0 {
11115                return Ok(());
11116            }
11117            depth.increment()?;
11118            let envelope_size = 8;
11119            let bytes_len = max_ordinal as usize * envelope_size;
11120            #[allow(unused_variables)]
11121            let offset = encoder.out_of_line_offset(bytes_len);
11122            let mut _prev_end_offset: usize = 0;
11123            if 1 > max_ordinal {
11124                return Ok(());
11125            }
11126
11127            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11128            // are envelope_size bytes.
11129            let cur_offset: usize = (1 - 1) * envelope_size;
11130
11131            // Zero reserved fields.
11132            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11133
11134            // Safety:
11135            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11136            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11137            //   envelope_size bytes, there is always sufficient room.
11138            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
11139            self.values.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
11140            encoder, offset + cur_offset, depth
11141        )?;
11142
11143            _prev_end_offset = cur_offset + envelope_size;
11144            if 2 > max_ordinal {
11145                return Ok(());
11146            }
11147
11148            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11149            // are envelope_size bytes.
11150            let cur_offset: usize = (2 - 1) * envelope_size;
11151
11152            // Zero reserved fields.
11153            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11154
11155            // Safety:
11156            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11157            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11158            //   envelope_size bytes, there is always sufficient room.
11159            fidl::encoding::encode_in_envelope_optional::<u8, D>(
11160                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11161                encoder,
11162                offset + cur_offset,
11163                depth,
11164            )?;
11165
11166            _prev_end_offset = cur_offset + envelope_size;
11167
11168            Ok(())
11169        }
11170    }
11171
11172    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputDescriptor {
11173        #[inline(always)]
11174        fn new_empty() -> Self {
11175            Self::default()
11176        }
11177
11178        unsafe fn decode(
11179            &mut self,
11180            decoder: &mut fidl::encoding::Decoder<'_, D>,
11181            offset: usize,
11182            mut depth: fidl::encoding::Depth,
11183        ) -> fidl::Result<()> {
11184            decoder.debug_check_bounds::<Self>(offset);
11185            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11186                None => return Err(fidl::Error::NotNullable),
11187                Some(len) => len,
11188            };
11189            // Calling decoder.out_of_line_offset(0) is not allowed.
11190            if len == 0 {
11191                return Ok(());
11192            };
11193            depth.increment()?;
11194            let envelope_size = 8;
11195            let bytes_len = len * envelope_size;
11196            let offset = decoder.out_of_line_offset(bytes_len)?;
11197            // Decode the envelope for each type.
11198            let mut _next_ordinal_to_read = 0;
11199            let mut next_offset = offset;
11200            let end_offset = offset + bytes_len;
11201            _next_ordinal_to_read += 1;
11202            if next_offset >= end_offset {
11203                return Ok(());
11204            }
11205
11206            // Decode unknown envelopes for gaps in ordinals.
11207            while _next_ordinal_to_read < 1 {
11208                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11209                _next_ordinal_to_read += 1;
11210                next_offset += envelope_size;
11211            }
11212
11213            let next_out_of_line = decoder.next_out_of_line();
11214            let handles_before = decoder.remaining_handles();
11215            if let Some((inlined, num_bytes, num_handles)) =
11216                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11217            {
11218                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11219                if inlined != (member_inline_size <= 4) {
11220                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11221                }
11222                let inner_offset;
11223                let mut inner_depth = depth.clone();
11224                if inlined {
11225                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11226                    inner_offset = next_offset;
11227                } else {
11228                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11229                    inner_depth.increment()?;
11230                }
11231                let val_ref = self.values.get_or_insert_with(
11232                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
11233                );
11234                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11235                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11236                {
11237                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11238                }
11239                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11240                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11241                }
11242            }
11243
11244            next_offset += envelope_size;
11245            _next_ordinal_to_read += 1;
11246            if next_offset >= end_offset {
11247                return Ok(());
11248            }
11249
11250            // Decode unknown envelopes for gaps in ordinals.
11251            while _next_ordinal_to_read < 2 {
11252                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11253                _next_ordinal_to_read += 1;
11254                next_offset += envelope_size;
11255            }
11256
11257            let next_out_of_line = decoder.next_out_of_line();
11258            let handles_before = decoder.remaining_handles();
11259            if let Some((inlined, num_bytes, num_handles)) =
11260                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11261            {
11262                let member_inline_size =
11263                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11264                if inlined != (member_inline_size <= 4) {
11265                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11266                }
11267                let inner_offset;
11268                let mut inner_depth = depth.clone();
11269                if inlined {
11270                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11271                    inner_offset = next_offset;
11272                } else {
11273                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11274                    inner_depth.increment()?;
11275                }
11276                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
11277                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
11278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11279                {
11280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11281                }
11282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11284                }
11285            }
11286
11287            next_offset += envelope_size;
11288
11289            // Decode the remaining unknown envelopes.
11290            while next_offset < end_offset {
11291                _next_ordinal_to_read += 1;
11292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11293                next_offset += envelope_size;
11294            }
11295
11296            Ok(())
11297        }
11298    }
11299
11300    impl SensorInputReport {
11301        #[inline(always)]
11302        fn max_ordinal_present(&self) -> u64 {
11303            if let Some(_) = self.values {
11304                return 1;
11305            }
11306            0
11307        }
11308    }
11309
11310    impl fidl::encoding::ValueTypeMarker for SensorInputReport {
11311        type Borrowed<'a> = &'a Self;
11312        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11313            value
11314        }
11315    }
11316
11317    unsafe impl fidl::encoding::TypeMarker for SensorInputReport {
11318        type Owned = Self;
11319
11320        #[inline(always)]
11321        fn inline_align(_context: fidl::encoding::Context) -> usize {
11322            8
11323        }
11324
11325        #[inline(always)]
11326        fn inline_size(_context: fidl::encoding::Context) -> usize {
11327            16
11328        }
11329    }
11330
11331    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputReport, D>
11332        for &SensorInputReport
11333    {
11334        unsafe fn encode(
11335            self,
11336            encoder: &mut fidl::encoding::Encoder<'_, D>,
11337            offset: usize,
11338            mut depth: fidl::encoding::Depth,
11339        ) -> fidl::Result<()> {
11340            encoder.debug_check_bounds::<SensorInputReport>(offset);
11341            // Vector header
11342            let max_ordinal: u64 = self.max_ordinal_present();
11343            encoder.write_num(max_ordinal, offset);
11344            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11345            // Calling encoder.out_of_line_offset(0) is not allowed.
11346            if max_ordinal == 0 {
11347                return Ok(());
11348            }
11349            depth.increment()?;
11350            let envelope_size = 8;
11351            let bytes_len = max_ordinal as usize * envelope_size;
11352            #[allow(unused_variables)]
11353            let offset = encoder.out_of_line_offset(bytes_len);
11354            let mut _prev_end_offset: usize = 0;
11355            if 1 > max_ordinal {
11356                return Ok(());
11357            }
11358
11359            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11360            // are envelope_size bytes.
11361            let cur_offset: usize = (1 - 1) * envelope_size;
11362
11363            // Zero reserved fields.
11364            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11365
11366            // Safety:
11367            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11368            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11369            //   envelope_size bytes, there is always sufficient room.
11370            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
11371                self.values.as_ref().map(
11372                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
11373                ),
11374                encoder,
11375                offset + cur_offset,
11376                depth,
11377            )?;
11378
11379            _prev_end_offset = cur_offset + envelope_size;
11380
11381            Ok(())
11382        }
11383    }
11384
11385    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputReport {
11386        #[inline(always)]
11387        fn new_empty() -> Self {
11388            Self::default()
11389        }
11390
11391        unsafe fn decode(
11392            &mut self,
11393            decoder: &mut fidl::encoding::Decoder<'_, D>,
11394            offset: usize,
11395            mut depth: fidl::encoding::Depth,
11396        ) -> fidl::Result<()> {
11397            decoder.debug_check_bounds::<Self>(offset);
11398            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11399                None => return Err(fidl::Error::NotNullable),
11400                Some(len) => len,
11401            };
11402            // Calling decoder.out_of_line_offset(0) is not allowed.
11403            if len == 0 {
11404                return Ok(());
11405            };
11406            depth.increment()?;
11407            let envelope_size = 8;
11408            let bytes_len = len * envelope_size;
11409            let offset = decoder.out_of_line_offset(bytes_len)?;
11410            // Decode the envelope for each type.
11411            let mut _next_ordinal_to_read = 0;
11412            let mut next_offset = offset;
11413            let end_offset = offset + bytes_len;
11414            _next_ordinal_to_read += 1;
11415            if next_offset >= end_offset {
11416                return Ok(());
11417            }
11418
11419            // Decode unknown envelopes for gaps in ordinals.
11420            while _next_ordinal_to_read < 1 {
11421                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11422                _next_ordinal_to_read += 1;
11423                next_offset += envelope_size;
11424            }
11425
11426            let next_out_of_line = decoder.next_out_of_line();
11427            let handles_before = decoder.remaining_handles();
11428            if let Some((inlined, num_bytes, num_handles)) =
11429                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11430            {
11431                let member_inline_size =
11432                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
11433                        decoder.context,
11434                    );
11435                if inlined != (member_inline_size <= 4) {
11436                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11437                }
11438                let inner_offset;
11439                let mut inner_depth = depth.clone();
11440                if inlined {
11441                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11442                    inner_offset = next_offset;
11443                } else {
11444                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11445                    inner_depth.increment()?;
11446                }
11447                let val_ref = self
11448                    .values
11449                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
11450                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11451                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11452                {
11453                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11454                }
11455                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11456                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11457                }
11458            }
11459
11460            next_offset += envelope_size;
11461
11462            // Decode the remaining unknown envelopes.
11463            while next_offset < end_offset {
11464                _next_ordinal_to_read += 1;
11465                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11466                next_offset += envelope_size;
11467            }
11468
11469            Ok(())
11470        }
11471    }
11472
11473    impl TouchDescriptor {
11474        #[inline(always)]
11475        fn max_ordinal_present(&self) -> u64 {
11476            if let Some(_) = self.feature {
11477                return 2;
11478            }
11479            if let Some(_) = self.input {
11480                return 1;
11481            }
11482            0
11483        }
11484    }
11485
11486    impl fidl::encoding::ValueTypeMarker for TouchDescriptor {
11487        type Borrowed<'a> = &'a Self;
11488        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11489            value
11490        }
11491    }
11492
11493    unsafe impl fidl::encoding::TypeMarker for TouchDescriptor {
11494        type Owned = Self;
11495
11496        #[inline(always)]
11497        fn inline_align(_context: fidl::encoding::Context) -> usize {
11498            8
11499        }
11500
11501        #[inline(always)]
11502        fn inline_size(_context: fidl::encoding::Context) -> usize {
11503            16
11504        }
11505    }
11506
11507    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDescriptor, D>
11508        for &TouchDescriptor
11509    {
11510        unsafe fn encode(
11511            self,
11512            encoder: &mut fidl::encoding::Encoder<'_, D>,
11513            offset: usize,
11514            mut depth: fidl::encoding::Depth,
11515        ) -> fidl::Result<()> {
11516            encoder.debug_check_bounds::<TouchDescriptor>(offset);
11517            // Vector header
11518            let max_ordinal: u64 = self.max_ordinal_present();
11519            encoder.write_num(max_ordinal, offset);
11520            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11521            // Calling encoder.out_of_line_offset(0) is not allowed.
11522            if max_ordinal == 0 {
11523                return Ok(());
11524            }
11525            depth.increment()?;
11526            let envelope_size = 8;
11527            let bytes_len = max_ordinal as usize * envelope_size;
11528            #[allow(unused_variables)]
11529            let offset = encoder.out_of_line_offset(bytes_len);
11530            let mut _prev_end_offset: usize = 0;
11531            if 1 > max_ordinal {
11532                return Ok(());
11533            }
11534
11535            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11536            // are envelope_size bytes.
11537            let cur_offset: usize = (1 - 1) * envelope_size;
11538
11539            // Zero reserved fields.
11540            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11541
11542            // Safety:
11543            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11544            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11545            //   envelope_size bytes, there is always sufficient room.
11546            fidl::encoding::encode_in_envelope_optional::<TouchInputDescriptor, D>(
11547                self.input
11548                    .as_ref()
11549                    .map(<TouchInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11550                encoder,
11551                offset + cur_offset,
11552                depth,
11553            )?;
11554
11555            _prev_end_offset = cur_offset + envelope_size;
11556            if 2 > max_ordinal {
11557                return Ok(());
11558            }
11559
11560            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11561            // are envelope_size bytes.
11562            let cur_offset: usize = (2 - 1) * envelope_size;
11563
11564            // Zero reserved fields.
11565            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11566
11567            // Safety:
11568            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11569            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11570            //   envelope_size bytes, there is always sufficient room.
11571            fidl::encoding::encode_in_envelope_optional::<TouchFeatureDescriptor, D>(
11572                self.feature
11573                    .as_ref()
11574                    .map(<TouchFeatureDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11575                encoder,
11576                offset + cur_offset,
11577                depth,
11578            )?;
11579
11580            _prev_end_offset = cur_offset + envelope_size;
11581
11582            Ok(())
11583        }
11584    }
11585
11586    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDescriptor {
11587        #[inline(always)]
11588        fn new_empty() -> Self {
11589            Self::default()
11590        }
11591
11592        unsafe fn decode(
11593            &mut self,
11594            decoder: &mut fidl::encoding::Decoder<'_, D>,
11595            offset: usize,
11596            mut depth: fidl::encoding::Depth,
11597        ) -> fidl::Result<()> {
11598            decoder.debug_check_bounds::<Self>(offset);
11599            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11600                None => return Err(fidl::Error::NotNullable),
11601                Some(len) => len,
11602            };
11603            // Calling decoder.out_of_line_offset(0) is not allowed.
11604            if len == 0 {
11605                return Ok(());
11606            };
11607            depth.increment()?;
11608            let envelope_size = 8;
11609            let bytes_len = len * envelope_size;
11610            let offset = decoder.out_of_line_offset(bytes_len)?;
11611            // Decode the envelope for each type.
11612            let mut _next_ordinal_to_read = 0;
11613            let mut next_offset = offset;
11614            let end_offset = offset + bytes_len;
11615            _next_ordinal_to_read += 1;
11616            if next_offset >= end_offset {
11617                return Ok(());
11618            }
11619
11620            // Decode unknown envelopes for gaps in ordinals.
11621            while _next_ordinal_to_read < 1 {
11622                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11623                _next_ordinal_to_read += 1;
11624                next_offset += envelope_size;
11625            }
11626
11627            let next_out_of_line = decoder.next_out_of_line();
11628            let handles_before = decoder.remaining_handles();
11629            if let Some((inlined, num_bytes, num_handles)) =
11630                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11631            {
11632                let member_inline_size =
11633                    <TouchInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
11634                        decoder.context,
11635                    );
11636                if inlined != (member_inline_size <= 4) {
11637                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11638                }
11639                let inner_offset;
11640                let mut inner_depth = depth.clone();
11641                if inlined {
11642                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11643                    inner_offset = next_offset;
11644                } else {
11645                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11646                    inner_depth.increment()?;
11647                }
11648                let val_ref =
11649                    self.input.get_or_insert_with(|| fidl::new_empty!(TouchInputDescriptor, D));
11650                fidl::decode!(
11651                    TouchInputDescriptor,
11652                    D,
11653                    val_ref,
11654                    decoder,
11655                    inner_offset,
11656                    inner_depth
11657                )?;
11658                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11659                {
11660                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11661                }
11662                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11663                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11664                }
11665            }
11666
11667            next_offset += envelope_size;
11668            _next_ordinal_to_read += 1;
11669            if next_offset >= end_offset {
11670                return Ok(());
11671            }
11672
11673            // Decode unknown envelopes for gaps in ordinals.
11674            while _next_ordinal_to_read < 2 {
11675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11676                _next_ordinal_to_read += 1;
11677                next_offset += envelope_size;
11678            }
11679
11680            let next_out_of_line = decoder.next_out_of_line();
11681            let handles_before = decoder.remaining_handles();
11682            if let Some((inlined, num_bytes, num_handles)) =
11683                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11684            {
11685                let member_inline_size =
11686                    <TouchFeatureDescriptor as fidl::encoding::TypeMarker>::inline_size(
11687                        decoder.context,
11688                    );
11689                if inlined != (member_inline_size <= 4) {
11690                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11691                }
11692                let inner_offset;
11693                let mut inner_depth = depth.clone();
11694                if inlined {
11695                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11696                    inner_offset = next_offset;
11697                } else {
11698                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11699                    inner_depth.increment()?;
11700                }
11701                let val_ref =
11702                    self.feature.get_or_insert_with(|| fidl::new_empty!(TouchFeatureDescriptor, D));
11703                fidl::decode!(
11704                    TouchFeatureDescriptor,
11705                    D,
11706                    val_ref,
11707                    decoder,
11708                    inner_offset,
11709                    inner_depth
11710                )?;
11711                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11712                {
11713                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11714                }
11715                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11716                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11717                }
11718            }
11719
11720            next_offset += envelope_size;
11721
11722            // Decode the remaining unknown envelopes.
11723            while next_offset < end_offset {
11724                _next_ordinal_to_read += 1;
11725                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11726                next_offset += envelope_size;
11727            }
11728
11729            Ok(())
11730        }
11731    }
11732
11733    impl TouchFeatureDescriptor {
11734        #[inline(always)]
11735        fn max_ordinal_present(&self) -> u64 {
11736            if let Some(_) = self.supports_selective_reporting {
11737                return 2;
11738            }
11739            if let Some(_) = self.supports_input_mode {
11740                return 1;
11741            }
11742            0
11743        }
11744    }
11745
11746    impl fidl::encoding::ValueTypeMarker for TouchFeatureDescriptor {
11747        type Borrowed<'a> = &'a Self;
11748        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11749            value
11750        }
11751    }
11752
11753    unsafe impl fidl::encoding::TypeMarker for TouchFeatureDescriptor {
11754        type Owned = Self;
11755
11756        #[inline(always)]
11757        fn inline_align(_context: fidl::encoding::Context) -> usize {
11758            8
11759        }
11760
11761        #[inline(always)]
11762        fn inline_size(_context: fidl::encoding::Context) -> usize {
11763            16
11764        }
11765    }
11766
11767    unsafe impl<D: fidl::encoding::ResourceDialect>
11768        fidl::encoding::Encode<TouchFeatureDescriptor, D> for &TouchFeatureDescriptor
11769    {
11770        unsafe fn encode(
11771            self,
11772            encoder: &mut fidl::encoding::Encoder<'_, D>,
11773            offset: usize,
11774            mut depth: fidl::encoding::Depth,
11775        ) -> fidl::Result<()> {
11776            encoder.debug_check_bounds::<TouchFeatureDescriptor>(offset);
11777            // Vector header
11778            let max_ordinal: u64 = self.max_ordinal_present();
11779            encoder.write_num(max_ordinal, offset);
11780            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11781            // Calling encoder.out_of_line_offset(0) is not allowed.
11782            if max_ordinal == 0 {
11783                return Ok(());
11784            }
11785            depth.increment()?;
11786            let envelope_size = 8;
11787            let bytes_len = max_ordinal as usize * envelope_size;
11788            #[allow(unused_variables)]
11789            let offset = encoder.out_of_line_offset(bytes_len);
11790            let mut _prev_end_offset: usize = 0;
11791            if 1 > max_ordinal {
11792                return Ok(());
11793            }
11794
11795            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11796            // are envelope_size bytes.
11797            let cur_offset: usize = (1 - 1) * envelope_size;
11798
11799            // Zero reserved fields.
11800            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11801
11802            // Safety:
11803            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11804            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11805            //   envelope_size bytes, there is always sufficient room.
11806            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11807                self.supports_input_mode
11808                    .as_ref()
11809                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11810                encoder,
11811                offset + cur_offset,
11812                depth,
11813            )?;
11814
11815            _prev_end_offset = cur_offset + envelope_size;
11816            if 2 > max_ordinal {
11817                return Ok(());
11818            }
11819
11820            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11821            // are envelope_size bytes.
11822            let cur_offset: usize = (2 - 1) * envelope_size;
11823
11824            // Zero reserved fields.
11825            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11826
11827            // Safety:
11828            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11829            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11830            //   envelope_size bytes, there is always sufficient room.
11831            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11832                self.supports_selective_reporting
11833                    .as_ref()
11834                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11835                encoder,
11836                offset + cur_offset,
11837                depth,
11838            )?;
11839
11840            _prev_end_offset = cur_offset + envelope_size;
11841
11842            Ok(())
11843        }
11844    }
11845
11846    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11847        for TouchFeatureDescriptor
11848    {
11849        #[inline(always)]
11850        fn new_empty() -> Self {
11851            Self::default()
11852        }
11853
11854        unsafe fn decode(
11855            &mut self,
11856            decoder: &mut fidl::encoding::Decoder<'_, D>,
11857            offset: usize,
11858            mut depth: fidl::encoding::Depth,
11859        ) -> fidl::Result<()> {
11860            decoder.debug_check_bounds::<Self>(offset);
11861            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11862                None => return Err(fidl::Error::NotNullable),
11863                Some(len) => len,
11864            };
11865            // Calling decoder.out_of_line_offset(0) is not allowed.
11866            if len == 0 {
11867                return Ok(());
11868            };
11869            depth.increment()?;
11870            let envelope_size = 8;
11871            let bytes_len = len * envelope_size;
11872            let offset = decoder.out_of_line_offset(bytes_len)?;
11873            // Decode the envelope for each type.
11874            let mut _next_ordinal_to_read = 0;
11875            let mut next_offset = offset;
11876            let end_offset = offset + bytes_len;
11877            _next_ordinal_to_read += 1;
11878            if next_offset >= end_offset {
11879                return Ok(());
11880            }
11881
11882            // Decode unknown envelopes for gaps in ordinals.
11883            while _next_ordinal_to_read < 1 {
11884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11885                _next_ordinal_to_read += 1;
11886                next_offset += envelope_size;
11887            }
11888
11889            let next_out_of_line = decoder.next_out_of_line();
11890            let handles_before = decoder.remaining_handles();
11891            if let Some((inlined, num_bytes, num_handles)) =
11892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11893            {
11894                let member_inline_size =
11895                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11896                if inlined != (member_inline_size <= 4) {
11897                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11898                }
11899                let inner_offset;
11900                let mut inner_depth = depth.clone();
11901                if inlined {
11902                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11903                    inner_offset = next_offset;
11904                } else {
11905                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11906                    inner_depth.increment()?;
11907                }
11908                let val_ref =
11909                    self.supports_input_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
11910                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11911                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11912                {
11913                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11914                }
11915                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11916                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11917                }
11918            }
11919
11920            next_offset += envelope_size;
11921            _next_ordinal_to_read += 1;
11922            if next_offset >= end_offset {
11923                return Ok(());
11924            }
11925
11926            // Decode unknown envelopes for gaps in ordinals.
11927            while _next_ordinal_to_read < 2 {
11928                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11929                _next_ordinal_to_read += 1;
11930                next_offset += envelope_size;
11931            }
11932
11933            let next_out_of_line = decoder.next_out_of_line();
11934            let handles_before = decoder.remaining_handles();
11935            if let Some((inlined, num_bytes, num_handles)) =
11936                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11937            {
11938                let member_inline_size =
11939                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11940                if inlined != (member_inline_size <= 4) {
11941                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11942                }
11943                let inner_offset;
11944                let mut inner_depth = depth.clone();
11945                if inlined {
11946                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11947                    inner_offset = next_offset;
11948                } else {
11949                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11950                    inner_depth.increment()?;
11951                }
11952                let val_ref = self
11953                    .supports_selective_reporting
11954                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
11955                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11956                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11957                {
11958                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11959                }
11960                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11961                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11962                }
11963            }
11964
11965            next_offset += envelope_size;
11966
11967            // Decode the remaining unknown envelopes.
11968            while next_offset < end_offset {
11969                _next_ordinal_to_read += 1;
11970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11971                next_offset += envelope_size;
11972            }
11973
11974            Ok(())
11975        }
11976    }
11977
11978    impl TouchFeatureReport {
11979        #[inline(always)]
11980        fn max_ordinal_present(&self) -> u64 {
11981            if let Some(_) = self.selective_reporting {
11982                return 2;
11983            }
11984            if let Some(_) = self.input_mode {
11985                return 1;
11986            }
11987            0
11988        }
11989    }
11990
11991    impl fidl::encoding::ValueTypeMarker for TouchFeatureReport {
11992        type Borrowed<'a> = &'a Self;
11993        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11994            value
11995        }
11996    }
11997
11998    unsafe impl fidl::encoding::TypeMarker for TouchFeatureReport {
11999        type Owned = Self;
12000
12001        #[inline(always)]
12002        fn inline_align(_context: fidl::encoding::Context) -> usize {
12003            8
12004        }
12005
12006        #[inline(always)]
12007        fn inline_size(_context: fidl::encoding::Context) -> usize {
12008            16
12009        }
12010    }
12011
12012    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchFeatureReport, D>
12013        for &TouchFeatureReport
12014    {
12015        unsafe fn encode(
12016            self,
12017            encoder: &mut fidl::encoding::Encoder<'_, D>,
12018            offset: usize,
12019            mut depth: fidl::encoding::Depth,
12020        ) -> fidl::Result<()> {
12021            encoder.debug_check_bounds::<TouchFeatureReport>(offset);
12022            // Vector header
12023            let max_ordinal: u64 = self.max_ordinal_present();
12024            encoder.write_num(max_ordinal, offset);
12025            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12026            // Calling encoder.out_of_line_offset(0) is not allowed.
12027            if max_ordinal == 0 {
12028                return Ok(());
12029            }
12030            depth.increment()?;
12031            let envelope_size = 8;
12032            let bytes_len = max_ordinal as usize * envelope_size;
12033            #[allow(unused_variables)]
12034            let offset = encoder.out_of_line_offset(bytes_len);
12035            let mut _prev_end_offset: usize = 0;
12036            if 1 > max_ordinal {
12037                return Ok(());
12038            }
12039
12040            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12041            // are envelope_size bytes.
12042            let cur_offset: usize = (1 - 1) * envelope_size;
12043
12044            // Zero reserved fields.
12045            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12046
12047            // Safety:
12048            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12049            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12050            //   envelope_size bytes, there is always sufficient room.
12051            fidl::encoding::encode_in_envelope_optional::<TouchConfigurationInputMode, D>(
12052                self.input_mode
12053                    .as_ref()
12054                    .map(<TouchConfigurationInputMode as fidl::encoding::ValueTypeMarker>::borrow),
12055                encoder,
12056                offset + cur_offset,
12057                depth,
12058            )?;
12059
12060            _prev_end_offset = cur_offset + envelope_size;
12061            if 2 > max_ordinal {
12062                return Ok(());
12063            }
12064
12065            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12066            // are envelope_size bytes.
12067            let cur_offset: usize = (2 - 1) * envelope_size;
12068
12069            // Zero reserved fields.
12070            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12071
12072            // Safety:
12073            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12074            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12075            //   envelope_size bytes, there is always sufficient room.
12076            fidl::encoding::encode_in_envelope_optional::<SelectiveReportingFeatureReport, D>(
12077                self.selective_reporting.as_ref().map(
12078                    <SelectiveReportingFeatureReport as fidl::encoding::ValueTypeMarker>::borrow,
12079                ),
12080                encoder,
12081                offset + cur_offset,
12082                depth,
12083            )?;
12084
12085            _prev_end_offset = cur_offset + envelope_size;
12086
12087            Ok(())
12088        }
12089    }
12090
12091    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchFeatureReport {
12092        #[inline(always)]
12093        fn new_empty() -> Self {
12094            Self::default()
12095        }
12096
12097        unsafe fn decode(
12098            &mut self,
12099            decoder: &mut fidl::encoding::Decoder<'_, D>,
12100            offset: usize,
12101            mut depth: fidl::encoding::Depth,
12102        ) -> fidl::Result<()> {
12103            decoder.debug_check_bounds::<Self>(offset);
12104            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12105                None => return Err(fidl::Error::NotNullable),
12106                Some(len) => len,
12107            };
12108            // Calling decoder.out_of_line_offset(0) is not allowed.
12109            if len == 0 {
12110                return Ok(());
12111            };
12112            depth.increment()?;
12113            let envelope_size = 8;
12114            let bytes_len = len * envelope_size;
12115            let offset = decoder.out_of_line_offset(bytes_len)?;
12116            // Decode the envelope for each type.
12117            let mut _next_ordinal_to_read = 0;
12118            let mut next_offset = offset;
12119            let end_offset = offset + bytes_len;
12120            _next_ordinal_to_read += 1;
12121            if next_offset >= end_offset {
12122                return Ok(());
12123            }
12124
12125            // Decode unknown envelopes for gaps in ordinals.
12126            while _next_ordinal_to_read < 1 {
12127                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12128                _next_ordinal_to_read += 1;
12129                next_offset += envelope_size;
12130            }
12131
12132            let next_out_of_line = decoder.next_out_of_line();
12133            let handles_before = decoder.remaining_handles();
12134            if let Some((inlined, num_bytes, num_handles)) =
12135                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12136            {
12137                let member_inline_size =
12138                    <TouchConfigurationInputMode as fidl::encoding::TypeMarker>::inline_size(
12139                        decoder.context,
12140                    );
12141                if inlined != (member_inline_size <= 4) {
12142                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12143                }
12144                let inner_offset;
12145                let mut inner_depth = depth.clone();
12146                if inlined {
12147                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12148                    inner_offset = next_offset;
12149                } else {
12150                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12151                    inner_depth.increment()?;
12152                }
12153                let val_ref = self
12154                    .input_mode
12155                    .get_or_insert_with(|| fidl::new_empty!(TouchConfigurationInputMode, D));
12156                fidl::decode!(
12157                    TouchConfigurationInputMode,
12158                    D,
12159                    val_ref,
12160                    decoder,
12161                    inner_offset,
12162                    inner_depth
12163                )?;
12164                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12165                {
12166                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12167                }
12168                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12169                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12170                }
12171            }
12172
12173            next_offset += envelope_size;
12174            _next_ordinal_to_read += 1;
12175            if next_offset >= end_offset {
12176                return Ok(());
12177            }
12178
12179            // Decode unknown envelopes for gaps in ordinals.
12180            while _next_ordinal_to_read < 2 {
12181                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12182                _next_ordinal_to_read += 1;
12183                next_offset += envelope_size;
12184            }
12185
12186            let next_out_of_line = decoder.next_out_of_line();
12187            let handles_before = decoder.remaining_handles();
12188            if let Some((inlined, num_bytes, num_handles)) =
12189                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12190            {
12191                let member_inline_size =
12192                    <SelectiveReportingFeatureReport as fidl::encoding::TypeMarker>::inline_size(
12193                        decoder.context,
12194                    );
12195                if inlined != (member_inline_size <= 4) {
12196                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12197                }
12198                let inner_offset;
12199                let mut inner_depth = depth.clone();
12200                if inlined {
12201                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12202                    inner_offset = next_offset;
12203                } else {
12204                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12205                    inner_depth.increment()?;
12206                }
12207                let val_ref = self
12208                    .selective_reporting
12209                    .get_or_insert_with(|| fidl::new_empty!(SelectiveReportingFeatureReport, D));
12210                fidl::decode!(
12211                    SelectiveReportingFeatureReport,
12212                    D,
12213                    val_ref,
12214                    decoder,
12215                    inner_offset,
12216                    inner_depth
12217                )?;
12218                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12219                {
12220                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12221                }
12222                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12223                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12224                }
12225            }
12226
12227            next_offset += envelope_size;
12228
12229            // Decode the remaining unknown envelopes.
12230            while next_offset < end_offset {
12231                _next_ordinal_to_read += 1;
12232                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12233                next_offset += envelope_size;
12234            }
12235
12236            Ok(())
12237        }
12238    }
12239
12240    impl TouchInputDescriptor {
12241        #[inline(always)]
12242        fn max_ordinal_present(&self) -> u64 {
12243            if let Some(_) = self.buttons {
12244                return 4;
12245            }
12246            if let Some(_) = self.touch_type {
12247                return 3;
12248            }
12249            if let Some(_) = self.max_contacts {
12250                return 2;
12251            }
12252            if let Some(_) = self.contacts {
12253                return 1;
12254            }
12255            0
12256        }
12257    }
12258
12259    impl fidl::encoding::ValueTypeMarker for TouchInputDescriptor {
12260        type Borrowed<'a> = &'a Self;
12261        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12262            value
12263        }
12264    }
12265
12266    unsafe impl fidl::encoding::TypeMarker for TouchInputDescriptor {
12267        type Owned = Self;
12268
12269        #[inline(always)]
12270        fn inline_align(_context: fidl::encoding::Context) -> usize {
12271            8
12272        }
12273
12274        #[inline(always)]
12275        fn inline_size(_context: fidl::encoding::Context) -> usize {
12276            16
12277        }
12278    }
12279
12280    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputDescriptor, D>
12281        for &TouchInputDescriptor
12282    {
12283        unsafe fn encode(
12284            self,
12285            encoder: &mut fidl::encoding::Encoder<'_, D>,
12286            offset: usize,
12287            mut depth: fidl::encoding::Depth,
12288        ) -> fidl::Result<()> {
12289            encoder.debug_check_bounds::<TouchInputDescriptor>(offset);
12290            // Vector header
12291            let max_ordinal: u64 = self.max_ordinal_present();
12292            encoder.write_num(max_ordinal, offset);
12293            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12294            // Calling encoder.out_of_line_offset(0) is not allowed.
12295            if max_ordinal == 0 {
12296                return Ok(());
12297            }
12298            depth.increment()?;
12299            let envelope_size = 8;
12300            let bytes_len = max_ordinal as usize * envelope_size;
12301            #[allow(unused_variables)]
12302            let offset = encoder.out_of_line_offset(bytes_len);
12303            let mut _prev_end_offset: usize = 0;
12304            if 1 > max_ordinal {
12305                return Ok(());
12306            }
12307
12308            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12309            // are envelope_size bytes.
12310            let cur_offset: usize = (1 - 1) * envelope_size;
12311
12312            // Zero reserved fields.
12313            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12314
12315            // Safety:
12316            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12317            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12318            //   envelope_size bytes, there is always sufficient room.
12319            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputDescriptor, 10>, D>(
12320            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12321            encoder, offset + cur_offset, depth
12322        )?;
12323
12324            _prev_end_offset = cur_offset + envelope_size;
12325            if 2 > max_ordinal {
12326                return Ok(());
12327            }
12328
12329            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12330            // are envelope_size bytes.
12331            let cur_offset: usize = (2 - 1) * envelope_size;
12332
12333            // Zero reserved fields.
12334            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12335
12336            // Safety:
12337            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12338            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12339            //   envelope_size bytes, there is always sufficient room.
12340            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12341                self.max_contacts.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12342                encoder,
12343                offset + cur_offset,
12344                depth,
12345            )?;
12346
12347            _prev_end_offset = cur_offset + envelope_size;
12348            if 3 > max_ordinal {
12349                return Ok(());
12350            }
12351
12352            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12353            // are envelope_size bytes.
12354            let cur_offset: usize = (3 - 1) * envelope_size;
12355
12356            // Zero reserved fields.
12357            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12358
12359            // Safety:
12360            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12361            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12362            //   envelope_size bytes, there is always sufficient room.
12363            fidl::encoding::encode_in_envelope_optional::<TouchType, D>(
12364                self.touch_type
12365                    .as_ref()
12366                    .map(<TouchType as fidl::encoding::ValueTypeMarker>::borrow),
12367                encoder,
12368                offset + cur_offset,
12369                depth,
12370            )?;
12371
12372            _prev_end_offset = cur_offset + envelope_size;
12373            if 4 > max_ordinal {
12374                return Ok(());
12375            }
12376
12377            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12378            // are envelope_size bytes.
12379            let cur_offset: usize = (4 - 1) * envelope_size;
12380
12381            // Zero reserved fields.
12382            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12383
12384            // Safety:
12385            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12386            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12387            //   envelope_size bytes, there is always sufficient room.
12388            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TouchButton, 10>, D>(
12389            self.buttons.as_ref().map(<fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12390            encoder, offset + cur_offset, depth
12391        )?;
12392
12393            _prev_end_offset = cur_offset + envelope_size;
12394
12395            Ok(())
12396        }
12397    }
12398
12399    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputDescriptor {
12400        #[inline(always)]
12401        fn new_empty() -> Self {
12402            Self::default()
12403        }
12404
12405        unsafe fn decode(
12406            &mut self,
12407            decoder: &mut fidl::encoding::Decoder<'_, D>,
12408            offset: usize,
12409            mut depth: fidl::encoding::Depth,
12410        ) -> fidl::Result<()> {
12411            decoder.debug_check_bounds::<Self>(offset);
12412            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12413                None => return Err(fidl::Error::NotNullable),
12414                Some(len) => len,
12415            };
12416            // Calling decoder.out_of_line_offset(0) is not allowed.
12417            if len == 0 {
12418                return Ok(());
12419            };
12420            depth.increment()?;
12421            let envelope_size = 8;
12422            let bytes_len = len * envelope_size;
12423            let offset = decoder.out_of_line_offset(bytes_len)?;
12424            // Decode the envelope for each type.
12425            let mut _next_ordinal_to_read = 0;
12426            let mut next_offset = offset;
12427            let end_offset = offset + bytes_len;
12428            _next_ordinal_to_read += 1;
12429            if next_offset >= end_offset {
12430                return Ok(());
12431            }
12432
12433            // Decode unknown envelopes for gaps in ordinals.
12434            while _next_ordinal_to_read < 1 {
12435                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12436                _next_ordinal_to_read += 1;
12437                next_offset += envelope_size;
12438            }
12439
12440            let next_out_of_line = decoder.next_out_of_line();
12441            let handles_before = decoder.remaining_handles();
12442            if let Some((inlined, num_bytes, num_handles)) =
12443                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12444            {
12445                let member_inline_size = <fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12446                if inlined != (member_inline_size <= 4) {
12447                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12448                }
12449                let inner_offset;
12450                let mut inner_depth = depth.clone();
12451                if inlined {
12452                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12453                    inner_offset = next_offset;
12454                } else {
12455                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12456                    inner_depth.increment()?;
12457                }
12458                let val_ref = self.contacts.get_or_insert_with(
12459                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D),
12460                );
12461                fidl::decode!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12462                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12463                {
12464                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12465                }
12466                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12467                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12468                }
12469            }
12470
12471            next_offset += envelope_size;
12472            _next_ordinal_to_read += 1;
12473            if next_offset >= end_offset {
12474                return Ok(());
12475            }
12476
12477            // Decode unknown envelopes for gaps in ordinals.
12478            while _next_ordinal_to_read < 2 {
12479                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12480                _next_ordinal_to_read += 1;
12481                next_offset += envelope_size;
12482            }
12483
12484            let next_out_of_line = decoder.next_out_of_line();
12485            let handles_before = decoder.remaining_handles();
12486            if let Some((inlined, num_bytes, num_handles)) =
12487                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12488            {
12489                let member_inline_size =
12490                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12491                if inlined != (member_inline_size <= 4) {
12492                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12493                }
12494                let inner_offset;
12495                let mut inner_depth = depth.clone();
12496                if inlined {
12497                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12498                    inner_offset = next_offset;
12499                } else {
12500                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12501                    inner_depth.increment()?;
12502                }
12503                let val_ref = self.max_contacts.get_or_insert_with(|| fidl::new_empty!(u32, D));
12504                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12505                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12506                {
12507                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12508                }
12509                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12510                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12511                }
12512            }
12513
12514            next_offset += envelope_size;
12515            _next_ordinal_to_read += 1;
12516            if next_offset >= end_offset {
12517                return Ok(());
12518            }
12519
12520            // Decode unknown envelopes for gaps in ordinals.
12521            while _next_ordinal_to_read < 3 {
12522                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12523                _next_ordinal_to_read += 1;
12524                next_offset += envelope_size;
12525            }
12526
12527            let next_out_of_line = decoder.next_out_of_line();
12528            let handles_before = decoder.remaining_handles();
12529            if let Some((inlined, num_bytes, num_handles)) =
12530                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12531            {
12532                let member_inline_size =
12533                    <TouchType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12534                if inlined != (member_inline_size <= 4) {
12535                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12536                }
12537                let inner_offset;
12538                let mut inner_depth = depth.clone();
12539                if inlined {
12540                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12541                    inner_offset = next_offset;
12542                } else {
12543                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12544                    inner_depth.increment()?;
12545                }
12546                let val_ref = self.touch_type.get_or_insert_with(|| fidl::new_empty!(TouchType, D));
12547                fidl::decode!(TouchType, D, val_ref, decoder, inner_offset, inner_depth)?;
12548                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12549                {
12550                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12551                }
12552                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12553                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12554                }
12555            }
12556
12557            next_offset += envelope_size;
12558            _next_ordinal_to_read += 1;
12559            if next_offset >= end_offset {
12560                return Ok(());
12561            }
12562
12563            // Decode unknown envelopes for gaps in ordinals.
12564            while _next_ordinal_to_read < 4 {
12565                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12566                _next_ordinal_to_read += 1;
12567                next_offset += envelope_size;
12568            }
12569
12570            let next_out_of_line = decoder.next_out_of_line();
12571            let handles_before = decoder.remaining_handles();
12572            if let Some((inlined, num_bytes, num_handles)) =
12573                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12574            {
12575                let member_inline_size = <fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12576                if inlined != (member_inline_size <= 4) {
12577                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12578                }
12579                let inner_offset;
12580                let mut inner_depth = depth.clone();
12581                if inlined {
12582                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12583                    inner_offset = next_offset;
12584                } else {
12585                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12586                    inner_depth.increment()?;
12587                }
12588                let val_ref = self.buttons.get_or_insert_with(
12589                    || fidl::new_empty!(fidl::encoding::Vector<TouchButton, 10>, D),
12590                );
12591                fidl::decode!(fidl::encoding::Vector<TouchButton, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12592                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12593                {
12594                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12595                }
12596                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12597                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12598                }
12599            }
12600
12601            next_offset += envelope_size;
12602
12603            // Decode the remaining unknown envelopes.
12604            while next_offset < end_offset {
12605                _next_ordinal_to_read += 1;
12606                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12607                next_offset += envelope_size;
12608            }
12609
12610            Ok(())
12611        }
12612    }
12613
12614    impl TouchInputReport {
12615        #[inline(always)]
12616        fn max_ordinal_present(&self) -> u64 {
12617            if let Some(_) = self.pressed_buttons {
12618                return 2;
12619            }
12620            if let Some(_) = self.contacts {
12621                return 1;
12622            }
12623            0
12624        }
12625    }
12626
12627    impl fidl::encoding::ValueTypeMarker for TouchInputReport {
12628        type Borrowed<'a> = &'a Self;
12629        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12630            value
12631        }
12632    }
12633
12634    unsafe impl fidl::encoding::TypeMarker for TouchInputReport {
12635        type Owned = Self;
12636
12637        #[inline(always)]
12638        fn inline_align(_context: fidl::encoding::Context) -> usize {
12639            8
12640        }
12641
12642        #[inline(always)]
12643        fn inline_size(_context: fidl::encoding::Context) -> usize {
12644            16
12645        }
12646    }
12647
12648    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputReport, D>
12649        for &TouchInputReport
12650    {
12651        unsafe fn encode(
12652            self,
12653            encoder: &mut fidl::encoding::Encoder<'_, D>,
12654            offset: usize,
12655            mut depth: fidl::encoding::Depth,
12656        ) -> fidl::Result<()> {
12657            encoder.debug_check_bounds::<TouchInputReport>(offset);
12658            // Vector header
12659            let max_ordinal: u64 = self.max_ordinal_present();
12660            encoder.write_num(max_ordinal, offset);
12661            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12662            // Calling encoder.out_of_line_offset(0) is not allowed.
12663            if max_ordinal == 0 {
12664                return Ok(());
12665            }
12666            depth.increment()?;
12667            let envelope_size = 8;
12668            let bytes_len = max_ordinal as usize * envelope_size;
12669            #[allow(unused_variables)]
12670            let offset = encoder.out_of_line_offset(bytes_len);
12671            let mut _prev_end_offset: usize = 0;
12672            if 1 > max_ordinal {
12673                return Ok(());
12674            }
12675
12676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12677            // are envelope_size bytes.
12678            let cur_offset: usize = (1 - 1) * envelope_size;
12679
12680            // Zero reserved fields.
12681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12682
12683            // Safety:
12684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12686            //   envelope_size bytes, there is always sufficient room.
12687            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputReport, 10>, D>(
12688            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12689            encoder, offset + cur_offset, depth
12690        )?;
12691
12692            _prev_end_offset = cur_offset + envelope_size;
12693            if 2 > max_ordinal {
12694                return Ok(());
12695            }
12696
12697            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12698            // are envelope_size bytes.
12699            let cur_offset: usize = (2 - 1) * envelope_size;
12700
12701            // Zero reserved fields.
12702            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12703
12704            // Safety:
12705            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12706            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12707            //   envelope_size bytes, there is always sufficient room.
12708            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<TouchButton, 10>, D>(
12709            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12710            encoder, offset + cur_offset, depth
12711        )?;
12712
12713            _prev_end_offset = cur_offset + envelope_size;
12714
12715            Ok(())
12716        }
12717    }
12718
12719    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputReport {
12720        #[inline(always)]
12721        fn new_empty() -> Self {
12722            Self::default()
12723        }
12724
12725        unsafe fn decode(
12726            &mut self,
12727            decoder: &mut fidl::encoding::Decoder<'_, D>,
12728            offset: usize,
12729            mut depth: fidl::encoding::Depth,
12730        ) -> fidl::Result<()> {
12731            decoder.debug_check_bounds::<Self>(offset);
12732            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12733                None => return Err(fidl::Error::NotNullable),
12734                Some(len) => len,
12735            };
12736            // Calling decoder.out_of_line_offset(0) is not allowed.
12737            if len == 0 {
12738                return Ok(());
12739            };
12740            depth.increment()?;
12741            let envelope_size = 8;
12742            let bytes_len = len * envelope_size;
12743            let offset = decoder.out_of_line_offset(bytes_len)?;
12744            // Decode the envelope for each type.
12745            let mut _next_ordinal_to_read = 0;
12746            let mut next_offset = offset;
12747            let end_offset = offset + bytes_len;
12748            _next_ordinal_to_read += 1;
12749            if next_offset >= end_offset {
12750                return Ok(());
12751            }
12752
12753            // Decode unknown envelopes for gaps in ordinals.
12754            while _next_ordinal_to_read < 1 {
12755                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12756                _next_ordinal_to_read += 1;
12757                next_offset += envelope_size;
12758            }
12759
12760            let next_out_of_line = decoder.next_out_of_line();
12761            let handles_before = decoder.remaining_handles();
12762            if let Some((inlined, num_bytes, num_handles)) =
12763                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12764            {
12765                let member_inline_size = <fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12766                if inlined != (member_inline_size <= 4) {
12767                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12768                }
12769                let inner_offset;
12770                let mut inner_depth = depth.clone();
12771                if inlined {
12772                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12773                    inner_offset = next_offset;
12774                } else {
12775                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12776                    inner_depth.increment()?;
12777                }
12778                let val_ref = self.contacts.get_or_insert_with(
12779                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputReport, 10>, D),
12780                );
12781                fidl::decode!(fidl::encoding::Vector<ContactInputReport, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12782                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12783                {
12784                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12785                }
12786                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12787                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12788                }
12789            }
12790
12791            next_offset += envelope_size;
12792            _next_ordinal_to_read += 1;
12793            if next_offset >= end_offset {
12794                return Ok(());
12795            }
12796
12797            // Decode unknown envelopes for gaps in ordinals.
12798            while _next_ordinal_to_read < 2 {
12799                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12800                _next_ordinal_to_read += 1;
12801                next_offset += envelope_size;
12802            }
12803
12804            let next_out_of_line = decoder.next_out_of_line();
12805            let handles_before = decoder.remaining_handles();
12806            if let Some((inlined, num_bytes, num_handles)) =
12807                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12808            {
12809                let member_inline_size = <fidl::encoding::Vector<TouchButton, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12810                if inlined != (member_inline_size <= 4) {
12811                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12812                }
12813                let inner_offset;
12814                let mut inner_depth = depth.clone();
12815                if inlined {
12816                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12817                    inner_offset = next_offset;
12818                } else {
12819                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12820                    inner_depth.increment()?;
12821                }
12822                let val_ref = self.pressed_buttons.get_or_insert_with(
12823                    || fidl::new_empty!(fidl::encoding::Vector<TouchButton, 10>, D),
12824                );
12825                fidl::decode!(fidl::encoding::Vector<TouchButton, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12826                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12827                {
12828                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12829                }
12830                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12831                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12832                }
12833            }
12834
12835            next_offset += envelope_size;
12836
12837            // Decode the remaining unknown envelopes.
12838            while next_offset < end_offset {
12839                _next_ordinal_to_read += 1;
12840                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12841                next_offset += envelope_size;
12842            }
12843
12844            Ok(())
12845        }
12846    }
12847}