Skip to main content

fidl_fuchsia_input_report__common/
fidl_fuchsia_input_report__common.rs

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