Skip to main content

fidl_fuchsia_ui_input_common/
fidl_fuchsia_ui_input_common.rs

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