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 MODIFIER_ALT: u32 = 96;
12
13pub const MODIFIER_CAPS_LOCK: u32 = 1;
14
15pub const MODIFIER_CONTROL: u32 = 24;
16
17pub const MODIFIER_LEFT_ALT: u32 = 32;
18
19pub const MODIFIER_LEFT_CONTROL: u32 = 8;
20
21pub const MODIFIER_LEFT_SHIFT: u32 = 2;
22
23pub const MODIFIER_LEFT_SUPER: u32 = 128;
24
25/// Keyboard modifiers
26pub const MODIFIER_NONE: u32 = 0;
27
28pub const MODIFIER_RIGHT_ALT: u32 = 64;
29
30pub const MODIFIER_RIGHT_CONTROL: u32 = 16;
31
32pub const MODIFIER_RIGHT_SHIFT: u32 = 4;
33
34pub const MODIFIER_RIGHT_SUPER: u32 = 256;
35
36pub const MODIFIER_SHIFT: u32 = 6;
37
38pub const MODIFIER_SUPER: u32 = 384;
39
40#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
41pub enum AxisScale {
42    Linear,
43    Logarithmic,
44    #[doc(hidden)]
45    __SourceBreaking {
46        unknown_ordinal: u32,
47    },
48}
49
50/// Pattern that matches an unknown `AxisScale` member.
51#[macro_export]
52macro_rules! AxisScaleUnknown {
53    () => {
54        _
55    };
56}
57
58impl AxisScale {
59    #[inline]
60    pub fn from_primitive(prim: u32) -> Option<Self> {
61        match prim {
62            0 => Some(Self::Linear),
63            1 => Some(Self::Logarithmic),
64            _ => None,
65        }
66    }
67
68    #[inline]
69    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
70        match prim {
71            0 => Self::Linear,
72            1 => Self::Logarithmic,
73            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
74        }
75    }
76
77    #[inline]
78    pub fn unknown() -> Self {
79        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
80    }
81
82    #[inline]
83    pub const fn into_primitive(self) -> u32 {
84        match self {
85            Self::Linear => 0,
86            Self::Logarithmic => 1,
87            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
88        }
89    }
90
91    #[inline]
92    pub fn is_unknown(&self) -> bool {
93        match self {
94            Self::__SourceBreaking { unknown_ordinal: _ } => true,
95            _ => false,
96        }
97    }
98}
99
100/// Determines what happens if the "action" key is pressed on the keyboard,
101/// typically would either be the "Enter" key on a physical keyboard, or an
102/// action button on a virtual keyboard, which is usually placed where Enter
103/// would be, but with a custom label.
104#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
105pub enum InputMethodAction {
106    /// The method action was not specified at all.
107    Unspecified,
108    /// No special action is requested.
109    None,
110    /// The action is "Go", e.g. execute a command.
111    Go,
112    /// The action is to invoke a search.
113    Search,
114    /// The action is to invoke "send", e.g. if this is an email or a SMS
115    /// message.
116    Send,
117    /// The action is to move to the next field in the focus sequence.
118    Next,
119    /// The action is to end the text editing.
120    Done,
121    /// The action is to move to the previous field in the focus sequence.
122    Previous,
123    /// Pressing the action key inserts a new line into the text field. In
124    /// contrast to other values, which all stop editing and invoke a specific
125    /// action.
126    Newline,
127    #[doc(hidden)]
128    __SourceBreaking { unknown_ordinal: u32 },
129}
130
131/// Pattern that matches an unknown `InputMethodAction` member.
132#[macro_export]
133macro_rules! InputMethodActionUnknown {
134    () => {
135        _
136    };
137}
138
139impl InputMethodAction {
140    #[inline]
141    pub fn from_primitive(prim: u32) -> Option<Self> {
142        match prim {
143            0 => Some(Self::Unspecified),
144            1 => Some(Self::None),
145            2 => Some(Self::Go),
146            3 => Some(Self::Search),
147            4 => Some(Self::Send),
148            5 => Some(Self::Next),
149            6 => Some(Self::Done),
150            7 => Some(Self::Previous),
151            8 => Some(Self::Newline),
152            _ => None,
153        }
154    }
155
156    #[inline]
157    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
158        match prim {
159            0 => Self::Unspecified,
160            1 => Self::None,
161            2 => Self::Go,
162            3 => Self::Search,
163            4 => Self::Send,
164            5 => Self::Next,
165            6 => Self::Done,
166            7 => Self::Previous,
167            8 => Self::Newline,
168            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
169        }
170    }
171
172    #[inline]
173    pub fn unknown() -> Self {
174        Self::__SourceBreaking { unknown_ordinal: 0x0 }
175    }
176
177    #[inline]
178    pub const fn into_primitive(self) -> u32 {
179        match self {
180            Self::Unspecified => 0,
181            Self::None => 1,
182            Self::Go => 2,
183            Self::Search => 3,
184            Self::Send => 4,
185            Self::Next => 5,
186            Self::Done => 6,
187            Self::Previous => 7,
188            Self::Newline => 8,
189            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
190        }
191    }
192
193    #[inline]
194    pub fn is_unknown(&self) -> bool {
195        match self {
196            Self::__SourceBreaking { unknown_ordinal: _ } => true,
197            _ => false,
198        }
199    }
200}
201
202#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
203pub enum KeyboardEventPhase {
204    /// When key is pressed down.
205    Pressed,
206    /// When key is released.
207    Released,
208    /// This key `PRESSED` is not directed to this input client anymore.
209    Cancelled,
210    /// Whether this is an automatically generated key repeat
211    Repeat,
212    #[doc(hidden)]
213    __SourceBreaking { unknown_ordinal: u32 },
214}
215
216/// Pattern that matches an unknown `KeyboardEventPhase` member.
217#[macro_export]
218macro_rules! KeyboardEventPhaseUnknown {
219    () => {
220        _
221    };
222}
223
224impl KeyboardEventPhase {
225    #[inline]
226    pub fn from_primitive(prim: u32) -> Option<Self> {
227        match prim {
228            0 => Some(Self::Pressed),
229            1 => Some(Self::Released),
230            2 => Some(Self::Cancelled),
231            3 => Some(Self::Repeat),
232            _ => None,
233        }
234    }
235
236    #[inline]
237    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
238        match prim {
239            0 => Self::Pressed,
240            1 => Self::Released,
241            2 => Self::Cancelled,
242            3 => Self::Repeat,
243            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
244        }
245    }
246
247    #[inline]
248    pub fn unknown() -> Self {
249        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
250    }
251
252    #[inline]
253    pub const fn into_primitive(self) -> u32 {
254        match self {
255            Self::Pressed => 0,
256            Self::Released => 1,
257            Self::Cancelled => 2,
258            Self::Repeat => 3,
259            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
260        }
261    }
262
263    #[inline]
264    pub fn is_unknown(&self) -> bool {
265        match self {
266            Self::__SourceBreaking { unknown_ordinal: _ } => true,
267            _ => false,
268        }
269    }
270}
271
272/// Requests a specific keyboard type from the text editing subsystem.
273///
274/// This is most relevant for virtual keyboards which have some leeway in how
275/// the keyboard is presented to the user, as well as which input is acceptable.
276///
277/// For example, a `NUMBER` keyboard type may only allow decimal numbers to be
278/// entered.  In addition, a virtual keyboard might only show a numeric keypad
279/// for text entry.
280#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
281pub enum KeyboardType {
282    /// Single-line text fields only.  Use MULTILINE below for multiline text.
283    Text,
284    /// A text field intended for entering numbers only.
285    Number,
286    /// A text field for entering phone numbers only (e.g. digits, limited
287    /// punctuation, perhaps some validation).
288    Phone,
289    /// A text field for entering date and time. For example, may have a
290    /// calendar widget on the side, to aid in date time entry.
291    Datetime,
292    /// Multi-line text.
293    Multiline,
294    #[doc(hidden)]
295    __SourceBreaking { unknown_ordinal: u32 },
296}
297
298/// Pattern that matches an unknown `KeyboardType` member.
299#[macro_export]
300macro_rules! KeyboardTypeUnknown {
301    () => {
302        _
303    };
304}
305
306impl KeyboardType {
307    #[inline]
308    pub fn from_primitive(prim: u32) -> Option<Self> {
309        match prim {
310            0 => Some(Self::Text),
311            1 => Some(Self::Number),
312            2 => Some(Self::Phone),
313            3 => Some(Self::Datetime),
314            4 => Some(Self::Multiline),
315            _ => None,
316        }
317    }
318
319    #[inline]
320    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
321        match prim {
322            0 => Self::Text,
323            1 => Self::Number,
324            2 => Self::Phone,
325            3 => Self::Datetime,
326            4 => Self::Multiline,
327            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
328        }
329    }
330
331    #[inline]
332    pub fn unknown() -> Self {
333        Self::__SourceBreaking { unknown_ordinal: 0x0 }
334    }
335
336    #[inline]
337    pub const fn into_primitive(self) -> u32 {
338        match self {
339            Self::Text => 0,
340            Self::Number => 1,
341            Self::Phone => 2,
342            Self::Datetime => 3,
343            Self::Multiline => 4,
344            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
345        }
346    }
347
348    #[inline]
349    pub fn is_unknown(&self) -> bool {
350        match self {
351            Self::__SourceBreaking { unknown_ordinal: _ } => true,
352            _ => false,
353        }
354    }
355}
356
357#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
358#[repr(u32)]
359pub enum PointerEventPhase {
360    /// The device has started tracking the pointer.
361    ///
362    /// For example, the pointer might be hovering above the device, having not yet
363    /// made contact with the surface of the device.
364    Add = 0,
365    /// The pointer has moved with respect to the device while not in contact with
366    /// the device.
367    Hover = 1,
368    /// The pointer has made contact with the device.
369    ///
370    /// For `MOUSE` devices, this is triggered when the primary button is pressed
371    /// down to emulate a touch on the screen.
372    Down = 2,
373    /// The pointer has moved with respect to the device while in contact with the
374    /// device.
375    Move = 3,
376    /// The pointer has stopped making contact with the device.
377    ///
378    /// For `MOUSE` devices, this is triggered when the primary button is
379    /// released.
380    Up = 4,
381    /// The device is no longer tracking the pointer.
382    ///
383    /// For example, the pointer might have drifted out of the device's hover
384    /// detection range or might have been disconnected from the system entirely.
385    Remove = 5,
386    /// The input from the pointer is no longer directed towards this receiver.
387    Cancel = 6,
388}
389
390impl PointerEventPhase {
391    #[inline]
392    pub fn from_primitive(prim: u32) -> Option<Self> {
393        match prim {
394            0 => Some(Self::Add),
395            1 => Some(Self::Hover),
396            2 => Some(Self::Down),
397            3 => Some(Self::Move),
398            4 => Some(Self::Up),
399            5 => Some(Self::Remove),
400            6 => Some(Self::Cancel),
401            _ => None,
402        }
403    }
404
405    #[inline]
406    pub const fn into_primitive(self) -> u32 {
407        self as u32
408    }
409}
410
411#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
412#[repr(u32)]
413pub enum PointerEventType {
414    /// A touch-based pointer device.
415    Touch = 0,
416    /// A pointer device with a stylus.
417    Stylus = 1,
418    /// A pointer device with a stylus that has been inverted.
419    InvertedStylus = 2,
420    /// A pointer device without a stylus.
421    Mouse = 3,
422}
423
424impl PointerEventType {
425    #[inline]
426    pub fn from_primitive(prim: u32) -> Option<Self> {
427        match prim {
428            0 => Some(Self::Touch),
429            1 => Some(Self::Stylus),
430            2 => Some(Self::InvertedStylus),
431            3 => Some(Self::Mouse),
432            _ => None,
433        }
434    }
435
436    #[inline]
437    pub const fn into_primitive(self) -> u32 {
438        self as u32
439    }
440}
441
442#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
443pub enum SensorLocation {
444    Unknown,
445    Base,
446    Lid,
447    #[doc(hidden)]
448    __SourceBreaking {
449        unknown_ordinal: u32,
450    },
451}
452
453/// Pattern that matches an unknown `SensorLocation` member.
454#[macro_export]
455macro_rules! SensorLocationUnknown {
456    () => {
457        _
458    };
459}
460
461impl SensorLocation {
462    #[inline]
463    pub fn from_primitive(prim: u32) -> Option<Self> {
464        match prim {
465            0 => Some(Self::Unknown),
466            1 => Some(Self::Base),
467            2 => Some(Self::Lid),
468            _ => None,
469        }
470    }
471
472    #[inline]
473    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
474        match prim {
475            0 => Self::Unknown,
476            1 => Self::Base,
477            2 => Self::Lid,
478            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
479        }
480    }
481
482    #[inline]
483    pub fn unknown() -> Self {
484        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
485    }
486
487    #[inline]
488    pub const fn into_primitive(self) -> u32 {
489        match self {
490            Self::Unknown => 0,
491            Self::Base => 1,
492            Self::Lid => 2,
493            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
494        }
495    }
496
497    #[inline]
498    pub fn is_unknown(&self) -> bool {
499        match self {
500            Self::__SourceBreaking { unknown_ordinal: _ } => true,
501            _ => false,
502        }
503    }
504}
505
506#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
507pub enum SensorType {
508    Accelerometer,
509    Gyroscope,
510    Magnetometer,
511    Lightmeter,
512    #[doc(hidden)]
513    __SourceBreaking {
514        unknown_ordinal: u32,
515    },
516}
517
518/// Pattern that matches an unknown `SensorType` member.
519#[macro_export]
520macro_rules! SensorTypeUnknown {
521    () => {
522        _
523    };
524}
525
526impl SensorType {
527    #[inline]
528    pub fn from_primitive(prim: u32) -> Option<Self> {
529        match prim {
530            0 => Some(Self::Accelerometer),
531            1 => Some(Self::Gyroscope),
532            2 => Some(Self::Magnetometer),
533            3 => Some(Self::Lightmeter),
534            _ => None,
535        }
536    }
537
538    #[inline]
539    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
540        match prim {
541            0 => Self::Accelerometer,
542            1 => Self::Gyroscope,
543            2 => Self::Magnetometer,
544            3 => Self::Lightmeter,
545            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
546        }
547    }
548
549    #[inline]
550    pub fn unknown() -> Self {
551        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
552    }
553
554    #[inline]
555    pub const fn into_primitive(self) -> u32 {
556        match self {
557            Self::Accelerometer => 0,
558            Self::Gyroscope => 1,
559            Self::Magnetometer => 2,
560            Self::Lightmeter => 3,
561            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
562        }
563    }
564
565    #[inline]
566    pub fn is_unknown(&self) -> bool {
567        match self {
568            Self::__SourceBreaking { unknown_ordinal: _ } => true,
569            _ => false,
570        }
571    }
572}
573
574/// Whether a TextPosition is visually upstream or downstream of its offset.
575///
576/// For example, when a text position exists at a line break, a single offset has
577/// two visual positions, one prior to the line break (at the end of the first
578/// line) and one after the line break (at the start of the second line). A text
579/// affinity disambiguates between those cases. (Something similar happens with
580/// between runs of bidirectional text.)
581///
582/// We do not expect new values to be added to this enum.
583#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
584#[repr(u32)]
585pub enum TextAffinity {
586    /// The position has affinity for the upstream side of the text position.
587    ///
588    /// For example, if the offset of the text position is a line break, the
589    /// position represents the end of the first line.
590    Upstream = 0,
591    /// The position has affinity for the downstream side of the text position.
592    ///
593    /// For example, if the offset of the text position is a line break, the
594    /// position represents the start of the second line.
595    Downstream = 1,
596}
597
598impl TextAffinity {
599    #[inline]
600    pub fn from_primitive(prim: u32) -> Option<Self> {
601        match prim {
602            0 => Some(Self::Upstream),
603            1 => Some(Self::Downstream),
604            _ => None,
605        }
606    }
607
608    #[inline]
609    pub const fn into_primitive(self) -> u32 {
610        self as u32
611    }
612}
613
614#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
615pub enum TouchButton {
616    Palm,
617    #[doc(hidden)]
618    __SourceBreaking {
619        unknown_ordinal: u32,
620    },
621}
622
623/// Pattern that matches an unknown `TouchButton` member.
624#[macro_export]
625macro_rules! TouchButtonUnknown {
626    () => {
627        _
628    };
629}
630
631impl TouchButton {
632    #[inline]
633    pub fn from_primitive(prim: u32) -> Option<Self> {
634        match prim {
635            1 => Some(Self::Palm),
636            _ => None,
637        }
638    }
639
640    #[inline]
641    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
642        match prim {
643            1 => Self::Palm,
644            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
645        }
646    }
647
648    #[inline]
649    pub fn unknown() -> Self {
650        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
651    }
652
653    #[inline]
654    pub const fn into_primitive(self) -> u32 {
655        match self {
656            Self::Palm => 1,
657            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
658        }
659    }
660
661    #[inline]
662    pub fn is_unknown(&self) -> bool {
663        match self {
664            Self::__SourceBreaking { unknown_ordinal: _ } => true,
665            _ => false,
666        }
667    }
668}
669
670#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
671pub struct Axis {
672    pub range: Range,
673    pub resolution: i32,
674    pub scale: AxisScale,
675}
676
677impl fidl::Persistable for Axis {}
678
679#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
680pub struct AxisF {
681    pub range: RangeF,
682    pub resolution: f32,
683    pub scale: AxisScale,
684}
685
686impl fidl::Persistable for AxisF {}
687
688#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
689pub struct DeviceDescriptor {
690    pub device_info: Option<Box<DeviceInfo>>,
691    pub keyboard: Option<Box<KeyboardDescriptor>>,
692    pub media_buttons: Option<Box<MediaButtonsDescriptor>>,
693    pub mouse: Option<Box<MouseDescriptor>>,
694    pub stylus: Option<Box<StylusDescriptor>>,
695    pub touchscreen: Option<Box<TouchscreenDescriptor>>,
696    pub sensor: Option<Box<SensorDescriptor>>,
697}
698
699impl fidl::Persistable for DeviceDescriptor {}
700
701#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
702pub struct DeviceInfo {
703    pub vendor_id: u32,
704    pub product_id: u32,
705    pub version: u32,
706    pub name: String,
707}
708
709impl fidl::Persistable for DeviceInfo {}
710
711#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
712pub struct FocusEvent {
713    /// Time the event was delivered. The time is in nanoseconds and corresponds
714    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
715    pub event_time: u64,
716    /// Whether the view has gained input focused or not.
717    pub focused: bool,
718}
719
720impl fidl::Persistable for FocusEvent {}
721
722#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
723pub struct InputDeviceDispatchReportRequest {
724    pub report: InputReport,
725}
726
727impl fidl::Persistable for InputDeviceDispatchReportRequest {}
728
729#[derive(Clone, Debug, PartialEq, PartialOrd)]
730pub struct InputMethodEditorClientDidUpdateStateRequest {
731    pub state: TextInputState,
732    pub event: Option<Box<InputEvent>>,
733}
734
735impl fidl::Persistable for InputMethodEditorClientDidUpdateStateRequest {}
736
737#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
738pub struct InputMethodEditorClientOnActionRequest {
739    pub action: InputMethodAction,
740}
741
742impl fidl::Persistable for InputMethodEditorClientOnActionRequest {}
743
744#[derive(Clone, Debug, PartialEq)]
745pub struct InputMethodEditorDispatchKey3Request {
746    pub event: fidl_fuchsia_ui_input3__common::KeyEvent,
747}
748
749impl fidl::Persistable for InputMethodEditorDispatchKey3Request {}
750
751#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
752pub struct InputMethodEditorDispatchKey3Response {
753    pub handled: bool,
754}
755
756impl fidl::Persistable for InputMethodEditorDispatchKey3Response {}
757
758#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
759pub struct InputMethodEditorInjectInputRequest {
760    pub event: InputEvent,
761}
762
763impl fidl::Persistable for InputMethodEditorInjectInputRequest {}
764
765#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
766pub struct InputMethodEditorSetKeyboardTypeRequest {
767    pub keyboard_type: KeyboardType,
768}
769
770impl fidl::Persistable for InputMethodEditorSetKeyboardTypeRequest {}
771
772#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
773pub struct InputMethodEditorSetStateRequest {
774    pub state: TextInputState,
775}
776
777impl fidl::Persistable for InputMethodEditorSetStateRequest {}
778
779#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
780pub struct InputReport {
781    pub event_time: u64,
782    pub keyboard: Option<Box<KeyboardReport>>,
783    pub media_buttons: Option<Box<MediaButtonsReport>>,
784    pub mouse: Option<Box<MouseReport>>,
785    pub stylus: Option<Box<StylusReport>>,
786    pub touchscreen: Option<Box<TouchscreenReport>>,
787    pub sensor: Option<Box<SensorReport>>,
788    pub trace_id: u64,
789}
790
791impl fidl::Persistable for InputReport {}
792
793#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
794pub struct KeyboardDescriptor {
795    pub keys: Vec<u32>,
796}
797
798impl fidl::Persistable for KeyboardDescriptor {}
799
800/// `KeyboardEvent` represents event generated by a user's interaction with a
801/// keyboard.
802///
803/// Those events are triggered by distinct pressed state changes of the keys.
804///
805/// The state transitions should be as follows:
806/// PRESSED -> (REPEAT ->) RELEASED
807/// or
808/// PRESSED -> (REPEAT ->) CANCELLED
809///
810/// The input system will repeat those events automatically when a code_point is
811/// available.
812///
813/// DEPRECATED: Will be removed in favor of `fuchsia.ui.input.KeyEvent`.
814#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
815pub struct KeyboardEvent {
816    /// Time the event was delivered. The time is in nanoseconds and corresponds
817    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
818    pub event_time: u64,
819    pub device_id: u32,
820    pub phase: KeyboardEventPhase,
821    /// Keyboard HID Usage
822    /// See https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
823    pub hid_usage: u32,
824    /// The unicode code point represented by this key event, if any.
825    /// Dead keys are represented as Unicode combining characters.
826    ///
827    /// If there is no unicode code point, this value is zero.
828    pub code_point: u32,
829    /// Key modifiers as defined by the different kModifier constants such as
830    /// `kModifierCapsLock` currently pressed
831    pub modifiers: u32,
832}
833
834impl fidl::Persistable for KeyboardEvent {}
835
836#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
837pub struct KeyboardReport {
838    pub pressed_keys: Vec<u32>,
839}
840
841impl fidl::Persistable for KeyboardReport {}
842
843#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
844#[repr(C)]
845pub struct MediaButtonsDescriptor {
846    pub buttons: u32,
847}
848
849impl fidl::Persistable for MediaButtonsDescriptor {}
850
851/// `MediaButtonsReport` describes the media buttons event delivered from the event stream.
852/// Each bool in the report represents a single button where true means the button
853/// is being pressed. A single report should be sent on every state change.
854#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
855pub struct MediaButtonsReport {
856    pub volume_up: bool,
857    pub volume_down: bool,
858    pub mic_mute: bool,
859    pub reset: bool,
860    pub pause: bool,
861    pub camera_disable: bool,
862}
863
864impl fidl::Persistable for MediaButtonsReport {}
865
866#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
867pub struct MouseDescriptor {
868    pub rel_x: Axis,
869    pub rel_y: Axis,
870    pub vscroll: Option<Box<Axis>>,
871    pub hscroll: Option<Box<Axis>>,
872    pub buttons: u32,
873}
874
875impl fidl::Persistable for MouseDescriptor {}
876
877#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
878#[repr(C)]
879pub struct MouseReport {
880    pub rel_x: i32,
881    pub rel_y: i32,
882    pub rel_hscroll: i32,
883    pub rel_vscroll: i32,
884    pub pressed_buttons: u32,
885}
886
887impl fidl::Persistable for MouseReport {}
888
889/// Pointers represent raw data about the user's interaction with the screen.
890///
891/// The state transitions should be as follows:
892/// ADD (-> HOVER) -> DOWN -> MOVE -> UP (-> HOVER) -> REMOVE
893///
894/// At any point after the initial ADD, a transition to CANCEL is also possible.
895#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
896pub struct PointerEvent {
897    /// Time the event was delivered. The time is in nanoseconds and corresponds
898    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
899    pub event_time: u64,
900    pub device_id: u32,
901    pub pointer_id: u32,
902    pub type_: PointerEventType,
903    pub phase: PointerEventPhase,
904    /// `x` and `y` are in the coordinate system of the View.
905    pub x: f32,
906    pub y: f32,
907    pub radius_major: f32,
908    pub radius_minor: f32,
909    /// Currently pressed buttons as defined the kButton constants such as
910    /// `kMousePrimaryButton`
911    pub buttons: u32,
912}
913
914impl fidl::Persistable for PointerEvent {}
915
916#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
917#[repr(C)]
918pub struct Range {
919    pub min: i32,
920    pub max: i32,
921}
922
923impl fidl::Persistable for Range {}
924
925#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
926pub struct RangeF {
927    pub min: f32,
928    pub max: f32,
929}
930
931impl fidl::Persistable for RangeF {}
932
933#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
934pub struct SendKeyboardInputCmd {
935    pub compositor_id: u32,
936    pub keyboard_event: KeyboardEvent,
937}
938
939impl fidl::Persistable for SendKeyboardInputCmd {}
940
941#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
942pub struct SendPointerInputCmd {
943    pub compositor_id: u32,
944    pub pointer_event: PointerEvent,
945}
946
947impl fidl::Persistable for SendPointerInputCmd {}
948
949#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
950pub struct SensorDescriptor {
951    pub type_: SensorType,
952    pub loc: SensorLocation,
953    pub min_sampling_freq: u32,
954    pub max_sampling_freq: u32,
955    pub fifo_max_event_count: u32,
956    pub phys_min: i32,
957    pub phys_max: i32,
958}
959
960impl fidl::Persistable for SensorDescriptor {}
961
962#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
963pub struct SetHardKeyboardDeliveryCmd {
964    pub delivery_request: bool,
965}
966
967impl fidl::Persistable for SetHardKeyboardDeliveryCmd {}
968
969#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
970pub struct SetParallelDispatchCmd {
971    pub parallel_dispatch: bool,
972}
973
974impl fidl::Persistable for SetParallelDispatchCmd {}
975
976#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
977pub struct StylusDescriptor {
978    pub x: Axis,
979    pub y: Axis,
980    pub pressure: Option<Box<Axis>>,
981    pub is_invertible: bool,
982    pub buttons: u32,
983}
984
985impl fidl::Persistable for StylusDescriptor {}
986
987#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
988pub struct StylusReport {
989    pub x: i32,
990    pub y: i32,
991    pub pressure: u32,
992    pub is_in_contact: bool,
993    pub in_range: bool,
994    pub is_inverted: bool,
995    pub pressed_buttons: u32,
996}
997
998impl fidl::Persistable for StylusReport {}
999
1000/// The current text, selection, and composing state for editing a run of text.
1001#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1002pub struct TextInputState {
1003    /// Current state revision to avoid race conditions.
1004    pub revision: u32,
1005    /// The current text being edited.
1006    pub text: String,
1007    /// The range of text that is currently selected.
1008    pub selection: TextSelection,
1009    /// The range of text that is still being composed.
1010    pub composing: TextRange,
1011}
1012
1013impl fidl::Persistable for TextInputState {}
1014
1015/// A range of characters in a string of text. Although strings in FIDL's wire
1016/// format are UTF-8 encoded, these indices are measured in UTF-16 code units
1017/// for legacy reasons. These text input APIs will eventually be replaced by
1018/// fuchsia.ui.text, which uses code points instead.
1019#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1020#[repr(C)]
1021pub struct TextRange {
1022    /// The index of the first UTF-16 code unit in the range.
1023    ///
1024    /// If `start` and `end` are both -1, the text range is empty.
1025    pub start: i64,
1026    /// The next index after the last UTF-16 code unit in this range.
1027    ///
1028    /// If `start` and `end` are both -1, the text range is empty.
1029    pub end: i64,
1030}
1031
1032impl fidl::Persistable for TextRange {}
1033
1034/// A range of text that represents a selection. Although strings in FIDL's wire
1035/// format are UTF-8 encoded, these indices are measured in UTF-16 code units
1036/// for legacy reasons. These text input APIs will eventually be replaced by
1037/// fuchsia.ui.text, which uses code points instead.
1038///
1039/// Text selection is always directional. Direction should be determined by
1040/// comparing base and extent.
1041#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1042pub struct TextSelection {
1043    /// The offset at which the selection originates, as measured in UTF-16 code units.
1044    ///
1045    /// Might be larger than, smaller than, or equal to extent.
1046    pub base: i64,
1047    /// The offset at which the selection terminates, as measured in UTF-16 code units.
1048    ///
1049    /// When the user uses the arrow keys to adjust the selection, this is the
1050    /// value that changes. Similarly, if the current theme paints a caret on one
1051    /// side of the selection, this is the location at which to paint the caret.
1052    ///
1053    /// Might be larger than, smaller than, or equal to base.
1054    pub extent: i64,
1055    /// If the text range is collapsed and has more than one visual location
1056    /// (e.g., occurs at a line break), which of the two locations to use when
1057    /// painting the caret.
1058    pub affinity: TextAffinity,
1059}
1060
1061impl fidl::Persistable for TextSelection {}
1062
1063#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1064#[repr(C)]
1065pub struct Touch {
1066    pub finger_id: u32,
1067    pub x: i32,
1068    pub y: i32,
1069    pub width: u32,
1070    pub height: u32,
1071}
1072
1073impl fidl::Persistable for Touch {}
1074
1075#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1076pub struct TouchscreenDescriptor {
1077    pub x: Axis,
1078    pub y: Axis,
1079    pub max_finger_id: u32,
1080}
1081
1082impl fidl::Persistable for TouchscreenDescriptor {}
1083
1084#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1085pub struct TouchscreenReport {
1086    pub touches: Vec<Touch>,
1087}
1088
1089impl fidl::Persistable for TouchscreenReport {}
1090
1091#[derive(Clone, Debug, Default, PartialEq)]
1092pub struct MediaButtonsEvent {
1093    pub volume: Option<i8>,
1094    pub mic_mute: Option<bool>,
1095    pub pause: Option<bool>,
1096    pub camera_disable: Option<bool>,
1097    pub power: Option<bool>,
1098    pub function: Option<bool>,
1099    pub device_id: Option<u32>,
1100    #[doc(hidden)]
1101    pub __source_breaking: fidl::marker::SourceBreaking,
1102}
1103
1104impl fidl::Persistable for MediaButtonsEvent {}
1105
1106#[derive(Clone, Debug, Default, PartialEq)]
1107pub struct TouchButtonsEvent {
1108    pub event_time: Option<fidl::MonotonicInstant>,
1109    pub device_info: Option<TouchDeviceInfo>,
1110    pub pressed_buttons: Option<Vec<TouchButton>>,
1111    #[doc(hidden)]
1112    pub __source_breaking: fidl::marker::SourceBreaking,
1113}
1114
1115impl fidl::Persistable for TouchButtonsEvent {}
1116
1117/// Information about a device that issues touch event streams.
1118#[derive(Clone, Debug, Default, PartialEq)]
1119pub struct TouchDeviceInfo {
1120    /// An identifier for the touch device that issues touch events.
1121    /// Required.
1122    pub id: Option<u32>,
1123    #[doc(hidden)]
1124    pub __source_breaking: fidl::marker::SourceBreaking,
1125}
1126
1127impl fidl::Persistable for TouchDeviceInfo {}
1128
1129#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1130pub enum Command {
1131    SendKeyboardInput(SendKeyboardInputCmd),
1132    SendPointerInput(SendPointerInputCmd),
1133    SetHardKeyboardDelivery(SetHardKeyboardDeliveryCmd),
1134    SetParallelDispatch(SetParallelDispatchCmd),
1135}
1136
1137impl Command {
1138    #[inline]
1139    pub fn ordinal(&self) -> u64 {
1140        match *self {
1141            Self::SendKeyboardInput(_) => 1,
1142            Self::SendPointerInput(_) => 2,
1143            Self::SetHardKeyboardDelivery(_) => 3,
1144            Self::SetParallelDispatch(_) => 4,
1145        }
1146    }
1147}
1148
1149impl fidl::Persistable for Command {}
1150
1151#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1152pub enum InputEvent {
1153    Pointer(PointerEvent),
1154    Keyboard(KeyboardEvent),
1155    Focus(FocusEvent),
1156}
1157
1158impl InputEvent {
1159    #[inline]
1160    pub fn ordinal(&self) -> u64 {
1161        match *self {
1162            Self::Pointer(_) => 1,
1163            Self::Keyboard(_) => 2,
1164            Self::Focus(_) => 3,
1165        }
1166    }
1167}
1168
1169impl fidl::Persistable for InputEvent {}
1170
1171#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1172pub enum SensorReport {
1173    Vector([i16; 3]),
1174    Scalar(u16),
1175}
1176
1177impl SensorReport {
1178    #[inline]
1179    pub fn ordinal(&self) -> u64 {
1180        match *self {
1181            Self::Vector(_) => 1,
1182            Self::Scalar(_) => 2,
1183        }
1184    }
1185}
1186
1187impl fidl::Persistable for SensorReport {}
1188
1189pub mod ime_service_ordinals {
1190    pub const GET_INPUT_METHOD_EDITOR: u64 = 0x148d2e42a1f461fc;
1191    pub const SHOW_KEYBOARD: u64 = 0x38ed2a1de28cfcf0;
1192    pub const HIDE_KEYBOARD: u64 = 0x7667f098198d09fd;
1193}
1194
1195pub mod input_device_ordinals {
1196    pub const DISPATCH_REPORT: u64 = 0x7ee375d01c8e149f;
1197}
1198
1199pub mod input_method_editor_ordinals {
1200    pub const SET_KEYBOARD_TYPE: u64 = 0x14fe60e927d7d487;
1201    pub const SET_STATE: u64 = 0x12b477b779818f45;
1202    pub const INJECT_INPUT: u64 = 0x34af74618a4f82b;
1203    pub const DISPATCH_KEY3: u64 = 0x2e13667c827209ac;
1204    pub const SHOW: u64 = 0x19ba00ba1beb002e;
1205    pub const HIDE: u64 = 0x283e0cd73f0d6d9e;
1206}
1207
1208pub mod input_method_editor_client_ordinals {
1209    pub const DID_UPDATE_STATE: u64 = 0x26681a6b204b679d;
1210    pub const ON_ACTION: u64 = 0x19c420f173275398;
1211}
1212
1213mod internal {
1214    use super::*;
1215    unsafe impl fidl::encoding::TypeMarker for AxisScale {
1216        type Owned = Self;
1217
1218        #[inline(always)]
1219        fn inline_align(_context: fidl::encoding::Context) -> usize {
1220            std::mem::align_of::<u32>()
1221        }
1222
1223        #[inline(always)]
1224        fn inline_size(_context: fidl::encoding::Context) -> usize {
1225            std::mem::size_of::<u32>()
1226        }
1227
1228        #[inline(always)]
1229        fn encode_is_copy() -> bool {
1230            false
1231        }
1232
1233        #[inline(always)]
1234        fn decode_is_copy() -> bool {
1235            false
1236        }
1237    }
1238
1239    impl fidl::encoding::ValueTypeMarker for AxisScale {
1240        type Borrowed<'a> = Self;
1241        #[inline(always)]
1242        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1243            *value
1244        }
1245    }
1246
1247    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AxisScale {
1248        #[inline]
1249        unsafe fn encode(
1250            self,
1251            encoder: &mut fidl::encoding::Encoder<'_, D>,
1252            offset: usize,
1253            _depth: fidl::encoding::Depth,
1254        ) -> fidl::Result<()> {
1255            encoder.debug_check_bounds::<Self>(offset);
1256            encoder.write_num(self.into_primitive(), offset);
1257            Ok(())
1258        }
1259    }
1260
1261    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisScale {
1262        #[inline(always)]
1263        fn new_empty() -> Self {
1264            Self::unknown()
1265        }
1266
1267        #[inline]
1268        unsafe fn decode(
1269            &mut self,
1270            decoder: &mut fidl::encoding::Decoder<'_, D>,
1271            offset: usize,
1272            _depth: fidl::encoding::Depth,
1273        ) -> fidl::Result<()> {
1274            decoder.debug_check_bounds::<Self>(offset);
1275            let prim = decoder.read_num::<u32>(offset);
1276
1277            *self = Self::from_primitive_allow_unknown(prim);
1278            Ok(())
1279        }
1280    }
1281    unsafe impl fidl::encoding::TypeMarker for InputMethodAction {
1282        type Owned = Self;
1283
1284        #[inline(always)]
1285        fn inline_align(_context: fidl::encoding::Context) -> usize {
1286            std::mem::align_of::<u32>()
1287        }
1288
1289        #[inline(always)]
1290        fn inline_size(_context: fidl::encoding::Context) -> usize {
1291            std::mem::size_of::<u32>()
1292        }
1293
1294        #[inline(always)]
1295        fn encode_is_copy() -> bool {
1296            false
1297        }
1298
1299        #[inline(always)]
1300        fn decode_is_copy() -> bool {
1301            false
1302        }
1303    }
1304
1305    impl fidl::encoding::ValueTypeMarker for InputMethodAction {
1306        type Borrowed<'a> = Self;
1307        #[inline(always)]
1308        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1309            *value
1310        }
1311    }
1312
1313    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1314        for InputMethodAction
1315    {
1316        #[inline]
1317        unsafe fn encode(
1318            self,
1319            encoder: &mut fidl::encoding::Encoder<'_, D>,
1320            offset: usize,
1321            _depth: fidl::encoding::Depth,
1322        ) -> fidl::Result<()> {
1323            encoder.debug_check_bounds::<Self>(offset);
1324            encoder.write_num(self.into_primitive(), offset);
1325            Ok(())
1326        }
1327    }
1328
1329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputMethodAction {
1330        #[inline(always)]
1331        fn new_empty() -> Self {
1332            Self::unknown()
1333        }
1334
1335        #[inline]
1336        unsafe fn decode(
1337            &mut self,
1338            decoder: &mut fidl::encoding::Decoder<'_, D>,
1339            offset: usize,
1340            _depth: fidl::encoding::Depth,
1341        ) -> fidl::Result<()> {
1342            decoder.debug_check_bounds::<Self>(offset);
1343            let prim = decoder.read_num::<u32>(offset);
1344
1345            *self = Self::from_primitive_allow_unknown(prim);
1346            Ok(())
1347        }
1348    }
1349    unsafe impl fidl::encoding::TypeMarker for KeyboardEventPhase {
1350        type Owned = Self;
1351
1352        #[inline(always)]
1353        fn inline_align(_context: fidl::encoding::Context) -> usize {
1354            std::mem::align_of::<u32>()
1355        }
1356
1357        #[inline(always)]
1358        fn inline_size(_context: fidl::encoding::Context) -> usize {
1359            std::mem::size_of::<u32>()
1360        }
1361
1362        #[inline(always)]
1363        fn encode_is_copy() -> bool {
1364            false
1365        }
1366
1367        #[inline(always)]
1368        fn decode_is_copy() -> bool {
1369            false
1370        }
1371    }
1372
1373    impl fidl::encoding::ValueTypeMarker for KeyboardEventPhase {
1374        type Borrowed<'a> = Self;
1375        #[inline(always)]
1376        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1377            *value
1378        }
1379    }
1380
1381    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1382        for KeyboardEventPhase
1383    {
1384        #[inline]
1385        unsafe fn encode(
1386            self,
1387            encoder: &mut fidl::encoding::Encoder<'_, D>,
1388            offset: usize,
1389            _depth: fidl::encoding::Depth,
1390        ) -> fidl::Result<()> {
1391            encoder.debug_check_bounds::<Self>(offset);
1392            encoder.write_num(self.into_primitive(), offset);
1393            Ok(())
1394        }
1395    }
1396
1397    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEventPhase {
1398        #[inline(always)]
1399        fn new_empty() -> Self {
1400            Self::unknown()
1401        }
1402
1403        #[inline]
1404        unsafe fn decode(
1405            &mut self,
1406            decoder: &mut fidl::encoding::Decoder<'_, D>,
1407            offset: usize,
1408            _depth: fidl::encoding::Depth,
1409        ) -> fidl::Result<()> {
1410            decoder.debug_check_bounds::<Self>(offset);
1411            let prim = decoder.read_num::<u32>(offset);
1412
1413            *self = Self::from_primitive_allow_unknown(prim);
1414            Ok(())
1415        }
1416    }
1417    unsafe impl fidl::encoding::TypeMarker for KeyboardType {
1418        type Owned = Self;
1419
1420        #[inline(always)]
1421        fn inline_align(_context: fidl::encoding::Context) -> usize {
1422            std::mem::align_of::<u32>()
1423        }
1424
1425        #[inline(always)]
1426        fn inline_size(_context: fidl::encoding::Context) -> usize {
1427            std::mem::size_of::<u32>()
1428        }
1429
1430        #[inline(always)]
1431        fn encode_is_copy() -> bool {
1432            false
1433        }
1434
1435        #[inline(always)]
1436        fn decode_is_copy() -> bool {
1437            false
1438        }
1439    }
1440
1441    impl fidl::encoding::ValueTypeMarker for KeyboardType {
1442        type Borrowed<'a> = Self;
1443        #[inline(always)]
1444        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1445            *value
1446        }
1447    }
1448
1449    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyboardType {
1450        #[inline]
1451        unsafe fn encode(
1452            self,
1453            encoder: &mut fidl::encoding::Encoder<'_, D>,
1454            offset: usize,
1455            _depth: fidl::encoding::Depth,
1456        ) -> fidl::Result<()> {
1457            encoder.debug_check_bounds::<Self>(offset);
1458            encoder.write_num(self.into_primitive(), offset);
1459            Ok(())
1460        }
1461    }
1462
1463    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardType {
1464        #[inline(always)]
1465        fn new_empty() -> Self {
1466            Self::unknown()
1467        }
1468
1469        #[inline]
1470        unsafe fn decode(
1471            &mut self,
1472            decoder: &mut fidl::encoding::Decoder<'_, D>,
1473            offset: usize,
1474            _depth: fidl::encoding::Depth,
1475        ) -> fidl::Result<()> {
1476            decoder.debug_check_bounds::<Self>(offset);
1477            let prim = decoder.read_num::<u32>(offset);
1478
1479            *self = Self::from_primitive_allow_unknown(prim);
1480            Ok(())
1481        }
1482    }
1483    unsafe impl fidl::encoding::TypeMarker for PointerEventPhase {
1484        type Owned = Self;
1485
1486        #[inline(always)]
1487        fn inline_align(_context: fidl::encoding::Context) -> usize {
1488            std::mem::align_of::<u32>()
1489        }
1490
1491        #[inline(always)]
1492        fn inline_size(_context: fidl::encoding::Context) -> usize {
1493            std::mem::size_of::<u32>()
1494        }
1495
1496        #[inline(always)]
1497        fn encode_is_copy() -> bool {
1498            true
1499        }
1500
1501        #[inline(always)]
1502        fn decode_is_copy() -> bool {
1503            false
1504        }
1505    }
1506
1507    impl fidl::encoding::ValueTypeMarker for PointerEventPhase {
1508        type Borrowed<'a> = Self;
1509        #[inline(always)]
1510        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1511            *value
1512        }
1513    }
1514
1515    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1516        for PointerEventPhase
1517    {
1518        #[inline]
1519        unsafe fn encode(
1520            self,
1521            encoder: &mut fidl::encoding::Encoder<'_, D>,
1522            offset: usize,
1523            _depth: fidl::encoding::Depth,
1524        ) -> fidl::Result<()> {
1525            encoder.debug_check_bounds::<Self>(offset);
1526            encoder.write_num(self.into_primitive(), offset);
1527            Ok(())
1528        }
1529    }
1530
1531    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventPhase {
1532        #[inline(always)]
1533        fn new_empty() -> Self {
1534            Self::Add
1535        }
1536
1537        #[inline]
1538        unsafe fn decode(
1539            &mut self,
1540            decoder: &mut fidl::encoding::Decoder<'_, D>,
1541            offset: usize,
1542            _depth: fidl::encoding::Depth,
1543        ) -> fidl::Result<()> {
1544            decoder.debug_check_bounds::<Self>(offset);
1545            let prim = decoder.read_num::<u32>(offset);
1546
1547            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1548            Ok(())
1549        }
1550    }
1551    unsafe impl fidl::encoding::TypeMarker for PointerEventType {
1552        type Owned = Self;
1553
1554        #[inline(always)]
1555        fn inline_align(_context: fidl::encoding::Context) -> usize {
1556            std::mem::align_of::<u32>()
1557        }
1558
1559        #[inline(always)]
1560        fn inline_size(_context: fidl::encoding::Context) -> usize {
1561            std::mem::size_of::<u32>()
1562        }
1563
1564        #[inline(always)]
1565        fn encode_is_copy() -> bool {
1566            true
1567        }
1568
1569        #[inline(always)]
1570        fn decode_is_copy() -> bool {
1571            false
1572        }
1573    }
1574
1575    impl fidl::encoding::ValueTypeMarker for PointerEventType {
1576        type Borrowed<'a> = Self;
1577        #[inline(always)]
1578        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1579            *value
1580        }
1581    }
1582
1583    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1584        for PointerEventType
1585    {
1586        #[inline]
1587        unsafe fn encode(
1588            self,
1589            encoder: &mut fidl::encoding::Encoder<'_, D>,
1590            offset: usize,
1591            _depth: fidl::encoding::Depth,
1592        ) -> fidl::Result<()> {
1593            encoder.debug_check_bounds::<Self>(offset);
1594            encoder.write_num(self.into_primitive(), offset);
1595            Ok(())
1596        }
1597    }
1598
1599    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventType {
1600        #[inline(always)]
1601        fn new_empty() -> Self {
1602            Self::Touch
1603        }
1604
1605        #[inline]
1606        unsafe fn decode(
1607            &mut self,
1608            decoder: &mut fidl::encoding::Decoder<'_, D>,
1609            offset: usize,
1610            _depth: fidl::encoding::Depth,
1611        ) -> fidl::Result<()> {
1612            decoder.debug_check_bounds::<Self>(offset);
1613            let prim = decoder.read_num::<u32>(offset);
1614
1615            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1616            Ok(())
1617        }
1618    }
1619    unsafe impl fidl::encoding::TypeMarker for SensorLocation {
1620        type Owned = Self;
1621
1622        #[inline(always)]
1623        fn inline_align(_context: fidl::encoding::Context) -> usize {
1624            std::mem::align_of::<u32>()
1625        }
1626
1627        #[inline(always)]
1628        fn inline_size(_context: fidl::encoding::Context) -> usize {
1629            std::mem::size_of::<u32>()
1630        }
1631
1632        #[inline(always)]
1633        fn encode_is_copy() -> bool {
1634            false
1635        }
1636
1637        #[inline(always)]
1638        fn decode_is_copy() -> bool {
1639            false
1640        }
1641    }
1642
1643    impl fidl::encoding::ValueTypeMarker for SensorLocation {
1644        type Borrowed<'a> = Self;
1645        #[inline(always)]
1646        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1647            *value
1648        }
1649    }
1650
1651    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorLocation {
1652        #[inline]
1653        unsafe fn encode(
1654            self,
1655            encoder: &mut fidl::encoding::Encoder<'_, D>,
1656            offset: usize,
1657            _depth: fidl::encoding::Depth,
1658        ) -> fidl::Result<()> {
1659            encoder.debug_check_bounds::<Self>(offset);
1660            encoder.write_num(self.into_primitive(), offset);
1661            Ok(())
1662        }
1663    }
1664
1665    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorLocation {
1666        #[inline(always)]
1667        fn new_empty() -> Self {
1668            Self::unknown()
1669        }
1670
1671        #[inline]
1672        unsafe fn decode(
1673            &mut self,
1674            decoder: &mut fidl::encoding::Decoder<'_, D>,
1675            offset: usize,
1676            _depth: fidl::encoding::Depth,
1677        ) -> fidl::Result<()> {
1678            decoder.debug_check_bounds::<Self>(offset);
1679            let prim = decoder.read_num::<u32>(offset);
1680
1681            *self = Self::from_primitive_allow_unknown(prim);
1682            Ok(())
1683        }
1684    }
1685    unsafe impl fidl::encoding::TypeMarker for SensorType {
1686        type Owned = Self;
1687
1688        #[inline(always)]
1689        fn inline_align(_context: fidl::encoding::Context) -> usize {
1690            std::mem::align_of::<u32>()
1691        }
1692
1693        #[inline(always)]
1694        fn inline_size(_context: fidl::encoding::Context) -> usize {
1695            std::mem::size_of::<u32>()
1696        }
1697
1698        #[inline(always)]
1699        fn encode_is_copy() -> bool {
1700            false
1701        }
1702
1703        #[inline(always)]
1704        fn decode_is_copy() -> bool {
1705            false
1706        }
1707    }
1708
1709    impl fidl::encoding::ValueTypeMarker for SensorType {
1710        type Borrowed<'a> = Self;
1711        #[inline(always)]
1712        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1713            *value
1714        }
1715    }
1716
1717    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1718        #[inline]
1719        unsafe fn encode(
1720            self,
1721            encoder: &mut fidl::encoding::Encoder<'_, D>,
1722            offset: usize,
1723            _depth: fidl::encoding::Depth,
1724        ) -> fidl::Result<()> {
1725            encoder.debug_check_bounds::<Self>(offset);
1726            encoder.write_num(self.into_primitive(), offset);
1727            Ok(())
1728        }
1729    }
1730
1731    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1732        #[inline(always)]
1733        fn new_empty() -> Self {
1734            Self::unknown()
1735        }
1736
1737        #[inline]
1738        unsafe fn decode(
1739            &mut self,
1740            decoder: &mut fidl::encoding::Decoder<'_, D>,
1741            offset: usize,
1742            _depth: fidl::encoding::Depth,
1743        ) -> fidl::Result<()> {
1744            decoder.debug_check_bounds::<Self>(offset);
1745            let prim = decoder.read_num::<u32>(offset);
1746
1747            *self = Self::from_primitive_allow_unknown(prim);
1748            Ok(())
1749        }
1750    }
1751    unsafe impl fidl::encoding::TypeMarker for TextAffinity {
1752        type Owned = Self;
1753
1754        #[inline(always)]
1755        fn inline_align(_context: fidl::encoding::Context) -> usize {
1756            std::mem::align_of::<u32>()
1757        }
1758
1759        #[inline(always)]
1760        fn inline_size(_context: fidl::encoding::Context) -> usize {
1761            std::mem::size_of::<u32>()
1762        }
1763
1764        #[inline(always)]
1765        fn encode_is_copy() -> bool {
1766            true
1767        }
1768
1769        #[inline(always)]
1770        fn decode_is_copy() -> bool {
1771            false
1772        }
1773    }
1774
1775    impl fidl::encoding::ValueTypeMarker for TextAffinity {
1776        type Borrowed<'a> = Self;
1777        #[inline(always)]
1778        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1779            *value
1780        }
1781    }
1782
1783    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TextAffinity {
1784        #[inline]
1785        unsafe fn encode(
1786            self,
1787            encoder: &mut fidl::encoding::Encoder<'_, D>,
1788            offset: usize,
1789            _depth: fidl::encoding::Depth,
1790        ) -> fidl::Result<()> {
1791            encoder.debug_check_bounds::<Self>(offset);
1792            encoder.write_num(self.into_primitive(), offset);
1793            Ok(())
1794        }
1795    }
1796
1797    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextAffinity {
1798        #[inline(always)]
1799        fn new_empty() -> Self {
1800            Self::Upstream
1801        }
1802
1803        #[inline]
1804        unsafe fn decode(
1805            &mut self,
1806            decoder: &mut fidl::encoding::Decoder<'_, D>,
1807            offset: usize,
1808            _depth: fidl::encoding::Depth,
1809        ) -> fidl::Result<()> {
1810            decoder.debug_check_bounds::<Self>(offset);
1811            let prim = decoder.read_num::<u32>(offset);
1812
1813            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1814            Ok(())
1815        }
1816    }
1817    unsafe impl fidl::encoding::TypeMarker for TouchButton {
1818        type Owned = Self;
1819
1820        #[inline(always)]
1821        fn inline_align(_context: fidl::encoding::Context) -> usize {
1822            std::mem::align_of::<u32>()
1823        }
1824
1825        #[inline(always)]
1826        fn inline_size(_context: fidl::encoding::Context) -> usize {
1827            std::mem::size_of::<u32>()
1828        }
1829
1830        #[inline(always)]
1831        fn encode_is_copy() -> bool {
1832            false
1833        }
1834
1835        #[inline(always)]
1836        fn decode_is_copy() -> bool {
1837            false
1838        }
1839    }
1840
1841    impl fidl::encoding::ValueTypeMarker for TouchButton {
1842        type Borrowed<'a> = Self;
1843        #[inline(always)]
1844        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1845            *value
1846        }
1847    }
1848
1849    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchButton {
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 TouchButton {
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
1884    impl fidl::encoding::ValueTypeMarker for Axis {
1885        type Borrowed<'a> = &'a Self;
1886        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1887            value
1888        }
1889    }
1890
1891    unsafe impl fidl::encoding::TypeMarker for Axis {
1892        type Owned = Self;
1893
1894        #[inline(always)]
1895        fn inline_align(_context: fidl::encoding::Context) -> usize {
1896            4
1897        }
1898
1899        #[inline(always)]
1900        fn inline_size(_context: fidl::encoding::Context) -> usize {
1901            16
1902        }
1903    }
1904
1905    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
1906        #[inline]
1907        unsafe fn encode(
1908            self,
1909            encoder: &mut fidl::encoding::Encoder<'_, D>,
1910            offset: usize,
1911            _depth: fidl::encoding::Depth,
1912        ) -> fidl::Result<()> {
1913            encoder.debug_check_bounds::<Axis>(offset);
1914            // Delegate to tuple encoding.
1915            fidl::encoding::Encode::<Axis, D>::encode(
1916                (
1917                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
1918                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
1919                    <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
1920                ),
1921                encoder,
1922                offset,
1923                _depth,
1924            )
1925        }
1926    }
1927    unsafe impl<
1928        D: fidl::encoding::ResourceDialect,
1929        T0: fidl::encoding::Encode<Range, D>,
1930        T1: fidl::encoding::Encode<i32, D>,
1931        T2: fidl::encoding::Encode<AxisScale, D>,
1932    > fidl::encoding::Encode<Axis, D> for (T0, T1, T2)
1933    {
1934        #[inline]
1935        unsafe fn encode(
1936            self,
1937            encoder: &mut fidl::encoding::Encoder<'_, D>,
1938            offset: usize,
1939            depth: fidl::encoding::Depth,
1940        ) -> fidl::Result<()> {
1941            encoder.debug_check_bounds::<Axis>(offset);
1942            // Zero out padding regions. There's no need to apply masks
1943            // because the unmasked parts will be overwritten by fields.
1944            // Write the fields.
1945            self.0.encode(encoder, offset + 0, depth)?;
1946            self.1.encode(encoder, offset + 8, depth)?;
1947            self.2.encode(encoder, offset + 12, depth)?;
1948            Ok(())
1949        }
1950    }
1951
1952    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
1953        #[inline(always)]
1954        fn new_empty() -> Self {
1955            Self {
1956                range: fidl::new_empty!(Range, D),
1957                resolution: fidl::new_empty!(i32, D),
1958                scale: fidl::new_empty!(AxisScale, D),
1959            }
1960        }
1961
1962        #[inline]
1963        unsafe fn decode(
1964            &mut self,
1965            decoder: &mut fidl::encoding::Decoder<'_, D>,
1966            offset: usize,
1967            _depth: fidl::encoding::Depth,
1968        ) -> fidl::Result<()> {
1969            decoder.debug_check_bounds::<Self>(offset);
1970            // Verify that padding bytes are zero.
1971            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
1972            fidl::decode!(i32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
1973            fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
1974            Ok(())
1975        }
1976    }
1977
1978    impl fidl::encoding::ValueTypeMarker for AxisF {
1979        type Borrowed<'a> = &'a Self;
1980        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1981            value
1982        }
1983    }
1984
1985    unsafe impl fidl::encoding::TypeMarker for AxisF {
1986        type Owned = Self;
1987
1988        #[inline(always)]
1989        fn inline_align(_context: fidl::encoding::Context) -> usize {
1990            4
1991        }
1992
1993        #[inline(always)]
1994        fn inline_size(_context: fidl::encoding::Context) -> usize {
1995            16
1996        }
1997    }
1998
1999    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AxisF, D> for &AxisF {
2000        #[inline]
2001        unsafe fn encode(
2002            self,
2003            encoder: &mut fidl::encoding::Encoder<'_, D>,
2004            offset: usize,
2005            _depth: fidl::encoding::Depth,
2006        ) -> fidl::Result<()> {
2007            encoder.debug_check_bounds::<AxisF>(offset);
2008            // Delegate to tuple encoding.
2009            fidl::encoding::Encode::<AxisF, D>::encode(
2010                (
2011                    <RangeF as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2012                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
2013                    <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
2014                ),
2015                encoder,
2016                offset,
2017                _depth,
2018            )
2019        }
2020    }
2021    unsafe impl<
2022        D: fidl::encoding::ResourceDialect,
2023        T0: fidl::encoding::Encode<RangeF, D>,
2024        T1: fidl::encoding::Encode<f32, D>,
2025        T2: fidl::encoding::Encode<AxisScale, D>,
2026    > fidl::encoding::Encode<AxisF, D> for (T0, T1, T2)
2027    {
2028        #[inline]
2029        unsafe fn encode(
2030            self,
2031            encoder: &mut fidl::encoding::Encoder<'_, D>,
2032            offset: usize,
2033            depth: fidl::encoding::Depth,
2034        ) -> fidl::Result<()> {
2035            encoder.debug_check_bounds::<AxisF>(offset);
2036            // Zero out padding regions. There's no need to apply masks
2037            // because the unmasked parts will be overwritten by fields.
2038            // Write the fields.
2039            self.0.encode(encoder, offset + 0, depth)?;
2040            self.1.encode(encoder, offset + 8, depth)?;
2041            self.2.encode(encoder, offset + 12, depth)?;
2042            Ok(())
2043        }
2044    }
2045
2046    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisF {
2047        #[inline(always)]
2048        fn new_empty() -> Self {
2049            Self {
2050                range: fidl::new_empty!(RangeF, D),
2051                resolution: fidl::new_empty!(f32, D),
2052                scale: fidl::new_empty!(AxisScale, D),
2053            }
2054        }
2055
2056        #[inline]
2057        unsafe fn decode(
2058            &mut self,
2059            decoder: &mut fidl::encoding::Decoder<'_, D>,
2060            offset: usize,
2061            _depth: fidl::encoding::Depth,
2062        ) -> fidl::Result<()> {
2063            decoder.debug_check_bounds::<Self>(offset);
2064            // Verify that padding bytes are zero.
2065            fidl::decode!(RangeF, D, &mut self.range, decoder, offset + 0, _depth)?;
2066            fidl::decode!(f32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
2067            fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
2068            Ok(())
2069        }
2070    }
2071
2072    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
2073        type Borrowed<'a> = &'a Self;
2074        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2075            value
2076        }
2077    }
2078
2079    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
2080        type Owned = Self;
2081
2082        #[inline(always)]
2083        fn inline_align(_context: fidl::encoding::Context) -> usize {
2084            8
2085        }
2086
2087        #[inline(always)]
2088        fn inline_size(_context: fidl::encoding::Context) -> usize {
2089            56
2090        }
2091    }
2092
2093    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
2094        for &DeviceDescriptor
2095    {
2096        #[inline]
2097        unsafe fn encode(
2098            self,
2099            encoder: &mut fidl::encoding::Encoder<'_, D>,
2100            offset: usize,
2101            _depth: fidl::encoding::Depth,
2102        ) -> fidl::Result<()> {
2103            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
2104            // Delegate to tuple encoding.
2105            fidl::encoding::Encode::<DeviceDescriptor, D>::encode(
2106                (
2107                    <fidl::encoding::Boxed<DeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_info),
2108                    <fidl::encoding::Boxed<KeyboardDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
2109                    <fidl::encoding::Boxed<MediaButtonsDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
2110                    <fidl::encoding::Boxed<MouseDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
2111                    <fidl::encoding::Boxed<StylusDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
2112                    <fidl::encoding::Boxed<TouchscreenDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
2113                    <fidl::encoding::Boxed<SensorDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
2114                ),
2115                encoder, offset, _depth
2116            )
2117        }
2118    }
2119    unsafe impl<
2120        D: fidl::encoding::ResourceDialect,
2121        T0: fidl::encoding::Encode<fidl::encoding::Boxed<DeviceInfo>, D>,
2122        T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardDescriptor>, D>,
2123        T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsDescriptor>, D>,
2124        T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseDescriptor>, D>,
2125        T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusDescriptor>, D>,
2126        T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenDescriptor>, D>,
2127        T6: fidl::encoding::Encode<fidl::encoding::Boxed<SensorDescriptor>, D>,
2128    > fidl::encoding::Encode<DeviceDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
2129    {
2130        #[inline]
2131        unsafe fn encode(
2132            self,
2133            encoder: &mut fidl::encoding::Encoder<'_, D>,
2134            offset: usize,
2135            depth: fidl::encoding::Depth,
2136        ) -> fidl::Result<()> {
2137            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
2138            // Zero out padding regions. There's no need to apply masks
2139            // because the unmasked parts will be overwritten by fields.
2140            // Write the fields.
2141            self.0.encode(encoder, offset + 0, depth)?;
2142            self.1.encode(encoder, offset + 8, depth)?;
2143            self.2.encode(encoder, offset + 16, depth)?;
2144            self.3.encode(encoder, offset + 24, depth)?;
2145            self.4.encode(encoder, offset + 32, depth)?;
2146            self.5.encode(encoder, offset + 40, depth)?;
2147            self.6.encode(encoder, offset + 48, depth)?;
2148            Ok(())
2149        }
2150    }
2151
2152    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
2153        #[inline(always)]
2154        fn new_empty() -> Self {
2155            Self {
2156                device_info: fidl::new_empty!(fidl::encoding::Boxed<DeviceInfo>, D),
2157                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardDescriptor>, D),
2158                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsDescriptor>, D),
2159                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseDescriptor>, D),
2160                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusDescriptor>, D),
2161                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenDescriptor>, D),
2162                sensor: fidl::new_empty!(fidl::encoding::Boxed<SensorDescriptor>, D),
2163            }
2164        }
2165
2166        #[inline]
2167        unsafe fn decode(
2168            &mut self,
2169            decoder: &mut fidl::encoding::Decoder<'_, D>,
2170            offset: usize,
2171            _depth: fidl::encoding::Depth,
2172        ) -> fidl::Result<()> {
2173            decoder.debug_check_bounds::<Self>(offset);
2174            // Verify that padding bytes are zero.
2175            fidl::decode!(
2176                fidl::encoding::Boxed<DeviceInfo>,
2177                D,
2178                &mut self.device_info,
2179                decoder,
2180                offset + 0,
2181                _depth
2182            )?;
2183            fidl::decode!(
2184                fidl::encoding::Boxed<KeyboardDescriptor>,
2185                D,
2186                &mut self.keyboard,
2187                decoder,
2188                offset + 8,
2189                _depth
2190            )?;
2191            fidl::decode!(
2192                fidl::encoding::Boxed<MediaButtonsDescriptor>,
2193                D,
2194                &mut self.media_buttons,
2195                decoder,
2196                offset + 16,
2197                _depth
2198            )?;
2199            fidl::decode!(
2200                fidl::encoding::Boxed<MouseDescriptor>,
2201                D,
2202                &mut self.mouse,
2203                decoder,
2204                offset + 24,
2205                _depth
2206            )?;
2207            fidl::decode!(
2208                fidl::encoding::Boxed<StylusDescriptor>,
2209                D,
2210                &mut self.stylus,
2211                decoder,
2212                offset + 32,
2213                _depth
2214            )?;
2215            fidl::decode!(
2216                fidl::encoding::Boxed<TouchscreenDescriptor>,
2217                D,
2218                &mut self.touchscreen,
2219                decoder,
2220                offset + 40,
2221                _depth
2222            )?;
2223            fidl::decode!(
2224                fidl::encoding::Boxed<SensorDescriptor>,
2225                D,
2226                &mut self.sensor,
2227                decoder,
2228                offset + 48,
2229                _depth
2230            )?;
2231            Ok(())
2232        }
2233    }
2234
2235    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2236        type Borrowed<'a> = &'a Self;
2237        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2238            value
2239        }
2240    }
2241
2242    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2243        type Owned = Self;
2244
2245        #[inline(always)]
2246        fn inline_align(_context: fidl::encoding::Context) -> usize {
2247            8
2248        }
2249
2250        #[inline(always)]
2251        fn inline_size(_context: fidl::encoding::Context) -> usize {
2252            32
2253        }
2254    }
2255
2256    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2257        for &DeviceInfo
2258    {
2259        #[inline]
2260        unsafe fn encode(
2261            self,
2262            encoder: &mut fidl::encoding::Encoder<'_, D>,
2263            offset: usize,
2264            _depth: fidl::encoding::Depth,
2265        ) -> fidl::Result<()> {
2266            encoder.debug_check_bounds::<DeviceInfo>(offset);
2267            // Delegate to tuple encoding.
2268            fidl::encoding::Encode::<DeviceInfo, D>::encode(
2269                (
2270                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
2271                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.product_id),
2272                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
2273                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2274                        &self.name,
2275                    ),
2276                ),
2277                encoder,
2278                offset,
2279                _depth,
2280            )
2281        }
2282    }
2283    unsafe impl<
2284        D: fidl::encoding::ResourceDialect,
2285        T0: fidl::encoding::Encode<u32, D>,
2286        T1: fidl::encoding::Encode<u32, D>,
2287        T2: fidl::encoding::Encode<u32, D>,
2288        T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
2289    > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3)
2290    {
2291        #[inline]
2292        unsafe fn encode(
2293            self,
2294            encoder: &mut fidl::encoding::Encoder<'_, D>,
2295            offset: usize,
2296            depth: fidl::encoding::Depth,
2297        ) -> fidl::Result<()> {
2298            encoder.debug_check_bounds::<DeviceInfo>(offset);
2299            // Zero out padding regions. There's no need to apply masks
2300            // because the unmasked parts will be overwritten by fields.
2301            unsafe {
2302                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2303                (ptr as *mut u64).write_unaligned(0);
2304            }
2305            // Write the fields.
2306            self.0.encode(encoder, offset + 0, depth)?;
2307            self.1.encode(encoder, offset + 4, depth)?;
2308            self.2.encode(encoder, offset + 8, depth)?;
2309            self.3.encode(encoder, offset + 16, depth)?;
2310            Ok(())
2311        }
2312    }
2313
2314    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2315        #[inline(always)]
2316        fn new_empty() -> Self {
2317            Self {
2318                vendor_id: fidl::new_empty!(u32, D),
2319                product_id: fidl::new_empty!(u32, D),
2320                version: fidl::new_empty!(u32, D),
2321                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
2322            }
2323        }
2324
2325        #[inline]
2326        unsafe fn decode(
2327            &mut self,
2328            decoder: &mut fidl::encoding::Decoder<'_, D>,
2329            offset: usize,
2330            _depth: fidl::encoding::Depth,
2331        ) -> fidl::Result<()> {
2332            decoder.debug_check_bounds::<Self>(offset);
2333            // Verify that padding bytes are zero.
2334            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2335            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2336            let mask = 0xffffffff00000000u64;
2337            let maskedval = padval & mask;
2338            if maskedval != 0 {
2339                return Err(fidl::Error::NonZeroPadding {
2340                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2341                });
2342            }
2343            fidl::decode!(u32, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
2344            fidl::decode!(u32, D, &mut self.product_id, decoder, offset + 4, _depth)?;
2345            fidl::decode!(u32, D, &mut self.version, decoder, offset + 8, _depth)?;
2346            fidl::decode!(
2347                fidl::encoding::UnboundedString,
2348                D,
2349                &mut self.name,
2350                decoder,
2351                offset + 16,
2352                _depth
2353            )?;
2354            Ok(())
2355        }
2356    }
2357
2358    impl fidl::encoding::ValueTypeMarker for FocusEvent {
2359        type Borrowed<'a> = &'a Self;
2360        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2361            value
2362        }
2363    }
2364
2365    unsafe impl fidl::encoding::TypeMarker for FocusEvent {
2366        type Owned = Self;
2367
2368        #[inline(always)]
2369        fn inline_align(_context: fidl::encoding::Context) -> usize {
2370            8
2371        }
2372
2373        #[inline(always)]
2374        fn inline_size(_context: fidl::encoding::Context) -> usize {
2375            16
2376        }
2377    }
2378
2379    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FocusEvent, D>
2380        for &FocusEvent
2381    {
2382        #[inline]
2383        unsafe fn encode(
2384            self,
2385            encoder: &mut fidl::encoding::Encoder<'_, D>,
2386            offset: usize,
2387            _depth: fidl::encoding::Depth,
2388        ) -> fidl::Result<()> {
2389            encoder.debug_check_bounds::<FocusEvent>(offset);
2390            // Delegate to tuple encoding.
2391            fidl::encoding::Encode::<FocusEvent, D>::encode(
2392                (
2393                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
2394                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.focused),
2395                ),
2396                encoder,
2397                offset,
2398                _depth,
2399            )
2400        }
2401    }
2402    unsafe impl<
2403        D: fidl::encoding::ResourceDialect,
2404        T0: fidl::encoding::Encode<u64, D>,
2405        T1: fidl::encoding::Encode<bool, D>,
2406    > fidl::encoding::Encode<FocusEvent, D> for (T0, T1)
2407    {
2408        #[inline]
2409        unsafe fn encode(
2410            self,
2411            encoder: &mut fidl::encoding::Encoder<'_, D>,
2412            offset: usize,
2413            depth: fidl::encoding::Depth,
2414        ) -> fidl::Result<()> {
2415            encoder.debug_check_bounds::<FocusEvent>(offset);
2416            // Zero out padding regions. There's no need to apply masks
2417            // because the unmasked parts will be overwritten by fields.
2418            unsafe {
2419                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2420                (ptr as *mut u64).write_unaligned(0);
2421            }
2422            // Write the fields.
2423            self.0.encode(encoder, offset + 0, depth)?;
2424            self.1.encode(encoder, offset + 8, depth)?;
2425            Ok(())
2426        }
2427    }
2428
2429    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FocusEvent {
2430        #[inline(always)]
2431        fn new_empty() -> Self {
2432            Self { event_time: fidl::new_empty!(u64, D), focused: fidl::new_empty!(bool, D) }
2433        }
2434
2435        #[inline]
2436        unsafe fn decode(
2437            &mut self,
2438            decoder: &mut fidl::encoding::Decoder<'_, D>,
2439            offset: usize,
2440            _depth: fidl::encoding::Depth,
2441        ) -> fidl::Result<()> {
2442            decoder.debug_check_bounds::<Self>(offset);
2443            // Verify that padding bytes are zero.
2444            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2445            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2446            let mask = 0xffffffffffffff00u64;
2447            let maskedval = padval & mask;
2448            if maskedval != 0 {
2449                return Err(fidl::Error::NonZeroPadding {
2450                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2451                });
2452            }
2453            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
2454            fidl::decode!(bool, D, &mut self.focused, decoder, offset + 8, _depth)?;
2455            Ok(())
2456        }
2457    }
2458
2459    impl fidl::encoding::ValueTypeMarker for InputDeviceDispatchReportRequest {
2460        type Borrowed<'a> = &'a Self;
2461        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2462            value
2463        }
2464    }
2465
2466    unsafe impl fidl::encoding::TypeMarker for InputDeviceDispatchReportRequest {
2467        type Owned = Self;
2468
2469        #[inline(always)]
2470        fn inline_align(_context: fidl::encoding::Context) -> usize {
2471            8
2472        }
2473
2474        #[inline(always)]
2475        fn inline_size(_context: fidl::encoding::Context) -> usize {
2476            72
2477        }
2478    }
2479
2480    unsafe impl<D: fidl::encoding::ResourceDialect>
2481        fidl::encoding::Encode<InputDeviceDispatchReportRequest, D>
2482        for &InputDeviceDispatchReportRequest
2483    {
2484        #[inline]
2485        unsafe fn encode(
2486            self,
2487            encoder: &mut fidl::encoding::Encoder<'_, D>,
2488            offset: usize,
2489            _depth: fidl::encoding::Depth,
2490        ) -> fidl::Result<()> {
2491            encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
2492            // Delegate to tuple encoding.
2493            fidl::encoding::Encode::<InputDeviceDispatchReportRequest, D>::encode(
2494                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2495                encoder,
2496                offset,
2497                _depth,
2498            )
2499        }
2500    }
2501    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2502        fidl::encoding::Encode<InputDeviceDispatchReportRequest, D> for (T0,)
2503    {
2504        #[inline]
2505        unsafe fn encode(
2506            self,
2507            encoder: &mut fidl::encoding::Encoder<'_, D>,
2508            offset: usize,
2509            depth: fidl::encoding::Depth,
2510        ) -> fidl::Result<()> {
2511            encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
2512            // Zero out padding regions. There's no need to apply masks
2513            // because the unmasked parts will be overwritten by fields.
2514            // Write the fields.
2515            self.0.encode(encoder, offset + 0, depth)?;
2516            Ok(())
2517        }
2518    }
2519
2520    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2521        for InputDeviceDispatchReportRequest
2522    {
2523        #[inline(always)]
2524        fn new_empty() -> Self {
2525            Self { report: fidl::new_empty!(InputReport, D) }
2526        }
2527
2528        #[inline]
2529        unsafe fn decode(
2530            &mut self,
2531            decoder: &mut fidl::encoding::Decoder<'_, D>,
2532            offset: usize,
2533            _depth: fidl::encoding::Depth,
2534        ) -> fidl::Result<()> {
2535            decoder.debug_check_bounds::<Self>(offset);
2536            // Verify that padding bytes are zero.
2537            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2538            Ok(())
2539        }
2540    }
2541
2542    impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientDidUpdateStateRequest {
2543        type Borrowed<'a> = &'a Self;
2544        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2545            value
2546        }
2547    }
2548
2549    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientDidUpdateStateRequest {
2550        type Owned = Self;
2551
2552        #[inline(always)]
2553        fn inline_align(_context: fidl::encoding::Context) -> usize {
2554            8
2555        }
2556
2557        #[inline(always)]
2558        fn inline_size(_context: fidl::encoding::Context) -> usize {
2559            80
2560        }
2561    }
2562
2563    unsafe impl<D: fidl::encoding::ResourceDialect>
2564        fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D>
2565        for &InputMethodEditorClientDidUpdateStateRequest
2566    {
2567        #[inline]
2568        unsafe fn encode(
2569            self,
2570            encoder: &mut fidl::encoding::Encoder<'_, D>,
2571            offset: usize,
2572            _depth: fidl::encoding::Depth,
2573        ) -> fidl::Result<()> {
2574            encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
2575            // Delegate to tuple encoding.
2576            fidl::encoding::Encode::<InputMethodEditorClientDidUpdateStateRequest, D>::encode(
2577                (
2578                    <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
2579                    <fidl::encoding::OptionalUnion<InputEvent> as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2580                ),
2581                encoder, offset, _depth
2582            )
2583        }
2584    }
2585    unsafe impl<
2586        D: fidl::encoding::ResourceDialect,
2587        T0: fidl::encoding::Encode<TextInputState, D>,
2588        T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<InputEvent>, D>,
2589    > fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D> for (T0, T1)
2590    {
2591        #[inline]
2592        unsafe fn encode(
2593            self,
2594            encoder: &mut fidl::encoding::Encoder<'_, D>,
2595            offset: usize,
2596            depth: fidl::encoding::Depth,
2597        ) -> fidl::Result<()> {
2598            encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
2599            // Zero out padding regions. There's no need to apply masks
2600            // because the unmasked parts will be overwritten by fields.
2601            // Write the fields.
2602            self.0.encode(encoder, offset + 0, depth)?;
2603            self.1.encode(encoder, offset + 64, depth)?;
2604            Ok(())
2605        }
2606    }
2607
2608    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2609        for InputMethodEditorClientDidUpdateStateRequest
2610    {
2611        #[inline(always)]
2612        fn new_empty() -> Self {
2613            Self {
2614                state: fidl::new_empty!(TextInputState, D),
2615                event: fidl::new_empty!(fidl::encoding::OptionalUnion<InputEvent>, D),
2616            }
2617        }
2618
2619        #[inline]
2620        unsafe fn decode(
2621            &mut self,
2622            decoder: &mut fidl::encoding::Decoder<'_, D>,
2623            offset: usize,
2624            _depth: fidl::encoding::Depth,
2625        ) -> fidl::Result<()> {
2626            decoder.debug_check_bounds::<Self>(offset);
2627            // Verify that padding bytes are zero.
2628            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
2629            fidl::decode!(
2630                fidl::encoding::OptionalUnion<InputEvent>,
2631                D,
2632                &mut self.event,
2633                decoder,
2634                offset + 64,
2635                _depth
2636            )?;
2637            Ok(())
2638        }
2639    }
2640
2641    impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientOnActionRequest {
2642        type Borrowed<'a> = &'a Self;
2643        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2644            value
2645        }
2646    }
2647
2648    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientOnActionRequest {
2649        type Owned = Self;
2650
2651        #[inline(always)]
2652        fn inline_align(_context: fidl::encoding::Context) -> usize {
2653            4
2654        }
2655
2656        #[inline(always)]
2657        fn inline_size(_context: fidl::encoding::Context) -> usize {
2658            4
2659        }
2660    }
2661
2662    unsafe impl<D: fidl::encoding::ResourceDialect>
2663        fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D>
2664        for &InputMethodEditorClientOnActionRequest
2665    {
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::<InputMethodEditorClientOnActionRequest>(offset);
2674            // Delegate to tuple encoding.
2675            fidl::encoding::Encode::<InputMethodEditorClientOnActionRequest, D>::encode(
2676                (<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
2677                encoder,
2678                offset,
2679                _depth,
2680            )
2681        }
2682    }
2683    unsafe impl<
2684        D: fidl::encoding::ResourceDialect,
2685        T0: fidl::encoding::Encode<InputMethodAction, D>,
2686    > fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D> for (T0,)
2687    {
2688        #[inline]
2689        unsafe fn encode(
2690            self,
2691            encoder: &mut fidl::encoding::Encoder<'_, D>,
2692            offset: usize,
2693            depth: fidl::encoding::Depth,
2694        ) -> fidl::Result<()> {
2695            encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
2696            // Zero out padding regions. There's no need to apply masks
2697            // because the unmasked parts will be overwritten by fields.
2698            // Write the fields.
2699            self.0.encode(encoder, offset + 0, depth)?;
2700            Ok(())
2701        }
2702    }
2703
2704    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2705        for InputMethodEditorClientOnActionRequest
2706    {
2707        #[inline(always)]
2708        fn new_empty() -> Self {
2709            Self { action: fidl::new_empty!(InputMethodAction, D) }
2710        }
2711
2712        #[inline]
2713        unsafe fn decode(
2714            &mut self,
2715            decoder: &mut fidl::encoding::Decoder<'_, D>,
2716            offset: usize,
2717            _depth: fidl::encoding::Depth,
2718        ) -> fidl::Result<()> {
2719            decoder.debug_check_bounds::<Self>(offset);
2720            // Verify that padding bytes are zero.
2721            fidl::decode!(InputMethodAction, D, &mut self.action, decoder, offset + 0, _depth)?;
2722            Ok(())
2723        }
2724    }
2725
2726    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
2727        type Borrowed<'a> = &'a Self;
2728        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2729            value
2730        }
2731    }
2732
2733    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Request {
2734        type Owned = Self;
2735
2736        #[inline(always)]
2737        fn inline_align(_context: fidl::encoding::Context) -> usize {
2738            8
2739        }
2740
2741        #[inline(always)]
2742        fn inline_size(_context: fidl::encoding::Context) -> usize {
2743            16
2744        }
2745    }
2746
2747    unsafe impl<D: fidl::encoding::ResourceDialect>
2748        fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D>
2749        for &InputMethodEditorDispatchKey3Request
2750    {
2751        #[inline]
2752        unsafe fn encode(
2753            self,
2754            encoder: &mut fidl::encoding::Encoder<'_, D>,
2755            offset: usize,
2756            _depth: fidl::encoding::Depth,
2757        ) -> fidl::Result<()> {
2758            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2759            // Delegate to tuple encoding.
2760            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request, D>::encode(
2761                (
2762                    <fidl_fuchsia_ui_input3__common::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2763                ),
2764                encoder, offset, _depth
2765            )
2766        }
2767    }
2768    unsafe impl<
2769        D: fidl::encoding::ResourceDialect,
2770        T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3__common::KeyEvent, D>,
2771    > fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D> for (T0,)
2772    {
2773        #[inline]
2774        unsafe fn encode(
2775            self,
2776            encoder: &mut fidl::encoding::Encoder<'_, D>,
2777            offset: usize,
2778            depth: fidl::encoding::Depth,
2779        ) -> fidl::Result<()> {
2780            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2781            // Zero out padding regions. There's no need to apply masks
2782            // because the unmasked parts will be overwritten by fields.
2783            // Write the fields.
2784            self.0.encode(encoder, offset + 0, depth)?;
2785            Ok(())
2786        }
2787    }
2788
2789    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2790        for InputMethodEditorDispatchKey3Request
2791    {
2792        #[inline(always)]
2793        fn new_empty() -> Self {
2794            Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3__common::KeyEvent, D) }
2795        }
2796
2797        #[inline]
2798        unsafe fn decode(
2799            &mut self,
2800            decoder: &mut fidl::encoding::Decoder<'_, D>,
2801            offset: usize,
2802            _depth: fidl::encoding::Depth,
2803        ) -> fidl::Result<()> {
2804            decoder.debug_check_bounds::<Self>(offset);
2805            // Verify that padding bytes are zero.
2806            fidl::decode!(
2807                fidl_fuchsia_ui_input3__common::KeyEvent,
2808                D,
2809                &mut self.event,
2810                decoder,
2811                offset + 0,
2812                _depth
2813            )?;
2814            Ok(())
2815        }
2816    }
2817
2818    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
2819        type Borrowed<'a> = &'a Self;
2820        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2821            value
2822        }
2823    }
2824
2825    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Response {
2826        type Owned = Self;
2827
2828        #[inline(always)]
2829        fn inline_align(_context: fidl::encoding::Context) -> usize {
2830            1
2831        }
2832
2833        #[inline(always)]
2834        fn inline_size(_context: fidl::encoding::Context) -> usize {
2835            1
2836        }
2837    }
2838
2839    unsafe impl<D: fidl::encoding::ResourceDialect>
2840        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D>
2841        for &InputMethodEditorDispatchKey3Response
2842    {
2843        #[inline]
2844        unsafe fn encode(
2845            self,
2846            encoder: &mut fidl::encoding::Encoder<'_, D>,
2847            offset: usize,
2848            _depth: fidl::encoding::Depth,
2849        ) -> fidl::Result<()> {
2850            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2851            // Delegate to tuple encoding.
2852            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response, D>::encode(
2853                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
2854                encoder,
2855                offset,
2856                _depth,
2857            )
2858        }
2859    }
2860    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2861        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D> for (T0,)
2862    {
2863        #[inline]
2864        unsafe fn encode(
2865            self,
2866            encoder: &mut fidl::encoding::Encoder<'_, D>,
2867            offset: usize,
2868            depth: fidl::encoding::Depth,
2869        ) -> fidl::Result<()> {
2870            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2871            // Zero out padding regions. There's no need to apply masks
2872            // because the unmasked parts will be overwritten by fields.
2873            // Write the fields.
2874            self.0.encode(encoder, offset + 0, depth)?;
2875            Ok(())
2876        }
2877    }
2878
2879    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2880        for InputMethodEditorDispatchKey3Response
2881    {
2882        #[inline(always)]
2883        fn new_empty() -> Self {
2884            Self { handled: fidl::new_empty!(bool, D) }
2885        }
2886
2887        #[inline]
2888        unsafe fn decode(
2889            &mut self,
2890            decoder: &mut fidl::encoding::Decoder<'_, D>,
2891            offset: usize,
2892            _depth: fidl::encoding::Depth,
2893        ) -> fidl::Result<()> {
2894            decoder.debug_check_bounds::<Self>(offset);
2895            // Verify that padding bytes are zero.
2896            fidl::decode!(bool, D, &mut self.handled, decoder, offset + 0, _depth)?;
2897            Ok(())
2898        }
2899    }
2900
2901    impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
2902        type Borrowed<'a> = &'a Self;
2903        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2904            value
2905        }
2906    }
2907
2908    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorInjectInputRequest {
2909        type Owned = Self;
2910
2911        #[inline(always)]
2912        fn inline_align(_context: fidl::encoding::Context) -> usize {
2913            8
2914        }
2915
2916        #[inline(always)]
2917        fn inline_size(_context: fidl::encoding::Context) -> usize {
2918            16
2919        }
2920    }
2921
2922    unsafe impl<D: fidl::encoding::ResourceDialect>
2923        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D>
2924        for &InputMethodEditorInjectInputRequest
2925    {
2926        #[inline]
2927        unsafe fn encode(
2928            self,
2929            encoder: &mut fidl::encoding::Encoder<'_, D>,
2930            offset: usize,
2931            _depth: fidl::encoding::Depth,
2932        ) -> fidl::Result<()> {
2933            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2934            // Delegate to tuple encoding.
2935            fidl::encoding::Encode::<InputMethodEditorInjectInputRequest, D>::encode(
2936                (<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
2937                encoder,
2938                offset,
2939                _depth,
2940            )
2941        }
2942    }
2943    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputEvent, D>>
2944        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D> for (T0,)
2945    {
2946        #[inline]
2947        unsafe fn encode(
2948            self,
2949            encoder: &mut fidl::encoding::Encoder<'_, D>,
2950            offset: usize,
2951            depth: fidl::encoding::Depth,
2952        ) -> fidl::Result<()> {
2953            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2954            // Zero out padding regions. There's no need to apply masks
2955            // because the unmasked parts will be overwritten by fields.
2956            // Write the fields.
2957            self.0.encode(encoder, offset + 0, depth)?;
2958            Ok(())
2959        }
2960    }
2961
2962    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2963        for InputMethodEditorInjectInputRequest
2964    {
2965        #[inline(always)]
2966        fn new_empty() -> Self {
2967            Self { event: fidl::new_empty!(InputEvent, D) }
2968        }
2969
2970        #[inline]
2971        unsafe fn decode(
2972            &mut self,
2973            decoder: &mut fidl::encoding::Decoder<'_, D>,
2974            offset: usize,
2975            _depth: fidl::encoding::Depth,
2976        ) -> fidl::Result<()> {
2977            decoder.debug_check_bounds::<Self>(offset);
2978            // Verify that padding bytes are zero.
2979            fidl::decode!(InputEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
2980            Ok(())
2981        }
2982    }
2983
2984    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2985        type Borrowed<'a> = &'a Self;
2986        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2987            value
2988        }
2989    }
2990
2991    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2992        type Owned = Self;
2993
2994        #[inline(always)]
2995        fn inline_align(_context: fidl::encoding::Context) -> usize {
2996            4
2997        }
2998
2999        #[inline(always)]
3000        fn inline_size(_context: fidl::encoding::Context) -> usize {
3001            4
3002        }
3003    }
3004
3005    unsafe impl<D: fidl::encoding::ResourceDialect>
3006        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D>
3007        for &InputMethodEditorSetKeyboardTypeRequest
3008    {
3009        #[inline]
3010        unsafe fn encode(
3011            self,
3012            encoder: &mut fidl::encoding::Encoder<'_, D>,
3013            offset: usize,
3014            _depth: fidl::encoding::Depth,
3015        ) -> fidl::Result<()> {
3016            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
3017            // Delegate to tuple encoding.
3018            fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest, D>::encode(
3019                (<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
3020                encoder,
3021                offset,
3022                _depth,
3023            )
3024        }
3025    }
3026    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardType, D>>
3027        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D> for (T0,)
3028    {
3029        #[inline]
3030        unsafe fn encode(
3031            self,
3032            encoder: &mut fidl::encoding::Encoder<'_, D>,
3033            offset: usize,
3034            depth: fidl::encoding::Depth,
3035        ) -> fidl::Result<()> {
3036            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
3037            // Zero out padding regions. There's no need to apply masks
3038            // because the unmasked parts will be overwritten by fields.
3039            // Write the fields.
3040            self.0.encode(encoder, offset + 0, depth)?;
3041            Ok(())
3042        }
3043    }
3044
3045    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3046        for InputMethodEditorSetKeyboardTypeRequest
3047    {
3048        #[inline(always)]
3049        fn new_empty() -> Self {
3050            Self { keyboard_type: fidl::new_empty!(KeyboardType, D) }
3051        }
3052
3053        #[inline]
3054        unsafe fn decode(
3055            &mut self,
3056            decoder: &mut fidl::encoding::Decoder<'_, D>,
3057            offset: usize,
3058            _depth: fidl::encoding::Depth,
3059        ) -> fidl::Result<()> {
3060            decoder.debug_check_bounds::<Self>(offset);
3061            // Verify that padding bytes are zero.
3062            fidl::decode!(KeyboardType, D, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
3063            Ok(())
3064        }
3065    }
3066
3067    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
3068        type Borrowed<'a> = &'a Self;
3069        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3070            value
3071        }
3072    }
3073
3074    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetStateRequest {
3075        type Owned = Self;
3076
3077        #[inline(always)]
3078        fn inline_align(_context: fidl::encoding::Context) -> usize {
3079            8
3080        }
3081
3082        #[inline(always)]
3083        fn inline_size(_context: fidl::encoding::Context) -> usize {
3084            64
3085        }
3086    }
3087
3088    unsafe impl<D: fidl::encoding::ResourceDialect>
3089        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D>
3090        for &InputMethodEditorSetStateRequest
3091    {
3092        #[inline]
3093        unsafe fn encode(
3094            self,
3095            encoder: &mut fidl::encoding::Encoder<'_, D>,
3096            offset: usize,
3097            _depth: fidl::encoding::Depth,
3098        ) -> fidl::Result<()> {
3099            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
3100            // Delegate to tuple encoding.
3101            fidl::encoding::Encode::<InputMethodEditorSetStateRequest, D>::encode(
3102                (<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
3103                encoder,
3104                offset,
3105                _depth,
3106            )
3107        }
3108    }
3109    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TextInputState, D>>
3110        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D> for (T0,)
3111    {
3112        #[inline]
3113        unsafe fn encode(
3114            self,
3115            encoder: &mut fidl::encoding::Encoder<'_, D>,
3116            offset: usize,
3117            depth: fidl::encoding::Depth,
3118        ) -> fidl::Result<()> {
3119            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
3120            // Zero out padding regions. There's no need to apply masks
3121            // because the unmasked parts will be overwritten by fields.
3122            // Write the fields.
3123            self.0.encode(encoder, offset + 0, depth)?;
3124            Ok(())
3125        }
3126    }
3127
3128    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3129        for InputMethodEditorSetStateRequest
3130    {
3131        #[inline(always)]
3132        fn new_empty() -> Self {
3133            Self { state: fidl::new_empty!(TextInputState, D) }
3134        }
3135
3136        #[inline]
3137        unsafe fn decode(
3138            &mut self,
3139            decoder: &mut fidl::encoding::Decoder<'_, D>,
3140            offset: usize,
3141            _depth: fidl::encoding::Depth,
3142        ) -> fidl::Result<()> {
3143            decoder.debug_check_bounds::<Self>(offset);
3144            // Verify that padding bytes are zero.
3145            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
3146            Ok(())
3147        }
3148    }
3149
3150    impl fidl::encoding::ValueTypeMarker for InputReport {
3151        type Borrowed<'a> = &'a Self;
3152        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3153            value
3154        }
3155    }
3156
3157    unsafe impl fidl::encoding::TypeMarker for InputReport {
3158        type Owned = Self;
3159
3160        #[inline(always)]
3161        fn inline_align(_context: fidl::encoding::Context) -> usize {
3162            8
3163        }
3164
3165        #[inline(always)]
3166        fn inline_size(_context: fidl::encoding::Context) -> usize {
3167            72
3168        }
3169    }
3170
3171    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
3172        for &InputReport
3173    {
3174        #[inline]
3175        unsafe fn encode(
3176            self,
3177            encoder: &mut fidl::encoding::Encoder<'_, D>,
3178            offset: usize,
3179            _depth: fidl::encoding::Depth,
3180        ) -> fidl::Result<()> {
3181            encoder.debug_check_bounds::<InputReport>(offset);
3182            // Delegate to tuple encoding.
3183            fidl::encoding::Encode::<InputReport, D>::encode(
3184                (
3185                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3186                    <fidl::encoding::Boxed<KeyboardReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
3187                    <fidl::encoding::Boxed<MediaButtonsReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
3188                    <fidl::encoding::Boxed<MouseReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
3189                    <fidl::encoding::Boxed<StylusReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
3190                    <fidl::encoding::Boxed<TouchscreenReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
3191                    <fidl::encoding::OptionalUnion<SensorReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
3192                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.trace_id),
3193                ),
3194                encoder, offset, _depth
3195            )
3196        }
3197    }
3198    unsafe impl<
3199        D: fidl::encoding::ResourceDialect,
3200        T0: fidl::encoding::Encode<u64, D>,
3201        T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>, D>,
3202        T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>, D>,
3203        T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>, D>,
3204        T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>, D>,
3205        T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>, D>,
3206        T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>, D>,
3207        T7: fidl::encoding::Encode<u64, D>,
3208    > fidl::encoding::Encode<InputReport, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
3209    {
3210        #[inline]
3211        unsafe fn encode(
3212            self,
3213            encoder: &mut fidl::encoding::Encoder<'_, D>,
3214            offset: usize,
3215            depth: fidl::encoding::Depth,
3216        ) -> fidl::Result<()> {
3217            encoder.debug_check_bounds::<InputReport>(offset);
3218            // Zero out padding regions. There's no need to apply masks
3219            // because the unmasked parts will be overwritten by fields.
3220            // Write the fields.
3221            self.0.encode(encoder, offset + 0, depth)?;
3222            self.1.encode(encoder, offset + 8, depth)?;
3223            self.2.encode(encoder, offset + 16, depth)?;
3224            self.3.encode(encoder, offset + 24, depth)?;
3225            self.4.encode(encoder, offset + 32, depth)?;
3226            self.5.encode(encoder, offset + 40, depth)?;
3227            self.6.encode(encoder, offset + 48, depth)?;
3228            self.7.encode(encoder, offset + 64, depth)?;
3229            Ok(())
3230        }
3231    }
3232
3233    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
3234        #[inline(always)]
3235        fn new_empty() -> Self {
3236            Self {
3237                event_time: fidl::new_empty!(u64, D),
3238                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>, D),
3239                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>, D),
3240                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>, D),
3241                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>, D),
3242                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>, D),
3243                sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>, D),
3244                trace_id: fidl::new_empty!(u64, D),
3245            }
3246        }
3247
3248        #[inline]
3249        unsafe fn decode(
3250            &mut self,
3251            decoder: &mut fidl::encoding::Decoder<'_, D>,
3252            offset: usize,
3253            _depth: fidl::encoding::Depth,
3254        ) -> fidl::Result<()> {
3255            decoder.debug_check_bounds::<Self>(offset);
3256            // Verify that padding bytes are zero.
3257            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3258            fidl::decode!(
3259                fidl::encoding::Boxed<KeyboardReport>,
3260                D,
3261                &mut self.keyboard,
3262                decoder,
3263                offset + 8,
3264                _depth
3265            )?;
3266            fidl::decode!(
3267                fidl::encoding::Boxed<MediaButtonsReport>,
3268                D,
3269                &mut self.media_buttons,
3270                decoder,
3271                offset + 16,
3272                _depth
3273            )?;
3274            fidl::decode!(
3275                fidl::encoding::Boxed<MouseReport>,
3276                D,
3277                &mut self.mouse,
3278                decoder,
3279                offset + 24,
3280                _depth
3281            )?;
3282            fidl::decode!(
3283                fidl::encoding::Boxed<StylusReport>,
3284                D,
3285                &mut self.stylus,
3286                decoder,
3287                offset + 32,
3288                _depth
3289            )?;
3290            fidl::decode!(
3291                fidl::encoding::Boxed<TouchscreenReport>,
3292                D,
3293                &mut self.touchscreen,
3294                decoder,
3295                offset + 40,
3296                _depth
3297            )?;
3298            fidl::decode!(
3299                fidl::encoding::OptionalUnion<SensorReport>,
3300                D,
3301                &mut self.sensor,
3302                decoder,
3303                offset + 48,
3304                _depth
3305            )?;
3306            fidl::decode!(u64, D, &mut self.trace_id, decoder, offset + 64, _depth)?;
3307            Ok(())
3308        }
3309    }
3310
3311    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
3312        type Borrowed<'a> = &'a Self;
3313        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3314            value
3315        }
3316    }
3317
3318    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
3319        type Owned = Self;
3320
3321        #[inline(always)]
3322        fn inline_align(_context: fidl::encoding::Context) -> usize {
3323            8
3324        }
3325
3326        #[inline(always)]
3327        fn inline_size(_context: fidl::encoding::Context) -> usize {
3328            16
3329        }
3330    }
3331
3332    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
3333        for &KeyboardDescriptor
3334    {
3335        #[inline]
3336        unsafe fn encode(
3337            self,
3338            encoder: &mut fidl::encoding::Encoder<'_, D>,
3339            offset: usize,
3340            _depth: fidl::encoding::Depth,
3341        ) -> fidl::Result<()> {
3342            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3343            // Delegate to tuple encoding.
3344            fidl::encoding::Encode::<KeyboardDescriptor, D>::encode(
3345                (
3346                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
3347                ),
3348                encoder, offset, _depth
3349            )
3350        }
3351    }
3352    unsafe impl<
3353        D: fidl::encoding::ResourceDialect,
3354        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3355    > fidl::encoding::Encode<KeyboardDescriptor, D> for (T0,)
3356    {
3357        #[inline]
3358        unsafe fn encode(
3359            self,
3360            encoder: &mut fidl::encoding::Encoder<'_, D>,
3361            offset: usize,
3362            depth: fidl::encoding::Depth,
3363        ) -> fidl::Result<()> {
3364            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3365            // Zero out padding regions. There's no need to apply masks
3366            // because the unmasked parts will be overwritten by fields.
3367            // Write the fields.
3368            self.0.encode(encoder, offset + 0, depth)?;
3369            Ok(())
3370        }
3371    }
3372
3373    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
3374        #[inline(always)]
3375        fn new_empty() -> Self {
3376            Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3377        }
3378
3379        #[inline]
3380        unsafe fn decode(
3381            &mut self,
3382            decoder: &mut fidl::encoding::Decoder<'_, D>,
3383            offset: usize,
3384            _depth: fidl::encoding::Depth,
3385        ) -> fidl::Result<()> {
3386            decoder.debug_check_bounds::<Self>(offset);
3387            // Verify that padding bytes are zero.
3388            fidl::decode!(
3389                fidl::encoding::UnboundedVector<u32>,
3390                D,
3391                &mut self.keys,
3392                decoder,
3393                offset + 0,
3394                _depth
3395            )?;
3396            Ok(())
3397        }
3398    }
3399
3400    impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
3401        type Borrowed<'a> = &'a Self;
3402        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3403            value
3404        }
3405    }
3406
3407    unsafe impl fidl::encoding::TypeMarker for KeyboardEvent {
3408        type Owned = Self;
3409
3410        #[inline(always)]
3411        fn inline_align(_context: fidl::encoding::Context) -> usize {
3412            8
3413        }
3414
3415        #[inline(always)]
3416        fn inline_size(_context: fidl::encoding::Context) -> usize {
3417            32
3418        }
3419    }
3420
3421    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardEvent, D>
3422        for &KeyboardEvent
3423    {
3424        #[inline]
3425        unsafe fn encode(
3426            self,
3427            encoder: &mut fidl::encoding::Encoder<'_, D>,
3428            offset: usize,
3429            _depth: fidl::encoding::Depth,
3430        ) -> fidl::Result<()> {
3431            encoder.debug_check_bounds::<KeyboardEvent>(offset);
3432            // Delegate to tuple encoding.
3433            fidl::encoding::Encode::<KeyboardEvent, D>::encode(
3434                (
3435                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3436                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
3437                    <KeyboardEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
3438                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hid_usage),
3439                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.code_point),
3440                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.modifiers),
3441                ),
3442                encoder,
3443                offset,
3444                _depth,
3445            )
3446        }
3447    }
3448    unsafe impl<
3449        D: fidl::encoding::ResourceDialect,
3450        T0: fidl::encoding::Encode<u64, D>,
3451        T1: fidl::encoding::Encode<u32, D>,
3452        T2: fidl::encoding::Encode<KeyboardEventPhase, D>,
3453        T3: fidl::encoding::Encode<u32, D>,
3454        T4: fidl::encoding::Encode<u32, D>,
3455        T5: fidl::encoding::Encode<u32, D>,
3456    > fidl::encoding::Encode<KeyboardEvent, D> for (T0, T1, T2, T3, T4, T5)
3457    {
3458        #[inline]
3459        unsafe fn encode(
3460            self,
3461            encoder: &mut fidl::encoding::Encoder<'_, D>,
3462            offset: usize,
3463            depth: fidl::encoding::Depth,
3464        ) -> fidl::Result<()> {
3465            encoder.debug_check_bounds::<KeyboardEvent>(offset);
3466            // Zero out padding regions. There's no need to apply masks
3467            // because the unmasked parts will be overwritten by fields.
3468            unsafe {
3469                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3470                (ptr as *mut u64).write_unaligned(0);
3471            }
3472            // Write the fields.
3473            self.0.encode(encoder, offset + 0, depth)?;
3474            self.1.encode(encoder, offset + 8, depth)?;
3475            self.2.encode(encoder, offset + 12, depth)?;
3476            self.3.encode(encoder, offset + 16, depth)?;
3477            self.4.encode(encoder, offset + 20, depth)?;
3478            self.5.encode(encoder, offset + 24, depth)?;
3479            Ok(())
3480        }
3481    }
3482
3483    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEvent {
3484        #[inline(always)]
3485        fn new_empty() -> Self {
3486            Self {
3487                event_time: fidl::new_empty!(u64, D),
3488                device_id: fidl::new_empty!(u32, D),
3489                phase: fidl::new_empty!(KeyboardEventPhase, D),
3490                hid_usage: fidl::new_empty!(u32, D),
3491                code_point: fidl::new_empty!(u32, D),
3492                modifiers: fidl::new_empty!(u32, D),
3493            }
3494        }
3495
3496        #[inline]
3497        unsafe fn decode(
3498            &mut self,
3499            decoder: &mut fidl::encoding::Decoder<'_, D>,
3500            offset: usize,
3501            _depth: fidl::encoding::Depth,
3502        ) -> fidl::Result<()> {
3503            decoder.debug_check_bounds::<Self>(offset);
3504            // Verify that padding bytes are zero.
3505            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3506            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3507            let mask = 0xffffffff00000000u64;
3508            let maskedval = padval & mask;
3509            if maskedval != 0 {
3510                return Err(fidl::Error::NonZeroPadding {
3511                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3512                });
3513            }
3514            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3515            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
3516            fidl::decode!(KeyboardEventPhase, D, &mut self.phase, decoder, offset + 12, _depth)?;
3517            fidl::decode!(u32, D, &mut self.hid_usage, decoder, offset + 16, _depth)?;
3518            fidl::decode!(u32, D, &mut self.code_point, decoder, offset + 20, _depth)?;
3519            fidl::decode!(u32, D, &mut self.modifiers, decoder, offset + 24, _depth)?;
3520            Ok(())
3521        }
3522    }
3523
3524    impl fidl::encoding::ValueTypeMarker for KeyboardReport {
3525        type Borrowed<'a> = &'a Self;
3526        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3527            value
3528        }
3529    }
3530
3531    unsafe impl fidl::encoding::TypeMarker for KeyboardReport {
3532        type Owned = Self;
3533
3534        #[inline(always)]
3535        fn inline_align(_context: fidl::encoding::Context) -> usize {
3536            8
3537        }
3538
3539        #[inline(always)]
3540        fn inline_size(_context: fidl::encoding::Context) -> usize {
3541            16
3542        }
3543    }
3544
3545    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardReport, D>
3546        for &KeyboardReport
3547    {
3548        #[inline]
3549        unsafe fn encode(
3550            self,
3551            encoder: &mut fidl::encoding::Encoder<'_, D>,
3552            offset: usize,
3553            _depth: fidl::encoding::Depth,
3554        ) -> fidl::Result<()> {
3555            encoder.debug_check_bounds::<KeyboardReport>(offset);
3556            // Delegate to tuple encoding.
3557            fidl::encoding::Encode::<KeyboardReport, D>::encode(
3558                (
3559                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
3560                ),
3561                encoder, offset, _depth
3562            )
3563        }
3564    }
3565    unsafe impl<
3566        D: fidl::encoding::ResourceDialect,
3567        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3568    > fidl::encoding::Encode<KeyboardReport, D> for (T0,)
3569    {
3570        #[inline]
3571        unsafe fn encode(
3572            self,
3573            encoder: &mut fidl::encoding::Encoder<'_, D>,
3574            offset: usize,
3575            depth: fidl::encoding::Depth,
3576        ) -> fidl::Result<()> {
3577            encoder.debug_check_bounds::<KeyboardReport>(offset);
3578            // Zero out padding regions. There's no need to apply masks
3579            // because the unmasked parts will be overwritten by fields.
3580            // Write the fields.
3581            self.0.encode(encoder, offset + 0, depth)?;
3582            Ok(())
3583        }
3584    }
3585
3586    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardReport {
3587        #[inline(always)]
3588        fn new_empty() -> Self {
3589            Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3590        }
3591
3592        #[inline]
3593        unsafe fn decode(
3594            &mut self,
3595            decoder: &mut fidl::encoding::Decoder<'_, D>,
3596            offset: usize,
3597            _depth: fidl::encoding::Depth,
3598        ) -> fidl::Result<()> {
3599            decoder.debug_check_bounds::<Self>(offset);
3600            // Verify that padding bytes are zero.
3601            fidl::decode!(
3602                fidl::encoding::UnboundedVector<u32>,
3603                D,
3604                &mut self.pressed_keys,
3605                decoder,
3606                offset + 0,
3607                _depth
3608            )?;
3609            Ok(())
3610        }
3611    }
3612
3613    impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
3614        type Borrowed<'a> = &'a Self;
3615        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3616            value
3617        }
3618    }
3619
3620    unsafe impl fidl::encoding::TypeMarker for MediaButtonsDescriptor {
3621        type Owned = Self;
3622
3623        #[inline(always)]
3624        fn inline_align(_context: fidl::encoding::Context) -> usize {
3625            4
3626        }
3627
3628        #[inline(always)]
3629        fn inline_size(_context: fidl::encoding::Context) -> usize {
3630            4
3631        }
3632        #[inline(always)]
3633        fn encode_is_copy() -> bool {
3634            true
3635        }
3636
3637        #[inline(always)]
3638        fn decode_is_copy() -> bool {
3639            true
3640        }
3641    }
3642
3643    unsafe impl<D: fidl::encoding::ResourceDialect>
3644        fidl::encoding::Encode<MediaButtonsDescriptor, D> for &MediaButtonsDescriptor
3645    {
3646        #[inline]
3647        unsafe fn encode(
3648            self,
3649            encoder: &mut fidl::encoding::Encoder<'_, D>,
3650            offset: usize,
3651            _depth: fidl::encoding::Depth,
3652        ) -> fidl::Result<()> {
3653            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3654            unsafe {
3655                // Copy the object into the buffer.
3656                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3657                (buf_ptr as *mut MediaButtonsDescriptor)
3658                    .write_unaligned((self as *const MediaButtonsDescriptor).read());
3659                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3660                // done second because the memcpy will write garbage to these bytes.
3661            }
3662            Ok(())
3663        }
3664    }
3665    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3666        fidl::encoding::Encode<MediaButtonsDescriptor, D> for (T0,)
3667    {
3668        #[inline]
3669        unsafe fn encode(
3670            self,
3671            encoder: &mut fidl::encoding::Encoder<'_, D>,
3672            offset: usize,
3673            depth: fidl::encoding::Depth,
3674        ) -> fidl::Result<()> {
3675            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3676            // Zero out padding regions. There's no need to apply masks
3677            // because the unmasked parts will be overwritten by fields.
3678            // Write the fields.
3679            self.0.encode(encoder, offset + 0, depth)?;
3680            Ok(())
3681        }
3682    }
3683
3684    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3685        for MediaButtonsDescriptor
3686    {
3687        #[inline(always)]
3688        fn new_empty() -> Self {
3689            Self { buttons: fidl::new_empty!(u32, D) }
3690        }
3691
3692        #[inline]
3693        unsafe fn decode(
3694            &mut self,
3695            decoder: &mut fidl::encoding::Decoder<'_, D>,
3696            offset: usize,
3697            _depth: fidl::encoding::Depth,
3698        ) -> fidl::Result<()> {
3699            decoder.debug_check_bounds::<Self>(offset);
3700            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3701            // Verify that padding bytes are zero.
3702            // Copy from the buffer into the object.
3703            unsafe {
3704                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3705            }
3706            Ok(())
3707        }
3708    }
3709
3710    impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
3711        type Borrowed<'a> = &'a Self;
3712        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3713            value
3714        }
3715    }
3716
3717    unsafe impl fidl::encoding::TypeMarker for MediaButtonsReport {
3718        type Owned = Self;
3719
3720        #[inline(always)]
3721        fn inline_align(_context: fidl::encoding::Context) -> usize {
3722            1
3723        }
3724
3725        #[inline(always)]
3726        fn inline_size(_context: fidl::encoding::Context) -> usize {
3727            6
3728        }
3729    }
3730
3731    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsReport, D>
3732        for &MediaButtonsReport
3733    {
3734        #[inline]
3735        unsafe fn encode(
3736            self,
3737            encoder: &mut fidl::encoding::Encoder<'_, D>,
3738            offset: usize,
3739            _depth: fidl::encoding::Depth,
3740        ) -> fidl::Result<()> {
3741            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3742            // Delegate to tuple encoding.
3743            fidl::encoding::Encode::<MediaButtonsReport, D>::encode(
3744                (
3745                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_up),
3746                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_down),
3747                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mic_mute),
3748                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reset),
3749                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.pause),
3750                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.camera_disable),
3751                ),
3752                encoder,
3753                offset,
3754                _depth,
3755            )
3756        }
3757    }
3758    unsafe impl<
3759        D: fidl::encoding::ResourceDialect,
3760        T0: fidl::encoding::Encode<bool, D>,
3761        T1: fidl::encoding::Encode<bool, D>,
3762        T2: fidl::encoding::Encode<bool, D>,
3763        T3: fidl::encoding::Encode<bool, D>,
3764        T4: fidl::encoding::Encode<bool, D>,
3765        T5: fidl::encoding::Encode<bool, D>,
3766    > fidl::encoding::Encode<MediaButtonsReport, D> for (T0, T1, T2, T3, T4, T5)
3767    {
3768        #[inline]
3769        unsafe fn encode(
3770            self,
3771            encoder: &mut fidl::encoding::Encoder<'_, D>,
3772            offset: usize,
3773            depth: fidl::encoding::Depth,
3774        ) -> fidl::Result<()> {
3775            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3776            // Zero out padding regions. There's no need to apply masks
3777            // because the unmasked parts will be overwritten by fields.
3778            // Write the fields.
3779            self.0.encode(encoder, offset + 0, depth)?;
3780            self.1.encode(encoder, offset + 1, depth)?;
3781            self.2.encode(encoder, offset + 2, depth)?;
3782            self.3.encode(encoder, offset + 3, depth)?;
3783            self.4.encode(encoder, offset + 4, depth)?;
3784            self.5.encode(encoder, offset + 5, depth)?;
3785            Ok(())
3786        }
3787    }
3788
3789    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsReport {
3790        #[inline(always)]
3791        fn new_empty() -> Self {
3792            Self {
3793                volume_up: fidl::new_empty!(bool, D),
3794                volume_down: fidl::new_empty!(bool, D),
3795                mic_mute: fidl::new_empty!(bool, D),
3796                reset: fidl::new_empty!(bool, D),
3797                pause: fidl::new_empty!(bool, D),
3798                camera_disable: fidl::new_empty!(bool, D),
3799            }
3800        }
3801
3802        #[inline]
3803        unsafe fn decode(
3804            &mut self,
3805            decoder: &mut fidl::encoding::Decoder<'_, D>,
3806            offset: usize,
3807            _depth: fidl::encoding::Depth,
3808        ) -> fidl::Result<()> {
3809            decoder.debug_check_bounds::<Self>(offset);
3810            // Verify that padding bytes are zero.
3811            fidl::decode!(bool, D, &mut self.volume_up, decoder, offset + 0, _depth)?;
3812            fidl::decode!(bool, D, &mut self.volume_down, decoder, offset + 1, _depth)?;
3813            fidl::decode!(bool, D, &mut self.mic_mute, decoder, offset + 2, _depth)?;
3814            fidl::decode!(bool, D, &mut self.reset, decoder, offset + 3, _depth)?;
3815            fidl::decode!(bool, D, &mut self.pause, decoder, offset + 4, _depth)?;
3816            fidl::decode!(bool, D, &mut self.camera_disable, decoder, offset + 5, _depth)?;
3817            Ok(())
3818        }
3819    }
3820
3821    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
3822        type Borrowed<'a> = &'a Self;
3823        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3824            value
3825        }
3826    }
3827
3828    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
3829        type Owned = Self;
3830
3831        #[inline(always)]
3832        fn inline_align(_context: fidl::encoding::Context) -> usize {
3833            8
3834        }
3835
3836        #[inline(always)]
3837        fn inline_size(_context: fidl::encoding::Context) -> usize {
3838            56
3839        }
3840    }
3841
3842    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
3843        for &MouseDescriptor
3844    {
3845        #[inline]
3846        unsafe fn encode(
3847            self,
3848            encoder: &mut fidl::encoding::Encoder<'_, D>,
3849            offset: usize,
3850            _depth: fidl::encoding::Depth,
3851        ) -> fidl::Result<()> {
3852            encoder.debug_check_bounds::<MouseDescriptor>(offset);
3853            // Delegate to tuple encoding.
3854            fidl::encoding::Encode::<MouseDescriptor, D>::encode(
3855                (
3856                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_x),
3857                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_y),
3858                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3859                        &self.vscroll,
3860                    ),
3861                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3862                        &self.hscroll,
3863                    ),
3864                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
3865                ),
3866                encoder,
3867                offset,
3868                _depth,
3869            )
3870        }
3871    }
3872    unsafe impl<
3873        D: fidl::encoding::ResourceDialect,
3874        T0: fidl::encoding::Encode<Axis, D>,
3875        T1: fidl::encoding::Encode<Axis, D>,
3876        T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3877        T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3878        T4: fidl::encoding::Encode<u32, D>,
3879    > fidl::encoding::Encode<MouseDescriptor, D> for (T0, T1, T2, T3, T4)
3880    {
3881        #[inline]
3882        unsafe fn encode(
3883            self,
3884            encoder: &mut fidl::encoding::Encoder<'_, D>,
3885            offset: usize,
3886            depth: fidl::encoding::Depth,
3887        ) -> fidl::Result<()> {
3888            encoder.debug_check_bounds::<MouseDescriptor>(offset);
3889            // Zero out padding regions. There's no need to apply masks
3890            // because the unmasked parts will be overwritten by fields.
3891            unsafe {
3892                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
3893                (ptr as *mut u64).write_unaligned(0);
3894            }
3895            // Write the fields.
3896            self.0.encode(encoder, offset + 0, depth)?;
3897            self.1.encode(encoder, offset + 16, depth)?;
3898            self.2.encode(encoder, offset + 32, depth)?;
3899            self.3.encode(encoder, offset + 40, depth)?;
3900            self.4.encode(encoder, offset + 48, depth)?;
3901            Ok(())
3902        }
3903    }
3904
3905    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
3906        #[inline(always)]
3907        fn new_empty() -> Self {
3908            Self {
3909                rel_x: fidl::new_empty!(Axis, D),
3910                rel_y: fidl::new_empty!(Axis, D),
3911                vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3912                hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3913                buttons: fidl::new_empty!(u32, D),
3914            }
3915        }
3916
3917        #[inline]
3918        unsafe fn decode(
3919            &mut self,
3920            decoder: &mut fidl::encoding::Decoder<'_, D>,
3921            offset: usize,
3922            _depth: fidl::encoding::Depth,
3923        ) -> fidl::Result<()> {
3924            decoder.debug_check_bounds::<Self>(offset);
3925            // Verify that padding bytes are zero.
3926            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
3927            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3928            let mask = 0xffffffff00000000u64;
3929            let maskedval = padval & mask;
3930            if maskedval != 0 {
3931                return Err(fidl::Error::NonZeroPadding {
3932                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
3933                });
3934            }
3935            fidl::decode!(Axis, D, &mut self.rel_x, decoder, offset + 0, _depth)?;
3936            fidl::decode!(Axis, D, &mut self.rel_y, decoder, offset + 16, _depth)?;
3937            fidl::decode!(
3938                fidl::encoding::Boxed<Axis>,
3939                D,
3940                &mut self.vscroll,
3941                decoder,
3942                offset + 32,
3943                _depth
3944            )?;
3945            fidl::decode!(
3946                fidl::encoding::Boxed<Axis>,
3947                D,
3948                &mut self.hscroll,
3949                decoder,
3950                offset + 40,
3951                _depth
3952            )?;
3953            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 48, _depth)?;
3954            Ok(())
3955        }
3956    }
3957
3958    impl fidl::encoding::ValueTypeMarker for MouseReport {
3959        type Borrowed<'a> = &'a Self;
3960        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3961            value
3962        }
3963    }
3964
3965    unsafe impl fidl::encoding::TypeMarker for MouseReport {
3966        type Owned = Self;
3967
3968        #[inline(always)]
3969        fn inline_align(_context: fidl::encoding::Context) -> usize {
3970            4
3971        }
3972
3973        #[inline(always)]
3974        fn inline_size(_context: fidl::encoding::Context) -> usize {
3975            20
3976        }
3977        #[inline(always)]
3978        fn encode_is_copy() -> bool {
3979            true
3980        }
3981
3982        #[inline(always)]
3983        fn decode_is_copy() -> bool {
3984            true
3985        }
3986    }
3987
3988    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseReport, D>
3989        for &MouseReport
3990    {
3991        #[inline]
3992        unsafe fn encode(
3993            self,
3994            encoder: &mut fidl::encoding::Encoder<'_, D>,
3995            offset: usize,
3996            _depth: fidl::encoding::Depth,
3997        ) -> fidl::Result<()> {
3998            encoder.debug_check_bounds::<MouseReport>(offset);
3999            unsafe {
4000                // Copy the object into the buffer.
4001                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4002                (buf_ptr as *mut MouseReport).write_unaligned((self as *const MouseReport).read());
4003                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4004                // done second because the memcpy will write garbage to these bytes.
4005            }
4006            Ok(())
4007        }
4008    }
4009    unsafe impl<
4010        D: fidl::encoding::ResourceDialect,
4011        T0: fidl::encoding::Encode<i32, D>,
4012        T1: fidl::encoding::Encode<i32, D>,
4013        T2: fidl::encoding::Encode<i32, D>,
4014        T3: fidl::encoding::Encode<i32, D>,
4015        T4: fidl::encoding::Encode<u32, D>,
4016    > fidl::encoding::Encode<MouseReport, D> for (T0, T1, T2, T3, T4)
4017    {
4018        #[inline]
4019        unsafe fn encode(
4020            self,
4021            encoder: &mut fidl::encoding::Encoder<'_, D>,
4022            offset: usize,
4023            depth: fidl::encoding::Depth,
4024        ) -> fidl::Result<()> {
4025            encoder.debug_check_bounds::<MouseReport>(offset);
4026            // Zero out padding regions. There's no need to apply masks
4027            // because the unmasked parts will be overwritten by fields.
4028            // Write the fields.
4029            self.0.encode(encoder, offset + 0, depth)?;
4030            self.1.encode(encoder, offset + 4, depth)?;
4031            self.2.encode(encoder, offset + 8, depth)?;
4032            self.3.encode(encoder, offset + 12, depth)?;
4033            self.4.encode(encoder, offset + 16, depth)?;
4034            Ok(())
4035        }
4036    }
4037
4038    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseReport {
4039        #[inline(always)]
4040        fn new_empty() -> Self {
4041            Self {
4042                rel_x: fidl::new_empty!(i32, D),
4043                rel_y: fidl::new_empty!(i32, D),
4044                rel_hscroll: fidl::new_empty!(i32, D),
4045                rel_vscroll: fidl::new_empty!(i32, D),
4046                pressed_buttons: fidl::new_empty!(u32, D),
4047            }
4048        }
4049
4050        #[inline]
4051        unsafe fn decode(
4052            &mut self,
4053            decoder: &mut fidl::encoding::Decoder<'_, D>,
4054            offset: usize,
4055            _depth: fidl::encoding::Depth,
4056        ) -> fidl::Result<()> {
4057            decoder.debug_check_bounds::<Self>(offset);
4058            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4059            // Verify that padding bytes are zero.
4060            // Copy from the buffer into the object.
4061            unsafe {
4062                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
4063            }
4064            Ok(())
4065        }
4066    }
4067
4068    impl fidl::encoding::ValueTypeMarker for PointerEvent {
4069        type Borrowed<'a> = &'a Self;
4070        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4071            value
4072        }
4073    }
4074
4075    unsafe impl fidl::encoding::TypeMarker for PointerEvent {
4076        type Owned = Self;
4077
4078        #[inline(always)]
4079        fn inline_align(_context: fidl::encoding::Context) -> usize {
4080            8
4081        }
4082
4083        #[inline(always)]
4084        fn inline_size(_context: fidl::encoding::Context) -> usize {
4085            48
4086        }
4087    }
4088
4089    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PointerEvent, D>
4090        for &PointerEvent
4091    {
4092        #[inline]
4093        unsafe fn encode(
4094            self,
4095            encoder: &mut fidl::encoding::Encoder<'_, D>,
4096            offset: usize,
4097            _depth: fidl::encoding::Depth,
4098        ) -> fidl::Result<()> {
4099            encoder.debug_check_bounds::<PointerEvent>(offset);
4100            // Delegate to tuple encoding.
4101            fidl::encoding::Encode::<PointerEvent, D>::encode(
4102                (
4103                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
4104                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
4105                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_id),
4106                    <PointerEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4107                    <PointerEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
4108                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4109                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4110                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_major),
4111                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_minor),
4112                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4113                ),
4114                encoder,
4115                offset,
4116                _depth,
4117            )
4118        }
4119    }
4120    unsafe impl<
4121        D: fidl::encoding::ResourceDialect,
4122        T0: fidl::encoding::Encode<u64, D>,
4123        T1: fidl::encoding::Encode<u32, D>,
4124        T2: fidl::encoding::Encode<u32, D>,
4125        T3: fidl::encoding::Encode<PointerEventType, D>,
4126        T4: fidl::encoding::Encode<PointerEventPhase, D>,
4127        T5: fidl::encoding::Encode<f32, D>,
4128        T6: fidl::encoding::Encode<f32, D>,
4129        T7: fidl::encoding::Encode<f32, D>,
4130        T8: fidl::encoding::Encode<f32, D>,
4131        T9: fidl::encoding::Encode<u32, D>,
4132    > fidl::encoding::Encode<PointerEvent, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
4133    {
4134        #[inline]
4135        unsafe fn encode(
4136            self,
4137            encoder: &mut fidl::encoding::Encoder<'_, D>,
4138            offset: usize,
4139            depth: fidl::encoding::Depth,
4140        ) -> fidl::Result<()> {
4141            encoder.debug_check_bounds::<PointerEvent>(offset);
4142            // Zero out padding regions. There's no need to apply masks
4143            // because the unmasked parts will be overwritten by fields.
4144            unsafe {
4145                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4146                (ptr as *mut u64).write_unaligned(0);
4147            }
4148            // Write the fields.
4149            self.0.encode(encoder, offset + 0, depth)?;
4150            self.1.encode(encoder, offset + 8, depth)?;
4151            self.2.encode(encoder, offset + 12, depth)?;
4152            self.3.encode(encoder, offset + 16, depth)?;
4153            self.4.encode(encoder, offset + 20, depth)?;
4154            self.5.encode(encoder, offset + 24, depth)?;
4155            self.6.encode(encoder, offset + 28, depth)?;
4156            self.7.encode(encoder, offset + 32, depth)?;
4157            self.8.encode(encoder, offset + 36, depth)?;
4158            self.9.encode(encoder, offset + 40, depth)?;
4159            Ok(())
4160        }
4161    }
4162
4163    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEvent {
4164        #[inline(always)]
4165        fn new_empty() -> Self {
4166            Self {
4167                event_time: fidl::new_empty!(u64, D),
4168                device_id: fidl::new_empty!(u32, D),
4169                pointer_id: fidl::new_empty!(u32, D),
4170                type_: fidl::new_empty!(PointerEventType, D),
4171                phase: fidl::new_empty!(PointerEventPhase, D),
4172                x: fidl::new_empty!(f32, D),
4173                y: fidl::new_empty!(f32, D),
4174                radius_major: fidl::new_empty!(f32, D),
4175                radius_minor: fidl::new_empty!(f32, D),
4176                buttons: fidl::new_empty!(u32, D),
4177            }
4178        }
4179
4180        #[inline]
4181        unsafe fn decode(
4182            &mut self,
4183            decoder: &mut fidl::encoding::Decoder<'_, D>,
4184            offset: usize,
4185            _depth: fidl::encoding::Depth,
4186        ) -> fidl::Result<()> {
4187            decoder.debug_check_bounds::<Self>(offset);
4188            // Verify that padding bytes are zero.
4189            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4190            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4191            let mask = 0xffffffff00000000u64;
4192            let maskedval = padval & mask;
4193            if maskedval != 0 {
4194                return Err(fidl::Error::NonZeroPadding {
4195                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4196                });
4197            }
4198            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
4199            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
4200            fidl::decode!(u32, D, &mut self.pointer_id, decoder, offset + 12, _depth)?;
4201            fidl::decode!(PointerEventType, D, &mut self.type_, decoder, offset + 16, _depth)?;
4202            fidl::decode!(PointerEventPhase, D, &mut self.phase, decoder, offset + 20, _depth)?;
4203            fidl::decode!(f32, D, &mut self.x, decoder, offset + 24, _depth)?;
4204            fidl::decode!(f32, D, &mut self.y, decoder, offset + 28, _depth)?;
4205            fidl::decode!(f32, D, &mut self.radius_major, decoder, offset + 32, _depth)?;
4206            fidl::decode!(f32, D, &mut self.radius_minor, decoder, offset + 36, _depth)?;
4207            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 40, _depth)?;
4208            Ok(())
4209        }
4210    }
4211
4212    impl fidl::encoding::ValueTypeMarker for Range {
4213        type Borrowed<'a> = &'a Self;
4214        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4215            value
4216        }
4217    }
4218
4219    unsafe impl fidl::encoding::TypeMarker for Range {
4220        type Owned = Self;
4221
4222        #[inline(always)]
4223        fn inline_align(_context: fidl::encoding::Context) -> usize {
4224            4
4225        }
4226
4227        #[inline(always)]
4228        fn inline_size(_context: fidl::encoding::Context) -> usize {
4229            8
4230        }
4231        #[inline(always)]
4232        fn encode_is_copy() -> bool {
4233            true
4234        }
4235
4236        #[inline(always)]
4237        fn decode_is_copy() -> bool {
4238            true
4239        }
4240    }
4241
4242    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
4243        #[inline]
4244        unsafe fn encode(
4245            self,
4246            encoder: &mut fidl::encoding::Encoder<'_, D>,
4247            offset: usize,
4248            _depth: fidl::encoding::Depth,
4249        ) -> fidl::Result<()> {
4250            encoder.debug_check_bounds::<Range>(offset);
4251            unsafe {
4252                // Copy the object into the buffer.
4253                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4254                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
4255                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4256                // done second because the memcpy will write garbage to these bytes.
4257            }
4258            Ok(())
4259        }
4260    }
4261    unsafe impl<
4262        D: fidl::encoding::ResourceDialect,
4263        T0: fidl::encoding::Encode<i32, D>,
4264        T1: fidl::encoding::Encode<i32, D>,
4265    > fidl::encoding::Encode<Range, D> for (T0, T1)
4266    {
4267        #[inline]
4268        unsafe fn encode(
4269            self,
4270            encoder: &mut fidl::encoding::Encoder<'_, D>,
4271            offset: usize,
4272            depth: fidl::encoding::Depth,
4273        ) -> fidl::Result<()> {
4274            encoder.debug_check_bounds::<Range>(offset);
4275            // Zero out padding regions. There's no need to apply masks
4276            // because the unmasked parts will be overwritten by fields.
4277            // Write the fields.
4278            self.0.encode(encoder, offset + 0, depth)?;
4279            self.1.encode(encoder, offset + 4, depth)?;
4280            Ok(())
4281        }
4282    }
4283
4284    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
4285        #[inline(always)]
4286        fn new_empty() -> Self {
4287            Self { min: fidl::new_empty!(i32, D), max: fidl::new_empty!(i32, D) }
4288        }
4289
4290        #[inline]
4291        unsafe fn decode(
4292            &mut self,
4293            decoder: &mut fidl::encoding::Decoder<'_, D>,
4294            offset: usize,
4295            _depth: fidl::encoding::Depth,
4296        ) -> fidl::Result<()> {
4297            decoder.debug_check_bounds::<Self>(offset);
4298            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4299            // Verify that padding bytes are zero.
4300            // Copy from the buffer into the object.
4301            unsafe {
4302                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4303            }
4304            Ok(())
4305        }
4306    }
4307
4308    impl fidl::encoding::ValueTypeMarker for RangeF {
4309        type Borrowed<'a> = &'a Self;
4310        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4311            value
4312        }
4313    }
4314
4315    unsafe impl fidl::encoding::TypeMarker for RangeF {
4316        type Owned = Self;
4317
4318        #[inline(always)]
4319        fn inline_align(_context: fidl::encoding::Context) -> usize {
4320            4
4321        }
4322
4323        #[inline(always)]
4324        fn inline_size(_context: fidl::encoding::Context) -> usize {
4325            8
4326        }
4327    }
4328
4329    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RangeF, D> for &RangeF {
4330        #[inline]
4331        unsafe fn encode(
4332            self,
4333            encoder: &mut fidl::encoding::Encoder<'_, D>,
4334            offset: usize,
4335            _depth: fidl::encoding::Depth,
4336        ) -> fidl::Result<()> {
4337            encoder.debug_check_bounds::<RangeF>(offset);
4338            // Delegate to tuple encoding.
4339            fidl::encoding::Encode::<RangeF, D>::encode(
4340                (
4341                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
4342                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
4343                ),
4344                encoder,
4345                offset,
4346                _depth,
4347            )
4348        }
4349    }
4350    unsafe impl<
4351        D: fidl::encoding::ResourceDialect,
4352        T0: fidl::encoding::Encode<f32, D>,
4353        T1: fidl::encoding::Encode<f32, D>,
4354    > fidl::encoding::Encode<RangeF, D> for (T0, T1)
4355    {
4356        #[inline]
4357        unsafe fn encode(
4358            self,
4359            encoder: &mut fidl::encoding::Encoder<'_, D>,
4360            offset: usize,
4361            depth: fidl::encoding::Depth,
4362        ) -> fidl::Result<()> {
4363            encoder.debug_check_bounds::<RangeF>(offset);
4364            // Zero out padding regions. There's no need to apply masks
4365            // because the unmasked parts will be overwritten by fields.
4366            // Write the fields.
4367            self.0.encode(encoder, offset + 0, depth)?;
4368            self.1.encode(encoder, offset + 4, depth)?;
4369            Ok(())
4370        }
4371    }
4372
4373    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RangeF {
4374        #[inline(always)]
4375        fn new_empty() -> Self {
4376            Self { min: fidl::new_empty!(f32, D), max: fidl::new_empty!(f32, D) }
4377        }
4378
4379        #[inline]
4380        unsafe fn decode(
4381            &mut self,
4382            decoder: &mut fidl::encoding::Decoder<'_, D>,
4383            offset: usize,
4384            _depth: fidl::encoding::Depth,
4385        ) -> fidl::Result<()> {
4386            decoder.debug_check_bounds::<Self>(offset);
4387            // Verify that padding bytes are zero.
4388            fidl::decode!(f32, D, &mut self.min, decoder, offset + 0, _depth)?;
4389            fidl::decode!(f32, D, &mut self.max, decoder, offset + 4, _depth)?;
4390            Ok(())
4391        }
4392    }
4393
4394    impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
4395        type Borrowed<'a> = &'a Self;
4396        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4397            value
4398        }
4399    }
4400
4401    unsafe impl fidl::encoding::TypeMarker for SendKeyboardInputCmd {
4402        type Owned = Self;
4403
4404        #[inline(always)]
4405        fn inline_align(_context: fidl::encoding::Context) -> usize {
4406            8
4407        }
4408
4409        #[inline(always)]
4410        fn inline_size(_context: fidl::encoding::Context) -> usize {
4411            40
4412        }
4413    }
4414
4415    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendKeyboardInputCmd, D>
4416        for &SendKeyboardInputCmd
4417    {
4418        #[inline]
4419        unsafe fn encode(
4420            self,
4421            encoder: &mut fidl::encoding::Encoder<'_, D>,
4422            offset: usize,
4423            _depth: fidl::encoding::Depth,
4424        ) -> fidl::Result<()> {
4425            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4426            // Delegate to tuple encoding.
4427            fidl::encoding::Encode::<SendKeyboardInputCmd, D>::encode(
4428                (
4429                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4430                    <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
4431                        &self.keyboard_event,
4432                    ),
4433                ),
4434                encoder,
4435                offset,
4436                _depth,
4437            )
4438        }
4439    }
4440    unsafe impl<
4441        D: fidl::encoding::ResourceDialect,
4442        T0: fidl::encoding::Encode<u32, D>,
4443        T1: fidl::encoding::Encode<KeyboardEvent, D>,
4444    > fidl::encoding::Encode<SendKeyboardInputCmd, D> for (T0, T1)
4445    {
4446        #[inline]
4447        unsafe fn encode(
4448            self,
4449            encoder: &mut fidl::encoding::Encoder<'_, D>,
4450            offset: usize,
4451            depth: fidl::encoding::Depth,
4452        ) -> fidl::Result<()> {
4453            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4454            // Zero out padding regions. There's no need to apply masks
4455            // because the unmasked parts will be overwritten by fields.
4456            unsafe {
4457                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4458                (ptr as *mut u64).write_unaligned(0);
4459            }
4460            // Write the fields.
4461            self.0.encode(encoder, offset + 0, depth)?;
4462            self.1.encode(encoder, offset + 8, depth)?;
4463            Ok(())
4464        }
4465    }
4466
4467    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendKeyboardInputCmd {
4468        #[inline(always)]
4469        fn new_empty() -> Self {
4470            Self {
4471                compositor_id: fidl::new_empty!(u32, D),
4472                keyboard_event: fidl::new_empty!(KeyboardEvent, D),
4473            }
4474        }
4475
4476        #[inline]
4477        unsafe fn decode(
4478            &mut self,
4479            decoder: &mut fidl::encoding::Decoder<'_, D>,
4480            offset: usize,
4481            _depth: fidl::encoding::Depth,
4482        ) -> fidl::Result<()> {
4483            decoder.debug_check_bounds::<Self>(offset);
4484            // Verify that padding bytes are zero.
4485            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4486            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4487            let mask = 0xffffffff00000000u64;
4488            let maskedval = padval & mask;
4489            if maskedval != 0 {
4490                return Err(fidl::Error::NonZeroPadding {
4491                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4492                });
4493            }
4494            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4495            fidl::decode!(KeyboardEvent, D, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
4496            Ok(())
4497        }
4498    }
4499
4500    impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
4501        type Borrowed<'a> = &'a Self;
4502        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4503            value
4504        }
4505    }
4506
4507    unsafe impl fidl::encoding::TypeMarker for SendPointerInputCmd {
4508        type Owned = Self;
4509
4510        #[inline(always)]
4511        fn inline_align(_context: fidl::encoding::Context) -> usize {
4512            8
4513        }
4514
4515        #[inline(always)]
4516        fn inline_size(_context: fidl::encoding::Context) -> usize {
4517            56
4518        }
4519    }
4520
4521    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendPointerInputCmd, D>
4522        for &SendPointerInputCmd
4523    {
4524        #[inline]
4525        unsafe fn encode(
4526            self,
4527            encoder: &mut fidl::encoding::Encoder<'_, D>,
4528            offset: usize,
4529            _depth: fidl::encoding::Depth,
4530        ) -> fidl::Result<()> {
4531            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4532            // Delegate to tuple encoding.
4533            fidl::encoding::Encode::<SendPointerInputCmd, D>::encode(
4534                (
4535                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4536                    <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
4537                ),
4538                encoder,
4539                offset,
4540                _depth,
4541            )
4542        }
4543    }
4544    unsafe impl<
4545        D: fidl::encoding::ResourceDialect,
4546        T0: fidl::encoding::Encode<u32, D>,
4547        T1: fidl::encoding::Encode<PointerEvent, D>,
4548    > fidl::encoding::Encode<SendPointerInputCmd, D> for (T0, T1)
4549    {
4550        #[inline]
4551        unsafe fn encode(
4552            self,
4553            encoder: &mut fidl::encoding::Encoder<'_, D>,
4554            offset: usize,
4555            depth: fidl::encoding::Depth,
4556        ) -> fidl::Result<()> {
4557            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4558            // Zero out padding regions. There's no need to apply masks
4559            // because the unmasked parts will be overwritten by fields.
4560            unsafe {
4561                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4562                (ptr as *mut u64).write_unaligned(0);
4563            }
4564            // Write the fields.
4565            self.0.encode(encoder, offset + 0, depth)?;
4566            self.1.encode(encoder, offset + 8, depth)?;
4567            Ok(())
4568        }
4569    }
4570
4571    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendPointerInputCmd {
4572        #[inline(always)]
4573        fn new_empty() -> Self {
4574            Self {
4575                compositor_id: fidl::new_empty!(u32, D),
4576                pointer_event: fidl::new_empty!(PointerEvent, D),
4577            }
4578        }
4579
4580        #[inline]
4581        unsafe fn decode(
4582            &mut self,
4583            decoder: &mut fidl::encoding::Decoder<'_, D>,
4584            offset: usize,
4585            _depth: fidl::encoding::Depth,
4586        ) -> fidl::Result<()> {
4587            decoder.debug_check_bounds::<Self>(offset);
4588            // Verify that padding bytes are zero.
4589            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4590            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4591            let mask = 0xffffffff00000000u64;
4592            let maskedval = padval & mask;
4593            if maskedval != 0 {
4594                return Err(fidl::Error::NonZeroPadding {
4595                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4596                });
4597            }
4598            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4599            fidl::decode!(PointerEvent, D, &mut self.pointer_event, decoder, offset + 8, _depth)?;
4600            Ok(())
4601        }
4602    }
4603
4604    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
4605        type Borrowed<'a> = &'a Self;
4606        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4607            value
4608        }
4609    }
4610
4611    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
4612        type Owned = Self;
4613
4614        #[inline(always)]
4615        fn inline_align(_context: fidl::encoding::Context) -> usize {
4616            4
4617        }
4618
4619        #[inline(always)]
4620        fn inline_size(_context: fidl::encoding::Context) -> usize {
4621            28
4622        }
4623    }
4624
4625    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
4626        for &SensorDescriptor
4627    {
4628        #[inline]
4629        unsafe fn encode(
4630            self,
4631            encoder: &mut fidl::encoding::Encoder<'_, D>,
4632            offset: usize,
4633            _depth: fidl::encoding::Depth,
4634        ) -> fidl::Result<()> {
4635            encoder.debug_check_bounds::<SensorDescriptor>(offset);
4636            // Delegate to tuple encoding.
4637            fidl::encoding::Encode::<SensorDescriptor, D>::encode(
4638                (
4639                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4640                    <SensorLocation as fidl::encoding::ValueTypeMarker>::borrow(&self.loc),
4641                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_sampling_freq),
4642                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_sampling_freq),
4643                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fifo_max_event_count),
4644                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_min),
4645                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_max),
4646                ),
4647                encoder,
4648                offset,
4649                _depth,
4650            )
4651        }
4652    }
4653    unsafe impl<
4654        D: fidl::encoding::ResourceDialect,
4655        T0: fidl::encoding::Encode<SensorType, D>,
4656        T1: fidl::encoding::Encode<SensorLocation, D>,
4657        T2: fidl::encoding::Encode<u32, D>,
4658        T3: fidl::encoding::Encode<u32, D>,
4659        T4: fidl::encoding::Encode<u32, D>,
4660        T5: fidl::encoding::Encode<i32, D>,
4661        T6: fidl::encoding::Encode<i32, D>,
4662    > fidl::encoding::Encode<SensorDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
4663    {
4664        #[inline]
4665        unsafe fn encode(
4666            self,
4667            encoder: &mut fidl::encoding::Encoder<'_, D>,
4668            offset: usize,
4669            depth: fidl::encoding::Depth,
4670        ) -> fidl::Result<()> {
4671            encoder.debug_check_bounds::<SensorDescriptor>(offset);
4672            // Zero out padding regions. There's no need to apply masks
4673            // because the unmasked parts will be overwritten by fields.
4674            // Write the fields.
4675            self.0.encode(encoder, offset + 0, depth)?;
4676            self.1.encode(encoder, offset + 4, depth)?;
4677            self.2.encode(encoder, offset + 8, depth)?;
4678            self.3.encode(encoder, offset + 12, depth)?;
4679            self.4.encode(encoder, offset + 16, depth)?;
4680            self.5.encode(encoder, offset + 20, depth)?;
4681            self.6.encode(encoder, offset + 24, depth)?;
4682            Ok(())
4683        }
4684    }
4685
4686    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
4687        #[inline(always)]
4688        fn new_empty() -> Self {
4689            Self {
4690                type_: fidl::new_empty!(SensorType, D),
4691                loc: fidl::new_empty!(SensorLocation, D),
4692                min_sampling_freq: fidl::new_empty!(u32, D),
4693                max_sampling_freq: fidl::new_empty!(u32, D),
4694                fifo_max_event_count: fidl::new_empty!(u32, D),
4695                phys_min: fidl::new_empty!(i32, D),
4696                phys_max: fidl::new_empty!(i32, D),
4697            }
4698        }
4699
4700        #[inline]
4701        unsafe fn decode(
4702            &mut self,
4703            decoder: &mut fidl::encoding::Decoder<'_, D>,
4704            offset: usize,
4705            _depth: fidl::encoding::Depth,
4706        ) -> fidl::Result<()> {
4707            decoder.debug_check_bounds::<Self>(offset);
4708            // Verify that padding bytes are zero.
4709            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 0, _depth)?;
4710            fidl::decode!(SensorLocation, D, &mut self.loc, decoder, offset + 4, _depth)?;
4711            fidl::decode!(u32, D, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
4712            fidl::decode!(u32, D, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
4713            fidl::decode!(u32, D, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
4714            fidl::decode!(i32, D, &mut self.phys_min, decoder, offset + 20, _depth)?;
4715            fidl::decode!(i32, D, &mut self.phys_max, decoder, offset + 24, _depth)?;
4716            Ok(())
4717        }
4718    }
4719
4720    impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
4721        type Borrowed<'a> = &'a Self;
4722        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4723            value
4724        }
4725    }
4726
4727    unsafe impl fidl::encoding::TypeMarker for SetHardKeyboardDeliveryCmd {
4728        type Owned = Self;
4729
4730        #[inline(always)]
4731        fn inline_align(_context: fidl::encoding::Context) -> usize {
4732            1
4733        }
4734
4735        #[inline(always)]
4736        fn inline_size(_context: fidl::encoding::Context) -> usize {
4737            1
4738        }
4739    }
4740
4741    unsafe impl<D: fidl::encoding::ResourceDialect>
4742        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for &SetHardKeyboardDeliveryCmd
4743    {
4744        #[inline]
4745        unsafe fn encode(
4746            self,
4747            encoder: &mut fidl::encoding::Encoder<'_, D>,
4748            offset: usize,
4749            _depth: fidl::encoding::Depth,
4750        ) -> fidl::Result<()> {
4751            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4752            // Delegate to tuple encoding.
4753            fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd, D>::encode(
4754                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
4755                encoder,
4756                offset,
4757                _depth,
4758            )
4759        }
4760    }
4761    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4762        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for (T0,)
4763    {
4764        #[inline]
4765        unsafe fn encode(
4766            self,
4767            encoder: &mut fidl::encoding::Encoder<'_, D>,
4768            offset: usize,
4769            depth: fidl::encoding::Depth,
4770        ) -> fidl::Result<()> {
4771            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4772            // Zero out padding regions. There's no need to apply masks
4773            // because the unmasked parts will be overwritten by fields.
4774            // Write the fields.
4775            self.0.encode(encoder, offset + 0, depth)?;
4776            Ok(())
4777        }
4778    }
4779
4780    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4781        for SetHardKeyboardDeliveryCmd
4782    {
4783        #[inline(always)]
4784        fn new_empty() -> Self {
4785            Self { delivery_request: fidl::new_empty!(bool, D) }
4786        }
4787
4788        #[inline]
4789        unsafe fn decode(
4790            &mut self,
4791            decoder: &mut fidl::encoding::Decoder<'_, D>,
4792            offset: usize,
4793            _depth: fidl::encoding::Depth,
4794        ) -> fidl::Result<()> {
4795            decoder.debug_check_bounds::<Self>(offset);
4796            // Verify that padding bytes are zero.
4797            fidl::decode!(bool, D, &mut self.delivery_request, decoder, offset + 0, _depth)?;
4798            Ok(())
4799        }
4800    }
4801
4802    impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
4803        type Borrowed<'a> = &'a Self;
4804        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4805            value
4806        }
4807    }
4808
4809    unsafe impl fidl::encoding::TypeMarker for SetParallelDispatchCmd {
4810        type Owned = Self;
4811
4812        #[inline(always)]
4813        fn inline_align(_context: fidl::encoding::Context) -> usize {
4814            1
4815        }
4816
4817        #[inline(always)]
4818        fn inline_size(_context: fidl::encoding::Context) -> usize {
4819            1
4820        }
4821    }
4822
4823    unsafe impl<D: fidl::encoding::ResourceDialect>
4824        fidl::encoding::Encode<SetParallelDispatchCmd, D> for &SetParallelDispatchCmd
4825    {
4826        #[inline]
4827        unsafe fn encode(
4828            self,
4829            encoder: &mut fidl::encoding::Encoder<'_, D>,
4830            offset: usize,
4831            _depth: fidl::encoding::Depth,
4832        ) -> fidl::Result<()> {
4833            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4834            // Delegate to tuple encoding.
4835            fidl::encoding::Encode::<SetParallelDispatchCmd, D>::encode(
4836                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
4837                encoder,
4838                offset,
4839                _depth,
4840            )
4841        }
4842    }
4843    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4844        fidl::encoding::Encode<SetParallelDispatchCmd, D> for (T0,)
4845    {
4846        #[inline]
4847        unsafe fn encode(
4848            self,
4849            encoder: &mut fidl::encoding::Encoder<'_, D>,
4850            offset: usize,
4851            depth: fidl::encoding::Depth,
4852        ) -> fidl::Result<()> {
4853            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4854            // Zero out padding regions. There's no need to apply masks
4855            // because the unmasked parts will be overwritten by fields.
4856            // Write the fields.
4857            self.0.encode(encoder, offset + 0, depth)?;
4858            Ok(())
4859        }
4860    }
4861
4862    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4863        for SetParallelDispatchCmd
4864    {
4865        #[inline(always)]
4866        fn new_empty() -> Self {
4867            Self { parallel_dispatch: fidl::new_empty!(bool, D) }
4868        }
4869
4870        #[inline]
4871        unsafe fn decode(
4872            &mut self,
4873            decoder: &mut fidl::encoding::Decoder<'_, D>,
4874            offset: usize,
4875            _depth: fidl::encoding::Depth,
4876        ) -> fidl::Result<()> {
4877            decoder.debug_check_bounds::<Self>(offset);
4878            // Verify that padding bytes are zero.
4879            fidl::decode!(bool, D, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
4880            Ok(())
4881        }
4882    }
4883
4884    impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
4885        type Borrowed<'a> = &'a Self;
4886        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4887            value
4888        }
4889    }
4890
4891    unsafe impl fidl::encoding::TypeMarker for StylusDescriptor {
4892        type Owned = Self;
4893
4894        #[inline(always)]
4895        fn inline_align(_context: fidl::encoding::Context) -> usize {
4896            8
4897        }
4898
4899        #[inline(always)]
4900        fn inline_size(_context: fidl::encoding::Context) -> usize {
4901            48
4902        }
4903    }
4904
4905    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusDescriptor, D>
4906        for &StylusDescriptor
4907    {
4908        #[inline]
4909        unsafe fn encode(
4910            self,
4911            encoder: &mut fidl::encoding::Encoder<'_, D>,
4912            offset: usize,
4913            _depth: fidl::encoding::Depth,
4914        ) -> fidl::Result<()> {
4915            encoder.debug_check_bounds::<StylusDescriptor>(offset);
4916            // Delegate to tuple encoding.
4917            fidl::encoding::Encode::<StylusDescriptor, D>::encode(
4918                (
4919                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4920                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4921                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
4922                        &self.pressure,
4923                    ),
4924                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_invertible),
4925                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4926                ),
4927                encoder,
4928                offset,
4929                _depth,
4930            )
4931        }
4932    }
4933    unsafe impl<
4934        D: fidl::encoding::ResourceDialect,
4935        T0: fidl::encoding::Encode<Axis, D>,
4936        T1: fidl::encoding::Encode<Axis, D>,
4937        T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
4938        T3: fidl::encoding::Encode<bool, D>,
4939        T4: fidl::encoding::Encode<u32, D>,
4940    > fidl::encoding::Encode<StylusDescriptor, D> for (T0, T1, T2, T3, T4)
4941    {
4942        #[inline]
4943        unsafe fn encode(
4944            self,
4945            encoder: &mut fidl::encoding::Encoder<'_, D>,
4946            offset: usize,
4947            depth: fidl::encoding::Depth,
4948        ) -> fidl::Result<()> {
4949            encoder.debug_check_bounds::<StylusDescriptor>(offset);
4950            // Zero out padding regions. There's no need to apply masks
4951            // because the unmasked parts will be overwritten by fields.
4952            unsafe {
4953                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4954                (ptr as *mut u64).write_unaligned(0);
4955            }
4956            // Write the fields.
4957            self.0.encode(encoder, offset + 0, depth)?;
4958            self.1.encode(encoder, offset + 16, depth)?;
4959            self.2.encode(encoder, offset + 32, depth)?;
4960            self.3.encode(encoder, offset + 40, depth)?;
4961            self.4.encode(encoder, offset + 44, depth)?;
4962            Ok(())
4963        }
4964    }
4965
4966    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusDescriptor {
4967        #[inline(always)]
4968        fn new_empty() -> Self {
4969            Self {
4970                x: fidl::new_empty!(Axis, D),
4971                y: fidl::new_empty!(Axis, D),
4972                pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
4973                is_invertible: fidl::new_empty!(bool, D),
4974                buttons: fidl::new_empty!(u32, D),
4975            }
4976        }
4977
4978        #[inline]
4979        unsafe fn decode(
4980            &mut self,
4981            decoder: &mut fidl::encoding::Decoder<'_, D>,
4982            offset: usize,
4983            _depth: fidl::encoding::Depth,
4984        ) -> fidl::Result<()> {
4985            decoder.debug_check_bounds::<Self>(offset);
4986            // Verify that padding bytes are zero.
4987            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4988            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4989            let mask = 0xffffff00u64;
4990            let maskedval = padval & mask;
4991            if maskedval != 0 {
4992                return Err(fidl::Error::NonZeroPadding {
4993                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4994                });
4995            }
4996            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
4997            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
4998            fidl::decode!(
4999                fidl::encoding::Boxed<Axis>,
5000                D,
5001                &mut self.pressure,
5002                decoder,
5003                offset + 32,
5004                _depth
5005            )?;
5006            fidl::decode!(bool, D, &mut self.is_invertible, decoder, offset + 40, _depth)?;
5007            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 44, _depth)?;
5008            Ok(())
5009        }
5010    }
5011
5012    impl fidl::encoding::ValueTypeMarker for StylusReport {
5013        type Borrowed<'a> = &'a Self;
5014        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5015            value
5016        }
5017    }
5018
5019    unsafe impl fidl::encoding::TypeMarker for StylusReport {
5020        type Owned = Self;
5021
5022        #[inline(always)]
5023        fn inline_align(_context: fidl::encoding::Context) -> usize {
5024            4
5025        }
5026
5027        #[inline(always)]
5028        fn inline_size(_context: fidl::encoding::Context) -> usize {
5029            20
5030        }
5031    }
5032
5033    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusReport, D>
5034        for &StylusReport
5035    {
5036        #[inline]
5037        unsafe fn encode(
5038            self,
5039            encoder: &mut fidl::encoding::Encoder<'_, D>,
5040            offset: usize,
5041            _depth: fidl::encoding::Depth,
5042        ) -> fidl::Result<()> {
5043            encoder.debug_check_bounds::<StylusReport>(offset);
5044            // Delegate to tuple encoding.
5045            fidl::encoding::Encode::<StylusReport, D>::encode(
5046                (
5047                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5048                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5049                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressure),
5050                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_in_contact),
5051                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_range),
5052                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_inverted),
5053                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_buttons),
5054                ),
5055                encoder,
5056                offset,
5057                _depth,
5058            )
5059        }
5060    }
5061    unsafe impl<
5062        D: fidl::encoding::ResourceDialect,
5063        T0: fidl::encoding::Encode<i32, D>,
5064        T1: fidl::encoding::Encode<i32, D>,
5065        T2: fidl::encoding::Encode<u32, D>,
5066        T3: fidl::encoding::Encode<bool, D>,
5067        T4: fidl::encoding::Encode<bool, D>,
5068        T5: fidl::encoding::Encode<bool, D>,
5069        T6: fidl::encoding::Encode<u32, D>,
5070    > fidl::encoding::Encode<StylusReport, D> for (T0, T1, T2, T3, T4, T5, T6)
5071    {
5072        #[inline]
5073        unsafe fn encode(
5074            self,
5075            encoder: &mut fidl::encoding::Encoder<'_, D>,
5076            offset: usize,
5077            depth: fidl::encoding::Depth,
5078        ) -> fidl::Result<()> {
5079            encoder.debug_check_bounds::<StylusReport>(offset);
5080            // Zero out padding regions. There's no need to apply masks
5081            // because the unmasked parts will be overwritten by fields.
5082            unsafe {
5083                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
5084                (ptr as *mut u32).write_unaligned(0);
5085            }
5086            // Write the fields.
5087            self.0.encode(encoder, offset + 0, depth)?;
5088            self.1.encode(encoder, offset + 4, depth)?;
5089            self.2.encode(encoder, offset + 8, depth)?;
5090            self.3.encode(encoder, offset + 12, depth)?;
5091            self.4.encode(encoder, offset + 13, depth)?;
5092            self.5.encode(encoder, offset + 14, depth)?;
5093            self.6.encode(encoder, offset + 16, depth)?;
5094            Ok(())
5095        }
5096    }
5097
5098    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusReport {
5099        #[inline(always)]
5100        fn new_empty() -> Self {
5101            Self {
5102                x: fidl::new_empty!(i32, D),
5103                y: fidl::new_empty!(i32, D),
5104                pressure: fidl::new_empty!(u32, D),
5105                is_in_contact: fidl::new_empty!(bool, D),
5106                in_range: fidl::new_empty!(bool, D),
5107                is_inverted: fidl::new_empty!(bool, D),
5108                pressed_buttons: fidl::new_empty!(u32, D),
5109            }
5110        }
5111
5112        #[inline]
5113        unsafe fn decode(
5114            &mut self,
5115            decoder: &mut fidl::encoding::Decoder<'_, D>,
5116            offset: usize,
5117            _depth: fidl::encoding::Depth,
5118        ) -> fidl::Result<()> {
5119            decoder.debug_check_bounds::<Self>(offset);
5120            // Verify that padding bytes are zero.
5121            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
5122            let padval = unsafe { (ptr as *const u32).read_unaligned() };
5123            let mask = 0xff000000u32;
5124            let maskedval = padval & mask;
5125            if maskedval != 0 {
5126                return Err(fidl::Error::NonZeroPadding {
5127                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
5128                });
5129            }
5130            fidl::decode!(i32, D, &mut self.x, decoder, offset + 0, _depth)?;
5131            fidl::decode!(i32, D, &mut self.y, decoder, offset + 4, _depth)?;
5132            fidl::decode!(u32, D, &mut self.pressure, decoder, offset + 8, _depth)?;
5133            fidl::decode!(bool, D, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
5134            fidl::decode!(bool, D, &mut self.in_range, decoder, offset + 13, _depth)?;
5135            fidl::decode!(bool, D, &mut self.is_inverted, decoder, offset + 14, _depth)?;
5136            fidl::decode!(u32, D, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
5137            Ok(())
5138        }
5139    }
5140
5141    impl fidl::encoding::ValueTypeMarker for TextInputState {
5142        type Borrowed<'a> = &'a Self;
5143        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5144            value
5145        }
5146    }
5147
5148    unsafe impl fidl::encoding::TypeMarker for TextInputState {
5149        type Owned = Self;
5150
5151        #[inline(always)]
5152        fn inline_align(_context: fidl::encoding::Context) -> usize {
5153            8
5154        }
5155
5156        #[inline(always)]
5157        fn inline_size(_context: fidl::encoding::Context) -> usize {
5158            64
5159        }
5160    }
5161
5162    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextInputState, D>
5163        for &TextInputState
5164    {
5165        #[inline]
5166        unsafe fn encode(
5167            self,
5168            encoder: &mut fidl::encoding::Encoder<'_, D>,
5169            offset: usize,
5170            _depth: fidl::encoding::Depth,
5171        ) -> fidl::Result<()> {
5172            encoder.debug_check_bounds::<TextInputState>(offset);
5173            // Delegate to tuple encoding.
5174            fidl::encoding::Encode::<TextInputState, D>::encode(
5175                (
5176                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision),
5177                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
5178                        &self.text,
5179                    ),
5180                    <TextSelection as fidl::encoding::ValueTypeMarker>::borrow(&self.selection),
5181                    <TextRange as fidl::encoding::ValueTypeMarker>::borrow(&self.composing),
5182                ),
5183                encoder,
5184                offset,
5185                _depth,
5186            )
5187        }
5188    }
5189    unsafe impl<
5190        D: fidl::encoding::ResourceDialect,
5191        T0: fidl::encoding::Encode<u32, D>,
5192        T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
5193        T2: fidl::encoding::Encode<TextSelection, D>,
5194        T3: fidl::encoding::Encode<TextRange, D>,
5195    > fidl::encoding::Encode<TextInputState, D> for (T0, T1, T2, T3)
5196    {
5197        #[inline]
5198        unsafe fn encode(
5199            self,
5200            encoder: &mut fidl::encoding::Encoder<'_, D>,
5201            offset: usize,
5202            depth: fidl::encoding::Depth,
5203        ) -> fidl::Result<()> {
5204            encoder.debug_check_bounds::<TextInputState>(offset);
5205            // Zero out padding regions. There's no need to apply masks
5206            // because the unmasked parts will be overwritten by fields.
5207            unsafe {
5208                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5209                (ptr as *mut u64).write_unaligned(0);
5210            }
5211            // Write the fields.
5212            self.0.encode(encoder, offset + 0, depth)?;
5213            self.1.encode(encoder, offset + 8, depth)?;
5214            self.2.encode(encoder, offset + 24, depth)?;
5215            self.3.encode(encoder, offset + 48, depth)?;
5216            Ok(())
5217        }
5218    }
5219
5220    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextInputState {
5221        #[inline(always)]
5222        fn new_empty() -> Self {
5223            Self {
5224                revision: fidl::new_empty!(u32, D),
5225                text: fidl::new_empty!(fidl::encoding::UnboundedString, D),
5226                selection: fidl::new_empty!(TextSelection, D),
5227                composing: fidl::new_empty!(TextRange, D),
5228            }
5229        }
5230
5231        #[inline]
5232        unsafe fn decode(
5233            &mut self,
5234            decoder: &mut fidl::encoding::Decoder<'_, D>,
5235            offset: usize,
5236            _depth: fidl::encoding::Depth,
5237        ) -> fidl::Result<()> {
5238            decoder.debug_check_bounds::<Self>(offset);
5239            // Verify that padding bytes are zero.
5240            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5241            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5242            let mask = 0xffffffff00000000u64;
5243            let maskedval = padval & mask;
5244            if maskedval != 0 {
5245                return Err(fidl::Error::NonZeroPadding {
5246                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5247                });
5248            }
5249            fidl::decode!(u32, D, &mut self.revision, decoder, offset + 0, _depth)?;
5250            fidl::decode!(
5251                fidl::encoding::UnboundedString,
5252                D,
5253                &mut self.text,
5254                decoder,
5255                offset + 8,
5256                _depth
5257            )?;
5258            fidl::decode!(TextSelection, D, &mut self.selection, decoder, offset + 24, _depth)?;
5259            fidl::decode!(TextRange, D, &mut self.composing, decoder, offset + 48, _depth)?;
5260            Ok(())
5261        }
5262    }
5263
5264    impl fidl::encoding::ValueTypeMarker for TextRange {
5265        type Borrowed<'a> = &'a Self;
5266        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5267            value
5268        }
5269    }
5270
5271    unsafe impl fidl::encoding::TypeMarker for TextRange {
5272        type Owned = Self;
5273
5274        #[inline(always)]
5275        fn inline_align(_context: fidl::encoding::Context) -> usize {
5276            8
5277        }
5278
5279        #[inline(always)]
5280        fn inline_size(_context: fidl::encoding::Context) -> usize {
5281            16
5282        }
5283        #[inline(always)]
5284        fn encode_is_copy() -> bool {
5285            true
5286        }
5287
5288        #[inline(always)]
5289        fn decode_is_copy() -> bool {
5290            true
5291        }
5292    }
5293
5294    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextRange, D>
5295        for &TextRange
5296    {
5297        #[inline]
5298        unsafe fn encode(
5299            self,
5300            encoder: &mut fidl::encoding::Encoder<'_, D>,
5301            offset: usize,
5302            _depth: fidl::encoding::Depth,
5303        ) -> fidl::Result<()> {
5304            encoder.debug_check_bounds::<TextRange>(offset);
5305            unsafe {
5306                // Copy the object into the buffer.
5307                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5308                (buf_ptr as *mut TextRange).write_unaligned((self as *const TextRange).read());
5309                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5310                // done second because the memcpy will write garbage to these bytes.
5311            }
5312            Ok(())
5313        }
5314    }
5315    unsafe impl<
5316        D: fidl::encoding::ResourceDialect,
5317        T0: fidl::encoding::Encode<i64, D>,
5318        T1: fidl::encoding::Encode<i64, D>,
5319    > fidl::encoding::Encode<TextRange, D> for (T0, T1)
5320    {
5321        #[inline]
5322        unsafe fn encode(
5323            self,
5324            encoder: &mut fidl::encoding::Encoder<'_, D>,
5325            offset: usize,
5326            depth: fidl::encoding::Depth,
5327        ) -> fidl::Result<()> {
5328            encoder.debug_check_bounds::<TextRange>(offset);
5329            // Zero out padding regions. There's no need to apply masks
5330            // because the unmasked parts will be overwritten by fields.
5331            // Write the fields.
5332            self.0.encode(encoder, offset + 0, depth)?;
5333            self.1.encode(encoder, offset + 8, depth)?;
5334            Ok(())
5335        }
5336    }
5337
5338    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextRange {
5339        #[inline(always)]
5340        fn new_empty() -> Self {
5341            Self { start: fidl::new_empty!(i64, D), end: fidl::new_empty!(i64, D) }
5342        }
5343
5344        #[inline]
5345        unsafe fn decode(
5346            &mut self,
5347            decoder: &mut fidl::encoding::Decoder<'_, D>,
5348            offset: usize,
5349            _depth: fidl::encoding::Depth,
5350        ) -> fidl::Result<()> {
5351            decoder.debug_check_bounds::<Self>(offset);
5352            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5353            // Verify that padding bytes are zero.
5354            // Copy from the buffer into the object.
5355            unsafe {
5356                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
5357            }
5358            Ok(())
5359        }
5360    }
5361
5362    impl fidl::encoding::ValueTypeMarker for TextSelection {
5363        type Borrowed<'a> = &'a Self;
5364        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5365            value
5366        }
5367    }
5368
5369    unsafe impl fidl::encoding::TypeMarker for TextSelection {
5370        type Owned = Self;
5371
5372        #[inline(always)]
5373        fn inline_align(_context: fidl::encoding::Context) -> usize {
5374            8
5375        }
5376
5377        #[inline(always)]
5378        fn inline_size(_context: fidl::encoding::Context) -> usize {
5379            24
5380        }
5381    }
5382
5383    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextSelection, D>
5384        for &TextSelection
5385    {
5386        #[inline]
5387        unsafe fn encode(
5388            self,
5389            encoder: &mut fidl::encoding::Encoder<'_, D>,
5390            offset: usize,
5391            _depth: fidl::encoding::Depth,
5392        ) -> fidl::Result<()> {
5393            encoder.debug_check_bounds::<TextSelection>(offset);
5394            // Delegate to tuple encoding.
5395            fidl::encoding::Encode::<TextSelection, D>::encode(
5396                (
5397                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
5398                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
5399                    <TextAffinity as fidl::encoding::ValueTypeMarker>::borrow(&self.affinity),
5400                ),
5401                encoder,
5402                offset,
5403                _depth,
5404            )
5405        }
5406    }
5407    unsafe impl<
5408        D: fidl::encoding::ResourceDialect,
5409        T0: fidl::encoding::Encode<i64, D>,
5410        T1: fidl::encoding::Encode<i64, D>,
5411        T2: fidl::encoding::Encode<TextAffinity, D>,
5412    > fidl::encoding::Encode<TextSelection, D> for (T0, T1, T2)
5413    {
5414        #[inline]
5415        unsafe fn encode(
5416            self,
5417            encoder: &mut fidl::encoding::Encoder<'_, D>,
5418            offset: usize,
5419            depth: fidl::encoding::Depth,
5420        ) -> fidl::Result<()> {
5421            encoder.debug_check_bounds::<TextSelection>(offset);
5422            // Zero out padding regions. There's no need to apply masks
5423            // because the unmasked parts will be overwritten by fields.
5424            unsafe {
5425                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5426                (ptr as *mut u64).write_unaligned(0);
5427            }
5428            // Write the fields.
5429            self.0.encode(encoder, offset + 0, depth)?;
5430            self.1.encode(encoder, offset + 8, depth)?;
5431            self.2.encode(encoder, offset + 16, depth)?;
5432            Ok(())
5433        }
5434    }
5435
5436    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextSelection {
5437        #[inline(always)]
5438        fn new_empty() -> Self {
5439            Self {
5440                base: fidl::new_empty!(i64, D),
5441                extent: fidl::new_empty!(i64, D),
5442                affinity: fidl::new_empty!(TextAffinity, D),
5443            }
5444        }
5445
5446        #[inline]
5447        unsafe fn decode(
5448            &mut self,
5449            decoder: &mut fidl::encoding::Decoder<'_, D>,
5450            offset: usize,
5451            _depth: fidl::encoding::Depth,
5452        ) -> fidl::Result<()> {
5453            decoder.debug_check_bounds::<Self>(offset);
5454            // Verify that padding bytes are zero.
5455            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5456            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5457            let mask = 0xffffffff00000000u64;
5458            let maskedval = padval & mask;
5459            if maskedval != 0 {
5460                return Err(fidl::Error::NonZeroPadding {
5461                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5462                });
5463            }
5464            fidl::decode!(i64, D, &mut self.base, decoder, offset + 0, _depth)?;
5465            fidl::decode!(i64, D, &mut self.extent, decoder, offset + 8, _depth)?;
5466            fidl::decode!(TextAffinity, D, &mut self.affinity, decoder, offset + 16, _depth)?;
5467            Ok(())
5468        }
5469    }
5470
5471    impl fidl::encoding::ValueTypeMarker for Touch {
5472        type Borrowed<'a> = &'a Self;
5473        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5474            value
5475        }
5476    }
5477
5478    unsafe impl fidl::encoding::TypeMarker for Touch {
5479        type Owned = Self;
5480
5481        #[inline(always)]
5482        fn inline_align(_context: fidl::encoding::Context) -> usize {
5483            4
5484        }
5485
5486        #[inline(always)]
5487        fn inline_size(_context: fidl::encoding::Context) -> usize {
5488            20
5489        }
5490        #[inline(always)]
5491        fn encode_is_copy() -> bool {
5492            true
5493        }
5494
5495        #[inline(always)]
5496        fn decode_is_copy() -> bool {
5497            true
5498        }
5499    }
5500
5501    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Touch, D> for &Touch {
5502        #[inline]
5503        unsafe fn encode(
5504            self,
5505            encoder: &mut fidl::encoding::Encoder<'_, D>,
5506            offset: usize,
5507            _depth: fidl::encoding::Depth,
5508        ) -> fidl::Result<()> {
5509            encoder.debug_check_bounds::<Touch>(offset);
5510            unsafe {
5511                // Copy the object into the buffer.
5512                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5513                (buf_ptr as *mut Touch).write_unaligned((self as *const Touch).read());
5514                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5515                // done second because the memcpy will write garbage to these bytes.
5516            }
5517            Ok(())
5518        }
5519    }
5520    unsafe impl<
5521        D: fidl::encoding::ResourceDialect,
5522        T0: fidl::encoding::Encode<u32, D>,
5523        T1: fidl::encoding::Encode<i32, D>,
5524        T2: fidl::encoding::Encode<i32, D>,
5525        T3: fidl::encoding::Encode<u32, D>,
5526        T4: fidl::encoding::Encode<u32, D>,
5527    > fidl::encoding::Encode<Touch, D> for (T0, T1, T2, T3, T4)
5528    {
5529        #[inline]
5530        unsafe fn encode(
5531            self,
5532            encoder: &mut fidl::encoding::Encoder<'_, D>,
5533            offset: usize,
5534            depth: fidl::encoding::Depth,
5535        ) -> fidl::Result<()> {
5536            encoder.debug_check_bounds::<Touch>(offset);
5537            // Zero out padding regions. There's no need to apply masks
5538            // because the unmasked parts will be overwritten by fields.
5539            // Write the fields.
5540            self.0.encode(encoder, offset + 0, depth)?;
5541            self.1.encode(encoder, offset + 4, depth)?;
5542            self.2.encode(encoder, offset + 8, depth)?;
5543            self.3.encode(encoder, offset + 12, depth)?;
5544            self.4.encode(encoder, offset + 16, depth)?;
5545            Ok(())
5546        }
5547    }
5548
5549    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Touch {
5550        #[inline(always)]
5551        fn new_empty() -> Self {
5552            Self {
5553                finger_id: fidl::new_empty!(u32, D),
5554                x: fidl::new_empty!(i32, D),
5555                y: fidl::new_empty!(i32, D),
5556                width: fidl::new_empty!(u32, D),
5557                height: 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            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5570            // Verify that padding bytes are zero.
5571            // Copy from the buffer into the object.
5572            unsafe {
5573                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
5574            }
5575            Ok(())
5576        }
5577    }
5578
5579    impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
5580        type Borrowed<'a> = &'a Self;
5581        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5582            value
5583        }
5584    }
5585
5586    unsafe impl fidl::encoding::TypeMarker for TouchscreenDescriptor {
5587        type Owned = Self;
5588
5589        #[inline(always)]
5590        fn inline_align(_context: fidl::encoding::Context) -> usize {
5591            4
5592        }
5593
5594        #[inline(always)]
5595        fn inline_size(_context: fidl::encoding::Context) -> usize {
5596            36
5597        }
5598    }
5599
5600    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenDescriptor, D>
5601        for &TouchscreenDescriptor
5602    {
5603        #[inline]
5604        unsafe fn encode(
5605            self,
5606            encoder: &mut fidl::encoding::Encoder<'_, D>,
5607            offset: usize,
5608            _depth: fidl::encoding::Depth,
5609        ) -> fidl::Result<()> {
5610            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5611            // Delegate to tuple encoding.
5612            fidl::encoding::Encode::<TouchscreenDescriptor, D>::encode(
5613                (
5614                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5615                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5616                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_finger_id),
5617                ),
5618                encoder,
5619                offset,
5620                _depth,
5621            )
5622        }
5623    }
5624    unsafe impl<
5625        D: fidl::encoding::ResourceDialect,
5626        T0: fidl::encoding::Encode<Axis, D>,
5627        T1: fidl::encoding::Encode<Axis, D>,
5628        T2: fidl::encoding::Encode<u32, D>,
5629    > fidl::encoding::Encode<TouchscreenDescriptor, D> for (T0, T1, T2)
5630    {
5631        #[inline]
5632        unsafe fn encode(
5633            self,
5634            encoder: &mut fidl::encoding::Encoder<'_, D>,
5635            offset: usize,
5636            depth: fidl::encoding::Depth,
5637        ) -> fidl::Result<()> {
5638            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5639            // Zero out padding regions. There's no need to apply masks
5640            // because the unmasked parts will be overwritten by fields.
5641            // Write the fields.
5642            self.0.encode(encoder, offset + 0, depth)?;
5643            self.1.encode(encoder, offset + 16, depth)?;
5644            self.2.encode(encoder, offset + 32, depth)?;
5645            Ok(())
5646        }
5647    }
5648
5649    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenDescriptor {
5650        #[inline(always)]
5651        fn new_empty() -> Self {
5652            Self {
5653                x: fidl::new_empty!(Axis, D),
5654                y: fidl::new_empty!(Axis, D),
5655                max_finger_id: fidl::new_empty!(u32, D),
5656            }
5657        }
5658
5659        #[inline]
5660        unsafe fn decode(
5661            &mut self,
5662            decoder: &mut fidl::encoding::Decoder<'_, D>,
5663            offset: usize,
5664            _depth: fidl::encoding::Depth,
5665        ) -> fidl::Result<()> {
5666            decoder.debug_check_bounds::<Self>(offset);
5667            // Verify that padding bytes are zero.
5668            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
5669            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
5670            fidl::decode!(u32, D, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
5671            Ok(())
5672        }
5673    }
5674
5675    impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
5676        type Borrowed<'a> = &'a Self;
5677        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5678            value
5679        }
5680    }
5681
5682    unsafe impl fidl::encoding::TypeMarker for TouchscreenReport {
5683        type Owned = Self;
5684
5685        #[inline(always)]
5686        fn inline_align(_context: fidl::encoding::Context) -> usize {
5687            8
5688        }
5689
5690        #[inline(always)]
5691        fn inline_size(_context: fidl::encoding::Context) -> usize {
5692            16
5693        }
5694    }
5695
5696    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenReport, D>
5697        for &TouchscreenReport
5698    {
5699        #[inline]
5700        unsafe fn encode(
5701            self,
5702            encoder: &mut fidl::encoding::Encoder<'_, D>,
5703            offset: usize,
5704            _depth: fidl::encoding::Depth,
5705        ) -> fidl::Result<()> {
5706            encoder.debug_check_bounds::<TouchscreenReport>(offset);
5707            // Delegate to tuple encoding.
5708            fidl::encoding::Encode::<TouchscreenReport, D>::encode(
5709                (
5710                    <fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
5711                ),
5712                encoder, offset, _depth
5713            )
5714        }
5715    }
5716    unsafe impl<
5717        D: fidl::encoding::ResourceDialect,
5718        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>, D>,
5719    > fidl::encoding::Encode<TouchscreenReport, D> for (T0,)
5720    {
5721        #[inline]
5722        unsafe fn encode(
5723            self,
5724            encoder: &mut fidl::encoding::Encoder<'_, D>,
5725            offset: usize,
5726            depth: fidl::encoding::Depth,
5727        ) -> fidl::Result<()> {
5728            encoder.debug_check_bounds::<TouchscreenReport>(offset);
5729            // Zero out padding regions. There's no need to apply masks
5730            // because the unmasked parts will be overwritten by fields.
5731            // Write the fields.
5732            self.0.encode(encoder, offset + 0, depth)?;
5733            Ok(())
5734        }
5735    }
5736
5737    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenReport {
5738        #[inline(always)]
5739        fn new_empty() -> Self {
5740            Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>, D) }
5741        }
5742
5743        #[inline]
5744        unsafe fn decode(
5745            &mut self,
5746            decoder: &mut fidl::encoding::Decoder<'_, D>,
5747            offset: usize,
5748            _depth: fidl::encoding::Depth,
5749        ) -> fidl::Result<()> {
5750            decoder.debug_check_bounds::<Self>(offset);
5751            // Verify that padding bytes are zero.
5752            fidl::decode!(
5753                fidl::encoding::UnboundedVector<Touch>,
5754                D,
5755                &mut self.touches,
5756                decoder,
5757                offset + 0,
5758                _depth
5759            )?;
5760            Ok(())
5761        }
5762    }
5763
5764    impl MediaButtonsEvent {
5765        #[inline(always)]
5766        fn max_ordinal_present(&self) -> u64 {
5767            if let Some(_) = self.device_id {
5768                return 7;
5769            }
5770            if let Some(_) = self.function {
5771                return 6;
5772            }
5773            if let Some(_) = self.power {
5774                return 5;
5775            }
5776            if let Some(_) = self.camera_disable {
5777                return 4;
5778            }
5779            if let Some(_) = self.pause {
5780                return 3;
5781            }
5782            if let Some(_) = self.mic_mute {
5783                return 2;
5784            }
5785            if let Some(_) = self.volume {
5786                return 1;
5787            }
5788            0
5789        }
5790    }
5791
5792    impl fidl::encoding::ValueTypeMarker for MediaButtonsEvent {
5793        type Borrowed<'a> = &'a Self;
5794        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5795            value
5796        }
5797    }
5798
5799    unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
5800        type Owned = Self;
5801
5802        #[inline(always)]
5803        fn inline_align(_context: fidl::encoding::Context) -> usize {
5804            8
5805        }
5806
5807        #[inline(always)]
5808        fn inline_size(_context: fidl::encoding::Context) -> usize {
5809            16
5810        }
5811    }
5812
5813    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsEvent, D>
5814        for &MediaButtonsEvent
5815    {
5816        unsafe fn encode(
5817            self,
5818            encoder: &mut fidl::encoding::Encoder<'_, D>,
5819            offset: usize,
5820            mut depth: fidl::encoding::Depth,
5821        ) -> fidl::Result<()> {
5822            encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
5823            // Vector header
5824            let max_ordinal: u64 = self.max_ordinal_present();
5825            encoder.write_num(max_ordinal, offset);
5826            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5827            // Calling encoder.out_of_line_offset(0) is not allowed.
5828            if max_ordinal == 0 {
5829                return Ok(());
5830            }
5831            depth.increment()?;
5832            let envelope_size = 8;
5833            let bytes_len = max_ordinal as usize * envelope_size;
5834            #[allow(unused_variables)]
5835            let offset = encoder.out_of_line_offset(bytes_len);
5836            let mut _prev_end_offset: usize = 0;
5837            if 1 > max_ordinal {
5838                return Ok(());
5839            }
5840
5841            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5842            // are envelope_size bytes.
5843            let cur_offset: usize = (1 - 1) * envelope_size;
5844
5845            // Zero reserved fields.
5846            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5847
5848            // Safety:
5849            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5850            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5851            //   envelope_size bytes, there is always sufficient room.
5852            fidl::encoding::encode_in_envelope_optional::<i8, D>(
5853                self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
5854                encoder,
5855                offset + cur_offset,
5856                depth,
5857            )?;
5858
5859            _prev_end_offset = cur_offset + envelope_size;
5860            if 2 > max_ordinal {
5861                return Ok(());
5862            }
5863
5864            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5865            // are envelope_size bytes.
5866            let cur_offset: usize = (2 - 1) * envelope_size;
5867
5868            // Zero reserved fields.
5869            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5870
5871            // Safety:
5872            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5873            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5874            //   envelope_size bytes, there is always sufficient room.
5875            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5876                self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5877                encoder,
5878                offset + cur_offset,
5879                depth,
5880            )?;
5881
5882            _prev_end_offset = cur_offset + envelope_size;
5883            if 3 > max_ordinal {
5884                return Ok(());
5885            }
5886
5887            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5888            // are envelope_size bytes.
5889            let cur_offset: usize = (3 - 1) * envelope_size;
5890
5891            // Zero reserved fields.
5892            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5893
5894            // Safety:
5895            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5896            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5897            //   envelope_size bytes, there is always sufficient room.
5898            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5899                self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5900                encoder,
5901                offset + cur_offset,
5902                depth,
5903            )?;
5904
5905            _prev_end_offset = cur_offset + envelope_size;
5906            if 4 > max_ordinal {
5907                return Ok(());
5908            }
5909
5910            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5911            // are envelope_size bytes.
5912            let cur_offset: usize = (4 - 1) * envelope_size;
5913
5914            // Zero reserved fields.
5915            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5916
5917            // Safety:
5918            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5919            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5920            //   envelope_size bytes, there is always sufficient room.
5921            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5922                self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5923                encoder,
5924                offset + cur_offset,
5925                depth,
5926            )?;
5927
5928            _prev_end_offset = cur_offset + envelope_size;
5929            if 5 > max_ordinal {
5930                return Ok(());
5931            }
5932
5933            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5934            // are envelope_size bytes.
5935            let cur_offset: usize = (5 - 1) * envelope_size;
5936
5937            // Zero reserved fields.
5938            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5939
5940            // Safety:
5941            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5942            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5943            //   envelope_size bytes, there is always sufficient room.
5944            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5945                self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5946                encoder,
5947                offset + cur_offset,
5948                depth,
5949            )?;
5950
5951            _prev_end_offset = cur_offset + envelope_size;
5952            if 6 > max_ordinal {
5953                return Ok(());
5954            }
5955
5956            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5957            // are envelope_size bytes.
5958            let cur_offset: usize = (6 - 1) * envelope_size;
5959
5960            // Zero reserved fields.
5961            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5962
5963            // Safety:
5964            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5965            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5966            //   envelope_size bytes, there is always sufficient room.
5967            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5968                self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5969                encoder,
5970                offset + cur_offset,
5971                depth,
5972            )?;
5973
5974            _prev_end_offset = cur_offset + envelope_size;
5975            if 7 > max_ordinal {
5976                return Ok(());
5977            }
5978
5979            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5980            // are envelope_size bytes.
5981            let cur_offset: usize = (7 - 1) * envelope_size;
5982
5983            // Zero reserved fields.
5984            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5985
5986            // Safety:
5987            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5988            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5989            //   envelope_size bytes, there is always sufficient room.
5990            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5991                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5992                encoder,
5993                offset + cur_offset,
5994                depth,
5995            )?;
5996
5997            _prev_end_offset = cur_offset + envelope_size;
5998
5999            Ok(())
6000        }
6001    }
6002
6003    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsEvent {
6004        #[inline(always)]
6005        fn new_empty() -> Self {
6006            Self::default()
6007        }
6008
6009        unsafe fn decode(
6010            &mut self,
6011            decoder: &mut fidl::encoding::Decoder<'_, D>,
6012            offset: usize,
6013            mut depth: fidl::encoding::Depth,
6014        ) -> fidl::Result<()> {
6015            decoder.debug_check_bounds::<Self>(offset);
6016            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6017                None => return Err(fidl::Error::NotNullable),
6018                Some(len) => len,
6019            };
6020            // Calling decoder.out_of_line_offset(0) is not allowed.
6021            if len == 0 {
6022                return Ok(());
6023            };
6024            depth.increment()?;
6025            let envelope_size = 8;
6026            let bytes_len = len * envelope_size;
6027            let offset = decoder.out_of_line_offset(bytes_len)?;
6028            // Decode the envelope for each type.
6029            let mut _next_ordinal_to_read = 0;
6030            let mut next_offset = offset;
6031            let end_offset = offset + bytes_len;
6032            _next_ordinal_to_read += 1;
6033            if next_offset >= end_offset {
6034                return Ok(());
6035            }
6036
6037            // Decode unknown envelopes for gaps in ordinals.
6038            while _next_ordinal_to_read < 1 {
6039                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6040                _next_ordinal_to_read += 1;
6041                next_offset += envelope_size;
6042            }
6043
6044            let next_out_of_line = decoder.next_out_of_line();
6045            let handles_before = decoder.remaining_handles();
6046            if let Some((inlined, num_bytes, num_handles)) =
6047                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6048            {
6049                let member_inline_size =
6050                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6051                if inlined != (member_inline_size <= 4) {
6052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6053                }
6054                let inner_offset;
6055                let mut inner_depth = depth.clone();
6056                if inlined {
6057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6058                    inner_offset = next_offset;
6059                } else {
6060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6061                    inner_depth.increment()?;
6062                }
6063                let val_ref = self.volume.get_or_insert_with(|| fidl::new_empty!(i8, D));
6064                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
6065                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6066                {
6067                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6068                }
6069                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6070                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6071                }
6072            }
6073
6074            next_offset += envelope_size;
6075            _next_ordinal_to_read += 1;
6076            if next_offset >= end_offset {
6077                return Ok(());
6078            }
6079
6080            // Decode unknown envelopes for gaps in ordinals.
6081            while _next_ordinal_to_read < 2 {
6082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6083                _next_ordinal_to_read += 1;
6084                next_offset += envelope_size;
6085            }
6086
6087            let next_out_of_line = decoder.next_out_of_line();
6088            let handles_before = decoder.remaining_handles();
6089            if let Some((inlined, num_bytes, num_handles)) =
6090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6091            {
6092                let member_inline_size =
6093                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6094                if inlined != (member_inline_size <= 4) {
6095                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6096                }
6097                let inner_offset;
6098                let mut inner_depth = depth.clone();
6099                if inlined {
6100                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6101                    inner_offset = next_offset;
6102                } else {
6103                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6104                    inner_depth.increment()?;
6105                }
6106                let val_ref = self.mic_mute.get_or_insert_with(|| fidl::new_empty!(bool, D));
6107                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6108                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6109                {
6110                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6111                }
6112                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6113                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6114                }
6115            }
6116
6117            next_offset += envelope_size;
6118            _next_ordinal_to_read += 1;
6119            if next_offset >= end_offset {
6120                return Ok(());
6121            }
6122
6123            // Decode unknown envelopes for gaps in ordinals.
6124            while _next_ordinal_to_read < 3 {
6125                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6126                _next_ordinal_to_read += 1;
6127                next_offset += envelope_size;
6128            }
6129
6130            let next_out_of_line = decoder.next_out_of_line();
6131            let handles_before = decoder.remaining_handles();
6132            if let Some((inlined, num_bytes, num_handles)) =
6133                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6134            {
6135                let member_inline_size =
6136                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6137                if inlined != (member_inline_size <= 4) {
6138                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6139                }
6140                let inner_offset;
6141                let mut inner_depth = depth.clone();
6142                if inlined {
6143                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6144                    inner_offset = next_offset;
6145                } else {
6146                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6147                    inner_depth.increment()?;
6148                }
6149                let val_ref = self.pause.get_or_insert_with(|| fidl::new_empty!(bool, D));
6150                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6151                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6152                {
6153                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6154                }
6155                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6156                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6157                }
6158            }
6159
6160            next_offset += envelope_size;
6161            _next_ordinal_to_read += 1;
6162            if next_offset >= end_offset {
6163                return Ok(());
6164            }
6165
6166            // Decode unknown envelopes for gaps in ordinals.
6167            while _next_ordinal_to_read < 4 {
6168                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6169                _next_ordinal_to_read += 1;
6170                next_offset += envelope_size;
6171            }
6172
6173            let next_out_of_line = decoder.next_out_of_line();
6174            let handles_before = decoder.remaining_handles();
6175            if let Some((inlined, num_bytes, num_handles)) =
6176                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6177            {
6178                let member_inline_size =
6179                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6180                if inlined != (member_inline_size <= 4) {
6181                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6182                }
6183                let inner_offset;
6184                let mut inner_depth = depth.clone();
6185                if inlined {
6186                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6187                    inner_offset = next_offset;
6188                } else {
6189                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6190                    inner_depth.increment()?;
6191                }
6192                let val_ref = self.camera_disable.get_or_insert_with(|| fidl::new_empty!(bool, D));
6193                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6194                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6195                {
6196                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6197                }
6198                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6199                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6200                }
6201            }
6202
6203            next_offset += envelope_size;
6204            _next_ordinal_to_read += 1;
6205            if next_offset >= end_offset {
6206                return Ok(());
6207            }
6208
6209            // Decode unknown envelopes for gaps in ordinals.
6210            while _next_ordinal_to_read < 5 {
6211                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6212                _next_ordinal_to_read += 1;
6213                next_offset += envelope_size;
6214            }
6215
6216            let next_out_of_line = decoder.next_out_of_line();
6217            let handles_before = decoder.remaining_handles();
6218            if let Some((inlined, num_bytes, num_handles)) =
6219                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6220            {
6221                let member_inline_size =
6222                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6223                if inlined != (member_inline_size <= 4) {
6224                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6225                }
6226                let inner_offset;
6227                let mut inner_depth = depth.clone();
6228                if inlined {
6229                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6230                    inner_offset = next_offset;
6231                } else {
6232                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6233                    inner_depth.increment()?;
6234                }
6235                let val_ref = self.power.get_or_insert_with(|| fidl::new_empty!(bool, D));
6236                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6237                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6238                {
6239                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6240                }
6241                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6242                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6243                }
6244            }
6245
6246            next_offset += envelope_size;
6247            _next_ordinal_to_read += 1;
6248            if next_offset >= end_offset {
6249                return Ok(());
6250            }
6251
6252            // Decode unknown envelopes for gaps in ordinals.
6253            while _next_ordinal_to_read < 6 {
6254                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6255                _next_ordinal_to_read += 1;
6256                next_offset += envelope_size;
6257            }
6258
6259            let next_out_of_line = decoder.next_out_of_line();
6260            let handles_before = decoder.remaining_handles();
6261            if let Some((inlined, num_bytes, num_handles)) =
6262                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6263            {
6264                let member_inline_size =
6265                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6266                if inlined != (member_inline_size <= 4) {
6267                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6268                }
6269                let inner_offset;
6270                let mut inner_depth = depth.clone();
6271                if inlined {
6272                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6273                    inner_offset = next_offset;
6274                } else {
6275                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6276                    inner_depth.increment()?;
6277                }
6278                let val_ref = self.function.get_or_insert_with(|| fidl::new_empty!(bool, D));
6279                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6280                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6281                {
6282                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6283                }
6284                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6285                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6286                }
6287            }
6288
6289            next_offset += envelope_size;
6290            _next_ordinal_to_read += 1;
6291            if next_offset >= end_offset {
6292                return Ok(());
6293            }
6294
6295            // Decode unknown envelopes for gaps in ordinals.
6296            while _next_ordinal_to_read < 7 {
6297                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6298                _next_ordinal_to_read += 1;
6299                next_offset += envelope_size;
6300            }
6301
6302            let next_out_of_line = decoder.next_out_of_line();
6303            let handles_before = decoder.remaining_handles();
6304            if let Some((inlined, num_bytes, num_handles)) =
6305                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6306            {
6307                let member_inline_size =
6308                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6309                if inlined != (member_inline_size <= 4) {
6310                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6311                }
6312                let inner_offset;
6313                let mut inner_depth = depth.clone();
6314                if inlined {
6315                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6316                    inner_offset = next_offset;
6317                } else {
6318                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6319                    inner_depth.increment()?;
6320                }
6321                let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
6322                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6323                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6324                {
6325                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6326                }
6327                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6328                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6329                }
6330            }
6331
6332            next_offset += envelope_size;
6333
6334            // Decode the remaining unknown envelopes.
6335            while next_offset < end_offset {
6336                _next_ordinal_to_read += 1;
6337                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6338                next_offset += envelope_size;
6339            }
6340
6341            Ok(())
6342        }
6343    }
6344
6345    impl TouchButtonsEvent {
6346        #[inline(always)]
6347        fn max_ordinal_present(&self) -> u64 {
6348            if let Some(_) = self.pressed_buttons {
6349                return 3;
6350            }
6351            if let Some(_) = self.device_info {
6352                return 2;
6353            }
6354            if let Some(_) = self.event_time {
6355                return 1;
6356            }
6357            0
6358        }
6359    }
6360
6361    impl fidl::encoding::ValueTypeMarker for TouchButtonsEvent {
6362        type Borrowed<'a> = &'a Self;
6363        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6364            value
6365        }
6366    }
6367
6368    unsafe impl fidl::encoding::TypeMarker for TouchButtonsEvent {
6369        type Owned = Self;
6370
6371        #[inline(always)]
6372        fn inline_align(_context: fidl::encoding::Context) -> usize {
6373            8
6374        }
6375
6376        #[inline(always)]
6377        fn inline_size(_context: fidl::encoding::Context) -> usize {
6378            16
6379        }
6380    }
6381
6382    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchButtonsEvent, D>
6383        for &TouchButtonsEvent
6384    {
6385        unsafe fn encode(
6386            self,
6387            encoder: &mut fidl::encoding::Encoder<'_, D>,
6388            offset: usize,
6389            mut depth: fidl::encoding::Depth,
6390        ) -> fidl::Result<()> {
6391            encoder.debug_check_bounds::<TouchButtonsEvent>(offset);
6392            // Vector header
6393            let max_ordinal: u64 = self.max_ordinal_present();
6394            encoder.write_num(max_ordinal, offset);
6395            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6396            // Calling encoder.out_of_line_offset(0) is not allowed.
6397            if max_ordinal == 0 {
6398                return Ok(());
6399            }
6400            depth.increment()?;
6401            let envelope_size = 8;
6402            let bytes_len = max_ordinal as usize * envelope_size;
6403            #[allow(unused_variables)]
6404            let offset = encoder.out_of_line_offset(bytes_len);
6405            let mut _prev_end_offset: usize = 0;
6406            if 1 > max_ordinal {
6407                return Ok(());
6408            }
6409
6410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6411            // are envelope_size bytes.
6412            let cur_offset: usize = (1 - 1) * envelope_size;
6413
6414            // Zero reserved fields.
6415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6416
6417            // Safety:
6418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6420            //   envelope_size bytes, there is always sufficient room.
6421            fidl::encoding::encode_in_envelope_optional::<fidl::MonotonicInstant, D>(
6422                self.event_time
6423                    .as_ref()
6424                    .map(<fidl::MonotonicInstant as fidl::encoding::ValueTypeMarker>::borrow),
6425                encoder,
6426                offset + cur_offset,
6427                depth,
6428            )?;
6429
6430            _prev_end_offset = cur_offset + envelope_size;
6431            if 2 > max_ordinal {
6432                return Ok(());
6433            }
6434
6435            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6436            // are envelope_size bytes.
6437            let cur_offset: usize = (2 - 1) * envelope_size;
6438
6439            // Zero reserved fields.
6440            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6441
6442            // Safety:
6443            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6444            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6445            //   envelope_size bytes, there is always sufficient room.
6446            fidl::encoding::encode_in_envelope_optional::<TouchDeviceInfo, D>(
6447                self.device_info
6448                    .as_ref()
6449                    .map(<TouchDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
6450                encoder,
6451                offset + cur_offset,
6452                depth,
6453            )?;
6454
6455            _prev_end_offset = cur_offset + envelope_size;
6456            if 3 > max_ordinal {
6457                return Ok(());
6458            }
6459
6460            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6461            // are envelope_size bytes.
6462            let cur_offset: usize = (3 - 1) * envelope_size;
6463
6464            // Zero reserved fields.
6465            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6466
6467            // Safety:
6468            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6469            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6470            //   envelope_size bytes, there is always sufficient room.
6471            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<TouchButton>, D>(
6472            self.pressed_buttons.as_ref().map(<fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::ValueTypeMarker>::borrow),
6473            encoder, offset + cur_offset, depth
6474        )?;
6475
6476            _prev_end_offset = cur_offset + envelope_size;
6477
6478            Ok(())
6479        }
6480    }
6481
6482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchButtonsEvent {
6483        #[inline(always)]
6484        fn new_empty() -> Self {
6485            Self::default()
6486        }
6487
6488        unsafe fn decode(
6489            &mut self,
6490            decoder: &mut fidl::encoding::Decoder<'_, D>,
6491            offset: usize,
6492            mut depth: fidl::encoding::Depth,
6493        ) -> fidl::Result<()> {
6494            decoder.debug_check_bounds::<Self>(offset);
6495            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6496                None => return Err(fidl::Error::NotNullable),
6497                Some(len) => len,
6498            };
6499            // Calling decoder.out_of_line_offset(0) is not allowed.
6500            if len == 0 {
6501                return Ok(());
6502            };
6503            depth.increment()?;
6504            let envelope_size = 8;
6505            let bytes_len = len * envelope_size;
6506            let offset = decoder.out_of_line_offset(bytes_len)?;
6507            // Decode the envelope for each type.
6508            let mut _next_ordinal_to_read = 0;
6509            let mut next_offset = offset;
6510            let end_offset = offset + bytes_len;
6511            _next_ordinal_to_read += 1;
6512            if next_offset >= end_offset {
6513                return Ok(());
6514            }
6515
6516            // Decode unknown envelopes for gaps in ordinals.
6517            while _next_ordinal_to_read < 1 {
6518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6519                _next_ordinal_to_read += 1;
6520                next_offset += envelope_size;
6521            }
6522
6523            let next_out_of_line = decoder.next_out_of_line();
6524            let handles_before = decoder.remaining_handles();
6525            if let Some((inlined, num_bytes, num_handles)) =
6526                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6527            {
6528                let member_inline_size =
6529                    <fidl::MonotonicInstant as fidl::encoding::TypeMarker>::inline_size(
6530                        decoder.context,
6531                    );
6532                if inlined != (member_inline_size <= 4) {
6533                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6534                }
6535                let inner_offset;
6536                let mut inner_depth = depth.clone();
6537                if inlined {
6538                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6539                    inner_offset = next_offset;
6540                } else {
6541                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6542                    inner_depth.increment()?;
6543                }
6544                let val_ref = self
6545                    .event_time
6546                    .get_or_insert_with(|| fidl::new_empty!(fidl::MonotonicInstant, D));
6547                fidl::decode!(
6548                    fidl::MonotonicInstant,
6549                    D,
6550                    val_ref,
6551                    decoder,
6552                    inner_offset,
6553                    inner_depth
6554                )?;
6555                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6556                {
6557                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6558                }
6559                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6560                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6561                }
6562            }
6563
6564            next_offset += envelope_size;
6565            _next_ordinal_to_read += 1;
6566            if next_offset >= end_offset {
6567                return Ok(());
6568            }
6569
6570            // Decode unknown envelopes for gaps in ordinals.
6571            while _next_ordinal_to_read < 2 {
6572                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6573                _next_ordinal_to_read += 1;
6574                next_offset += envelope_size;
6575            }
6576
6577            let next_out_of_line = decoder.next_out_of_line();
6578            let handles_before = decoder.remaining_handles();
6579            if let Some((inlined, num_bytes, num_handles)) =
6580                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6581            {
6582                let member_inline_size =
6583                    <TouchDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6584                if inlined != (member_inline_size <= 4) {
6585                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6586                }
6587                let inner_offset;
6588                let mut inner_depth = depth.clone();
6589                if inlined {
6590                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6591                    inner_offset = next_offset;
6592                } else {
6593                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6594                    inner_depth.increment()?;
6595                }
6596                let val_ref =
6597                    self.device_info.get_or_insert_with(|| fidl::new_empty!(TouchDeviceInfo, D));
6598                fidl::decode!(TouchDeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
6599                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6600                {
6601                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6602                }
6603                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6604                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6605                }
6606            }
6607
6608            next_offset += envelope_size;
6609            _next_ordinal_to_read += 1;
6610            if next_offset >= end_offset {
6611                return Ok(());
6612            }
6613
6614            // Decode unknown envelopes for gaps in ordinals.
6615            while _next_ordinal_to_read < 3 {
6616                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6617                _next_ordinal_to_read += 1;
6618                next_offset += envelope_size;
6619            }
6620
6621            let next_out_of_line = decoder.next_out_of_line();
6622            let handles_before = decoder.remaining_handles();
6623            if let Some((inlined, num_bytes, num_handles)) =
6624                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6625            {
6626                let member_inline_size = <fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6627                if inlined != (member_inline_size <= 4) {
6628                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6629                }
6630                let inner_offset;
6631                let mut inner_depth = depth.clone();
6632                if inlined {
6633                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6634                    inner_offset = next_offset;
6635                } else {
6636                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6637                    inner_depth.increment()?;
6638                }
6639                let val_ref = self.pressed_buttons.get_or_insert_with(|| {
6640                    fidl::new_empty!(fidl::encoding::UnboundedVector<TouchButton>, D)
6641                });
6642                fidl::decode!(
6643                    fidl::encoding::UnboundedVector<TouchButton>,
6644                    D,
6645                    val_ref,
6646                    decoder,
6647                    inner_offset,
6648                    inner_depth
6649                )?;
6650                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6651                {
6652                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6653                }
6654                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6655                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6656                }
6657            }
6658
6659            next_offset += envelope_size;
6660
6661            // Decode the remaining unknown envelopes.
6662            while next_offset < end_offset {
6663                _next_ordinal_to_read += 1;
6664                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6665                next_offset += envelope_size;
6666            }
6667
6668            Ok(())
6669        }
6670    }
6671
6672    impl TouchDeviceInfo {
6673        #[inline(always)]
6674        fn max_ordinal_present(&self) -> u64 {
6675            if let Some(_) = self.id {
6676                return 1;
6677            }
6678            0
6679        }
6680    }
6681
6682    impl fidl::encoding::ValueTypeMarker for TouchDeviceInfo {
6683        type Borrowed<'a> = &'a Self;
6684        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6685            value
6686        }
6687    }
6688
6689    unsafe impl fidl::encoding::TypeMarker for TouchDeviceInfo {
6690        type Owned = Self;
6691
6692        #[inline(always)]
6693        fn inline_align(_context: fidl::encoding::Context) -> usize {
6694            8
6695        }
6696
6697        #[inline(always)]
6698        fn inline_size(_context: fidl::encoding::Context) -> usize {
6699            16
6700        }
6701    }
6702
6703    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDeviceInfo, D>
6704        for &TouchDeviceInfo
6705    {
6706        unsafe fn encode(
6707            self,
6708            encoder: &mut fidl::encoding::Encoder<'_, D>,
6709            offset: usize,
6710            mut depth: fidl::encoding::Depth,
6711        ) -> fidl::Result<()> {
6712            encoder.debug_check_bounds::<TouchDeviceInfo>(offset);
6713            // Vector header
6714            let max_ordinal: u64 = self.max_ordinal_present();
6715            encoder.write_num(max_ordinal, offset);
6716            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6717            // Calling encoder.out_of_line_offset(0) is not allowed.
6718            if max_ordinal == 0 {
6719                return Ok(());
6720            }
6721            depth.increment()?;
6722            let envelope_size = 8;
6723            let bytes_len = max_ordinal as usize * envelope_size;
6724            #[allow(unused_variables)]
6725            let offset = encoder.out_of_line_offset(bytes_len);
6726            let mut _prev_end_offset: usize = 0;
6727            if 1 > max_ordinal {
6728                return Ok(());
6729            }
6730
6731            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6732            // are envelope_size bytes.
6733            let cur_offset: usize = (1 - 1) * envelope_size;
6734
6735            // Zero reserved fields.
6736            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6737
6738            // Safety:
6739            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6740            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6741            //   envelope_size bytes, there is always sufficient room.
6742            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6743                self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6744                encoder,
6745                offset + cur_offset,
6746                depth,
6747            )?;
6748
6749            _prev_end_offset = cur_offset + envelope_size;
6750
6751            Ok(())
6752        }
6753    }
6754
6755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDeviceInfo {
6756        #[inline(always)]
6757        fn new_empty() -> Self {
6758            Self::default()
6759        }
6760
6761        unsafe fn decode(
6762            &mut self,
6763            decoder: &mut fidl::encoding::Decoder<'_, D>,
6764            offset: usize,
6765            mut depth: fidl::encoding::Depth,
6766        ) -> fidl::Result<()> {
6767            decoder.debug_check_bounds::<Self>(offset);
6768            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6769                None => return Err(fidl::Error::NotNullable),
6770                Some(len) => len,
6771            };
6772            // Calling decoder.out_of_line_offset(0) is not allowed.
6773            if len == 0 {
6774                return Ok(());
6775            };
6776            depth.increment()?;
6777            let envelope_size = 8;
6778            let bytes_len = len * envelope_size;
6779            let offset = decoder.out_of_line_offset(bytes_len)?;
6780            // Decode the envelope for each type.
6781            let mut _next_ordinal_to_read = 0;
6782            let mut next_offset = offset;
6783            let end_offset = offset + bytes_len;
6784            _next_ordinal_to_read += 1;
6785            if next_offset >= end_offset {
6786                return Ok(());
6787            }
6788
6789            // Decode unknown envelopes for gaps in ordinals.
6790            while _next_ordinal_to_read < 1 {
6791                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6792                _next_ordinal_to_read += 1;
6793                next_offset += envelope_size;
6794            }
6795
6796            let next_out_of_line = decoder.next_out_of_line();
6797            let handles_before = decoder.remaining_handles();
6798            if let Some((inlined, num_bytes, num_handles)) =
6799                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6800            {
6801                let member_inline_size =
6802                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6803                if inlined != (member_inline_size <= 4) {
6804                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6805                }
6806                let inner_offset;
6807                let mut inner_depth = depth.clone();
6808                if inlined {
6809                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6810                    inner_offset = next_offset;
6811                } else {
6812                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6813                    inner_depth.increment()?;
6814                }
6815                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
6816                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6817                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6818                {
6819                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6820                }
6821                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6822                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6823                }
6824            }
6825
6826            next_offset += envelope_size;
6827
6828            // Decode the remaining unknown envelopes.
6829            while next_offset < end_offset {
6830                _next_ordinal_to_read += 1;
6831                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6832                next_offset += envelope_size;
6833            }
6834
6835            Ok(())
6836        }
6837    }
6838
6839    impl fidl::encoding::ValueTypeMarker for Command {
6840        type Borrowed<'a> = &'a Self;
6841        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6842            value
6843        }
6844    }
6845
6846    unsafe impl fidl::encoding::TypeMarker for Command {
6847        type Owned = Self;
6848
6849        #[inline(always)]
6850        fn inline_align(_context: fidl::encoding::Context) -> usize {
6851            8
6852        }
6853
6854        #[inline(always)]
6855        fn inline_size(_context: fidl::encoding::Context) -> usize {
6856            16
6857        }
6858    }
6859
6860    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Command, D> for &Command {
6861        #[inline]
6862        unsafe fn encode(
6863            self,
6864            encoder: &mut fidl::encoding::Encoder<'_, D>,
6865            offset: usize,
6866            _depth: fidl::encoding::Depth,
6867        ) -> fidl::Result<()> {
6868            encoder.debug_check_bounds::<Command>(offset);
6869            encoder.write_num::<u64>(self.ordinal(), offset);
6870            match self {
6871                Command::SendKeyboardInput(ref val) => {
6872                    fidl::encoding::encode_in_envelope::<SendKeyboardInputCmd, D>(
6873                        <SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6874                        encoder,
6875                        offset + 8,
6876                        _depth,
6877                    )
6878                }
6879                Command::SendPointerInput(ref val) => {
6880                    fidl::encoding::encode_in_envelope::<SendPointerInputCmd, D>(
6881                        <SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6882                        encoder,
6883                        offset + 8,
6884                        _depth,
6885                    )
6886                }
6887                Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
6888                    SetHardKeyboardDeliveryCmd,
6889                    D,
6890                >(
6891                    <SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6892                    encoder,
6893                    offset + 8,
6894                    _depth,
6895                ),
6896                Command::SetParallelDispatch(ref val) => {
6897                    fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd, D>(
6898                        <SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6899                        encoder,
6900                        offset + 8,
6901                        _depth,
6902                    )
6903                }
6904            }
6905        }
6906    }
6907
6908    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
6909        #[inline(always)]
6910        fn new_empty() -> Self {
6911            Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D))
6912        }
6913
6914        #[inline]
6915        unsafe fn decode(
6916            &mut self,
6917            decoder: &mut fidl::encoding::Decoder<'_, D>,
6918            offset: usize,
6919            mut depth: fidl::encoding::Depth,
6920        ) -> fidl::Result<()> {
6921            decoder.debug_check_bounds::<Self>(offset);
6922            #[allow(unused_variables)]
6923            let next_out_of_line = decoder.next_out_of_line();
6924            let handles_before = decoder.remaining_handles();
6925            let (ordinal, inlined, num_bytes, num_handles) =
6926                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6927
6928            let member_inline_size = match ordinal {
6929                1 => <SendKeyboardInputCmd as fidl::encoding::TypeMarker>::inline_size(
6930                    decoder.context,
6931                ),
6932                2 => <SendPointerInputCmd as fidl::encoding::TypeMarker>::inline_size(
6933                    decoder.context,
6934                ),
6935                3 => <SetHardKeyboardDeliveryCmd as fidl::encoding::TypeMarker>::inline_size(
6936                    decoder.context,
6937                ),
6938                4 => <SetParallelDispatchCmd as fidl::encoding::TypeMarker>::inline_size(
6939                    decoder.context,
6940                ),
6941                _ => return Err(fidl::Error::UnknownUnionTag),
6942            };
6943
6944            if inlined != (member_inline_size <= 4) {
6945                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6946            }
6947            let _inner_offset;
6948            if inlined {
6949                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6950                _inner_offset = offset + 8;
6951            } else {
6952                depth.increment()?;
6953                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6954            }
6955            match ordinal {
6956                1 => {
6957                    #[allow(irrefutable_let_patterns)]
6958                    if let Command::SendKeyboardInput(_) = self {
6959                        // Do nothing, read the value into the object
6960                    } else {
6961                        // Initialize `self` to the right variant
6962                        *self =
6963                            Command::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D));
6964                    }
6965                    #[allow(irrefutable_let_patterns)]
6966                    if let Command::SendKeyboardInput(ref mut val) = self {
6967                        fidl::decode!(SendKeyboardInputCmd, D, val, decoder, _inner_offset, depth)?;
6968                    } else {
6969                        unreachable!()
6970                    }
6971                }
6972                2 => {
6973                    #[allow(irrefutable_let_patterns)]
6974                    if let Command::SendPointerInput(_) = self {
6975                        // Do nothing, read the value into the object
6976                    } else {
6977                        // Initialize `self` to the right variant
6978                        *self = Command::SendPointerInput(fidl::new_empty!(SendPointerInputCmd, D));
6979                    }
6980                    #[allow(irrefutable_let_patterns)]
6981                    if let Command::SendPointerInput(ref mut val) = self {
6982                        fidl::decode!(SendPointerInputCmd, D, val, decoder, _inner_offset, depth)?;
6983                    } else {
6984                        unreachable!()
6985                    }
6986                }
6987                3 => {
6988                    #[allow(irrefutable_let_patterns)]
6989                    if let Command::SetHardKeyboardDelivery(_) = self {
6990                        // Do nothing, read the value into the object
6991                    } else {
6992                        // Initialize `self` to the right variant
6993                        *self = Command::SetHardKeyboardDelivery(fidl::new_empty!(
6994                            SetHardKeyboardDeliveryCmd,
6995                            D
6996                        ));
6997                    }
6998                    #[allow(irrefutable_let_patterns)]
6999                    if let Command::SetHardKeyboardDelivery(ref mut val) = self {
7000                        fidl::decode!(
7001                            SetHardKeyboardDeliveryCmd,
7002                            D,
7003                            val,
7004                            decoder,
7005                            _inner_offset,
7006                            depth
7007                        )?;
7008                    } else {
7009                        unreachable!()
7010                    }
7011                }
7012                4 => {
7013                    #[allow(irrefutable_let_patterns)]
7014                    if let Command::SetParallelDispatch(_) = self {
7015                        // Do nothing, read the value into the object
7016                    } else {
7017                        // Initialize `self` to the right variant
7018                        *self = Command::SetParallelDispatch(fidl::new_empty!(
7019                            SetParallelDispatchCmd,
7020                            D
7021                        ));
7022                    }
7023                    #[allow(irrefutable_let_patterns)]
7024                    if let Command::SetParallelDispatch(ref mut val) = self {
7025                        fidl::decode!(
7026                            SetParallelDispatchCmd,
7027                            D,
7028                            val,
7029                            decoder,
7030                            _inner_offset,
7031                            depth
7032                        )?;
7033                    } else {
7034                        unreachable!()
7035                    }
7036                }
7037                ordinal => panic!("unexpected ordinal {:?}", ordinal),
7038            }
7039            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7040                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7041            }
7042            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7043                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7044            }
7045            Ok(())
7046        }
7047    }
7048
7049    impl fidl::encoding::ValueTypeMarker for InputEvent {
7050        type Borrowed<'a> = &'a Self;
7051        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7052            value
7053        }
7054    }
7055
7056    unsafe impl fidl::encoding::TypeMarker for InputEvent {
7057        type Owned = Self;
7058
7059        #[inline(always)]
7060        fn inline_align(_context: fidl::encoding::Context) -> usize {
7061            8
7062        }
7063
7064        #[inline(always)]
7065        fn inline_size(_context: fidl::encoding::Context) -> usize {
7066            16
7067        }
7068    }
7069
7070    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputEvent, D>
7071        for &InputEvent
7072    {
7073        #[inline]
7074        unsafe fn encode(
7075            self,
7076            encoder: &mut fidl::encoding::Encoder<'_, D>,
7077            offset: usize,
7078            _depth: fidl::encoding::Depth,
7079        ) -> fidl::Result<()> {
7080            encoder.debug_check_bounds::<InputEvent>(offset);
7081            encoder.write_num::<u64>(self.ordinal(), offset);
7082            match self {
7083                InputEvent::Pointer(ref val) => {
7084                    fidl::encoding::encode_in_envelope::<PointerEvent, D>(
7085                        <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
7086                        encoder,
7087                        offset + 8,
7088                        _depth,
7089                    )
7090                }
7091                InputEvent::Keyboard(ref val) => {
7092                    fidl::encoding::encode_in_envelope::<KeyboardEvent, D>(
7093                        <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
7094                        encoder,
7095                        offset + 8,
7096                        _depth,
7097                    )
7098                }
7099                InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent, D>(
7100                    <FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
7101                    encoder,
7102                    offset + 8,
7103                    _depth,
7104                ),
7105            }
7106        }
7107    }
7108
7109    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputEvent {
7110        #[inline(always)]
7111        fn new_empty() -> Self {
7112            Self::Pointer(fidl::new_empty!(PointerEvent, D))
7113        }
7114
7115        #[inline]
7116        unsafe fn decode(
7117            &mut self,
7118            decoder: &mut fidl::encoding::Decoder<'_, D>,
7119            offset: usize,
7120            mut depth: fidl::encoding::Depth,
7121        ) -> fidl::Result<()> {
7122            decoder.debug_check_bounds::<Self>(offset);
7123            #[allow(unused_variables)]
7124            let next_out_of_line = decoder.next_out_of_line();
7125            let handles_before = decoder.remaining_handles();
7126            let (ordinal, inlined, num_bytes, num_handles) =
7127                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7128
7129            let member_inline_size = match ordinal {
7130                1 => <PointerEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7131                2 => <KeyboardEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7132                3 => <FocusEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7133                _ => return Err(fidl::Error::UnknownUnionTag),
7134            };
7135
7136            if inlined != (member_inline_size <= 4) {
7137                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7138            }
7139            let _inner_offset;
7140            if inlined {
7141                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7142                _inner_offset = offset + 8;
7143            } else {
7144                depth.increment()?;
7145                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7146            }
7147            match ordinal {
7148                1 => {
7149                    #[allow(irrefutable_let_patterns)]
7150                    if let InputEvent::Pointer(_) = self {
7151                        // Do nothing, read the value into the object
7152                    } else {
7153                        // Initialize `self` to the right variant
7154                        *self = InputEvent::Pointer(fidl::new_empty!(PointerEvent, D));
7155                    }
7156                    #[allow(irrefutable_let_patterns)]
7157                    if let InputEvent::Pointer(ref mut val) = self {
7158                        fidl::decode!(PointerEvent, D, val, decoder, _inner_offset, depth)?;
7159                    } else {
7160                        unreachable!()
7161                    }
7162                }
7163                2 => {
7164                    #[allow(irrefutable_let_patterns)]
7165                    if let InputEvent::Keyboard(_) = self {
7166                        // Do nothing, read the value into the object
7167                    } else {
7168                        // Initialize `self` to the right variant
7169                        *self = InputEvent::Keyboard(fidl::new_empty!(KeyboardEvent, D));
7170                    }
7171                    #[allow(irrefutable_let_patterns)]
7172                    if let InputEvent::Keyboard(ref mut val) = self {
7173                        fidl::decode!(KeyboardEvent, D, val, decoder, _inner_offset, depth)?;
7174                    } else {
7175                        unreachable!()
7176                    }
7177                }
7178                3 => {
7179                    #[allow(irrefutable_let_patterns)]
7180                    if let InputEvent::Focus(_) = self {
7181                        // Do nothing, read the value into the object
7182                    } else {
7183                        // Initialize `self` to the right variant
7184                        *self = InputEvent::Focus(fidl::new_empty!(FocusEvent, D));
7185                    }
7186                    #[allow(irrefutable_let_patterns)]
7187                    if let InputEvent::Focus(ref mut val) = self {
7188                        fidl::decode!(FocusEvent, D, val, decoder, _inner_offset, depth)?;
7189                    } else {
7190                        unreachable!()
7191                    }
7192                }
7193                ordinal => panic!("unexpected ordinal {:?}", ordinal),
7194            }
7195            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7196                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7197            }
7198            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7199                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7200            }
7201            Ok(())
7202        }
7203    }
7204
7205    impl fidl::encoding::ValueTypeMarker for SensorReport {
7206        type Borrowed<'a> = &'a Self;
7207        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7208            value
7209        }
7210    }
7211
7212    unsafe impl fidl::encoding::TypeMarker for SensorReport {
7213        type Owned = Self;
7214
7215        #[inline(always)]
7216        fn inline_align(_context: fidl::encoding::Context) -> usize {
7217            8
7218        }
7219
7220        #[inline(always)]
7221        fn inline_size(_context: fidl::encoding::Context) -> usize {
7222            16
7223        }
7224    }
7225
7226    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorReport, D>
7227        for &SensorReport
7228    {
7229        #[inline]
7230        unsafe fn encode(
7231            self,
7232            encoder: &mut fidl::encoding::Encoder<'_, D>,
7233            offset: usize,
7234            _depth: fidl::encoding::Depth,
7235        ) -> fidl::Result<()> {
7236            encoder.debug_check_bounds::<SensorReport>(offset);
7237            encoder.write_num::<u64>(self.ordinal(), offset);
7238            match self {
7239                SensorReport::Vector(ref val) => fidl::encoding::encode_in_envelope::<
7240                    fidl::encoding::Array<i16, 3>,
7241                    D,
7242                >(
7243                    <fidl::encoding::Array<i16, 3> as fidl::encoding::ValueTypeMarker>::borrow(val),
7244                    encoder,
7245                    offset + 8,
7246                    _depth,
7247                ),
7248                SensorReport::Scalar(ref val) => fidl::encoding::encode_in_envelope::<u16, D>(
7249                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
7250                    encoder,
7251                    offset + 8,
7252                    _depth,
7253                ),
7254            }
7255        }
7256    }
7257
7258    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReport {
7259        #[inline(always)]
7260        fn new_empty() -> Self {
7261            Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>, D))
7262        }
7263
7264        #[inline]
7265        unsafe fn decode(
7266            &mut self,
7267            decoder: &mut fidl::encoding::Decoder<'_, D>,
7268            offset: usize,
7269            mut depth: fidl::encoding::Depth,
7270        ) -> fidl::Result<()> {
7271            decoder.debug_check_bounds::<Self>(offset);
7272            #[allow(unused_variables)]
7273            let next_out_of_line = decoder.next_out_of_line();
7274            let handles_before = decoder.remaining_handles();
7275            let (ordinal, inlined, num_bytes, num_handles) =
7276                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7277
7278            let member_inline_size = match ordinal {
7279                1 => <fidl::encoding::Array<i16, 3> as fidl::encoding::TypeMarker>::inline_size(
7280                    decoder.context,
7281                ),
7282                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7283                _ => return Err(fidl::Error::UnknownUnionTag),
7284            };
7285
7286            if inlined != (member_inline_size <= 4) {
7287                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7288            }
7289            let _inner_offset;
7290            if inlined {
7291                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7292                _inner_offset = offset + 8;
7293            } else {
7294                depth.increment()?;
7295                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7296            }
7297            match ordinal {
7298                1 => {
7299                    #[allow(irrefutable_let_patterns)]
7300                    if let SensorReport::Vector(_) = self {
7301                        // Do nothing, read the value into the object
7302                    } else {
7303                        // Initialize `self` to the right variant
7304                        *self = SensorReport::Vector(
7305                            fidl::new_empty!(fidl::encoding::Array<i16, 3>, D),
7306                        );
7307                    }
7308                    #[allow(irrefutable_let_patterns)]
7309                    if let SensorReport::Vector(ref mut val) = self {
7310                        fidl::decode!(fidl::encoding::Array<i16, 3>, D, val, decoder, _inner_offset, depth)?;
7311                    } else {
7312                        unreachable!()
7313                    }
7314                }
7315                2 => {
7316                    #[allow(irrefutable_let_patterns)]
7317                    if let SensorReport::Scalar(_) = self {
7318                        // Do nothing, read the value into the object
7319                    } else {
7320                        // Initialize `self` to the right variant
7321                        *self = SensorReport::Scalar(fidl::new_empty!(u16, D));
7322                    }
7323                    #[allow(irrefutable_let_patterns)]
7324                    if let SensorReport::Scalar(ref mut val) = self {
7325                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
7326                    } else {
7327                        unreachable!()
7328                    }
7329                }
7330                ordinal => panic!("unexpected ordinal {:?}", ordinal),
7331            }
7332            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7333                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7334            }
7335            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7336                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7337            }
7338            Ok(())
7339        }
7340    }
7341}