fidl_fuchsia_input_report__common/
fidl_fuchsia_input_report__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Hardcoded max sizes for ConsumerControl vectors. These sizes should be increased
12/// if we ever see a device with more objects than can be represented.
13pub const CONSUMER_CONTROL_MAX_NUM_BUTTONS: u32 = 255;
14
15/// Hardcoded max sizes for keyboard vectors. These sizes should be increased
16/// if we ever see keyboards with more objects than can be represented.
17pub const KEYBOARD_MAX_NUM_KEYS: u32 = 256;
18
19pub const KEYBOARD_MAX_NUM_LEDS: u32 = 256;
20
21pub const KEYBOARD_MAX_PRESSED_KEYS: u32 = 256;
22
23pub const MAX_DEVICE_REPORT_COUNT: u32 = 50;
24
25/// A hardcoded number of max reports. Because report ID is only 8 bits, only 255
26/// different reports are allowed at a time.
27pub const MAX_REPORT_COUNT: u32 = 255;
28
29/// A hardcoded number of max mouse buttons. This should be increased in the future
30/// if we ever see mice with more buttons.
31pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
32
33/// A hardcoded number of max sensor values. This should be increased in the future
34/// if we ever see a sensor with more values.
35pub const SENSOR_MAX_VALUES: u32 = 100;
36
37/// A hardcoded number of max contacts per report. This should be increased in the future if
38/// we see devices with more than the max amount.
39pub const TOUCH_MAX_CONTACTS: u32 = 10;
40
41pub const TOUCH_MAX_NUM_BUTTONS: u32 = 10;
42
43/// These ControlButtons represent on/off buttons whose purpose is to change
44/// the host's configuration.
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub enum ConsumerControlButton {
47    /// This button represents increasing volume.
48    VolumeUp,
49    /// This button represents decreasing volume.
50    VolumeDown,
51    /// This button represents pausing.
52    Pause,
53    /// This button represents factory resetting the host.
54    FactoryReset,
55    /// This button represents muting the microphone on the host.
56    MicMute,
57    /// This button represents rebooting the host.
58    Reboot,
59    /// This button represents disabling the camera on the host.
60    CameraDisable,
61    /// This button represents a function.
62    Function,
63    /// This button represents a power button.
64    Power,
65    #[doc(hidden)]
66    __SourceBreaking { unknown_ordinal: u32 },
67}
68
69/// Pattern that matches an unknown `ConsumerControlButton` member.
70#[macro_export]
71macro_rules! ConsumerControlButtonUnknown {
72    () => {
73        _
74    };
75}
76
77impl ConsumerControlButton {
78    #[inline]
79    pub fn from_primitive(prim: u32) -> Option<Self> {
80        match prim {
81            1 => Some(Self::VolumeUp),
82            2 => Some(Self::VolumeDown),
83            3 => Some(Self::Pause),
84            4 => Some(Self::FactoryReset),
85            5 => Some(Self::MicMute),
86            6 => Some(Self::Reboot),
87            7 => Some(Self::CameraDisable),
88            8 => Some(Self::Function),
89            9 => Some(Self::Power),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96        match prim {
97            1 => Self::VolumeUp,
98            2 => Self::VolumeDown,
99            3 => Self::Pause,
100            4 => Self::FactoryReset,
101            5 => Self::MicMute,
102            6 => Self::Reboot,
103            7 => Self::CameraDisable,
104            8 => Self::Function,
105            9 => Self::Power,
106            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107        }
108    }
109
110    #[inline]
111    pub fn unknown() -> Self {
112        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        match self {
118            Self::VolumeUp => 1,
119            Self::VolumeDown => 2,
120            Self::Pause => 3,
121            Self::FactoryReset => 4,
122            Self::MicMute => 5,
123            Self::Reboot => 6,
124            Self::CameraDisable => 7,
125            Self::Function => 8,
126            Self::Power => 9,
127            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128        }
129    }
130
131    #[inline]
132    pub fn is_unknown(&self) -> bool {
133        match self {
134            Self::__SourceBreaking { unknown_ordinal: _ } => true,
135            _ => false,
136        }
137    }
138}
139
140/// The InputReport field to be populated by InputDevice.GetInputReport.
141#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
142pub enum DeviceType {
143    Mouse,
144    Sensor,
145    Touch,
146    Keyboard,
147    ConsumerControl,
148    #[doc(hidden)]
149    __SourceBreaking {
150        unknown_ordinal: u32,
151    },
152}
153
154/// Pattern that matches an unknown `DeviceType` member.
155#[macro_export]
156macro_rules! DeviceTypeUnknown {
157    () => {
158        _
159    };
160}
161
162impl DeviceType {
163    #[inline]
164    pub fn from_primitive(prim: u32) -> Option<Self> {
165        match prim {
166            0 => Some(Self::Mouse),
167            1 => Some(Self::Sensor),
168            2 => Some(Self::Touch),
169            3 => Some(Self::Keyboard),
170            4 => Some(Self::ConsumerControl),
171            _ => None,
172        }
173    }
174
175    #[inline]
176    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
177        match prim {
178            0 => Self::Mouse,
179            1 => Self::Sensor,
180            2 => Self::Touch,
181            3 => Self::Keyboard,
182            4 => Self::ConsumerControl,
183            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
184        }
185    }
186
187    #[inline]
188    pub fn unknown() -> Self {
189        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
190    }
191
192    #[inline]
193    pub const fn into_primitive(self) -> u32 {
194        match self {
195            Self::Mouse => 0,
196            Self::Sensor => 1,
197            Self::Touch => 2,
198            Self::Keyboard => 3,
199            Self::ConsumerControl => 4,
200            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
201        }
202    }
203
204    #[inline]
205    pub fn is_unknown(&self) -> bool {
206        match self {
207            Self::__SourceBreaking { unknown_ordinal: _ } => true,
208            _ => false,
209        }
210    }
211}
212
213/// An LedType represents an LED on a device that can be turned on or off.
214/// When applicable, the definition of each LED is derived from one of the
215/// following sources albeit with a Fuchsia-specific numeric value:
216/// - USB HID usage codes for usage page 0x0008 (LED)
217#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
218pub enum LedType {
219    /// LED to indicate a Keyboard's number lock is enabled.
220    /// Corresponds to USB HID page 0x0008 usage 0x0001
221    NumLock,
222    /// LED to indicate a Keyboard's capital lock is enabled.
223    /// Corresponds to USB HID page 0x0008 usage 0x0002
224    CapsLock,
225    /// LED to indicate a Keyboard's scroll lock is enabled.
226    /// Corresponds to USB HID page 0x0008 usage 0x0003
227    ScrollLock,
228    /// LED to indicate a Keyboard's composition mode is enabled.
229    /// Corresponds to USB HID page 0x0008 usage 0x0004
230    Compose,
231    /// LED to indicate a Keyboard's Kana mode is enabled.
232    /// Corresponds to USB HID page 0x0008 usage 0x0005
233    Kana,
234    #[doc(hidden)]
235    __SourceBreaking { unknown_ordinal: u32 },
236}
237
238/// Pattern that matches an unknown `LedType` member.
239#[macro_export]
240macro_rules! LedTypeUnknown {
241    () => {
242        _
243    };
244}
245
246impl LedType {
247    #[inline]
248    pub fn from_primitive(prim: u32) -> Option<Self> {
249        match prim {
250            1 => Some(Self::NumLock),
251            2 => Some(Self::CapsLock),
252            3 => Some(Self::ScrollLock),
253            4 => Some(Self::Compose),
254            5 => Some(Self::Kana),
255            _ => None,
256        }
257    }
258
259    #[inline]
260    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
261        match prim {
262            1 => Self::NumLock,
263            2 => Self::CapsLock,
264            3 => Self::ScrollLock,
265            4 => Self::Compose,
266            5 => Self::Kana,
267            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
268        }
269    }
270
271    #[inline]
272    pub fn unknown() -> Self {
273        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
274    }
275
276    #[inline]
277    pub const fn into_primitive(self) -> u32 {
278        match self {
279            Self::NumLock => 1,
280            Self::CapsLock => 2,
281            Self::ScrollLock => 3,
282            Self::Compose => 4,
283            Self::Kana => 5,
284            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
285        }
286    }
287
288    #[inline]
289    pub fn is_unknown(&self) -> bool {
290        match self {
291            Self::__SourceBreaking { unknown_ordinal: _ } => true,
292            _ => false,
293        }
294    }
295}
296
297/// `SensorReportingState` determines when a sensor will send reports.
298#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
299pub enum SensorReportingState {
300    /// No events will be sent from the sensor.
301    ReportNoEvents,
302    /// All events will be sent from the sensor. For most sensors, this
303    /// frequency can be set by `report_interval`.
304    ReportAllEvents,
305    /// Only events that cross a threshold will be reported.
306    ReportThresholdEvents,
307    #[doc(hidden)]
308    __SourceBreaking { unknown_ordinal: u32 },
309}
310
311/// Pattern that matches an unknown `SensorReportingState` member.
312#[macro_export]
313macro_rules! SensorReportingStateUnknown {
314    () => {
315        _
316    };
317}
318
319impl SensorReportingState {
320    #[inline]
321    pub fn from_primitive(prim: u32) -> Option<Self> {
322        match prim {
323            1 => Some(Self::ReportNoEvents),
324            2 => Some(Self::ReportAllEvents),
325            3 => Some(Self::ReportThresholdEvents),
326            _ => None,
327        }
328    }
329
330    #[inline]
331    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
332        match prim {
333            1 => Self::ReportNoEvents,
334            2 => Self::ReportAllEvents,
335            3 => Self::ReportThresholdEvents,
336            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337        }
338    }
339
340    #[inline]
341    pub fn unknown() -> Self {
342        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
343    }
344
345    #[inline]
346    pub const fn into_primitive(self) -> u32 {
347        match self {
348            Self::ReportNoEvents => 1,
349            Self::ReportAllEvents => 2,
350            Self::ReportThresholdEvents => 3,
351            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
352        }
353    }
354
355    #[inline]
356    pub fn is_unknown(&self) -> bool {
357        match self {
358            Self::__SourceBreaking { unknown_ordinal: _ } => true,
359            _ => false,
360        }
361    }
362}
363
364/// Each sensor value has a corresponding SensorType, which explains what the
365/// value is measuring in the world.
366#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
367pub enum SensorType {
368    /// Acceleration on the X axis.
369    AccelerometerX,
370    /// Acceleration on the Y axis.
371    AccelerometerY,
372    /// Acceleration on the Z axis.
373    AccelerometerZ,
374    /// Strength of the Magnetic Field in the X axis.
375    MagnetometerX,
376    /// Strength of the Magnetic Field in the Y axis.
377    MagnetometerY,
378    /// Strength of the Magnetic Field in the Z axis.
379    MagnetometerZ,
380    /// Angular Velocity in the X direction moving counter-clockwise.
381    GyroscopeX,
382    /// Angular Velocity in the Y direction moving counter-clockwise.
383    GyroscopeY,
384    /// Angular Velocity in the Z direction moving counter-clockwise.
385    GyroscopeZ,
386    /// Ambient level of Light.
387    LightIlluminance,
388    /// Ambient level of Red Light.
389    LightRed,
390    /// Ambient level of Green Light.
391    LightGreen,
392    /// Ambient level of Blue Light.
393    LightBlue,
394    #[doc(hidden)]
395    __SourceBreaking { unknown_ordinal: u32 },
396}
397
398/// Pattern that matches an unknown `SensorType` member.
399#[macro_export]
400macro_rules! SensorTypeUnknown {
401    () => {
402        _
403    };
404}
405
406impl SensorType {
407    #[inline]
408    pub fn from_primitive(prim: u32) -> Option<Self> {
409        match prim {
410            1 => Some(Self::AccelerometerX),
411            2 => Some(Self::AccelerometerY),
412            3 => Some(Self::AccelerometerZ),
413            4 => Some(Self::MagnetometerX),
414            5 => Some(Self::MagnetometerY),
415            6 => Some(Self::MagnetometerZ),
416            7 => Some(Self::GyroscopeX),
417            8 => Some(Self::GyroscopeY),
418            9 => Some(Self::GyroscopeZ),
419            10 => Some(Self::LightIlluminance),
420            11 => Some(Self::LightRed),
421            12 => Some(Self::LightGreen),
422            13 => Some(Self::LightBlue),
423            _ => None,
424        }
425    }
426
427    #[inline]
428    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
429        match prim {
430            1 => Self::AccelerometerX,
431            2 => Self::AccelerometerY,
432            3 => Self::AccelerometerZ,
433            4 => Self::MagnetometerX,
434            5 => Self::MagnetometerY,
435            6 => Self::MagnetometerZ,
436            7 => Self::GyroscopeX,
437            8 => Self::GyroscopeY,
438            9 => Self::GyroscopeZ,
439            10 => Self::LightIlluminance,
440            11 => Self::LightRed,
441            12 => Self::LightGreen,
442            13 => Self::LightBlue,
443            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
444        }
445    }
446
447    #[inline]
448    pub fn unknown() -> Self {
449        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
450    }
451
452    #[inline]
453    pub const fn into_primitive(self) -> u32 {
454        match self {
455            Self::AccelerometerX => 1,
456            Self::AccelerometerY => 2,
457            Self::AccelerometerZ => 3,
458            Self::MagnetometerX => 4,
459            Self::MagnetometerY => 5,
460            Self::MagnetometerZ => 6,
461            Self::GyroscopeX => 7,
462            Self::GyroscopeY => 8,
463            Self::GyroscopeZ => 9,
464            Self::LightIlluminance => 10,
465            Self::LightRed => 11,
466            Self::LightGreen => 12,
467            Self::LightBlue => 13,
468            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
469        }
470    }
471
472    #[inline]
473    pub fn is_unknown(&self) -> bool {
474        match self {
475            Self::__SourceBreaking { unknown_ordinal: _ } => true,
476            _ => false,
477        }
478    }
479}
480
481/// Input mode indicating which top-level collection should be used for input reporting.
482/// These values must correspond to the input modes defined in 16.7 of the HID Usage Tables
483/// for Universal Serial Bus (USB) Spec (https://usb.org/sites/default/files/hut1_22.pdf).
484#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
485pub enum TouchConfigurationInputMode {
486    /// Use the Mouse Collection for reporting data.
487    MouseCollection,
488    /// Use the Windows Precision Touchpad Collection for reporting data. Defined by Windows
489    /// Precision Touchpad Required HID Top-Level Collections: https://docs.microsoft.com/
490    /// en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required
491    /// -hid-top-level-collections).
492    WindowsPrecisionTouchpadCollection,
493    #[doc(hidden)]
494    __SourceBreaking { unknown_ordinal: u32 },
495}
496
497/// Pattern that matches an unknown `TouchConfigurationInputMode` member.
498#[macro_export]
499macro_rules! TouchConfigurationInputModeUnknown {
500    () => {
501        _
502    };
503}
504
505impl TouchConfigurationInputMode {
506    #[inline]
507    pub fn from_primitive(prim: u32) -> Option<Self> {
508        match prim {
509            0 => Some(Self::MouseCollection),
510            3 => Some(Self::WindowsPrecisionTouchpadCollection),
511            _ => None,
512        }
513    }
514
515    #[inline]
516    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
517        match prim {
518            0 => Self::MouseCollection,
519            3 => Self::WindowsPrecisionTouchpadCollection,
520            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
521        }
522    }
523
524    #[inline]
525    pub fn unknown() -> Self {
526        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
527    }
528
529    #[inline]
530    pub const fn into_primitive(self) -> u32 {
531        match self {
532            Self::MouseCollection => 0,
533            Self::WindowsPrecisionTouchpadCollection => 3,
534            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
535        }
536    }
537
538    #[inline]
539    pub fn is_unknown(&self) -> bool {
540        match self {
541            Self::__SourceBreaking { unknown_ordinal: _ } => true,
542            _ => false,
543        }
544    }
545}
546
547/// The device type from which the touch originated.
548#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
549pub enum TouchType {
550    /// A touch screen has direct finger input associated with a display.
551    Touchscreen,
552    /// A touch pad is a pointer device that tracks finger positions.
553    Touchpad,
554    #[doc(hidden)]
555    __SourceBreaking { unknown_ordinal: u32 },
556}
557
558/// Pattern that matches an unknown `TouchType` member.
559#[macro_export]
560macro_rules! TouchTypeUnknown {
561    () => {
562        _
563    };
564}
565
566impl TouchType {
567    #[inline]
568    pub fn from_primitive(prim: u32) -> Option<Self> {
569        match prim {
570            1 => Some(Self::Touchscreen),
571            2 => Some(Self::Touchpad),
572            _ => None,
573        }
574    }
575
576    #[inline]
577    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
578        match prim {
579            1 => Self::Touchscreen,
580            2 => Self::Touchpad,
581            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
582        }
583    }
584
585    #[inline]
586    pub fn unknown() -> Self {
587        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
588    }
589
590    #[inline]
591    pub const fn into_primitive(self) -> u32 {
592        match self {
593            Self::Touchscreen => 1,
594            Self::Touchpad => 2,
595            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
596        }
597    }
598
599    #[inline]
600    pub fn is_unknown(&self) -> bool {
601        match self {
602            Self::__SourceBreaking { unknown_ordinal: _ } => true,
603            _ => false,
604        }
605    }
606}
607
608/// This provides an easy, standardized way to specify units. New units can
609/// be added as needed. Each UnitType should be named after a specific unit that
610/// should be fully distinguished by the name (E.g: Use METERS instead of
611/// DISTANCE). More complicated units that need to be differentiated should
612/// begin with SI_ (for Internation System of Units) or ENGLISH_ (for English
613/// System of Units).
614#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
615pub enum UnitType {
616    /// The device did not specify units.
617    None,
618    /// The device specified units that are not convertible to any of the other units.
619    Other,
620    /// A measurement of distance in meters.
621    Meters,
622    /// A measurement of mass in grams.
623    Grams,
624    /// A measurement of rotation in degrees.
625    Degrees,
626    /// A measurement of angular velocity in degrees per second.
627    EnglishAngularVelocity,
628    /// A measurement of linear velocity in meters per second.
629    SiLinearVelocity,
630    /// A measurement of acceleration in meters per second squared.
631    SiLinearAcceleration,
632    /// A measure of magnetic flux in webers.
633    Webers,
634    /// A measurement of luminous intensity in candelas.
635    Candelas,
636    /// A measurement of pressure in pascals.
637    Pascals,
638    Lux,
639    Seconds,
640    #[doc(hidden)]
641    __SourceBreaking {
642        unknown_ordinal: u32,
643    },
644}
645
646/// Pattern that matches an unknown `UnitType` member.
647#[macro_export]
648macro_rules! UnitTypeUnknown {
649    () => {
650        _
651    };
652}
653
654impl UnitType {
655    #[inline]
656    pub fn from_primitive(prim: u32) -> Option<Self> {
657        match prim {
658            0 => Some(Self::None),
659            1 => Some(Self::Other),
660            2 => Some(Self::Meters),
661            3 => Some(Self::Grams),
662            4 => Some(Self::Degrees),
663            5 => Some(Self::EnglishAngularVelocity),
664            6 => Some(Self::SiLinearVelocity),
665            7 => Some(Self::SiLinearAcceleration),
666            8 => Some(Self::Webers),
667            9 => Some(Self::Candelas),
668            10 => Some(Self::Pascals),
669            11 => Some(Self::Lux),
670            12 => Some(Self::Seconds),
671            _ => None,
672        }
673    }
674
675    #[inline]
676    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
677        match prim {
678            0 => Self::None,
679            1 => Self::Other,
680            2 => Self::Meters,
681            3 => Self::Grams,
682            4 => Self::Degrees,
683            5 => Self::EnglishAngularVelocity,
684            6 => Self::SiLinearVelocity,
685            7 => Self::SiLinearAcceleration,
686            8 => Self::Webers,
687            9 => Self::Candelas,
688            10 => Self::Pascals,
689            11 => Self::Lux,
690            12 => Self::Seconds,
691            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
692        }
693    }
694
695    #[inline]
696    pub fn unknown() -> Self {
697        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
698    }
699
700    #[inline]
701    pub const fn into_primitive(self) -> u32 {
702        match self {
703            Self::None => 0,
704            Self::Other => 1,
705            Self::Meters => 2,
706            Self::Grams => 3,
707            Self::Degrees => 4,
708            Self::EnglishAngularVelocity => 5,
709            Self::SiLinearVelocity => 6,
710            Self::SiLinearAcceleration => 7,
711            Self::Webers => 8,
712            Self::Candelas => 9,
713            Self::Pascals => 10,
714            Self::Lux => 11,
715            Self::Seconds => 12,
716            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
717        }
718    }
719
720    #[inline]
721    pub fn is_unknown(&self) -> bool {
722        match self {
723            Self::__SourceBreaking { unknown_ordinal: _ } => true,
724            _ => false,
725        }
726    }
727}
728
729/// Below are ProductIds which represents which product this Input device represents. If the
730/// Input device is a HID device, the ProductId maps directly to the HID
731/// ProductId. If the Input device is not a HID device, then the ProductId
732/// will be greater than 0xFFFF, which is the max HID ProductId.
733#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
734pub enum VendorGoogleProductId {
735    /// Below are the non-HID VendorIds
736    FocaltechTouchscreen,
737    AmsLightSensor,
738    PcPs2Keyboard,
739    PcPs2Mouse,
740    AdcButtons,
741    GoodixTouchscreen,
742    HidButtons,
743    VirtioMouse,
744    VirtioKeyboard,
745    VirtioTouchscreen,
746    GoldfishAccelerationSensor,
747    GoldfishGyroscopeSensor,
748    GoldfishRgbcLightSensor,
749    #[doc(hidden)]
750    __SourceBreaking {
751        unknown_ordinal: u32,
752    },
753}
754
755/// Pattern that matches an unknown `VendorGoogleProductId` member.
756#[macro_export]
757macro_rules! VendorGoogleProductIdUnknown {
758    () => {
759        _
760    };
761}
762
763impl VendorGoogleProductId {
764    #[inline]
765    pub fn from_primitive(prim: u32) -> Option<Self> {
766        match prim {
767            65537 => Some(Self::FocaltechTouchscreen),
768            65538 => Some(Self::AmsLightSensor),
769            65539 => Some(Self::PcPs2Keyboard),
770            65540 => Some(Self::PcPs2Mouse),
771            65541 => Some(Self::AdcButtons),
772            65542 => Some(Self::GoodixTouchscreen),
773            65543 => Some(Self::HidButtons),
774            65544 => Some(Self::VirtioMouse),
775            65545 => Some(Self::VirtioKeyboard),
776            65546 => Some(Self::VirtioTouchscreen),
777            2417819649 => Some(Self::GoldfishAccelerationSensor),
778            2417819650 => Some(Self::GoldfishGyroscopeSensor),
779            2417819651 => Some(Self::GoldfishRgbcLightSensor),
780            _ => None,
781        }
782    }
783
784    #[inline]
785    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
786        match prim {
787            65537 => Self::FocaltechTouchscreen,
788            65538 => Self::AmsLightSensor,
789            65539 => Self::PcPs2Keyboard,
790            65540 => Self::PcPs2Mouse,
791            65541 => Self::AdcButtons,
792            65542 => Self::GoodixTouchscreen,
793            65543 => Self::HidButtons,
794            65544 => Self::VirtioMouse,
795            65545 => Self::VirtioKeyboard,
796            65546 => Self::VirtioTouchscreen,
797            2417819649 => Self::GoldfishAccelerationSensor,
798            2417819650 => Self::GoldfishGyroscopeSensor,
799            2417819651 => Self::GoldfishRgbcLightSensor,
800            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
801        }
802    }
803
804    #[inline]
805    pub fn unknown() -> Self {
806        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
807    }
808
809    #[inline]
810    pub const fn into_primitive(self) -> u32 {
811        match self {
812            Self::FocaltechTouchscreen => 65537,
813            Self::AmsLightSensor => 65538,
814            Self::PcPs2Keyboard => 65539,
815            Self::PcPs2Mouse => 65540,
816            Self::AdcButtons => 65541,
817            Self::GoodixTouchscreen => 65542,
818            Self::HidButtons => 65543,
819            Self::VirtioMouse => 65544,
820            Self::VirtioKeyboard => 65545,
821            Self::VirtioTouchscreen => 65546,
822            Self::GoldfishAccelerationSensor => 2417819649,
823            Self::GoldfishGyroscopeSensor => 2417819650,
824            Self::GoldfishRgbcLightSensor => 2417819651,
825            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
826        }
827    }
828
829    #[inline]
830    pub fn is_unknown(&self) -> bool {
831        match self {
832            Self::__SourceBreaking { unknown_ordinal: _ } => true,
833            _ => false,
834        }
835    }
836}
837
838/// The VendorId represents the vendor that created this Input device. If the
839/// Input device is a HID device, the VendorId maps directly to the HID
840/// VendorId. If the Input device is not a HID device, then the VendorId
841/// will be greater than 0xFFFF, which is the max HID VendorId.
842#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
843pub enum VendorId {
844    /// Below are the HID VendorIds, range 0x0000 - 0xFFFF.
845    Google,
846    #[doc(hidden)]
847    __SourceBreaking { unknown_ordinal: u32 },
848}
849
850/// Pattern that matches an unknown `VendorId` member.
851#[macro_export]
852macro_rules! VendorIdUnknown {
853    () => {
854        _
855    };
856}
857
858impl VendorId {
859    #[inline]
860    pub fn from_primitive(prim: u32) -> Option<Self> {
861        match prim {
862            6353 => Some(Self::Google),
863            _ => None,
864        }
865    }
866
867    #[inline]
868    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
869        match prim {
870            6353 => Self::Google,
871            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
872        }
873    }
874
875    #[inline]
876    pub fn unknown() -> Self {
877        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
878    }
879
880    #[inline]
881    pub const fn into_primitive(self) -> u32 {
882        match self {
883            Self::Google => 6353,
884            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
885        }
886    }
887
888    #[inline]
889    pub fn is_unknown(&self) -> bool {
890        match self {
891            Self::__SourceBreaking { unknown_ordinal: _ } => true,
892            _ => false,
893        }
894    }
895}
896
897/// An `Axis` is defined as a `range` and a `unit`.
898#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
899pub struct Axis {
900    pub range: Range,
901    pub unit: Unit,
902}
903
904impl fidl::Persistable for Axis {}
905
906/// DeviceInfo provides more information about the device and lets a client
907/// distinguish between devices (e.g between two touchscreens that come from
908/// different vendors). If the device is a HID device, then the id information
909/// will come from the device itself. Other, non-HID devices may assign the
910/// ids in the driver, so it will be the driver author's responsibility to
911/// assign sensible ids.
912#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
913#[repr(C)]
914pub struct DeviceInfo {
915    pub vendor_id: u32,
916    pub product_id: u32,
917    pub version: u32,
918}
919
920impl fidl::Persistable for DeviceInfo {}
921
922#[derive(Clone, Debug, PartialEq)]
923pub struct InputDeviceGetDescriptorResponse {
924    pub descriptor: DeviceDescriptor,
925}
926
927impl fidl::Persistable for InputDeviceGetDescriptorResponse {}
928
929#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
930pub struct InputDeviceGetInputReportRequest {
931    pub device_type: DeviceType,
932}
933
934impl fidl::Persistable for InputDeviceGetInputReportRequest {}
935
936#[derive(Clone, Debug, PartialEq)]
937pub struct InputDeviceSendOutputReportRequest {
938    pub report: OutputReport,
939}
940
941impl fidl::Persistable for InputDeviceSendOutputReportRequest {}
942
943#[derive(Clone, Debug, PartialEq)]
944pub struct InputDeviceSetFeatureReportRequest {
945    pub report: FeatureReport,
946}
947
948impl fidl::Persistable for InputDeviceSetFeatureReportRequest {}
949
950#[derive(Clone, Debug, PartialEq)]
951pub struct InputDeviceGetFeatureReportResponse {
952    pub report: FeatureReport,
953}
954
955impl fidl::Persistable for InputDeviceGetFeatureReportResponse {}
956
957#[derive(Clone, Debug, PartialEq)]
958pub struct InputDeviceGetInputReportResponse {
959    pub report: InputReport,
960}
961
962impl fidl::Persistable for InputDeviceGetInputReportResponse {}
963
964#[derive(Clone, Debug, PartialEq)]
965pub struct InputReportsReaderReadInputReportsResponse {
966    pub reports: Vec<InputReport>,
967}
968
969impl fidl::Persistable for InputReportsReaderReadInputReportsResponse {}
970
971/// Describe a `Range` of values.
972#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
973#[repr(C)]
974pub struct Range {
975    pub min: i64,
976    pub max: i64,
977}
978
979impl fidl::Persistable for Range {}
980
981/// A `SensorAxis` is a normal `Axis` with an additional `SensorType` to describe what the
982/// axis is measuring.
983#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
984pub struct SensorAxis {
985    pub axis: Axis,
986    pub type_: SensorType,
987}
988
989impl fidl::Persistable for SensorAxis {}
990
991/// Describes a given unit by giving the unit and the unit's exponent.
992/// E.g: Nanometers would have type METERS and exponent -9.
993#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
994pub struct Unit {
995    pub type_: UnitType,
996    pub exponent: i32,
997}
998
999impl fidl::Persistable for Unit {}
1000
1001/// A Fuchsia ConsumerControl represents a device thats purpose is to change
1002/// values on the host. Typical controls are Volume, Power, Media Playback.
1003/// (Consider a TV remote to be a typical ConsumerControl).
1004#[derive(Clone, Debug, Default, PartialEq)]
1005pub struct ConsumerControlDescriptor {
1006    pub input: Option<ConsumerControlInputDescriptor>,
1007    #[doc(hidden)]
1008    pub __source_breaking: fidl::marker::SourceBreaking,
1009}
1010
1011impl fidl::Persistable for ConsumerControlDescriptor {}
1012
1013/// Describes the format of the input report that will be sent from the
1014/// ConsumerControl device to the host.
1015#[derive(Clone, Debug, Default, PartialEq)]
1016pub struct ConsumerControlInputDescriptor {
1017    /// The list of buttons that this device contains.
1018    pub buttons: Option<Vec<ConsumerControlButton>>,
1019    #[doc(hidden)]
1020    pub __source_breaking: fidl::marker::SourceBreaking,
1021}
1022
1023impl fidl::Persistable for ConsumerControlInputDescriptor {}
1024
1025/// A single report created by a ConsumerControl device.
1026#[derive(Clone, Debug, Default, PartialEq)]
1027pub struct ConsumerControlInputReport {
1028    /// The list of buttons that are currently pressed down.
1029    pub pressed_buttons: Option<Vec<ConsumerControlButton>>,
1030    #[doc(hidden)]
1031    pub __source_breaking: fidl::marker::SourceBreaking,
1032}
1033
1034impl fidl::Persistable for ConsumerControlInputReport {}
1035
1036/// `ContactInputDescriptor` describes the fields associated with a touch on a touch device.
1037#[derive(Clone, Debug, Default, PartialEq)]
1038pub struct ContactInputDescriptor {
1039    /// Describes the reporting of the x-axis.
1040    pub position_x: Option<Axis>,
1041    /// Describes the reporting of the y-axis.
1042    pub position_y: Option<Axis>,
1043    /// Pressure of the contact.
1044    pub pressure: Option<Axis>,
1045    /// Width of the area of contact.
1046    pub contact_width: Option<Axis>,
1047    /// Height of the area of contact.
1048    pub contact_height: Option<Axis>,
1049    #[doc(hidden)]
1050    pub __source_breaking: fidl::marker::SourceBreaking,
1051}
1052
1053impl fidl::Persistable for ContactInputDescriptor {}
1054
1055/// `ContactInputReport` describes one touch on a touch device.
1056#[derive(Clone, Debug, Default, PartialEq)]
1057pub struct ContactInputReport {
1058    /// Identifier for this contact.
1059    pub contact_id: Option<u32>,
1060    /// A contact's position on the x axis.
1061    pub position_x: Option<i64>,
1062    /// A contact's position on the y axis.
1063    pub position_y: Option<i64>,
1064    /// Pressure of the contact.
1065    pub pressure: Option<i64>,
1066    /// Width of the bounding box around the touch contact. Combined with
1067    /// `contact_height`, this describes the area of the touch contact.
1068    /// `contact_width` and `contact_height` should both have units of distance,
1069    /// and they should be in the same units as `position_x` and `position_y`.
1070    pub contact_width: Option<i64>,
1071    /// Height of the bounding box around the touch contact. Combined with
1072    /// `contact_width`, this describes the area of the touch contact.
1073    /// `contact_width` and `contact_height` should both have units of distance,
1074    /// and they should be in the same units as `position_x` and `position_y`.
1075    pub contact_height: Option<i64>,
1076    /// Also known as touch valid. Indicates the device’s confidence that the touch
1077    /// contact was an intended, valid contact. The device should report 0 if the
1078    /// contact is not a valid touch. The device should report 1 if the contact is
1079    /// intended and valid (e.g. a pointing touch)
1080    pub confidence: Option<bool>,
1081    #[doc(hidden)]
1082    pub __source_breaking: fidl::marker::SourceBreaking,
1083}
1084
1085impl fidl::Persistable for ContactInputReport {}
1086
1087/// `DeviceDescriptor` describes a physical input device. Some physical devices may
1088/// send multiple types of reports (E.g: a physical touchscreen can send touch and
1089/// stylus reports, so it will have both a TouchDescriptor and a StylusDescriptor).
1090#[derive(Clone, Debug, Default, PartialEq)]
1091pub struct DeviceDescriptor {
1092    /// This field is removed. Use device_information instead.
1093    pub device_info: Option<DeviceInfo>,
1094    /// When `mouse` is present the device has a mouse.
1095    pub mouse: Option<MouseDescriptor>,
1096    /// When `sensor` is present the device has a sensor.
1097    pub sensor: Option<SensorDescriptor>,
1098    /// When `touch` is present the device has a touch device.
1099    /// (E.g: Touchscreen, touchpad).
1100    pub touch: Option<TouchDescriptor>,
1101    /// When `keyboard` is present the device has a keyboard.
1102    pub keyboard: Option<KeyboardDescriptor>,
1103    /// When `consumer_control` is present the device has a ConsumerControl
1104    /// device.
1105    pub consumer_control: Option<ConsumerControlDescriptor>,
1106    /// `device_information` should always be present to help distinguish
1107    /// between physical devices.
1108    pub device_information: Option<DeviceInformation>,
1109    #[doc(hidden)]
1110    pub __source_breaking: fidl::marker::SourceBreaking,
1111}
1112
1113impl fidl::Persistable for DeviceDescriptor {}
1114
1115/// DeviceInformation provides more information about the device and lets a
1116/// client distinguish between devices (e.g between two touchscreens that come
1117/// from different vendors). If the device is a HID device, then the id
1118/// information will come from the device itself. Other, non-HID devices may
1119/// assign the ids in the driver, so it will be the driver author's
1120/// responsibility to assign sensible ids.
1121#[derive(Clone, Debug, Default, PartialEq)]
1122pub struct DeviceInformation {
1123    pub vendor_id: Option<u32>,
1124    pub product_id: Option<u32>,
1125    pub version: Option<u32>,
1126    pub polling_rate: Option<i64>,
1127    #[doc(hidden)]
1128    pub __source_breaking: fidl::marker::SourceBreaking,
1129}
1130
1131impl fidl::Persistable for DeviceInformation {}
1132
1133/// A single report containing the feature information for an input device.
1134/// Feature reports obtained from the device show the current state of the
1135/// device. Sending a feature report to the device sets the device in that
1136/// state.
1137#[derive(Clone, Debug, Default, PartialEq)]
1138pub struct FeatureReport {
1139    pub sensor: Option<SensorFeatureReport>,
1140    pub touch: Option<TouchFeatureReport>,
1141    #[doc(hidden)]
1142    pub __source_breaking: fidl::marker::SourceBreaking,
1143}
1144
1145impl fidl::Persistable for FeatureReport {}
1146
1147/// `InputReport` is a single report that is created by an input device.
1148#[derive(Clone, Debug, Default, PartialEq)]
1149pub struct InputReport {
1150    /// `event_time` is in nanoseconds when the event was recorded.
1151    pub event_time: Option<i64>,
1152    /// `mouse` is the report generated if the device contains a mouse.
1153    pub mouse: Option<MouseInputReport>,
1154    /// Unique ID to connect trace async begin/end events.
1155    pub trace_id: Option<u64>,
1156    /// `sensor` is the report generated if the device contains a sensor.
1157    pub sensor: Option<SensorInputReport>,
1158    /// `touch` is the report generated if the device contains a touch device.
1159    pub touch: Option<TouchInputReport>,
1160    /// `keyboard` is the report generated if the device contains a keyboard.
1161    pub keyboard: Option<KeyboardInputReport>,
1162    /// `consumer_controls` is the report generated if the device contains a
1163    /// ConsumerControl device.
1164    pub consumer_control: Option<ConsumerControlInputReport>,
1165    /// The Descriptor that describes this InputReport will have a matching
1166    /// ReportID. If this doesn't exist, report_id is 0.
1167    pub report_id: Option<u8>,
1168    #[doc(hidden)]
1169    pub __source_breaking: fidl::marker::SourceBreaking,
1170}
1171
1172impl fidl::Persistable for InputReport {}
1173
1174/// The capabilities of a keyboard device.
1175#[derive(Clone, Debug, Default, PartialEq)]
1176pub struct KeyboardDescriptor {
1177    pub input: Option<KeyboardInputDescriptor>,
1178    pub output: Option<KeyboardOutputDescriptor>,
1179    #[doc(hidden)]
1180    pub __source_breaking: fidl::marker::SourceBreaking,
1181}
1182
1183impl fidl::Persistable for KeyboardDescriptor {}
1184
1185/// Describes the format of the input report that will be sent from the keyboard
1186/// to the device.
1187#[derive(Clone, Debug, Default, PartialEq)]
1188pub struct KeyboardInputDescriptor {
1189    /// The list of keys that this keyboard contains.
1190    pub keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1191    #[doc(hidden)]
1192    pub __source_breaking: fidl::marker::SourceBreaking,
1193}
1194
1195impl fidl::Persistable for KeyboardInputDescriptor {}
1196
1197/// A single report created by a keyboard device.
1198#[derive(Clone, Debug, Default, PartialEq)]
1199pub struct KeyboardInputReport {
1200    /// The list of keys that are currently pressed down.
1201    pub pressed_keys3: Option<Vec<fidl_fuchsia_input__common::Key>>,
1202    #[doc(hidden)]
1203    pub __source_breaking: fidl::marker::SourceBreaking,
1204}
1205
1206impl fidl::Persistable for KeyboardInputReport {}
1207
1208/// Describes the format of the output report that can be sent to the keyboard..
1209#[derive(Clone, Debug, Default, PartialEq)]
1210pub struct KeyboardOutputDescriptor {
1211    /// The list of keyboard LEDs that can be toggled.
1212    pub leds: Option<Vec<LedType>>,
1213    #[doc(hidden)]
1214    pub __source_breaking: fidl::marker::SourceBreaking,
1215}
1216
1217impl fidl::Persistable for KeyboardOutputDescriptor {}
1218
1219/// A single report containing output information for a keyboard.
1220#[derive(Clone, Debug, Default, PartialEq)]
1221pub struct KeyboardOutputReport {
1222    /// Each LED in this list will be turned on. Any LED not in this list will be
1223    /// turned off.
1224    pub enabled_leds: Option<Vec<LedType>>,
1225    #[doc(hidden)]
1226    pub __source_breaking: fidl::marker::SourceBreaking,
1227}
1228
1229impl fidl::Persistable for KeyboardOutputReport {}
1230
1231/// The capabilities of a mouse device.
1232#[derive(Clone, Debug, Default, PartialEq)]
1233pub struct MouseDescriptor {
1234    pub input: Option<MouseInputDescriptor>,
1235    #[doc(hidden)]
1236    pub __source_breaking: fidl::marker::SourceBreaking,
1237}
1238
1239impl fidl::Persistable for MouseDescriptor {}
1240
1241/// Describes the format of the input report that will be sent from the mouse
1242/// to the device.
1243#[derive(Clone, Debug, Default, PartialEq)]
1244pub struct MouseInputDescriptor {
1245    /// The range of relative X movement.
1246    pub movement_x: Option<Axis>,
1247    /// The range of relative Y movement.
1248    pub movement_y: Option<Axis>,
1249    /// The range of relative vertical scroll.
1250    pub scroll_v: Option<Axis>,
1251    /// The range of relative horizontal scroll.
1252    pub scroll_h: Option<Axis>,
1253    /// This is a vector of ids for the mouse buttons.
1254    pub buttons: Option<Vec<u8>>,
1255    /// The range of the position of X.
1256    /// The main use of position is from virtual mice like over VNC.
1257    pub position_x: Option<Axis>,
1258    /// The range of the position of Y.
1259    /// The main use of position is from virtual mice like over VNC.
1260    pub position_y: Option<Axis>,
1261    #[doc(hidden)]
1262    pub __source_breaking: fidl::marker::SourceBreaking,
1263}
1264
1265impl fidl::Persistable for MouseInputDescriptor {}
1266
1267/// `MouseReport` gives the relative movement of the mouse and currently
1268/// pressed buttons. Relative means the movement seen between the previous
1269/// report and this report. The client is responsible for tracking this and
1270/// converting it to absolute movement.
1271#[derive(Clone, Debug, Default, PartialEq)]
1272pub struct MouseInputReport {
1273    /// Relative X positional displacement.
1274    pub movement_x: Option<i64>,
1275    /// Relative Y positional displacement.
1276    pub movement_y: Option<i64>,
1277    /// Relative vertical scrolling displacement.
1278    pub scroll_v: Option<i64>,
1279    /// Relative horizontal scrolling displacement.
1280    pub scroll_h: Option<i64>,
1281    /// A list of currently pressed buttons.
1282    pub pressed_buttons: Option<Vec<u8>>,
1283    /// The position of X.
1284    /// The main use of position is from virtual mice like over VNC.
1285    pub position_x: Option<i64>,
1286    /// The position of Y.
1287    /// The main use of position is from virtual mice like over VNC.
1288    pub position_y: Option<i64>,
1289    #[doc(hidden)]
1290    pub __source_breaking: fidl::marker::SourceBreaking,
1291}
1292
1293impl fidl::Persistable for MouseInputReport {}
1294
1295/// Describes the output reports that a physical input device will accept.
1296/// Output information typically represents device output to the user
1297/// (E.g: LEDs, tactile feedback, etc).
1298#[derive(Clone, Debug, Default, PartialEq)]
1299pub struct OutputDescriptor {
1300    pub keyboard: Option<KeyboardOutputDescriptor>,
1301    #[doc(hidden)]
1302    pub __source_breaking: fidl::marker::SourceBreaking,
1303}
1304
1305impl fidl::Persistable for OutputDescriptor {}
1306
1307/// A single report containing output information for an input device.
1308/// Output information typically represents device output to the user
1309/// (E.g: LEDs, tactile feedback, etc).
1310#[derive(Clone, Debug, Default, PartialEq)]
1311pub struct OutputReport {
1312    pub keyboard: Option<KeyboardOutputReport>,
1313    #[doc(hidden)]
1314    pub __source_breaking: fidl::marker::SourceBreaking,
1315}
1316
1317impl fidl::Persistable for OutputReport {}
1318
1319/// Selective Reporting Feature Report indicating which types of input are reported.
1320#[derive(Clone, Debug, Default, PartialEq)]
1321pub struct SelectiveReportingFeatureReport {
1322    /// If this is true, the device will report surface contacts.
1323    pub surface_switch: Option<bool>,
1324    /// If this is true, the device will report button state.
1325    pub button_switch: Option<bool>,
1326    #[doc(hidden)]
1327    pub __source_breaking: fidl::marker::SourceBreaking,
1328}
1329
1330impl fidl::Persistable for SelectiveReportingFeatureReport {}
1331
1332/// The capabilities of a sensor device.
1333#[derive(Clone, Debug, Default, PartialEq)]
1334pub struct SensorDescriptor {
1335    pub input: Option<Vec<SensorInputDescriptor>>,
1336    pub feature: Option<Vec<SensorFeatureDescriptor>>,
1337    #[doc(hidden)]
1338    pub __source_breaking: fidl::marker::SourceBreaking,
1339}
1340
1341impl fidl::Persistable for SensorDescriptor {}
1342
1343/// Describes the format of the sensor's feature report. Feature reports can be
1344/// requested from the sensor, or sent to the sensor.
1345#[derive(Clone, Debug, Default, PartialEq)]
1346pub struct SensorFeatureDescriptor {
1347    /// Describes the minimum and maximum reporting interval this sensor
1348    /// supports.
1349    pub report_interval: Option<Axis>,
1350    /// Sets the sensitivity for the given `SensorType`.
1351    pub sensitivity: Option<Vec<SensorAxis>>,
1352    /// If this is true then SensorFeatureReport supports setting a
1353    /// SensorReportingState.
1354    pub supports_reporting_state: Option<bool>,
1355    /// Sets the high threshold values for the given `SensorType`.
1356    pub threshold_high: Option<Vec<SensorAxis>>,
1357    /// Sets the low threshold values for the given `SensorType`.
1358    pub threshold_low: Option<Vec<SensorAxis>>,
1359    /// Describes the minimum and maximum sampling rate this sensor supports.
1360    pub sampling_rate: Option<Axis>,
1361    /// ReportID of current descriptor. Report with same report ID should be
1362    /// associated with this descriptor.
1363    pub report_id: Option<u8>,
1364    #[doc(hidden)]
1365    pub __source_breaking: fidl::marker::SourceBreaking,
1366}
1367
1368impl fidl::Persistable for SensorFeatureDescriptor {}
1369
1370/// A SensorFeatureReport describes the features of a given sensor. If a
1371/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1372/// If a FeatureReport is requested from the Input Device it shows the device's
1373/// current configuration.
1374#[derive(Clone, Debug, Default, PartialEq)]
1375pub struct SensorFeatureReport {
1376    /// The time between reports sent by the sensor.
1377    pub report_interval: Option<i64>,
1378    /// The sensitivity for various `SensorType`. This vector must be given in
1379    /// the order of the descriptor's `sensitivity` vector.
1380    pub sensitivity: Option<Vec<i64>>,
1381    /// This determines when the sensor will send reports.
1382    pub reporting_state: Option<SensorReportingState>,
1383    /// The high thresholds for various `SensorType`. This vector must be given in
1384    /// the order of the descriptor's `threshold_high` vector.
1385    pub threshold_high: Option<Vec<i64>>,
1386    /// The low thresholds for various `SensorType`. This vector must be given in
1387    /// the order of the descriptor's `threshold_low` vector.
1388    pub threshold_low: Option<Vec<i64>>,
1389    /// The rate at which the sensor is sampled.
1390    pub sampling_rate: Option<i64>,
1391    #[doc(hidden)]
1392    pub __source_breaking: fidl::marker::SourceBreaking,
1393}
1394
1395impl fidl::Persistable for SensorFeatureReport {}
1396
1397/// Describes the format of the input report that will be sent from the sensor
1398/// to the device.
1399#[derive(Clone, Debug, Default, PartialEq)]
1400pub struct SensorInputDescriptor {
1401    /// Each `SensorAxis` in `values` describes what a sensor is measuring and its range.
1402    /// These will directly correspond to the values in `SensorReport`.
1403    pub values: Option<Vec<SensorAxis>>,
1404    /// ReportID of current descriptor. Report with same report ID should be
1405    /// associated with this descriptor.
1406    pub report_id: Option<u8>,
1407    #[doc(hidden)]
1408    pub __source_breaking: fidl::marker::SourceBreaking,
1409}
1410
1411impl fidl::Persistable for SensorInputDescriptor {}
1412
1413/// `SensorReport` gives the values measured by a sensor at a given point in time.
1414#[derive(Clone, Debug, Default, PartialEq)]
1415pub struct SensorInputReport {
1416    /// The ordering of `values` will always directly correspond to the ordering of
1417    /// the values in `SensorDescriptor`.
1418    pub values: Option<Vec<i64>>,
1419    #[doc(hidden)]
1420    pub __source_breaking: fidl::marker::SourceBreaking,
1421}
1422
1423impl fidl::Persistable for SensorInputReport {}
1424
1425/// The capabilities of a touch device.
1426#[derive(Clone, Debug, Default, PartialEq)]
1427pub struct TouchDescriptor {
1428    pub input: Option<TouchInputDescriptor>,
1429    pub feature: Option<TouchFeatureDescriptor>,
1430    #[doc(hidden)]
1431    pub __source_breaking: fidl::marker::SourceBreaking,
1432}
1433
1434impl fidl::Persistable for TouchDescriptor {}
1435
1436/// Describes the format of the touchpad configuration's feature report. Feature reports
1437/// can be requested from the touchpad, or sent to the touchpad.
1438#[derive(Clone, Debug, Default, PartialEq)]
1439pub struct TouchFeatureDescriptor {
1440    /// Indicates whether or not touch feature descriptor supports different input modes.
1441    pub supports_input_mode: Option<bool>,
1442    /// Indicates whether or not touch feature descriptor supports selective reporting.
1443    pub supports_selective_reporting: Option<bool>,
1444    #[doc(hidden)]
1445    pub __source_breaking: fidl::marker::SourceBreaking,
1446}
1447
1448impl fidl::Persistable for TouchFeatureDescriptor {}
1449
1450/// A TouchFeatureReport describes the features of a given touch device. If a
1451/// FeatureReport is sent to the Input Device it sets the configuration of the device.
1452/// If a FeatureReport is requested from the Input Device it shows the device's
1453/// current configuration.
1454#[derive(Clone, Debug, Default, PartialEq)]
1455pub struct TouchFeatureReport {
1456    /// The input mode currently reporting.
1457    pub input_mode: Option<TouchConfigurationInputMode>,
1458    /// The current report types being reported.
1459    pub selective_reporting: Option<SelectiveReportingFeatureReport>,
1460    #[doc(hidden)]
1461    pub __source_breaking: fidl::marker::SourceBreaking,
1462}
1463
1464impl fidl::Persistable for TouchFeatureReport {}
1465
1466/// Describes the format of the input report that will be sent from the keyboard
1467/// to the device.
1468#[derive(Clone, Debug, Default, PartialEq)]
1469pub struct TouchInputDescriptor {
1470    /// The contact descriptors associated with this touch descriptor.
1471    pub contacts: Option<Vec<ContactInputDescriptor>>,
1472    /// The max number of contacts that this touch device can report at once.
1473    pub max_contacts: Option<u32>,
1474    /// The type of touch device being used.
1475    pub touch_type: Option<TouchType>,
1476    /// Identifiers for the physical buttons on a touch device.
1477    pub buttons: Option<Vec<u8>>,
1478    #[doc(hidden)]
1479    pub __source_breaking: fidl::marker::SourceBreaking,
1480}
1481
1482impl fidl::Persistable for TouchInputDescriptor {}
1483
1484/// `TouchInputReport` describes the current contacts recorded by the touchscreen.
1485#[derive(Clone, Debug, Default, PartialEq)]
1486pub struct TouchInputReport {
1487    /// The contacts currently being reported by the device.
1488    pub contacts: Option<Vec<ContactInputReport>>,
1489    /// Identifiers for currently pressed buttons.
1490    pub pressed_buttons: Option<Vec<u8>>,
1491    #[doc(hidden)]
1492    pub __source_breaking: fidl::marker::SourceBreaking,
1493}
1494
1495impl fidl::Persistable for TouchInputReport {}
1496
1497mod internal {
1498    use super::*;
1499    unsafe impl fidl::encoding::TypeMarker for ConsumerControlButton {
1500        type Owned = Self;
1501
1502        #[inline(always)]
1503        fn inline_align(_context: fidl::encoding::Context) -> usize {
1504            std::mem::align_of::<u32>()
1505        }
1506
1507        #[inline(always)]
1508        fn inline_size(_context: fidl::encoding::Context) -> usize {
1509            std::mem::size_of::<u32>()
1510        }
1511
1512        #[inline(always)]
1513        fn encode_is_copy() -> bool {
1514            false
1515        }
1516
1517        #[inline(always)]
1518        fn decode_is_copy() -> bool {
1519            false
1520        }
1521    }
1522
1523    impl fidl::encoding::ValueTypeMarker for ConsumerControlButton {
1524        type Borrowed<'a> = Self;
1525        #[inline(always)]
1526        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1527            *value
1528        }
1529    }
1530
1531    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1532        for ConsumerControlButton
1533    {
1534        #[inline]
1535        unsafe fn encode(
1536            self,
1537            encoder: &mut fidl::encoding::Encoder<'_, D>,
1538            offset: usize,
1539            _depth: fidl::encoding::Depth,
1540        ) -> fidl::Result<()> {
1541            encoder.debug_check_bounds::<Self>(offset);
1542            encoder.write_num(self.into_primitive(), offset);
1543            Ok(())
1544        }
1545    }
1546
1547    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsumerControlButton {
1548        #[inline(always)]
1549        fn new_empty() -> Self {
1550            Self::unknown()
1551        }
1552
1553        #[inline]
1554        unsafe fn decode(
1555            &mut self,
1556            decoder: &mut fidl::encoding::Decoder<'_, D>,
1557            offset: usize,
1558            _depth: fidl::encoding::Depth,
1559        ) -> fidl::Result<()> {
1560            decoder.debug_check_bounds::<Self>(offset);
1561            let prim = decoder.read_num::<u32>(offset);
1562
1563            *self = Self::from_primitive_allow_unknown(prim);
1564            Ok(())
1565        }
1566    }
1567    unsafe impl fidl::encoding::TypeMarker for DeviceType {
1568        type Owned = Self;
1569
1570        #[inline(always)]
1571        fn inline_align(_context: fidl::encoding::Context) -> usize {
1572            std::mem::align_of::<u32>()
1573        }
1574
1575        #[inline(always)]
1576        fn inline_size(_context: fidl::encoding::Context) -> usize {
1577            std::mem::size_of::<u32>()
1578        }
1579
1580        #[inline(always)]
1581        fn encode_is_copy() -> bool {
1582            false
1583        }
1584
1585        #[inline(always)]
1586        fn decode_is_copy() -> bool {
1587            false
1588        }
1589    }
1590
1591    impl fidl::encoding::ValueTypeMarker for DeviceType {
1592        type Borrowed<'a> = Self;
1593        #[inline(always)]
1594        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1595            *value
1596        }
1597    }
1598
1599    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
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 DeviceType {
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 LedType {
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 LedType {
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 LedType {
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 LedType {
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 SensorReportingState {
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 SensorReportingState {
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>
1732        for SensorReportingState
1733    {
1734        #[inline]
1735        unsafe fn encode(
1736            self,
1737            encoder: &mut fidl::encoding::Encoder<'_, D>,
1738            offset: usize,
1739            _depth: fidl::encoding::Depth,
1740        ) -> fidl::Result<()> {
1741            encoder.debug_check_bounds::<Self>(offset);
1742            encoder.write_num(self.into_primitive(), offset);
1743            Ok(())
1744        }
1745    }
1746
1747    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReportingState {
1748        #[inline(always)]
1749        fn new_empty() -> Self {
1750            Self::unknown()
1751        }
1752
1753        #[inline]
1754        unsafe fn decode(
1755            &mut self,
1756            decoder: &mut fidl::encoding::Decoder<'_, D>,
1757            offset: usize,
1758            _depth: fidl::encoding::Depth,
1759        ) -> fidl::Result<()> {
1760            decoder.debug_check_bounds::<Self>(offset);
1761            let prim = decoder.read_num::<u32>(offset);
1762
1763            *self = Self::from_primitive_allow_unknown(prim);
1764            Ok(())
1765        }
1766    }
1767    unsafe impl fidl::encoding::TypeMarker for SensorType {
1768        type Owned = Self;
1769
1770        #[inline(always)]
1771        fn inline_align(_context: fidl::encoding::Context) -> usize {
1772            std::mem::align_of::<u32>()
1773        }
1774
1775        #[inline(always)]
1776        fn inline_size(_context: fidl::encoding::Context) -> usize {
1777            std::mem::size_of::<u32>()
1778        }
1779
1780        #[inline(always)]
1781        fn encode_is_copy() -> bool {
1782            false
1783        }
1784
1785        #[inline(always)]
1786        fn decode_is_copy() -> bool {
1787            false
1788        }
1789    }
1790
1791    impl fidl::encoding::ValueTypeMarker for SensorType {
1792        type Borrowed<'a> = Self;
1793        #[inline(always)]
1794        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1795            *value
1796        }
1797    }
1798
1799    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
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 SensorType {
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 TouchConfigurationInputMode {
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 TouchConfigurationInputMode {
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>
1866        for TouchConfigurationInputMode
1867    {
1868        #[inline]
1869        unsafe fn encode(
1870            self,
1871            encoder: &mut fidl::encoding::Encoder<'_, D>,
1872            offset: usize,
1873            _depth: fidl::encoding::Depth,
1874        ) -> fidl::Result<()> {
1875            encoder.debug_check_bounds::<Self>(offset);
1876            encoder.write_num(self.into_primitive(), offset);
1877            Ok(())
1878        }
1879    }
1880
1881    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1882        for TouchConfigurationInputMode
1883    {
1884        #[inline(always)]
1885        fn new_empty() -> Self {
1886            Self::unknown()
1887        }
1888
1889        #[inline]
1890        unsafe fn decode(
1891            &mut self,
1892            decoder: &mut fidl::encoding::Decoder<'_, D>,
1893            offset: usize,
1894            _depth: fidl::encoding::Depth,
1895        ) -> fidl::Result<()> {
1896            decoder.debug_check_bounds::<Self>(offset);
1897            let prim = decoder.read_num::<u32>(offset);
1898
1899            *self = Self::from_primitive_allow_unknown(prim);
1900            Ok(())
1901        }
1902    }
1903    unsafe impl fidl::encoding::TypeMarker for TouchType {
1904        type Owned = Self;
1905
1906        #[inline(always)]
1907        fn inline_align(_context: fidl::encoding::Context) -> usize {
1908            std::mem::align_of::<u32>()
1909        }
1910
1911        #[inline(always)]
1912        fn inline_size(_context: fidl::encoding::Context) -> usize {
1913            std::mem::size_of::<u32>()
1914        }
1915
1916        #[inline(always)]
1917        fn encode_is_copy() -> bool {
1918            false
1919        }
1920
1921        #[inline(always)]
1922        fn decode_is_copy() -> bool {
1923            false
1924        }
1925    }
1926
1927    impl fidl::encoding::ValueTypeMarker for TouchType {
1928        type Borrowed<'a> = Self;
1929        #[inline(always)]
1930        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1931            *value
1932        }
1933    }
1934
1935    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchType {
1936        #[inline]
1937        unsafe fn encode(
1938            self,
1939            encoder: &mut fidl::encoding::Encoder<'_, D>,
1940            offset: usize,
1941            _depth: fidl::encoding::Depth,
1942        ) -> fidl::Result<()> {
1943            encoder.debug_check_bounds::<Self>(offset);
1944            encoder.write_num(self.into_primitive(), offset);
1945            Ok(())
1946        }
1947    }
1948
1949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchType {
1950        #[inline(always)]
1951        fn new_empty() -> Self {
1952            Self::unknown()
1953        }
1954
1955        #[inline]
1956        unsafe fn decode(
1957            &mut self,
1958            decoder: &mut fidl::encoding::Decoder<'_, D>,
1959            offset: usize,
1960            _depth: fidl::encoding::Depth,
1961        ) -> fidl::Result<()> {
1962            decoder.debug_check_bounds::<Self>(offset);
1963            let prim = decoder.read_num::<u32>(offset);
1964
1965            *self = Self::from_primitive_allow_unknown(prim);
1966            Ok(())
1967        }
1968    }
1969    unsafe impl fidl::encoding::TypeMarker for UnitType {
1970        type Owned = Self;
1971
1972        #[inline(always)]
1973        fn inline_align(_context: fidl::encoding::Context) -> usize {
1974            std::mem::align_of::<u32>()
1975        }
1976
1977        #[inline(always)]
1978        fn inline_size(_context: fidl::encoding::Context) -> usize {
1979            std::mem::size_of::<u32>()
1980        }
1981
1982        #[inline(always)]
1983        fn encode_is_copy() -> bool {
1984            false
1985        }
1986
1987        #[inline(always)]
1988        fn decode_is_copy() -> bool {
1989            false
1990        }
1991    }
1992
1993    impl fidl::encoding::ValueTypeMarker for UnitType {
1994        type Borrowed<'a> = Self;
1995        #[inline(always)]
1996        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1997            *value
1998        }
1999    }
2000
2001    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UnitType {
2002        #[inline]
2003        unsafe fn encode(
2004            self,
2005            encoder: &mut fidl::encoding::Encoder<'_, D>,
2006            offset: usize,
2007            _depth: fidl::encoding::Depth,
2008        ) -> fidl::Result<()> {
2009            encoder.debug_check_bounds::<Self>(offset);
2010            encoder.write_num(self.into_primitive(), offset);
2011            Ok(())
2012        }
2013    }
2014
2015    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnitType {
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 VendorGoogleProductId {
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 VendorGoogleProductId {
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>
2068        for VendorGoogleProductId
2069    {
2070        #[inline]
2071        unsafe fn encode(
2072            self,
2073            encoder: &mut fidl::encoding::Encoder<'_, D>,
2074            offset: usize,
2075            _depth: fidl::encoding::Depth,
2076        ) -> fidl::Result<()> {
2077            encoder.debug_check_bounds::<Self>(offset);
2078            encoder.write_num(self.into_primitive(), offset);
2079            Ok(())
2080        }
2081    }
2082
2083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorGoogleProductId {
2084        #[inline(always)]
2085        fn new_empty() -> Self {
2086            Self::unknown()
2087        }
2088
2089        #[inline]
2090        unsafe fn decode(
2091            &mut self,
2092            decoder: &mut fidl::encoding::Decoder<'_, D>,
2093            offset: usize,
2094            _depth: fidl::encoding::Depth,
2095        ) -> fidl::Result<()> {
2096            decoder.debug_check_bounds::<Self>(offset);
2097            let prim = decoder.read_num::<u32>(offset);
2098
2099            *self = Self::from_primitive_allow_unknown(prim);
2100            Ok(())
2101        }
2102    }
2103    unsafe impl fidl::encoding::TypeMarker for VendorId {
2104        type Owned = Self;
2105
2106        #[inline(always)]
2107        fn inline_align(_context: fidl::encoding::Context) -> usize {
2108            std::mem::align_of::<u32>()
2109        }
2110
2111        #[inline(always)]
2112        fn inline_size(_context: fidl::encoding::Context) -> usize {
2113            std::mem::size_of::<u32>()
2114        }
2115
2116        #[inline(always)]
2117        fn encode_is_copy() -> bool {
2118            false
2119        }
2120
2121        #[inline(always)]
2122        fn decode_is_copy() -> bool {
2123            false
2124        }
2125    }
2126
2127    impl fidl::encoding::ValueTypeMarker for VendorId {
2128        type Borrowed<'a> = Self;
2129        #[inline(always)]
2130        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2131            *value
2132        }
2133    }
2134
2135    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for VendorId {
2136        #[inline]
2137        unsafe fn encode(
2138            self,
2139            encoder: &mut fidl::encoding::Encoder<'_, D>,
2140            offset: usize,
2141            _depth: fidl::encoding::Depth,
2142        ) -> fidl::Result<()> {
2143            encoder.debug_check_bounds::<Self>(offset);
2144            encoder.write_num(self.into_primitive(), offset);
2145            Ok(())
2146        }
2147    }
2148
2149    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorId {
2150        #[inline(always)]
2151        fn new_empty() -> Self {
2152            Self::unknown()
2153        }
2154
2155        #[inline]
2156        unsafe fn decode(
2157            &mut self,
2158            decoder: &mut fidl::encoding::Decoder<'_, D>,
2159            offset: usize,
2160            _depth: fidl::encoding::Depth,
2161        ) -> fidl::Result<()> {
2162            decoder.debug_check_bounds::<Self>(offset);
2163            let prim = decoder.read_num::<u32>(offset);
2164
2165            *self = Self::from_primitive_allow_unknown(prim);
2166            Ok(())
2167        }
2168    }
2169
2170    impl fidl::encoding::ValueTypeMarker for Axis {
2171        type Borrowed<'a> = &'a Self;
2172        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2173            value
2174        }
2175    }
2176
2177    unsafe impl fidl::encoding::TypeMarker for Axis {
2178        type Owned = Self;
2179
2180        #[inline(always)]
2181        fn inline_align(_context: fidl::encoding::Context) -> usize {
2182            8
2183        }
2184
2185        #[inline(always)]
2186        fn inline_size(_context: fidl::encoding::Context) -> usize {
2187            24
2188        }
2189    }
2190
2191    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
2192        #[inline]
2193        unsafe fn encode(
2194            self,
2195            encoder: &mut fidl::encoding::Encoder<'_, D>,
2196            offset: usize,
2197            _depth: fidl::encoding::Depth,
2198        ) -> fidl::Result<()> {
2199            encoder.debug_check_bounds::<Axis>(offset);
2200            // Delegate to tuple encoding.
2201            fidl::encoding::Encode::<Axis, D>::encode(
2202                (
2203                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2204                    <Unit as fidl::encoding::ValueTypeMarker>::borrow(&self.unit),
2205                ),
2206                encoder,
2207                offset,
2208                _depth,
2209            )
2210        }
2211    }
2212    unsafe impl<
2213            D: fidl::encoding::ResourceDialect,
2214            T0: fidl::encoding::Encode<Range, D>,
2215            T1: fidl::encoding::Encode<Unit, D>,
2216        > fidl::encoding::Encode<Axis, D> for (T0, T1)
2217    {
2218        #[inline]
2219        unsafe fn encode(
2220            self,
2221            encoder: &mut fidl::encoding::Encoder<'_, D>,
2222            offset: usize,
2223            depth: fidl::encoding::Depth,
2224        ) -> fidl::Result<()> {
2225            encoder.debug_check_bounds::<Axis>(offset);
2226            // Zero out padding regions. There's no need to apply masks
2227            // because the unmasked parts will be overwritten by fields.
2228            // Write the fields.
2229            self.0.encode(encoder, offset + 0, depth)?;
2230            self.1.encode(encoder, offset + 16, depth)?;
2231            Ok(())
2232        }
2233    }
2234
2235    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
2236        #[inline(always)]
2237        fn new_empty() -> Self {
2238            Self { range: fidl::new_empty!(Range, D), unit: fidl::new_empty!(Unit, D) }
2239        }
2240
2241        #[inline]
2242        unsafe fn decode(
2243            &mut self,
2244            decoder: &mut fidl::encoding::Decoder<'_, D>,
2245            offset: usize,
2246            _depth: fidl::encoding::Depth,
2247        ) -> fidl::Result<()> {
2248            decoder.debug_check_bounds::<Self>(offset);
2249            // Verify that padding bytes are zero.
2250            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
2251            fidl::decode!(Unit, D, &mut self.unit, decoder, offset + 16, _depth)?;
2252            Ok(())
2253        }
2254    }
2255
2256    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2257        type Borrowed<'a> = &'a Self;
2258        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2259            value
2260        }
2261    }
2262
2263    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2264        type Owned = Self;
2265
2266        #[inline(always)]
2267        fn inline_align(_context: fidl::encoding::Context) -> usize {
2268            4
2269        }
2270
2271        #[inline(always)]
2272        fn inline_size(_context: fidl::encoding::Context) -> usize {
2273            12
2274        }
2275        #[inline(always)]
2276        fn encode_is_copy() -> bool {
2277            true
2278        }
2279
2280        #[inline(always)]
2281        fn decode_is_copy() -> bool {
2282            true
2283        }
2284    }
2285
2286    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2287        for &DeviceInfo
2288    {
2289        #[inline]
2290        unsafe fn encode(
2291            self,
2292            encoder: &mut fidl::encoding::Encoder<'_, D>,
2293            offset: usize,
2294            _depth: fidl::encoding::Depth,
2295        ) -> fidl::Result<()> {
2296            encoder.debug_check_bounds::<DeviceInfo>(offset);
2297            unsafe {
2298                // Copy the object into the buffer.
2299                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2300                (buf_ptr as *mut DeviceInfo).write_unaligned((self as *const DeviceInfo).read());
2301                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2302                // done second because the memcpy will write garbage to these bytes.
2303            }
2304            Ok(())
2305        }
2306    }
2307    unsafe impl<
2308            D: fidl::encoding::ResourceDialect,
2309            T0: fidl::encoding::Encode<u32, D>,
2310            T1: fidl::encoding::Encode<u32, D>,
2311            T2: fidl::encoding::Encode<u32, D>,
2312        > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2)
2313    {
2314        #[inline]
2315        unsafe fn encode(
2316            self,
2317            encoder: &mut fidl::encoding::Encoder<'_, D>,
2318            offset: usize,
2319            depth: fidl::encoding::Depth,
2320        ) -> fidl::Result<()> {
2321            encoder.debug_check_bounds::<DeviceInfo>(offset);
2322            // Zero out padding regions. There's no need to apply masks
2323            // because the unmasked parts will be overwritten by fields.
2324            // Write the fields.
2325            self.0.encode(encoder, offset + 0, depth)?;
2326            self.1.encode(encoder, offset + 4, depth)?;
2327            self.2.encode(encoder, offset + 8, depth)?;
2328            Ok(())
2329        }
2330    }
2331
2332    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2333        #[inline(always)]
2334        fn new_empty() -> Self {
2335            Self {
2336                vendor_id: fidl::new_empty!(u32, D),
2337                product_id: fidl::new_empty!(u32, D),
2338                version: fidl::new_empty!(u32, D),
2339            }
2340        }
2341
2342        #[inline]
2343        unsafe fn decode(
2344            &mut self,
2345            decoder: &mut fidl::encoding::Decoder<'_, D>,
2346            offset: usize,
2347            _depth: fidl::encoding::Depth,
2348        ) -> fidl::Result<()> {
2349            decoder.debug_check_bounds::<Self>(offset);
2350            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2351            // Verify that padding bytes are zero.
2352            // Copy from the buffer into the object.
2353            unsafe {
2354                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2355            }
2356            Ok(())
2357        }
2358    }
2359
2360    impl fidl::encoding::ValueTypeMarker for InputDeviceGetDescriptorResponse {
2361        type Borrowed<'a> = &'a Self;
2362        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2363            value
2364        }
2365    }
2366
2367    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetDescriptorResponse {
2368        type Owned = Self;
2369
2370        #[inline(always)]
2371        fn inline_align(_context: fidl::encoding::Context) -> usize {
2372            8
2373        }
2374
2375        #[inline(always)]
2376        fn inline_size(_context: fidl::encoding::Context) -> usize {
2377            16
2378        }
2379    }
2380
2381    unsafe impl<D: fidl::encoding::ResourceDialect>
2382        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D>
2383        for &InputDeviceGetDescriptorResponse
2384    {
2385        #[inline]
2386        unsafe fn encode(
2387            self,
2388            encoder: &mut fidl::encoding::Encoder<'_, D>,
2389            offset: usize,
2390            _depth: fidl::encoding::Depth,
2391        ) -> fidl::Result<()> {
2392            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2393            // Delegate to tuple encoding.
2394            fidl::encoding::Encode::<InputDeviceGetDescriptorResponse, D>::encode(
2395                (<DeviceDescriptor as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptor),),
2396                encoder,
2397                offset,
2398                _depth,
2399            )
2400        }
2401    }
2402    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceDescriptor, D>>
2403        fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D> for (T0,)
2404    {
2405        #[inline]
2406        unsafe fn encode(
2407            self,
2408            encoder: &mut fidl::encoding::Encoder<'_, D>,
2409            offset: usize,
2410            depth: fidl::encoding::Depth,
2411        ) -> fidl::Result<()> {
2412            encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2413            // Zero out padding regions. There's no need to apply masks
2414            // because the unmasked parts will be overwritten by fields.
2415            // Write the fields.
2416            self.0.encode(encoder, offset + 0, depth)?;
2417            Ok(())
2418        }
2419    }
2420
2421    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2422        for InputDeviceGetDescriptorResponse
2423    {
2424        #[inline(always)]
2425        fn new_empty() -> Self {
2426            Self { descriptor: fidl::new_empty!(DeviceDescriptor, D) }
2427        }
2428
2429        #[inline]
2430        unsafe fn decode(
2431            &mut self,
2432            decoder: &mut fidl::encoding::Decoder<'_, D>,
2433            offset: usize,
2434            _depth: fidl::encoding::Depth,
2435        ) -> fidl::Result<()> {
2436            decoder.debug_check_bounds::<Self>(offset);
2437            // Verify that padding bytes are zero.
2438            fidl::decode!(DeviceDescriptor, D, &mut self.descriptor, decoder, offset + 0, _depth)?;
2439            Ok(())
2440        }
2441    }
2442
2443    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportRequest {
2444        type Borrowed<'a> = &'a Self;
2445        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2446            value
2447        }
2448    }
2449
2450    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportRequest {
2451        type Owned = Self;
2452
2453        #[inline(always)]
2454        fn inline_align(_context: fidl::encoding::Context) -> usize {
2455            4
2456        }
2457
2458        #[inline(always)]
2459        fn inline_size(_context: fidl::encoding::Context) -> usize {
2460            4
2461        }
2462    }
2463
2464    unsafe impl<D: fidl::encoding::ResourceDialect>
2465        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D>
2466        for &InputDeviceGetInputReportRequest
2467    {
2468        #[inline]
2469        unsafe fn encode(
2470            self,
2471            encoder: &mut fidl::encoding::Encoder<'_, D>,
2472            offset: usize,
2473            _depth: fidl::encoding::Depth,
2474        ) -> fidl::Result<()> {
2475            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2476            // Delegate to tuple encoding.
2477            fidl::encoding::Encode::<InputDeviceGetInputReportRequest, D>::encode(
2478                (<DeviceType as fidl::encoding::ValueTypeMarker>::borrow(&self.device_type),),
2479                encoder,
2480                offset,
2481                _depth,
2482            )
2483        }
2484    }
2485    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceType, D>>
2486        fidl::encoding::Encode<InputDeviceGetInputReportRequest, D> for (T0,)
2487    {
2488        #[inline]
2489        unsafe fn encode(
2490            self,
2491            encoder: &mut fidl::encoding::Encoder<'_, D>,
2492            offset: usize,
2493            depth: fidl::encoding::Depth,
2494        ) -> fidl::Result<()> {
2495            encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2496            // Zero out padding regions. There's no need to apply masks
2497            // because the unmasked parts will be overwritten by fields.
2498            // Write the fields.
2499            self.0.encode(encoder, offset + 0, depth)?;
2500            Ok(())
2501        }
2502    }
2503
2504    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2505        for InputDeviceGetInputReportRequest
2506    {
2507        #[inline(always)]
2508        fn new_empty() -> Self {
2509            Self { device_type: fidl::new_empty!(DeviceType, D) }
2510        }
2511
2512        #[inline]
2513        unsafe fn decode(
2514            &mut self,
2515            decoder: &mut fidl::encoding::Decoder<'_, D>,
2516            offset: usize,
2517            _depth: fidl::encoding::Depth,
2518        ) -> fidl::Result<()> {
2519            decoder.debug_check_bounds::<Self>(offset);
2520            // Verify that padding bytes are zero.
2521            fidl::decode!(DeviceType, D, &mut self.device_type, decoder, offset + 0, _depth)?;
2522            Ok(())
2523        }
2524    }
2525
2526    impl fidl::encoding::ValueTypeMarker for InputDeviceSendOutputReportRequest {
2527        type Borrowed<'a> = &'a Self;
2528        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2529            value
2530        }
2531    }
2532
2533    unsafe impl fidl::encoding::TypeMarker for InputDeviceSendOutputReportRequest {
2534        type Owned = Self;
2535
2536        #[inline(always)]
2537        fn inline_align(_context: fidl::encoding::Context) -> usize {
2538            8
2539        }
2540
2541        #[inline(always)]
2542        fn inline_size(_context: fidl::encoding::Context) -> usize {
2543            16
2544        }
2545    }
2546
2547    unsafe impl<D: fidl::encoding::ResourceDialect>
2548        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D>
2549        for &InputDeviceSendOutputReportRequest
2550    {
2551        #[inline]
2552        unsafe fn encode(
2553            self,
2554            encoder: &mut fidl::encoding::Encoder<'_, D>,
2555            offset: usize,
2556            _depth: fidl::encoding::Depth,
2557        ) -> fidl::Result<()> {
2558            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2559            // Delegate to tuple encoding.
2560            fidl::encoding::Encode::<InputDeviceSendOutputReportRequest, D>::encode(
2561                (<OutputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2562                encoder,
2563                offset,
2564                _depth,
2565            )
2566        }
2567    }
2568    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OutputReport, D>>
2569        fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D> for (T0,)
2570    {
2571        #[inline]
2572        unsafe fn encode(
2573            self,
2574            encoder: &mut fidl::encoding::Encoder<'_, D>,
2575            offset: usize,
2576            depth: fidl::encoding::Depth,
2577        ) -> fidl::Result<()> {
2578            encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2579            // Zero out padding regions. There's no need to apply masks
2580            // because the unmasked parts will be overwritten by fields.
2581            // Write the fields.
2582            self.0.encode(encoder, offset + 0, depth)?;
2583            Ok(())
2584        }
2585    }
2586
2587    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2588        for InputDeviceSendOutputReportRequest
2589    {
2590        #[inline(always)]
2591        fn new_empty() -> Self {
2592            Self { report: fidl::new_empty!(OutputReport, D) }
2593        }
2594
2595        #[inline]
2596        unsafe fn decode(
2597            &mut self,
2598            decoder: &mut fidl::encoding::Decoder<'_, D>,
2599            offset: usize,
2600            _depth: fidl::encoding::Depth,
2601        ) -> fidl::Result<()> {
2602            decoder.debug_check_bounds::<Self>(offset);
2603            // Verify that padding bytes are zero.
2604            fidl::decode!(OutputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2605            Ok(())
2606        }
2607    }
2608
2609    impl fidl::encoding::ValueTypeMarker for InputDeviceSetFeatureReportRequest {
2610        type Borrowed<'a> = &'a Self;
2611        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2612            value
2613        }
2614    }
2615
2616    unsafe impl fidl::encoding::TypeMarker for InputDeviceSetFeatureReportRequest {
2617        type Owned = Self;
2618
2619        #[inline(always)]
2620        fn inline_align(_context: fidl::encoding::Context) -> usize {
2621            8
2622        }
2623
2624        #[inline(always)]
2625        fn inline_size(_context: fidl::encoding::Context) -> usize {
2626            16
2627        }
2628    }
2629
2630    unsafe impl<D: fidl::encoding::ResourceDialect>
2631        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D>
2632        for &InputDeviceSetFeatureReportRequest
2633    {
2634        #[inline]
2635        unsafe fn encode(
2636            self,
2637            encoder: &mut fidl::encoding::Encoder<'_, D>,
2638            offset: usize,
2639            _depth: fidl::encoding::Depth,
2640        ) -> fidl::Result<()> {
2641            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2642            // Delegate to tuple encoding.
2643            fidl::encoding::Encode::<InputDeviceSetFeatureReportRequest, D>::encode(
2644                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2645                encoder,
2646                offset,
2647                _depth,
2648            )
2649        }
2650    }
2651    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2652        fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D> for (T0,)
2653    {
2654        #[inline]
2655        unsafe fn encode(
2656            self,
2657            encoder: &mut fidl::encoding::Encoder<'_, D>,
2658            offset: usize,
2659            depth: fidl::encoding::Depth,
2660        ) -> fidl::Result<()> {
2661            encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2662            // Zero out padding regions. There's no need to apply masks
2663            // because the unmasked parts will be overwritten by fields.
2664            // Write the fields.
2665            self.0.encode(encoder, offset + 0, depth)?;
2666            Ok(())
2667        }
2668    }
2669
2670    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2671        for InputDeviceSetFeatureReportRequest
2672    {
2673        #[inline(always)]
2674        fn new_empty() -> Self {
2675            Self { report: fidl::new_empty!(FeatureReport, D) }
2676        }
2677
2678        #[inline]
2679        unsafe fn decode(
2680            &mut self,
2681            decoder: &mut fidl::encoding::Decoder<'_, D>,
2682            offset: usize,
2683            _depth: fidl::encoding::Depth,
2684        ) -> fidl::Result<()> {
2685            decoder.debug_check_bounds::<Self>(offset);
2686            // Verify that padding bytes are zero.
2687            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2688            Ok(())
2689        }
2690    }
2691
2692    impl fidl::encoding::ValueTypeMarker for InputDeviceGetFeatureReportResponse {
2693        type Borrowed<'a> = &'a Self;
2694        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2695            value
2696        }
2697    }
2698
2699    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetFeatureReportResponse {
2700        type Owned = Self;
2701
2702        #[inline(always)]
2703        fn inline_align(_context: fidl::encoding::Context) -> usize {
2704            8
2705        }
2706
2707        #[inline(always)]
2708        fn inline_size(_context: fidl::encoding::Context) -> usize {
2709            16
2710        }
2711    }
2712
2713    unsafe impl<D: fidl::encoding::ResourceDialect>
2714        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D>
2715        for &InputDeviceGetFeatureReportResponse
2716    {
2717        #[inline]
2718        unsafe fn encode(
2719            self,
2720            encoder: &mut fidl::encoding::Encoder<'_, D>,
2721            offset: usize,
2722            _depth: fidl::encoding::Depth,
2723        ) -> fidl::Result<()> {
2724            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2725            // Delegate to tuple encoding.
2726            fidl::encoding::Encode::<InputDeviceGetFeatureReportResponse, D>::encode(
2727                (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2728                encoder,
2729                offset,
2730                _depth,
2731            )
2732        }
2733    }
2734    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2735        fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D> for (T0,)
2736    {
2737        #[inline]
2738        unsafe fn encode(
2739            self,
2740            encoder: &mut fidl::encoding::Encoder<'_, D>,
2741            offset: usize,
2742            depth: fidl::encoding::Depth,
2743        ) -> fidl::Result<()> {
2744            encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2745            // Zero out padding regions. There's no need to apply masks
2746            // because the unmasked parts will be overwritten by fields.
2747            // Write the fields.
2748            self.0.encode(encoder, offset + 0, depth)?;
2749            Ok(())
2750        }
2751    }
2752
2753    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2754        for InputDeviceGetFeatureReportResponse
2755    {
2756        #[inline(always)]
2757        fn new_empty() -> Self {
2758            Self { report: fidl::new_empty!(FeatureReport, D) }
2759        }
2760
2761        #[inline]
2762        unsafe fn decode(
2763            &mut self,
2764            decoder: &mut fidl::encoding::Decoder<'_, D>,
2765            offset: usize,
2766            _depth: fidl::encoding::Depth,
2767        ) -> fidl::Result<()> {
2768            decoder.debug_check_bounds::<Self>(offset);
2769            // Verify that padding bytes are zero.
2770            fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2771            Ok(())
2772        }
2773    }
2774
2775    impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportResponse {
2776        type Borrowed<'a> = &'a Self;
2777        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2778            value
2779        }
2780    }
2781
2782    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2783        type Owned = Self;
2784
2785        #[inline(always)]
2786        fn inline_align(_context: fidl::encoding::Context) -> usize {
2787            8
2788        }
2789
2790        #[inline(always)]
2791        fn inline_size(_context: fidl::encoding::Context) -> usize {
2792            16
2793        }
2794    }
2795
2796    unsafe impl<D: fidl::encoding::ResourceDialect>
2797        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D>
2798        for &InputDeviceGetInputReportResponse
2799    {
2800        #[inline]
2801        unsafe fn encode(
2802            self,
2803            encoder: &mut fidl::encoding::Encoder<'_, D>,
2804            offset: usize,
2805            _depth: fidl::encoding::Depth,
2806        ) -> fidl::Result<()> {
2807            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2808            // Delegate to tuple encoding.
2809            fidl::encoding::Encode::<InputDeviceGetInputReportResponse, D>::encode(
2810                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2811                encoder,
2812                offset,
2813                _depth,
2814            )
2815        }
2816    }
2817    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2818        fidl::encoding::Encode<InputDeviceGetInputReportResponse, D> for (T0,)
2819    {
2820        #[inline]
2821        unsafe fn encode(
2822            self,
2823            encoder: &mut fidl::encoding::Encoder<'_, D>,
2824            offset: usize,
2825            depth: fidl::encoding::Depth,
2826        ) -> fidl::Result<()> {
2827            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2828            // Zero out padding regions. There's no need to apply masks
2829            // because the unmasked parts will be overwritten by fields.
2830            // Write the fields.
2831            self.0.encode(encoder, offset + 0, depth)?;
2832            Ok(())
2833        }
2834    }
2835
2836    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2837        for InputDeviceGetInputReportResponse
2838    {
2839        #[inline(always)]
2840        fn new_empty() -> Self {
2841            Self { report: fidl::new_empty!(InputReport, D) }
2842        }
2843
2844        #[inline]
2845        unsafe fn decode(
2846            &mut self,
2847            decoder: &mut fidl::encoding::Decoder<'_, D>,
2848            offset: usize,
2849            _depth: fidl::encoding::Depth,
2850        ) -> fidl::Result<()> {
2851            decoder.debug_check_bounds::<Self>(offset);
2852            // Verify that padding bytes are zero.
2853            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2854            Ok(())
2855        }
2856    }
2857
2858    impl fidl::encoding::ValueTypeMarker for InputReportsReaderReadInputReportsResponse {
2859        type Borrowed<'a> = &'a Self;
2860        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2861            value
2862        }
2863    }
2864
2865    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2866        type Owned = Self;
2867
2868        #[inline(always)]
2869        fn inline_align(_context: fidl::encoding::Context) -> usize {
2870            8
2871        }
2872
2873        #[inline(always)]
2874        fn inline_size(_context: fidl::encoding::Context) -> usize {
2875            16
2876        }
2877    }
2878
2879    unsafe impl<D: fidl::encoding::ResourceDialect>
2880        fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D>
2881        for &InputReportsReaderReadInputReportsResponse
2882    {
2883        #[inline]
2884        unsafe fn encode(
2885            self,
2886            encoder: &mut fidl::encoding::Encoder<'_, D>,
2887            offset: usize,
2888            _depth: fidl::encoding::Depth,
2889        ) -> fidl::Result<()> {
2890            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2891            // Delegate to tuple encoding.
2892            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, D>::encode(
2893                (
2894                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.reports),
2895                ),
2896                encoder, offset, _depth
2897            )
2898        }
2899    }
2900    unsafe impl<
2901            D: fidl::encoding::ResourceDialect,
2902            T0: fidl::encoding::Encode<fidl::encoding::Vector<InputReport, 50>, D>,
2903        > fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D> for (T0,)
2904    {
2905        #[inline]
2906        unsafe fn encode(
2907            self,
2908            encoder: &mut fidl::encoding::Encoder<'_, D>,
2909            offset: usize,
2910            depth: fidl::encoding::Depth,
2911        ) -> fidl::Result<()> {
2912            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2913            // Zero out padding regions. There's no need to apply masks
2914            // because the unmasked parts will be overwritten by fields.
2915            // Write the fields.
2916            self.0.encode(encoder, offset + 0, depth)?;
2917            Ok(())
2918        }
2919    }
2920
2921    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2922        for InputReportsReaderReadInputReportsResponse
2923    {
2924        #[inline(always)]
2925        fn new_empty() -> Self {
2926            Self { reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, D) }
2927        }
2928
2929        #[inline]
2930        unsafe fn decode(
2931            &mut self,
2932            decoder: &mut fidl::encoding::Decoder<'_, D>,
2933            offset: usize,
2934            _depth: fidl::encoding::Depth,
2935        ) -> fidl::Result<()> {
2936            decoder.debug_check_bounds::<Self>(offset);
2937            // Verify that padding bytes are zero.
2938            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, D, &mut self.reports, decoder, offset + 0, _depth)?;
2939            Ok(())
2940        }
2941    }
2942
2943    impl fidl::encoding::ValueTypeMarker for Range {
2944        type Borrowed<'a> = &'a Self;
2945        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2946            value
2947        }
2948    }
2949
2950    unsafe impl fidl::encoding::TypeMarker for Range {
2951        type Owned = Self;
2952
2953        #[inline(always)]
2954        fn inline_align(_context: fidl::encoding::Context) -> usize {
2955            8
2956        }
2957
2958        #[inline(always)]
2959        fn inline_size(_context: fidl::encoding::Context) -> usize {
2960            16
2961        }
2962        #[inline(always)]
2963        fn encode_is_copy() -> bool {
2964            true
2965        }
2966
2967        #[inline(always)]
2968        fn decode_is_copy() -> bool {
2969            true
2970        }
2971    }
2972
2973    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
2974        #[inline]
2975        unsafe fn encode(
2976            self,
2977            encoder: &mut fidl::encoding::Encoder<'_, D>,
2978            offset: usize,
2979            _depth: fidl::encoding::Depth,
2980        ) -> fidl::Result<()> {
2981            encoder.debug_check_bounds::<Range>(offset);
2982            unsafe {
2983                // Copy the object into the buffer.
2984                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2985                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
2986                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2987                // done second because the memcpy will write garbage to these bytes.
2988            }
2989            Ok(())
2990        }
2991    }
2992    unsafe impl<
2993            D: fidl::encoding::ResourceDialect,
2994            T0: fidl::encoding::Encode<i64, D>,
2995            T1: fidl::encoding::Encode<i64, D>,
2996        > fidl::encoding::Encode<Range, D> for (T0, T1)
2997    {
2998        #[inline]
2999        unsafe fn encode(
3000            self,
3001            encoder: &mut fidl::encoding::Encoder<'_, D>,
3002            offset: usize,
3003            depth: fidl::encoding::Depth,
3004        ) -> fidl::Result<()> {
3005            encoder.debug_check_bounds::<Range>(offset);
3006            // Zero out padding regions. There's no need to apply masks
3007            // because the unmasked parts will be overwritten by fields.
3008            // Write the fields.
3009            self.0.encode(encoder, offset + 0, depth)?;
3010            self.1.encode(encoder, offset + 8, depth)?;
3011            Ok(())
3012        }
3013    }
3014
3015    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
3016        #[inline(always)]
3017        fn new_empty() -> Self {
3018            Self { min: fidl::new_empty!(i64, D), max: fidl::new_empty!(i64, D) }
3019        }
3020
3021        #[inline]
3022        unsafe fn decode(
3023            &mut self,
3024            decoder: &mut fidl::encoding::Decoder<'_, D>,
3025            offset: usize,
3026            _depth: fidl::encoding::Depth,
3027        ) -> fidl::Result<()> {
3028            decoder.debug_check_bounds::<Self>(offset);
3029            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3030            // Verify that padding bytes are zero.
3031            // Copy from the buffer into the object.
3032            unsafe {
3033                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3034            }
3035            Ok(())
3036        }
3037    }
3038
3039    impl fidl::encoding::ValueTypeMarker for SensorAxis {
3040        type Borrowed<'a> = &'a Self;
3041        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3042            value
3043        }
3044    }
3045
3046    unsafe impl fidl::encoding::TypeMarker for SensorAxis {
3047        type Owned = Self;
3048
3049        #[inline(always)]
3050        fn inline_align(_context: fidl::encoding::Context) -> usize {
3051            8
3052        }
3053
3054        #[inline(always)]
3055        fn inline_size(_context: fidl::encoding::Context) -> usize {
3056            32
3057        }
3058    }
3059
3060    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorAxis, D>
3061        for &SensorAxis
3062    {
3063        #[inline]
3064        unsafe fn encode(
3065            self,
3066            encoder: &mut fidl::encoding::Encoder<'_, D>,
3067            offset: usize,
3068            _depth: fidl::encoding::Depth,
3069        ) -> fidl::Result<()> {
3070            encoder.debug_check_bounds::<SensorAxis>(offset);
3071            // Delegate to tuple encoding.
3072            fidl::encoding::Encode::<SensorAxis, D>::encode(
3073                (
3074                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.axis),
3075                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3076                ),
3077                encoder,
3078                offset,
3079                _depth,
3080            )
3081        }
3082    }
3083    unsafe impl<
3084            D: fidl::encoding::ResourceDialect,
3085            T0: fidl::encoding::Encode<Axis, D>,
3086            T1: fidl::encoding::Encode<SensorType, D>,
3087        > fidl::encoding::Encode<SensorAxis, D> for (T0, T1)
3088    {
3089        #[inline]
3090        unsafe fn encode(
3091            self,
3092            encoder: &mut fidl::encoding::Encoder<'_, D>,
3093            offset: usize,
3094            depth: fidl::encoding::Depth,
3095        ) -> fidl::Result<()> {
3096            encoder.debug_check_bounds::<SensorAxis>(offset);
3097            // Zero out padding regions. There's no need to apply masks
3098            // because the unmasked parts will be overwritten by fields.
3099            unsafe {
3100                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3101                (ptr as *mut u64).write_unaligned(0);
3102            }
3103            // Write the fields.
3104            self.0.encode(encoder, offset + 0, depth)?;
3105            self.1.encode(encoder, offset + 24, depth)?;
3106            Ok(())
3107        }
3108    }
3109
3110    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorAxis {
3111        #[inline(always)]
3112        fn new_empty() -> Self {
3113            Self { axis: fidl::new_empty!(Axis, D), type_: fidl::new_empty!(SensorType, D) }
3114        }
3115
3116        #[inline]
3117        unsafe fn decode(
3118            &mut self,
3119            decoder: &mut fidl::encoding::Decoder<'_, D>,
3120            offset: usize,
3121            _depth: fidl::encoding::Depth,
3122        ) -> fidl::Result<()> {
3123            decoder.debug_check_bounds::<Self>(offset);
3124            // Verify that padding bytes are zero.
3125            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3126            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3127            let mask = 0xffffffff00000000u64;
3128            let maskedval = padval & mask;
3129            if maskedval != 0 {
3130                return Err(fidl::Error::NonZeroPadding {
3131                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3132                });
3133            }
3134            fidl::decode!(Axis, D, &mut self.axis, decoder, offset + 0, _depth)?;
3135            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 24, _depth)?;
3136            Ok(())
3137        }
3138    }
3139
3140    impl fidl::encoding::ValueTypeMarker for Unit {
3141        type Borrowed<'a> = &'a Self;
3142        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3143            value
3144        }
3145    }
3146
3147    unsafe impl fidl::encoding::TypeMarker for Unit {
3148        type Owned = Self;
3149
3150        #[inline(always)]
3151        fn inline_align(_context: fidl::encoding::Context) -> usize {
3152            4
3153        }
3154
3155        #[inline(always)]
3156        fn inline_size(_context: fidl::encoding::Context) -> usize {
3157            8
3158        }
3159    }
3160
3161    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
3162        #[inline]
3163        unsafe fn encode(
3164            self,
3165            encoder: &mut fidl::encoding::Encoder<'_, D>,
3166            offset: usize,
3167            _depth: fidl::encoding::Depth,
3168        ) -> fidl::Result<()> {
3169            encoder.debug_check_bounds::<Unit>(offset);
3170            // Delegate to tuple encoding.
3171            fidl::encoding::Encode::<Unit, D>::encode(
3172                (
3173                    <UnitType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3174                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
3175                ),
3176                encoder,
3177                offset,
3178                _depth,
3179            )
3180        }
3181    }
3182    unsafe impl<
3183            D: fidl::encoding::ResourceDialect,
3184            T0: fidl::encoding::Encode<UnitType, D>,
3185            T1: fidl::encoding::Encode<i32, D>,
3186        > fidl::encoding::Encode<Unit, D> for (T0, T1)
3187    {
3188        #[inline]
3189        unsafe fn encode(
3190            self,
3191            encoder: &mut fidl::encoding::Encoder<'_, D>,
3192            offset: usize,
3193            depth: fidl::encoding::Depth,
3194        ) -> fidl::Result<()> {
3195            encoder.debug_check_bounds::<Unit>(offset);
3196            // Zero out padding regions. There's no need to apply masks
3197            // because the unmasked parts will be overwritten by fields.
3198            // Write the fields.
3199            self.0.encode(encoder, offset + 0, depth)?;
3200            self.1.encode(encoder, offset + 4, depth)?;
3201            Ok(())
3202        }
3203    }
3204
3205    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
3206        #[inline(always)]
3207        fn new_empty() -> Self {
3208            Self { type_: fidl::new_empty!(UnitType, D), exponent: fidl::new_empty!(i32, D) }
3209        }
3210
3211        #[inline]
3212        unsafe fn decode(
3213            &mut self,
3214            decoder: &mut fidl::encoding::Decoder<'_, D>,
3215            offset: usize,
3216            _depth: fidl::encoding::Depth,
3217        ) -> fidl::Result<()> {
3218            decoder.debug_check_bounds::<Self>(offset);
3219            // Verify that padding bytes are zero.
3220            fidl::decode!(UnitType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3221            fidl::decode!(i32, D, &mut self.exponent, decoder, offset + 4, _depth)?;
3222            Ok(())
3223        }
3224    }
3225
3226    impl ConsumerControlDescriptor {
3227        #[inline(always)]
3228        fn max_ordinal_present(&self) -> u64 {
3229            if let Some(_) = self.input {
3230                return 1;
3231            }
3232            0
3233        }
3234    }
3235
3236    impl fidl::encoding::ValueTypeMarker for ConsumerControlDescriptor {
3237        type Borrowed<'a> = &'a Self;
3238        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3239            value
3240        }
3241    }
3242
3243    unsafe impl fidl::encoding::TypeMarker for ConsumerControlDescriptor {
3244        type Owned = Self;
3245
3246        #[inline(always)]
3247        fn inline_align(_context: fidl::encoding::Context) -> usize {
3248            8
3249        }
3250
3251        #[inline(always)]
3252        fn inline_size(_context: fidl::encoding::Context) -> usize {
3253            16
3254        }
3255    }
3256
3257    unsafe impl<D: fidl::encoding::ResourceDialect>
3258        fidl::encoding::Encode<ConsumerControlDescriptor, D> for &ConsumerControlDescriptor
3259    {
3260        unsafe fn encode(
3261            self,
3262            encoder: &mut fidl::encoding::Encoder<'_, D>,
3263            offset: usize,
3264            mut depth: fidl::encoding::Depth,
3265        ) -> fidl::Result<()> {
3266            encoder.debug_check_bounds::<ConsumerControlDescriptor>(offset);
3267            // Vector header
3268            let max_ordinal: u64 = self.max_ordinal_present();
3269            encoder.write_num(max_ordinal, offset);
3270            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3271            // Calling encoder.out_of_line_offset(0) is not allowed.
3272            if max_ordinal == 0 {
3273                return Ok(());
3274            }
3275            depth.increment()?;
3276            let envelope_size = 8;
3277            let bytes_len = max_ordinal as usize * envelope_size;
3278            #[allow(unused_variables)]
3279            let offset = encoder.out_of_line_offset(bytes_len);
3280            let mut _prev_end_offset: usize = 0;
3281            if 1 > max_ordinal {
3282                return Ok(());
3283            }
3284
3285            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3286            // are envelope_size bytes.
3287            let cur_offset: usize = (1 - 1) * envelope_size;
3288
3289            // Zero reserved fields.
3290            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3291
3292            // Safety:
3293            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3294            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3295            //   envelope_size bytes, there is always sufficient room.
3296            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputDescriptor, D>(
3297                self.input.as_ref().map(
3298                    <ConsumerControlInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow,
3299                ),
3300                encoder,
3301                offset + cur_offset,
3302                depth,
3303            )?;
3304
3305            _prev_end_offset = cur_offset + envelope_size;
3306
3307            Ok(())
3308        }
3309    }
3310
3311    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3312        for ConsumerControlDescriptor
3313    {
3314        #[inline(always)]
3315        fn new_empty() -> Self {
3316            Self::default()
3317        }
3318
3319        unsafe fn decode(
3320            &mut self,
3321            decoder: &mut fidl::encoding::Decoder<'_, D>,
3322            offset: usize,
3323            mut depth: fidl::encoding::Depth,
3324        ) -> fidl::Result<()> {
3325            decoder.debug_check_bounds::<Self>(offset);
3326            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3327                None => return Err(fidl::Error::NotNullable),
3328                Some(len) => len,
3329            };
3330            // Calling decoder.out_of_line_offset(0) is not allowed.
3331            if len == 0 {
3332                return Ok(());
3333            };
3334            depth.increment()?;
3335            let envelope_size = 8;
3336            let bytes_len = len * envelope_size;
3337            let offset = decoder.out_of_line_offset(bytes_len)?;
3338            // Decode the envelope for each type.
3339            let mut _next_ordinal_to_read = 0;
3340            let mut next_offset = offset;
3341            let end_offset = offset + bytes_len;
3342            _next_ordinal_to_read += 1;
3343            if next_offset >= end_offset {
3344                return Ok(());
3345            }
3346
3347            // Decode unknown envelopes for gaps in ordinals.
3348            while _next_ordinal_to_read < 1 {
3349                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3350                _next_ordinal_to_read += 1;
3351                next_offset += envelope_size;
3352            }
3353
3354            let next_out_of_line = decoder.next_out_of_line();
3355            let handles_before = decoder.remaining_handles();
3356            if let Some((inlined, num_bytes, num_handles)) =
3357                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3358            {
3359                let member_inline_size =
3360                    <ConsumerControlInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
3361                        decoder.context,
3362                    );
3363                if inlined != (member_inline_size <= 4) {
3364                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3365                }
3366                let inner_offset;
3367                let mut inner_depth = depth.clone();
3368                if inlined {
3369                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3370                    inner_offset = next_offset;
3371                } else {
3372                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3373                    inner_depth.increment()?;
3374                }
3375                let val_ref = self
3376                    .input
3377                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputDescriptor, D));
3378                fidl::decode!(
3379                    ConsumerControlInputDescriptor,
3380                    D,
3381                    val_ref,
3382                    decoder,
3383                    inner_offset,
3384                    inner_depth
3385                )?;
3386                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3387                {
3388                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3389                }
3390                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3391                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3392                }
3393            }
3394
3395            next_offset += envelope_size;
3396
3397            // Decode the remaining unknown envelopes.
3398            while next_offset < end_offset {
3399                _next_ordinal_to_read += 1;
3400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3401                next_offset += envelope_size;
3402            }
3403
3404            Ok(())
3405        }
3406    }
3407
3408    impl ConsumerControlInputDescriptor {
3409        #[inline(always)]
3410        fn max_ordinal_present(&self) -> u64 {
3411            if let Some(_) = self.buttons {
3412                return 1;
3413            }
3414            0
3415        }
3416    }
3417
3418    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputDescriptor {
3419        type Borrowed<'a> = &'a Self;
3420        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3421            value
3422        }
3423    }
3424
3425    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputDescriptor {
3426        type Owned = Self;
3427
3428        #[inline(always)]
3429        fn inline_align(_context: fidl::encoding::Context) -> usize {
3430            8
3431        }
3432
3433        #[inline(always)]
3434        fn inline_size(_context: fidl::encoding::Context) -> usize {
3435            16
3436        }
3437    }
3438
3439    unsafe impl<D: fidl::encoding::ResourceDialect>
3440        fidl::encoding::Encode<ConsumerControlInputDescriptor, D>
3441        for &ConsumerControlInputDescriptor
3442    {
3443        unsafe fn encode(
3444            self,
3445            encoder: &mut fidl::encoding::Encoder<'_, D>,
3446            offset: usize,
3447            mut depth: fidl::encoding::Depth,
3448        ) -> fidl::Result<()> {
3449            encoder.debug_check_bounds::<ConsumerControlInputDescriptor>(offset);
3450            // Vector header
3451            let max_ordinal: u64 = self.max_ordinal_present();
3452            encoder.write_num(max_ordinal, offset);
3453            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3454            // Calling encoder.out_of_line_offset(0) is not allowed.
3455            if max_ordinal == 0 {
3456                return Ok(());
3457            }
3458            depth.increment()?;
3459            let envelope_size = 8;
3460            let bytes_len = max_ordinal as usize * envelope_size;
3461            #[allow(unused_variables)]
3462            let offset = encoder.out_of_line_offset(bytes_len);
3463            let mut _prev_end_offset: usize = 0;
3464            if 1 > max_ordinal {
3465                return Ok(());
3466            }
3467
3468            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3469            // are envelope_size bytes.
3470            let cur_offset: usize = (1 - 1) * envelope_size;
3471
3472            // Zero reserved fields.
3473            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3474
3475            // Safety:
3476            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3477            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3478            //   envelope_size bytes, there is always sufficient room.
3479            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3480            self.buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3481            encoder, offset + cur_offset, depth
3482        )?;
3483
3484            _prev_end_offset = cur_offset + envelope_size;
3485
3486            Ok(())
3487        }
3488    }
3489
3490    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3491        for ConsumerControlInputDescriptor
3492    {
3493        #[inline(always)]
3494        fn new_empty() -> Self {
3495            Self::default()
3496        }
3497
3498        unsafe fn decode(
3499            &mut self,
3500            decoder: &mut fidl::encoding::Decoder<'_, D>,
3501            offset: usize,
3502            mut depth: fidl::encoding::Depth,
3503        ) -> fidl::Result<()> {
3504            decoder.debug_check_bounds::<Self>(offset);
3505            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3506                None => return Err(fidl::Error::NotNullable),
3507                Some(len) => len,
3508            };
3509            // Calling decoder.out_of_line_offset(0) is not allowed.
3510            if len == 0 {
3511                return Ok(());
3512            };
3513            depth.increment()?;
3514            let envelope_size = 8;
3515            let bytes_len = len * envelope_size;
3516            let offset = decoder.out_of_line_offset(bytes_len)?;
3517            // Decode the envelope for each type.
3518            let mut _next_ordinal_to_read = 0;
3519            let mut next_offset = offset;
3520            let end_offset = offset + bytes_len;
3521            _next_ordinal_to_read += 1;
3522            if next_offset >= end_offset {
3523                return Ok(());
3524            }
3525
3526            // Decode unknown envelopes for gaps in ordinals.
3527            while _next_ordinal_to_read < 1 {
3528                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3529                _next_ordinal_to_read += 1;
3530                next_offset += envelope_size;
3531            }
3532
3533            let next_out_of_line = decoder.next_out_of_line();
3534            let handles_before = decoder.remaining_handles();
3535            if let Some((inlined, num_bytes, num_handles)) =
3536                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3537            {
3538                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3539                if inlined != (member_inline_size <= 4) {
3540                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3541                }
3542                let inner_offset;
3543                let mut inner_depth = depth.clone();
3544                if inlined {
3545                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3546                    inner_offset = next_offset;
3547                } else {
3548                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3549                    inner_depth.increment()?;
3550                }
3551                let val_ref = self.buttons.get_or_insert_with(
3552                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3553                );
3554                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3555                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3556                {
3557                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3558                }
3559                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3560                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3561                }
3562            }
3563
3564            next_offset += envelope_size;
3565
3566            // Decode the remaining unknown envelopes.
3567            while next_offset < end_offset {
3568                _next_ordinal_to_read += 1;
3569                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3570                next_offset += envelope_size;
3571            }
3572
3573            Ok(())
3574        }
3575    }
3576
3577    impl ConsumerControlInputReport {
3578        #[inline(always)]
3579        fn max_ordinal_present(&self) -> u64 {
3580            if let Some(_) = self.pressed_buttons {
3581                return 1;
3582            }
3583            0
3584        }
3585    }
3586
3587    impl fidl::encoding::ValueTypeMarker for ConsumerControlInputReport {
3588        type Borrowed<'a> = &'a Self;
3589        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3590            value
3591        }
3592    }
3593
3594    unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputReport {
3595        type Owned = Self;
3596
3597        #[inline(always)]
3598        fn inline_align(_context: fidl::encoding::Context) -> usize {
3599            8
3600        }
3601
3602        #[inline(always)]
3603        fn inline_size(_context: fidl::encoding::Context) -> usize {
3604            16
3605        }
3606    }
3607
3608    unsafe impl<D: fidl::encoding::ResourceDialect>
3609        fidl::encoding::Encode<ConsumerControlInputReport, D> for &ConsumerControlInputReport
3610    {
3611        unsafe fn encode(
3612            self,
3613            encoder: &mut fidl::encoding::Encoder<'_, D>,
3614            offset: usize,
3615            mut depth: fidl::encoding::Depth,
3616        ) -> fidl::Result<()> {
3617            encoder.debug_check_bounds::<ConsumerControlInputReport>(offset);
3618            // Vector header
3619            let max_ordinal: u64 = self.max_ordinal_present();
3620            encoder.write_num(max_ordinal, offset);
3621            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3622            // Calling encoder.out_of_line_offset(0) is not allowed.
3623            if max_ordinal == 0 {
3624                return Ok(());
3625            }
3626            depth.increment()?;
3627            let envelope_size = 8;
3628            let bytes_len = max_ordinal as usize * envelope_size;
3629            #[allow(unused_variables)]
3630            let offset = encoder.out_of_line_offset(bytes_len);
3631            let mut _prev_end_offset: usize = 0;
3632            if 1 > max_ordinal {
3633                return Ok(());
3634            }
3635
3636            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3637            // are envelope_size bytes.
3638            let cur_offset: usize = (1 - 1) * envelope_size;
3639
3640            // Zero reserved fields.
3641            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3642
3643            // Safety:
3644            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3645            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3646            //   envelope_size bytes, there is always sufficient room.
3647            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3648            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3649            encoder, offset + cur_offset, depth
3650        )?;
3651
3652            _prev_end_offset = cur_offset + envelope_size;
3653
3654            Ok(())
3655        }
3656    }
3657
3658    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3659        for ConsumerControlInputReport
3660    {
3661        #[inline(always)]
3662        fn new_empty() -> Self {
3663            Self::default()
3664        }
3665
3666        unsafe fn decode(
3667            &mut self,
3668            decoder: &mut fidl::encoding::Decoder<'_, D>,
3669            offset: usize,
3670            mut depth: fidl::encoding::Depth,
3671        ) -> fidl::Result<()> {
3672            decoder.debug_check_bounds::<Self>(offset);
3673            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3674                None => return Err(fidl::Error::NotNullable),
3675                Some(len) => len,
3676            };
3677            // Calling decoder.out_of_line_offset(0) is not allowed.
3678            if len == 0 {
3679                return Ok(());
3680            };
3681            depth.increment()?;
3682            let envelope_size = 8;
3683            let bytes_len = len * envelope_size;
3684            let offset = decoder.out_of_line_offset(bytes_len)?;
3685            // Decode the envelope for each type.
3686            let mut _next_ordinal_to_read = 0;
3687            let mut next_offset = offset;
3688            let end_offset = offset + bytes_len;
3689            _next_ordinal_to_read += 1;
3690            if next_offset >= end_offset {
3691                return Ok(());
3692            }
3693
3694            // Decode unknown envelopes for gaps in ordinals.
3695            while _next_ordinal_to_read < 1 {
3696                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3697                _next_ordinal_to_read += 1;
3698                next_offset += envelope_size;
3699            }
3700
3701            let next_out_of_line = decoder.next_out_of_line();
3702            let handles_before = decoder.remaining_handles();
3703            if let Some((inlined, num_bytes, num_handles)) =
3704                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3705            {
3706                let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3707                if inlined != (member_inline_size <= 4) {
3708                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3709                }
3710                let inner_offset;
3711                let mut inner_depth = depth.clone();
3712                if inlined {
3713                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3714                    inner_offset = next_offset;
3715                } else {
3716                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3717                    inner_depth.increment()?;
3718                }
3719                let val_ref = self.pressed_buttons.get_or_insert_with(
3720                    || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3721                );
3722                fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3723                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3724                {
3725                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3726                }
3727                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3728                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3729                }
3730            }
3731
3732            next_offset += envelope_size;
3733
3734            // Decode the remaining unknown envelopes.
3735            while next_offset < end_offset {
3736                _next_ordinal_to_read += 1;
3737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3738                next_offset += envelope_size;
3739            }
3740
3741            Ok(())
3742        }
3743    }
3744
3745    impl ContactInputDescriptor {
3746        #[inline(always)]
3747        fn max_ordinal_present(&self) -> u64 {
3748            if let Some(_) = self.contact_height {
3749                return 5;
3750            }
3751            if let Some(_) = self.contact_width {
3752                return 4;
3753            }
3754            if let Some(_) = self.pressure {
3755                return 3;
3756            }
3757            if let Some(_) = self.position_y {
3758                return 2;
3759            }
3760            if let Some(_) = self.position_x {
3761                return 1;
3762            }
3763            0
3764        }
3765    }
3766
3767    impl fidl::encoding::ValueTypeMarker for ContactInputDescriptor {
3768        type Borrowed<'a> = &'a Self;
3769        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3770            value
3771        }
3772    }
3773
3774    unsafe impl fidl::encoding::TypeMarker for ContactInputDescriptor {
3775        type Owned = Self;
3776
3777        #[inline(always)]
3778        fn inline_align(_context: fidl::encoding::Context) -> usize {
3779            8
3780        }
3781
3782        #[inline(always)]
3783        fn inline_size(_context: fidl::encoding::Context) -> usize {
3784            16
3785        }
3786    }
3787
3788    unsafe impl<D: fidl::encoding::ResourceDialect>
3789        fidl::encoding::Encode<ContactInputDescriptor, D> for &ContactInputDescriptor
3790    {
3791        unsafe fn encode(
3792            self,
3793            encoder: &mut fidl::encoding::Encoder<'_, D>,
3794            offset: usize,
3795            mut depth: fidl::encoding::Depth,
3796        ) -> fidl::Result<()> {
3797            encoder.debug_check_bounds::<ContactInputDescriptor>(offset);
3798            // Vector header
3799            let max_ordinal: u64 = self.max_ordinal_present();
3800            encoder.write_num(max_ordinal, offset);
3801            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3802            // Calling encoder.out_of_line_offset(0) is not allowed.
3803            if max_ordinal == 0 {
3804                return Ok(());
3805            }
3806            depth.increment()?;
3807            let envelope_size = 8;
3808            let bytes_len = max_ordinal as usize * envelope_size;
3809            #[allow(unused_variables)]
3810            let offset = encoder.out_of_line_offset(bytes_len);
3811            let mut _prev_end_offset: usize = 0;
3812            if 1 > max_ordinal {
3813                return Ok(());
3814            }
3815
3816            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3817            // are envelope_size bytes.
3818            let cur_offset: usize = (1 - 1) * envelope_size;
3819
3820            // Zero reserved fields.
3821            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3822
3823            // Safety:
3824            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3825            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3826            //   envelope_size bytes, there is always sufficient room.
3827            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3828                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3829                encoder,
3830                offset + cur_offset,
3831                depth,
3832            )?;
3833
3834            _prev_end_offset = cur_offset + envelope_size;
3835            if 2 > max_ordinal {
3836                return Ok(());
3837            }
3838
3839            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3840            // are envelope_size bytes.
3841            let cur_offset: usize = (2 - 1) * envelope_size;
3842
3843            // Zero reserved fields.
3844            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3845
3846            // Safety:
3847            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3848            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3849            //   envelope_size bytes, there is always sufficient room.
3850            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3851                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3852                encoder,
3853                offset + cur_offset,
3854                depth,
3855            )?;
3856
3857            _prev_end_offset = cur_offset + envelope_size;
3858            if 3 > max_ordinal {
3859                return Ok(());
3860            }
3861
3862            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3863            // are envelope_size bytes.
3864            let cur_offset: usize = (3 - 1) * envelope_size;
3865
3866            // Zero reserved fields.
3867            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3868
3869            // Safety:
3870            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3871            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3872            //   envelope_size bytes, there is always sufficient room.
3873            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3874                self.pressure.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3875                encoder,
3876                offset + cur_offset,
3877                depth,
3878            )?;
3879
3880            _prev_end_offset = cur_offset + envelope_size;
3881            if 4 > max_ordinal {
3882                return Ok(());
3883            }
3884
3885            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3886            // are envelope_size bytes.
3887            let cur_offset: usize = (4 - 1) * envelope_size;
3888
3889            // Zero reserved fields.
3890            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3891
3892            // Safety:
3893            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3894            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3895            //   envelope_size bytes, there is always sufficient room.
3896            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3897                self.contact_width.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3898                encoder,
3899                offset + cur_offset,
3900                depth,
3901            )?;
3902
3903            _prev_end_offset = cur_offset + envelope_size;
3904            if 5 > max_ordinal {
3905                return Ok(());
3906            }
3907
3908            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3909            // are envelope_size bytes.
3910            let cur_offset: usize = (5 - 1) * envelope_size;
3911
3912            // Zero reserved fields.
3913            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3914
3915            // Safety:
3916            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3917            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3918            //   envelope_size bytes, there is always sufficient room.
3919            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3920                self.contact_height.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3921                encoder,
3922                offset + cur_offset,
3923                depth,
3924            )?;
3925
3926            _prev_end_offset = cur_offset + envelope_size;
3927
3928            Ok(())
3929        }
3930    }
3931
3932    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3933        for ContactInputDescriptor
3934    {
3935        #[inline(always)]
3936        fn new_empty() -> Self {
3937            Self::default()
3938        }
3939
3940        unsafe fn decode(
3941            &mut self,
3942            decoder: &mut fidl::encoding::Decoder<'_, D>,
3943            offset: usize,
3944            mut depth: fidl::encoding::Depth,
3945        ) -> fidl::Result<()> {
3946            decoder.debug_check_bounds::<Self>(offset);
3947            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3948                None => return Err(fidl::Error::NotNullable),
3949                Some(len) => len,
3950            };
3951            // Calling decoder.out_of_line_offset(0) is not allowed.
3952            if len == 0 {
3953                return Ok(());
3954            };
3955            depth.increment()?;
3956            let envelope_size = 8;
3957            let bytes_len = len * envelope_size;
3958            let offset = decoder.out_of_line_offset(bytes_len)?;
3959            // Decode the envelope for each type.
3960            let mut _next_ordinal_to_read = 0;
3961            let mut next_offset = offset;
3962            let end_offset = offset + bytes_len;
3963            _next_ordinal_to_read += 1;
3964            if next_offset >= end_offset {
3965                return Ok(());
3966            }
3967
3968            // Decode unknown envelopes for gaps in ordinals.
3969            while _next_ordinal_to_read < 1 {
3970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3971                _next_ordinal_to_read += 1;
3972                next_offset += envelope_size;
3973            }
3974
3975            let next_out_of_line = decoder.next_out_of_line();
3976            let handles_before = decoder.remaining_handles();
3977            if let Some((inlined, num_bytes, num_handles)) =
3978                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3979            {
3980                let member_inline_size =
3981                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3982                if inlined != (member_inline_size <= 4) {
3983                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3984                }
3985                let inner_offset;
3986                let mut inner_depth = depth.clone();
3987                if inlined {
3988                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3989                    inner_offset = next_offset;
3990                } else {
3991                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3992                    inner_depth.increment()?;
3993                }
3994                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
3995                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
3996                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3997                {
3998                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3999                }
4000                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4001                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4002                }
4003            }
4004
4005            next_offset += envelope_size;
4006            _next_ordinal_to_read += 1;
4007            if next_offset >= end_offset {
4008                return Ok(());
4009            }
4010
4011            // Decode unknown envelopes for gaps in ordinals.
4012            while _next_ordinal_to_read < 2 {
4013                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4014                _next_ordinal_to_read += 1;
4015                next_offset += envelope_size;
4016            }
4017
4018            let next_out_of_line = decoder.next_out_of_line();
4019            let handles_before = decoder.remaining_handles();
4020            if let Some((inlined, num_bytes, num_handles)) =
4021                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4022            {
4023                let member_inline_size =
4024                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4025                if inlined != (member_inline_size <= 4) {
4026                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4027                }
4028                let inner_offset;
4029                let mut inner_depth = depth.clone();
4030                if inlined {
4031                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4032                    inner_offset = next_offset;
4033                } else {
4034                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4035                    inner_depth.increment()?;
4036                }
4037                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4038                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4039                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4040                {
4041                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4042                }
4043                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4044                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4045                }
4046            }
4047
4048            next_offset += envelope_size;
4049            _next_ordinal_to_read += 1;
4050            if next_offset >= end_offset {
4051                return Ok(());
4052            }
4053
4054            // Decode unknown envelopes for gaps in ordinals.
4055            while _next_ordinal_to_read < 3 {
4056                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4057                _next_ordinal_to_read += 1;
4058                next_offset += envelope_size;
4059            }
4060
4061            let next_out_of_line = decoder.next_out_of_line();
4062            let handles_before = decoder.remaining_handles();
4063            if let Some((inlined, num_bytes, num_handles)) =
4064                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4065            {
4066                let member_inline_size =
4067                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4068                if inlined != (member_inline_size <= 4) {
4069                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4070                }
4071                let inner_offset;
4072                let mut inner_depth = depth.clone();
4073                if inlined {
4074                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4075                    inner_offset = next_offset;
4076                } else {
4077                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4078                    inner_depth.increment()?;
4079                }
4080                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4081                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4082                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4083                {
4084                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4085                }
4086                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4087                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4088                }
4089            }
4090
4091            next_offset += envelope_size;
4092            _next_ordinal_to_read += 1;
4093            if next_offset >= end_offset {
4094                return Ok(());
4095            }
4096
4097            // Decode unknown envelopes for gaps in ordinals.
4098            while _next_ordinal_to_read < 4 {
4099                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4100                _next_ordinal_to_read += 1;
4101                next_offset += envelope_size;
4102            }
4103
4104            let next_out_of_line = decoder.next_out_of_line();
4105            let handles_before = decoder.remaining_handles();
4106            if let Some((inlined, num_bytes, num_handles)) =
4107                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4108            {
4109                let member_inline_size =
4110                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4111                if inlined != (member_inline_size <= 4) {
4112                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4113                }
4114                let inner_offset;
4115                let mut inner_depth = depth.clone();
4116                if inlined {
4117                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4118                    inner_offset = next_offset;
4119                } else {
4120                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4121                    inner_depth.increment()?;
4122                }
4123                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4124                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4125                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4126                {
4127                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4128                }
4129                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4130                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4131                }
4132            }
4133
4134            next_offset += envelope_size;
4135            _next_ordinal_to_read += 1;
4136            if next_offset >= end_offset {
4137                return Ok(());
4138            }
4139
4140            // Decode unknown envelopes for gaps in ordinals.
4141            while _next_ordinal_to_read < 5 {
4142                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4143                _next_ordinal_to_read += 1;
4144                next_offset += envelope_size;
4145            }
4146
4147            let next_out_of_line = decoder.next_out_of_line();
4148            let handles_before = decoder.remaining_handles();
4149            if let Some((inlined, num_bytes, num_handles)) =
4150                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4151            {
4152                let member_inline_size =
4153                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4154                if inlined != (member_inline_size <= 4) {
4155                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4156                }
4157                let inner_offset;
4158                let mut inner_depth = depth.clone();
4159                if inlined {
4160                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4161                    inner_offset = next_offset;
4162                } else {
4163                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4164                    inner_depth.increment()?;
4165                }
4166                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4167                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4168                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4169                {
4170                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4171                }
4172                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4173                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4174                }
4175            }
4176
4177            next_offset += envelope_size;
4178
4179            // Decode the remaining unknown envelopes.
4180            while next_offset < end_offset {
4181                _next_ordinal_to_read += 1;
4182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4183                next_offset += envelope_size;
4184            }
4185
4186            Ok(())
4187        }
4188    }
4189
4190    impl ContactInputReport {
4191        #[inline(always)]
4192        fn max_ordinal_present(&self) -> u64 {
4193            if let Some(_) = self.confidence {
4194                return 7;
4195            }
4196            if let Some(_) = self.contact_height {
4197                return 6;
4198            }
4199            if let Some(_) = self.contact_width {
4200                return 5;
4201            }
4202            if let Some(_) = self.pressure {
4203                return 4;
4204            }
4205            if let Some(_) = self.position_y {
4206                return 3;
4207            }
4208            if let Some(_) = self.position_x {
4209                return 2;
4210            }
4211            if let Some(_) = self.contact_id {
4212                return 1;
4213            }
4214            0
4215        }
4216    }
4217
4218    impl fidl::encoding::ValueTypeMarker for ContactInputReport {
4219        type Borrowed<'a> = &'a Self;
4220        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4221            value
4222        }
4223    }
4224
4225    unsafe impl fidl::encoding::TypeMarker for ContactInputReport {
4226        type Owned = Self;
4227
4228        #[inline(always)]
4229        fn inline_align(_context: fidl::encoding::Context) -> usize {
4230            8
4231        }
4232
4233        #[inline(always)]
4234        fn inline_size(_context: fidl::encoding::Context) -> usize {
4235            16
4236        }
4237    }
4238
4239    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContactInputReport, D>
4240        for &ContactInputReport
4241    {
4242        unsafe fn encode(
4243            self,
4244            encoder: &mut fidl::encoding::Encoder<'_, D>,
4245            offset: usize,
4246            mut depth: fidl::encoding::Depth,
4247        ) -> fidl::Result<()> {
4248            encoder.debug_check_bounds::<ContactInputReport>(offset);
4249            // Vector header
4250            let max_ordinal: u64 = self.max_ordinal_present();
4251            encoder.write_num(max_ordinal, offset);
4252            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4253            // Calling encoder.out_of_line_offset(0) is not allowed.
4254            if max_ordinal == 0 {
4255                return Ok(());
4256            }
4257            depth.increment()?;
4258            let envelope_size = 8;
4259            let bytes_len = max_ordinal as usize * envelope_size;
4260            #[allow(unused_variables)]
4261            let offset = encoder.out_of_line_offset(bytes_len);
4262            let mut _prev_end_offset: usize = 0;
4263            if 1 > max_ordinal {
4264                return Ok(());
4265            }
4266
4267            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4268            // are envelope_size bytes.
4269            let cur_offset: usize = (1 - 1) * envelope_size;
4270
4271            // Zero reserved fields.
4272            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4273
4274            // Safety:
4275            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4276            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4277            //   envelope_size bytes, there is always sufficient room.
4278            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4279                self.contact_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4280                encoder,
4281                offset + cur_offset,
4282                depth,
4283            )?;
4284
4285            _prev_end_offset = cur_offset + envelope_size;
4286            if 2 > max_ordinal {
4287                return Ok(());
4288            }
4289
4290            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4291            // are envelope_size bytes.
4292            let cur_offset: usize = (2 - 1) * envelope_size;
4293
4294            // Zero reserved fields.
4295            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4296
4297            // Safety:
4298            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4299            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4300            //   envelope_size bytes, there is always sufficient room.
4301            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4302                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4303                encoder,
4304                offset + cur_offset,
4305                depth,
4306            )?;
4307
4308            _prev_end_offset = cur_offset + envelope_size;
4309            if 3 > max_ordinal {
4310                return Ok(());
4311            }
4312
4313            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4314            // are envelope_size bytes.
4315            let cur_offset: usize = (3 - 1) * envelope_size;
4316
4317            // Zero reserved fields.
4318            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4319
4320            // Safety:
4321            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4322            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4323            //   envelope_size bytes, there is always sufficient room.
4324            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4325                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4326                encoder,
4327                offset + cur_offset,
4328                depth,
4329            )?;
4330
4331            _prev_end_offset = cur_offset + envelope_size;
4332            if 4 > max_ordinal {
4333                return Ok(());
4334            }
4335
4336            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4337            // are envelope_size bytes.
4338            let cur_offset: usize = (4 - 1) * envelope_size;
4339
4340            // Zero reserved fields.
4341            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4342
4343            // Safety:
4344            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4345            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4346            //   envelope_size bytes, there is always sufficient room.
4347            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4348                self.pressure.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4349                encoder,
4350                offset + cur_offset,
4351                depth,
4352            )?;
4353
4354            _prev_end_offset = cur_offset + envelope_size;
4355            if 5 > max_ordinal {
4356                return Ok(());
4357            }
4358
4359            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4360            // are envelope_size bytes.
4361            let cur_offset: usize = (5 - 1) * envelope_size;
4362
4363            // Zero reserved fields.
4364            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4365
4366            // Safety:
4367            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4368            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4369            //   envelope_size bytes, there is always sufficient room.
4370            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4371                self.contact_width.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4372                encoder,
4373                offset + cur_offset,
4374                depth,
4375            )?;
4376
4377            _prev_end_offset = cur_offset + envelope_size;
4378            if 6 > max_ordinal {
4379                return Ok(());
4380            }
4381
4382            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4383            // are envelope_size bytes.
4384            let cur_offset: usize = (6 - 1) * envelope_size;
4385
4386            // Zero reserved fields.
4387            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4388
4389            // Safety:
4390            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4391            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4392            //   envelope_size bytes, there is always sufficient room.
4393            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4394                self.contact_height.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4395                encoder,
4396                offset + cur_offset,
4397                depth,
4398            )?;
4399
4400            _prev_end_offset = cur_offset + envelope_size;
4401            if 7 > max_ordinal {
4402                return Ok(());
4403            }
4404
4405            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4406            // are envelope_size bytes.
4407            let cur_offset: usize = (7 - 1) * envelope_size;
4408
4409            // Zero reserved fields.
4410            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4411
4412            // Safety:
4413            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4414            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4415            //   envelope_size bytes, there is always sufficient room.
4416            fidl::encoding::encode_in_envelope_optional::<bool, D>(
4417                self.confidence.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4418                encoder,
4419                offset + cur_offset,
4420                depth,
4421            )?;
4422
4423            _prev_end_offset = cur_offset + envelope_size;
4424
4425            Ok(())
4426        }
4427    }
4428
4429    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContactInputReport {
4430        #[inline(always)]
4431        fn new_empty() -> Self {
4432            Self::default()
4433        }
4434
4435        unsafe fn decode(
4436            &mut self,
4437            decoder: &mut fidl::encoding::Decoder<'_, D>,
4438            offset: usize,
4439            mut depth: fidl::encoding::Depth,
4440        ) -> fidl::Result<()> {
4441            decoder.debug_check_bounds::<Self>(offset);
4442            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4443                None => return Err(fidl::Error::NotNullable),
4444                Some(len) => len,
4445            };
4446            // Calling decoder.out_of_line_offset(0) is not allowed.
4447            if len == 0 {
4448                return Ok(());
4449            };
4450            depth.increment()?;
4451            let envelope_size = 8;
4452            let bytes_len = len * envelope_size;
4453            let offset = decoder.out_of_line_offset(bytes_len)?;
4454            // Decode the envelope for each type.
4455            let mut _next_ordinal_to_read = 0;
4456            let mut next_offset = offset;
4457            let end_offset = offset + bytes_len;
4458            _next_ordinal_to_read += 1;
4459            if next_offset >= end_offset {
4460                return Ok(());
4461            }
4462
4463            // Decode unknown envelopes for gaps in ordinals.
4464            while _next_ordinal_to_read < 1 {
4465                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4466                _next_ordinal_to_read += 1;
4467                next_offset += envelope_size;
4468            }
4469
4470            let next_out_of_line = decoder.next_out_of_line();
4471            let handles_before = decoder.remaining_handles();
4472            if let Some((inlined, num_bytes, num_handles)) =
4473                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4474            {
4475                let member_inline_size =
4476                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4477                if inlined != (member_inline_size <= 4) {
4478                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4479                }
4480                let inner_offset;
4481                let mut inner_depth = depth.clone();
4482                if inlined {
4483                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4484                    inner_offset = next_offset;
4485                } else {
4486                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4487                    inner_depth.increment()?;
4488                }
4489                let val_ref = self.contact_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4490                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4491                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4492                {
4493                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4494                }
4495                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4496                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4497                }
4498            }
4499
4500            next_offset += envelope_size;
4501            _next_ordinal_to_read += 1;
4502            if next_offset >= end_offset {
4503                return Ok(());
4504            }
4505
4506            // Decode unknown envelopes for gaps in ordinals.
4507            while _next_ordinal_to_read < 2 {
4508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4509                _next_ordinal_to_read += 1;
4510                next_offset += envelope_size;
4511            }
4512
4513            let next_out_of_line = decoder.next_out_of_line();
4514            let handles_before = decoder.remaining_handles();
4515            if let Some((inlined, num_bytes, num_handles)) =
4516                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4517            {
4518                let member_inline_size =
4519                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4520                if inlined != (member_inline_size <= 4) {
4521                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4522                }
4523                let inner_offset;
4524                let mut inner_depth = depth.clone();
4525                if inlined {
4526                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4527                    inner_offset = next_offset;
4528                } else {
4529                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4530                    inner_depth.increment()?;
4531                }
4532                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
4533                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4534                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4535                {
4536                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4537                }
4538                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4539                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4540                }
4541            }
4542
4543            next_offset += envelope_size;
4544            _next_ordinal_to_read += 1;
4545            if next_offset >= end_offset {
4546                return Ok(());
4547            }
4548
4549            // Decode unknown envelopes for gaps in ordinals.
4550            while _next_ordinal_to_read < 3 {
4551                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4552                _next_ordinal_to_read += 1;
4553                next_offset += envelope_size;
4554            }
4555
4556            let next_out_of_line = decoder.next_out_of_line();
4557            let handles_before = decoder.remaining_handles();
4558            if let Some((inlined, num_bytes, num_handles)) =
4559                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4560            {
4561                let member_inline_size =
4562                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4563                if inlined != (member_inline_size <= 4) {
4564                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4565                }
4566                let inner_offset;
4567                let mut inner_depth = depth.clone();
4568                if inlined {
4569                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4570                    inner_offset = next_offset;
4571                } else {
4572                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4573                    inner_depth.increment()?;
4574                }
4575                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
4576                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4577                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4578                {
4579                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4580                }
4581                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4582                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4583                }
4584            }
4585
4586            next_offset += envelope_size;
4587            _next_ordinal_to_read += 1;
4588            if next_offset >= end_offset {
4589                return Ok(());
4590            }
4591
4592            // Decode unknown envelopes for gaps in ordinals.
4593            while _next_ordinal_to_read < 4 {
4594                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4595                _next_ordinal_to_read += 1;
4596                next_offset += envelope_size;
4597            }
4598
4599            let next_out_of_line = decoder.next_out_of_line();
4600            let handles_before = decoder.remaining_handles();
4601            if let Some((inlined, num_bytes, num_handles)) =
4602                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4603            {
4604                let member_inline_size =
4605                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4606                if inlined != (member_inline_size <= 4) {
4607                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4608                }
4609                let inner_offset;
4610                let mut inner_depth = depth.clone();
4611                if inlined {
4612                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4613                    inner_offset = next_offset;
4614                } else {
4615                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4616                    inner_depth.increment()?;
4617                }
4618                let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(i64, D));
4619                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4620                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4621                {
4622                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4623                }
4624                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4625                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4626                }
4627            }
4628
4629            next_offset += envelope_size;
4630            _next_ordinal_to_read += 1;
4631            if next_offset >= end_offset {
4632                return Ok(());
4633            }
4634
4635            // Decode unknown envelopes for gaps in ordinals.
4636            while _next_ordinal_to_read < 5 {
4637                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4638                _next_ordinal_to_read += 1;
4639                next_offset += envelope_size;
4640            }
4641
4642            let next_out_of_line = decoder.next_out_of_line();
4643            let handles_before = decoder.remaining_handles();
4644            if let Some((inlined, num_bytes, num_handles)) =
4645                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4646            {
4647                let member_inline_size =
4648                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4649                if inlined != (member_inline_size <= 4) {
4650                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4651                }
4652                let inner_offset;
4653                let mut inner_depth = depth.clone();
4654                if inlined {
4655                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4656                    inner_offset = next_offset;
4657                } else {
4658                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4659                    inner_depth.increment()?;
4660                }
4661                let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(i64, D));
4662                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4663                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4664                {
4665                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4666                }
4667                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4668                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4669                }
4670            }
4671
4672            next_offset += envelope_size;
4673            _next_ordinal_to_read += 1;
4674            if next_offset >= end_offset {
4675                return Ok(());
4676            }
4677
4678            // Decode unknown envelopes for gaps in ordinals.
4679            while _next_ordinal_to_read < 6 {
4680                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4681                _next_ordinal_to_read += 1;
4682                next_offset += envelope_size;
4683            }
4684
4685            let next_out_of_line = decoder.next_out_of_line();
4686            let handles_before = decoder.remaining_handles();
4687            if let Some((inlined, num_bytes, num_handles)) =
4688                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4689            {
4690                let member_inline_size =
4691                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4692                if inlined != (member_inline_size <= 4) {
4693                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4694                }
4695                let inner_offset;
4696                let mut inner_depth = depth.clone();
4697                if inlined {
4698                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4699                    inner_offset = next_offset;
4700                } else {
4701                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4702                    inner_depth.increment()?;
4703                }
4704                let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(i64, D));
4705                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4706                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4707                {
4708                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4709                }
4710                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4711                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4712                }
4713            }
4714
4715            next_offset += envelope_size;
4716            _next_ordinal_to_read += 1;
4717            if next_offset >= end_offset {
4718                return Ok(());
4719            }
4720
4721            // Decode unknown envelopes for gaps in ordinals.
4722            while _next_ordinal_to_read < 7 {
4723                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4724                _next_ordinal_to_read += 1;
4725                next_offset += envelope_size;
4726            }
4727
4728            let next_out_of_line = decoder.next_out_of_line();
4729            let handles_before = decoder.remaining_handles();
4730            if let Some((inlined, num_bytes, num_handles)) =
4731                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4732            {
4733                let member_inline_size =
4734                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4735                if inlined != (member_inline_size <= 4) {
4736                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4737                }
4738                let inner_offset;
4739                let mut inner_depth = depth.clone();
4740                if inlined {
4741                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4742                    inner_offset = next_offset;
4743                } else {
4744                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4745                    inner_depth.increment()?;
4746                }
4747                let val_ref = self.confidence.get_or_insert_with(|| fidl::new_empty!(bool, D));
4748                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4749                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4750                {
4751                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4752                }
4753                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4754                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4755                }
4756            }
4757
4758            next_offset += envelope_size;
4759
4760            // Decode the remaining unknown envelopes.
4761            while next_offset < end_offset {
4762                _next_ordinal_to_read += 1;
4763                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4764                next_offset += envelope_size;
4765            }
4766
4767            Ok(())
4768        }
4769    }
4770
4771    impl DeviceDescriptor {
4772        #[inline(always)]
4773        fn max_ordinal_present(&self) -> u64 {
4774            if let Some(_) = self.device_information {
4775                return 7;
4776            }
4777            if let Some(_) = self.consumer_control {
4778                return 6;
4779            }
4780            if let Some(_) = self.keyboard {
4781                return 5;
4782            }
4783            if let Some(_) = self.touch {
4784                return 4;
4785            }
4786            if let Some(_) = self.sensor {
4787                return 3;
4788            }
4789            if let Some(_) = self.mouse {
4790                return 2;
4791            }
4792            if let Some(_) = self.device_info {
4793                return 1;
4794            }
4795            0
4796        }
4797    }
4798
4799    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
4800        type Borrowed<'a> = &'a Self;
4801        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4802            value
4803        }
4804    }
4805
4806    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
4807        type Owned = Self;
4808
4809        #[inline(always)]
4810        fn inline_align(_context: fidl::encoding::Context) -> usize {
4811            8
4812        }
4813
4814        #[inline(always)]
4815        fn inline_size(_context: fidl::encoding::Context) -> usize {
4816            16
4817        }
4818    }
4819
4820    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
4821        for &DeviceDescriptor
4822    {
4823        unsafe fn encode(
4824            self,
4825            encoder: &mut fidl::encoding::Encoder<'_, D>,
4826            offset: usize,
4827            mut depth: fidl::encoding::Depth,
4828        ) -> fidl::Result<()> {
4829            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
4830            // Vector header
4831            let max_ordinal: u64 = self.max_ordinal_present();
4832            encoder.write_num(max_ordinal, offset);
4833            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4834            // Calling encoder.out_of_line_offset(0) is not allowed.
4835            if max_ordinal == 0 {
4836                return Ok(());
4837            }
4838            depth.increment()?;
4839            let envelope_size = 8;
4840            let bytes_len = max_ordinal as usize * envelope_size;
4841            #[allow(unused_variables)]
4842            let offset = encoder.out_of_line_offset(bytes_len);
4843            let mut _prev_end_offset: usize = 0;
4844            if 1 > max_ordinal {
4845                return Ok(());
4846            }
4847
4848            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4849            // are envelope_size bytes.
4850            let cur_offset: usize = (1 - 1) * envelope_size;
4851
4852            // Zero reserved fields.
4853            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4854
4855            // Safety:
4856            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4857            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4858            //   envelope_size bytes, there is always sufficient room.
4859            fidl::encoding::encode_in_envelope_optional::<DeviceInfo, D>(
4860                self.device_info
4861                    .as_ref()
4862                    .map(<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
4863                encoder,
4864                offset + cur_offset,
4865                depth,
4866            )?;
4867
4868            _prev_end_offset = cur_offset + envelope_size;
4869            if 2 > max_ordinal {
4870                return Ok(());
4871            }
4872
4873            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4874            // are envelope_size bytes.
4875            let cur_offset: usize = (2 - 1) * envelope_size;
4876
4877            // Zero reserved fields.
4878            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4879
4880            // Safety:
4881            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4882            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4883            //   envelope_size bytes, there is always sufficient room.
4884            fidl::encoding::encode_in_envelope_optional::<MouseDescriptor, D>(
4885                self.mouse
4886                    .as_ref()
4887                    .map(<MouseDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4888                encoder,
4889                offset + cur_offset,
4890                depth,
4891            )?;
4892
4893            _prev_end_offset = cur_offset + envelope_size;
4894            if 3 > max_ordinal {
4895                return Ok(());
4896            }
4897
4898            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4899            // are envelope_size bytes.
4900            let cur_offset: usize = (3 - 1) * envelope_size;
4901
4902            // Zero reserved fields.
4903            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4904
4905            // Safety:
4906            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4907            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4908            //   envelope_size bytes, there is always sufficient room.
4909            fidl::encoding::encode_in_envelope_optional::<SensorDescriptor, D>(
4910                self.sensor
4911                    .as_ref()
4912                    .map(<SensorDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4913                encoder,
4914                offset + cur_offset,
4915                depth,
4916            )?;
4917
4918            _prev_end_offset = cur_offset + envelope_size;
4919            if 4 > max_ordinal {
4920                return Ok(());
4921            }
4922
4923            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4924            // are envelope_size bytes.
4925            let cur_offset: usize = (4 - 1) * envelope_size;
4926
4927            // Zero reserved fields.
4928            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4929
4930            // Safety:
4931            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4932            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4933            //   envelope_size bytes, there is always sufficient room.
4934            fidl::encoding::encode_in_envelope_optional::<TouchDescriptor, D>(
4935                self.touch
4936                    .as_ref()
4937                    .map(<TouchDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4938                encoder,
4939                offset + cur_offset,
4940                depth,
4941            )?;
4942
4943            _prev_end_offset = cur_offset + envelope_size;
4944            if 5 > max_ordinal {
4945                return Ok(());
4946            }
4947
4948            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4949            // are envelope_size bytes.
4950            let cur_offset: usize = (5 - 1) * envelope_size;
4951
4952            // Zero reserved fields.
4953            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4954
4955            // Safety:
4956            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4957            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4958            //   envelope_size bytes, there is always sufficient room.
4959            fidl::encoding::encode_in_envelope_optional::<KeyboardDescriptor, D>(
4960                self.keyboard
4961                    .as_ref()
4962                    .map(<KeyboardDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4963                encoder,
4964                offset + cur_offset,
4965                depth,
4966            )?;
4967
4968            _prev_end_offset = cur_offset + envelope_size;
4969            if 6 > max_ordinal {
4970                return Ok(());
4971            }
4972
4973            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4974            // are envelope_size bytes.
4975            let cur_offset: usize = (6 - 1) * envelope_size;
4976
4977            // Zero reserved fields.
4978            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4979
4980            // Safety:
4981            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4982            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4983            //   envelope_size bytes, there is always sufficient room.
4984            fidl::encoding::encode_in_envelope_optional::<ConsumerControlDescriptor, D>(
4985                self.consumer_control
4986                    .as_ref()
4987                    .map(<ConsumerControlDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4988                encoder,
4989                offset + cur_offset,
4990                depth,
4991            )?;
4992
4993            _prev_end_offset = cur_offset + envelope_size;
4994            if 7 > max_ordinal {
4995                return Ok(());
4996            }
4997
4998            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4999            // are envelope_size bytes.
5000            let cur_offset: usize = (7 - 1) * envelope_size;
5001
5002            // Zero reserved fields.
5003            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5004
5005            // Safety:
5006            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5007            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5008            //   envelope_size bytes, there is always sufficient room.
5009            fidl::encoding::encode_in_envelope_optional::<DeviceInformation, D>(
5010                self.device_information
5011                    .as_ref()
5012                    .map(<DeviceInformation as fidl::encoding::ValueTypeMarker>::borrow),
5013                encoder,
5014                offset + cur_offset,
5015                depth,
5016            )?;
5017
5018            _prev_end_offset = cur_offset + envelope_size;
5019
5020            Ok(())
5021        }
5022    }
5023
5024    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
5025        #[inline(always)]
5026        fn new_empty() -> Self {
5027            Self::default()
5028        }
5029
5030        unsafe fn decode(
5031            &mut self,
5032            decoder: &mut fidl::encoding::Decoder<'_, D>,
5033            offset: usize,
5034            mut depth: fidl::encoding::Depth,
5035        ) -> fidl::Result<()> {
5036            decoder.debug_check_bounds::<Self>(offset);
5037            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5038                None => return Err(fidl::Error::NotNullable),
5039                Some(len) => len,
5040            };
5041            // Calling decoder.out_of_line_offset(0) is not allowed.
5042            if len == 0 {
5043                return Ok(());
5044            };
5045            depth.increment()?;
5046            let envelope_size = 8;
5047            let bytes_len = len * envelope_size;
5048            let offset = decoder.out_of_line_offset(bytes_len)?;
5049            // Decode the envelope for each type.
5050            let mut _next_ordinal_to_read = 0;
5051            let mut next_offset = offset;
5052            let end_offset = offset + bytes_len;
5053            _next_ordinal_to_read += 1;
5054            if next_offset >= end_offset {
5055                return Ok(());
5056            }
5057
5058            // Decode unknown envelopes for gaps in ordinals.
5059            while _next_ordinal_to_read < 1 {
5060                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5061                _next_ordinal_to_read += 1;
5062                next_offset += envelope_size;
5063            }
5064
5065            let next_out_of_line = decoder.next_out_of_line();
5066            let handles_before = decoder.remaining_handles();
5067            if let Some((inlined, num_bytes, num_handles)) =
5068                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5069            {
5070                let member_inline_size =
5071                    <DeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5072                if inlined != (member_inline_size <= 4) {
5073                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5074                }
5075                let inner_offset;
5076                let mut inner_depth = depth.clone();
5077                if inlined {
5078                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5079                    inner_offset = next_offset;
5080                } else {
5081                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5082                    inner_depth.increment()?;
5083                }
5084                let val_ref =
5085                    self.device_info.get_or_insert_with(|| fidl::new_empty!(DeviceInfo, D));
5086                fidl::decode!(DeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5087                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5088                {
5089                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5090                }
5091                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5092                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5093                }
5094            }
5095
5096            next_offset += envelope_size;
5097            _next_ordinal_to_read += 1;
5098            if next_offset >= end_offset {
5099                return Ok(());
5100            }
5101
5102            // Decode unknown envelopes for gaps in ordinals.
5103            while _next_ordinal_to_read < 2 {
5104                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5105                _next_ordinal_to_read += 1;
5106                next_offset += envelope_size;
5107            }
5108
5109            let next_out_of_line = decoder.next_out_of_line();
5110            let handles_before = decoder.remaining_handles();
5111            if let Some((inlined, num_bytes, num_handles)) =
5112                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5113            {
5114                let member_inline_size =
5115                    <MouseDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5116                if inlined != (member_inline_size <= 4) {
5117                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5118                }
5119                let inner_offset;
5120                let mut inner_depth = depth.clone();
5121                if inlined {
5122                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5123                    inner_offset = next_offset;
5124                } else {
5125                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5126                    inner_depth.increment()?;
5127                }
5128                let val_ref =
5129                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseDescriptor, D));
5130                fidl::decode!(MouseDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5131                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5132                {
5133                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5134                }
5135                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5136                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5137                }
5138            }
5139
5140            next_offset += envelope_size;
5141            _next_ordinal_to_read += 1;
5142            if next_offset >= end_offset {
5143                return Ok(());
5144            }
5145
5146            // Decode unknown envelopes for gaps in ordinals.
5147            while _next_ordinal_to_read < 3 {
5148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5149                _next_ordinal_to_read += 1;
5150                next_offset += envelope_size;
5151            }
5152
5153            let next_out_of_line = decoder.next_out_of_line();
5154            let handles_before = decoder.remaining_handles();
5155            if let Some((inlined, num_bytes, num_handles)) =
5156                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5157            {
5158                let member_inline_size =
5159                    <SensorDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5160                if inlined != (member_inline_size <= 4) {
5161                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5162                }
5163                let inner_offset;
5164                let mut inner_depth = depth.clone();
5165                if inlined {
5166                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5167                    inner_offset = next_offset;
5168                } else {
5169                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5170                    inner_depth.increment()?;
5171                }
5172                let val_ref =
5173                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorDescriptor, D));
5174                fidl::decode!(SensorDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5175                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5176                {
5177                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5178                }
5179                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5180                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5181                }
5182            }
5183
5184            next_offset += envelope_size;
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 < 4 {
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                    <TouchDescriptor 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.touch.get_or_insert_with(|| fidl::new_empty!(TouchDescriptor, D));
5218                fidl::decode!(TouchDescriptor, 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 < 5 {
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                    <KeyboardDescriptor as fidl::encoding::TypeMarker>::inline_size(
5248                        decoder.context,
5249                    );
5250                if inlined != (member_inline_size <= 4) {
5251                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5252                }
5253                let inner_offset;
5254                let mut inner_depth = depth.clone();
5255                if inlined {
5256                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5257                    inner_offset = next_offset;
5258                } else {
5259                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5260                    inner_depth.increment()?;
5261                }
5262                let val_ref =
5263                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardDescriptor, D));
5264                fidl::decode!(KeyboardDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5265                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5266                {
5267                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5268                }
5269                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5270                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5271                }
5272            }
5273
5274            next_offset += envelope_size;
5275            _next_ordinal_to_read += 1;
5276            if next_offset >= end_offset {
5277                return Ok(());
5278            }
5279
5280            // Decode unknown envelopes for gaps in ordinals.
5281            while _next_ordinal_to_read < 6 {
5282                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5283                _next_ordinal_to_read += 1;
5284                next_offset += envelope_size;
5285            }
5286
5287            let next_out_of_line = decoder.next_out_of_line();
5288            let handles_before = decoder.remaining_handles();
5289            if let Some((inlined, num_bytes, num_handles)) =
5290                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5291            {
5292                let member_inline_size =
5293                    <ConsumerControlDescriptor as fidl::encoding::TypeMarker>::inline_size(
5294                        decoder.context,
5295                    );
5296                if inlined != (member_inline_size <= 4) {
5297                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5298                }
5299                let inner_offset;
5300                let mut inner_depth = depth.clone();
5301                if inlined {
5302                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5303                    inner_offset = next_offset;
5304                } else {
5305                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5306                    inner_depth.increment()?;
5307                }
5308                let val_ref = self
5309                    .consumer_control
5310                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlDescriptor, D));
5311                fidl::decode!(
5312                    ConsumerControlDescriptor,
5313                    D,
5314                    val_ref,
5315                    decoder,
5316                    inner_offset,
5317                    inner_depth
5318                )?;
5319                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5320                {
5321                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5322                }
5323                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5324                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5325                }
5326            }
5327
5328            next_offset += envelope_size;
5329            _next_ordinal_to_read += 1;
5330            if next_offset >= end_offset {
5331                return Ok(());
5332            }
5333
5334            // Decode unknown envelopes for gaps in ordinals.
5335            while _next_ordinal_to_read < 7 {
5336                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5337                _next_ordinal_to_read += 1;
5338                next_offset += envelope_size;
5339            }
5340
5341            let next_out_of_line = decoder.next_out_of_line();
5342            let handles_before = decoder.remaining_handles();
5343            if let Some((inlined, num_bytes, num_handles)) =
5344                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5345            {
5346                let member_inline_size =
5347                    <DeviceInformation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5348                if inlined != (member_inline_size <= 4) {
5349                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5350                }
5351                let inner_offset;
5352                let mut inner_depth = depth.clone();
5353                if inlined {
5354                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5355                    inner_offset = next_offset;
5356                } else {
5357                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5358                    inner_depth.increment()?;
5359                }
5360                let val_ref = self
5361                    .device_information
5362                    .get_or_insert_with(|| fidl::new_empty!(DeviceInformation, D));
5363                fidl::decode!(DeviceInformation, D, val_ref, decoder, inner_offset, inner_depth)?;
5364                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5365                {
5366                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5367                }
5368                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5369                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5370                }
5371            }
5372
5373            next_offset += envelope_size;
5374
5375            // Decode the remaining unknown envelopes.
5376            while next_offset < end_offset {
5377                _next_ordinal_to_read += 1;
5378                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5379                next_offset += envelope_size;
5380            }
5381
5382            Ok(())
5383        }
5384    }
5385
5386    impl DeviceInformation {
5387        #[inline(always)]
5388        fn max_ordinal_present(&self) -> u64 {
5389            if let Some(_) = self.polling_rate {
5390                return 4;
5391            }
5392            if let Some(_) = self.version {
5393                return 3;
5394            }
5395            if let Some(_) = self.product_id {
5396                return 2;
5397            }
5398            if let Some(_) = self.vendor_id {
5399                return 1;
5400            }
5401            0
5402        }
5403    }
5404
5405    impl fidl::encoding::ValueTypeMarker for DeviceInformation {
5406        type Borrowed<'a> = &'a Self;
5407        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5408            value
5409        }
5410    }
5411
5412    unsafe impl fidl::encoding::TypeMarker for DeviceInformation {
5413        type Owned = Self;
5414
5415        #[inline(always)]
5416        fn inline_align(_context: fidl::encoding::Context) -> usize {
5417            8
5418        }
5419
5420        #[inline(always)]
5421        fn inline_size(_context: fidl::encoding::Context) -> usize {
5422            16
5423        }
5424    }
5425
5426    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInformation, D>
5427        for &DeviceInformation
5428    {
5429        unsafe fn encode(
5430            self,
5431            encoder: &mut fidl::encoding::Encoder<'_, D>,
5432            offset: usize,
5433            mut depth: fidl::encoding::Depth,
5434        ) -> fidl::Result<()> {
5435            encoder.debug_check_bounds::<DeviceInformation>(offset);
5436            // Vector header
5437            let max_ordinal: u64 = self.max_ordinal_present();
5438            encoder.write_num(max_ordinal, offset);
5439            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5440            // Calling encoder.out_of_line_offset(0) is not allowed.
5441            if max_ordinal == 0 {
5442                return Ok(());
5443            }
5444            depth.increment()?;
5445            let envelope_size = 8;
5446            let bytes_len = max_ordinal as usize * envelope_size;
5447            #[allow(unused_variables)]
5448            let offset = encoder.out_of_line_offset(bytes_len);
5449            let mut _prev_end_offset: usize = 0;
5450            if 1 > max_ordinal {
5451                return Ok(());
5452            }
5453
5454            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5455            // are envelope_size bytes.
5456            let cur_offset: usize = (1 - 1) * envelope_size;
5457
5458            // Zero reserved fields.
5459            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5460
5461            // Safety:
5462            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5463            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5464            //   envelope_size bytes, there is always sufficient room.
5465            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5466                self.vendor_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5467                encoder,
5468                offset + cur_offset,
5469                depth,
5470            )?;
5471
5472            _prev_end_offset = cur_offset + envelope_size;
5473            if 2 > max_ordinal {
5474                return Ok(());
5475            }
5476
5477            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5478            // are envelope_size bytes.
5479            let cur_offset: usize = (2 - 1) * envelope_size;
5480
5481            // Zero reserved fields.
5482            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5483
5484            // Safety:
5485            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5486            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5487            //   envelope_size bytes, there is always sufficient room.
5488            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5489                self.product_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5490                encoder,
5491                offset + cur_offset,
5492                depth,
5493            )?;
5494
5495            _prev_end_offset = cur_offset + envelope_size;
5496            if 3 > max_ordinal {
5497                return Ok(());
5498            }
5499
5500            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5501            // are envelope_size bytes.
5502            let cur_offset: usize = (3 - 1) * envelope_size;
5503
5504            // Zero reserved fields.
5505            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5506
5507            // Safety:
5508            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5509            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5510            //   envelope_size bytes, there is always sufficient room.
5511            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5512                self.version.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5513                encoder,
5514                offset + cur_offset,
5515                depth,
5516            )?;
5517
5518            _prev_end_offset = cur_offset + envelope_size;
5519            if 4 > max_ordinal {
5520                return Ok(());
5521            }
5522
5523            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5524            // are envelope_size bytes.
5525            let cur_offset: usize = (4 - 1) * envelope_size;
5526
5527            // Zero reserved fields.
5528            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5529
5530            // Safety:
5531            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5532            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5533            //   envelope_size bytes, there is always sufficient room.
5534            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5535                self.polling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5536                encoder,
5537                offset + cur_offset,
5538                depth,
5539            )?;
5540
5541            _prev_end_offset = cur_offset + envelope_size;
5542
5543            Ok(())
5544        }
5545    }
5546
5547    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInformation {
5548        #[inline(always)]
5549        fn new_empty() -> Self {
5550            Self::default()
5551        }
5552
5553        unsafe fn decode(
5554            &mut self,
5555            decoder: &mut fidl::encoding::Decoder<'_, D>,
5556            offset: usize,
5557            mut depth: fidl::encoding::Depth,
5558        ) -> fidl::Result<()> {
5559            decoder.debug_check_bounds::<Self>(offset);
5560            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5561                None => return Err(fidl::Error::NotNullable),
5562                Some(len) => len,
5563            };
5564            // Calling decoder.out_of_line_offset(0) is not allowed.
5565            if len == 0 {
5566                return Ok(());
5567            };
5568            depth.increment()?;
5569            let envelope_size = 8;
5570            let bytes_len = len * envelope_size;
5571            let offset = decoder.out_of_line_offset(bytes_len)?;
5572            // Decode the envelope for each type.
5573            let mut _next_ordinal_to_read = 0;
5574            let mut next_offset = offset;
5575            let end_offset = offset + bytes_len;
5576            _next_ordinal_to_read += 1;
5577            if next_offset >= end_offset {
5578                return Ok(());
5579            }
5580
5581            // Decode unknown envelopes for gaps in ordinals.
5582            while _next_ordinal_to_read < 1 {
5583                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5584                _next_ordinal_to_read += 1;
5585                next_offset += envelope_size;
5586            }
5587
5588            let next_out_of_line = decoder.next_out_of_line();
5589            let handles_before = decoder.remaining_handles();
5590            if let Some((inlined, num_bytes, num_handles)) =
5591                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5592            {
5593                let member_inline_size =
5594                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5595                if inlined != (member_inline_size <= 4) {
5596                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5597                }
5598                let inner_offset;
5599                let mut inner_depth = depth.clone();
5600                if inlined {
5601                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5602                    inner_offset = next_offset;
5603                } else {
5604                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5605                    inner_depth.increment()?;
5606                }
5607                let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5608                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5609                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5610                {
5611                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5612                }
5613                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5614                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5615                }
5616            }
5617
5618            next_offset += envelope_size;
5619            _next_ordinal_to_read += 1;
5620            if next_offset >= end_offset {
5621                return Ok(());
5622            }
5623
5624            // Decode unknown envelopes for gaps in ordinals.
5625            while _next_ordinal_to_read < 2 {
5626                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5627                _next_ordinal_to_read += 1;
5628                next_offset += envelope_size;
5629            }
5630
5631            let next_out_of_line = decoder.next_out_of_line();
5632            let handles_before = decoder.remaining_handles();
5633            if let Some((inlined, num_bytes, num_handles)) =
5634                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5635            {
5636                let member_inline_size =
5637                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5638                if inlined != (member_inline_size <= 4) {
5639                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5640                }
5641                let inner_offset;
5642                let mut inner_depth = depth.clone();
5643                if inlined {
5644                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5645                    inner_offset = next_offset;
5646                } else {
5647                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5648                    inner_depth.increment()?;
5649                }
5650                let val_ref = self.product_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5651                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5652                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5653                {
5654                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5655                }
5656                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5657                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5658                }
5659            }
5660
5661            next_offset += envelope_size;
5662            _next_ordinal_to_read += 1;
5663            if next_offset >= end_offset {
5664                return Ok(());
5665            }
5666
5667            // Decode unknown envelopes for gaps in ordinals.
5668            while _next_ordinal_to_read < 3 {
5669                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5670                _next_ordinal_to_read += 1;
5671                next_offset += envelope_size;
5672            }
5673
5674            let next_out_of_line = decoder.next_out_of_line();
5675            let handles_before = decoder.remaining_handles();
5676            if let Some((inlined, num_bytes, num_handles)) =
5677                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5678            {
5679                let member_inline_size =
5680                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5681                if inlined != (member_inline_size <= 4) {
5682                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5683                }
5684                let inner_offset;
5685                let mut inner_depth = depth.clone();
5686                if inlined {
5687                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5688                    inner_offset = next_offset;
5689                } else {
5690                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5691                    inner_depth.increment()?;
5692                }
5693                let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(u32, D));
5694                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5695                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5696                {
5697                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5698                }
5699                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5700                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5701                }
5702            }
5703
5704            next_offset += envelope_size;
5705            _next_ordinal_to_read += 1;
5706            if next_offset >= end_offset {
5707                return Ok(());
5708            }
5709
5710            // Decode unknown envelopes for gaps in ordinals.
5711            while _next_ordinal_to_read < 4 {
5712                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5713                _next_ordinal_to_read += 1;
5714                next_offset += envelope_size;
5715            }
5716
5717            let next_out_of_line = decoder.next_out_of_line();
5718            let handles_before = decoder.remaining_handles();
5719            if let Some((inlined, num_bytes, num_handles)) =
5720                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5721            {
5722                let member_inline_size =
5723                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5724                if inlined != (member_inline_size <= 4) {
5725                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5726                }
5727                let inner_offset;
5728                let mut inner_depth = depth.clone();
5729                if inlined {
5730                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5731                    inner_offset = next_offset;
5732                } else {
5733                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5734                    inner_depth.increment()?;
5735                }
5736                let val_ref = self.polling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
5737                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5738                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5739                {
5740                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5741                }
5742                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5743                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5744                }
5745            }
5746
5747            next_offset += envelope_size;
5748
5749            // Decode the remaining unknown envelopes.
5750            while next_offset < end_offset {
5751                _next_ordinal_to_read += 1;
5752                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5753                next_offset += envelope_size;
5754            }
5755
5756            Ok(())
5757        }
5758    }
5759
5760    impl FeatureReport {
5761        #[inline(always)]
5762        fn max_ordinal_present(&self) -> u64 {
5763            if let Some(_) = self.touch {
5764                return 2;
5765            }
5766            if let Some(_) = self.sensor {
5767                return 1;
5768            }
5769            0
5770        }
5771    }
5772
5773    impl fidl::encoding::ValueTypeMarker for FeatureReport {
5774        type Borrowed<'a> = &'a Self;
5775        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5776            value
5777        }
5778    }
5779
5780    unsafe impl fidl::encoding::TypeMarker for FeatureReport {
5781        type Owned = Self;
5782
5783        #[inline(always)]
5784        fn inline_align(_context: fidl::encoding::Context) -> usize {
5785            8
5786        }
5787
5788        #[inline(always)]
5789        fn inline_size(_context: fidl::encoding::Context) -> usize {
5790            16
5791        }
5792    }
5793
5794    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FeatureReport, D>
5795        for &FeatureReport
5796    {
5797        unsafe fn encode(
5798            self,
5799            encoder: &mut fidl::encoding::Encoder<'_, D>,
5800            offset: usize,
5801            mut depth: fidl::encoding::Depth,
5802        ) -> fidl::Result<()> {
5803            encoder.debug_check_bounds::<FeatureReport>(offset);
5804            // Vector header
5805            let max_ordinal: u64 = self.max_ordinal_present();
5806            encoder.write_num(max_ordinal, offset);
5807            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5808            // Calling encoder.out_of_line_offset(0) is not allowed.
5809            if max_ordinal == 0 {
5810                return Ok(());
5811            }
5812            depth.increment()?;
5813            let envelope_size = 8;
5814            let bytes_len = max_ordinal as usize * envelope_size;
5815            #[allow(unused_variables)]
5816            let offset = encoder.out_of_line_offset(bytes_len);
5817            let mut _prev_end_offset: usize = 0;
5818            if 1 > max_ordinal {
5819                return Ok(());
5820            }
5821
5822            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5823            // are envelope_size bytes.
5824            let cur_offset: usize = (1 - 1) * envelope_size;
5825
5826            // Zero reserved fields.
5827            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5828
5829            // Safety:
5830            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5831            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5832            //   envelope_size bytes, there is always sufficient room.
5833            fidl::encoding::encode_in_envelope_optional::<SensorFeatureReport, D>(
5834                self.sensor
5835                    .as_ref()
5836                    .map(<SensorFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5837                encoder,
5838                offset + cur_offset,
5839                depth,
5840            )?;
5841
5842            _prev_end_offset = cur_offset + envelope_size;
5843            if 2 > max_ordinal {
5844                return Ok(());
5845            }
5846
5847            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5848            // are envelope_size bytes.
5849            let cur_offset: usize = (2 - 1) * envelope_size;
5850
5851            // Zero reserved fields.
5852            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5853
5854            // Safety:
5855            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5856            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5857            //   envelope_size bytes, there is always sufficient room.
5858            fidl::encoding::encode_in_envelope_optional::<TouchFeatureReport, D>(
5859                self.touch
5860                    .as_ref()
5861                    .map(<TouchFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5862                encoder,
5863                offset + cur_offset,
5864                depth,
5865            )?;
5866
5867            _prev_end_offset = cur_offset + envelope_size;
5868
5869            Ok(())
5870        }
5871    }
5872
5873    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FeatureReport {
5874        #[inline(always)]
5875        fn new_empty() -> Self {
5876            Self::default()
5877        }
5878
5879        unsafe fn decode(
5880            &mut self,
5881            decoder: &mut fidl::encoding::Decoder<'_, D>,
5882            offset: usize,
5883            mut depth: fidl::encoding::Depth,
5884        ) -> fidl::Result<()> {
5885            decoder.debug_check_bounds::<Self>(offset);
5886            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5887                None => return Err(fidl::Error::NotNullable),
5888                Some(len) => len,
5889            };
5890            // Calling decoder.out_of_line_offset(0) is not allowed.
5891            if len == 0 {
5892                return Ok(());
5893            };
5894            depth.increment()?;
5895            let envelope_size = 8;
5896            let bytes_len = len * envelope_size;
5897            let offset = decoder.out_of_line_offset(bytes_len)?;
5898            // Decode the envelope for each type.
5899            let mut _next_ordinal_to_read = 0;
5900            let mut next_offset = offset;
5901            let end_offset = offset + bytes_len;
5902            _next_ordinal_to_read += 1;
5903            if next_offset >= end_offset {
5904                return Ok(());
5905            }
5906
5907            // Decode unknown envelopes for gaps in ordinals.
5908            while _next_ordinal_to_read < 1 {
5909                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5910                _next_ordinal_to_read += 1;
5911                next_offset += envelope_size;
5912            }
5913
5914            let next_out_of_line = decoder.next_out_of_line();
5915            let handles_before = decoder.remaining_handles();
5916            if let Some((inlined, num_bytes, num_handles)) =
5917                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5918            {
5919                let member_inline_size =
5920                    <SensorFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5921                        decoder.context,
5922                    );
5923                if inlined != (member_inline_size <= 4) {
5924                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5925                }
5926                let inner_offset;
5927                let mut inner_depth = depth.clone();
5928                if inlined {
5929                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5930                    inner_offset = next_offset;
5931                } else {
5932                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5933                    inner_depth.increment()?;
5934                }
5935                let val_ref =
5936                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorFeatureReport, D));
5937                fidl::decode!(SensorFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5938                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5939                {
5940                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5941                }
5942                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5943                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5944                }
5945            }
5946
5947            next_offset += envelope_size;
5948            _next_ordinal_to_read += 1;
5949            if next_offset >= end_offset {
5950                return Ok(());
5951            }
5952
5953            // Decode unknown envelopes for gaps in ordinals.
5954            while _next_ordinal_to_read < 2 {
5955                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5956                _next_ordinal_to_read += 1;
5957                next_offset += envelope_size;
5958            }
5959
5960            let next_out_of_line = decoder.next_out_of_line();
5961            let handles_before = decoder.remaining_handles();
5962            if let Some((inlined, num_bytes, num_handles)) =
5963                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5964            {
5965                let member_inline_size =
5966                    <TouchFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5967                        decoder.context,
5968                    );
5969                if inlined != (member_inline_size <= 4) {
5970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5971                }
5972                let inner_offset;
5973                let mut inner_depth = depth.clone();
5974                if inlined {
5975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5976                    inner_offset = next_offset;
5977                } else {
5978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5979                    inner_depth.increment()?;
5980                }
5981                let val_ref =
5982                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchFeatureReport, D));
5983                fidl::decode!(TouchFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5984                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5985                {
5986                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5987                }
5988                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5989                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5990                }
5991            }
5992
5993            next_offset += envelope_size;
5994
5995            // Decode the remaining unknown envelopes.
5996            while next_offset < end_offset {
5997                _next_ordinal_to_read += 1;
5998                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5999                next_offset += envelope_size;
6000            }
6001
6002            Ok(())
6003        }
6004    }
6005
6006    impl InputReport {
6007        #[inline(always)]
6008        fn max_ordinal_present(&self) -> u64 {
6009            if let Some(_) = self.report_id {
6010                return 8;
6011            }
6012            if let Some(_) = self.consumer_control {
6013                return 7;
6014            }
6015            if let Some(_) = self.keyboard {
6016                return 6;
6017            }
6018            if let Some(_) = self.touch {
6019                return 5;
6020            }
6021            if let Some(_) = self.sensor {
6022                return 4;
6023            }
6024            if let Some(_) = self.trace_id {
6025                return 3;
6026            }
6027            if let Some(_) = self.mouse {
6028                return 2;
6029            }
6030            if let Some(_) = self.event_time {
6031                return 1;
6032            }
6033            0
6034        }
6035    }
6036
6037    impl fidl::encoding::ValueTypeMarker for InputReport {
6038        type Borrowed<'a> = &'a Self;
6039        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6040            value
6041        }
6042    }
6043
6044    unsafe impl fidl::encoding::TypeMarker for InputReport {
6045        type Owned = Self;
6046
6047        #[inline(always)]
6048        fn inline_align(_context: fidl::encoding::Context) -> usize {
6049            8
6050        }
6051
6052        #[inline(always)]
6053        fn inline_size(_context: fidl::encoding::Context) -> usize {
6054            16
6055        }
6056    }
6057
6058    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
6059        for &InputReport
6060    {
6061        unsafe fn encode(
6062            self,
6063            encoder: &mut fidl::encoding::Encoder<'_, D>,
6064            offset: usize,
6065            mut depth: fidl::encoding::Depth,
6066        ) -> fidl::Result<()> {
6067            encoder.debug_check_bounds::<InputReport>(offset);
6068            // Vector header
6069            let max_ordinal: u64 = self.max_ordinal_present();
6070            encoder.write_num(max_ordinal, offset);
6071            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6072            // Calling encoder.out_of_line_offset(0) is not allowed.
6073            if max_ordinal == 0 {
6074                return Ok(());
6075            }
6076            depth.increment()?;
6077            let envelope_size = 8;
6078            let bytes_len = max_ordinal as usize * envelope_size;
6079            #[allow(unused_variables)]
6080            let offset = encoder.out_of_line_offset(bytes_len);
6081            let mut _prev_end_offset: usize = 0;
6082            if 1 > max_ordinal {
6083                return Ok(());
6084            }
6085
6086            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6087            // are envelope_size bytes.
6088            let cur_offset: usize = (1 - 1) * envelope_size;
6089
6090            // Zero reserved fields.
6091            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6092
6093            // Safety:
6094            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6095            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6096            //   envelope_size bytes, there is always sufficient room.
6097            fidl::encoding::encode_in_envelope_optional::<i64, D>(
6098                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6099                encoder,
6100                offset + cur_offset,
6101                depth,
6102            )?;
6103
6104            _prev_end_offset = cur_offset + envelope_size;
6105            if 2 > max_ordinal {
6106                return Ok(());
6107            }
6108
6109            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6110            // are envelope_size bytes.
6111            let cur_offset: usize = (2 - 1) * envelope_size;
6112
6113            // Zero reserved fields.
6114            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6115
6116            // Safety:
6117            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6118            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6119            //   envelope_size bytes, there is always sufficient room.
6120            fidl::encoding::encode_in_envelope_optional::<MouseInputReport, D>(
6121                self.mouse
6122                    .as_ref()
6123                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6124                encoder,
6125                offset + cur_offset,
6126                depth,
6127            )?;
6128
6129            _prev_end_offset = cur_offset + envelope_size;
6130            if 3 > max_ordinal {
6131                return Ok(());
6132            }
6133
6134            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6135            // are envelope_size bytes.
6136            let cur_offset: usize = (3 - 1) * envelope_size;
6137
6138            // Zero reserved fields.
6139            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6140
6141            // Safety:
6142            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6143            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6144            //   envelope_size bytes, there is always sufficient room.
6145            fidl::encoding::encode_in_envelope_optional::<u64, D>(
6146                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6147                encoder,
6148                offset + cur_offset,
6149                depth,
6150            )?;
6151
6152            _prev_end_offset = cur_offset + envelope_size;
6153            if 4 > max_ordinal {
6154                return Ok(());
6155            }
6156
6157            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6158            // are envelope_size bytes.
6159            let cur_offset: usize = (4 - 1) * envelope_size;
6160
6161            // Zero reserved fields.
6162            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6163
6164            // Safety:
6165            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6166            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6167            //   envelope_size bytes, there is always sufficient room.
6168            fidl::encoding::encode_in_envelope_optional::<SensorInputReport, D>(
6169                self.sensor
6170                    .as_ref()
6171                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6172                encoder,
6173                offset + cur_offset,
6174                depth,
6175            )?;
6176
6177            _prev_end_offset = cur_offset + envelope_size;
6178            if 5 > max_ordinal {
6179                return Ok(());
6180            }
6181
6182            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6183            // are envelope_size bytes.
6184            let cur_offset: usize = (5 - 1) * envelope_size;
6185
6186            // Zero reserved fields.
6187            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6188
6189            // Safety:
6190            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6191            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6192            //   envelope_size bytes, there is always sufficient room.
6193            fidl::encoding::encode_in_envelope_optional::<TouchInputReport, D>(
6194                self.touch
6195                    .as_ref()
6196                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6197                encoder,
6198                offset + cur_offset,
6199                depth,
6200            )?;
6201
6202            _prev_end_offset = cur_offset + envelope_size;
6203            if 6 > max_ordinal {
6204                return Ok(());
6205            }
6206
6207            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6208            // are envelope_size bytes.
6209            let cur_offset: usize = (6 - 1) * envelope_size;
6210
6211            // Zero reserved fields.
6212            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6213
6214            // Safety:
6215            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6216            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6217            //   envelope_size bytes, there is always sufficient room.
6218            fidl::encoding::encode_in_envelope_optional::<KeyboardInputReport, D>(
6219                self.keyboard
6220                    .as_ref()
6221                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6222                encoder,
6223                offset + cur_offset,
6224                depth,
6225            )?;
6226
6227            _prev_end_offset = cur_offset + envelope_size;
6228            if 7 > max_ordinal {
6229                return Ok(());
6230            }
6231
6232            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6233            // are envelope_size bytes.
6234            let cur_offset: usize = (7 - 1) * envelope_size;
6235
6236            // Zero reserved fields.
6237            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6238
6239            // Safety:
6240            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6241            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6242            //   envelope_size bytes, there is always sufficient room.
6243            fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputReport, D>(
6244                self.consumer_control
6245                    .as_ref()
6246                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6247                encoder,
6248                offset + cur_offset,
6249                depth,
6250            )?;
6251
6252            _prev_end_offset = cur_offset + envelope_size;
6253            if 8 > max_ordinal {
6254                return Ok(());
6255            }
6256
6257            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6258            // are envelope_size bytes.
6259            let cur_offset: usize = (8 - 1) * envelope_size;
6260
6261            // Zero reserved fields.
6262            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6263
6264            // Safety:
6265            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6266            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6267            //   envelope_size bytes, there is always sufficient room.
6268            fidl::encoding::encode_in_envelope_optional::<u8, D>(
6269                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
6270                encoder,
6271                offset + cur_offset,
6272                depth,
6273            )?;
6274
6275            _prev_end_offset = cur_offset + envelope_size;
6276
6277            Ok(())
6278        }
6279    }
6280
6281    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
6282        #[inline(always)]
6283        fn new_empty() -> Self {
6284            Self::default()
6285        }
6286
6287        unsafe fn decode(
6288            &mut self,
6289            decoder: &mut fidl::encoding::Decoder<'_, D>,
6290            offset: usize,
6291            mut depth: fidl::encoding::Depth,
6292        ) -> fidl::Result<()> {
6293            decoder.debug_check_bounds::<Self>(offset);
6294            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6295                None => return Err(fidl::Error::NotNullable),
6296                Some(len) => len,
6297            };
6298            // Calling decoder.out_of_line_offset(0) is not allowed.
6299            if len == 0 {
6300                return Ok(());
6301            };
6302            depth.increment()?;
6303            let envelope_size = 8;
6304            let bytes_len = len * envelope_size;
6305            let offset = decoder.out_of_line_offset(bytes_len)?;
6306            // Decode the envelope for each type.
6307            let mut _next_ordinal_to_read = 0;
6308            let mut next_offset = offset;
6309            let end_offset = offset + bytes_len;
6310            _next_ordinal_to_read += 1;
6311            if next_offset >= end_offset {
6312                return Ok(());
6313            }
6314
6315            // Decode unknown envelopes for gaps in ordinals.
6316            while _next_ordinal_to_read < 1 {
6317                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6318                _next_ordinal_to_read += 1;
6319                next_offset += envelope_size;
6320            }
6321
6322            let next_out_of_line = decoder.next_out_of_line();
6323            let handles_before = decoder.remaining_handles();
6324            if let Some((inlined, num_bytes, num_handles)) =
6325                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6326            {
6327                let member_inline_size =
6328                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6329                if inlined != (member_inline_size <= 4) {
6330                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6331                }
6332                let inner_offset;
6333                let mut inner_depth = depth.clone();
6334                if inlined {
6335                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6336                    inner_offset = next_offset;
6337                } else {
6338                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6339                    inner_depth.increment()?;
6340                }
6341                let val_ref = self.event_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
6342                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6343                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6344                {
6345                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6346                }
6347                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6348                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6349                }
6350            }
6351
6352            next_offset += envelope_size;
6353            _next_ordinal_to_read += 1;
6354            if next_offset >= end_offset {
6355                return Ok(());
6356            }
6357
6358            // Decode unknown envelopes for gaps in ordinals.
6359            while _next_ordinal_to_read < 2 {
6360                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6361                _next_ordinal_to_read += 1;
6362                next_offset += envelope_size;
6363            }
6364
6365            let next_out_of_line = decoder.next_out_of_line();
6366            let handles_before = decoder.remaining_handles();
6367            if let Some((inlined, num_bytes, num_handles)) =
6368                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6369            {
6370                let member_inline_size =
6371                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6372                if inlined != (member_inline_size <= 4) {
6373                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6374                }
6375                let inner_offset;
6376                let mut inner_depth = depth.clone();
6377                if inlined {
6378                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6379                    inner_offset = next_offset;
6380                } else {
6381                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6382                    inner_depth.increment()?;
6383                }
6384                let val_ref =
6385                    self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseInputReport, D));
6386                fidl::decode!(MouseInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6387                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6388                {
6389                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6390                }
6391                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6392                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6393                }
6394            }
6395
6396            next_offset += envelope_size;
6397            _next_ordinal_to_read += 1;
6398            if next_offset >= end_offset {
6399                return Ok(());
6400            }
6401
6402            // Decode unknown envelopes for gaps in ordinals.
6403            while _next_ordinal_to_read < 3 {
6404                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6405                _next_ordinal_to_read += 1;
6406                next_offset += envelope_size;
6407            }
6408
6409            let next_out_of_line = decoder.next_out_of_line();
6410            let handles_before = decoder.remaining_handles();
6411            if let Some((inlined, num_bytes, num_handles)) =
6412                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6413            {
6414                let member_inline_size =
6415                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6416                if inlined != (member_inline_size <= 4) {
6417                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6418                }
6419                let inner_offset;
6420                let mut inner_depth = depth.clone();
6421                if inlined {
6422                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6423                    inner_offset = next_offset;
6424                } else {
6425                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6426                    inner_depth.increment()?;
6427                }
6428                let val_ref = self.trace_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
6429                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6430                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6431                {
6432                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6433                }
6434                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6435                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6436                }
6437            }
6438
6439            next_offset += envelope_size;
6440            _next_ordinal_to_read += 1;
6441            if next_offset >= end_offset {
6442                return Ok(());
6443            }
6444
6445            // Decode unknown envelopes for gaps in ordinals.
6446            while _next_ordinal_to_read < 4 {
6447                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6448                _next_ordinal_to_read += 1;
6449                next_offset += envelope_size;
6450            }
6451
6452            let next_out_of_line = decoder.next_out_of_line();
6453            let handles_before = decoder.remaining_handles();
6454            if let Some((inlined, num_bytes, num_handles)) =
6455                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6456            {
6457                let member_inline_size =
6458                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6459                if inlined != (member_inline_size <= 4) {
6460                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6461                }
6462                let inner_offset;
6463                let mut inner_depth = depth.clone();
6464                if inlined {
6465                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6466                    inner_offset = next_offset;
6467                } else {
6468                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6469                    inner_depth.increment()?;
6470                }
6471                let val_ref =
6472                    self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorInputReport, D));
6473                fidl::decode!(SensorInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6474                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6475                {
6476                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6477                }
6478                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6479                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6480                }
6481            }
6482
6483            next_offset += envelope_size;
6484            _next_ordinal_to_read += 1;
6485            if next_offset >= end_offset {
6486                return Ok(());
6487            }
6488
6489            // Decode unknown envelopes for gaps in ordinals.
6490            while _next_ordinal_to_read < 5 {
6491                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6492                _next_ordinal_to_read += 1;
6493                next_offset += envelope_size;
6494            }
6495
6496            let next_out_of_line = decoder.next_out_of_line();
6497            let handles_before = decoder.remaining_handles();
6498            if let Some((inlined, num_bytes, num_handles)) =
6499                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6500            {
6501                let member_inline_size =
6502                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6503                if inlined != (member_inline_size <= 4) {
6504                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6505                }
6506                let inner_offset;
6507                let mut inner_depth = depth.clone();
6508                if inlined {
6509                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6510                    inner_offset = next_offset;
6511                } else {
6512                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6513                    inner_depth.increment()?;
6514                }
6515                let val_ref =
6516                    self.touch.get_or_insert_with(|| fidl::new_empty!(TouchInputReport, D));
6517                fidl::decode!(TouchInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6518                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6519                {
6520                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6521                }
6522                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6523                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6524                }
6525            }
6526
6527            next_offset += envelope_size;
6528            _next_ordinal_to_read += 1;
6529            if next_offset >= end_offset {
6530                return Ok(());
6531            }
6532
6533            // Decode unknown envelopes for gaps in ordinals.
6534            while _next_ordinal_to_read < 6 {
6535                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6536                _next_ordinal_to_read += 1;
6537                next_offset += envelope_size;
6538            }
6539
6540            let next_out_of_line = decoder.next_out_of_line();
6541            let handles_before = decoder.remaining_handles();
6542            if let Some((inlined, num_bytes, num_handles)) =
6543                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6544            {
6545                let member_inline_size =
6546                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
6547                        decoder.context,
6548                    );
6549                if inlined != (member_inline_size <= 4) {
6550                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6551                }
6552                let inner_offset;
6553                let mut inner_depth = depth.clone();
6554                if inlined {
6555                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6556                    inner_offset = next_offset;
6557                } else {
6558                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6559                    inner_depth.increment()?;
6560                }
6561                let val_ref =
6562                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardInputReport, D));
6563                fidl::decode!(KeyboardInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6564                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6565                {
6566                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6567                }
6568                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6569                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6570                }
6571            }
6572
6573            next_offset += envelope_size;
6574            _next_ordinal_to_read += 1;
6575            if next_offset >= end_offset {
6576                return Ok(());
6577            }
6578
6579            // Decode unknown envelopes for gaps in ordinals.
6580            while _next_ordinal_to_read < 7 {
6581                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6582                _next_ordinal_to_read += 1;
6583                next_offset += envelope_size;
6584            }
6585
6586            let next_out_of_line = decoder.next_out_of_line();
6587            let handles_before = decoder.remaining_handles();
6588            if let Some((inlined, num_bytes, num_handles)) =
6589                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6590            {
6591                let member_inline_size =
6592                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
6593                        decoder.context,
6594                    );
6595                if inlined != (member_inline_size <= 4) {
6596                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6597                }
6598                let inner_offset;
6599                let mut inner_depth = depth.clone();
6600                if inlined {
6601                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6602                    inner_offset = next_offset;
6603                } else {
6604                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6605                    inner_depth.increment()?;
6606                }
6607                let val_ref = self
6608                    .consumer_control
6609                    .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputReport, D));
6610                fidl::decode!(
6611                    ConsumerControlInputReport,
6612                    D,
6613                    val_ref,
6614                    decoder,
6615                    inner_offset,
6616                    inner_depth
6617                )?;
6618                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6619                {
6620                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6621                }
6622                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6623                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6624                }
6625            }
6626
6627            next_offset += envelope_size;
6628            _next_ordinal_to_read += 1;
6629            if next_offset >= end_offset {
6630                return Ok(());
6631            }
6632
6633            // Decode unknown envelopes for gaps in ordinals.
6634            while _next_ordinal_to_read < 8 {
6635                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6636                _next_ordinal_to_read += 1;
6637                next_offset += envelope_size;
6638            }
6639
6640            let next_out_of_line = decoder.next_out_of_line();
6641            let handles_before = decoder.remaining_handles();
6642            if let Some((inlined, num_bytes, num_handles)) =
6643                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6644            {
6645                let member_inline_size =
6646                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6647                if inlined != (member_inline_size <= 4) {
6648                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6649                }
6650                let inner_offset;
6651                let mut inner_depth = depth.clone();
6652                if inlined {
6653                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6654                    inner_offset = next_offset;
6655                } else {
6656                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6657                    inner_depth.increment()?;
6658                }
6659                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
6660                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6661                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6662                {
6663                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6664                }
6665                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6666                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6667                }
6668            }
6669
6670            next_offset += envelope_size;
6671
6672            // Decode the remaining unknown envelopes.
6673            while next_offset < end_offset {
6674                _next_ordinal_to_read += 1;
6675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6676                next_offset += envelope_size;
6677            }
6678
6679            Ok(())
6680        }
6681    }
6682
6683    impl KeyboardDescriptor {
6684        #[inline(always)]
6685        fn max_ordinal_present(&self) -> u64 {
6686            if let Some(_) = self.output {
6687                return 2;
6688            }
6689            if let Some(_) = self.input {
6690                return 1;
6691            }
6692            0
6693        }
6694    }
6695
6696    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
6697        type Borrowed<'a> = &'a Self;
6698        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6699            value
6700        }
6701    }
6702
6703    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
6704        type Owned = Self;
6705
6706        #[inline(always)]
6707        fn inline_align(_context: fidl::encoding::Context) -> usize {
6708            8
6709        }
6710
6711        #[inline(always)]
6712        fn inline_size(_context: fidl::encoding::Context) -> usize {
6713            16
6714        }
6715    }
6716
6717    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
6718        for &KeyboardDescriptor
6719    {
6720        unsafe fn encode(
6721            self,
6722            encoder: &mut fidl::encoding::Encoder<'_, D>,
6723            offset: usize,
6724            mut depth: fidl::encoding::Depth,
6725        ) -> fidl::Result<()> {
6726            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
6727            // Vector header
6728            let max_ordinal: u64 = self.max_ordinal_present();
6729            encoder.write_num(max_ordinal, offset);
6730            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6731            // Calling encoder.out_of_line_offset(0) is not allowed.
6732            if max_ordinal == 0 {
6733                return Ok(());
6734            }
6735            depth.increment()?;
6736            let envelope_size = 8;
6737            let bytes_len = max_ordinal as usize * envelope_size;
6738            #[allow(unused_variables)]
6739            let offset = encoder.out_of_line_offset(bytes_len);
6740            let mut _prev_end_offset: usize = 0;
6741            if 1 > max_ordinal {
6742                return Ok(());
6743            }
6744
6745            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6746            // are envelope_size bytes.
6747            let cur_offset: usize = (1 - 1) * envelope_size;
6748
6749            // Zero reserved fields.
6750            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6751
6752            // Safety:
6753            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6754            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6755            //   envelope_size bytes, there is always sufficient room.
6756            fidl::encoding::encode_in_envelope_optional::<KeyboardInputDescriptor, D>(
6757                self.input
6758                    .as_ref()
6759                    .map(<KeyboardInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6760                encoder,
6761                offset + cur_offset,
6762                depth,
6763            )?;
6764
6765            _prev_end_offset = cur_offset + envelope_size;
6766            if 2 > max_ordinal {
6767                return Ok(());
6768            }
6769
6770            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6771            // are envelope_size bytes.
6772            let cur_offset: usize = (2 - 1) * envelope_size;
6773
6774            // Zero reserved fields.
6775            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6776
6777            // Safety:
6778            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6779            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6780            //   envelope_size bytes, there is always sufficient room.
6781            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
6782                self.output
6783                    .as_ref()
6784                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6785                encoder,
6786                offset + cur_offset,
6787                depth,
6788            )?;
6789
6790            _prev_end_offset = cur_offset + envelope_size;
6791
6792            Ok(())
6793        }
6794    }
6795
6796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
6797        #[inline(always)]
6798        fn new_empty() -> Self {
6799            Self::default()
6800        }
6801
6802        unsafe fn decode(
6803            &mut self,
6804            decoder: &mut fidl::encoding::Decoder<'_, D>,
6805            offset: usize,
6806            mut depth: fidl::encoding::Depth,
6807        ) -> fidl::Result<()> {
6808            decoder.debug_check_bounds::<Self>(offset);
6809            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6810                None => return Err(fidl::Error::NotNullable),
6811                Some(len) => len,
6812            };
6813            // Calling decoder.out_of_line_offset(0) is not allowed.
6814            if len == 0 {
6815                return Ok(());
6816            };
6817            depth.increment()?;
6818            let envelope_size = 8;
6819            let bytes_len = len * envelope_size;
6820            let offset = decoder.out_of_line_offset(bytes_len)?;
6821            // Decode the envelope for each type.
6822            let mut _next_ordinal_to_read = 0;
6823            let mut next_offset = offset;
6824            let end_offset = offset + bytes_len;
6825            _next_ordinal_to_read += 1;
6826            if next_offset >= end_offset {
6827                return Ok(());
6828            }
6829
6830            // Decode unknown envelopes for gaps in ordinals.
6831            while _next_ordinal_to_read < 1 {
6832                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6833                _next_ordinal_to_read += 1;
6834                next_offset += envelope_size;
6835            }
6836
6837            let next_out_of_line = decoder.next_out_of_line();
6838            let handles_before = decoder.remaining_handles();
6839            if let Some((inlined, num_bytes, num_handles)) =
6840                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6841            {
6842                let member_inline_size =
6843                    <KeyboardInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6844                        decoder.context,
6845                    );
6846                if inlined != (member_inline_size <= 4) {
6847                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6848                }
6849                let inner_offset;
6850                let mut inner_depth = depth.clone();
6851                if inlined {
6852                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6853                    inner_offset = next_offset;
6854                } else {
6855                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6856                    inner_depth.increment()?;
6857                }
6858                let val_ref =
6859                    self.input.get_or_insert_with(|| fidl::new_empty!(KeyboardInputDescriptor, D));
6860                fidl::decode!(
6861                    KeyboardInputDescriptor,
6862                    D,
6863                    val_ref,
6864                    decoder,
6865                    inner_offset,
6866                    inner_depth
6867                )?;
6868                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6869                {
6870                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6871                }
6872                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6873                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6874                }
6875            }
6876
6877            next_offset += envelope_size;
6878            _next_ordinal_to_read += 1;
6879            if next_offset >= end_offset {
6880                return Ok(());
6881            }
6882
6883            // Decode unknown envelopes for gaps in ordinals.
6884            while _next_ordinal_to_read < 2 {
6885                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6886                _next_ordinal_to_read += 1;
6887                next_offset += envelope_size;
6888            }
6889
6890            let next_out_of_line = decoder.next_out_of_line();
6891            let handles_before = decoder.remaining_handles();
6892            if let Some((inlined, num_bytes, num_handles)) =
6893                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6894            {
6895                let member_inline_size =
6896                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6897                        decoder.context,
6898                    );
6899                if inlined != (member_inline_size <= 4) {
6900                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6901                }
6902                let inner_offset;
6903                let mut inner_depth = depth.clone();
6904                if inlined {
6905                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6906                    inner_offset = next_offset;
6907                } else {
6908                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6909                    inner_depth.increment()?;
6910                }
6911                let val_ref = self
6912                    .output
6913                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
6914                fidl::decode!(
6915                    KeyboardOutputDescriptor,
6916                    D,
6917                    val_ref,
6918                    decoder,
6919                    inner_offset,
6920                    inner_depth
6921                )?;
6922                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6923                {
6924                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6925                }
6926                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6927                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6928                }
6929            }
6930
6931            next_offset += envelope_size;
6932
6933            // Decode the remaining unknown envelopes.
6934            while next_offset < end_offset {
6935                _next_ordinal_to_read += 1;
6936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6937                next_offset += envelope_size;
6938            }
6939
6940            Ok(())
6941        }
6942    }
6943
6944    impl KeyboardInputDescriptor {
6945        #[inline(always)]
6946        fn max_ordinal_present(&self) -> u64 {
6947            if let Some(_) = self.keys3 {
6948                return 2;
6949            }
6950            0
6951        }
6952    }
6953
6954    impl fidl::encoding::ValueTypeMarker for KeyboardInputDescriptor {
6955        type Borrowed<'a> = &'a Self;
6956        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6957            value
6958        }
6959    }
6960
6961    unsafe impl fidl::encoding::TypeMarker for KeyboardInputDescriptor {
6962        type Owned = Self;
6963
6964        #[inline(always)]
6965        fn inline_align(_context: fidl::encoding::Context) -> usize {
6966            8
6967        }
6968
6969        #[inline(always)]
6970        fn inline_size(_context: fidl::encoding::Context) -> usize {
6971            16
6972        }
6973    }
6974
6975    unsafe impl<D: fidl::encoding::ResourceDialect>
6976        fidl::encoding::Encode<KeyboardInputDescriptor, D> for &KeyboardInputDescriptor
6977    {
6978        unsafe fn encode(
6979            self,
6980            encoder: &mut fidl::encoding::Encoder<'_, D>,
6981            offset: usize,
6982            mut depth: fidl::encoding::Depth,
6983        ) -> fidl::Result<()> {
6984            encoder.debug_check_bounds::<KeyboardInputDescriptor>(offset);
6985            // Vector header
6986            let max_ordinal: u64 = self.max_ordinal_present();
6987            encoder.write_num(max_ordinal, offset);
6988            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6989            // Calling encoder.out_of_line_offset(0) is not allowed.
6990            if max_ordinal == 0 {
6991                return Ok(());
6992            }
6993            depth.increment()?;
6994            let envelope_size = 8;
6995            let bytes_len = max_ordinal as usize * envelope_size;
6996            #[allow(unused_variables)]
6997            let offset = encoder.out_of_line_offset(bytes_len);
6998            let mut _prev_end_offset: usize = 0;
6999            if 2 > max_ordinal {
7000                return Ok(());
7001            }
7002
7003            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7004            // are envelope_size bytes.
7005            let cur_offset: usize = (2 - 1) * envelope_size;
7006
7007            // Zero reserved fields.
7008            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7009
7010            // Safety:
7011            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7012            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7013            //   envelope_size bytes, there is always sufficient room.
7014            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7015            self.keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7016            encoder, offset + cur_offset, depth
7017        )?;
7018
7019            _prev_end_offset = cur_offset + envelope_size;
7020
7021            Ok(())
7022        }
7023    }
7024
7025    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7026        for KeyboardInputDescriptor
7027    {
7028        #[inline(always)]
7029        fn new_empty() -> Self {
7030            Self::default()
7031        }
7032
7033        unsafe fn decode(
7034            &mut self,
7035            decoder: &mut fidl::encoding::Decoder<'_, D>,
7036            offset: usize,
7037            mut depth: fidl::encoding::Depth,
7038        ) -> fidl::Result<()> {
7039            decoder.debug_check_bounds::<Self>(offset);
7040            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7041                None => return Err(fidl::Error::NotNullable),
7042                Some(len) => len,
7043            };
7044            // Calling decoder.out_of_line_offset(0) is not allowed.
7045            if len == 0 {
7046                return Ok(());
7047            };
7048            depth.increment()?;
7049            let envelope_size = 8;
7050            let bytes_len = len * envelope_size;
7051            let offset = decoder.out_of_line_offset(bytes_len)?;
7052            // Decode the envelope for each type.
7053            let mut _next_ordinal_to_read = 0;
7054            let mut next_offset = offset;
7055            let end_offset = offset + bytes_len;
7056            _next_ordinal_to_read += 1;
7057            if next_offset >= end_offset {
7058                return Ok(());
7059            }
7060
7061            // Decode unknown envelopes for gaps in ordinals.
7062            while _next_ordinal_to_read < 2 {
7063                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7064                _next_ordinal_to_read += 1;
7065                next_offset += envelope_size;
7066            }
7067
7068            let next_out_of_line = decoder.next_out_of_line();
7069            let handles_before = decoder.remaining_handles();
7070            if let Some((inlined, num_bytes, num_handles)) =
7071                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7072            {
7073                let member_inline_size = <fidl::encoding::Vector<
7074                    fidl_fuchsia_input__common::Key,
7075                    256,
7076                > as fidl::encoding::TypeMarker>::inline_size(
7077                    decoder.context
7078                );
7079                if inlined != (member_inline_size <= 4) {
7080                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7081                }
7082                let inner_offset;
7083                let mut inner_depth = depth.clone();
7084                if inlined {
7085                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7086                    inner_offset = next_offset;
7087                } else {
7088                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7089                    inner_depth.increment()?;
7090                }
7091                let val_ref =
7092                self.keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7093                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7094                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7095                {
7096                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7097                }
7098                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7099                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7100                }
7101            }
7102
7103            next_offset += envelope_size;
7104
7105            // Decode the remaining unknown envelopes.
7106            while next_offset < end_offset {
7107                _next_ordinal_to_read += 1;
7108                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7109                next_offset += envelope_size;
7110            }
7111
7112            Ok(())
7113        }
7114    }
7115
7116    impl KeyboardInputReport {
7117        #[inline(always)]
7118        fn max_ordinal_present(&self) -> u64 {
7119            if let Some(_) = self.pressed_keys3 {
7120                return 2;
7121            }
7122            0
7123        }
7124    }
7125
7126    impl fidl::encoding::ValueTypeMarker for KeyboardInputReport {
7127        type Borrowed<'a> = &'a Self;
7128        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7129            value
7130        }
7131    }
7132
7133    unsafe impl fidl::encoding::TypeMarker for KeyboardInputReport {
7134        type Owned = Self;
7135
7136        #[inline(always)]
7137        fn inline_align(_context: fidl::encoding::Context) -> usize {
7138            8
7139        }
7140
7141        #[inline(always)]
7142        fn inline_size(_context: fidl::encoding::Context) -> usize {
7143            16
7144        }
7145    }
7146
7147    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardInputReport, D>
7148        for &KeyboardInputReport
7149    {
7150        unsafe fn encode(
7151            self,
7152            encoder: &mut fidl::encoding::Encoder<'_, D>,
7153            offset: usize,
7154            mut depth: fidl::encoding::Depth,
7155        ) -> fidl::Result<()> {
7156            encoder.debug_check_bounds::<KeyboardInputReport>(offset);
7157            // Vector header
7158            let max_ordinal: u64 = self.max_ordinal_present();
7159            encoder.write_num(max_ordinal, offset);
7160            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7161            // Calling encoder.out_of_line_offset(0) is not allowed.
7162            if max_ordinal == 0 {
7163                return Ok(());
7164            }
7165            depth.increment()?;
7166            let envelope_size = 8;
7167            let bytes_len = max_ordinal as usize * envelope_size;
7168            #[allow(unused_variables)]
7169            let offset = encoder.out_of_line_offset(bytes_len);
7170            let mut _prev_end_offset: usize = 0;
7171            if 2 > max_ordinal {
7172                return Ok(());
7173            }
7174
7175            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7176            // are envelope_size bytes.
7177            let cur_offset: usize = (2 - 1) * envelope_size;
7178
7179            // Zero reserved fields.
7180            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7181
7182            // Safety:
7183            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7184            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7185            //   envelope_size bytes, there is always sufficient room.
7186            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D>(
7187            self.pressed_keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7188            encoder, offset + cur_offset, depth
7189        )?;
7190
7191            _prev_end_offset = cur_offset + envelope_size;
7192
7193            Ok(())
7194        }
7195    }
7196
7197    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardInputReport {
7198        #[inline(always)]
7199        fn new_empty() -> Self {
7200            Self::default()
7201        }
7202
7203        unsafe fn decode(
7204            &mut self,
7205            decoder: &mut fidl::encoding::Decoder<'_, D>,
7206            offset: usize,
7207            mut depth: fidl::encoding::Depth,
7208        ) -> fidl::Result<()> {
7209            decoder.debug_check_bounds::<Self>(offset);
7210            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7211                None => return Err(fidl::Error::NotNullable),
7212                Some(len) => len,
7213            };
7214            // Calling decoder.out_of_line_offset(0) is not allowed.
7215            if len == 0 {
7216                return Ok(());
7217            };
7218            depth.increment()?;
7219            let envelope_size = 8;
7220            let bytes_len = len * envelope_size;
7221            let offset = decoder.out_of_line_offset(bytes_len)?;
7222            // Decode the envelope for each type.
7223            let mut _next_ordinal_to_read = 0;
7224            let mut next_offset = offset;
7225            let end_offset = offset + bytes_len;
7226            _next_ordinal_to_read += 1;
7227            if next_offset >= end_offset {
7228                return Ok(());
7229            }
7230
7231            // Decode unknown envelopes for gaps in ordinals.
7232            while _next_ordinal_to_read < 2 {
7233                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7234                _next_ordinal_to_read += 1;
7235                next_offset += envelope_size;
7236            }
7237
7238            let next_out_of_line = decoder.next_out_of_line();
7239            let handles_before = decoder.remaining_handles();
7240            if let Some((inlined, num_bytes, num_handles)) =
7241                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7242            {
7243                let member_inline_size = <fidl::encoding::Vector<
7244                    fidl_fuchsia_input__common::Key,
7245                    256,
7246                > as fidl::encoding::TypeMarker>::inline_size(
7247                    decoder.context
7248                );
7249                if inlined != (member_inline_size <= 4) {
7250                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7251                }
7252                let inner_offset;
7253                let mut inner_depth = depth.clone();
7254                if inlined {
7255                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7256                    inner_offset = next_offset;
7257                } else {
7258                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7259                    inner_depth.increment()?;
7260                }
7261                let val_ref =
7262                self.pressed_keys3.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D));
7263                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input__common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7264                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7265                {
7266                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7267                }
7268                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7269                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7270                }
7271            }
7272
7273            next_offset += envelope_size;
7274
7275            // Decode the remaining unknown envelopes.
7276            while next_offset < end_offset {
7277                _next_ordinal_to_read += 1;
7278                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7279                next_offset += envelope_size;
7280            }
7281
7282            Ok(())
7283        }
7284    }
7285
7286    impl KeyboardOutputDescriptor {
7287        #[inline(always)]
7288        fn max_ordinal_present(&self) -> u64 {
7289            if let Some(_) = self.leds {
7290                return 1;
7291            }
7292            0
7293        }
7294    }
7295
7296    impl fidl::encoding::ValueTypeMarker for KeyboardOutputDescriptor {
7297        type Borrowed<'a> = &'a Self;
7298        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7299            value
7300        }
7301    }
7302
7303    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputDescriptor {
7304        type Owned = Self;
7305
7306        #[inline(always)]
7307        fn inline_align(_context: fidl::encoding::Context) -> usize {
7308            8
7309        }
7310
7311        #[inline(always)]
7312        fn inline_size(_context: fidl::encoding::Context) -> usize {
7313            16
7314        }
7315    }
7316
7317    unsafe impl<D: fidl::encoding::ResourceDialect>
7318        fidl::encoding::Encode<KeyboardOutputDescriptor, D> for &KeyboardOutputDescriptor
7319    {
7320        unsafe fn encode(
7321            self,
7322            encoder: &mut fidl::encoding::Encoder<'_, D>,
7323            offset: usize,
7324            mut depth: fidl::encoding::Depth,
7325        ) -> fidl::Result<()> {
7326            encoder.debug_check_bounds::<KeyboardOutputDescriptor>(offset);
7327            // Vector header
7328            let max_ordinal: u64 = self.max_ordinal_present();
7329            encoder.write_num(max_ordinal, offset);
7330            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7331            // Calling encoder.out_of_line_offset(0) is not allowed.
7332            if max_ordinal == 0 {
7333                return Ok(());
7334            }
7335            depth.increment()?;
7336            let envelope_size = 8;
7337            let bytes_len = max_ordinal as usize * envelope_size;
7338            #[allow(unused_variables)]
7339            let offset = encoder.out_of_line_offset(bytes_len);
7340            let mut _prev_end_offset: usize = 0;
7341            if 1 > max_ordinal {
7342                return Ok(());
7343            }
7344
7345            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7346            // are envelope_size bytes.
7347            let cur_offset: usize = (1 - 1) * envelope_size;
7348
7349            // Zero reserved fields.
7350            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7351
7352            // Safety:
7353            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7354            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7355            //   envelope_size bytes, there is always sufficient room.
7356            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7357            self.leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7358            encoder, offset + cur_offset, depth
7359        )?;
7360
7361            _prev_end_offset = cur_offset + envelope_size;
7362
7363            Ok(())
7364        }
7365    }
7366
7367    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7368        for KeyboardOutputDescriptor
7369    {
7370        #[inline(always)]
7371        fn new_empty() -> Self {
7372            Self::default()
7373        }
7374
7375        unsafe fn decode(
7376            &mut self,
7377            decoder: &mut fidl::encoding::Decoder<'_, D>,
7378            offset: usize,
7379            mut depth: fidl::encoding::Depth,
7380        ) -> fidl::Result<()> {
7381            decoder.debug_check_bounds::<Self>(offset);
7382            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7383                None => return Err(fidl::Error::NotNullable),
7384                Some(len) => len,
7385            };
7386            // Calling decoder.out_of_line_offset(0) is not allowed.
7387            if len == 0 {
7388                return Ok(());
7389            };
7390            depth.increment()?;
7391            let envelope_size = 8;
7392            let bytes_len = len * envelope_size;
7393            let offset = decoder.out_of_line_offset(bytes_len)?;
7394            // Decode the envelope for each type.
7395            let mut _next_ordinal_to_read = 0;
7396            let mut next_offset = offset;
7397            let end_offset = offset + bytes_len;
7398            _next_ordinal_to_read += 1;
7399            if next_offset >= end_offset {
7400                return Ok(());
7401            }
7402
7403            // Decode unknown envelopes for gaps in ordinals.
7404            while _next_ordinal_to_read < 1 {
7405                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7406                _next_ordinal_to_read += 1;
7407                next_offset += envelope_size;
7408            }
7409
7410            let next_out_of_line = decoder.next_out_of_line();
7411            let handles_before = decoder.remaining_handles();
7412            if let Some((inlined, num_bytes, num_handles)) =
7413                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7414            {
7415                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7416                if inlined != (member_inline_size <= 4) {
7417                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7418                }
7419                let inner_offset;
7420                let mut inner_depth = depth.clone();
7421                if inlined {
7422                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7423                    inner_offset = next_offset;
7424                } else {
7425                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7426                    inner_depth.increment()?;
7427                }
7428                let val_ref = self.leds.get_or_insert_with(
7429                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7430                );
7431                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7432                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7433                {
7434                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7435                }
7436                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7437                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7438                }
7439            }
7440
7441            next_offset += envelope_size;
7442
7443            // Decode the remaining unknown envelopes.
7444            while next_offset < end_offset {
7445                _next_ordinal_to_read += 1;
7446                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7447                next_offset += envelope_size;
7448            }
7449
7450            Ok(())
7451        }
7452    }
7453
7454    impl KeyboardOutputReport {
7455        #[inline(always)]
7456        fn max_ordinal_present(&self) -> u64 {
7457            if let Some(_) = self.enabled_leds {
7458                return 1;
7459            }
7460            0
7461        }
7462    }
7463
7464    impl fidl::encoding::ValueTypeMarker for KeyboardOutputReport {
7465        type Borrowed<'a> = &'a Self;
7466        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7467            value
7468        }
7469    }
7470
7471    unsafe impl fidl::encoding::TypeMarker for KeyboardOutputReport {
7472        type Owned = Self;
7473
7474        #[inline(always)]
7475        fn inline_align(_context: fidl::encoding::Context) -> usize {
7476            8
7477        }
7478
7479        #[inline(always)]
7480        fn inline_size(_context: fidl::encoding::Context) -> usize {
7481            16
7482        }
7483    }
7484
7485    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardOutputReport, D>
7486        for &KeyboardOutputReport
7487    {
7488        unsafe fn encode(
7489            self,
7490            encoder: &mut fidl::encoding::Encoder<'_, D>,
7491            offset: usize,
7492            mut depth: fidl::encoding::Depth,
7493        ) -> fidl::Result<()> {
7494            encoder.debug_check_bounds::<KeyboardOutputReport>(offset);
7495            // Vector header
7496            let max_ordinal: u64 = self.max_ordinal_present();
7497            encoder.write_num(max_ordinal, offset);
7498            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7499            // Calling encoder.out_of_line_offset(0) is not allowed.
7500            if max_ordinal == 0 {
7501                return Ok(());
7502            }
7503            depth.increment()?;
7504            let envelope_size = 8;
7505            let bytes_len = max_ordinal as usize * envelope_size;
7506            #[allow(unused_variables)]
7507            let offset = encoder.out_of_line_offset(bytes_len);
7508            let mut _prev_end_offset: usize = 0;
7509            if 1 > max_ordinal {
7510                return Ok(());
7511            }
7512
7513            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7514            // are envelope_size bytes.
7515            let cur_offset: usize = (1 - 1) * envelope_size;
7516
7517            // Zero reserved fields.
7518            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7519
7520            // Safety:
7521            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7522            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7523            //   envelope_size bytes, there is always sufficient room.
7524            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7525            self.enabled_leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7526            encoder, offset + cur_offset, depth
7527        )?;
7528
7529            _prev_end_offset = cur_offset + envelope_size;
7530
7531            Ok(())
7532        }
7533    }
7534
7535    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardOutputReport {
7536        #[inline(always)]
7537        fn new_empty() -> Self {
7538            Self::default()
7539        }
7540
7541        unsafe fn decode(
7542            &mut self,
7543            decoder: &mut fidl::encoding::Decoder<'_, D>,
7544            offset: usize,
7545            mut depth: fidl::encoding::Depth,
7546        ) -> fidl::Result<()> {
7547            decoder.debug_check_bounds::<Self>(offset);
7548            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7549                None => return Err(fidl::Error::NotNullable),
7550                Some(len) => len,
7551            };
7552            // Calling decoder.out_of_line_offset(0) is not allowed.
7553            if len == 0 {
7554                return Ok(());
7555            };
7556            depth.increment()?;
7557            let envelope_size = 8;
7558            let bytes_len = len * envelope_size;
7559            let offset = decoder.out_of_line_offset(bytes_len)?;
7560            // Decode the envelope for each type.
7561            let mut _next_ordinal_to_read = 0;
7562            let mut next_offset = offset;
7563            let end_offset = offset + bytes_len;
7564            _next_ordinal_to_read += 1;
7565            if next_offset >= end_offset {
7566                return Ok(());
7567            }
7568
7569            // Decode unknown envelopes for gaps in ordinals.
7570            while _next_ordinal_to_read < 1 {
7571                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7572                _next_ordinal_to_read += 1;
7573                next_offset += envelope_size;
7574            }
7575
7576            let next_out_of_line = decoder.next_out_of_line();
7577            let handles_before = decoder.remaining_handles();
7578            if let Some((inlined, num_bytes, num_handles)) =
7579                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7580            {
7581                let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7582                if inlined != (member_inline_size <= 4) {
7583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7584                }
7585                let inner_offset;
7586                let mut inner_depth = depth.clone();
7587                if inlined {
7588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7589                    inner_offset = next_offset;
7590                } else {
7591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7592                    inner_depth.increment()?;
7593                }
7594                let val_ref = self.enabled_leds.get_or_insert_with(
7595                    || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7596                );
7597                fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7598                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7599                {
7600                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7601                }
7602                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7603                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7604                }
7605            }
7606
7607            next_offset += envelope_size;
7608
7609            // Decode the remaining unknown envelopes.
7610            while next_offset < end_offset {
7611                _next_ordinal_to_read += 1;
7612                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7613                next_offset += envelope_size;
7614            }
7615
7616            Ok(())
7617        }
7618    }
7619
7620    impl MouseDescriptor {
7621        #[inline(always)]
7622        fn max_ordinal_present(&self) -> u64 {
7623            if let Some(_) = self.input {
7624                return 1;
7625            }
7626            0
7627        }
7628    }
7629
7630    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
7631        type Borrowed<'a> = &'a Self;
7632        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7633            value
7634        }
7635    }
7636
7637    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
7638        type Owned = Self;
7639
7640        #[inline(always)]
7641        fn inline_align(_context: fidl::encoding::Context) -> usize {
7642            8
7643        }
7644
7645        #[inline(always)]
7646        fn inline_size(_context: fidl::encoding::Context) -> usize {
7647            16
7648        }
7649    }
7650
7651    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
7652        for &MouseDescriptor
7653    {
7654        unsafe fn encode(
7655            self,
7656            encoder: &mut fidl::encoding::Encoder<'_, D>,
7657            offset: usize,
7658            mut depth: fidl::encoding::Depth,
7659        ) -> fidl::Result<()> {
7660            encoder.debug_check_bounds::<MouseDescriptor>(offset);
7661            // Vector header
7662            let max_ordinal: u64 = self.max_ordinal_present();
7663            encoder.write_num(max_ordinal, offset);
7664            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7665            // Calling encoder.out_of_line_offset(0) is not allowed.
7666            if max_ordinal == 0 {
7667                return Ok(());
7668            }
7669            depth.increment()?;
7670            let envelope_size = 8;
7671            let bytes_len = max_ordinal as usize * envelope_size;
7672            #[allow(unused_variables)]
7673            let offset = encoder.out_of_line_offset(bytes_len);
7674            let mut _prev_end_offset: usize = 0;
7675            if 1 > max_ordinal {
7676                return Ok(());
7677            }
7678
7679            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7680            // are envelope_size bytes.
7681            let cur_offset: usize = (1 - 1) * envelope_size;
7682
7683            // Zero reserved fields.
7684            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7685
7686            // Safety:
7687            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7688            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7689            //   envelope_size bytes, there is always sufficient room.
7690            fidl::encoding::encode_in_envelope_optional::<MouseInputDescriptor, D>(
7691                self.input
7692                    .as_ref()
7693                    .map(<MouseInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
7694                encoder,
7695                offset + cur_offset,
7696                depth,
7697            )?;
7698
7699            _prev_end_offset = cur_offset + envelope_size;
7700
7701            Ok(())
7702        }
7703    }
7704
7705    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
7706        #[inline(always)]
7707        fn new_empty() -> Self {
7708            Self::default()
7709        }
7710
7711        unsafe fn decode(
7712            &mut self,
7713            decoder: &mut fidl::encoding::Decoder<'_, D>,
7714            offset: usize,
7715            mut depth: fidl::encoding::Depth,
7716        ) -> fidl::Result<()> {
7717            decoder.debug_check_bounds::<Self>(offset);
7718            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7719                None => return Err(fidl::Error::NotNullable),
7720                Some(len) => len,
7721            };
7722            // Calling decoder.out_of_line_offset(0) is not allowed.
7723            if len == 0 {
7724                return Ok(());
7725            };
7726            depth.increment()?;
7727            let envelope_size = 8;
7728            let bytes_len = len * envelope_size;
7729            let offset = decoder.out_of_line_offset(bytes_len)?;
7730            // Decode the envelope for each type.
7731            let mut _next_ordinal_to_read = 0;
7732            let mut next_offset = offset;
7733            let end_offset = offset + bytes_len;
7734            _next_ordinal_to_read += 1;
7735            if next_offset >= end_offset {
7736                return Ok(());
7737            }
7738
7739            // Decode unknown envelopes for gaps in ordinals.
7740            while _next_ordinal_to_read < 1 {
7741                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7742                _next_ordinal_to_read += 1;
7743                next_offset += envelope_size;
7744            }
7745
7746            let next_out_of_line = decoder.next_out_of_line();
7747            let handles_before = decoder.remaining_handles();
7748            if let Some((inlined, num_bytes, num_handles)) =
7749                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7750            {
7751                let member_inline_size =
7752                    <MouseInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
7753                        decoder.context,
7754                    );
7755                if inlined != (member_inline_size <= 4) {
7756                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7757                }
7758                let inner_offset;
7759                let mut inner_depth = depth.clone();
7760                if inlined {
7761                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7762                    inner_offset = next_offset;
7763                } else {
7764                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7765                    inner_depth.increment()?;
7766                }
7767                let val_ref =
7768                    self.input.get_or_insert_with(|| fidl::new_empty!(MouseInputDescriptor, D));
7769                fidl::decode!(
7770                    MouseInputDescriptor,
7771                    D,
7772                    val_ref,
7773                    decoder,
7774                    inner_offset,
7775                    inner_depth
7776                )?;
7777                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7778                {
7779                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7780                }
7781                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7782                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7783                }
7784            }
7785
7786            next_offset += envelope_size;
7787
7788            // Decode the remaining unknown envelopes.
7789            while next_offset < end_offset {
7790                _next_ordinal_to_read += 1;
7791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7792                next_offset += envelope_size;
7793            }
7794
7795            Ok(())
7796        }
7797    }
7798
7799    impl MouseInputDescriptor {
7800        #[inline(always)]
7801        fn max_ordinal_present(&self) -> u64 {
7802            if let Some(_) = self.position_y {
7803                return 7;
7804            }
7805            if let Some(_) = self.position_x {
7806                return 6;
7807            }
7808            if let Some(_) = self.buttons {
7809                return 5;
7810            }
7811            if let Some(_) = self.scroll_h {
7812                return 4;
7813            }
7814            if let Some(_) = self.scroll_v {
7815                return 3;
7816            }
7817            if let Some(_) = self.movement_y {
7818                return 2;
7819            }
7820            if let Some(_) = self.movement_x {
7821                return 1;
7822            }
7823            0
7824        }
7825    }
7826
7827    impl fidl::encoding::ValueTypeMarker for MouseInputDescriptor {
7828        type Borrowed<'a> = &'a Self;
7829        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7830            value
7831        }
7832    }
7833
7834    unsafe impl fidl::encoding::TypeMarker for MouseInputDescriptor {
7835        type Owned = Self;
7836
7837        #[inline(always)]
7838        fn inline_align(_context: fidl::encoding::Context) -> usize {
7839            8
7840        }
7841
7842        #[inline(always)]
7843        fn inline_size(_context: fidl::encoding::Context) -> usize {
7844            16
7845        }
7846    }
7847
7848    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputDescriptor, D>
7849        for &MouseInputDescriptor
7850    {
7851        unsafe fn encode(
7852            self,
7853            encoder: &mut fidl::encoding::Encoder<'_, D>,
7854            offset: usize,
7855            mut depth: fidl::encoding::Depth,
7856        ) -> fidl::Result<()> {
7857            encoder.debug_check_bounds::<MouseInputDescriptor>(offset);
7858            // Vector header
7859            let max_ordinal: u64 = self.max_ordinal_present();
7860            encoder.write_num(max_ordinal, offset);
7861            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7862            // Calling encoder.out_of_line_offset(0) is not allowed.
7863            if max_ordinal == 0 {
7864                return Ok(());
7865            }
7866            depth.increment()?;
7867            let envelope_size = 8;
7868            let bytes_len = max_ordinal as usize * envelope_size;
7869            #[allow(unused_variables)]
7870            let offset = encoder.out_of_line_offset(bytes_len);
7871            let mut _prev_end_offset: usize = 0;
7872            if 1 > max_ordinal {
7873                return Ok(());
7874            }
7875
7876            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7877            // are envelope_size bytes.
7878            let cur_offset: usize = (1 - 1) * envelope_size;
7879
7880            // Zero reserved fields.
7881            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7882
7883            // Safety:
7884            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7885            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7886            //   envelope_size bytes, there is always sufficient room.
7887            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7888                self.movement_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7889                encoder,
7890                offset + cur_offset,
7891                depth,
7892            )?;
7893
7894            _prev_end_offset = cur_offset + envelope_size;
7895            if 2 > max_ordinal {
7896                return Ok(());
7897            }
7898
7899            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7900            // are envelope_size bytes.
7901            let cur_offset: usize = (2 - 1) * envelope_size;
7902
7903            // Zero reserved fields.
7904            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7905
7906            // Safety:
7907            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7908            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7909            //   envelope_size bytes, there is always sufficient room.
7910            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7911                self.movement_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7912                encoder,
7913                offset + cur_offset,
7914                depth,
7915            )?;
7916
7917            _prev_end_offset = cur_offset + envelope_size;
7918            if 3 > max_ordinal {
7919                return Ok(());
7920            }
7921
7922            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7923            // are envelope_size bytes.
7924            let cur_offset: usize = (3 - 1) * envelope_size;
7925
7926            // Zero reserved fields.
7927            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7928
7929            // Safety:
7930            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7931            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7932            //   envelope_size bytes, there is always sufficient room.
7933            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7934                self.scroll_v.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7935                encoder,
7936                offset + cur_offset,
7937                depth,
7938            )?;
7939
7940            _prev_end_offset = cur_offset + envelope_size;
7941            if 4 > max_ordinal {
7942                return Ok(());
7943            }
7944
7945            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7946            // are envelope_size bytes.
7947            let cur_offset: usize = (4 - 1) * envelope_size;
7948
7949            // Zero reserved fields.
7950            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7951
7952            // Safety:
7953            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7954            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7955            //   envelope_size bytes, there is always sufficient room.
7956            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7957                self.scroll_h.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7958                encoder,
7959                offset + cur_offset,
7960                depth,
7961            )?;
7962
7963            _prev_end_offset = cur_offset + envelope_size;
7964            if 5 > max_ordinal {
7965                return Ok(());
7966            }
7967
7968            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7969            // are envelope_size bytes.
7970            let cur_offset: usize = (5 - 1) * envelope_size;
7971
7972            // Zero reserved fields.
7973            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7974
7975            // Safety:
7976            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7977            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7978            //   envelope_size bytes, there is always sufficient room.
7979            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
7980                self.buttons.as_ref().map(
7981                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
7982                ),
7983                encoder,
7984                offset + cur_offset,
7985                depth,
7986            )?;
7987
7988            _prev_end_offset = cur_offset + envelope_size;
7989            if 6 > max_ordinal {
7990                return Ok(());
7991            }
7992
7993            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7994            // are envelope_size bytes.
7995            let cur_offset: usize = (6 - 1) * envelope_size;
7996
7997            // Zero reserved fields.
7998            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7999
8000            // Safety:
8001            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8002            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8003            //   envelope_size bytes, there is always sufficient room.
8004            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8005                self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8006                encoder,
8007                offset + cur_offset,
8008                depth,
8009            )?;
8010
8011            _prev_end_offset = cur_offset + envelope_size;
8012            if 7 > max_ordinal {
8013                return Ok(());
8014            }
8015
8016            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8017            // are envelope_size bytes.
8018            let cur_offset: usize = (7 - 1) * envelope_size;
8019
8020            // Zero reserved fields.
8021            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8022
8023            // Safety:
8024            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8025            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8026            //   envelope_size bytes, there is always sufficient room.
8027            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8028                self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8029                encoder,
8030                offset + cur_offset,
8031                depth,
8032            )?;
8033
8034            _prev_end_offset = cur_offset + envelope_size;
8035
8036            Ok(())
8037        }
8038    }
8039
8040    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputDescriptor {
8041        #[inline(always)]
8042        fn new_empty() -> Self {
8043            Self::default()
8044        }
8045
8046        unsafe fn decode(
8047            &mut self,
8048            decoder: &mut fidl::encoding::Decoder<'_, D>,
8049            offset: usize,
8050            mut depth: fidl::encoding::Depth,
8051        ) -> fidl::Result<()> {
8052            decoder.debug_check_bounds::<Self>(offset);
8053            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8054                None => return Err(fidl::Error::NotNullable),
8055                Some(len) => len,
8056            };
8057            // Calling decoder.out_of_line_offset(0) is not allowed.
8058            if len == 0 {
8059                return Ok(());
8060            };
8061            depth.increment()?;
8062            let envelope_size = 8;
8063            let bytes_len = len * envelope_size;
8064            let offset = decoder.out_of_line_offset(bytes_len)?;
8065            // Decode the envelope for each type.
8066            let mut _next_ordinal_to_read = 0;
8067            let mut next_offset = offset;
8068            let end_offset = offset + bytes_len;
8069            _next_ordinal_to_read += 1;
8070            if next_offset >= end_offset {
8071                return Ok(());
8072            }
8073
8074            // Decode unknown envelopes for gaps in ordinals.
8075            while _next_ordinal_to_read < 1 {
8076                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8077                _next_ordinal_to_read += 1;
8078                next_offset += envelope_size;
8079            }
8080
8081            let next_out_of_line = decoder.next_out_of_line();
8082            let handles_before = decoder.remaining_handles();
8083            if let Some((inlined, num_bytes, num_handles)) =
8084                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8085            {
8086                let member_inline_size =
8087                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8088                if inlined != (member_inline_size <= 4) {
8089                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8090                }
8091                let inner_offset;
8092                let mut inner_depth = depth.clone();
8093                if inlined {
8094                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8095                    inner_offset = next_offset;
8096                } else {
8097                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8098                    inner_depth.increment()?;
8099                }
8100                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8101                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8102                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8103                {
8104                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8105                }
8106                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8107                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8108                }
8109            }
8110
8111            next_offset += envelope_size;
8112            _next_ordinal_to_read += 1;
8113            if next_offset >= end_offset {
8114                return Ok(());
8115            }
8116
8117            // Decode unknown envelopes for gaps in ordinals.
8118            while _next_ordinal_to_read < 2 {
8119                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8120                _next_ordinal_to_read += 1;
8121                next_offset += envelope_size;
8122            }
8123
8124            let next_out_of_line = decoder.next_out_of_line();
8125            let handles_before = decoder.remaining_handles();
8126            if let Some((inlined, num_bytes, num_handles)) =
8127                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8128            {
8129                let member_inline_size =
8130                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8131                if inlined != (member_inline_size <= 4) {
8132                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8133                }
8134                let inner_offset;
8135                let mut inner_depth = depth.clone();
8136                if inlined {
8137                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8138                    inner_offset = next_offset;
8139                } else {
8140                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8141                    inner_depth.increment()?;
8142                }
8143                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8144                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8145                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8146                {
8147                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8148                }
8149                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8150                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8151                }
8152            }
8153
8154            next_offset += envelope_size;
8155            _next_ordinal_to_read += 1;
8156            if next_offset >= end_offset {
8157                return Ok(());
8158            }
8159
8160            // Decode unknown envelopes for gaps in ordinals.
8161            while _next_ordinal_to_read < 3 {
8162                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8163                _next_ordinal_to_read += 1;
8164                next_offset += envelope_size;
8165            }
8166
8167            let next_out_of_line = decoder.next_out_of_line();
8168            let handles_before = decoder.remaining_handles();
8169            if let Some((inlined, num_bytes, num_handles)) =
8170                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8171            {
8172                let member_inline_size =
8173                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8174                if inlined != (member_inline_size <= 4) {
8175                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8176                }
8177                let inner_offset;
8178                let mut inner_depth = depth.clone();
8179                if inlined {
8180                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8181                    inner_offset = next_offset;
8182                } else {
8183                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8184                    inner_depth.increment()?;
8185                }
8186                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8187                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8188                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8189                {
8190                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8191                }
8192                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8193                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8194                }
8195            }
8196
8197            next_offset += envelope_size;
8198            _next_ordinal_to_read += 1;
8199            if next_offset >= end_offset {
8200                return Ok(());
8201            }
8202
8203            // Decode unknown envelopes for gaps in ordinals.
8204            while _next_ordinal_to_read < 4 {
8205                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8206                _next_ordinal_to_read += 1;
8207                next_offset += envelope_size;
8208            }
8209
8210            let next_out_of_line = decoder.next_out_of_line();
8211            let handles_before = decoder.remaining_handles();
8212            if let Some((inlined, num_bytes, num_handles)) =
8213                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8214            {
8215                let member_inline_size =
8216                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8217                if inlined != (member_inline_size <= 4) {
8218                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8219                }
8220                let inner_offset;
8221                let mut inner_depth = depth.clone();
8222                if inlined {
8223                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8224                    inner_offset = next_offset;
8225                } else {
8226                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8227                    inner_depth.increment()?;
8228                }
8229                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8230                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8231                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8232                {
8233                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8234                }
8235                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8236                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8237                }
8238            }
8239
8240            next_offset += envelope_size;
8241            _next_ordinal_to_read += 1;
8242            if next_offset >= end_offset {
8243                return Ok(());
8244            }
8245
8246            // Decode unknown envelopes for gaps in ordinals.
8247            while _next_ordinal_to_read < 5 {
8248                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8249                _next_ordinal_to_read += 1;
8250                next_offset += envelope_size;
8251            }
8252
8253            let next_out_of_line = decoder.next_out_of_line();
8254            let handles_before = decoder.remaining_handles();
8255            if let Some((inlined, num_bytes, num_handles)) =
8256                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8257            {
8258                let member_inline_size =
8259                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8260                        decoder.context,
8261                    );
8262                if inlined != (member_inline_size <= 4) {
8263                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8264                }
8265                let inner_offset;
8266                let mut inner_depth = depth.clone();
8267                if inlined {
8268                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8269                    inner_offset = next_offset;
8270                } else {
8271                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8272                    inner_depth.increment()?;
8273                }
8274                let val_ref = self
8275                    .buttons
8276                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8277                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8279                {
8280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8281                }
8282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8284                }
8285            }
8286
8287            next_offset += envelope_size;
8288            _next_ordinal_to_read += 1;
8289            if next_offset >= end_offset {
8290                return Ok(());
8291            }
8292
8293            // Decode unknown envelopes for gaps in ordinals.
8294            while _next_ordinal_to_read < 6 {
8295                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8296                _next_ordinal_to_read += 1;
8297                next_offset += envelope_size;
8298            }
8299
8300            let next_out_of_line = decoder.next_out_of_line();
8301            let handles_before = decoder.remaining_handles();
8302            if let Some((inlined, num_bytes, num_handles)) =
8303                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8304            {
8305                let member_inline_size =
8306                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8307                if inlined != (member_inline_size <= 4) {
8308                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8309                }
8310                let inner_offset;
8311                let mut inner_depth = depth.clone();
8312                if inlined {
8313                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8314                    inner_offset = next_offset;
8315                } else {
8316                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8317                    inner_depth.increment()?;
8318                }
8319                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8320                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8322                {
8323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8324                }
8325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8327                }
8328            }
8329
8330            next_offset += envelope_size;
8331            _next_ordinal_to_read += 1;
8332            if next_offset >= end_offset {
8333                return Ok(());
8334            }
8335
8336            // Decode unknown envelopes for gaps in ordinals.
8337            while _next_ordinal_to_read < 7 {
8338                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8339                _next_ordinal_to_read += 1;
8340                next_offset += envelope_size;
8341            }
8342
8343            let next_out_of_line = decoder.next_out_of_line();
8344            let handles_before = decoder.remaining_handles();
8345            if let Some((inlined, num_bytes, num_handles)) =
8346                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8347            {
8348                let member_inline_size =
8349                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8350                if inlined != (member_inline_size <= 4) {
8351                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8352                }
8353                let inner_offset;
8354                let mut inner_depth = depth.clone();
8355                if inlined {
8356                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8357                    inner_offset = next_offset;
8358                } else {
8359                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8360                    inner_depth.increment()?;
8361                }
8362                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8363                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8364                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8365                {
8366                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8367                }
8368                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8369                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8370                }
8371            }
8372
8373            next_offset += envelope_size;
8374
8375            // Decode the remaining unknown envelopes.
8376            while next_offset < end_offset {
8377                _next_ordinal_to_read += 1;
8378                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8379                next_offset += envelope_size;
8380            }
8381
8382            Ok(())
8383        }
8384    }
8385
8386    impl MouseInputReport {
8387        #[inline(always)]
8388        fn max_ordinal_present(&self) -> u64 {
8389            if let Some(_) = self.position_y {
8390                return 7;
8391            }
8392            if let Some(_) = self.position_x {
8393                return 6;
8394            }
8395            if let Some(_) = self.pressed_buttons {
8396                return 5;
8397            }
8398            if let Some(_) = self.scroll_h {
8399                return 4;
8400            }
8401            if let Some(_) = self.scroll_v {
8402                return 3;
8403            }
8404            if let Some(_) = self.movement_y {
8405                return 2;
8406            }
8407            if let Some(_) = self.movement_x {
8408                return 1;
8409            }
8410            0
8411        }
8412    }
8413
8414    impl fidl::encoding::ValueTypeMarker for MouseInputReport {
8415        type Borrowed<'a> = &'a Self;
8416        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8417            value
8418        }
8419    }
8420
8421    unsafe impl fidl::encoding::TypeMarker for MouseInputReport {
8422        type Owned = Self;
8423
8424        #[inline(always)]
8425        fn inline_align(_context: fidl::encoding::Context) -> usize {
8426            8
8427        }
8428
8429        #[inline(always)]
8430        fn inline_size(_context: fidl::encoding::Context) -> usize {
8431            16
8432        }
8433    }
8434
8435    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputReport, D>
8436        for &MouseInputReport
8437    {
8438        unsafe fn encode(
8439            self,
8440            encoder: &mut fidl::encoding::Encoder<'_, D>,
8441            offset: usize,
8442            mut depth: fidl::encoding::Depth,
8443        ) -> fidl::Result<()> {
8444            encoder.debug_check_bounds::<MouseInputReport>(offset);
8445            // Vector header
8446            let max_ordinal: u64 = self.max_ordinal_present();
8447            encoder.write_num(max_ordinal, offset);
8448            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8449            // Calling encoder.out_of_line_offset(0) is not allowed.
8450            if max_ordinal == 0 {
8451                return Ok(());
8452            }
8453            depth.increment()?;
8454            let envelope_size = 8;
8455            let bytes_len = max_ordinal as usize * envelope_size;
8456            #[allow(unused_variables)]
8457            let offset = encoder.out_of_line_offset(bytes_len);
8458            let mut _prev_end_offset: usize = 0;
8459            if 1 > max_ordinal {
8460                return Ok(());
8461            }
8462
8463            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8464            // are envelope_size bytes.
8465            let cur_offset: usize = (1 - 1) * envelope_size;
8466
8467            // Zero reserved fields.
8468            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8469
8470            // Safety:
8471            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8472            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8473            //   envelope_size bytes, there is always sufficient room.
8474            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8475                self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8476                encoder,
8477                offset + cur_offset,
8478                depth,
8479            )?;
8480
8481            _prev_end_offset = cur_offset + envelope_size;
8482            if 2 > max_ordinal {
8483                return Ok(());
8484            }
8485
8486            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8487            // are envelope_size bytes.
8488            let cur_offset: usize = (2 - 1) * envelope_size;
8489
8490            // Zero reserved fields.
8491            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8492
8493            // Safety:
8494            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8495            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8496            //   envelope_size bytes, there is always sufficient room.
8497            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8498                self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8499                encoder,
8500                offset + cur_offset,
8501                depth,
8502            )?;
8503
8504            _prev_end_offset = cur_offset + envelope_size;
8505            if 3 > max_ordinal {
8506                return Ok(());
8507            }
8508
8509            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8510            // are envelope_size bytes.
8511            let cur_offset: usize = (3 - 1) * envelope_size;
8512
8513            // Zero reserved fields.
8514            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8515
8516            // Safety:
8517            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8518            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8519            //   envelope_size bytes, there is always sufficient room.
8520            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8521                self.scroll_v.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8522                encoder,
8523                offset + cur_offset,
8524                depth,
8525            )?;
8526
8527            _prev_end_offset = cur_offset + envelope_size;
8528            if 4 > max_ordinal {
8529                return Ok(());
8530            }
8531
8532            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8533            // are envelope_size bytes.
8534            let cur_offset: usize = (4 - 1) * envelope_size;
8535
8536            // Zero reserved fields.
8537            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8538
8539            // Safety:
8540            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8541            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8542            //   envelope_size bytes, there is always sufficient room.
8543            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8544                self.scroll_h.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8545                encoder,
8546                offset + cur_offset,
8547                depth,
8548            )?;
8549
8550            _prev_end_offset = cur_offset + envelope_size;
8551            if 5 > max_ordinal {
8552                return Ok(());
8553            }
8554
8555            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8556            // are envelope_size bytes.
8557            let cur_offset: usize = (5 - 1) * envelope_size;
8558
8559            // Zero reserved fields.
8560            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8561
8562            // Safety:
8563            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8564            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8565            //   envelope_size bytes, there is always sufficient room.
8566            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
8567                self.pressed_buttons.as_ref().map(
8568                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
8569                ),
8570                encoder,
8571                offset + cur_offset,
8572                depth,
8573            )?;
8574
8575            _prev_end_offset = cur_offset + envelope_size;
8576            if 6 > max_ordinal {
8577                return Ok(());
8578            }
8579
8580            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8581            // are envelope_size bytes.
8582            let cur_offset: usize = (6 - 1) * envelope_size;
8583
8584            // Zero reserved fields.
8585            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8586
8587            // Safety:
8588            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8589            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8590            //   envelope_size bytes, there is always sufficient room.
8591            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8592                self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8593                encoder,
8594                offset + cur_offset,
8595                depth,
8596            )?;
8597
8598            _prev_end_offset = cur_offset + envelope_size;
8599            if 7 > max_ordinal {
8600                return Ok(());
8601            }
8602
8603            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8604            // are envelope_size bytes.
8605            let cur_offset: usize = (7 - 1) * envelope_size;
8606
8607            // Zero reserved fields.
8608            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8609
8610            // Safety:
8611            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8612            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8613            //   envelope_size bytes, there is always sufficient room.
8614            fidl::encoding::encode_in_envelope_optional::<i64, D>(
8615                self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8616                encoder,
8617                offset + cur_offset,
8618                depth,
8619            )?;
8620
8621            _prev_end_offset = cur_offset + envelope_size;
8622
8623            Ok(())
8624        }
8625    }
8626
8627    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputReport {
8628        #[inline(always)]
8629        fn new_empty() -> Self {
8630            Self::default()
8631        }
8632
8633        unsafe fn decode(
8634            &mut self,
8635            decoder: &mut fidl::encoding::Decoder<'_, D>,
8636            offset: usize,
8637            mut depth: fidl::encoding::Depth,
8638        ) -> fidl::Result<()> {
8639            decoder.debug_check_bounds::<Self>(offset);
8640            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8641                None => return Err(fidl::Error::NotNullable),
8642                Some(len) => len,
8643            };
8644            // Calling decoder.out_of_line_offset(0) is not allowed.
8645            if len == 0 {
8646                return Ok(());
8647            };
8648            depth.increment()?;
8649            let envelope_size = 8;
8650            let bytes_len = len * envelope_size;
8651            let offset = decoder.out_of_line_offset(bytes_len)?;
8652            // Decode the envelope for each type.
8653            let mut _next_ordinal_to_read = 0;
8654            let mut next_offset = offset;
8655            let end_offset = offset + bytes_len;
8656            _next_ordinal_to_read += 1;
8657            if next_offset >= end_offset {
8658                return Ok(());
8659            }
8660
8661            // Decode unknown envelopes for gaps in ordinals.
8662            while _next_ordinal_to_read < 1 {
8663                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8664                _next_ordinal_to_read += 1;
8665                next_offset += envelope_size;
8666            }
8667
8668            let next_out_of_line = decoder.next_out_of_line();
8669            let handles_before = decoder.remaining_handles();
8670            if let Some((inlined, num_bytes, num_handles)) =
8671                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8672            {
8673                let member_inline_size =
8674                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8675                if inlined != (member_inline_size <= 4) {
8676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8677                }
8678                let inner_offset;
8679                let mut inner_depth = depth.clone();
8680                if inlined {
8681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8682                    inner_offset = next_offset;
8683                } else {
8684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8685                    inner_depth.increment()?;
8686                }
8687                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8688                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8689                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8690                {
8691                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8692                }
8693                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8694                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8695                }
8696            }
8697
8698            next_offset += envelope_size;
8699            _next_ordinal_to_read += 1;
8700            if next_offset >= end_offset {
8701                return Ok(());
8702            }
8703
8704            // Decode unknown envelopes for gaps in ordinals.
8705            while _next_ordinal_to_read < 2 {
8706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8707                _next_ordinal_to_read += 1;
8708                next_offset += envelope_size;
8709            }
8710
8711            let next_out_of_line = decoder.next_out_of_line();
8712            let handles_before = decoder.remaining_handles();
8713            if let Some((inlined, num_bytes, num_handles)) =
8714                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8715            {
8716                let member_inline_size =
8717                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8718                if inlined != (member_inline_size <= 4) {
8719                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8720                }
8721                let inner_offset;
8722                let mut inner_depth = depth.clone();
8723                if inlined {
8724                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8725                    inner_offset = next_offset;
8726                } else {
8727                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8728                    inner_depth.increment()?;
8729                }
8730                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8731                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8732                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8733                {
8734                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8735                }
8736                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8737                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8738                }
8739            }
8740
8741            next_offset += envelope_size;
8742            _next_ordinal_to_read += 1;
8743            if next_offset >= end_offset {
8744                return Ok(());
8745            }
8746
8747            // Decode unknown envelopes for gaps in ordinals.
8748            while _next_ordinal_to_read < 3 {
8749                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8750                _next_ordinal_to_read += 1;
8751                next_offset += envelope_size;
8752            }
8753
8754            let next_out_of_line = decoder.next_out_of_line();
8755            let handles_before = decoder.remaining_handles();
8756            if let Some((inlined, num_bytes, num_handles)) =
8757                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8758            {
8759                let member_inline_size =
8760                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8761                if inlined != (member_inline_size <= 4) {
8762                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8763                }
8764                let inner_offset;
8765                let mut inner_depth = depth.clone();
8766                if inlined {
8767                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8768                    inner_offset = next_offset;
8769                } else {
8770                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8771                    inner_depth.increment()?;
8772                }
8773                let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(i64, D));
8774                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8775                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8776                {
8777                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8778                }
8779                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8780                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8781                }
8782            }
8783
8784            next_offset += envelope_size;
8785            _next_ordinal_to_read += 1;
8786            if next_offset >= end_offset {
8787                return Ok(());
8788            }
8789
8790            // Decode unknown envelopes for gaps in ordinals.
8791            while _next_ordinal_to_read < 4 {
8792                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8793                _next_ordinal_to_read += 1;
8794                next_offset += envelope_size;
8795            }
8796
8797            let next_out_of_line = decoder.next_out_of_line();
8798            let handles_before = decoder.remaining_handles();
8799            if let Some((inlined, num_bytes, num_handles)) =
8800                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8801            {
8802                let member_inline_size =
8803                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8804                if inlined != (member_inline_size <= 4) {
8805                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8806                }
8807                let inner_offset;
8808                let mut inner_depth = depth.clone();
8809                if inlined {
8810                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8811                    inner_offset = next_offset;
8812                } else {
8813                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8814                    inner_depth.increment()?;
8815                }
8816                let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(i64, D));
8817                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8818                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8819                {
8820                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8821                }
8822                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8823                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8824                }
8825            }
8826
8827            next_offset += envelope_size;
8828            _next_ordinal_to_read += 1;
8829            if next_offset >= end_offset {
8830                return Ok(());
8831            }
8832
8833            // Decode unknown envelopes for gaps in ordinals.
8834            while _next_ordinal_to_read < 5 {
8835                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8836                _next_ordinal_to_read += 1;
8837                next_offset += envelope_size;
8838            }
8839
8840            let next_out_of_line = decoder.next_out_of_line();
8841            let handles_before = decoder.remaining_handles();
8842            if let Some((inlined, num_bytes, num_handles)) =
8843                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8844            {
8845                let member_inline_size =
8846                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8847                        decoder.context,
8848                    );
8849                if inlined != (member_inline_size <= 4) {
8850                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8851                }
8852                let inner_offset;
8853                let mut inner_depth = depth.clone();
8854                if inlined {
8855                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8856                    inner_offset = next_offset;
8857                } else {
8858                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8859                    inner_depth.increment()?;
8860                }
8861                let val_ref = self
8862                    .pressed_buttons
8863                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8864                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8865                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8866                {
8867                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8868                }
8869                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8870                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8871                }
8872            }
8873
8874            next_offset += envelope_size;
8875            _next_ordinal_to_read += 1;
8876            if next_offset >= end_offset {
8877                return Ok(());
8878            }
8879
8880            // Decode unknown envelopes for gaps in ordinals.
8881            while _next_ordinal_to_read < 6 {
8882                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8883                _next_ordinal_to_read += 1;
8884                next_offset += envelope_size;
8885            }
8886
8887            let next_out_of_line = decoder.next_out_of_line();
8888            let handles_before = decoder.remaining_handles();
8889            if let Some((inlined, num_bytes, num_handles)) =
8890                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8891            {
8892                let member_inline_size =
8893                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8894                if inlined != (member_inline_size <= 4) {
8895                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8896                }
8897                let inner_offset;
8898                let mut inner_depth = depth.clone();
8899                if inlined {
8900                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8901                    inner_offset = next_offset;
8902                } else {
8903                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8904                    inner_depth.increment()?;
8905                }
8906                let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8907                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8908                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8909                {
8910                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8911                }
8912                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8913                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8914                }
8915            }
8916
8917            next_offset += envelope_size;
8918            _next_ordinal_to_read += 1;
8919            if next_offset >= end_offset {
8920                return Ok(());
8921            }
8922
8923            // Decode unknown envelopes for gaps in ordinals.
8924            while _next_ordinal_to_read < 7 {
8925                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8926                _next_ordinal_to_read += 1;
8927                next_offset += envelope_size;
8928            }
8929
8930            let next_out_of_line = decoder.next_out_of_line();
8931            let handles_before = decoder.remaining_handles();
8932            if let Some((inlined, num_bytes, num_handles)) =
8933                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8934            {
8935                let member_inline_size =
8936                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8937                if inlined != (member_inline_size <= 4) {
8938                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8939                }
8940                let inner_offset;
8941                let mut inner_depth = depth.clone();
8942                if inlined {
8943                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8944                    inner_offset = next_offset;
8945                } else {
8946                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8947                    inner_depth.increment()?;
8948                }
8949                let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8950                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8951                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8952                {
8953                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8954                }
8955                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8956                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8957                }
8958            }
8959
8960            next_offset += envelope_size;
8961
8962            // Decode the remaining unknown envelopes.
8963            while next_offset < end_offset {
8964                _next_ordinal_to_read += 1;
8965                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8966                next_offset += envelope_size;
8967            }
8968
8969            Ok(())
8970        }
8971    }
8972
8973    impl OutputDescriptor {
8974        #[inline(always)]
8975        fn max_ordinal_present(&self) -> u64 {
8976            if let Some(_) = self.keyboard {
8977                return 1;
8978            }
8979            0
8980        }
8981    }
8982
8983    impl fidl::encoding::ValueTypeMarker for OutputDescriptor {
8984        type Borrowed<'a> = &'a Self;
8985        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8986            value
8987        }
8988    }
8989
8990    unsafe impl fidl::encoding::TypeMarker for OutputDescriptor {
8991        type Owned = Self;
8992
8993        #[inline(always)]
8994        fn inline_align(_context: fidl::encoding::Context) -> usize {
8995            8
8996        }
8997
8998        #[inline(always)]
8999        fn inline_size(_context: fidl::encoding::Context) -> usize {
9000            16
9001        }
9002    }
9003
9004    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputDescriptor, D>
9005        for &OutputDescriptor
9006    {
9007        unsafe fn encode(
9008            self,
9009            encoder: &mut fidl::encoding::Encoder<'_, D>,
9010            offset: usize,
9011            mut depth: fidl::encoding::Depth,
9012        ) -> fidl::Result<()> {
9013            encoder.debug_check_bounds::<OutputDescriptor>(offset);
9014            // Vector header
9015            let max_ordinal: u64 = self.max_ordinal_present();
9016            encoder.write_num(max_ordinal, offset);
9017            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9018            // Calling encoder.out_of_line_offset(0) is not allowed.
9019            if max_ordinal == 0 {
9020                return Ok(());
9021            }
9022            depth.increment()?;
9023            let envelope_size = 8;
9024            let bytes_len = max_ordinal as usize * envelope_size;
9025            #[allow(unused_variables)]
9026            let offset = encoder.out_of_line_offset(bytes_len);
9027            let mut _prev_end_offset: usize = 0;
9028            if 1 > max_ordinal {
9029                return Ok(());
9030            }
9031
9032            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9033            // are envelope_size bytes.
9034            let cur_offset: usize = (1 - 1) * envelope_size;
9035
9036            // Zero reserved fields.
9037            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9038
9039            // Safety:
9040            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9041            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9042            //   envelope_size bytes, there is always sufficient room.
9043            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
9044                self.keyboard
9045                    .as_ref()
9046                    .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
9047                encoder,
9048                offset + cur_offset,
9049                depth,
9050            )?;
9051
9052            _prev_end_offset = cur_offset + envelope_size;
9053
9054            Ok(())
9055        }
9056    }
9057
9058    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputDescriptor {
9059        #[inline(always)]
9060        fn new_empty() -> Self {
9061            Self::default()
9062        }
9063
9064        unsafe fn decode(
9065            &mut self,
9066            decoder: &mut fidl::encoding::Decoder<'_, D>,
9067            offset: usize,
9068            mut depth: fidl::encoding::Depth,
9069        ) -> fidl::Result<()> {
9070            decoder.debug_check_bounds::<Self>(offset);
9071            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9072                None => return Err(fidl::Error::NotNullable),
9073                Some(len) => len,
9074            };
9075            // Calling decoder.out_of_line_offset(0) is not allowed.
9076            if len == 0 {
9077                return Ok(());
9078            };
9079            depth.increment()?;
9080            let envelope_size = 8;
9081            let bytes_len = len * envelope_size;
9082            let offset = decoder.out_of_line_offset(bytes_len)?;
9083            // Decode the envelope for each type.
9084            let mut _next_ordinal_to_read = 0;
9085            let mut next_offset = offset;
9086            let end_offset = offset + bytes_len;
9087            _next_ordinal_to_read += 1;
9088            if next_offset >= end_offset {
9089                return Ok(());
9090            }
9091
9092            // Decode unknown envelopes for gaps in ordinals.
9093            while _next_ordinal_to_read < 1 {
9094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9095                _next_ordinal_to_read += 1;
9096                next_offset += envelope_size;
9097            }
9098
9099            let next_out_of_line = decoder.next_out_of_line();
9100            let handles_before = decoder.remaining_handles();
9101            if let Some((inlined, num_bytes, num_handles)) =
9102                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9103            {
9104                let member_inline_size =
9105                    <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
9106                        decoder.context,
9107                    );
9108                if inlined != (member_inline_size <= 4) {
9109                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9110                }
9111                let inner_offset;
9112                let mut inner_depth = depth.clone();
9113                if inlined {
9114                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9115                    inner_offset = next_offset;
9116                } else {
9117                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9118                    inner_depth.increment()?;
9119                }
9120                let val_ref = self
9121                    .keyboard
9122                    .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
9123                fidl::decode!(
9124                    KeyboardOutputDescriptor,
9125                    D,
9126                    val_ref,
9127                    decoder,
9128                    inner_offset,
9129                    inner_depth
9130                )?;
9131                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9132                {
9133                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9134                }
9135                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9136                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9137                }
9138            }
9139
9140            next_offset += envelope_size;
9141
9142            // Decode the remaining unknown envelopes.
9143            while next_offset < end_offset {
9144                _next_ordinal_to_read += 1;
9145                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9146                next_offset += envelope_size;
9147            }
9148
9149            Ok(())
9150        }
9151    }
9152
9153    impl OutputReport {
9154        #[inline(always)]
9155        fn max_ordinal_present(&self) -> u64 {
9156            if let Some(_) = self.keyboard {
9157                return 1;
9158            }
9159            0
9160        }
9161    }
9162
9163    impl fidl::encoding::ValueTypeMarker for OutputReport {
9164        type Borrowed<'a> = &'a Self;
9165        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9166            value
9167        }
9168    }
9169
9170    unsafe impl fidl::encoding::TypeMarker for OutputReport {
9171        type Owned = Self;
9172
9173        #[inline(always)]
9174        fn inline_align(_context: fidl::encoding::Context) -> usize {
9175            8
9176        }
9177
9178        #[inline(always)]
9179        fn inline_size(_context: fidl::encoding::Context) -> usize {
9180            16
9181        }
9182    }
9183
9184    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputReport, D>
9185        for &OutputReport
9186    {
9187        unsafe fn encode(
9188            self,
9189            encoder: &mut fidl::encoding::Encoder<'_, D>,
9190            offset: usize,
9191            mut depth: fidl::encoding::Depth,
9192        ) -> fidl::Result<()> {
9193            encoder.debug_check_bounds::<OutputReport>(offset);
9194            // Vector header
9195            let max_ordinal: u64 = self.max_ordinal_present();
9196            encoder.write_num(max_ordinal, offset);
9197            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9198            // Calling encoder.out_of_line_offset(0) is not allowed.
9199            if max_ordinal == 0 {
9200                return Ok(());
9201            }
9202            depth.increment()?;
9203            let envelope_size = 8;
9204            let bytes_len = max_ordinal as usize * envelope_size;
9205            #[allow(unused_variables)]
9206            let offset = encoder.out_of_line_offset(bytes_len);
9207            let mut _prev_end_offset: usize = 0;
9208            if 1 > max_ordinal {
9209                return Ok(());
9210            }
9211
9212            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9213            // are envelope_size bytes.
9214            let cur_offset: usize = (1 - 1) * envelope_size;
9215
9216            // Zero reserved fields.
9217            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9218
9219            // Safety:
9220            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9221            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9222            //   envelope_size bytes, there is always sufficient room.
9223            fidl::encoding::encode_in_envelope_optional::<KeyboardOutputReport, D>(
9224                self.keyboard
9225                    .as_ref()
9226                    .map(<KeyboardOutputReport as fidl::encoding::ValueTypeMarker>::borrow),
9227                encoder,
9228                offset + cur_offset,
9229                depth,
9230            )?;
9231
9232            _prev_end_offset = cur_offset + envelope_size;
9233
9234            Ok(())
9235        }
9236    }
9237
9238    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputReport {
9239        #[inline(always)]
9240        fn new_empty() -> Self {
9241            Self::default()
9242        }
9243
9244        unsafe fn decode(
9245            &mut self,
9246            decoder: &mut fidl::encoding::Decoder<'_, D>,
9247            offset: usize,
9248            mut depth: fidl::encoding::Depth,
9249        ) -> fidl::Result<()> {
9250            decoder.debug_check_bounds::<Self>(offset);
9251            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9252                None => return Err(fidl::Error::NotNullable),
9253                Some(len) => len,
9254            };
9255            // Calling decoder.out_of_line_offset(0) is not allowed.
9256            if len == 0 {
9257                return Ok(());
9258            };
9259            depth.increment()?;
9260            let envelope_size = 8;
9261            let bytes_len = len * envelope_size;
9262            let offset = decoder.out_of_line_offset(bytes_len)?;
9263            // Decode the envelope for each type.
9264            let mut _next_ordinal_to_read = 0;
9265            let mut next_offset = offset;
9266            let end_offset = offset + bytes_len;
9267            _next_ordinal_to_read += 1;
9268            if next_offset >= end_offset {
9269                return Ok(());
9270            }
9271
9272            // Decode unknown envelopes for gaps in ordinals.
9273            while _next_ordinal_to_read < 1 {
9274                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9275                _next_ordinal_to_read += 1;
9276                next_offset += envelope_size;
9277            }
9278
9279            let next_out_of_line = decoder.next_out_of_line();
9280            let handles_before = decoder.remaining_handles();
9281            if let Some((inlined, num_bytes, num_handles)) =
9282                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9283            {
9284                let member_inline_size =
9285                    <KeyboardOutputReport as fidl::encoding::TypeMarker>::inline_size(
9286                        decoder.context,
9287                    );
9288                if inlined != (member_inline_size <= 4) {
9289                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9290                }
9291                let inner_offset;
9292                let mut inner_depth = depth.clone();
9293                if inlined {
9294                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9295                    inner_offset = next_offset;
9296                } else {
9297                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9298                    inner_depth.increment()?;
9299                }
9300                let val_ref =
9301                    self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardOutputReport, D));
9302                fidl::decode!(
9303                    KeyboardOutputReport,
9304                    D,
9305                    val_ref,
9306                    decoder,
9307                    inner_offset,
9308                    inner_depth
9309                )?;
9310                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9311                {
9312                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9313                }
9314                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9315                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9316                }
9317            }
9318
9319            next_offset += envelope_size;
9320
9321            // Decode the remaining unknown envelopes.
9322            while next_offset < end_offset {
9323                _next_ordinal_to_read += 1;
9324                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9325                next_offset += envelope_size;
9326            }
9327
9328            Ok(())
9329        }
9330    }
9331
9332    impl SelectiveReportingFeatureReport {
9333        #[inline(always)]
9334        fn max_ordinal_present(&self) -> u64 {
9335            if let Some(_) = self.button_switch {
9336                return 2;
9337            }
9338            if let Some(_) = self.surface_switch {
9339                return 1;
9340            }
9341            0
9342        }
9343    }
9344
9345    impl fidl::encoding::ValueTypeMarker for SelectiveReportingFeatureReport {
9346        type Borrowed<'a> = &'a Self;
9347        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9348            value
9349        }
9350    }
9351
9352    unsafe impl fidl::encoding::TypeMarker for SelectiveReportingFeatureReport {
9353        type Owned = Self;
9354
9355        #[inline(always)]
9356        fn inline_align(_context: fidl::encoding::Context) -> usize {
9357            8
9358        }
9359
9360        #[inline(always)]
9361        fn inline_size(_context: fidl::encoding::Context) -> usize {
9362            16
9363        }
9364    }
9365
9366    unsafe impl<D: fidl::encoding::ResourceDialect>
9367        fidl::encoding::Encode<SelectiveReportingFeatureReport, D>
9368        for &SelectiveReportingFeatureReport
9369    {
9370        unsafe fn encode(
9371            self,
9372            encoder: &mut fidl::encoding::Encoder<'_, D>,
9373            offset: usize,
9374            mut depth: fidl::encoding::Depth,
9375        ) -> fidl::Result<()> {
9376            encoder.debug_check_bounds::<SelectiveReportingFeatureReport>(offset);
9377            // Vector header
9378            let max_ordinal: u64 = self.max_ordinal_present();
9379            encoder.write_num(max_ordinal, offset);
9380            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9381            // Calling encoder.out_of_line_offset(0) is not allowed.
9382            if max_ordinal == 0 {
9383                return Ok(());
9384            }
9385            depth.increment()?;
9386            let envelope_size = 8;
9387            let bytes_len = max_ordinal as usize * envelope_size;
9388            #[allow(unused_variables)]
9389            let offset = encoder.out_of_line_offset(bytes_len);
9390            let mut _prev_end_offset: usize = 0;
9391            if 1 > max_ordinal {
9392                return Ok(());
9393            }
9394
9395            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9396            // are envelope_size bytes.
9397            let cur_offset: usize = (1 - 1) * envelope_size;
9398
9399            // Zero reserved fields.
9400            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9401
9402            // Safety:
9403            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9404            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9405            //   envelope_size bytes, there is always sufficient room.
9406            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9407                self.surface_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9408                encoder,
9409                offset + cur_offset,
9410                depth,
9411            )?;
9412
9413            _prev_end_offset = cur_offset + envelope_size;
9414            if 2 > max_ordinal {
9415                return Ok(());
9416            }
9417
9418            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9419            // are envelope_size bytes.
9420            let cur_offset: usize = (2 - 1) * envelope_size;
9421
9422            // Zero reserved fields.
9423            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9424
9425            // Safety:
9426            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9427            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9428            //   envelope_size bytes, there is always sufficient room.
9429            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9430                self.button_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9431                encoder,
9432                offset + cur_offset,
9433                depth,
9434            )?;
9435
9436            _prev_end_offset = cur_offset + envelope_size;
9437
9438            Ok(())
9439        }
9440    }
9441
9442    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9443        for SelectiveReportingFeatureReport
9444    {
9445        #[inline(always)]
9446        fn new_empty() -> Self {
9447            Self::default()
9448        }
9449
9450        unsafe fn decode(
9451            &mut self,
9452            decoder: &mut fidl::encoding::Decoder<'_, D>,
9453            offset: usize,
9454            mut depth: fidl::encoding::Depth,
9455        ) -> fidl::Result<()> {
9456            decoder.debug_check_bounds::<Self>(offset);
9457            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9458                None => return Err(fidl::Error::NotNullable),
9459                Some(len) => len,
9460            };
9461            // Calling decoder.out_of_line_offset(0) is not allowed.
9462            if len == 0 {
9463                return Ok(());
9464            };
9465            depth.increment()?;
9466            let envelope_size = 8;
9467            let bytes_len = len * envelope_size;
9468            let offset = decoder.out_of_line_offset(bytes_len)?;
9469            // Decode the envelope for each type.
9470            let mut _next_ordinal_to_read = 0;
9471            let mut next_offset = offset;
9472            let end_offset = offset + bytes_len;
9473            _next_ordinal_to_read += 1;
9474            if next_offset >= end_offset {
9475                return Ok(());
9476            }
9477
9478            // Decode unknown envelopes for gaps in ordinals.
9479            while _next_ordinal_to_read < 1 {
9480                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9481                _next_ordinal_to_read += 1;
9482                next_offset += envelope_size;
9483            }
9484
9485            let next_out_of_line = decoder.next_out_of_line();
9486            let handles_before = decoder.remaining_handles();
9487            if let Some((inlined, num_bytes, num_handles)) =
9488                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9489            {
9490                let member_inline_size =
9491                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9492                if inlined != (member_inline_size <= 4) {
9493                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9494                }
9495                let inner_offset;
9496                let mut inner_depth = depth.clone();
9497                if inlined {
9498                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9499                    inner_offset = next_offset;
9500                } else {
9501                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9502                    inner_depth.increment()?;
9503                }
9504                let val_ref = self.surface_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9505                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9506                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9507                {
9508                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9509                }
9510                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9511                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9512                }
9513            }
9514
9515            next_offset += envelope_size;
9516            _next_ordinal_to_read += 1;
9517            if next_offset >= end_offset {
9518                return Ok(());
9519            }
9520
9521            // Decode unknown envelopes for gaps in ordinals.
9522            while _next_ordinal_to_read < 2 {
9523                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9524                _next_ordinal_to_read += 1;
9525                next_offset += envelope_size;
9526            }
9527
9528            let next_out_of_line = decoder.next_out_of_line();
9529            let handles_before = decoder.remaining_handles();
9530            if let Some((inlined, num_bytes, num_handles)) =
9531                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9532            {
9533                let member_inline_size =
9534                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9535                if inlined != (member_inline_size <= 4) {
9536                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9537                }
9538                let inner_offset;
9539                let mut inner_depth = depth.clone();
9540                if inlined {
9541                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9542                    inner_offset = next_offset;
9543                } else {
9544                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9545                    inner_depth.increment()?;
9546                }
9547                let val_ref = self.button_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9548                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9549                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9550                {
9551                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9552                }
9553                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9554                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9555                }
9556            }
9557
9558            next_offset += envelope_size;
9559
9560            // Decode the remaining unknown envelopes.
9561            while next_offset < end_offset {
9562                _next_ordinal_to_read += 1;
9563                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9564                next_offset += envelope_size;
9565            }
9566
9567            Ok(())
9568        }
9569    }
9570
9571    impl SensorDescriptor {
9572        #[inline(always)]
9573        fn max_ordinal_present(&self) -> u64 {
9574            if let Some(_) = self.feature {
9575                return 2;
9576            }
9577            if let Some(_) = self.input {
9578                return 1;
9579            }
9580            0
9581        }
9582    }
9583
9584    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
9585        type Borrowed<'a> = &'a Self;
9586        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9587            value
9588        }
9589    }
9590
9591    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
9592        type Owned = Self;
9593
9594        #[inline(always)]
9595        fn inline_align(_context: fidl::encoding::Context) -> usize {
9596            8
9597        }
9598
9599        #[inline(always)]
9600        fn inline_size(_context: fidl::encoding::Context) -> usize {
9601            16
9602        }
9603    }
9604
9605    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
9606        for &SensorDescriptor
9607    {
9608        unsafe fn encode(
9609            self,
9610            encoder: &mut fidl::encoding::Encoder<'_, D>,
9611            offset: usize,
9612            mut depth: fidl::encoding::Depth,
9613        ) -> fidl::Result<()> {
9614            encoder.debug_check_bounds::<SensorDescriptor>(offset);
9615            // Vector header
9616            let max_ordinal: u64 = self.max_ordinal_present();
9617            encoder.write_num(max_ordinal, offset);
9618            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9619            // Calling encoder.out_of_line_offset(0) is not allowed.
9620            if max_ordinal == 0 {
9621                return Ok(());
9622            }
9623            depth.increment()?;
9624            let envelope_size = 8;
9625            let bytes_len = max_ordinal as usize * envelope_size;
9626            #[allow(unused_variables)]
9627            let offset = encoder.out_of_line_offset(bytes_len);
9628            let mut _prev_end_offset: usize = 0;
9629            if 1 > max_ordinal {
9630                return Ok(());
9631            }
9632
9633            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9634            // are envelope_size bytes.
9635            let cur_offset: usize = (1 - 1) * envelope_size;
9636
9637            // Zero reserved fields.
9638            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9639
9640            // Safety:
9641            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9642            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9643            //   envelope_size bytes, there is always sufficient room.
9644            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorInputDescriptor, 255>, D>(
9645            self.input.as_ref().map(<fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9646            encoder, offset + cur_offset, depth
9647        )?;
9648
9649            _prev_end_offset = cur_offset + envelope_size;
9650            if 2 > max_ordinal {
9651                return Ok(());
9652            }
9653
9654            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9655            // are envelope_size bytes.
9656            let cur_offset: usize = (2 - 1) * envelope_size;
9657
9658            // Zero reserved fields.
9659            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9660
9661            // Safety:
9662            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9663            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9664            //   envelope_size bytes, there is always sufficient room.
9665            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D>(
9666            self.feature.as_ref().map(<fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9667            encoder, offset + cur_offset, depth
9668        )?;
9669
9670            _prev_end_offset = cur_offset + envelope_size;
9671
9672            Ok(())
9673        }
9674    }
9675
9676    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
9677        #[inline(always)]
9678        fn new_empty() -> Self {
9679            Self::default()
9680        }
9681
9682        unsafe fn decode(
9683            &mut self,
9684            decoder: &mut fidl::encoding::Decoder<'_, D>,
9685            offset: usize,
9686            mut depth: fidl::encoding::Depth,
9687        ) -> fidl::Result<()> {
9688            decoder.debug_check_bounds::<Self>(offset);
9689            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9690                None => return Err(fidl::Error::NotNullable),
9691                Some(len) => len,
9692            };
9693            // Calling decoder.out_of_line_offset(0) is not allowed.
9694            if len == 0 {
9695                return Ok(());
9696            };
9697            depth.increment()?;
9698            let envelope_size = 8;
9699            let bytes_len = len * envelope_size;
9700            let offset = decoder.out_of_line_offset(bytes_len)?;
9701            // Decode the envelope for each type.
9702            let mut _next_ordinal_to_read = 0;
9703            let mut next_offset = offset;
9704            let end_offset = offset + bytes_len;
9705            _next_ordinal_to_read += 1;
9706            if next_offset >= end_offset {
9707                return Ok(());
9708            }
9709
9710            // Decode unknown envelopes for gaps in ordinals.
9711            while _next_ordinal_to_read < 1 {
9712                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9713                _next_ordinal_to_read += 1;
9714                next_offset += envelope_size;
9715            }
9716
9717            let next_out_of_line = decoder.next_out_of_line();
9718            let handles_before = decoder.remaining_handles();
9719            if let Some((inlined, num_bytes, num_handles)) =
9720                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9721            {
9722                let member_inline_size = <fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9723                if inlined != (member_inline_size <= 4) {
9724                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9725                }
9726                let inner_offset;
9727                let mut inner_depth = depth.clone();
9728                if inlined {
9729                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9730                    inner_offset = next_offset;
9731                } else {
9732                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9733                    inner_depth.increment()?;
9734                }
9735                let val_ref = self.input.get_or_insert_with(
9736                    || fidl::new_empty!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D),
9737                );
9738                fidl::decode!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9739                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9740                {
9741                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9742                }
9743                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9744                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9745                }
9746            }
9747
9748            next_offset += envelope_size;
9749            _next_ordinal_to_read += 1;
9750            if next_offset >= end_offset {
9751                return Ok(());
9752            }
9753
9754            // Decode unknown envelopes for gaps in ordinals.
9755            while _next_ordinal_to_read < 2 {
9756                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9757                _next_ordinal_to_read += 1;
9758                next_offset += envelope_size;
9759            }
9760
9761            let next_out_of_line = decoder.next_out_of_line();
9762            let handles_before = decoder.remaining_handles();
9763            if let Some((inlined, num_bytes, num_handles)) =
9764                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9765            {
9766                let member_inline_size = <fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9767                if inlined != (member_inline_size <= 4) {
9768                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9769                }
9770                let inner_offset;
9771                let mut inner_depth = depth.clone();
9772                if inlined {
9773                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9774                    inner_offset = next_offset;
9775                } else {
9776                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9777                    inner_depth.increment()?;
9778                }
9779                let val_ref = self.feature.get_or_insert_with(
9780                    || fidl::new_empty!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D),
9781                );
9782                fidl::decode!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9783                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9784                {
9785                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9786                }
9787                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9788                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9789                }
9790            }
9791
9792            next_offset += envelope_size;
9793
9794            // Decode the remaining unknown envelopes.
9795            while next_offset < end_offset {
9796                _next_ordinal_to_read += 1;
9797                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9798                next_offset += envelope_size;
9799            }
9800
9801            Ok(())
9802        }
9803    }
9804
9805    impl SensorFeatureDescriptor {
9806        #[inline(always)]
9807        fn max_ordinal_present(&self) -> u64 {
9808            if let Some(_) = self.report_id {
9809                return 7;
9810            }
9811            if let Some(_) = self.sampling_rate {
9812                return 6;
9813            }
9814            if let Some(_) = self.threshold_low {
9815                return 5;
9816            }
9817            if let Some(_) = self.threshold_high {
9818                return 4;
9819            }
9820            if let Some(_) = self.supports_reporting_state {
9821                return 3;
9822            }
9823            if let Some(_) = self.sensitivity {
9824                return 2;
9825            }
9826            if let Some(_) = self.report_interval {
9827                return 1;
9828            }
9829            0
9830        }
9831    }
9832
9833    impl fidl::encoding::ValueTypeMarker for SensorFeatureDescriptor {
9834        type Borrowed<'a> = &'a Self;
9835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9836            value
9837        }
9838    }
9839
9840    unsafe impl fidl::encoding::TypeMarker for SensorFeatureDescriptor {
9841        type Owned = Self;
9842
9843        #[inline(always)]
9844        fn inline_align(_context: fidl::encoding::Context) -> usize {
9845            8
9846        }
9847
9848        #[inline(always)]
9849        fn inline_size(_context: fidl::encoding::Context) -> usize {
9850            16
9851        }
9852    }
9853
9854    unsafe impl<D: fidl::encoding::ResourceDialect>
9855        fidl::encoding::Encode<SensorFeatureDescriptor, D> for &SensorFeatureDescriptor
9856    {
9857        unsafe fn encode(
9858            self,
9859            encoder: &mut fidl::encoding::Encoder<'_, D>,
9860            offset: usize,
9861            mut depth: fidl::encoding::Depth,
9862        ) -> fidl::Result<()> {
9863            encoder.debug_check_bounds::<SensorFeatureDescriptor>(offset);
9864            // Vector header
9865            let max_ordinal: u64 = self.max_ordinal_present();
9866            encoder.write_num(max_ordinal, offset);
9867            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9868            // Calling encoder.out_of_line_offset(0) is not allowed.
9869            if max_ordinal == 0 {
9870                return Ok(());
9871            }
9872            depth.increment()?;
9873            let envelope_size = 8;
9874            let bytes_len = max_ordinal as usize * envelope_size;
9875            #[allow(unused_variables)]
9876            let offset = encoder.out_of_line_offset(bytes_len);
9877            let mut _prev_end_offset: usize = 0;
9878            if 1 > max_ordinal {
9879                return Ok(());
9880            }
9881
9882            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9883            // are envelope_size bytes.
9884            let cur_offset: usize = (1 - 1) * envelope_size;
9885
9886            // Zero reserved fields.
9887            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9888
9889            // Safety:
9890            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9891            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9892            //   envelope_size bytes, there is always sufficient room.
9893            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
9894                self.report_interval
9895                    .as_ref()
9896                    .map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
9897                encoder,
9898                offset + cur_offset,
9899                depth,
9900            )?;
9901
9902            _prev_end_offset = cur_offset + envelope_size;
9903            if 2 > max_ordinal {
9904                return Ok(());
9905            }
9906
9907            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9908            // are envelope_size bytes.
9909            let cur_offset: usize = (2 - 1) * envelope_size;
9910
9911            // Zero reserved fields.
9912            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9913
9914            // Safety:
9915            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9916            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9917            //   envelope_size bytes, there is always sufficient room.
9918            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9919            self.sensitivity.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9920            encoder, offset + cur_offset, depth
9921        )?;
9922
9923            _prev_end_offset = cur_offset + envelope_size;
9924            if 3 > max_ordinal {
9925                return Ok(());
9926            }
9927
9928            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9929            // are envelope_size bytes.
9930            let cur_offset: usize = (3 - 1) * envelope_size;
9931
9932            // Zero reserved fields.
9933            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9934
9935            // Safety:
9936            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9937            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9938            //   envelope_size bytes, there is always sufficient room.
9939            fidl::encoding::encode_in_envelope_optional::<bool, D>(
9940                self.supports_reporting_state
9941                    .as_ref()
9942                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9943                encoder,
9944                offset + cur_offset,
9945                depth,
9946            )?;
9947
9948            _prev_end_offset = cur_offset + envelope_size;
9949            if 4 > max_ordinal {
9950                return Ok(());
9951            }
9952
9953            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9954            // are envelope_size bytes.
9955            let cur_offset: usize = (4 - 1) * envelope_size;
9956
9957            // Zero reserved fields.
9958            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9959
9960            // Safety:
9961            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9962            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9963            //   envelope_size bytes, there is always sufficient room.
9964            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9965            self.threshold_high.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9966            encoder, offset + cur_offset, depth
9967        )?;
9968
9969            _prev_end_offset = cur_offset + envelope_size;
9970            if 5 > max_ordinal {
9971                return Ok(());
9972            }
9973
9974            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9975            // are envelope_size bytes.
9976            let cur_offset: usize = (5 - 1) * envelope_size;
9977
9978            // Zero reserved fields.
9979            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9980
9981            // Safety:
9982            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9983            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9984            //   envelope_size bytes, there is always sufficient room.
9985            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9986            self.threshold_low.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9987            encoder, offset + cur_offset, depth
9988        )?;
9989
9990            _prev_end_offset = cur_offset + envelope_size;
9991            if 6 > max_ordinal {
9992                return Ok(());
9993            }
9994
9995            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9996            // are envelope_size bytes.
9997            let cur_offset: usize = (6 - 1) * envelope_size;
9998
9999            // Zero reserved fields.
10000            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10001
10002            // Safety:
10003            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10004            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10005            //   envelope_size bytes, there is always sufficient room.
10006            fidl::encoding::encode_in_envelope_optional::<Axis, D>(
10007                self.sampling_rate.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
10008                encoder,
10009                offset + cur_offset,
10010                depth,
10011            )?;
10012
10013            _prev_end_offset = cur_offset + envelope_size;
10014            if 7 > max_ordinal {
10015                return Ok(());
10016            }
10017
10018            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10019            // are envelope_size bytes.
10020            let cur_offset: usize = (7 - 1) * envelope_size;
10021
10022            // Zero reserved fields.
10023            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10024
10025            // Safety:
10026            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10027            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10028            //   envelope_size bytes, there is always sufficient room.
10029            fidl::encoding::encode_in_envelope_optional::<u8, D>(
10030                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
10031                encoder,
10032                offset + cur_offset,
10033                depth,
10034            )?;
10035
10036            _prev_end_offset = cur_offset + envelope_size;
10037
10038            Ok(())
10039        }
10040    }
10041
10042    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10043        for SensorFeatureDescriptor
10044    {
10045        #[inline(always)]
10046        fn new_empty() -> Self {
10047            Self::default()
10048        }
10049
10050        unsafe fn decode(
10051            &mut self,
10052            decoder: &mut fidl::encoding::Decoder<'_, D>,
10053            offset: usize,
10054            mut depth: fidl::encoding::Depth,
10055        ) -> fidl::Result<()> {
10056            decoder.debug_check_bounds::<Self>(offset);
10057            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10058                None => return Err(fidl::Error::NotNullable),
10059                Some(len) => len,
10060            };
10061            // Calling decoder.out_of_line_offset(0) is not allowed.
10062            if len == 0 {
10063                return Ok(());
10064            };
10065            depth.increment()?;
10066            let envelope_size = 8;
10067            let bytes_len = len * envelope_size;
10068            let offset = decoder.out_of_line_offset(bytes_len)?;
10069            // Decode the envelope for each type.
10070            let mut _next_ordinal_to_read = 0;
10071            let mut next_offset = offset;
10072            let end_offset = offset + bytes_len;
10073            _next_ordinal_to_read += 1;
10074            if next_offset >= end_offset {
10075                return Ok(());
10076            }
10077
10078            // Decode unknown envelopes for gaps in ordinals.
10079            while _next_ordinal_to_read < 1 {
10080                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10081                _next_ordinal_to_read += 1;
10082                next_offset += envelope_size;
10083            }
10084
10085            let next_out_of_line = decoder.next_out_of_line();
10086            let handles_before = decoder.remaining_handles();
10087            if let Some((inlined, num_bytes, num_handles)) =
10088                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10089            {
10090                let member_inline_size =
10091                    <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10092                if inlined != (member_inline_size <= 4) {
10093                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10094                }
10095                let inner_offset;
10096                let mut inner_depth = depth.clone();
10097                if inlined {
10098                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10099                    inner_offset = next_offset;
10100                } else {
10101                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10102                    inner_depth.increment()?;
10103                }
10104                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10105                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10106                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10107                {
10108                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10109                }
10110                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10111                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10112                }
10113            }
10114
10115            next_offset += envelope_size;
10116            _next_ordinal_to_read += 1;
10117            if next_offset >= end_offset {
10118                return Ok(());
10119            }
10120
10121            // Decode unknown envelopes for gaps in ordinals.
10122            while _next_ordinal_to_read < 2 {
10123                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10124                _next_ordinal_to_read += 1;
10125                next_offset += envelope_size;
10126            }
10127
10128            let next_out_of_line = decoder.next_out_of_line();
10129            let handles_before = decoder.remaining_handles();
10130            if let Some((inlined, num_bytes, num_handles)) =
10131                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10132            {
10133                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10134                if inlined != (member_inline_size <= 4) {
10135                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10136                }
10137                let inner_offset;
10138                let mut inner_depth = depth.clone();
10139                if inlined {
10140                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10141                    inner_offset = next_offset;
10142                } else {
10143                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10144                    inner_depth.increment()?;
10145                }
10146                let val_ref = self.sensitivity.get_or_insert_with(
10147                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10148                );
10149                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10150                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10151                {
10152                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10153                }
10154                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10155                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10156                }
10157            }
10158
10159            next_offset += envelope_size;
10160            _next_ordinal_to_read += 1;
10161            if next_offset >= end_offset {
10162                return Ok(());
10163            }
10164
10165            // Decode unknown envelopes for gaps in ordinals.
10166            while _next_ordinal_to_read < 3 {
10167                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10168                _next_ordinal_to_read += 1;
10169                next_offset += envelope_size;
10170            }
10171
10172            let next_out_of_line = decoder.next_out_of_line();
10173            let handles_before = decoder.remaining_handles();
10174            if let Some((inlined, num_bytes, num_handles)) =
10175                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10176            {
10177                let member_inline_size =
10178                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10179                if inlined != (member_inline_size <= 4) {
10180                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10181                }
10182                let inner_offset;
10183                let mut inner_depth = depth.clone();
10184                if inlined {
10185                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10186                    inner_offset = next_offset;
10187                } else {
10188                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10189                    inner_depth.increment()?;
10190                }
10191                let val_ref =
10192                    self.supports_reporting_state.get_or_insert_with(|| fidl::new_empty!(bool, D));
10193                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10194                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10195                {
10196                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10197                }
10198                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10199                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10200                }
10201            }
10202
10203            next_offset += envelope_size;
10204            _next_ordinal_to_read += 1;
10205            if next_offset >= end_offset {
10206                return Ok(());
10207            }
10208
10209            // Decode unknown envelopes for gaps in ordinals.
10210            while _next_ordinal_to_read < 4 {
10211                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10212                _next_ordinal_to_read += 1;
10213                next_offset += envelope_size;
10214            }
10215
10216            let next_out_of_line = decoder.next_out_of_line();
10217            let handles_before = decoder.remaining_handles();
10218            if let Some((inlined, num_bytes, num_handles)) =
10219                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10220            {
10221                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10222                if inlined != (member_inline_size <= 4) {
10223                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10224                }
10225                let inner_offset;
10226                let mut inner_depth = depth.clone();
10227                if inlined {
10228                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10229                    inner_offset = next_offset;
10230                } else {
10231                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10232                    inner_depth.increment()?;
10233                }
10234                let val_ref = self.threshold_high.get_or_insert_with(
10235                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10236                );
10237                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, 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 < 5 {
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.threshold_low.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 < 6 {
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                    <Axis 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 = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10324                fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10325                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10326                {
10327                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10328                }
10329                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10330                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10331                }
10332            }
10333
10334            next_offset += envelope_size;
10335            _next_ordinal_to_read += 1;
10336            if next_offset >= end_offset {
10337                return Ok(());
10338            }
10339
10340            // Decode unknown envelopes for gaps in ordinals.
10341            while _next_ordinal_to_read < 7 {
10342                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10343                _next_ordinal_to_read += 1;
10344                next_offset += envelope_size;
10345            }
10346
10347            let next_out_of_line = decoder.next_out_of_line();
10348            let handles_before = decoder.remaining_handles();
10349            if let Some((inlined, num_bytes, num_handles)) =
10350                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10351            {
10352                let member_inline_size =
10353                    <u8 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.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
10367                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
10368                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10369                {
10370                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10371                }
10372                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10373                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10374                }
10375            }
10376
10377            next_offset += envelope_size;
10378
10379            // Decode the remaining unknown envelopes.
10380            while next_offset < end_offset {
10381                _next_ordinal_to_read += 1;
10382                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10383                next_offset += envelope_size;
10384            }
10385
10386            Ok(())
10387        }
10388    }
10389
10390    impl SensorFeatureReport {
10391        #[inline(always)]
10392        fn max_ordinal_present(&self) -> u64 {
10393            if let Some(_) = self.sampling_rate {
10394                return 6;
10395            }
10396            if let Some(_) = self.threshold_low {
10397                return 5;
10398            }
10399            if let Some(_) = self.threshold_high {
10400                return 4;
10401            }
10402            if let Some(_) = self.reporting_state {
10403                return 3;
10404            }
10405            if let Some(_) = self.sensitivity {
10406                return 2;
10407            }
10408            if let Some(_) = self.report_interval {
10409                return 1;
10410            }
10411            0
10412        }
10413    }
10414
10415    impl fidl::encoding::ValueTypeMarker for SensorFeatureReport {
10416        type Borrowed<'a> = &'a Self;
10417        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10418            value
10419        }
10420    }
10421
10422    unsafe impl fidl::encoding::TypeMarker for SensorFeatureReport {
10423        type Owned = Self;
10424
10425        #[inline(always)]
10426        fn inline_align(_context: fidl::encoding::Context) -> usize {
10427            8
10428        }
10429
10430        #[inline(always)]
10431        fn inline_size(_context: fidl::encoding::Context) -> usize {
10432            16
10433        }
10434    }
10435
10436    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorFeatureReport, D>
10437        for &SensorFeatureReport
10438    {
10439        unsafe fn encode(
10440            self,
10441            encoder: &mut fidl::encoding::Encoder<'_, D>,
10442            offset: usize,
10443            mut depth: fidl::encoding::Depth,
10444        ) -> fidl::Result<()> {
10445            encoder.debug_check_bounds::<SensorFeatureReport>(offset);
10446            // Vector header
10447            let max_ordinal: u64 = self.max_ordinal_present();
10448            encoder.write_num(max_ordinal, offset);
10449            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10450            // Calling encoder.out_of_line_offset(0) is not allowed.
10451            if max_ordinal == 0 {
10452                return Ok(());
10453            }
10454            depth.increment()?;
10455            let envelope_size = 8;
10456            let bytes_len = max_ordinal as usize * envelope_size;
10457            #[allow(unused_variables)]
10458            let offset = encoder.out_of_line_offset(bytes_len);
10459            let mut _prev_end_offset: usize = 0;
10460            if 1 > max_ordinal {
10461                return Ok(());
10462            }
10463
10464            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10465            // are envelope_size bytes.
10466            let cur_offset: usize = (1 - 1) * envelope_size;
10467
10468            // Zero reserved fields.
10469            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10470
10471            // Safety:
10472            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10473            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10474            //   envelope_size bytes, there is always sufficient room.
10475            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10476                self.report_interval.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10477                encoder,
10478                offset + cur_offset,
10479                depth,
10480            )?;
10481
10482            _prev_end_offset = cur_offset + envelope_size;
10483            if 2 > max_ordinal {
10484                return Ok(());
10485            }
10486
10487            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10488            // are envelope_size bytes.
10489            let cur_offset: usize = (2 - 1) * envelope_size;
10490
10491            // Zero reserved fields.
10492            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10493
10494            // Safety:
10495            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10496            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10497            //   envelope_size bytes, there is always sufficient room.
10498            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10499                self.sensitivity.as_ref().map(
10500                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10501                ),
10502                encoder,
10503                offset + cur_offset,
10504                depth,
10505            )?;
10506
10507            _prev_end_offset = cur_offset + envelope_size;
10508            if 3 > max_ordinal {
10509                return Ok(());
10510            }
10511
10512            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10513            // are envelope_size bytes.
10514            let cur_offset: usize = (3 - 1) * envelope_size;
10515
10516            // Zero reserved fields.
10517            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10518
10519            // Safety:
10520            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10521            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10522            //   envelope_size bytes, there is always sufficient room.
10523            fidl::encoding::encode_in_envelope_optional::<SensorReportingState, D>(
10524                self.reporting_state
10525                    .as_ref()
10526                    .map(<SensorReportingState as fidl::encoding::ValueTypeMarker>::borrow),
10527                encoder,
10528                offset + cur_offset,
10529                depth,
10530            )?;
10531
10532            _prev_end_offset = cur_offset + envelope_size;
10533            if 4 > max_ordinal {
10534                return Ok(());
10535            }
10536
10537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10538            // are envelope_size bytes.
10539            let cur_offset: usize = (4 - 1) * envelope_size;
10540
10541            // Zero reserved fields.
10542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10543
10544            // Safety:
10545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10547            //   envelope_size bytes, there is always sufficient room.
10548            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10549                self.threshold_high.as_ref().map(
10550                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10551                ),
10552                encoder,
10553                offset + cur_offset,
10554                depth,
10555            )?;
10556
10557            _prev_end_offset = cur_offset + envelope_size;
10558            if 5 > max_ordinal {
10559                return Ok(());
10560            }
10561
10562            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10563            // are envelope_size bytes.
10564            let cur_offset: usize = (5 - 1) * envelope_size;
10565
10566            // Zero reserved fields.
10567            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10568
10569            // Safety:
10570            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10571            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10572            //   envelope_size bytes, there is always sufficient room.
10573            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10574                self.threshold_low.as_ref().map(
10575                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10576                ),
10577                encoder,
10578                offset + cur_offset,
10579                depth,
10580            )?;
10581
10582            _prev_end_offset = cur_offset + envelope_size;
10583            if 6 > max_ordinal {
10584                return Ok(());
10585            }
10586
10587            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10588            // are envelope_size bytes.
10589            let cur_offset: usize = (6 - 1) * envelope_size;
10590
10591            // Zero reserved fields.
10592            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10593
10594            // Safety:
10595            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10596            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10597            //   envelope_size bytes, there is always sufficient room.
10598            fidl::encoding::encode_in_envelope_optional::<i64, D>(
10599                self.sampling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10600                encoder,
10601                offset + cur_offset,
10602                depth,
10603            )?;
10604
10605            _prev_end_offset = cur_offset + envelope_size;
10606
10607            Ok(())
10608        }
10609    }
10610
10611    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorFeatureReport {
10612        #[inline(always)]
10613        fn new_empty() -> Self {
10614            Self::default()
10615        }
10616
10617        unsafe fn decode(
10618            &mut self,
10619            decoder: &mut fidl::encoding::Decoder<'_, D>,
10620            offset: usize,
10621            mut depth: fidl::encoding::Depth,
10622        ) -> fidl::Result<()> {
10623            decoder.debug_check_bounds::<Self>(offset);
10624            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10625                None => return Err(fidl::Error::NotNullable),
10626                Some(len) => len,
10627            };
10628            // Calling decoder.out_of_line_offset(0) is not allowed.
10629            if len == 0 {
10630                return Ok(());
10631            };
10632            depth.increment()?;
10633            let envelope_size = 8;
10634            let bytes_len = len * envelope_size;
10635            let offset = decoder.out_of_line_offset(bytes_len)?;
10636            // Decode the envelope for each type.
10637            let mut _next_ordinal_to_read = 0;
10638            let mut next_offset = offset;
10639            let end_offset = offset + bytes_len;
10640            _next_ordinal_to_read += 1;
10641            if next_offset >= end_offset {
10642                return Ok(());
10643            }
10644
10645            // Decode unknown envelopes for gaps in ordinals.
10646            while _next_ordinal_to_read < 1 {
10647                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10648                _next_ordinal_to_read += 1;
10649                next_offset += envelope_size;
10650            }
10651
10652            let next_out_of_line = decoder.next_out_of_line();
10653            let handles_before = decoder.remaining_handles();
10654            if let Some((inlined, num_bytes, num_handles)) =
10655                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10656            {
10657                let member_inline_size =
10658                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10659                if inlined != (member_inline_size <= 4) {
10660                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10661                }
10662                let inner_offset;
10663                let mut inner_depth = depth.clone();
10664                if inlined {
10665                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10666                    inner_offset = next_offset;
10667                } else {
10668                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10669                    inner_depth.increment()?;
10670                }
10671                let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(i64, D));
10672                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10673                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10674                {
10675                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10676                }
10677                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10678                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10679                }
10680            }
10681
10682            next_offset += envelope_size;
10683            _next_ordinal_to_read += 1;
10684            if next_offset >= end_offset {
10685                return Ok(());
10686            }
10687
10688            // Decode unknown envelopes for gaps in ordinals.
10689            while _next_ordinal_to_read < 2 {
10690                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10691                _next_ordinal_to_read += 1;
10692                next_offset += envelope_size;
10693            }
10694
10695            let next_out_of_line = decoder.next_out_of_line();
10696            let handles_before = decoder.remaining_handles();
10697            if let Some((inlined, num_bytes, num_handles)) =
10698                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10699            {
10700                let member_inline_size =
10701                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10702                        decoder.context,
10703                    );
10704                if inlined != (member_inline_size <= 4) {
10705                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10706                }
10707                let inner_offset;
10708                let mut inner_depth = depth.clone();
10709                if inlined {
10710                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10711                    inner_offset = next_offset;
10712                } else {
10713                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10714                    inner_depth.increment()?;
10715                }
10716                let val_ref = self
10717                    .sensitivity
10718                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10719                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10720                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10721                {
10722                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10723                }
10724                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10725                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10726                }
10727            }
10728
10729            next_offset += envelope_size;
10730            _next_ordinal_to_read += 1;
10731            if next_offset >= end_offset {
10732                return Ok(());
10733            }
10734
10735            // Decode unknown envelopes for gaps in ordinals.
10736            while _next_ordinal_to_read < 3 {
10737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10738                _next_ordinal_to_read += 1;
10739                next_offset += envelope_size;
10740            }
10741
10742            let next_out_of_line = decoder.next_out_of_line();
10743            let handles_before = decoder.remaining_handles();
10744            if let Some((inlined, num_bytes, num_handles)) =
10745                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10746            {
10747                let member_inline_size =
10748                    <SensorReportingState as fidl::encoding::TypeMarker>::inline_size(
10749                        decoder.context,
10750                    );
10751                if inlined != (member_inline_size <= 4) {
10752                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10753                }
10754                let inner_offset;
10755                let mut inner_depth = depth.clone();
10756                if inlined {
10757                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10758                    inner_offset = next_offset;
10759                } else {
10760                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10761                    inner_depth.increment()?;
10762                }
10763                let val_ref = self
10764                    .reporting_state
10765                    .get_or_insert_with(|| fidl::new_empty!(SensorReportingState, D));
10766                fidl::decode!(
10767                    SensorReportingState,
10768                    D,
10769                    val_ref,
10770                    decoder,
10771                    inner_offset,
10772                    inner_depth
10773                )?;
10774                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10775                {
10776                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10777                }
10778                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10779                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10780                }
10781            }
10782
10783            next_offset += envelope_size;
10784            _next_ordinal_to_read += 1;
10785            if next_offset >= end_offset {
10786                return Ok(());
10787            }
10788
10789            // Decode unknown envelopes for gaps in ordinals.
10790            while _next_ordinal_to_read < 4 {
10791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10792                _next_ordinal_to_read += 1;
10793                next_offset += envelope_size;
10794            }
10795
10796            let next_out_of_line = decoder.next_out_of_line();
10797            let handles_before = decoder.remaining_handles();
10798            if let Some((inlined, num_bytes, num_handles)) =
10799                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10800            {
10801                let member_inline_size =
10802                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10803                        decoder.context,
10804                    );
10805                if inlined != (member_inline_size <= 4) {
10806                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10807                }
10808                let inner_offset;
10809                let mut inner_depth = depth.clone();
10810                if inlined {
10811                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10812                    inner_offset = next_offset;
10813                } else {
10814                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10815                    inner_depth.increment()?;
10816                }
10817                let val_ref = self
10818                    .threshold_high
10819                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10820                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10821                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10822                {
10823                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10824                }
10825                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10826                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10827                }
10828            }
10829
10830            next_offset += envelope_size;
10831            _next_ordinal_to_read += 1;
10832            if next_offset >= end_offset {
10833                return Ok(());
10834            }
10835
10836            // Decode unknown envelopes for gaps in ordinals.
10837            while _next_ordinal_to_read < 5 {
10838                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10839                _next_ordinal_to_read += 1;
10840                next_offset += envelope_size;
10841            }
10842
10843            let next_out_of_line = decoder.next_out_of_line();
10844            let handles_before = decoder.remaining_handles();
10845            if let Some((inlined, num_bytes, num_handles)) =
10846                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10847            {
10848                let member_inline_size =
10849                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10850                        decoder.context,
10851                    );
10852                if inlined != (member_inline_size <= 4) {
10853                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10854                }
10855                let inner_offset;
10856                let mut inner_depth = depth.clone();
10857                if inlined {
10858                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10859                    inner_offset = next_offset;
10860                } else {
10861                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10862                    inner_depth.increment()?;
10863                }
10864                let val_ref = self
10865                    .threshold_low
10866                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10867                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10868                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10869                {
10870                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10871                }
10872                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10873                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10874                }
10875            }
10876
10877            next_offset += envelope_size;
10878            _next_ordinal_to_read += 1;
10879            if next_offset >= end_offset {
10880                return Ok(());
10881            }
10882
10883            // Decode unknown envelopes for gaps in ordinals.
10884            while _next_ordinal_to_read < 6 {
10885                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10886                _next_ordinal_to_read += 1;
10887                next_offset += envelope_size;
10888            }
10889
10890            let next_out_of_line = decoder.next_out_of_line();
10891            let handles_before = decoder.remaining_handles();
10892            if let Some((inlined, num_bytes, num_handles)) =
10893                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10894            {
10895                let member_inline_size =
10896                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10897                if inlined != (member_inline_size <= 4) {
10898                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10899                }
10900                let inner_offset;
10901                let mut inner_depth = depth.clone();
10902                if inlined {
10903                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10904                    inner_offset = next_offset;
10905                } else {
10906                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10907                    inner_depth.increment()?;
10908                }
10909                let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
10910                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10911                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10912                {
10913                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10914                }
10915                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10916                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10917                }
10918            }
10919
10920            next_offset += envelope_size;
10921
10922            // Decode the remaining unknown envelopes.
10923            while next_offset < end_offset {
10924                _next_ordinal_to_read += 1;
10925                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10926                next_offset += envelope_size;
10927            }
10928
10929            Ok(())
10930        }
10931    }
10932
10933    impl SensorInputDescriptor {
10934        #[inline(always)]
10935        fn max_ordinal_present(&self) -> u64 {
10936            if let Some(_) = self.report_id {
10937                return 2;
10938            }
10939            if let Some(_) = self.values {
10940                return 1;
10941            }
10942            0
10943        }
10944    }
10945
10946    impl fidl::encoding::ValueTypeMarker for SensorInputDescriptor {
10947        type Borrowed<'a> = &'a Self;
10948        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10949            value
10950        }
10951    }
10952
10953    unsafe impl fidl::encoding::TypeMarker for SensorInputDescriptor {
10954        type Owned = Self;
10955
10956        #[inline(always)]
10957        fn inline_align(_context: fidl::encoding::Context) -> usize {
10958            8
10959        }
10960
10961        #[inline(always)]
10962        fn inline_size(_context: fidl::encoding::Context) -> usize {
10963            16
10964        }
10965    }
10966
10967    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputDescriptor, D>
10968        for &SensorInputDescriptor
10969    {
10970        unsafe fn encode(
10971            self,
10972            encoder: &mut fidl::encoding::Encoder<'_, D>,
10973            offset: usize,
10974            mut depth: fidl::encoding::Depth,
10975        ) -> fidl::Result<()> {
10976            encoder.debug_check_bounds::<SensorInputDescriptor>(offset);
10977            // Vector header
10978            let max_ordinal: u64 = self.max_ordinal_present();
10979            encoder.write_num(max_ordinal, offset);
10980            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10981            // Calling encoder.out_of_line_offset(0) is not allowed.
10982            if max_ordinal == 0 {
10983                return Ok(());
10984            }
10985            depth.increment()?;
10986            let envelope_size = 8;
10987            let bytes_len = max_ordinal as usize * envelope_size;
10988            #[allow(unused_variables)]
10989            let offset = encoder.out_of_line_offset(bytes_len);
10990            let mut _prev_end_offset: usize = 0;
10991            if 1 > max_ordinal {
10992                return Ok(());
10993            }
10994
10995            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10996            // are envelope_size bytes.
10997            let cur_offset: usize = (1 - 1) * envelope_size;
10998
10999            // Zero reserved fields.
11000            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11001
11002            // Safety:
11003            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11004            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11005            //   envelope_size bytes, there is always sufficient room.
11006            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
11007            self.values.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
11008            encoder, offset + cur_offset, depth
11009        )?;
11010
11011            _prev_end_offset = cur_offset + envelope_size;
11012            if 2 > max_ordinal {
11013                return Ok(());
11014            }
11015
11016            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11017            // are envelope_size bytes.
11018            let cur_offset: usize = (2 - 1) * envelope_size;
11019
11020            // Zero reserved fields.
11021            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11022
11023            // Safety:
11024            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11025            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11026            //   envelope_size bytes, there is always sufficient room.
11027            fidl::encoding::encode_in_envelope_optional::<u8, D>(
11028                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11029                encoder,
11030                offset + cur_offset,
11031                depth,
11032            )?;
11033
11034            _prev_end_offset = cur_offset + envelope_size;
11035
11036            Ok(())
11037        }
11038    }
11039
11040    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputDescriptor {
11041        #[inline(always)]
11042        fn new_empty() -> Self {
11043            Self::default()
11044        }
11045
11046        unsafe fn decode(
11047            &mut self,
11048            decoder: &mut fidl::encoding::Decoder<'_, D>,
11049            offset: usize,
11050            mut depth: fidl::encoding::Depth,
11051        ) -> fidl::Result<()> {
11052            decoder.debug_check_bounds::<Self>(offset);
11053            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11054                None => return Err(fidl::Error::NotNullable),
11055                Some(len) => len,
11056            };
11057            // Calling decoder.out_of_line_offset(0) is not allowed.
11058            if len == 0 {
11059                return Ok(());
11060            };
11061            depth.increment()?;
11062            let envelope_size = 8;
11063            let bytes_len = len * envelope_size;
11064            let offset = decoder.out_of_line_offset(bytes_len)?;
11065            // Decode the envelope for each type.
11066            let mut _next_ordinal_to_read = 0;
11067            let mut next_offset = offset;
11068            let end_offset = offset + bytes_len;
11069            _next_ordinal_to_read += 1;
11070            if next_offset >= end_offset {
11071                return Ok(());
11072            }
11073
11074            // Decode unknown envelopes for gaps in ordinals.
11075            while _next_ordinal_to_read < 1 {
11076                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11077                _next_ordinal_to_read += 1;
11078                next_offset += envelope_size;
11079            }
11080
11081            let next_out_of_line = decoder.next_out_of_line();
11082            let handles_before = decoder.remaining_handles();
11083            if let Some((inlined, num_bytes, num_handles)) =
11084                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11085            {
11086                let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11087                if inlined != (member_inline_size <= 4) {
11088                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11089                }
11090                let inner_offset;
11091                let mut inner_depth = depth.clone();
11092                if inlined {
11093                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11094                    inner_offset = next_offset;
11095                } else {
11096                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11097                    inner_depth.increment()?;
11098                }
11099                let val_ref = self.values.get_or_insert_with(
11100                    || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
11101                );
11102                fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11103                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11104                {
11105                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11106                }
11107                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11108                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11109                }
11110            }
11111
11112            next_offset += envelope_size;
11113            _next_ordinal_to_read += 1;
11114            if next_offset >= end_offset {
11115                return Ok(());
11116            }
11117
11118            // Decode unknown envelopes for gaps in ordinals.
11119            while _next_ordinal_to_read < 2 {
11120                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11121                _next_ordinal_to_read += 1;
11122                next_offset += envelope_size;
11123            }
11124
11125            let next_out_of_line = decoder.next_out_of_line();
11126            let handles_before = decoder.remaining_handles();
11127            if let Some((inlined, num_bytes, num_handles)) =
11128                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11129            {
11130                let member_inline_size =
11131                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11132                if inlined != (member_inline_size <= 4) {
11133                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11134                }
11135                let inner_offset;
11136                let mut inner_depth = depth.clone();
11137                if inlined {
11138                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11139                    inner_offset = next_offset;
11140                } else {
11141                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11142                    inner_depth.increment()?;
11143                }
11144                let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
11145                fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
11146                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11147                {
11148                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11149                }
11150                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11151                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11152                }
11153            }
11154
11155            next_offset += envelope_size;
11156
11157            // Decode the remaining unknown envelopes.
11158            while next_offset < end_offset {
11159                _next_ordinal_to_read += 1;
11160                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11161                next_offset += envelope_size;
11162            }
11163
11164            Ok(())
11165        }
11166    }
11167
11168    impl SensorInputReport {
11169        #[inline(always)]
11170        fn max_ordinal_present(&self) -> u64 {
11171            if let Some(_) = self.values {
11172                return 1;
11173            }
11174            0
11175        }
11176    }
11177
11178    impl fidl::encoding::ValueTypeMarker for SensorInputReport {
11179        type Borrowed<'a> = &'a Self;
11180        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11181            value
11182        }
11183    }
11184
11185    unsafe impl fidl::encoding::TypeMarker for SensorInputReport {
11186        type Owned = Self;
11187
11188        #[inline(always)]
11189        fn inline_align(_context: fidl::encoding::Context) -> usize {
11190            8
11191        }
11192
11193        #[inline(always)]
11194        fn inline_size(_context: fidl::encoding::Context) -> usize {
11195            16
11196        }
11197    }
11198
11199    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputReport, D>
11200        for &SensorInputReport
11201    {
11202        unsafe fn encode(
11203            self,
11204            encoder: &mut fidl::encoding::Encoder<'_, D>,
11205            offset: usize,
11206            mut depth: fidl::encoding::Depth,
11207        ) -> fidl::Result<()> {
11208            encoder.debug_check_bounds::<SensorInputReport>(offset);
11209            // Vector header
11210            let max_ordinal: u64 = self.max_ordinal_present();
11211            encoder.write_num(max_ordinal, offset);
11212            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11213            // Calling encoder.out_of_line_offset(0) is not allowed.
11214            if max_ordinal == 0 {
11215                return Ok(());
11216            }
11217            depth.increment()?;
11218            let envelope_size = 8;
11219            let bytes_len = max_ordinal as usize * envelope_size;
11220            #[allow(unused_variables)]
11221            let offset = encoder.out_of_line_offset(bytes_len);
11222            let mut _prev_end_offset: usize = 0;
11223            if 1 > max_ordinal {
11224                return Ok(());
11225            }
11226
11227            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11228            // are envelope_size bytes.
11229            let cur_offset: usize = (1 - 1) * envelope_size;
11230
11231            // Zero reserved fields.
11232            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11233
11234            // Safety:
11235            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11236            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11237            //   envelope_size bytes, there is always sufficient room.
11238            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
11239                self.values.as_ref().map(
11240                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
11241                ),
11242                encoder,
11243                offset + cur_offset,
11244                depth,
11245            )?;
11246
11247            _prev_end_offset = cur_offset + envelope_size;
11248
11249            Ok(())
11250        }
11251    }
11252
11253    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputReport {
11254        #[inline(always)]
11255        fn new_empty() -> Self {
11256            Self::default()
11257        }
11258
11259        unsafe fn decode(
11260            &mut self,
11261            decoder: &mut fidl::encoding::Decoder<'_, D>,
11262            offset: usize,
11263            mut depth: fidl::encoding::Depth,
11264        ) -> fidl::Result<()> {
11265            decoder.debug_check_bounds::<Self>(offset);
11266            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11267                None => return Err(fidl::Error::NotNullable),
11268                Some(len) => len,
11269            };
11270            // Calling decoder.out_of_line_offset(0) is not allowed.
11271            if len == 0 {
11272                return Ok(());
11273            };
11274            depth.increment()?;
11275            let envelope_size = 8;
11276            let bytes_len = len * envelope_size;
11277            let offset = decoder.out_of_line_offset(bytes_len)?;
11278            // Decode the envelope for each type.
11279            let mut _next_ordinal_to_read = 0;
11280            let mut next_offset = offset;
11281            let end_offset = offset + bytes_len;
11282            _next_ordinal_to_read += 1;
11283            if next_offset >= end_offset {
11284                return Ok(());
11285            }
11286
11287            // Decode unknown envelopes for gaps in ordinals.
11288            while _next_ordinal_to_read < 1 {
11289                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11290                _next_ordinal_to_read += 1;
11291                next_offset += envelope_size;
11292            }
11293
11294            let next_out_of_line = decoder.next_out_of_line();
11295            let handles_before = decoder.remaining_handles();
11296            if let Some((inlined, num_bytes, num_handles)) =
11297                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11298            {
11299                let member_inline_size =
11300                    <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
11301                        decoder.context,
11302                    );
11303                if inlined != (member_inline_size <= 4) {
11304                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11305                }
11306                let inner_offset;
11307                let mut inner_depth = depth.clone();
11308                if inlined {
11309                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11310                    inner_offset = next_offset;
11311                } else {
11312                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11313                    inner_depth.increment()?;
11314                }
11315                let val_ref = self
11316                    .values
11317                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
11318                fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11319                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11320                {
11321                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11322                }
11323                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11324                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11325                }
11326            }
11327
11328            next_offset += envelope_size;
11329
11330            // Decode the remaining unknown envelopes.
11331            while next_offset < end_offset {
11332                _next_ordinal_to_read += 1;
11333                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11334                next_offset += envelope_size;
11335            }
11336
11337            Ok(())
11338        }
11339    }
11340
11341    impl TouchDescriptor {
11342        #[inline(always)]
11343        fn max_ordinal_present(&self) -> u64 {
11344            if let Some(_) = self.feature {
11345                return 2;
11346            }
11347            if let Some(_) = self.input {
11348                return 1;
11349            }
11350            0
11351        }
11352    }
11353
11354    impl fidl::encoding::ValueTypeMarker for TouchDescriptor {
11355        type Borrowed<'a> = &'a Self;
11356        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11357            value
11358        }
11359    }
11360
11361    unsafe impl fidl::encoding::TypeMarker for TouchDescriptor {
11362        type Owned = Self;
11363
11364        #[inline(always)]
11365        fn inline_align(_context: fidl::encoding::Context) -> usize {
11366            8
11367        }
11368
11369        #[inline(always)]
11370        fn inline_size(_context: fidl::encoding::Context) -> usize {
11371            16
11372        }
11373    }
11374
11375    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDescriptor, D>
11376        for &TouchDescriptor
11377    {
11378        unsafe fn encode(
11379            self,
11380            encoder: &mut fidl::encoding::Encoder<'_, D>,
11381            offset: usize,
11382            mut depth: fidl::encoding::Depth,
11383        ) -> fidl::Result<()> {
11384            encoder.debug_check_bounds::<TouchDescriptor>(offset);
11385            // Vector header
11386            let max_ordinal: u64 = self.max_ordinal_present();
11387            encoder.write_num(max_ordinal, offset);
11388            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11389            // Calling encoder.out_of_line_offset(0) is not allowed.
11390            if max_ordinal == 0 {
11391                return Ok(());
11392            }
11393            depth.increment()?;
11394            let envelope_size = 8;
11395            let bytes_len = max_ordinal as usize * envelope_size;
11396            #[allow(unused_variables)]
11397            let offset = encoder.out_of_line_offset(bytes_len);
11398            let mut _prev_end_offset: usize = 0;
11399            if 1 > max_ordinal {
11400                return Ok(());
11401            }
11402
11403            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11404            // are envelope_size bytes.
11405            let cur_offset: usize = (1 - 1) * envelope_size;
11406
11407            // Zero reserved fields.
11408            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11409
11410            // Safety:
11411            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11412            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11413            //   envelope_size bytes, there is always sufficient room.
11414            fidl::encoding::encode_in_envelope_optional::<TouchInputDescriptor, D>(
11415                self.input
11416                    .as_ref()
11417                    .map(<TouchInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11418                encoder,
11419                offset + cur_offset,
11420                depth,
11421            )?;
11422
11423            _prev_end_offset = cur_offset + envelope_size;
11424            if 2 > max_ordinal {
11425                return Ok(());
11426            }
11427
11428            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11429            // are envelope_size bytes.
11430            let cur_offset: usize = (2 - 1) * envelope_size;
11431
11432            // Zero reserved fields.
11433            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11434
11435            // Safety:
11436            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11437            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11438            //   envelope_size bytes, there is always sufficient room.
11439            fidl::encoding::encode_in_envelope_optional::<TouchFeatureDescriptor, D>(
11440                self.feature
11441                    .as_ref()
11442                    .map(<TouchFeatureDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11443                encoder,
11444                offset + cur_offset,
11445                depth,
11446            )?;
11447
11448            _prev_end_offset = cur_offset + envelope_size;
11449
11450            Ok(())
11451        }
11452    }
11453
11454    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDescriptor {
11455        #[inline(always)]
11456        fn new_empty() -> Self {
11457            Self::default()
11458        }
11459
11460        unsafe fn decode(
11461            &mut self,
11462            decoder: &mut fidl::encoding::Decoder<'_, D>,
11463            offset: usize,
11464            mut depth: fidl::encoding::Depth,
11465        ) -> fidl::Result<()> {
11466            decoder.debug_check_bounds::<Self>(offset);
11467            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11468                None => return Err(fidl::Error::NotNullable),
11469                Some(len) => len,
11470            };
11471            // Calling decoder.out_of_line_offset(0) is not allowed.
11472            if len == 0 {
11473                return Ok(());
11474            };
11475            depth.increment()?;
11476            let envelope_size = 8;
11477            let bytes_len = len * envelope_size;
11478            let offset = decoder.out_of_line_offset(bytes_len)?;
11479            // Decode the envelope for each type.
11480            let mut _next_ordinal_to_read = 0;
11481            let mut next_offset = offset;
11482            let end_offset = offset + bytes_len;
11483            _next_ordinal_to_read += 1;
11484            if next_offset >= end_offset {
11485                return Ok(());
11486            }
11487
11488            // Decode unknown envelopes for gaps in ordinals.
11489            while _next_ordinal_to_read < 1 {
11490                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11491                _next_ordinal_to_read += 1;
11492                next_offset += envelope_size;
11493            }
11494
11495            let next_out_of_line = decoder.next_out_of_line();
11496            let handles_before = decoder.remaining_handles();
11497            if let Some((inlined, num_bytes, num_handles)) =
11498                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11499            {
11500                let member_inline_size =
11501                    <TouchInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
11502                        decoder.context,
11503                    );
11504                if inlined != (member_inline_size <= 4) {
11505                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11506                }
11507                let inner_offset;
11508                let mut inner_depth = depth.clone();
11509                if inlined {
11510                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11511                    inner_offset = next_offset;
11512                } else {
11513                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11514                    inner_depth.increment()?;
11515                }
11516                let val_ref =
11517                    self.input.get_or_insert_with(|| fidl::new_empty!(TouchInputDescriptor, D));
11518                fidl::decode!(
11519                    TouchInputDescriptor,
11520                    D,
11521                    val_ref,
11522                    decoder,
11523                    inner_offset,
11524                    inner_depth
11525                )?;
11526                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11527                {
11528                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11529                }
11530                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11531                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11532                }
11533            }
11534
11535            next_offset += envelope_size;
11536            _next_ordinal_to_read += 1;
11537            if next_offset >= end_offset {
11538                return Ok(());
11539            }
11540
11541            // Decode unknown envelopes for gaps in ordinals.
11542            while _next_ordinal_to_read < 2 {
11543                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11544                _next_ordinal_to_read += 1;
11545                next_offset += envelope_size;
11546            }
11547
11548            let next_out_of_line = decoder.next_out_of_line();
11549            let handles_before = decoder.remaining_handles();
11550            if let Some((inlined, num_bytes, num_handles)) =
11551                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11552            {
11553                let member_inline_size =
11554                    <TouchFeatureDescriptor as fidl::encoding::TypeMarker>::inline_size(
11555                        decoder.context,
11556                    );
11557                if inlined != (member_inline_size <= 4) {
11558                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11559                }
11560                let inner_offset;
11561                let mut inner_depth = depth.clone();
11562                if inlined {
11563                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11564                    inner_offset = next_offset;
11565                } else {
11566                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11567                    inner_depth.increment()?;
11568                }
11569                let val_ref =
11570                    self.feature.get_or_insert_with(|| fidl::new_empty!(TouchFeatureDescriptor, D));
11571                fidl::decode!(
11572                    TouchFeatureDescriptor,
11573                    D,
11574                    val_ref,
11575                    decoder,
11576                    inner_offset,
11577                    inner_depth
11578                )?;
11579                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11580                {
11581                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11582                }
11583                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11584                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11585                }
11586            }
11587
11588            next_offset += envelope_size;
11589
11590            // Decode the remaining unknown envelopes.
11591            while next_offset < end_offset {
11592                _next_ordinal_to_read += 1;
11593                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11594                next_offset += envelope_size;
11595            }
11596
11597            Ok(())
11598        }
11599    }
11600
11601    impl TouchFeatureDescriptor {
11602        #[inline(always)]
11603        fn max_ordinal_present(&self) -> u64 {
11604            if let Some(_) = self.supports_selective_reporting {
11605                return 2;
11606            }
11607            if let Some(_) = self.supports_input_mode {
11608                return 1;
11609            }
11610            0
11611        }
11612    }
11613
11614    impl fidl::encoding::ValueTypeMarker for TouchFeatureDescriptor {
11615        type Borrowed<'a> = &'a Self;
11616        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11617            value
11618        }
11619    }
11620
11621    unsafe impl fidl::encoding::TypeMarker for TouchFeatureDescriptor {
11622        type Owned = Self;
11623
11624        #[inline(always)]
11625        fn inline_align(_context: fidl::encoding::Context) -> usize {
11626            8
11627        }
11628
11629        #[inline(always)]
11630        fn inline_size(_context: fidl::encoding::Context) -> usize {
11631            16
11632        }
11633    }
11634
11635    unsafe impl<D: fidl::encoding::ResourceDialect>
11636        fidl::encoding::Encode<TouchFeatureDescriptor, D> for &TouchFeatureDescriptor
11637    {
11638        unsafe fn encode(
11639            self,
11640            encoder: &mut fidl::encoding::Encoder<'_, D>,
11641            offset: usize,
11642            mut depth: fidl::encoding::Depth,
11643        ) -> fidl::Result<()> {
11644            encoder.debug_check_bounds::<TouchFeatureDescriptor>(offset);
11645            // Vector header
11646            let max_ordinal: u64 = self.max_ordinal_present();
11647            encoder.write_num(max_ordinal, offset);
11648            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11649            // Calling encoder.out_of_line_offset(0) is not allowed.
11650            if max_ordinal == 0 {
11651                return Ok(());
11652            }
11653            depth.increment()?;
11654            let envelope_size = 8;
11655            let bytes_len = max_ordinal as usize * envelope_size;
11656            #[allow(unused_variables)]
11657            let offset = encoder.out_of_line_offset(bytes_len);
11658            let mut _prev_end_offset: usize = 0;
11659            if 1 > max_ordinal {
11660                return Ok(());
11661            }
11662
11663            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11664            // are envelope_size bytes.
11665            let cur_offset: usize = (1 - 1) * envelope_size;
11666
11667            // Zero reserved fields.
11668            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11669
11670            // Safety:
11671            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11672            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11673            //   envelope_size bytes, there is always sufficient room.
11674            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11675                self.supports_input_mode
11676                    .as_ref()
11677                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11678                encoder,
11679                offset + cur_offset,
11680                depth,
11681            )?;
11682
11683            _prev_end_offset = cur_offset + envelope_size;
11684            if 2 > max_ordinal {
11685                return Ok(());
11686            }
11687
11688            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11689            // are envelope_size bytes.
11690            let cur_offset: usize = (2 - 1) * envelope_size;
11691
11692            // Zero reserved fields.
11693            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11694
11695            // Safety:
11696            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11697            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11698            //   envelope_size bytes, there is always sufficient room.
11699            fidl::encoding::encode_in_envelope_optional::<bool, D>(
11700                self.supports_selective_reporting
11701                    .as_ref()
11702                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11703                encoder,
11704                offset + cur_offset,
11705                depth,
11706            )?;
11707
11708            _prev_end_offset = cur_offset + envelope_size;
11709
11710            Ok(())
11711        }
11712    }
11713
11714    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11715        for TouchFeatureDescriptor
11716    {
11717        #[inline(always)]
11718        fn new_empty() -> Self {
11719            Self::default()
11720        }
11721
11722        unsafe fn decode(
11723            &mut self,
11724            decoder: &mut fidl::encoding::Decoder<'_, D>,
11725            offset: usize,
11726            mut depth: fidl::encoding::Depth,
11727        ) -> fidl::Result<()> {
11728            decoder.debug_check_bounds::<Self>(offset);
11729            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11730                None => return Err(fidl::Error::NotNullable),
11731                Some(len) => len,
11732            };
11733            // Calling decoder.out_of_line_offset(0) is not allowed.
11734            if len == 0 {
11735                return Ok(());
11736            };
11737            depth.increment()?;
11738            let envelope_size = 8;
11739            let bytes_len = len * envelope_size;
11740            let offset = decoder.out_of_line_offset(bytes_len)?;
11741            // Decode the envelope for each type.
11742            let mut _next_ordinal_to_read = 0;
11743            let mut next_offset = offset;
11744            let end_offset = offset + bytes_len;
11745            _next_ordinal_to_read += 1;
11746            if next_offset >= end_offset {
11747                return Ok(());
11748            }
11749
11750            // Decode unknown envelopes for gaps in ordinals.
11751            while _next_ordinal_to_read < 1 {
11752                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11753                _next_ordinal_to_read += 1;
11754                next_offset += envelope_size;
11755            }
11756
11757            let next_out_of_line = decoder.next_out_of_line();
11758            let handles_before = decoder.remaining_handles();
11759            if let Some((inlined, num_bytes, num_handles)) =
11760                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11761            {
11762                let member_inline_size =
11763                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11764                if inlined != (member_inline_size <= 4) {
11765                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11766                }
11767                let inner_offset;
11768                let mut inner_depth = depth.clone();
11769                if inlined {
11770                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11771                    inner_offset = next_offset;
11772                } else {
11773                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11774                    inner_depth.increment()?;
11775                }
11776                let val_ref =
11777                    self.supports_input_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
11778                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11779                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11780                {
11781                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11782                }
11783                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11784                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11785                }
11786            }
11787
11788            next_offset += envelope_size;
11789            _next_ordinal_to_read += 1;
11790            if next_offset >= end_offset {
11791                return Ok(());
11792            }
11793
11794            // Decode unknown envelopes for gaps in ordinals.
11795            while _next_ordinal_to_read < 2 {
11796                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11797                _next_ordinal_to_read += 1;
11798                next_offset += envelope_size;
11799            }
11800
11801            let next_out_of_line = decoder.next_out_of_line();
11802            let handles_before = decoder.remaining_handles();
11803            if let Some((inlined, num_bytes, num_handles)) =
11804                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11805            {
11806                let member_inline_size =
11807                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11808                if inlined != (member_inline_size <= 4) {
11809                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11810                }
11811                let inner_offset;
11812                let mut inner_depth = depth.clone();
11813                if inlined {
11814                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11815                    inner_offset = next_offset;
11816                } else {
11817                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11818                    inner_depth.increment()?;
11819                }
11820                let val_ref = self
11821                    .supports_selective_reporting
11822                    .get_or_insert_with(|| fidl::new_empty!(bool, D));
11823                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11824                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11825                {
11826                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11827                }
11828                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11829                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11830                }
11831            }
11832
11833            next_offset += envelope_size;
11834
11835            // Decode the remaining unknown envelopes.
11836            while next_offset < end_offset {
11837                _next_ordinal_to_read += 1;
11838                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11839                next_offset += envelope_size;
11840            }
11841
11842            Ok(())
11843        }
11844    }
11845
11846    impl TouchFeatureReport {
11847        #[inline(always)]
11848        fn max_ordinal_present(&self) -> u64 {
11849            if let Some(_) = self.selective_reporting {
11850                return 2;
11851            }
11852            if let Some(_) = self.input_mode {
11853                return 1;
11854            }
11855            0
11856        }
11857    }
11858
11859    impl fidl::encoding::ValueTypeMarker for TouchFeatureReport {
11860        type Borrowed<'a> = &'a Self;
11861        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11862            value
11863        }
11864    }
11865
11866    unsafe impl fidl::encoding::TypeMarker for TouchFeatureReport {
11867        type Owned = Self;
11868
11869        #[inline(always)]
11870        fn inline_align(_context: fidl::encoding::Context) -> usize {
11871            8
11872        }
11873
11874        #[inline(always)]
11875        fn inline_size(_context: fidl::encoding::Context) -> usize {
11876            16
11877        }
11878    }
11879
11880    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchFeatureReport, D>
11881        for &TouchFeatureReport
11882    {
11883        unsafe fn encode(
11884            self,
11885            encoder: &mut fidl::encoding::Encoder<'_, D>,
11886            offset: usize,
11887            mut depth: fidl::encoding::Depth,
11888        ) -> fidl::Result<()> {
11889            encoder.debug_check_bounds::<TouchFeatureReport>(offset);
11890            // Vector header
11891            let max_ordinal: u64 = self.max_ordinal_present();
11892            encoder.write_num(max_ordinal, offset);
11893            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11894            // Calling encoder.out_of_line_offset(0) is not allowed.
11895            if max_ordinal == 0 {
11896                return Ok(());
11897            }
11898            depth.increment()?;
11899            let envelope_size = 8;
11900            let bytes_len = max_ordinal as usize * envelope_size;
11901            #[allow(unused_variables)]
11902            let offset = encoder.out_of_line_offset(bytes_len);
11903            let mut _prev_end_offset: usize = 0;
11904            if 1 > max_ordinal {
11905                return Ok(());
11906            }
11907
11908            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11909            // are envelope_size bytes.
11910            let cur_offset: usize = (1 - 1) * envelope_size;
11911
11912            // Zero reserved fields.
11913            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11914
11915            // Safety:
11916            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11917            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11918            //   envelope_size bytes, there is always sufficient room.
11919            fidl::encoding::encode_in_envelope_optional::<TouchConfigurationInputMode, D>(
11920                self.input_mode
11921                    .as_ref()
11922                    .map(<TouchConfigurationInputMode as fidl::encoding::ValueTypeMarker>::borrow),
11923                encoder,
11924                offset + cur_offset,
11925                depth,
11926            )?;
11927
11928            _prev_end_offset = cur_offset + envelope_size;
11929            if 2 > max_ordinal {
11930                return Ok(());
11931            }
11932
11933            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11934            // are envelope_size bytes.
11935            let cur_offset: usize = (2 - 1) * envelope_size;
11936
11937            // Zero reserved fields.
11938            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11939
11940            // Safety:
11941            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11942            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11943            //   envelope_size bytes, there is always sufficient room.
11944            fidl::encoding::encode_in_envelope_optional::<SelectiveReportingFeatureReport, D>(
11945                self.selective_reporting.as_ref().map(
11946                    <SelectiveReportingFeatureReport as fidl::encoding::ValueTypeMarker>::borrow,
11947                ),
11948                encoder,
11949                offset + cur_offset,
11950                depth,
11951            )?;
11952
11953            _prev_end_offset = cur_offset + envelope_size;
11954
11955            Ok(())
11956        }
11957    }
11958
11959    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchFeatureReport {
11960        #[inline(always)]
11961        fn new_empty() -> Self {
11962            Self::default()
11963        }
11964
11965        unsafe fn decode(
11966            &mut self,
11967            decoder: &mut fidl::encoding::Decoder<'_, D>,
11968            offset: usize,
11969            mut depth: fidl::encoding::Depth,
11970        ) -> fidl::Result<()> {
11971            decoder.debug_check_bounds::<Self>(offset);
11972            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11973                None => return Err(fidl::Error::NotNullable),
11974                Some(len) => len,
11975            };
11976            // Calling decoder.out_of_line_offset(0) is not allowed.
11977            if len == 0 {
11978                return Ok(());
11979            };
11980            depth.increment()?;
11981            let envelope_size = 8;
11982            let bytes_len = len * envelope_size;
11983            let offset = decoder.out_of_line_offset(bytes_len)?;
11984            // Decode the envelope for each type.
11985            let mut _next_ordinal_to_read = 0;
11986            let mut next_offset = offset;
11987            let end_offset = offset + bytes_len;
11988            _next_ordinal_to_read += 1;
11989            if next_offset >= end_offset {
11990                return Ok(());
11991            }
11992
11993            // Decode unknown envelopes for gaps in ordinals.
11994            while _next_ordinal_to_read < 1 {
11995                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11996                _next_ordinal_to_read += 1;
11997                next_offset += envelope_size;
11998            }
11999
12000            let next_out_of_line = decoder.next_out_of_line();
12001            let handles_before = decoder.remaining_handles();
12002            if let Some((inlined, num_bytes, num_handles)) =
12003                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12004            {
12005                let member_inline_size =
12006                    <TouchConfigurationInputMode as fidl::encoding::TypeMarker>::inline_size(
12007                        decoder.context,
12008                    );
12009                if inlined != (member_inline_size <= 4) {
12010                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12011                }
12012                let inner_offset;
12013                let mut inner_depth = depth.clone();
12014                if inlined {
12015                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12016                    inner_offset = next_offset;
12017                } else {
12018                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12019                    inner_depth.increment()?;
12020                }
12021                let val_ref = self
12022                    .input_mode
12023                    .get_or_insert_with(|| fidl::new_empty!(TouchConfigurationInputMode, D));
12024                fidl::decode!(
12025                    TouchConfigurationInputMode,
12026                    D,
12027                    val_ref,
12028                    decoder,
12029                    inner_offset,
12030                    inner_depth
12031                )?;
12032                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12033                {
12034                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12035                }
12036                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12037                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12038                }
12039            }
12040
12041            next_offset += envelope_size;
12042            _next_ordinal_to_read += 1;
12043            if next_offset >= end_offset {
12044                return Ok(());
12045            }
12046
12047            // Decode unknown envelopes for gaps in ordinals.
12048            while _next_ordinal_to_read < 2 {
12049                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12050                _next_ordinal_to_read += 1;
12051                next_offset += envelope_size;
12052            }
12053
12054            let next_out_of_line = decoder.next_out_of_line();
12055            let handles_before = decoder.remaining_handles();
12056            if let Some((inlined, num_bytes, num_handles)) =
12057                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12058            {
12059                let member_inline_size =
12060                    <SelectiveReportingFeatureReport as fidl::encoding::TypeMarker>::inline_size(
12061                        decoder.context,
12062                    );
12063                if inlined != (member_inline_size <= 4) {
12064                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12065                }
12066                let inner_offset;
12067                let mut inner_depth = depth.clone();
12068                if inlined {
12069                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12070                    inner_offset = next_offset;
12071                } else {
12072                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12073                    inner_depth.increment()?;
12074                }
12075                let val_ref = self
12076                    .selective_reporting
12077                    .get_or_insert_with(|| fidl::new_empty!(SelectiveReportingFeatureReport, D));
12078                fidl::decode!(
12079                    SelectiveReportingFeatureReport,
12080                    D,
12081                    val_ref,
12082                    decoder,
12083                    inner_offset,
12084                    inner_depth
12085                )?;
12086                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12087                {
12088                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12089                }
12090                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12091                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12092                }
12093            }
12094
12095            next_offset += envelope_size;
12096
12097            // Decode the remaining unknown envelopes.
12098            while next_offset < end_offset {
12099                _next_ordinal_to_read += 1;
12100                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12101                next_offset += envelope_size;
12102            }
12103
12104            Ok(())
12105        }
12106    }
12107
12108    impl TouchInputDescriptor {
12109        #[inline(always)]
12110        fn max_ordinal_present(&self) -> u64 {
12111            if let Some(_) = self.buttons {
12112                return 4;
12113            }
12114            if let Some(_) = self.touch_type {
12115                return 3;
12116            }
12117            if let Some(_) = self.max_contacts {
12118                return 2;
12119            }
12120            if let Some(_) = self.contacts {
12121                return 1;
12122            }
12123            0
12124        }
12125    }
12126
12127    impl fidl::encoding::ValueTypeMarker for TouchInputDescriptor {
12128        type Borrowed<'a> = &'a Self;
12129        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12130            value
12131        }
12132    }
12133
12134    unsafe impl fidl::encoding::TypeMarker for TouchInputDescriptor {
12135        type Owned = Self;
12136
12137        #[inline(always)]
12138        fn inline_align(_context: fidl::encoding::Context) -> usize {
12139            8
12140        }
12141
12142        #[inline(always)]
12143        fn inline_size(_context: fidl::encoding::Context) -> usize {
12144            16
12145        }
12146    }
12147
12148    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputDescriptor, D>
12149        for &TouchInputDescriptor
12150    {
12151        unsafe fn encode(
12152            self,
12153            encoder: &mut fidl::encoding::Encoder<'_, D>,
12154            offset: usize,
12155            mut depth: fidl::encoding::Depth,
12156        ) -> fidl::Result<()> {
12157            encoder.debug_check_bounds::<TouchInputDescriptor>(offset);
12158            // Vector header
12159            let max_ordinal: u64 = self.max_ordinal_present();
12160            encoder.write_num(max_ordinal, offset);
12161            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12162            // Calling encoder.out_of_line_offset(0) is not allowed.
12163            if max_ordinal == 0 {
12164                return Ok(());
12165            }
12166            depth.increment()?;
12167            let envelope_size = 8;
12168            let bytes_len = max_ordinal as usize * envelope_size;
12169            #[allow(unused_variables)]
12170            let offset = encoder.out_of_line_offset(bytes_len);
12171            let mut _prev_end_offset: usize = 0;
12172            if 1 > max_ordinal {
12173                return Ok(());
12174            }
12175
12176            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12177            // are envelope_size bytes.
12178            let cur_offset: usize = (1 - 1) * envelope_size;
12179
12180            // Zero reserved fields.
12181            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12182
12183            // Safety:
12184            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12185            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12186            //   envelope_size bytes, there is always sufficient room.
12187            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputDescriptor, 10>, D>(
12188            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12189            encoder, offset + cur_offset, depth
12190        )?;
12191
12192            _prev_end_offset = cur_offset + envelope_size;
12193            if 2 > max_ordinal {
12194                return Ok(());
12195            }
12196
12197            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12198            // are envelope_size bytes.
12199            let cur_offset: usize = (2 - 1) * envelope_size;
12200
12201            // Zero reserved fields.
12202            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12203
12204            // Safety:
12205            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12206            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12207            //   envelope_size bytes, there is always sufficient room.
12208            fidl::encoding::encode_in_envelope_optional::<u32, D>(
12209                self.max_contacts.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12210                encoder,
12211                offset + cur_offset,
12212                depth,
12213            )?;
12214
12215            _prev_end_offset = cur_offset + envelope_size;
12216            if 3 > max_ordinal {
12217                return Ok(());
12218            }
12219
12220            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12221            // are envelope_size bytes.
12222            let cur_offset: usize = (3 - 1) * envelope_size;
12223
12224            // Zero reserved fields.
12225            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12226
12227            // Safety:
12228            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12229            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12230            //   envelope_size bytes, there is always sufficient room.
12231            fidl::encoding::encode_in_envelope_optional::<TouchType, D>(
12232                self.touch_type
12233                    .as_ref()
12234                    .map(<TouchType as fidl::encoding::ValueTypeMarker>::borrow),
12235                encoder,
12236                offset + cur_offset,
12237                depth,
12238            )?;
12239
12240            _prev_end_offset = cur_offset + envelope_size;
12241            if 4 > max_ordinal {
12242                return Ok(());
12243            }
12244
12245            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12246            // are envelope_size bytes.
12247            let cur_offset: usize = (4 - 1) * envelope_size;
12248
12249            // Zero reserved fields.
12250            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12251
12252            // Safety:
12253            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12254            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12255            //   envelope_size bytes, there is always sufficient room.
12256            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
12257                self.buttons.as_ref().map(
12258                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
12259                ),
12260                encoder,
12261                offset + cur_offset,
12262                depth,
12263            )?;
12264
12265            _prev_end_offset = cur_offset + envelope_size;
12266
12267            Ok(())
12268        }
12269    }
12270
12271    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputDescriptor {
12272        #[inline(always)]
12273        fn new_empty() -> Self {
12274            Self::default()
12275        }
12276
12277        unsafe fn decode(
12278            &mut self,
12279            decoder: &mut fidl::encoding::Decoder<'_, D>,
12280            offset: usize,
12281            mut depth: fidl::encoding::Depth,
12282        ) -> fidl::Result<()> {
12283            decoder.debug_check_bounds::<Self>(offset);
12284            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12285                None => return Err(fidl::Error::NotNullable),
12286                Some(len) => len,
12287            };
12288            // Calling decoder.out_of_line_offset(0) is not allowed.
12289            if len == 0 {
12290                return Ok(());
12291            };
12292            depth.increment()?;
12293            let envelope_size = 8;
12294            let bytes_len = len * envelope_size;
12295            let offset = decoder.out_of_line_offset(bytes_len)?;
12296            // Decode the envelope for each type.
12297            let mut _next_ordinal_to_read = 0;
12298            let mut next_offset = offset;
12299            let end_offset = offset + bytes_len;
12300            _next_ordinal_to_read += 1;
12301            if next_offset >= end_offset {
12302                return Ok(());
12303            }
12304
12305            // Decode unknown envelopes for gaps in ordinals.
12306            while _next_ordinal_to_read < 1 {
12307                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12308                _next_ordinal_to_read += 1;
12309                next_offset += envelope_size;
12310            }
12311
12312            let next_out_of_line = decoder.next_out_of_line();
12313            let handles_before = decoder.remaining_handles();
12314            if let Some((inlined, num_bytes, num_handles)) =
12315                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12316            {
12317                let member_inline_size = <fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12318                if inlined != (member_inline_size <= 4) {
12319                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12320                }
12321                let inner_offset;
12322                let mut inner_depth = depth.clone();
12323                if inlined {
12324                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12325                    inner_offset = next_offset;
12326                } else {
12327                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12328                    inner_depth.increment()?;
12329                }
12330                let val_ref = self.contacts.get_or_insert_with(
12331                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D),
12332                );
12333                fidl::decode!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12334                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12335                {
12336                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12337                }
12338                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12339                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12340                }
12341            }
12342
12343            next_offset += envelope_size;
12344            _next_ordinal_to_read += 1;
12345            if next_offset >= end_offset {
12346                return Ok(());
12347            }
12348
12349            // Decode unknown envelopes for gaps in ordinals.
12350            while _next_ordinal_to_read < 2 {
12351                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12352                _next_ordinal_to_read += 1;
12353                next_offset += envelope_size;
12354            }
12355
12356            let next_out_of_line = decoder.next_out_of_line();
12357            let handles_before = decoder.remaining_handles();
12358            if let Some((inlined, num_bytes, num_handles)) =
12359                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12360            {
12361                let member_inline_size =
12362                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12363                if inlined != (member_inline_size <= 4) {
12364                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12365                }
12366                let inner_offset;
12367                let mut inner_depth = depth.clone();
12368                if inlined {
12369                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12370                    inner_offset = next_offset;
12371                } else {
12372                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12373                    inner_depth.increment()?;
12374                }
12375                let val_ref = self.max_contacts.get_or_insert_with(|| fidl::new_empty!(u32, D));
12376                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12377                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12378                {
12379                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12380                }
12381                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12382                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12383                }
12384            }
12385
12386            next_offset += envelope_size;
12387            _next_ordinal_to_read += 1;
12388            if next_offset >= end_offset {
12389                return Ok(());
12390            }
12391
12392            // Decode unknown envelopes for gaps in ordinals.
12393            while _next_ordinal_to_read < 3 {
12394                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12395                _next_ordinal_to_read += 1;
12396                next_offset += envelope_size;
12397            }
12398
12399            let next_out_of_line = decoder.next_out_of_line();
12400            let handles_before = decoder.remaining_handles();
12401            if let Some((inlined, num_bytes, num_handles)) =
12402                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12403            {
12404                let member_inline_size =
12405                    <TouchType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12406                if inlined != (member_inline_size <= 4) {
12407                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12408                }
12409                let inner_offset;
12410                let mut inner_depth = depth.clone();
12411                if inlined {
12412                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12413                    inner_offset = next_offset;
12414                } else {
12415                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12416                    inner_depth.increment()?;
12417                }
12418                let val_ref = self.touch_type.get_or_insert_with(|| fidl::new_empty!(TouchType, D));
12419                fidl::decode!(TouchType, D, val_ref, decoder, inner_offset, inner_depth)?;
12420                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12421                {
12422                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12423                }
12424                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12425                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12426                }
12427            }
12428
12429            next_offset += envelope_size;
12430            _next_ordinal_to_read += 1;
12431            if next_offset >= end_offset {
12432                return Ok(());
12433            }
12434
12435            // Decode unknown envelopes for gaps in ordinals.
12436            while _next_ordinal_to_read < 4 {
12437                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12438                _next_ordinal_to_read += 1;
12439                next_offset += envelope_size;
12440            }
12441
12442            let next_out_of_line = decoder.next_out_of_line();
12443            let handles_before = decoder.remaining_handles();
12444            if let Some((inlined, num_bytes, num_handles)) =
12445                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12446            {
12447                let member_inline_size =
12448                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
12449                        decoder.context,
12450                    );
12451                if inlined != (member_inline_size <= 4) {
12452                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12453                }
12454                let inner_offset;
12455                let mut inner_depth = depth.clone();
12456                if inlined {
12457                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12458                    inner_offset = next_offset;
12459                } else {
12460                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12461                    inner_depth.increment()?;
12462                }
12463                let val_ref = self
12464                    .buttons
12465                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
12466                fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12467                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12468                {
12469                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12470                }
12471                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12472                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12473                }
12474            }
12475
12476            next_offset += envelope_size;
12477
12478            // Decode the remaining unknown envelopes.
12479            while next_offset < end_offset {
12480                _next_ordinal_to_read += 1;
12481                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12482                next_offset += envelope_size;
12483            }
12484
12485            Ok(())
12486        }
12487    }
12488
12489    impl TouchInputReport {
12490        #[inline(always)]
12491        fn max_ordinal_present(&self) -> u64 {
12492            if let Some(_) = self.pressed_buttons {
12493                return 2;
12494            }
12495            if let Some(_) = self.contacts {
12496                return 1;
12497            }
12498            0
12499        }
12500    }
12501
12502    impl fidl::encoding::ValueTypeMarker for TouchInputReport {
12503        type Borrowed<'a> = &'a Self;
12504        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12505            value
12506        }
12507    }
12508
12509    unsafe impl fidl::encoding::TypeMarker for TouchInputReport {
12510        type Owned = Self;
12511
12512        #[inline(always)]
12513        fn inline_align(_context: fidl::encoding::Context) -> usize {
12514            8
12515        }
12516
12517        #[inline(always)]
12518        fn inline_size(_context: fidl::encoding::Context) -> usize {
12519            16
12520        }
12521    }
12522
12523    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputReport, D>
12524        for &TouchInputReport
12525    {
12526        unsafe fn encode(
12527            self,
12528            encoder: &mut fidl::encoding::Encoder<'_, D>,
12529            offset: usize,
12530            mut depth: fidl::encoding::Depth,
12531        ) -> fidl::Result<()> {
12532            encoder.debug_check_bounds::<TouchInputReport>(offset);
12533            // Vector header
12534            let max_ordinal: u64 = self.max_ordinal_present();
12535            encoder.write_num(max_ordinal, offset);
12536            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12537            // Calling encoder.out_of_line_offset(0) is not allowed.
12538            if max_ordinal == 0 {
12539                return Ok(());
12540            }
12541            depth.increment()?;
12542            let envelope_size = 8;
12543            let bytes_len = max_ordinal as usize * envelope_size;
12544            #[allow(unused_variables)]
12545            let offset = encoder.out_of_line_offset(bytes_len);
12546            let mut _prev_end_offset: usize = 0;
12547            if 1 > max_ordinal {
12548                return Ok(());
12549            }
12550
12551            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12552            // are envelope_size bytes.
12553            let cur_offset: usize = (1 - 1) * envelope_size;
12554
12555            // Zero reserved fields.
12556            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12557
12558            // Safety:
12559            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12560            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12561            //   envelope_size bytes, there is always sufficient room.
12562            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputReport, 10>, D>(
12563            self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12564            encoder, offset + cur_offset, depth
12565        )?;
12566
12567            _prev_end_offset = cur_offset + envelope_size;
12568            if 2 > max_ordinal {
12569                return Ok(());
12570            }
12571
12572            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12573            // are envelope_size bytes.
12574            let cur_offset: usize = (2 - 1) * envelope_size;
12575
12576            // Zero reserved fields.
12577            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12578
12579            // Safety:
12580            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12581            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12582            //   envelope_size bytes, there is always sufficient room.
12583            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
12584                self.pressed_buttons.as_ref().map(
12585                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
12586                ),
12587                encoder,
12588                offset + cur_offset,
12589                depth,
12590            )?;
12591
12592            _prev_end_offset = cur_offset + envelope_size;
12593
12594            Ok(())
12595        }
12596    }
12597
12598    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputReport {
12599        #[inline(always)]
12600        fn new_empty() -> Self {
12601            Self::default()
12602        }
12603
12604        unsafe fn decode(
12605            &mut self,
12606            decoder: &mut fidl::encoding::Decoder<'_, D>,
12607            offset: usize,
12608            mut depth: fidl::encoding::Depth,
12609        ) -> fidl::Result<()> {
12610            decoder.debug_check_bounds::<Self>(offset);
12611            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12612                None => return Err(fidl::Error::NotNullable),
12613                Some(len) => len,
12614            };
12615            // Calling decoder.out_of_line_offset(0) is not allowed.
12616            if len == 0 {
12617                return Ok(());
12618            };
12619            depth.increment()?;
12620            let envelope_size = 8;
12621            let bytes_len = len * envelope_size;
12622            let offset = decoder.out_of_line_offset(bytes_len)?;
12623            // Decode the envelope for each type.
12624            let mut _next_ordinal_to_read = 0;
12625            let mut next_offset = offset;
12626            let end_offset = offset + bytes_len;
12627            _next_ordinal_to_read += 1;
12628            if next_offset >= end_offset {
12629                return Ok(());
12630            }
12631
12632            // Decode unknown envelopes for gaps in ordinals.
12633            while _next_ordinal_to_read < 1 {
12634                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12635                _next_ordinal_to_read += 1;
12636                next_offset += envelope_size;
12637            }
12638
12639            let next_out_of_line = decoder.next_out_of_line();
12640            let handles_before = decoder.remaining_handles();
12641            if let Some((inlined, num_bytes, num_handles)) =
12642                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12643            {
12644                let member_inline_size = <fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12645                if inlined != (member_inline_size <= 4) {
12646                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12647                }
12648                let inner_offset;
12649                let mut inner_depth = depth.clone();
12650                if inlined {
12651                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12652                    inner_offset = next_offset;
12653                } else {
12654                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12655                    inner_depth.increment()?;
12656                }
12657                let val_ref = self.contacts.get_or_insert_with(
12658                    || fidl::new_empty!(fidl::encoding::Vector<ContactInputReport, 10>, D),
12659                );
12660                fidl::decode!(fidl::encoding::Vector<ContactInputReport, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12661                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12662                {
12663                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12664                }
12665                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12666                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12667                }
12668            }
12669
12670            next_offset += envelope_size;
12671            _next_ordinal_to_read += 1;
12672            if next_offset >= end_offset {
12673                return Ok(());
12674            }
12675
12676            // Decode unknown envelopes for gaps in ordinals.
12677            while _next_ordinal_to_read < 2 {
12678                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12679                _next_ordinal_to_read += 1;
12680                next_offset += envelope_size;
12681            }
12682
12683            let next_out_of_line = decoder.next_out_of_line();
12684            let handles_before = decoder.remaining_handles();
12685            if let Some((inlined, num_bytes, num_handles)) =
12686                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12687            {
12688                let member_inline_size =
12689                    <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
12690                        decoder.context,
12691                    );
12692                if inlined != (member_inline_size <= 4) {
12693                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12694                }
12695                let inner_offset;
12696                let mut inner_depth = depth.clone();
12697                if inlined {
12698                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12699                    inner_offset = next_offset;
12700                } else {
12701                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12702                    inner_depth.increment()?;
12703                }
12704                let val_ref = self
12705                    .pressed_buttons
12706                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
12707                fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12708                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12709                {
12710                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12711                }
12712                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12713                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12714                }
12715            }
12716
12717            next_offset += envelope_size;
12718
12719            // Decode the remaining unknown envelopes.
12720            while next_offset < end_offset {
12721                _next_ordinal_to_read += 1;
12722                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12723                next_offset += envelope_size;
12724            }
12725
12726            Ok(())
12727        }
12728    }
12729}