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<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputMethodAction, D>>
2684        fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D> for (T0,)
2685    {
2686        #[inline]
2687        unsafe fn encode(
2688            self,
2689            encoder: &mut fidl::encoding::Encoder<'_, D>,
2690            offset: usize,
2691            depth: fidl::encoding::Depth,
2692        ) -> fidl::Result<()> {
2693            encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
2694            // Zero out padding regions. There's no need to apply masks
2695            // because the unmasked parts will be overwritten by fields.
2696            // Write the fields.
2697            self.0.encode(encoder, offset + 0, depth)?;
2698            Ok(())
2699        }
2700    }
2701
2702    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2703        for InputMethodEditorClientOnActionRequest
2704    {
2705        #[inline(always)]
2706        fn new_empty() -> Self {
2707            Self { action: fidl::new_empty!(InputMethodAction, D) }
2708        }
2709
2710        #[inline]
2711        unsafe fn decode(
2712            &mut self,
2713            decoder: &mut fidl::encoding::Decoder<'_, D>,
2714            offset: usize,
2715            _depth: fidl::encoding::Depth,
2716        ) -> fidl::Result<()> {
2717            decoder.debug_check_bounds::<Self>(offset);
2718            // Verify that padding bytes are zero.
2719            fidl::decode!(InputMethodAction, D, &mut self.action, decoder, offset + 0, _depth)?;
2720            Ok(())
2721        }
2722    }
2723
2724    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
2725        type Borrowed<'a> = &'a Self;
2726        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2727            value
2728        }
2729    }
2730
2731    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Request {
2732        type Owned = Self;
2733
2734        #[inline(always)]
2735        fn inline_align(_context: fidl::encoding::Context) -> usize {
2736            8
2737        }
2738
2739        #[inline(always)]
2740        fn inline_size(_context: fidl::encoding::Context) -> usize {
2741            16
2742        }
2743    }
2744
2745    unsafe impl<D: fidl::encoding::ResourceDialect>
2746        fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D>
2747        for &InputMethodEditorDispatchKey3Request
2748    {
2749        #[inline]
2750        unsafe fn encode(
2751            self,
2752            encoder: &mut fidl::encoding::Encoder<'_, D>,
2753            offset: usize,
2754            _depth: fidl::encoding::Depth,
2755        ) -> fidl::Result<()> {
2756            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2757            // Delegate to tuple encoding.
2758            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request, D>::encode(
2759                (
2760                    <fidl_fuchsia_ui_input3__common::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2761                ),
2762                encoder, offset, _depth
2763            )
2764        }
2765    }
2766    unsafe impl<
2767            D: fidl::encoding::ResourceDialect,
2768            T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3__common::KeyEvent, D>,
2769        > fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D> for (T0,)
2770    {
2771        #[inline]
2772        unsafe fn encode(
2773            self,
2774            encoder: &mut fidl::encoding::Encoder<'_, D>,
2775            offset: usize,
2776            depth: fidl::encoding::Depth,
2777        ) -> fidl::Result<()> {
2778            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2779            // Zero out padding regions. There's no need to apply masks
2780            // because the unmasked parts will be overwritten by fields.
2781            // Write the fields.
2782            self.0.encode(encoder, offset + 0, depth)?;
2783            Ok(())
2784        }
2785    }
2786
2787    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2788        for InputMethodEditorDispatchKey3Request
2789    {
2790        #[inline(always)]
2791        fn new_empty() -> Self {
2792            Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3__common::KeyEvent, D) }
2793        }
2794
2795        #[inline]
2796        unsafe fn decode(
2797            &mut self,
2798            decoder: &mut fidl::encoding::Decoder<'_, D>,
2799            offset: usize,
2800            _depth: fidl::encoding::Depth,
2801        ) -> fidl::Result<()> {
2802            decoder.debug_check_bounds::<Self>(offset);
2803            // Verify that padding bytes are zero.
2804            fidl::decode!(
2805                fidl_fuchsia_ui_input3__common::KeyEvent,
2806                D,
2807                &mut self.event,
2808                decoder,
2809                offset + 0,
2810                _depth
2811            )?;
2812            Ok(())
2813        }
2814    }
2815
2816    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
2817        type Borrowed<'a> = &'a Self;
2818        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2819            value
2820        }
2821    }
2822
2823    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Response {
2824        type Owned = Self;
2825
2826        #[inline(always)]
2827        fn inline_align(_context: fidl::encoding::Context) -> usize {
2828            1
2829        }
2830
2831        #[inline(always)]
2832        fn inline_size(_context: fidl::encoding::Context) -> usize {
2833            1
2834        }
2835    }
2836
2837    unsafe impl<D: fidl::encoding::ResourceDialect>
2838        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D>
2839        for &InputMethodEditorDispatchKey3Response
2840    {
2841        #[inline]
2842        unsafe fn encode(
2843            self,
2844            encoder: &mut fidl::encoding::Encoder<'_, D>,
2845            offset: usize,
2846            _depth: fidl::encoding::Depth,
2847        ) -> fidl::Result<()> {
2848            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2849            // Delegate to tuple encoding.
2850            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response, D>::encode(
2851                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
2852                encoder,
2853                offset,
2854                _depth,
2855            )
2856        }
2857    }
2858    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2859        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D> for (T0,)
2860    {
2861        #[inline]
2862        unsafe fn encode(
2863            self,
2864            encoder: &mut fidl::encoding::Encoder<'_, D>,
2865            offset: usize,
2866            depth: fidl::encoding::Depth,
2867        ) -> fidl::Result<()> {
2868            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2869            // Zero out padding regions. There's no need to apply masks
2870            // because the unmasked parts will be overwritten by fields.
2871            // Write the fields.
2872            self.0.encode(encoder, offset + 0, depth)?;
2873            Ok(())
2874        }
2875    }
2876
2877    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2878        for InputMethodEditorDispatchKey3Response
2879    {
2880        #[inline(always)]
2881        fn new_empty() -> Self {
2882            Self { handled: fidl::new_empty!(bool, D) }
2883        }
2884
2885        #[inline]
2886        unsafe fn decode(
2887            &mut self,
2888            decoder: &mut fidl::encoding::Decoder<'_, D>,
2889            offset: usize,
2890            _depth: fidl::encoding::Depth,
2891        ) -> fidl::Result<()> {
2892            decoder.debug_check_bounds::<Self>(offset);
2893            // Verify that padding bytes are zero.
2894            fidl::decode!(bool, D, &mut self.handled, decoder, offset + 0, _depth)?;
2895            Ok(())
2896        }
2897    }
2898
2899    impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
2900        type Borrowed<'a> = &'a Self;
2901        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2902            value
2903        }
2904    }
2905
2906    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorInjectInputRequest {
2907        type Owned = Self;
2908
2909        #[inline(always)]
2910        fn inline_align(_context: fidl::encoding::Context) -> usize {
2911            8
2912        }
2913
2914        #[inline(always)]
2915        fn inline_size(_context: fidl::encoding::Context) -> usize {
2916            16
2917        }
2918    }
2919
2920    unsafe impl<D: fidl::encoding::ResourceDialect>
2921        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D>
2922        for &InputMethodEditorInjectInputRequest
2923    {
2924        #[inline]
2925        unsafe fn encode(
2926            self,
2927            encoder: &mut fidl::encoding::Encoder<'_, D>,
2928            offset: usize,
2929            _depth: fidl::encoding::Depth,
2930        ) -> fidl::Result<()> {
2931            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2932            // Delegate to tuple encoding.
2933            fidl::encoding::Encode::<InputMethodEditorInjectInputRequest, D>::encode(
2934                (<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
2935                encoder,
2936                offset,
2937                _depth,
2938            )
2939        }
2940    }
2941    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputEvent, D>>
2942        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D> for (T0,)
2943    {
2944        #[inline]
2945        unsafe fn encode(
2946            self,
2947            encoder: &mut fidl::encoding::Encoder<'_, D>,
2948            offset: usize,
2949            depth: fidl::encoding::Depth,
2950        ) -> fidl::Result<()> {
2951            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2952            // Zero out padding regions. There's no need to apply masks
2953            // because the unmasked parts will be overwritten by fields.
2954            // Write the fields.
2955            self.0.encode(encoder, offset + 0, depth)?;
2956            Ok(())
2957        }
2958    }
2959
2960    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2961        for InputMethodEditorInjectInputRequest
2962    {
2963        #[inline(always)]
2964        fn new_empty() -> Self {
2965            Self { event: fidl::new_empty!(InputEvent, D) }
2966        }
2967
2968        #[inline]
2969        unsafe fn decode(
2970            &mut self,
2971            decoder: &mut fidl::encoding::Decoder<'_, D>,
2972            offset: usize,
2973            _depth: fidl::encoding::Depth,
2974        ) -> fidl::Result<()> {
2975            decoder.debug_check_bounds::<Self>(offset);
2976            // Verify that padding bytes are zero.
2977            fidl::decode!(InputEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
2978            Ok(())
2979        }
2980    }
2981
2982    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2983        type Borrowed<'a> = &'a Self;
2984        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2985            value
2986        }
2987    }
2988
2989    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2990        type Owned = Self;
2991
2992        #[inline(always)]
2993        fn inline_align(_context: fidl::encoding::Context) -> usize {
2994            4
2995        }
2996
2997        #[inline(always)]
2998        fn inline_size(_context: fidl::encoding::Context) -> usize {
2999            4
3000        }
3001    }
3002
3003    unsafe impl<D: fidl::encoding::ResourceDialect>
3004        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D>
3005        for &InputMethodEditorSetKeyboardTypeRequest
3006    {
3007        #[inline]
3008        unsafe fn encode(
3009            self,
3010            encoder: &mut fidl::encoding::Encoder<'_, D>,
3011            offset: usize,
3012            _depth: fidl::encoding::Depth,
3013        ) -> fidl::Result<()> {
3014            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
3015            // Delegate to tuple encoding.
3016            fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest, D>::encode(
3017                (<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
3018                encoder,
3019                offset,
3020                _depth,
3021            )
3022        }
3023    }
3024    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardType, D>>
3025        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D> for (T0,)
3026    {
3027        #[inline]
3028        unsafe fn encode(
3029            self,
3030            encoder: &mut fidl::encoding::Encoder<'_, D>,
3031            offset: usize,
3032            depth: fidl::encoding::Depth,
3033        ) -> fidl::Result<()> {
3034            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
3035            // Zero out padding regions. There's no need to apply masks
3036            // because the unmasked parts will be overwritten by fields.
3037            // Write the fields.
3038            self.0.encode(encoder, offset + 0, depth)?;
3039            Ok(())
3040        }
3041    }
3042
3043    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3044        for InputMethodEditorSetKeyboardTypeRequest
3045    {
3046        #[inline(always)]
3047        fn new_empty() -> Self {
3048            Self { keyboard_type: fidl::new_empty!(KeyboardType, D) }
3049        }
3050
3051        #[inline]
3052        unsafe fn decode(
3053            &mut self,
3054            decoder: &mut fidl::encoding::Decoder<'_, D>,
3055            offset: usize,
3056            _depth: fidl::encoding::Depth,
3057        ) -> fidl::Result<()> {
3058            decoder.debug_check_bounds::<Self>(offset);
3059            // Verify that padding bytes are zero.
3060            fidl::decode!(KeyboardType, D, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
3061            Ok(())
3062        }
3063    }
3064
3065    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
3066        type Borrowed<'a> = &'a Self;
3067        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3068            value
3069        }
3070    }
3071
3072    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetStateRequest {
3073        type Owned = Self;
3074
3075        #[inline(always)]
3076        fn inline_align(_context: fidl::encoding::Context) -> usize {
3077            8
3078        }
3079
3080        #[inline(always)]
3081        fn inline_size(_context: fidl::encoding::Context) -> usize {
3082            64
3083        }
3084    }
3085
3086    unsafe impl<D: fidl::encoding::ResourceDialect>
3087        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D>
3088        for &InputMethodEditorSetStateRequest
3089    {
3090        #[inline]
3091        unsafe fn encode(
3092            self,
3093            encoder: &mut fidl::encoding::Encoder<'_, D>,
3094            offset: usize,
3095            _depth: fidl::encoding::Depth,
3096        ) -> fidl::Result<()> {
3097            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
3098            // Delegate to tuple encoding.
3099            fidl::encoding::Encode::<InputMethodEditorSetStateRequest, D>::encode(
3100                (<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
3101                encoder,
3102                offset,
3103                _depth,
3104            )
3105        }
3106    }
3107    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TextInputState, D>>
3108        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D> for (T0,)
3109    {
3110        #[inline]
3111        unsafe fn encode(
3112            self,
3113            encoder: &mut fidl::encoding::Encoder<'_, D>,
3114            offset: usize,
3115            depth: fidl::encoding::Depth,
3116        ) -> fidl::Result<()> {
3117            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
3118            // Zero out padding regions. There's no need to apply masks
3119            // because the unmasked parts will be overwritten by fields.
3120            // Write the fields.
3121            self.0.encode(encoder, offset + 0, depth)?;
3122            Ok(())
3123        }
3124    }
3125
3126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3127        for InputMethodEditorSetStateRequest
3128    {
3129        #[inline(always)]
3130        fn new_empty() -> Self {
3131            Self { state: fidl::new_empty!(TextInputState, D) }
3132        }
3133
3134        #[inline]
3135        unsafe fn decode(
3136            &mut self,
3137            decoder: &mut fidl::encoding::Decoder<'_, D>,
3138            offset: usize,
3139            _depth: fidl::encoding::Depth,
3140        ) -> fidl::Result<()> {
3141            decoder.debug_check_bounds::<Self>(offset);
3142            // Verify that padding bytes are zero.
3143            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
3144            Ok(())
3145        }
3146    }
3147
3148    impl fidl::encoding::ValueTypeMarker for InputReport {
3149        type Borrowed<'a> = &'a Self;
3150        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3151            value
3152        }
3153    }
3154
3155    unsafe impl fidl::encoding::TypeMarker for InputReport {
3156        type Owned = Self;
3157
3158        #[inline(always)]
3159        fn inline_align(_context: fidl::encoding::Context) -> usize {
3160            8
3161        }
3162
3163        #[inline(always)]
3164        fn inline_size(_context: fidl::encoding::Context) -> usize {
3165            72
3166        }
3167    }
3168
3169    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
3170        for &InputReport
3171    {
3172        #[inline]
3173        unsafe fn encode(
3174            self,
3175            encoder: &mut fidl::encoding::Encoder<'_, D>,
3176            offset: usize,
3177            _depth: fidl::encoding::Depth,
3178        ) -> fidl::Result<()> {
3179            encoder.debug_check_bounds::<InputReport>(offset);
3180            // Delegate to tuple encoding.
3181            fidl::encoding::Encode::<InputReport, D>::encode(
3182                (
3183                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3184                    <fidl::encoding::Boxed<KeyboardReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
3185                    <fidl::encoding::Boxed<MediaButtonsReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
3186                    <fidl::encoding::Boxed<MouseReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
3187                    <fidl::encoding::Boxed<StylusReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
3188                    <fidl::encoding::Boxed<TouchscreenReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
3189                    <fidl::encoding::OptionalUnion<SensorReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
3190                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.trace_id),
3191                ),
3192                encoder, offset, _depth
3193            )
3194        }
3195    }
3196    unsafe impl<
3197            D: fidl::encoding::ResourceDialect,
3198            T0: fidl::encoding::Encode<u64, D>,
3199            T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>, D>,
3200            T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>, D>,
3201            T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>, D>,
3202            T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>, D>,
3203            T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>, D>,
3204            T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>, D>,
3205            T7: fidl::encoding::Encode<u64, D>,
3206        > fidl::encoding::Encode<InputReport, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
3207    {
3208        #[inline]
3209        unsafe fn encode(
3210            self,
3211            encoder: &mut fidl::encoding::Encoder<'_, D>,
3212            offset: usize,
3213            depth: fidl::encoding::Depth,
3214        ) -> fidl::Result<()> {
3215            encoder.debug_check_bounds::<InputReport>(offset);
3216            // Zero out padding regions. There's no need to apply masks
3217            // because the unmasked parts will be overwritten by fields.
3218            // Write the fields.
3219            self.0.encode(encoder, offset + 0, depth)?;
3220            self.1.encode(encoder, offset + 8, depth)?;
3221            self.2.encode(encoder, offset + 16, depth)?;
3222            self.3.encode(encoder, offset + 24, depth)?;
3223            self.4.encode(encoder, offset + 32, depth)?;
3224            self.5.encode(encoder, offset + 40, depth)?;
3225            self.6.encode(encoder, offset + 48, depth)?;
3226            self.7.encode(encoder, offset + 64, depth)?;
3227            Ok(())
3228        }
3229    }
3230
3231    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
3232        #[inline(always)]
3233        fn new_empty() -> Self {
3234            Self {
3235                event_time: fidl::new_empty!(u64, D),
3236                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>, D),
3237                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>, D),
3238                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>, D),
3239                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>, D),
3240                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>, D),
3241                sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>, D),
3242                trace_id: fidl::new_empty!(u64, D),
3243            }
3244        }
3245
3246        #[inline]
3247        unsafe fn decode(
3248            &mut self,
3249            decoder: &mut fidl::encoding::Decoder<'_, D>,
3250            offset: usize,
3251            _depth: fidl::encoding::Depth,
3252        ) -> fidl::Result<()> {
3253            decoder.debug_check_bounds::<Self>(offset);
3254            // Verify that padding bytes are zero.
3255            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3256            fidl::decode!(
3257                fidl::encoding::Boxed<KeyboardReport>,
3258                D,
3259                &mut self.keyboard,
3260                decoder,
3261                offset + 8,
3262                _depth
3263            )?;
3264            fidl::decode!(
3265                fidl::encoding::Boxed<MediaButtonsReport>,
3266                D,
3267                &mut self.media_buttons,
3268                decoder,
3269                offset + 16,
3270                _depth
3271            )?;
3272            fidl::decode!(
3273                fidl::encoding::Boxed<MouseReport>,
3274                D,
3275                &mut self.mouse,
3276                decoder,
3277                offset + 24,
3278                _depth
3279            )?;
3280            fidl::decode!(
3281                fidl::encoding::Boxed<StylusReport>,
3282                D,
3283                &mut self.stylus,
3284                decoder,
3285                offset + 32,
3286                _depth
3287            )?;
3288            fidl::decode!(
3289                fidl::encoding::Boxed<TouchscreenReport>,
3290                D,
3291                &mut self.touchscreen,
3292                decoder,
3293                offset + 40,
3294                _depth
3295            )?;
3296            fidl::decode!(
3297                fidl::encoding::OptionalUnion<SensorReport>,
3298                D,
3299                &mut self.sensor,
3300                decoder,
3301                offset + 48,
3302                _depth
3303            )?;
3304            fidl::decode!(u64, D, &mut self.trace_id, decoder, offset + 64, _depth)?;
3305            Ok(())
3306        }
3307    }
3308
3309    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
3310        type Borrowed<'a> = &'a Self;
3311        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3312            value
3313        }
3314    }
3315
3316    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
3317        type Owned = Self;
3318
3319        #[inline(always)]
3320        fn inline_align(_context: fidl::encoding::Context) -> usize {
3321            8
3322        }
3323
3324        #[inline(always)]
3325        fn inline_size(_context: fidl::encoding::Context) -> usize {
3326            16
3327        }
3328    }
3329
3330    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
3331        for &KeyboardDescriptor
3332    {
3333        #[inline]
3334        unsafe fn encode(
3335            self,
3336            encoder: &mut fidl::encoding::Encoder<'_, D>,
3337            offset: usize,
3338            _depth: fidl::encoding::Depth,
3339        ) -> fidl::Result<()> {
3340            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3341            // Delegate to tuple encoding.
3342            fidl::encoding::Encode::<KeyboardDescriptor, D>::encode(
3343                (
3344                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
3345                ),
3346                encoder, offset, _depth
3347            )
3348        }
3349    }
3350    unsafe impl<
3351            D: fidl::encoding::ResourceDialect,
3352            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3353        > fidl::encoding::Encode<KeyboardDescriptor, D> for (T0,)
3354    {
3355        #[inline]
3356        unsafe fn encode(
3357            self,
3358            encoder: &mut fidl::encoding::Encoder<'_, D>,
3359            offset: usize,
3360            depth: fidl::encoding::Depth,
3361        ) -> fidl::Result<()> {
3362            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3363            // Zero out padding regions. There's no need to apply masks
3364            // because the unmasked parts will be overwritten by fields.
3365            // Write the fields.
3366            self.0.encode(encoder, offset + 0, depth)?;
3367            Ok(())
3368        }
3369    }
3370
3371    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
3372        #[inline(always)]
3373        fn new_empty() -> Self {
3374            Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3375        }
3376
3377        #[inline]
3378        unsafe fn decode(
3379            &mut self,
3380            decoder: &mut fidl::encoding::Decoder<'_, D>,
3381            offset: usize,
3382            _depth: fidl::encoding::Depth,
3383        ) -> fidl::Result<()> {
3384            decoder.debug_check_bounds::<Self>(offset);
3385            // Verify that padding bytes are zero.
3386            fidl::decode!(
3387                fidl::encoding::UnboundedVector<u32>,
3388                D,
3389                &mut self.keys,
3390                decoder,
3391                offset + 0,
3392                _depth
3393            )?;
3394            Ok(())
3395        }
3396    }
3397
3398    impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
3399        type Borrowed<'a> = &'a Self;
3400        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3401            value
3402        }
3403    }
3404
3405    unsafe impl fidl::encoding::TypeMarker for KeyboardEvent {
3406        type Owned = Self;
3407
3408        #[inline(always)]
3409        fn inline_align(_context: fidl::encoding::Context) -> usize {
3410            8
3411        }
3412
3413        #[inline(always)]
3414        fn inline_size(_context: fidl::encoding::Context) -> usize {
3415            32
3416        }
3417    }
3418
3419    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardEvent, D>
3420        for &KeyboardEvent
3421    {
3422        #[inline]
3423        unsafe fn encode(
3424            self,
3425            encoder: &mut fidl::encoding::Encoder<'_, D>,
3426            offset: usize,
3427            _depth: fidl::encoding::Depth,
3428        ) -> fidl::Result<()> {
3429            encoder.debug_check_bounds::<KeyboardEvent>(offset);
3430            // Delegate to tuple encoding.
3431            fidl::encoding::Encode::<KeyboardEvent, D>::encode(
3432                (
3433                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3434                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
3435                    <KeyboardEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
3436                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hid_usage),
3437                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.code_point),
3438                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.modifiers),
3439                ),
3440                encoder,
3441                offset,
3442                _depth,
3443            )
3444        }
3445    }
3446    unsafe impl<
3447            D: fidl::encoding::ResourceDialect,
3448            T0: fidl::encoding::Encode<u64, D>,
3449            T1: fidl::encoding::Encode<u32, D>,
3450            T2: fidl::encoding::Encode<KeyboardEventPhase, D>,
3451            T3: fidl::encoding::Encode<u32, D>,
3452            T4: fidl::encoding::Encode<u32, D>,
3453            T5: fidl::encoding::Encode<u32, D>,
3454        > fidl::encoding::Encode<KeyboardEvent, D> for (T0, T1, T2, T3, T4, T5)
3455    {
3456        #[inline]
3457        unsafe fn encode(
3458            self,
3459            encoder: &mut fidl::encoding::Encoder<'_, D>,
3460            offset: usize,
3461            depth: fidl::encoding::Depth,
3462        ) -> fidl::Result<()> {
3463            encoder.debug_check_bounds::<KeyboardEvent>(offset);
3464            // Zero out padding regions. There's no need to apply masks
3465            // because the unmasked parts will be overwritten by fields.
3466            unsafe {
3467                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3468                (ptr as *mut u64).write_unaligned(0);
3469            }
3470            // Write the fields.
3471            self.0.encode(encoder, offset + 0, depth)?;
3472            self.1.encode(encoder, offset + 8, depth)?;
3473            self.2.encode(encoder, offset + 12, depth)?;
3474            self.3.encode(encoder, offset + 16, depth)?;
3475            self.4.encode(encoder, offset + 20, depth)?;
3476            self.5.encode(encoder, offset + 24, depth)?;
3477            Ok(())
3478        }
3479    }
3480
3481    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEvent {
3482        #[inline(always)]
3483        fn new_empty() -> Self {
3484            Self {
3485                event_time: fidl::new_empty!(u64, D),
3486                device_id: fidl::new_empty!(u32, D),
3487                phase: fidl::new_empty!(KeyboardEventPhase, D),
3488                hid_usage: fidl::new_empty!(u32, D),
3489                code_point: fidl::new_empty!(u32, D),
3490                modifiers: fidl::new_empty!(u32, D),
3491            }
3492        }
3493
3494        #[inline]
3495        unsafe fn decode(
3496            &mut self,
3497            decoder: &mut fidl::encoding::Decoder<'_, D>,
3498            offset: usize,
3499            _depth: fidl::encoding::Depth,
3500        ) -> fidl::Result<()> {
3501            decoder.debug_check_bounds::<Self>(offset);
3502            // Verify that padding bytes are zero.
3503            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3504            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3505            let mask = 0xffffffff00000000u64;
3506            let maskedval = padval & mask;
3507            if maskedval != 0 {
3508                return Err(fidl::Error::NonZeroPadding {
3509                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3510                });
3511            }
3512            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3513            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
3514            fidl::decode!(KeyboardEventPhase, D, &mut self.phase, decoder, offset + 12, _depth)?;
3515            fidl::decode!(u32, D, &mut self.hid_usage, decoder, offset + 16, _depth)?;
3516            fidl::decode!(u32, D, &mut self.code_point, decoder, offset + 20, _depth)?;
3517            fidl::decode!(u32, D, &mut self.modifiers, decoder, offset + 24, _depth)?;
3518            Ok(())
3519        }
3520    }
3521
3522    impl fidl::encoding::ValueTypeMarker for KeyboardReport {
3523        type Borrowed<'a> = &'a Self;
3524        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3525            value
3526        }
3527    }
3528
3529    unsafe impl fidl::encoding::TypeMarker for KeyboardReport {
3530        type Owned = Self;
3531
3532        #[inline(always)]
3533        fn inline_align(_context: fidl::encoding::Context) -> usize {
3534            8
3535        }
3536
3537        #[inline(always)]
3538        fn inline_size(_context: fidl::encoding::Context) -> usize {
3539            16
3540        }
3541    }
3542
3543    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardReport, D>
3544        for &KeyboardReport
3545    {
3546        #[inline]
3547        unsafe fn encode(
3548            self,
3549            encoder: &mut fidl::encoding::Encoder<'_, D>,
3550            offset: usize,
3551            _depth: fidl::encoding::Depth,
3552        ) -> fidl::Result<()> {
3553            encoder.debug_check_bounds::<KeyboardReport>(offset);
3554            // Delegate to tuple encoding.
3555            fidl::encoding::Encode::<KeyboardReport, D>::encode(
3556                (
3557                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
3558                ),
3559                encoder, offset, _depth
3560            )
3561        }
3562    }
3563    unsafe impl<
3564            D: fidl::encoding::ResourceDialect,
3565            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3566        > fidl::encoding::Encode<KeyboardReport, D> for (T0,)
3567    {
3568        #[inline]
3569        unsafe fn encode(
3570            self,
3571            encoder: &mut fidl::encoding::Encoder<'_, D>,
3572            offset: usize,
3573            depth: fidl::encoding::Depth,
3574        ) -> fidl::Result<()> {
3575            encoder.debug_check_bounds::<KeyboardReport>(offset);
3576            // Zero out padding regions. There's no need to apply masks
3577            // because the unmasked parts will be overwritten by fields.
3578            // Write the fields.
3579            self.0.encode(encoder, offset + 0, depth)?;
3580            Ok(())
3581        }
3582    }
3583
3584    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardReport {
3585        #[inline(always)]
3586        fn new_empty() -> Self {
3587            Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3588        }
3589
3590        #[inline]
3591        unsafe fn decode(
3592            &mut self,
3593            decoder: &mut fidl::encoding::Decoder<'_, D>,
3594            offset: usize,
3595            _depth: fidl::encoding::Depth,
3596        ) -> fidl::Result<()> {
3597            decoder.debug_check_bounds::<Self>(offset);
3598            // Verify that padding bytes are zero.
3599            fidl::decode!(
3600                fidl::encoding::UnboundedVector<u32>,
3601                D,
3602                &mut self.pressed_keys,
3603                decoder,
3604                offset + 0,
3605                _depth
3606            )?;
3607            Ok(())
3608        }
3609    }
3610
3611    impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
3612        type Borrowed<'a> = &'a Self;
3613        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3614            value
3615        }
3616    }
3617
3618    unsafe impl fidl::encoding::TypeMarker for MediaButtonsDescriptor {
3619        type Owned = Self;
3620
3621        #[inline(always)]
3622        fn inline_align(_context: fidl::encoding::Context) -> usize {
3623            4
3624        }
3625
3626        #[inline(always)]
3627        fn inline_size(_context: fidl::encoding::Context) -> usize {
3628            4
3629        }
3630        #[inline(always)]
3631        fn encode_is_copy() -> bool {
3632            true
3633        }
3634
3635        #[inline(always)]
3636        fn decode_is_copy() -> bool {
3637            true
3638        }
3639    }
3640
3641    unsafe impl<D: fidl::encoding::ResourceDialect>
3642        fidl::encoding::Encode<MediaButtonsDescriptor, D> for &MediaButtonsDescriptor
3643    {
3644        #[inline]
3645        unsafe fn encode(
3646            self,
3647            encoder: &mut fidl::encoding::Encoder<'_, D>,
3648            offset: usize,
3649            _depth: fidl::encoding::Depth,
3650        ) -> fidl::Result<()> {
3651            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3652            unsafe {
3653                // Copy the object into the buffer.
3654                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3655                (buf_ptr as *mut MediaButtonsDescriptor)
3656                    .write_unaligned((self as *const MediaButtonsDescriptor).read());
3657                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3658                // done second because the memcpy will write garbage to these bytes.
3659            }
3660            Ok(())
3661        }
3662    }
3663    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3664        fidl::encoding::Encode<MediaButtonsDescriptor, D> for (T0,)
3665    {
3666        #[inline]
3667        unsafe fn encode(
3668            self,
3669            encoder: &mut fidl::encoding::Encoder<'_, D>,
3670            offset: usize,
3671            depth: fidl::encoding::Depth,
3672        ) -> fidl::Result<()> {
3673            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3674            // Zero out padding regions. There's no need to apply masks
3675            // because the unmasked parts will be overwritten by fields.
3676            // Write the fields.
3677            self.0.encode(encoder, offset + 0, depth)?;
3678            Ok(())
3679        }
3680    }
3681
3682    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3683        for MediaButtonsDescriptor
3684    {
3685        #[inline(always)]
3686        fn new_empty() -> Self {
3687            Self { buttons: fidl::new_empty!(u32, D) }
3688        }
3689
3690        #[inline]
3691        unsafe fn decode(
3692            &mut self,
3693            decoder: &mut fidl::encoding::Decoder<'_, D>,
3694            offset: usize,
3695            _depth: fidl::encoding::Depth,
3696        ) -> fidl::Result<()> {
3697            decoder.debug_check_bounds::<Self>(offset);
3698            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3699            // Verify that padding bytes are zero.
3700            // Copy from the buffer into the object.
3701            unsafe {
3702                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3703            }
3704            Ok(())
3705        }
3706    }
3707
3708    impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
3709        type Borrowed<'a> = &'a Self;
3710        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3711            value
3712        }
3713    }
3714
3715    unsafe impl fidl::encoding::TypeMarker for MediaButtonsReport {
3716        type Owned = Self;
3717
3718        #[inline(always)]
3719        fn inline_align(_context: fidl::encoding::Context) -> usize {
3720            1
3721        }
3722
3723        #[inline(always)]
3724        fn inline_size(_context: fidl::encoding::Context) -> usize {
3725            6
3726        }
3727    }
3728
3729    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsReport, D>
3730        for &MediaButtonsReport
3731    {
3732        #[inline]
3733        unsafe fn encode(
3734            self,
3735            encoder: &mut fidl::encoding::Encoder<'_, D>,
3736            offset: usize,
3737            _depth: fidl::encoding::Depth,
3738        ) -> fidl::Result<()> {
3739            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3740            // Delegate to tuple encoding.
3741            fidl::encoding::Encode::<MediaButtonsReport, D>::encode(
3742                (
3743                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_up),
3744                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_down),
3745                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mic_mute),
3746                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reset),
3747                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.pause),
3748                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.camera_disable),
3749                ),
3750                encoder,
3751                offset,
3752                _depth,
3753            )
3754        }
3755    }
3756    unsafe impl<
3757            D: fidl::encoding::ResourceDialect,
3758            T0: fidl::encoding::Encode<bool, D>,
3759            T1: fidl::encoding::Encode<bool, D>,
3760            T2: fidl::encoding::Encode<bool, D>,
3761            T3: fidl::encoding::Encode<bool, D>,
3762            T4: fidl::encoding::Encode<bool, D>,
3763            T5: fidl::encoding::Encode<bool, D>,
3764        > fidl::encoding::Encode<MediaButtonsReport, D> for (T0, T1, T2, T3, T4, T5)
3765    {
3766        #[inline]
3767        unsafe fn encode(
3768            self,
3769            encoder: &mut fidl::encoding::Encoder<'_, D>,
3770            offset: usize,
3771            depth: fidl::encoding::Depth,
3772        ) -> fidl::Result<()> {
3773            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3774            // Zero out padding regions. There's no need to apply masks
3775            // because the unmasked parts will be overwritten by fields.
3776            // Write the fields.
3777            self.0.encode(encoder, offset + 0, depth)?;
3778            self.1.encode(encoder, offset + 1, depth)?;
3779            self.2.encode(encoder, offset + 2, depth)?;
3780            self.3.encode(encoder, offset + 3, depth)?;
3781            self.4.encode(encoder, offset + 4, depth)?;
3782            self.5.encode(encoder, offset + 5, depth)?;
3783            Ok(())
3784        }
3785    }
3786
3787    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsReport {
3788        #[inline(always)]
3789        fn new_empty() -> Self {
3790            Self {
3791                volume_up: fidl::new_empty!(bool, D),
3792                volume_down: fidl::new_empty!(bool, D),
3793                mic_mute: fidl::new_empty!(bool, D),
3794                reset: fidl::new_empty!(bool, D),
3795                pause: fidl::new_empty!(bool, D),
3796                camera_disable: fidl::new_empty!(bool, D),
3797            }
3798        }
3799
3800        #[inline]
3801        unsafe fn decode(
3802            &mut self,
3803            decoder: &mut fidl::encoding::Decoder<'_, D>,
3804            offset: usize,
3805            _depth: fidl::encoding::Depth,
3806        ) -> fidl::Result<()> {
3807            decoder.debug_check_bounds::<Self>(offset);
3808            // Verify that padding bytes are zero.
3809            fidl::decode!(bool, D, &mut self.volume_up, decoder, offset + 0, _depth)?;
3810            fidl::decode!(bool, D, &mut self.volume_down, decoder, offset + 1, _depth)?;
3811            fidl::decode!(bool, D, &mut self.mic_mute, decoder, offset + 2, _depth)?;
3812            fidl::decode!(bool, D, &mut self.reset, decoder, offset + 3, _depth)?;
3813            fidl::decode!(bool, D, &mut self.pause, decoder, offset + 4, _depth)?;
3814            fidl::decode!(bool, D, &mut self.camera_disable, decoder, offset + 5, _depth)?;
3815            Ok(())
3816        }
3817    }
3818
3819    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
3820        type Borrowed<'a> = &'a Self;
3821        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3822            value
3823        }
3824    }
3825
3826    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
3827        type Owned = Self;
3828
3829        #[inline(always)]
3830        fn inline_align(_context: fidl::encoding::Context) -> usize {
3831            8
3832        }
3833
3834        #[inline(always)]
3835        fn inline_size(_context: fidl::encoding::Context) -> usize {
3836            56
3837        }
3838    }
3839
3840    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
3841        for &MouseDescriptor
3842    {
3843        #[inline]
3844        unsafe fn encode(
3845            self,
3846            encoder: &mut fidl::encoding::Encoder<'_, D>,
3847            offset: usize,
3848            _depth: fidl::encoding::Depth,
3849        ) -> fidl::Result<()> {
3850            encoder.debug_check_bounds::<MouseDescriptor>(offset);
3851            // Delegate to tuple encoding.
3852            fidl::encoding::Encode::<MouseDescriptor, D>::encode(
3853                (
3854                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_x),
3855                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_y),
3856                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3857                        &self.vscroll,
3858                    ),
3859                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3860                        &self.hscroll,
3861                    ),
3862                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
3863                ),
3864                encoder,
3865                offset,
3866                _depth,
3867            )
3868        }
3869    }
3870    unsafe impl<
3871            D: fidl::encoding::ResourceDialect,
3872            T0: fidl::encoding::Encode<Axis, D>,
3873            T1: fidl::encoding::Encode<Axis, D>,
3874            T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3875            T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3876            T4: fidl::encoding::Encode<u32, D>,
3877        > fidl::encoding::Encode<MouseDescriptor, D> for (T0, T1, T2, T3, T4)
3878    {
3879        #[inline]
3880        unsafe fn encode(
3881            self,
3882            encoder: &mut fidl::encoding::Encoder<'_, D>,
3883            offset: usize,
3884            depth: fidl::encoding::Depth,
3885        ) -> fidl::Result<()> {
3886            encoder.debug_check_bounds::<MouseDescriptor>(offset);
3887            // Zero out padding regions. There's no need to apply masks
3888            // because the unmasked parts will be overwritten by fields.
3889            unsafe {
3890                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
3891                (ptr as *mut u64).write_unaligned(0);
3892            }
3893            // Write the fields.
3894            self.0.encode(encoder, offset + 0, depth)?;
3895            self.1.encode(encoder, offset + 16, depth)?;
3896            self.2.encode(encoder, offset + 32, depth)?;
3897            self.3.encode(encoder, offset + 40, depth)?;
3898            self.4.encode(encoder, offset + 48, depth)?;
3899            Ok(())
3900        }
3901    }
3902
3903    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
3904        #[inline(always)]
3905        fn new_empty() -> Self {
3906            Self {
3907                rel_x: fidl::new_empty!(Axis, D),
3908                rel_y: fidl::new_empty!(Axis, D),
3909                vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3910                hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3911                buttons: fidl::new_empty!(u32, D),
3912            }
3913        }
3914
3915        #[inline]
3916        unsafe fn decode(
3917            &mut self,
3918            decoder: &mut fidl::encoding::Decoder<'_, D>,
3919            offset: usize,
3920            _depth: fidl::encoding::Depth,
3921        ) -> fidl::Result<()> {
3922            decoder.debug_check_bounds::<Self>(offset);
3923            // Verify that padding bytes are zero.
3924            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
3925            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3926            let mask = 0xffffffff00000000u64;
3927            let maskedval = padval & mask;
3928            if maskedval != 0 {
3929                return Err(fidl::Error::NonZeroPadding {
3930                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
3931                });
3932            }
3933            fidl::decode!(Axis, D, &mut self.rel_x, decoder, offset + 0, _depth)?;
3934            fidl::decode!(Axis, D, &mut self.rel_y, decoder, offset + 16, _depth)?;
3935            fidl::decode!(
3936                fidl::encoding::Boxed<Axis>,
3937                D,
3938                &mut self.vscroll,
3939                decoder,
3940                offset + 32,
3941                _depth
3942            )?;
3943            fidl::decode!(
3944                fidl::encoding::Boxed<Axis>,
3945                D,
3946                &mut self.hscroll,
3947                decoder,
3948                offset + 40,
3949                _depth
3950            )?;
3951            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 48, _depth)?;
3952            Ok(())
3953        }
3954    }
3955
3956    impl fidl::encoding::ValueTypeMarker for MouseReport {
3957        type Borrowed<'a> = &'a Self;
3958        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3959            value
3960        }
3961    }
3962
3963    unsafe impl fidl::encoding::TypeMarker for MouseReport {
3964        type Owned = Self;
3965
3966        #[inline(always)]
3967        fn inline_align(_context: fidl::encoding::Context) -> usize {
3968            4
3969        }
3970
3971        #[inline(always)]
3972        fn inline_size(_context: fidl::encoding::Context) -> usize {
3973            20
3974        }
3975        #[inline(always)]
3976        fn encode_is_copy() -> bool {
3977            true
3978        }
3979
3980        #[inline(always)]
3981        fn decode_is_copy() -> bool {
3982            true
3983        }
3984    }
3985
3986    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseReport, D>
3987        for &MouseReport
3988    {
3989        #[inline]
3990        unsafe fn encode(
3991            self,
3992            encoder: &mut fidl::encoding::Encoder<'_, D>,
3993            offset: usize,
3994            _depth: fidl::encoding::Depth,
3995        ) -> fidl::Result<()> {
3996            encoder.debug_check_bounds::<MouseReport>(offset);
3997            unsafe {
3998                // Copy the object into the buffer.
3999                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4000                (buf_ptr as *mut MouseReport).write_unaligned((self as *const MouseReport).read());
4001                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4002                // done second because the memcpy will write garbage to these bytes.
4003            }
4004            Ok(())
4005        }
4006    }
4007    unsafe impl<
4008            D: fidl::encoding::ResourceDialect,
4009            T0: fidl::encoding::Encode<i32, D>,
4010            T1: fidl::encoding::Encode<i32, D>,
4011            T2: fidl::encoding::Encode<i32, D>,
4012            T3: fidl::encoding::Encode<i32, D>,
4013            T4: fidl::encoding::Encode<u32, D>,
4014        > fidl::encoding::Encode<MouseReport, D> for (T0, T1, T2, T3, T4)
4015    {
4016        #[inline]
4017        unsafe fn encode(
4018            self,
4019            encoder: &mut fidl::encoding::Encoder<'_, D>,
4020            offset: usize,
4021            depth: fidl::encoding::Depth,
4022        ) -> fidl::Result<()> {
4023            encoder.debug_check_bounds::<MouseReport>(offset);
4024            // Zero out padding regions. There's no need to apply masks
4025            // because the unmasked parts will be overwritten by fields.
4026            // Write the fields.
4027            self.0.encode(encoder, offset + 0, depth)?;
4028            self.1.encode(encoder, offset + 4, depth)?;
4029            self.2.encode(encoder, offset + 8, depth)?;
4030            self.3.encode(encoder, offset + 12, depth)?;
4031            self.4.encode(encoder, offset + 16, depth)?;
4032            Ok(())
4033        }
4034    }
4035
4036    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseReport {
4037        #[inline(always)]
4038        fn new_empty() -> Self {
4039            Self {
4040                rel_x: fidl::new_empty!(i32, D),
4041                rel_y: fidl::new_empty!(i32, D),
4042                rel_hscroll: fidl::new_empty!(i32, D),
4043                rel_vscroll: fidl::new_empty!(i32, D),
4044                pressed_buttons: fidl::new_empty!(u32, D),
4045            }
4046        }
4047
4048        #[inline]
4049        unsafe fn decode(
4050            &mut self,
4051            decoder: &mut fidl::encoding::Decoder<'_, D>,
4052            offset: usize,
4053            _depth: fidl::encoding::Depth,
4054        ) -> fidl::Result<()> {
4055            decoder.debug_check_bounds::<Self>(offset);
4056            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4057            // Verify that padding bytes are zero.
4058            // Copy from the buffer into the object.
4059            unsafe {
4060                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
4061            }
4062            Ok(())
4063        }
4064    }
4065
4066    impl fidl::encoding::ValueTypeMarker for PointerEvent {
4067        type Borrowed<'a> = &'a Self;
4068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4069            value
4070        }
4071    }
4072
4073    unsafe impl fidl::encoding::TypeMarker for PointerEvent {
4074        type Owned = Self;
4075
4076        #[inline(always)]
4077        fn inline_align(_context: fidl::encoding::Context) -> usize {
4078            8
4079        }
4080
4081        #[inline(always)]
4082        fn inline_size(_context: fidl::encoding::Context) -> usize {
4083            48
4084        }
4085    }
4086
4087    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PointerEvent, D>
4088        for &PointerEvent
4089    {
4090        #[inline]
4091        unsafe fn encode(
4092            self,
4093            encoder: &mut fidl::encoding::Encoder<'_, D>,
4094            offset: usize,
4095            _depth: fidl::encoding::Depth,
4096        ) -> fidl::Result<()> {
4097            encoder.debug_check_bounds::<PointerEvent>(offset);
4098            // Delegate to tuple encoding.
4099            fidl::encoding::Encode::<PointerEvent, D>::encode(
4100                (
4101                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
4102                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
4103                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_id),
4104                    <PointerEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4105                    <PointerEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
4106                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4107                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4108                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_major),
4109                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_minor),
4110                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4111                ),
4112                encoder,
4113                offset,
4114                _depth,
4115            )
4116        }
4117    }
4118    unsafe impl<
4119            D: fidl::encoding::ResourceDialect,
4120            T0: fidl::encoding::Encode<u64, D>,
4121            T1: fidl::encoding::Encode<u32, D>,
4122            T2: fidl::encoding::Encode<u32, D>,
4123            T3: fidl::encoding::Encode<PointerEventType, D>,
4124            T4: fidl::encoding::Encode<PointerEventPhase, D>,
4125            T5: fidl::encoding::Encode<f32, D>,
4126            T6: fidl::encoding::Encode<f32, D>,
4127            T7: fidl::encoding::Encode<f32, D>,
4128            T8: fidl::encoding::Encode<f32, D>,
4129            T9: fidl::encoding::Encode<u32, D>,
4130        > fidl::encoding::Encode<PointerEvent, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
4131    {
4132        #[inline]
4133        unsafe fn encode(
4134            self,
4135            encoder: &mut fidl::encoding::Encoder<'_, D>,
4136            offset: usize,
4137            depth: fidl::encoding::Depth,
4138        ) -> fidl::Result<()> {
4139            encoder.debug_check_bounds::<PointerEvent>(offset);
4140            // Zero out padding regions. There's no need to apply masks
4141            // because the unmasked parts will be overwritten by fields.
4142            unsafe {
4143                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4144                (ptr as *mut u64).write_unaligned(0);
4145            }
4146            // Write the fields.
4147            self.0.encode(encoder, offset + 0, depth)?;
4148            self.1.encode(encoder, offset + 8, depth)?;
4149            self.2.encode(encoder, offset + 12, depth)?;
4150            self.3.encode(encoder, offset + 16, depth)?;
4151            self.4.encode(encoder, offset + 20, depth)?;
4152            self.5.encode(encoder, offset + 24, depth)?;
4153            self.6.encode(encoder, offset + 28, depth)?;
4154            self.7.encode(encoder, offset + 32, depth)?;
4155            self.8.encode(encoder, offset + 36, depth)?;
4156            self.9.encode(encoder, offset + 40, depth)?;
4157            Ok(())
4158        }
4159    }
4160
4161    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEvent {
4162        #[inline(always)]
4163        fn new_empty() -> Self {
4164            Self {
4165                event_time: fidl::new_empty!(u64, D),
4166                device_id: fidl::new_empty!(u32, D),
4167                pointer_id: fidl::new_empty!(u32, D),
4168                type_: fidl::new_empty!(PointerEventType, D),
4169                phase: fidl::new_empty!(PointerEventPhase, D),
4170                x: fidl::new_empty!(f32, D),
4171                y: fidl::new_empty!(f32, D),
4172                radius_major: fidl::new_empty!(f32, D),
4173                radius_minor: fidl::new_empty!(f32, D),
4174                buttons: fidl::new_empty!(u32, D),
4175            }
4176        }
4177
4178        #[inline]
4179        unsafe fn decode(
4180            &mut self,
4181            decoder: &mut fidl::encoding::Decoder<'_, D>,
4182            offset: usize,
4183            _depth: fidl::encoding::Depth,
4184        ) -> fidl::Result<()> {
4185            decoder.debug_check_bounds::<Self>(offset);
4186            // Verify that padding bytes are zero.
4187            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4188            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4189            let mask = 0xffffffff00000000u64;
4190            let maskedval = padval & mask;
4191            if maskedval != 0 {
4192                return Err(fidl::Error::NonZeroPadding {
4193                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4194                });
4195            }
4196            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
4197            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
4198            fidl::decode!(u32, D, &mut self.pointer_id, decoder, offset + 12, _depth)?;
4199            fidl::decode!(PointerEventType, D, &mut self.type_, decoder, offset + 16, _depth)?;
4200            fidl::decode!(PointerEventPhase, D, &mut self.phase, decoder, offset + 20, _depth)?;
4201            fidl::decode!(f32, D, &mut self.x, decoder, offset + 24, _depth)?;
4202            fidl::decode!(f32, D, &mut self.y, decoder, offset + 28, _depth)?;
4203            fidl::decode!(f32, D, &mut self.radius_major, decoder, offset + 32, _depth)?;
4204            fidl::decode!(f32, D, &mut self.radius_minor, decoder, offset + 36, _depth)?;
4205            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 40, _depth)?;
4206            Ok(())
4207        }
4208    }
4209
4210    impl fidl::encoding::ValueTypeMarker for Range {
4211        type Borrowed<'a> = &'a Self;
4212        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4213            value
4214        }
4215    }
4216
4217    unsafe impl fidl::encoding::TypeMarker for Range {
4218        type Owned = Self;
4219
4220        #[inline(always)]
4221        fn inline_align(_context: fidl::encoding::Context) -> usize {
4222            4
4223        }
4224
4225        #[inline(always)]
4226        fn inline_size(_context: fidl::encoding::Context) -> usize {
4227            8
4228        }
4229        #[inline(always)]
4230        fn encode_is_copy() -> bool {
4231            true
4232        }
4233
4234        #[inline(always)]
4235        fn decode_is_copy() -> bool {
4236            true
4237        }
4238    }
4239
4240    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
4241        #[inline]
4242        unsafe fn encode(
4243            self,
4244            encoder: &mut fidl::encoding::Encoder<'_, D>,
4245            offset: usize,
4246            _depth: fidl::encoding::Depth,
4247        ) -> fidl::Result<()> {
4248            encoder.debug_check_bounds::<Range>(offset);
4249            unsafe {
4250                // Copy the object into the buffer.
4251                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4252                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
4253                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4254                // done second because the memcpy will write garbage to these bytes.
4255            }
4256            Ok(())
4257        }
4258    }
4259    unsafe impl<
4260            D: fidl::encoding::ResourceDialect,
4261            T0: fidl::encoding::Encode<i32, D>,
4262            T1: fidl::encoding::Encode<i32, D>,
4263        > fidl::encoding::Encode<Range, D> for (T0, T1)
4264    {
4265        #[inline]
4266        unsafe fn encode(
4267            self,
4268            encoder: &mut fidl::encoding::Encoder<'_, D>,
4269            offset: usize,
4270            depth: fidl::encoding::Depth,
4271        ) -> fidl::Result<()> {
4272            encoder.debug_check_bounds::<Range>(offset);
4273            // Zero out padding regions. There's no need to apply masks
4274            // because the unmasked parts will be overwritten by fields.
4275            // Write the fields.
4276            self.0.encode(encoder, offset + 0, depth)?;
4277            self.1.encode(encoder, offset + 4, depth)?;
4278            Ok(())
4279        }
4280    }
4281
4282    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
4283        #[inline(always)]
4284        fn new_empty() -> Self {
4285            Self { min: fidl::new_empty!(i32, D), max: fidl::new_empty!(i32, D) }
4286        }
4287
4288        #[inline]
4289        unsafe fn decode(
4290            &mut self,
4291            decoder: &mut fidl::encoding::Decoder<'_, D>,
4292            offset: usize,
4293            _depth: fidl::encoding::Depth,
4294        ) -> fidl::Result<()> {
4295            decoder.debug_check_bounds::<Self>(offset);
4296            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4297            // Verify that padding bytes are zero.
4298            // Copy from the buffer into the object.
4299            unsafe {
4300                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4301            }
4302            Ok(())
4303        }
4304    }
4305
4306    impl fidl::encoding::ValueTypeMarker for RangeF {
4307        type Borrowed<'a> = &'a Self;
4308        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4309            value
4310        }
4311    }
4312
4313    unsafe impl fidl::encoding::TypeMarker for RangeF {
4314        type Owned = Self;
4315
4316        #[inline(always)]
4317        fn inline_align(_context: fidl::encoding::Context) -> usize {
4318            4
4319        }
4320
4321        #[inline(always)]
4322        fn inline_size(_context: fidl::encoding::Context) -> usize {
4323            8
4324        }
4325    }
4326
4327    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RangeF, D> for &RangeF {
4328        #[inline]
4329        unsafe fn encode(
4330            self,
4331            encoder: &mut fidl::encoding::Encoder<'_, D>,
4332            offset: usize,
4333            _depth: fidl::encoding::Depth,
4334        ) -> fidl::Result<()> {
4335            encoder.debug_check_bounds::<RangeF>(offset);
4336            // Delegate to tuple encoding.
4337            fidl::encoding::Encode::<RangeF, D>::encode(
4338                (
4339                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
4340                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
4341                ),
4342                encoder,
4343                offset,
4344                _depth,
4345            )
4346        }
4347    }
4348    unsafe impl<
4349            D: fidl::encoding::ResourceDialect,
4350            T0: fidl::encoding::Encode<f32, D>,
4351            T1: fidl::encoding::Encode<f32, D>,
4352        > fidl::encoding::Encode<RangeF, D> for (T0, T1)
4353    {
4354        #[inline]
4355        unsafe fn encode(
4356            self,
4357            encoder: &mut fidl::encoding::Encoder<'_, D>,
4358            offset: usize,
4359            depth: fidl::encoding::Depth,
4360        ) -> fidl::Result<()> {
4361            encoder.debug_check_bounds::<RangeF>(offset);
4362            // Zero out padding regions. There's no need to apply masks
4363            // because the unmasked parts will be overwritten by fields.
4364            // Write the fields.
4365            self.0.encode(encoder, offset + 0, depth)?;
4366            self.1.encode(encoder, offset + 4, depth)?;
4367            Ok(())
4368        }
4369    }
4370
4371    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RangeF {
4372        #[inline(always)]
4373        fn new_empty() -> Self {
4374            Self { min: fidl::new_empty!(f32, D), max: fidl::new_empty!(f32, D) }
4375        }
4376
4377        #[inline]
4378        unsafe fn decode(
4379            &mut self,
4380            decoder: &mut fidl::encoding::Decoder<'_, D>,
4381            offset: usize,
4382            _depth: fidl::encoding::Depth,
4383        ) -> fidl::Result<()> {
4384            decoder.debug_check_bounds::<Self>(offset);
4385            // Verify that padding bytes are zero.
4386            fidl::decode!(f32, D, &mut self.min, decoder, offset + 0, _depth)?;
4387            fidl::decode!(f32, D, &mut self.max, decoder, offset + 4, _depth)?;
4388            Ok(())
4389        }
4390    }
4391
4392    impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
4393        type Borrowed<'a> = &'a Self;
4394        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4395            value
4396        }
4397    }
4398
4399    unsafe impl fidl::encoding::TypeMarker for SendKeyboardInputCmd {
4400        type Owned = Self;
4401
4402        #[inline(always)]
4403        fn inline_align(_context: fidl::encoding::Context) -> usize {
4404            8
4405        }
4406
4407        #[inline(always)]
4408        fn inline_size(_context: fidl::encoding::Context) -> usize {
4409            40
4410        }
4411    }
4412
4413    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendKeyboardInputCmd, D>
4414        for &SendKeyboardInputCmd
4415    {
4416        #[inline]
4417        unsafe fn encode(
4418            self,
4419            encoder: &mut fidl::encoding::Encoder<'_, D>,
4420            offset: usize,
4421            _depth: fidl::encoding::Depth,
4422        ) -> fidl::Result<()> {
4423            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4424            // Delegate to tuple encoding.
4425            fidl::encoding::Encode::<SendKeyboardInputCmd, D>::encode(
4426                (
4427                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4428                    <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
4429                        &self.keyboard_event,
4430                    ),
4431                ),
4432                encoder,
4433                offset,
4434                _depth,
4435            )
4436        }
4437    }
4438    unsafe impl<
4439            D: fidl::encoding::ResourceDialect,
4440            T0: fidl::encoding::Encode<u32, D>,
4441            T1: fidl::encoding::Encode<KeyboardEvent, D>,
4442        > fidl::encoding::Encode<SendKeyboardInputCmd, D> for (T0, T1)
4443    {
4444        #[inline]
4445        unsafe fn encode(
4446            self,
4447            encoder: &mut fidl::encoding::Encoder<'_, D>,
4448            offset: usize,
4449            depth: fidl::encoding::Depth,
4450        ) -> fidl::Result<()> {
4451            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4452            // Zero out padding regions. There's no need to apply masks
4453            // because the unmasked parts will be overwritten by fields.
4454            unsafe {
4455                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4456                (ptr as *mut u64).write_unaligned(0);
4457            }
4458            // Write the fields.
4459            self.0.encode(encoder, offset + 0, depth)?;
4460            self.1.encode(encoder, offset + 8, depth)?;
4461            Ok(())
4462        }
4463    }
4464
4465    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendKeyboardInputCmd {
4466        #[inline(always)]
4467        fn new_empty() -> Self {
4468            Self {
4469                compositor_id: fidl::new_empty!(u32, D),
4470                keyboard_event: fidl::new_empty!(KeyboardEvent, D),
4471            }
4472        }
4473
4474        #[inline]
4475        unsafe fn decode(
4476            &mut self,
4477            decoder: &mut fidl::encoding::Decoder<'_, D>,
4478            offset: usize,
4479            _depth: fidl::encoding::Depth,
4480        ) -> fidl::Result<()> {
4481            decoder.debug_check_bounds::<Self>(offset);
4482            // Verify that padding bytes are zero.
4483            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4484            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4485            let mask = 0xffffffff00000000u64;
4486            let maskedval = padval & mask;
4487            if maskedval != 0 {
4488                return Err(fidl::Error::NonZeroPadding {
4489                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4490                });
4491            }
4492            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4493            fidl::decode!(KeyboardEvent, D, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
4494            Ok(())
4495        }
4496    }
4497
4498    impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
4499        type Borrowed<'a> = &'a Self;
4500        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4501            value
4502        }
4503    }
4504
4505    unsafe impl fidl::encoding::TypeMarker for SendPointerInputCmd {
4506        type Owned = Self;
4507
4508        #[inline(always)]
4509        fn inline_align(_context: fidl::encoding::Context) -> usize {
4510            8
4511        }
4512
4513        #[inline(always)]
4514        fn inline_size(_context: fidl::encoding::Context) -> usize {
4515            56
4516        }
4517    }
4518
4519    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendPointerInputCmd, D>
4520        for &SendPointerInputCmd
4521    {
4522        #[inline]
4523        unsafe fn encode(
4524            self,
4525            encoder: &mut fidl::encoding::Encoder<'_, D>,
4526            offset: usize,
4527            _depth: fidl::encoding::Depth,
4528        ) -> fidl::Result<()> {
4529            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4530            // Delegate to tuple encoding.
4531            fidl::encoding::Encode::<SendPointerInputCmd, D>::encode(
4532                (
4533                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4534                    <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
4535                ),
4536                encoder,
4537                offset,
4538                _depth,
4539            )
4540        }
4541    }
4542    unsafe impl<
4543            D: fidl::encoding::ResourceDialect,
4544            T0: fidl::encoding::Encode<u32, D>,
4545            T1: fidl::encoding::Encode<PointerEvent, D>,
4546        > fidl::encoding::Encode<SendPointerInputCmd, D> for (T0, T1)
4547    {
4548        #[inline]
4549        unsafe fn encode(
4550            self,
4551            encoder: &mut fidl::encoding::Encoder<'_, D>,
4552            offset: usize,
4553            depth: fidl::encoding::Depth,
4554        ) -> fidl::Result<()> {
4555            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4556            // Zero out padding regions. There's no need to apply masks
4557            // because the unmasked parts will be overwritten by fields.
4558            unsafe {
4559                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4560                (ptr as *mut u64).write_unaligned(0);
4561            }
4562            // Write the fields.
4563            self.0.encode(encoder, offset + 0, depth)?;
4564            self.1.encode(encoder, offset + 8, depth)?;
4565            Ok(())
4566        }
4567    }
4568
4569    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendPointerInputCmd {
4570        #[inline(always)]
4571        fn new_empty() -> Self {
4572            Self {
4573                compositor_id: fidl::new_empty!(u32, D),
4574                pointer_event: fidl::new_empty!(PointerEvent, D),
4575            }
4576        }
4577
4578        #[inline]
4579        unsafe fn decode(
4580            &mut self,
4581            decoder: &mut fidl::encoding::Decoder<'_, D>,
4582            offset: usize,
4583            _depth: fidl::encoding::Depth,
4584        ) -> fidl::Result<()> {
4585            decoder.debug_check_bounds::<Self>(offset);
4586            // Verify that padding bytes are zero.
4587            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4588            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4589            let mask = 0xffffffff00000000u64;
4590            let maskedval = padval & mask;
4591            if maskedval != 0 {
4592                return Err(fidl::Error::NonZeroPadding {
4593                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4594                });
4595            }
4596            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4597            fidl::decode!(PointerEvent, D, &mut self.pointer_event, decoder, offset + 8, _depth)?;
4598            Ok(())
4599        }
4600    }
4601
4602    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
4603        type Borrowed<'a> = &'a Self;
4604        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4605            value
4606        }
4607    }
4608
4609    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
4610        type Owned = Self;
4611
4612        #[inline(always)]
4613        fn inline_align(_context: fidl::encoding::Context) -> usize {
4614            4
4615        }
4616
4617        #[inline(always)]
4618        fn inline_size(_context: fidl::encoding::Context) -> usize {
4619            28
4620        }
4621    }
4622
4623    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
4624        for &SensorDescriptor
4625    {
4626        #[inline]
4627        unsafe fn encode(
4628            self,
4629            encoder: &mut fidl::encoding::Encoder<'_, D>,
4630            offset: usize,
4631            _depth: fidl::encoding::Depth,
4632        ) -> fidl::Result<()> {
4633            encoder.debug_check_bounds::<SensorDescriptor>(offset);
4634            // Delegate to tuple encoding.
4635            fidl::encoding::Encode::<SensorDescriptor, D>::encode(
4636                (
4637                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4638                    <SensorLocation as fidl::encoding::ValueTypeMarker>::borrow(&self.loc),
4639                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_sampling_freq),
4640                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_sampling_freq),
4641                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fifo_max_event_count),
4642                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_min),
4643                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_max),
4644                ),
4645                encoder,
4646                offset,
4647                _depth,
4648            )
4649        }
4650    }
4651    unsafe impl<
4652            D: fidl::encoding::ResourceDialect,
4653            T0: fidl::encoding::Encode<SensorType, D>,
4654            T1: fidl::encoding::Encode<SensorLocation, D>,
4655            T2: fidl::encoding::Encode<u32, D>,
4656            T3: fidl::encoding::Encode<u32, D>,
4657            T4: fidl::encoding::Encode<u32, D>,
4658            T5: fidl::encoding::Encode<i32, D>,
4659            T6: fidl::encoding::Encode<i32, D>,
4660        > fidl::encoding::Encode<SensorDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
4661    {
4662        #[inline]
4663        unsafe fn encode(
4664            self,
4665            encoder: &mut fidl::encoding::Encoder<'_, D>,
4666            offset: usize,
4667            depth: fidl::encoding::Depth,
4668        ) -> fidl::Result<()> {
4669            encoder.debug_check_bounds::<SensorDescriptor>(offset);
4670            // Zero out padding regions. There's no need to apply masks
4671            // because the unmasked parts will be overwritten by fields.
4672            // Write the fields.
4673            self.0.encode(encoder, offset + 0, depth)?;
4674            self.1.encode(encoder, offset + 4, depth)?;
4675            self.2.encode(encoder, offset + 8, depth)?;
4676            self.3.encode(encoder, offset + 12, depth)?;
4677            self.4.encode(encoder, offset + 16, depth)?;
4678            self.5.encode(encoder, offset + 20, depth)?;
4679            self.6.encode(encoder, offset + 24, depth)?;
4680            Ok(())
4681        }
4682    }
4683
4684    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
4685        #[inline(always)]
4686        fn new_empty() -> Self {
4687            Self {
4688                type_: fidl::new_empty!(SensorType, D),
4689                loc: fidl::new_empty!(SensorLocation, D),
4690                min_sampling_freq: fidl::new_empty!(u32, D),
4691                max_sampling_freq: fidl::new_empty!(u32, D),
4692                fifo_max_event_count: fidl::new_empty!(u32, D),
4693                phys_min: fidl::new_empty!(i32, D),
4694                phys_max: fidl::new_empty!(i32, D),
4695            }
4696        }
4697
4698        #[inline]
4699        unsafe fn decode(
4700            &mut self,
4701            decoder: &mut fidl::encoding::Decoder<'_, D>,
4702            offset: usize,
4703            _depth: fidl::encoding::Depth,
4704        ) -> fidl::Result<()> {
4705            decoder.debug_check_bounds::<Self>(offset);
4706            // Verify that padding bytes are zero.
4707            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 0, _depth)?;
4708            fidl::decode!(SensorLocation, D, &mut self.loc, decoder, offset + 4, _depth)?;
4709            fidl::decode!(u32, D, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
4710            fidl::decode!(u32, D, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
4711            fidl::decode!(u32, D, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
4712            fidl::decode!(i32, D, &mut self.phys_min, decoder, offset + 20, _depth)?;
4713            fidl::decode!(i32, D, &mut self.phys_max, decoder, offset + 24, _depth)?;
4714            Ok(())
4715        }
4716    }
4717
4718    impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
4719        type Borrowed<'a> = &'a Self;
4720        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4721            value
4722        }
4723    }
4724
4725    unsafe impl fidl::encoding::TypeMarker for SetHardKeyboardDeliveryCmd {
4726        type Owned = Self;
4727
4728        #[inline(always)]
4729        fn inline_align(_context: fidl::encoding::Context) -> usize {
4730            1
4731        }
4732
4733        #[inline(always)]
4734        fn inline_size(_context: fidl::encoding::Context) -> usize {
4735            1
4736        }
4737    }
4738
4739    unsafe impl<D: fidl::encoding::ResourceDialect>
4740        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for &SetHardKeyboardDeliveryCmd
4741    {
4742        #[inline]
4743        unsafe fn encode(
4744            self,
4745            encoder: &mut fidl::encoding::Encoder<'_, D>,
4746            offset: usize,
4747            _depth: fidl::encoding::Depth,
4748        ) -> fidl::Result<()> {
4749            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4750            // Delegate to tuple encoding.
4751            fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd, D>::encode(
4752                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
4753                encoder,
4754                offset,
4755                _depth,
4756            )
4757        }
4758    }
4759    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4760        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for (T0,)
4761    {
4762        #[inline]
4763        unsafe fn encode(
4764            self,
4765            encoder: &mut fidl::encoding::Encoder<'_, D>,
4766            offset: usize,
4767            depth: fidl::encoding::Depth,
4768        ) -> fidl::Result<()> {
4769            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4770            // Zero out padding regions. There's no need to apply masks
4771            // because the unmasked parts will be overwritten by fields.
4772            // Write the fields.
4773            self.0.encode(encoder, offset + 0, depth)?;
4774            Ok(())
4775        }
4776    }
4777
4778    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4779        for SetHardKeyboardDeliveryCmd
4780    {
4781        #[inline(always)]
4782        fn new_empty() -> Self {
4783            Self { delivery_request: fidl::new_empty!(bool, D) }
4784        }
4785
4786        #[inline]
4787        unsafe fn decode(
4788            &mut self,
4789            decoder: &mut fidl::encoding::Decoder<'_, D>,
4790            offset: usize,
4791            _depth: fidl::encoding::Depth,
4792        ) -> fidl::Result<()> {
4793            decoder.debug_check_bounds::<Self>(offset);
4794            // Verify that padding bytes are zero.
4795            fidl::decode!(bool, D, &mut self.delivery_request, decoder, offset + 0, _depth)?;
4796            Ok(())
4797        }
4798    }
4799
4800    impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
4801        type Borrowed<'a> = &'a Self;
4802        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4803            value
4804        }
4805    }
4806
4807    unsafe impl fidl::encoding::TypeMarker for SetParallelDispatchCmd {
4808        type Owned = Self;
4809
4810        #[inline(always)]
4811        fn inline_align(_context: fidl::encoding::Context) -> usize {
4812            1
4813        }
4814
4815        #[inline(always)]
4816        fn inline_size(_context: fidl::encoding::Context) -> usize {
4817            1
4818        }
4819    }
4820
4821    unsafe impl<D: fidl::encoding::ResourceDialect>
4822        fidl::encoding::Encode<SetParallelDispatchCmd, D> for &SetParallelDispatchCmd
4823    {
4824        #[inline]
4825        unsafe fn encode(
4826            self,
4827            encoder: &mut fidl::encoding::Encoder<'_, D>,
4828            offset: usize,
4829            _depth: fidl::encoding::Depth,
4830        ) -> fidl::Result<()> {
4831            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4832            // Delegate to tuple encoding.
4833            fidl::encoding::Encode::<SetParallelDispatchCmd, D>::encode(
4834                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
4835                encoder,
4836                offset,
4837                _depth,
4838            )
4839        }
4840    }
4841    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4842        fidl::encoding::Encode<SetParallelDispatchCmd, D> for (T0,)
4843    {
4844        #[inline]
4845        unsafe fn encode(
4846            self,
4847            encoder: &mut fidl::encoding::Encoder<'_, D>,
4848            offset: usize,
4849            depth: fidl::encoding::Depth,
4850        ) -> fidl::Result<()> {
4851            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4852            // Zero out padding regions. There's no need to apply masks
4853            // because the unmasked parts will be overwritten by fields.
4854            // Write the fields.
4855            self.0.encode(encoder, offset + 0, depth)?;
4856            Ok(())
4857        }
4858    }
4859
4860    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4861        for SetParallelDispatchCmd
4862    {
4863        #[inline(always)]
4864        fn new_empty() -> Self {
4865            Self { parallel_dispatch: fidl::new_empty!(bool, D) }
4866        }
4867
4868        #[inline]
4869        unsafe fn decode(
4870            &mut self,
4871            decoder: &mut fidl::encoding::Decoder<'_, D>,
4872            offset: usize,
4873            _depth: fidl::encoding::Depth,
4874        ) -> fidl::Result<()> {
4875            decoder.debug_check_bounds::<Self>(offset);
4876            // Verify that padding bytes are zero.
4877            fidl::decode!(bool, D, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
4878            Ok(())
4879        }
4880    }
4881
4882    impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
4883        type Borrowed<'a> = &'a Self;
4884        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4885            value
4886        }
4887    }
4888
4889    unsafe impl fidl::encoding::TypeMarker for StylusDescriptor {
4890        type Owned = Self;
4891
4892        #[inline(always)]
4893        fn inline_align(_context: fidl::encoding::Context) -> usize {
4894            8
4895        }
4896
4897        #[inline(always)]
4898        fn inline_size(_context: fidl::encoding::Context) -> usize {
4899            48
4900        }
4901    }
4902
4903    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusDescriptor, D>
4904        for &StylusDescriptor
4905    {
4906        #[inline]
4907        unsafe fn encode(
4908            self,
4909            encoder: &mut fidl::encoding::Encoder<'_, D>,
4910            offset: usize,
4911            _depth: fidl::encoding::Depth,
4912        ) -> fidl::Result<()> {
4913            encoder.debug_check_bounds::<StylusDescriptor>(offset);
4914            // Delegate to tuple encoding.
4915            fidl::encoding::Encode::<StylusDescriptor, D>::encode(
4916                (
4917                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4918                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4919                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
4920                        &self.pressure,
4921                    ),
4922                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_invertible),
4923                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4924                ),
4925                encoder,
4926                offset,
4927                _depth,
4928            )
4929        }
4930    }
4931    unsafe impl<
4932            D: fidl::encoding::ResourceDialect,
4933            T0: fidl::encoding::Encode<Axis, D>,
4934            T1: fidl::encoding::Encode<Axis, D>,
4935            T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
4936            T3: fidl::encoding::Encode<bool, D>,
4937            T4: fidl::encoding::Encode<u32, D>,
4938        > fidl::encoding::Encode<StylusDescriptor, D> for (T0, T1, T2, T3, T4)
4939    {
4940        #[inline]
4941        unsafe fn encode(
4942            self,
4943            encoder: &mut fidl::encoding::Encoder<'_, D>,
4944            offset: usize,
4945            depth: fidl::encoding::Depth,
4946        ) -> fidl::Result<()> {
4947            encoder.debug_check_bounds::<StylusDescriptor>(offset);
4948            // Zero out padding regions. There's no need to apply masks
4949            // because the unmasked parts will be overwritten by fields.
4950            unsafe {
4951                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4952                (ptr as *mut u64).write_unaligned(0);
4953            }
4954            // Write the fields.
4955            self.0.encode(encoder, offset + 0, depth)?;
4956            self.1.encode(encoder, offset + 16, depth)?;
4957            self.2.encode(encoder, offset + 32, depth)?;
4958            self.3.encode(encoder, offset + 40, depth)?;
4959            self.4.encode(encoder, offset + 44, depth)?;
4960            Ok(())
4961        }
4962    }
4963
4964    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusDescriptor {
4965        #[inline(always)]
4966        fn new_empty() -> Self {
4967            Self {
4968                x: fidl::new_empty!(Axis, D),
4969                y: fidl::new_empty!(Axis, D),
4970                pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
4971                is_invertible: fidl::new_empty!(bool, D),
4972                buttons: fidl::new_empty!(u32, D),
4973            }
4974        }
4975
4976        #[inline]
4977        unsafe fn decode(
4978            &mut self,
4979            decoder: &mut fidl::encoding::Decoder<'_, D>,
4980            offset: usize,
4981            _depth: fidl::encoding::Depth,
4982        ) -> fidl::Result<()> {
4983            decoder.debug_check_bounds::<Self>(offset);
4984            // Verify that padding bytes are zero.
4985            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4986            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4987            let mask = 0xffffff00u64;
4988            let maskedval = padval & mask;
4989            if maskedval != 0 {
4990                return Err(fidl::Error::NonZeroPadding {
4991                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4992                });
4993            }
4994            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
4995            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
4996            fidl::decode!(
4997                fidl::encoding::Boxed<Axis>,
4998                D,
4999                &mut self.pressure,
5000                decoder,
5001                offset + 32,
5002                _depth
5003            )?;
5004            fidl::decode!(bool, D, &mut self.is_invertible, decoder, offset + 40, _depth)?;
5005            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 44, _depth)?;
5006            Ok(())
5007        }
5008    }
5009
5010    impl fidl::encoding::ValueTypeMarker for StylusReport {
5011        type Borrowed<'a> = &'a Self;
5012        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5013            value
5014        }
5015    }
5016
5017    unsafe impl fidl::encoding::TypeMarker for StylusReport {
5018        type Owned = Self;
5019
5020        #[inline(always)]
5021        fn inline_align(_context: fidl::encoding::Context) -> usize {
5022            4
5023        }
5024
5025        #[inline(always)]
5026        fn inline_size(_context: fidl::encoding::Context) -> usize {
5027            20
5028        }
5029    }
5030
5031    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusReport, D>
5032        for &StylusReport
5033    {
5034        #[inline]
5035        unsafe fn encode(
5036            self,
5037            encoder: &mut fidl::encoding::Encoder<'_, D>,
5038            offset: usize,
5039            _depth: fidl::encoding::Depth,
5040        ) -> fidl::Result<()> {
5041            encoder.debug_check_bounds::<StylusReport>(offset);
5042            // Delegate to tuple encoding.
5043            fidl::encoding::Encode::<StylusReport, D>::encode(
5044                (
5045                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5046                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5047                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressure),
5048                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_in_contact),
5049                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_range),
5050                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_inverted),
5051                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_buttons),
5052                ),
5053                encoder,
5054                offset,
5055                _depth,
5056            )
5057        }
5058    }
5059    unsafe impl<
5060            D: fidl::encoding::ResourceDialect,
5061            T0: fidl::encoding::Encode<i32, D>,
5062            T1: fidl::encoding::Encode<i32, D>,
5063            T2: fidl::encoding::Encode<u32, D>,
5064            T3: fidl::encoding::Encode<bool, D>,
5065            T4: fidl::encoding::Encode<bool, D>,
5066            T5: fidl::encoding::Encode<bool, D>,
5067            T6: fidl::encoding::Encode<u32, D>,
5068        > fidl::encoding::Encode<StylusReport, D> for (T0, T1, T2, T3, T4, T5, T6)
5069    {
5070        #[inline]
5071        unsafe fn encode(
5072            self,
5073            encoder: &mut fidl::encoding::Encoder<'_, D>,
5074            offset: usize,
5075            depth: fidl::encoding::Depth,
5076        ) -> fidl::Result<()> {
5077            encoder.debug_check_bounds::<StylusReport>(offset);
5078            // Zero out padding regions. There's no need to apply masks
5079            // because the unmasked parts will be overwritten by fields.
5080            unsafe {
5081                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
5082                (ptr as *mut u32).write_unaligned(0);
5083            }
5084            // Write the fields.
5085            self.0.encode(encoder, offset + 0, depth)?;
5086            self.1.encode(encoder, offset + 4, depth)?;
5087            self.2.encode(encoder, offset + 8, depth)?;
5088            self.3.encode(encoder, offset + 12, depth)?;
5089            self.4.encode(encoder, offset + 13, depth)?;
5090            self.5.encode(encoder, offset + 14, depth)?;
5091            self.6.encode(encoder, offset + 16, depth)?;
5092            Ok(())
5093        }
5094    }
5095
5096    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusReport {
5097        #[inline(always)]
5098        fn new_empty() -> Self {
5099            Self {
5100                x: fidl::new_empty!(i32, D),
5101                y: fidl::new_empty!(i32, D),
5102                pressure: fidl::new_empty!(u32, D),
5103                is_in_contact: fidl::new_empty!(bool, D),
5104                in_range: fidl::new_empty!(bool, D),
5105                is_inverted: fidl::new_empty!(bool, D),
5106                pressed_buttons: fidl::new_empty!(u32, D),
5107            }
5108        }
5109
5110        #[inline]
5111        unsafe fn decode(
5112            &mut self,
5113            decoder: &mut fidl::encoding::Decoder<'_, D>,
5114            offset: usize,
5115            _depth: fidl::encoding::Depth,
5116        ) -> fidl::Result<()> {
5117            decoder.debug_check_bounds::<Self>(offset);
5118            // Verify that padding bytes are zero.
5119            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
5120            let padval = unsafe { (ptr as *const u32).read_unaligned() };
5121            let mask = 0xff000000u32;
5122            let maskedval = padval & mask;
5123            if maskedval != 0 {
5124                return Err(fidl::Error::NonZeroPadding {
5125                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
5126                });
5127            }
5128            fidl::decode!(i32, D, &mut self.x, decoder, offset + 0, _depth)?;
5129            fidl::decode!(i32, D, &mut self.y, decoder, offset + 4, _depth)?;
5130            fidl::decode!(u32, D, &mut self.pressure, decoder, offset + 8, _depth)?;
5131            fidl::decode!(bool, D, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
5132            fidl::decode!(bool, D, &mut self.in_range, decoder, offset + 13, _depth)?;
5133            fidl::decode!(bool, D, &mut self.is_inverted, decoder, offset + 14, _depth)?;
5134            fidl::decode!(u32, D, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
5135            Ok(())
5136        }
5137    }
5138
5139    impl fidl::encoding::ValueTypeMarker for TextInputState {
5140        type Borrowed<'a> = &'a Self;
5141        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5142            value
5143        }
5144    }
5145
5146    unsafe impl fidl::encoding::TypeMarker for TextInputState {
5147        type Owned = Self;
5148
5149        #[inline(always)]
5150        fn inline_align(_context: fidl::encoding::Context) -> usize {
5151            8
5152        }
5153
5154        #[inline(always)]
5155        fn inline_size(_context: fidl::encoding::Context) -> usize {
5156            64
5157        }
5158    }
5159
5160    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextInputState, D>
5161        for &TextInputState
5162    {
5163        #[inline]
5164        unsafe fn encode(
5165            self,
5166            encoder: &mut fidl::encoding::Encoder<'_, D>,
5167            offset: usize,
5168            _depth: fidl::encoding::Depth,
5169        ) -> fidl::Result<()> {
5170            encoder.debug_check_bounds::<TextInputState>(offset);
5171            // Delegate to tuple encoding.
5172            fidl::encoding::Encode::<TextInputState, D>::encode(
5173                (
5174                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision),
5175                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
5176                        &self.text,
5177                    ),
5178                    <TextSelection as fidl::encoding::ValueTypeMarker>::borrow(&self.selection),
5179                    <TextRange as fidl::encoding::ValueTypeMarker>::borrow(&self.composing),
5180                ),
5181                encoder,
5182                offset,
5183                _depth,
5184            )
5185        }
5186    }
5187    unsafe impl<
5188            D: fidl::encoding::ResourceDialect,
5189            T0: fidl::encoding::Encode<u32, D>,
5190            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
5191            T2: fidl::encoding::Encode<TextSelection, D>,
5192            T3: fidl::encoding::Encode<TextRange, D>,
5193        > fidl::encoding::Encode<TextInputState, D> for (T0, T1, T2, T3)
5194    {
5195        #[inline]
5196        unsafe fn encode(
5197            self,
5198            encoder: &mut fidl::encoding::Encoder<'_, D>,
5199            offset: usize,
5200            depth: fidl::encoding::Depth,
5201        ) -> fidl::Result<()> {
5202            encoder.debug_check_bounds::<TextInputState>(offset);
5203            // Zero out padding regions. There's no need to apply masks
5204            // because the unmasked parts will be overwritten by fields.
5205            unsafe {
5206                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5207                (ptr as *mut u64).write_unaligned(0);
5208            }
5209            // Write the fields.
5210            self.0.encode(encoder, offset + 0, depth)?;
5211            self.1.encode(encoder, offset + 8, depth)?;
5212            self.2.encode(encoder, offset + 24, depth)?;
5213            self.3.encode(encoder, offset + 48, depth)?;
5214            Ok(())
5215        }
5216    }
5217
5218    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextInputState {
5219        #[inline(always)]
5220        fn new_empty() -> Self {
5221            Self {
5222                revision: fidl::new_empty!(u32, D),
5223                text: fidl::new_empty!(fidl::encoding::UnboundedString, D),
5224                selection: fidl::new_empty!(TextSelection, D),
5225                composing: fidl::new_empty!(TextRange, D),
5226            }
5227        }
5228
5229        #[inline]
5230        unsafe fn decode(
5231            &mut self,
5232            decoder: &mut fidl::encoding::Decoder<'_, D>,
5233            offset: usize,
5234            _depth: fidl::encoding::Depth,
5235        ) -> fidl::Result<()> {
5236            decoder.debug_check_bounds::<Self>(offset);
5237            // Verify that padding bytes are zero.
5238            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5239            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5240            let mask = 0xffffffff00000000u64;
5241            let maskedval = padval & mask;
5242            if maskedval != 0 {
5243                return Err(fidl::Error::NonZeroPadding {
5244                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5245                });
5246            }
5247            fidl::decode!(u32, D, &mut self.revision, decoder, offset + 0, _depth)?;
5248            fidl::decode!(
5249                fidl::encoding::UnboundedString,
5250                D,
5251                &mut self.text,
5252                decoder,
5253                offset + 8,
5254                _depth
5255            )?;
5256            fidl::decode!(TextSelection, D, &mut self.selection, decoder, offset + 24, _depth)?;
5257            fidl::decode!(TextRange, D, &mut self.composing, decoder, offset + 48, _depth)?;
5258            Ok(())
5259        }
5260    }
5261
5262    impl fidl::encoding::ValueTypeMarker for TextRange {
5263        type Borrowed<'a> = &'a Self;
5264        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5265            value
5266        }
5267    }
5268
5269    unsafe impl fidl::encoding::TypeMarker for TextRange {
5270        type Owned = Self;
5271
5272        #[inline(always)]
5273        fn inline_align(_context: fidl::encoding::Context) -> usize {
5274            8
5275        }
5276
5277        #[inline(always)]
5278        fn inline_size(_context: fidl::encoding::Context) -> usize {
5279            16
5280        }
5281        #[inline(always)]
5282        fn encode_is_copy() -> bool {
5283            true
5284        }
5285
5286        #[inline(always)]
5287        fn decode_is_copy() -> bool {
5288            true
5289        }
5290    }
5291
5292    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextRange, D>
5293        for &TextRange
5294    {
5295        #[inline]
5296        unsafe fn encode(
5297            self,
5298            encoder: &mut fidl::encoding::Encoder<'_, D>,
5299            offset: usize,
5300            _depth: fidl::encoding::Depth,
5301        ) -> fidl::Result<()> {
5302            encoder.debug_check_bounds::<TextRange>(offset);
5303            unsafe {
5304                // Copy the object into the buffer.
5305                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5306                (buf_ptr as *mut TextRange).write_unaligned((self as *const TextRange).read());
5307                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5308                // done second because the memcpy will write garbage to these bytes.
5309            }
5310            Ok(())
5311        }
5312    }
5313    unsafe impl<
5314            D: fidl::encoding::ResourceDialect,
5315            T0: fidl::encoding::Encode<i64, D>,
5316            T1: fidl::encoding::Encode<i64, D>,
5317        > fidl::encoding::Encode<TextRange, D> for (T0, T1)
5318    {
5319        #[inline]
5320        unsafe fn encode(
5321            self,
5322            encoder: &mut fidl::encoding::Encoder<'_, D>,
5323            offset: usize,
5324            depth: fidl::encoding::Depth,
5325        ) -> fidl::Result<()> {
5326            encoder.debug_check_bounds::<TextRange>(offset);
5327            // Zero out padding regions. There's no need to apply masks
5328            // because the unmasked parts will be overwritten by fields.
5329            // Write the fields.
5330            self.0.encode(encoder, offset + 0, depth)?;
5331            self.1.encode(encoder, offset + 8, depth)?;
5332            Ok(())
5333        }
5334    }
5335
5336    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextRange {
5337        #[inline(always)]
5338        fn new_empty() -> Self {
5339            Self { start: fidl::new_empty!(i64, D), end: fidl::new_empty!(i64, D) }
5340        }
5341
5342        #[inline]
5343        unsafe fn decode(
5344            &mut self,
5345            decoder: &mut fidl::encoding::Decoder<'_, D>,
5346            offset: usize,
5347            _depth: fidl::encoding::Depth,
5348        ) -> fidl::Result<()> {
5349            decoder.debug_check_bounds::<Self>(offset);
5350            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5351            // Verify that padding bytes are zero.
5352            // Copy from the buffer into the object.
5353            unsafe {
5354                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
5355            }
5356            Ok(())
5357        }
5358    }
5359
5360    impl fidl::encoding::ValueTypeMarker for TextSelection {
5361        type Borrowed<'a> = &'a Self;
5362        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5363            value
5364        }
5365    }
5366
5367    unsafe impl fidl::encoding::TypeMarker for TextSelection {
5368        type Owned = Self;
5369
5370        #[inline(always)]
5371        fn inline_align(_context: fidl::encoding::Context) -> usize {
5372            8
5373        }
5374
5375        #[inline(always)]
5376        fn inline_size(_context: fidl::encoding::Context) -> usize {
5377            24
5378        }
5379    }
5380
5381    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextSelection, D>
5382        for &TextSelection
5383    {
5384        #[inline]
5385        unsafe fn encode(
5386            self,
5387            encoder: &mut fidl::encoding::Encoder<'_, D>,
5388            offset: usize,
5389            _depth: fidl::encoding::Depth,
5390        ) -> fidl::Result<()> {
5391            encoder.debug_check_bounds::<TextSelection>(offset);
5392            // Delegate to tuple encoding.
5393            fidl::encoding::Encode::<TextSelection, D>::encode(
5394                (
5395                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
5396                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
5397                    <TextAffinity as fidl::encoding::ValueTypeMarker>::borrow(&self.affinity),
5398                ),
5399                encoder,
5400                offset,
5401                _depth,
5402            )
5403        }
5404    }
5405    unsafe impl<
5406            D: fidl::encoding::ResourceDialect,
5407            T0: fidl::encoding::Encode<i64, D>,
5408            T1: fidl::encoding::Encode<i64, D>,
5409            T2: fidl::encoding::Encode<TextAffinity, D>,
5410        > fidl::encoding::Encode<TextSelection, D> for (T0, T1, T2)
5411    {
5412        #[inline]
5413        unsafe fn encode(
5414            self,
5415            encoder: &mut fidl::encoding::Encoder<'_, D>,
5416            offset: usize,
5417            depth: fidl::encoding::Depth,
5418        ) -> fidl::Result<()> {
5419            encoder.debug_check_bounds::<TextSelection>(offset);
5420            // Zero out padding regions. There's no need to apply masks
5421            // because the unmasked parts will be overwritten by fields.
5422            unsafe {
5423                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5424                (ptr as *mut u64).write_unaligned(0);
5425            }
5426            // Write the fields.
5427            self.0.encode(encoder, offset + 0, depth)?;
5428            self.1.encode(encoder, offset + 8, depth)?;
5429            self.2.encode(encoder, offset + 16, depth)?;
5430            Ok(())
5431        }
5432    }
5433
5434    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextSelection {
5435        #[inline(always)]
5436        fn new_empty() -> Self {
5437            Self {
5438                base: fidl::new_empty!(i64, D),
5439                extent: fidl::new_empty!(i64, D),
5440                affinity: fidl::new_empty!(TextAffinity, D),
5441            }
5442        }
5443
5444        #[inline]
5445        unsafe fn decode(
5446            &mut self,
5447            decoder: &mut fidl::encoding::Decoder<'_, D>,
5448            offset: usize,
5449            _depth: fidl::encoding::Depth,
5450        ) -> fidl::Result<()> {
5451            decoder.debug_check_bounds::<Self>(offset);
5452            // Verify that padding bytes are zero.
5453            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5454            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5455            let mask = 0xffffffff00000000u64;
5456            let maskedval = padval & mask;
5457            if maskedval != 0 {
5458                return Err(fidl::Error::NonZeroPadding {
5459                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5460                });
5461            }
5462            fidl::decode!(i64, D, &mut self.base, decoder, offset + 0, _depth)?;
5463            fidl::decode!(i64, D, &mut self.extent, decoder, offset + 8, _depth)?;
5464            fidl::decode!(TextAffinity, D, &mut self.affinity, decoder, offset + 16, _depth)?;
5465            Ok(())
5466        }
5467    }
5468
5469    impl fidl::encoding::ValueTypeMarker for Touch {
5470        type Borrowed<'a> = &'a Self;
5471        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5472            value
5473        }
5474    }
5475
5476    unsafe impl fidl::encoding::TypeMarker for Touch {
5477        type Owned = Self;
5478
5479        #[inline(always)]
5480        fn inline_align(_context: fidl::encoding::Context) -> usize {
5481            4
5482        }
5483
5484        #[inline(always)]
5485        fn inline_size(_context: fidl::encoding::Context) -> usize {
5486            20
5487        }
5488        #[inline(always)]
5489        fn encode_is_copy() -> bool {
5490            true
5491        }
5492
5493        #[inline(always)]
5494        fn decode_is_copy() -> bool {
5495            true
5496        }
5497    }
5498
5499    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Touch, D> for &Touch {
5500        #[inline]
5501        unsafe fn encode(
5502            self,
5503            encoder: &mut fidl::encoding::Encoder<'_, D>,
5504            offset: usize,
5505            _depth: fidl::encoding::Depth,
5506        ) -> fidl::Result<()> {
5507            encoder.debug_check_bounds::<Touch>(offset);
5508            unsafe {
5509                // Copy the object into the buffer.
5510                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5511                (buf_ptr as *mut Touch).write_unaligned((self as *const Touch).read());
5512                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5513                // done second because the memcpy will write garbage to these bytes.
5514            }
5515            Ok(())
5516        }
5517    }
5518    unsafe impl<
5519            D: fidl::encoding::ResourceDialect,
5520            T0: fidl::encoding::Encode<u32, D>,
5521            T1: fidl::encoding::Encode<i32, D>,
5522            T2: fidl::encoding::Encode<i32, D>,
5523            T3: fidl::encoding::Encode<u32, D>,
5524            T4: fidl::encoding::Encode<u32, D>,
5525        > fidl::encoding::Encode<Touch, D> for (T0, T1, T2, T3, T4)
5526    {
5527        #[inline]
5528        unsafe fn encode(
5529            self,
5530            encoder: &mut fidl::encoding::Encoder<'_, D>,
5531            offset: usize,
5532            depth: fidl::encoding::Depth,
5533        ) -> fidl::Result<()> {
5534            encoder.debug_check_bounds::<Touch>(offset);
5535            // Zero out padding regions. There's no need to apply masks
5536            // because the unmasked parts will be overwritten by fields.
5537            // Write the fields.
5538            self.0.encode(encoder, offset + 0, depth)?;
5539            self.1.encode(encoder, offset + 4, depth)?;
5540            self.2.encode(encoder, offset + 8, depth)?;
5541            self.3.encode(encoder, offset + 12, depth)?;
5542            self.4.encode(encoder, offset + 16, depth)?;
5543            Ok(())
5544        }
5545    }
5546
5547    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Touch {
5548        #[inline(always)]
5549        fn new_empty() -> Self {
5550            Self {
5551                finger_id: fidl::new_empty!(u32, D),
5552                x: fidl::new_empty!(i32, D),
5553                y: fidl::new_empty!(i32, D),
5554                width: fidl::new_empty!(u32, D),
5555                height: fidl::new_empty!(u32, D),
5556            }
5557        }
5558
5559        #[inline]
5560        unsafe fn decode(
5561            &mut self,
5562            decoder: &mut fidl::encoding::Decoder<'_, D>,
5563            offset: usize,
5564            _depth: fidl::encoding::Depth,
5565        ) -> fidl::Result<()> {
5566            decoder.debug_check_bounds::<Self>(offset);
5567            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5568            // Verify that padding bytes are zero.
5569            // Copy from the buffer into the object.
5570            unsafe {
5571                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
5572            }
5573            Ok(())
5574        }
5575    }
5576
5577    impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
5578        type Borrowed<'a> = &'a Self;
5579        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5580            value
5581        }
5582    }
5583
5584    unsafe impl fidl::encoding::TypeMarker for TouchscreenDescriptor {
5585        type Owned = Self;
5586
5587        #[inline(always)]
5588        fn inline_align(_context: fidl::encoding::Context) -> usize {
5589            4
5590        }
5591
5592        #[inline(always)]
5593        fn inline_size(_context: fidl::encoding::Context) -> usize {
5594            36
5595        }
5596    }
5597
5598    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenDescriptor, D>
5599        for &TouchscreenDescriptor
5600    {
5601        #[inline]
5602        unsafe fn encode(
5603            self,
5604            encoder: &mut fidl::encoding::Encoder<'_, D>,
5605            offset: usize,
5606            _depth: fidl::encoding::Depth,
5607        ) -> fidl::Result<()> {
5608            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5609            // Delegate to tuple encoding.
5610            fidl::encoding::Encode::<TouchscreenDescriptor, D>::encode(
5611                (
5612                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5613                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5614                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_finger_id),
5615                ),
5616                encoder,
5617                offset,
5618                _depth,
5619            )
5620        }
5621    }
5622    unsafe impl<
5623            D: fidl::encoding::ResourceDialect,
5624            T0: fidl::encoding::Encode<Axis, D>,
5625            T1: fidl::encoding::Encode<Axis, D>,
5626            T2: fidl::encoding::Encode<u32, D>,
5627        > fidl::encoding::Encode<TouchscreenDescriptor, D> for (T0, T1, T2)
5628    {
5629        #[inline]
5630        unsafe fn encode(
5631            self,
5632            encoder: &mut fidl::encoding::Encoder<'_, D>,
5633            offset: usize,
5634            depth: fidl::encoding::Depth,
5635        ) -> fidl::Result<()> {
5636            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5637            // Zero out padding regions. There's no need to apply masks
5638            // because the unmasked parts will be overwritten by fields.
5639            // Write the fields.
5640            self.0.encode(encoder, offset + 0, depth)?;
5641            self.1.encode(encoder, offset + 16, depth)?;
5642            self.2.encode(encoder, offset + 32, depth)?;
5643            Ok(())
5644        }
5645    }
5646
5647    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenDescriptor {
5648        #[inline(always)]
5649        fn new_empty() -> Self {
5650            Self {
5651                x: fidl::new_empty!(Axis, D),
5652                y: fidl::new_empty!(Axis, D),
5653                max_finger_id: fidl::new_empty!(u32, D),
5654            }
5655        }
5656
5657        #[inline]
5658        unsafe fn decode(
5659            &mut self,
5660            decoder: &mut fidl::encoding::Decoder<'_, D>,
5661            offset: usize,
5662            _depth: fidl::encoding::Depth,
5663        ) -> fidl::Result<()> {
5664            decoder.debug_check_bounds::<Self>(offset);
5665            // Verify that padding bytes are zero.
5666            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
5667            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
5668            fidl::decode!(u32, D, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
5669            Ok(())
5670        }
5671    }
5672
5673    impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
5674        type Borrowed<'a> = &'a Self;
5675        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5676            value
5677        }
5678    }
5679
5680    unsafe impl fidl::encoding::TypeMarker for TouchscreenReport {
5681        type Owned = Self;
5682
5683        #[inline(always)]
5684        fn inline_align(_context: fidl::encoding::Context) -> usize {
5685            8
5686        }
5687
5688        #[inline(always)]
5689        fn inline_size(_context: fidl::encoding::Context) -> usize {
5690            16
5691        }
5692    }
5693
5694    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenReport, D>
5695        for &TouchscreenReport
5696    {
5697        #[inline]
5698        unsafe fn encode(
5699            self,
5700            encoder: &mut fidl::encoding::Encoder<'_, D>,
5701            offset: usize,
5702            _depth: fidl::encoding::Depth,
5703        ) -> fidl::Result<()> {
5704            encoder.debug_check_bounds::<TouchscreenReport>(offset);
5705            // Delegate to tuple encoding.
5706            fidl::encoding::Encode::<TouchscreenReport, D>::encode(
5707                (
5708                    <fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
5709                ),
5710                encoder, offset, _depth
5711            )
5712        }
5713    }
5714    unsafe impl<
5715            D: fidl::encoding::ResourceDialect,
5716            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>, D>,
5717        > fidl::encoding::Encode<TouchscreenReport, D> for (T0,)
5718    {
5719        #[inline]
5720        unsafe fn encode(
5721            self,
5722            encoder: &mut fidl::encoding::Encoder<'_, D>,
5723            offset: usize,
5724            depth: fidl::encoding::Depth,
5725        ) -> fidl::Result<()> {
5726            encoder.debug_check_bounds::<TouchscreenReport>(offset);
5727            // Zero out padding regions. There's no need to apply masks
5728            // because the unmasked parts will be overwritten by fields.
5729            // Write the fields.
5730            self.0.encode(encoder, offset + 0, depth)?;
5731            Ok(())
5732        }
5733    }
5734
5735    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenReport {
5736        #[inline(always)]
5737        fn new_empty() -> Self {
5738            Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>, D) }
5739        }
5740
5741        #[inline]
5742        unsafe fn decode(
5743            &mut self,
5744            decoder: &mut fidl::encoding::Decoder<'_, D>,
5745            offset: usize,
5746            _depth: fidl::encoding::Depth,
5747        ) -> fidl::Result<()> {
5748            decoder.debug_check_bounds::<Self>(offset);
5749            // Verify that padding bytes are zero.
5750            fidl::decode!(
5751                fidl::encoding::UnboundedVector<Touch>,
5752                D,
5753                &mut self.touches,
5754                decoder,
5755                offset + 0,
5756                _depth
5757            )?;
5758            Ok(())
5759        }
5760    }
5761
5762    impl MediaButtonsEvent {
5763        #[inline(always)]
5764        fn max_ordinal_present(&self) -> u64 {
5765            if let Some(_) = self.device_id {
5766                return 7;
5767            }
5768            if let Some(_) = self.function {
5769                return 6;
5770            }
5771            if let Some(_) = self.power {
5772                return 5;
5773            }
5774            if let Some(_) = self.camera_disable {
5775                return 4;
5776            }
5777            if let Some(_) = self.pause {
5778                return 3;
5779            }
5780            if let Some(_) = self.mic_mute {
5781                return 2;
5782            }
5783            if let Some(_) = self.volume {
5784                return 1;
5785            }
5786            0
5787        }
5788    }
5789
5790    impl fidl::encoding::ValueTypeMarker for MediaButtonsEvent {
5791        type Borrowed<'a> = &'a Self;
5792        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5793            value
5794        }
5795    }
5796
5797    unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
5798        type Owned = Self;
5799
5800        #[inline(always)]
5801        fn inline_align(_context: fidl::encoding::Context) -> usize {
5802            8
5803        }
5804
5805        #[inline(always)]
5806        fn inline_size(_context: fidl::encoding::Context) -> usize {
5807            16
5808        }
5809    }
5810
5811    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsEvent, D>
5812        for &MediaButtonsEvent
5813    {
5814        unsafe fn encode(
5815            self,
5816            encoder: &mut fidl::encoding::Encoder<'_, D>,
5817            offset: usize,
5818            mut depth: fidl::encoding::Depth,
5819        ) -> fidl::Result<()> {
5820            encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
5821            // Vector header
5822            let max_ordinal: u64 = self.max_ordinal_present();
5823            encoder.write_num(max_ordinal, offset);
5824            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5825            // Calling encoder.out_of_line_offset(0) is not allowed.
5826            if max_ordinal == 0 {
5827                return Ok(());
5828            }
5829            depth.increment()?;
5830            let envelope_size = 8;
5831            let bytes_len = max_ordinal as usize * envelope_size;
5832            #[allow(unused_variables)]
5833            let offset = encoder.out_of_line_offset(bytes_len);
5834            let mut _prev_end_offset: usize = 0;
5835            if 1 > max_ordinal {
5836                return Ok(());
5837            }
5838
5839            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5840            // are envelope_size bytes.
5841            let cur_offset: usize = (1 - 1) * envelope_size;
5842
5843            // Zero reserved fields.
5844            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5845
5846            // Safety:
5847            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5848            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5849            //   envelope_size bytes, there is always sufficient room.
5850            fidl::encoding::encode_in_envelope_optional::<i8, D>(
5851                self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
5852                encoder,
5853                offset + cur_offset,
5854                depth,
5855            )?;
5856
5857            _prev_end_offset = cur_offset + envelope_size;
5858            if 2 > max_ordinal {
5859                return Ok(());
5860            }
5861
5862            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5863            // are envelope_size bytes.
5864            let cur_offset: usize = (2 - 1) * envelope_size;
5865
5866            // Zero reserved fields.
5867            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5868
5869            // Safety:
5870            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5871            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5872            //   envelope_size bytes, there is always sufficient room.
5873            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5874                self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5875                encoder,
5876                offset + cur_offset,
5877                depth,
5878            )?;
5879
5880            _prev_end_offset = cur_offset + envelope_size;
5881            if 3 > max_ordinal {
5882                return Ok(());
5883            }
5884
5885            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5886            // are envelope_size bytes.
5887            let cur_offset: usize = (3 - 1) * envelope_size;
5888
5889            // Zero reserved fields.
5890            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5891
5892            // Safety:
5893            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5894            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5895            //   envelope_size bytes, there is always sufficient room.
5896            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5897                self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5898                encoder,
5899                offset + cur_offset,
5900                depth,
5901            )?;
5902
5903            _prev_end_offset = cur_offset + envelope_size;
5904            if 4 > max_ordinal {
5905                return Ok(());
5906            }
5907
5908            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5909            // are envelope_size bytes.
5910            let cur_offset: usize = (4 - 1) * envelope_size;
5911
5912            // Zero reserved fields.
5913            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5914
5915            // Safety:
5916            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5917            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5918            //   envelope_size bytes, there is always sufficient room.
5919            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5920                self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5921                encoder,
5922                offset + cur_offset,
5923                depth,
5924            )?;
5925
5926            _prev_end_offset = cur_offset + envelope_size;
5927            if 5 > max_ordinal {
5928                return Ok(());
5929            }
5930
5931            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5932            // are envelope_size bytes.
5933            let cur_offset: usize = (5 - 1) * envelope_size;
5934
5935            // Zero reserved fields.
5936            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5937
5938            // Safety:
5939            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5940            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5941            //   envelope_size bytes, there is always sufficient room.
5942            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5943                self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5944                encoder,
5945                offset + cur_offset,
5946                depth,
5947            )?;
5948
5949            _prev_end_offset = cur_offset + envelope_size;
5950            if 6 > max_ordinal {
5951                return Ok(());
5952            }
5953
5954            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5955            // are envelope_size bytes.
5956            let cur_offset: usize = (6 - 1) * envelope_size;
5957
5958            // Zero reserved fields.
5959            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5960
5961            // Safety:
5962            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5963            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5964            //   envelope_size bytes, there is always sufficient room.
5965            fidl::encoding::encode_in_envelope_optional::<bool, D>(
5966                self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5967                encoder,
5968                offset + cur_offset,
5969                depth,
5970            )?;
5971
5972            _prev_end_offset = cur_offset + envelope_size;
5973            if 7 > max_ordinal {
5974                return Ok(());
5975            }
5976
5977            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5978            // are envelope_size bytes.
5979            let cur_offset: usize = (7 - 1) * envelope_size;
5980
5981            // Zero reserved fields.
5982            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5983
5984            // Safety:
5985            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5986            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5987            //   envelope_size bytes, there is always sufficient room.
5988            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5989                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5990                encoder,
5991                offset + cur_offset,
5992                depth,
5993            )?;
5994
5995            _prev_end_offset = cur_offset + envelope_size;
5996
5997            Ok(())
5998        }
5999    }
6000
6001    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsEvent {
6002        #[inline(always)]
6003        fn new_empty() -> Self {
6004            Self::default()
6005        }
6006
6007        unsafe fn decode(
6008            &mut self,
6009            decoder: &mut fidl::encoding::Decoder<'_, D>,
6010            offset: usize,
6011            mut depth: fidl::encoding::Depth,
6012        ) -> fidl::Result<()> {
6013            decoder.debug_check_bounds::<Self>(offset);
6014            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6015                None => return Err(fidl::Error::NotNullable),
6016                Some(len) => len,
6017            };
6018            // Calling decoder.out_of_line_offset(0) is not allowed.
6019            if len == 0 {
6020                return Ok(());
6021            };
6022            depth.increment()?;
6023            let envelope_size = 8;
6024            let bytes_len = len * envelope_size;
6025            let offset = decoder.out_of_line_offset(bytes_len)?;
6026            // Decode the envelope for each type.
6027            let mut _next_ordinal_to_read = 0;
6028            let mut next_offset = offset;
6029            let end_offset = offset + bytes_len;
6030            _next_ordinal_to_read += 1;
6031            if next_offset >= end_offset {
6032                return Ok(());
6033            }
6034
6035            // Decode unknown envelopes for gaps in ordinals.
6036            while _next_ordinal_to_read < 1 {
6037                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6038                _next_ordinal_to_read += 1;
6039                next_offset += envelope_size;
6040            }
6041
6042            let next_out_of_line = decoder.next_out_of_line();
6043            let handles_before = decoder.remaining_handles();
6044            if let Some((inlined, num_bytes, num_handles)) =
6045                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6046            {
6047                let member_inline_size =
6048                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6049                if inlined != (member_inline_size <= 4) {
6050                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6051                }
6052                let inner_offset;
6053                let mut inner_depth = depth.clone();
6054                if inlined {
6055                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6056                    inner_offset = next_offset;
6057                } else {
6058                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6059                    inner_depth.increment()?;
6060                }
6061                let val_ref = self.volume.get_or_insert_with(|| fidl::new_empty!(i8, D));
6062                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
6063                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6064                {
6065                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6066                }
6067                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6068                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6069                }
6070            }
6071
6072            next_offset += envelope_size;
6073            _next_ordinal_to_read += 1;
6074            if next_offset >= end_offset {
6075                return Ok(());
6076            }
6077
6078            // Decode unknown envelopes for gaps in ordinals.
6079            while _next_ordinal_to_read < 2 {
6080                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6081                _next_ordinal_to_read += 1;
6082                next_offset += envelope_size;
6083            }
6084
6085            let next_out_of_line = decoder.next_out_of_line();
6086            let handles_before = decoder.remaining_handles();
6087            if let Some((inlined, num_bytes, num_handles)) =
6088                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6089            {
6090                let member_inline_size =
6091                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6092                if inlined != (member_inline_size <= 4) {
6093                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6094                }
6095                let inner_offset;
6096                let mut inner_depth = depth.clone();
6097                if inlined {
6098                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6099                    inner_offset = next_offset;
6100                } else {
6101                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6102                    inner_depth.increment()?;
6103                }
6104                let val_ref = self.mic_mute.get_or_insert_with(|| fidl::new_empty!(bool, D));
6105                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6106                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6107                {
6108                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6109                }
6110                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6111                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6112                }
6113            }
6114
6115            next_offset += envelope_size;
6116            _next_ordinal_to_read += 1;
6117            if next_offset >= end_offset {
6118                return Ok(());
6119            }
6120
6121            // Decode unknown envelopes for gaps in ordinals.
6122            while _next_ordinal_to_read < 3 {
6123                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6124                _next_ordinal_to_read += 1;
6125                next_offset += envelope_size;
6126            }
6127
6128            let next_out_of_line = decoder.next_out_of_line();
6129            let handles_before = decoder.remaining_handles();
6130            if let Some((inlined, num_bytes, num_handles)) =
6131                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6132            {
6133                let member_inline_size =
6134                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6135                if inlined != (member_inline_size <= 4) {
6136                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6137                }
6138                let inner_offset;
6139                let mut inner_depth = depth.clone();
6140                if inlined {
6141                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6142                    inner_offset = next_offset;
6143                } else {
6144                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6145                    inner_depth.increment()?;
6146                }
6147                let val_ref = self.pause.get_or_insert_with(|| fidl::new_empty!(bool, D));
6148                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6149                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6150                {
6151                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6152                }
6153                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6154                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6155                }
6156            }
6157
6158            next_offset += envelope_size;
6159            _next_ordinal_to_read += 1;
6160            if next_offset >= end_offset {
6161                return Ok(());
6162            }
6163
6164            // Decode unknown envelopes for gaps in ordinals.
6165            while _next_ordinal_to_read < 4 {
6166                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6167                _next_ordinal_to_read += 1;
6168                next_offset += envelope_size;
6169            }
6170
6171            let next_out_of_line = decoder.next_out_of_line();
6172            let handles_before = decoder.remaining_handles();
6173            if let Some((inlined, num_bytes, num_handles)) =
6174                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6175            {
6176                let member_inline_size =
6177                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6178                if inlined != (member_inline_size <= 4) {
6179                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6180                }
6181                let inner_offset;
6182                let mut inner_depth = depth.clone();
6183                if inlined {
6184                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6185                    inner_offset = next_offset;
6186                } else {
6187                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6188                    inner_depth.increment()?;
6189                }
6190                let val_ref = self.camera_disable.get_or_insert_with(|| fidl::new_empty!(bool, D));
6191                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6192                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6193                {
6194                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6195                }
6196                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6197                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6198                }
6199            }
6200
6201            next_offset += envelope_size;
6202            _next_ordinal_to_read += 1;
6203            if next_offset >= end_offset {
6204                return Ok(());
6205            }
6206
6207            // Decode unknown envelopes for gaps in ordinals.
6208            while _next_ordinal_to_read < 5 {
6209                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6210                _next_ordinal_to_read += 1;
6211                next_offset += envelope_size;
6212            }
6213
6214            let next_out_of_line = decoder.next_out_of_line();
6215            let handles_before = decoder.remaining_handles();
6216            if let Some((inlined, num_bytes, num_handles)) =
6217                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6218            {
6219                let member_inline_size =
6220                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6221                if inlined != (member_inline_size <= 4) {
6222                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6223                }
6224                let inner_offset;
6225                let mut inner_depth = depth.clone();
6226                if inlined {
6227                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6228                    inner_offset = next_offset;
6229                } else {
6230                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6231                    inner_depth.increment()?;
6232                }
6233                let val_ref = self.power.get_or_insert_with(|| fidl::new_empty!(bool, D));
6234                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6235                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6236                {
6237                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6238                }
6239                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6240                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6241                }
6242            }
6243
6244            next_offset += envelope_size;
6245            _next_ordinal_to_read += 1;
6246            if next_offset >= end_offset {
6247                return Ok(());
6248            }
6249
6250            // Decode unknown envelopes for gaps in ordinals.
6251            while _next_ordinal_to_read < 6 {
6252                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6253                _next_ordinal_to_read += 1;
6254                next_offset += envelope_size;
6255            }
6256
6257            let next_out_of_line = decoder.next_out_of_line();
6258            let handles_before = decoder.remaining_handles();
6259            if let Some((inlined, num_bytes, num_handles)) =
6260                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6261            {
6262                let member_inline_size =
6263                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6264                if inlined != (member_inline_size <= 4) {
6265                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6266                }
6267                let inner_offset;
6268                let mut inner_depth = depth.clone();
6269                if inlined {
6270                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6271                    inner_offset = next_offset;
6272                } else {
6273                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6274                    inner_depth.increment()?;
6275                }
6276                let val_ref = self.function.get_or_insert_with(|| fidl::new_empty!(bool, D));
6277                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6279                {
6280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6281                }
6282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6284                }
6285            }
6286
6287            next_offset += envelope_size;
6288            _next_ordinal_to_read += 1;
6289            if next_offset >= end_offset {
6290                return Ok(());
6291            }
6292
6293            // Decode unknown envelopes for gaps in ordinals.
6294            while _next_ordinal_to_read < 7 {
6295                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6296                _next_ordinal_to_read += 1;
6297                next_offset += envelope_size;
6298            }
6299
6300            let next_out_of_line = decoder.next_out_of_line();
6301            let handles_before = decoder.remaining_handles();
6302            if let Some((inlined, num_bytes, num_handles)) =
6303                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6304            {
6305                let member_inline_size =
6306                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6307                if inlined != (member_inline_size <= 4) {
6308                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6309                }
6310                let inner_offset;
6311                let mut inner_depth = depth.clone();
6312                if inlined {
6313                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6314                    inner_offset = next_offset;
6315                } else {
6316                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6317                    inner_depth.increment()?;
6318                }
6319                let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
6320                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6322                {
6323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6324                }
6325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6327                }
6328            }
6329
6330            next_offset += envelope_size;
6331
6332            // Decode the remaining unknown envelopes.
6333            while next_offset < end_offset {
6334                _next_ordinal_to_read += 1;
6335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6336                next_offset += envelope_size;
6337            }
6338
6339            Ok(())
6340        }
6341    }
6342
6343    impl TouchButtonsEvent {
6344        #[inline(always)]
6345        fn max_ordinal_present(&self) -> u64 {
6346            if let Some(_) = self.pressed_buttons {
6347                return 3;
6348            }
6349            if let Some(_) = self.device_info {
6350                return 2;
6351            }
6352            if let Some(_) = self.event_time {
6353                return 1;
6354            }
6355            0
6356        }
6357    }
6358
6359    impl fidl::encoding::ValueTypeMarker for TouchButtonsEvent {
6360        type Borrowed<'a> = &'a Self;
6361        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6362            value
6363        }
6364    }
6365
6366    unsafe impl fidl::encoding::TypeMarker for TouchButtonsEvent {
6367        type Owned = Self;
6368
6369        #[inline(always)]
6370        fn inline_align(_context: fidl::encoding::Context) -> usize {
6371            8
6372        }
6373
6374        #[inline(always)]
6375        fn inline_size(_context: fidl::encoding::Context) -> usize {
6376            16
6377        }
6378    }
6379
6380    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchButtonsEvent, D>
6381        for &TouchButtonsEvent
6382    {
6383        unsafe fn encode(
6384            self,
6385            encoder: &mut fidl::encoding::Encoder<'_, D>,
6386            offset: usize,
6387            mut depth: fidl::encoding::Depth,
6388        ) -> fidl::Result<()> {
6389            encoder.debug_check_bounds::<TouchButtonsEvent>(offset);
6390            // Vector header
6391            let max_ordinal: u64 = self.max_ordinal_present();
6392            encoder.write_num(max_ordinal, offset);
6393            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6394            // Calling encoder.out_of_line_offset(0) is not allowed.
6395            if max_ordinal == 0 {
6396                return Ok(());
6397            }
6398            depth.increment()?;
6399            let envelope_size = 8;
6400            let bytes_len = max_ordinal as usize * envelope_size;
6401            #[allow(unused_variables)]
6402            let offset = encoder.out_of_line_offset(bytes_len);
6403            let mut _prev_end_offset: usize = 0;
6404            if 1 > max_ordinal {
6405                return Ok(());
6406            }
6407
6408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6409            // are envelope_size bytes.
6410            let cur_offset: usize = (1 - 1) * envelope_size;
6411
6412            // Zero reserved fields.
6413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6414
6415            // Safety:
6416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6418            //   envelope_size bytes, there is always sufficient room.
6419            fidl::encoding::encode_in_envelope_optional::<fidl::MonotonicInstant, D>(
6420                self.event_time
6421                    .as_ref()
6422                    .map(<fidl::MonotonicInstant as fidl::encoding::ValueTypeMarker>::borrow),
6423                encoder,
6424                offset + cur_offset,
6425                depth,
6426            )?;
6427
6428            _prev_end_offset = cur_offset + envelope_size;
6429            if 2 > max_ordinal {
6430                return Ok(());
6431            }
6432
6433            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6434            // are envelope_size bytes.
6435            let cur_offset: usize = (2 - 1) * envelope_size;
6436
6437            // Zero reserved fields.
6438            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6439
6440            // Safety:
6441            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6442            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6443            //   envelope_size bytes, there is always sufficient room.
6444            fidl::encoding::encode_in_envelope_optional::<TouchDeviceInfo, D>(
6445                self.device_info
6446                    .as_ref()
6447                    .map(<TouchDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
6448                encoder,
6449                offset + cur_offset,
6450                depth,
6451            )?;
6452
6453            _prev_end_offset = cur_offset + envelope_size;
6454            if 3 > max_ordinal {
6455                return Ok(());
6456            }
6457
6458            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6459            // are envelope_size bytes.
6460            let cur_offset: usize = (3 - 1) * envelope_size;
6461
6462            // Zero reserved fields.
6463            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6464
6465            // Safety:
6466            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6467            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6468            //   envelope_size bytes, there is always sufficient room.
6469            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<TouchButton>, D>(
6470            self.pressed_buttons.as_ref().map(<fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::ValueTypeMarker>::borrow),
6471            encoder, offset + cur_offset, depth
6472        )?;
6473
6474            _prev_end_offset = cur_offset + envelope_size;
6475
6476            Ok(())
6477        }
6478    }
6479
6480    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchButtonsEvent {
6481        #[inline(always)]
6482        fn new_empty() -> Self {
6483            Self::default()
6484        }
6485
6486        unsafe fn decode(
6487            &mut self,
6488            decoder: &mut fidl::encoding::Decoder<'_, D>,
6489            offset: usize,
6490            mut depth: fidl::encoding::Depth,
6491        ) -> fidl::Result<()> {
6492            decoder.debug_check_bounds::<Self>(offset);
6493            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6494                None => return Err(fidl::Error::NotNullable),
6495                Some(len) => len,
6496            };
6497            // Calling decoder.out_of_line_offset(0) is not allowed.
6498            if len == 0 {
6499                return Ok(());
6500            };
6501            depth.increment()?;
6502            let envelope_size = 8;
6503            let bytes_len = len * envelope_size;
6504            let offset = decoder.out_of_line_offset(bytes_len)?;
6505            // Decode the envelope for each type.
6506            let mut _next_ordinal_to_read = 0;
6507            let mut next_offset = offset;
6508            let end_offset = offset + bytes_len;
6509            _next_ordinal_to_read += 1;
6510            if next_offset >= end_offset {
6511                return Ok(());
6512            }
6513
6514            // Decode unknown envelopes for gaps in ordinals.
6515            while _next_ordinal_to_read < 1 {
6516                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6517                _next_ordinal_to_read += 1;
6518                next_offset += envelope_size;
6519            }
6520
6521            let next_out_of_line = decoder.next_out_of_line();
6522            let handles_before = decoder.remaining_handles();
6523            if let Some((inlined, num_bytes, num_handles)) =
6524                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6525            {
6526                let member_inline_size =
6527                    <fidl::MonotonicInstant as fidl::encoding::TypeMarker>::inline_size(
6528                        decoder.context,
6529                    );
6530                if inlined != (member_inline_size <= 4) {
6531                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6532                }
6533                let inner_offset;
6534                let mut inner_depth = depth.clone();
6535                if inlined {
6536                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6537                    inner_offset = next_offset;
6538                } else {
6539                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6540                    inner_depth.increment()?;
6541                }
6542                let val_ref = self
6543                    .event_time
6544                    .get_or_insert_with(|| fidl::new_empty!(fidl::MonotonicInstant, D));
6545                fidl::decode!(
6546                    fidl::MonotonicInstant,
6547                    D,
6548                    val_ref,
6549                    decoder,
6550                    inner_offset,
6551                    inner_depth
6552                )?;
6553                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6554                {
6555                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6556                }
6557                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6558                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6559                }
6560            }
6561
6562            next_offset += envelope_size;
6563            _next_ordinal_to_read += 1;
6564            if next_offset >= end_offset {
6565                return Ok(());
6566            }
6567
6568            // Decode unknown envelopes for gaps in ordinals.
6569            while _next_ordinal_to_read < 2 {
6570                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6571                _next_ordinal_to_read += 1;
6572                next_offset += envelope_size;
6573            }
6574
6575            let next_out_of_line = decoder.next_out_of_line();
6576            let handles_before = decoder.remaining_handles();
6577            if let Some((inlined, num_bytes, num_handles)) =
6578                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6579            {
6580                let member_inline_size =
6581                    <TouchDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6582                if inlined != (member_inline_size <= 4) {
6583                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6584                }
6585                let inner_offset;
6586                let mut inner_depth = depth.clone();
6587                if inlined {
6588                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6589                    inner_offset = next_offset;
6590                } else {
6591                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6592                    inner_depth.increment()?;
6593                }
6594                let val_ref =
6595                    self.device_info.get_or_insert_with(|| fidl::new_empty!(TouchDeviceInfo, D));
6596                fidl::decode!(TouchDeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
6597                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6598                {
6599                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6600                }
6601                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6602                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6603                }
6604            }
6605
6606            next_offset += envelope_size;
6607            _next_ordinal_to_read += 1;
6608            if next_offset >= end_offset {
6609                return Ok(());
6610            }
6611
6612            // Decode unknown envelopes for gaps in ordinals.
6613            while _next_ordinal_to_read < 3 {
6614                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6615                _next_ordinal_to_read += 1;
6616                next_offset += envelope_size;
6617            }
6618
6619            let next_out_of_line = decoder.next_out_of_line();
6620            let handles_before = decoder.remaining_handles();
6621            if let Some((inlined, num_bytes, num_handles)) =
6622                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6623            {
6624                let member_inline_size = <fidl::encoding::UnboundedVector<TouchButton> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6625                if inlined != (member_inline_size <= 4) {
6626                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6627                }
6628                let inner_offset;
6629                let mut inner_depth = depth.clone();
6630                if inlined {
6631                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6632                    inner_offset = next_offset;
6633                } else {
6634                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6635                    inner_depth.increment()?;
6636                }
6637                let val_ref = self.pressed_buttons.get_or_insert_with(|| {
6638                    fidl::new_empty!(fidl::encoding::UnboundedVector<TouchButton>, D)
6639                });
6640                fidl::decode!(
6641                    fidl::encoding::UnboundedVector<TouchButton>,
6642                    D,
6643                    val_ref,
6644                    decoder,
6645                    inner_offset,
6646                    inner_depth
6647                )?;
6648                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6649                {
6650                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6651                }
6652                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6653                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6654                }
6655            }
6656
6657            next_offset += envelope_size;
6658
6659            // Decode the remaining unknown envelopes.
6660            while next_offset < end_offset {
6661                _next_ordinal_to_read += 1;
6662                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6663                next_offset += envelope_size;
6664            }
6665
6666            Ok(())
6667        }
6668    }
6669
6670    impl TouchDeviceInfo {
6671        #[inline(always)]
6672        fn max_ordinal_present(&self) -> u64 {
6673            if let Some(_) = self.id {
6674                return 1;
6675            }
6676            0
6677        }
6678    }
6679
6680    impl fidl::encoding::ValueTypeMarker for TouchDeviceInfo {
6681        type Borrowed<'a> = &'a Self;
6682        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6683            value
6684        }
6685    }
6686
6687    unsafe impl fidl::encoding::TypeMarker for TouchDeviceInfo {
6688        type Owned = Self;
6689
6690        #[inline(always)]
6691        fn inline_align(_context: fidl::encoding::Context) -> usize {
6692            8
6693        }
6694
6695        #[inline(always)]
6696        fn inline_size(_context: fidl::encoding::Context) -> usize {
6697            16
6698        }
6699    }
6700
6701    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDeviceInfo, D>
6702        for &TouchDeviceInfo
6703    {
6704        unsafe fn encode(
6705            self,
6706            encoder: &mut fidl::encoding::Encoder<'_, D>,
6707            offset: usize,
6708            mut depth: fidl::encoding::Depth,
6709        ) -> fidl::Result<()> {
6710            encoder.debug_check_bounds::<TouchDeviceInfo>(offset);
6711            // Vector header
6712            let max_ordinal: u64 = self.max_ordinal_present();
6713            encoder.write_num(max_ordinal, offset);
6714            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6715            // Calling encoder.out_of_line_offset(0) is not allowed.
6716            if max_ordinal == 0 {
6717                return Ok(());
6718            }
6719            depth.increment()?;
6720            let envelope_size = 8;
6721            let bytes_len = max_ordinal as usize * envelope_size;
6722            #[allow(unused_variables)]
6723            let offset = encoder.out_of_line_offset(bytes_len);
6724            let mut _prev_end_offset: usize = 0;
6725            if 1 > max_ordinal {
6726                return Ok(());
6727            }
6728
6729            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
6730            // are envelope_size bytes.
6731            let cur_offset: usize = (1 - 1) * envelope_size;
6732
6733            // Zero reserved fields.
6734            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6735
6736            // Safety:
6737            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
6738            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
6739            //   envelope_size bytes, there is always sufficient room.
6740            fidl::encoding::encode_in_envelope_optional::<u32, D>(
6741                self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
6742                encoder,
6743                offset + cur_offset,
6744                depth,
6745            )?;
6746
6747            _prev_end_offset = cur_offset + envelope_size;
6748
6749            Ok(())
6750        }
6751    }
6752
6753    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDeviceInfo {
6754        #[inline(always)]
6755        fn new_empty() -> Self {
6756            Self::default()
6757        }
6758
6759        unsafe fn decode(
6760            &mut self,
6761            decoder: &mut fidl::encoding::Decoder<'_, D>,
6762            offset: usize,
6763            mut depth: fidl::encoding::Depth,
6764        ) -> fidl::Result<()> {
6765            decoder.debug_check_bounds::<Self>(offset);
6766            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6767                None => return Err(fidl::Error::NotNullable),
6768                Some(len) => len,
6769            };
6770            // Calling decoder.out_of_line_offset(0) is not allowed.
6771            if len == 0 {
6772                return Ok(());
6773            };
6774            depth.increment()?;
6775            let envelope_size = 8;
6776            let bytes_len = len * envelope_size;
6777            let offset = decoder.out_of_line_offset(bytes_len)?;
6778            // Decode the envelope for each type.
6779            let mut _next_ordinal_to_read = 0;
6780            let mut next_offset = offset;
6781            let end_offset = offset + bytes_len;
6782            _next_ordinal_to_read += 1;
6783            if next_offset >= end_offset {
6784                return Ok(());
6785            }
6786
6787            // Decode unknown envelopes for gaps in ordinals.
6788            while _next_ordinal_to_read < 1 {
6789                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6790                _next_ordinal_to_read += 1;
6791                next_offset += envelope_size;
6792            }
6793
6794            let next_out_of_line = decoder.next_out_of_line();
6795            let handles_before = decoder.remaining_handles();
6796            if let Some((inlined, num_bytes, num_handles)) =
6797                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6798            {
6799                let member_inline_size =
6800                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6801                if inlined != (member_inline_size <= 4) {
6802                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6803                }
6804                let inner_offset;
6805                let mut inner_depth = depth.clone();
6806                if inlined {
6807                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6808                    inner_offset = next_offset;
6809                } else {
6810                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6811                    inner_depth.increment()?;
6812                }
6813                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
6814                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6815                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6816                {
6817                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6818                }
6819                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6820                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6821                }
6822            }
6823
6824            next_offset += envelope_size;
6825
6826            // Decode the remaining unknown envelopes.
6827            while next_offset < end_offset {
6828                _next_ordinal_to_read += 1;
6829                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6830                next_offset += envelope_size;
6831            }
6832
6833            Ok(())
6834        }
6835    }
6836
6837    impl fidl::encoding::ValueTypeMarker for Command {
6838        type Borrowed<'a> = &'a Self;
6839        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6840            value
6841        }
6842    }
6843
6844    unsafe impl fidl::encoding::TypeMarker for Command {
6845        type Owned = Self;
6846
6847        #[inline(always)]
6848        fn inline_align(_context: fidl::encoding::Context) -> usize {
6849            8
6850        }
6851
6852        #[inline(always)]
6853        fn inline_size(_context: fidl::encoding::Context) -> usize {
6854            16
6855        }
6856    }
6857
6858    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Command, D> for &Command {
6859        #[inline]
6860        unsafe fn encode(
6861            self,
6862            encoder: &mut fidl::encoding::Encoder<'_, D>,
6863            offset: usize,
6864            _depth: fidl::encoding::Depth,
6865        ) -> fidl::Result<()> {
6866            encoder.debug_check_bounds::<Command>(offset);
6867            encoder.write_num::<u64>(self.ordinal(), offset);
6868            match self {
6869                Command::SendKeyboardInput(ref val) => {
6870                    fidl::encoding::encode_in_envelope::<SendKeyboardInputCmd, D>(
6871                        <SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6872                        encoder,
6873                        offset + 8,
6874                        _depth,
6875                    )
6876                }
6877                Command::SendPointerInput(ref val) => {
6878                    fidl::encoding::encode_in_envelope::<SendPointerInputCmd, D>(
6879                        <SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6880                        encoder,
6881                        offset + 8,
6882                        _depth,
6883                    )
6884                }
6885                Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
6886                    SetHardKeyboardDeliveryCmd,
6887                    D,
6888                >(
6889                    <SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6890                    encoder,
6891                    offset + 8,
6892                    _depth,
6893                ),
6894                Command::SetParallelDispatch(ref val) => {
6895                    fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd, D>(
6896                        <SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6897                        encoder,
6898                        offset + 8,
6899                        _depth,
6900                    )
6901                }
6902            }
6903        }
6904    }
6905
6906    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
6907        #[inline(always)]
6908        fn new_empty() -> Self {
6909            Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D))
6910        }
6911
6912        #[inline]
6913        unsafe fn decode(
6914            &mut self,
6915            decoder: &mut fidl::encoding::Decoder<'_, D>,
6916            offset: usize,
6917            mut depth: fidl::encoding::Depth,
6918        ) -> fidl::Result<()> {
6919            decoder.debug_check_bounds::<Self>(offset);
6920            #[allow(unused_variables)]
6921            let next_out_of_line = decoder.next_out_of_line();
6922            let handles_before = decoder.remaining_handles();
6923            let (ordinal, inlined, num_bytes, num_handles) =
6924                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6925
6926            let member_inline_size = match ordinal {
6927                1 => <SendKeyboardInputCmd as fidl::encoding::TypeMarker>::inline_size(
6928                    decoder.context,
6929                ),
6930                2 => <SendPointerInputCmd as fidl::encoding::TypeMarker>::inline_size(
6931                    decoder.context,
6932                ),
6933                3 => <SetHardKeyboardDeliveryCmd as fidl::encoding::TypeMarker>::inline_size(
6934                    decoder.context,
6935                ),
6936                4 => <SetParallelDispatchCmd as fidl::encoding::TypeMarker>::inline_size(
6937                    decoder.context,
6938                ),
6939                _ => return Err(fidl::Error::UnknownUnionTag),
6940            };
6941
6942            if inlined != (member_inline_size <= 4) {
6943                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6944            }
6945            let _inner_offset;
6946            if inlined {
6947                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6948                _inner_offset = offset + 8;
6949            } else {
6950                depth.increment()?;
6951                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6952            }
6953            match ordinal {
6954                1 => {
6955                    #[allow(irrefutable_let_patterns)]
6956                    if let Command::SendKeyboardInput(_) = self {
6957                        // Do nothing, read the value into the object
6958                    } else {
6959                        // Initialize `self` to the right variant
6960                        *self =
6961                            Command::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D));
6962                    }
6963                    #[allow(irrefutable_let_patterns)]
6964                    if let Command::SendKeyboardInput(ref mut val) = self {
6965                        fidl::decode!(SendKeyboardInputCmd, D, val, decoder, _inner_offset, depth)?;
6966                    } else {
6967                        unreachable!()
6968                    }
6969                }
6970                2 => {
6971                    #[allow(irrefutable_let_patterns)]
6972                    if let Command::SendPointerInput(_) = self {
6973                        // Do nothing, read the value into the object
6974                    } else {
6975                        // Initialize `self` to the right variant
6976                        *self = Command::SendPointerInput(fidl::new_empty!(SendPointerInputCmd, D));
6977                    }
6978                    #[allow(irrefutable_let_patterns)]
6979                    if let Command::SendPointerInput(ref mut val) = self {
6980                        fidl::decode!(SendPointerInputCmd, D, val, decoder, _inner_offset, depth)?;
6981                    } else {
6982                        unreachable!()
6983                    }
6984                }
6985                3 => {
6986                    #[allow(irrefutable_let_patterns)]
6987                    if let Command::SetHardKeyboardDelivery(_) = self {
6988                        // Do nothing, read the value into the object
6989                    } else {
6990                        // Initialize `self` to the right variant
6991                        *self = Command::SetHardKeyboardDelivery(fidl::new_empty!(
6992                            SetHardKeyboardDeliveryCmd,
6993                            D
6994                        ));
6995                    }
6996                    #[allow(irrefutable_let_patterns)]
6997                    if let Command::SetHardKeyboardDelivery(ref mut val) = self {
6998                        fidl::decode!(
6999                            SetHardKeyboardDeliveryCmd,
7000                            D,
7001                            val,
7002                            decoder,
7003                            _inner_offset,
7004                            depth
7005                        )?;
7006                    } else {
7007                        unreachable!()
7008                    }
7009                }
7010                4 => {
7011                    #[allow(irrefutable_let_patterns)]
7012                    if let Command::SetParallelDispatch(_) = self {
7013                        // Do nothing, read the value into the object
7014                    } else {
7015                        // Initialize `self` to the right variant
7016                        *self = Command::SetParallelDispatch(fidl::new_empty!(
7017                            SetParallelDispatchCmd,
7018                            D
7019                        ));
7020                    }
7021                    #[allow(irrefutable_let_patterns)]
7022                    if let Command::SetParallelDispatch(ref mut val) = self {
7023                        fidl::decode!(
7024                            SetParallelDispatchCmd,
7025                            D,
7026                            val,
7027                            decoder,
7028                            _inner_offset,
7029                            depth
7030                        )?;
7031                    } else {
7032                        unreachable!()
7033                    }
7034                }
7035                ordinal => panic!("unexpected ordinal {:?}", ordinal),
7036            }
7037            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7038                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7039            }
7040            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7041                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7042            }
7043            Ok(())
7044        }
7045    }
7046
7047    impl fidl::encoding::ValueTypeMarker for InputEvent {
7048        type Borrowed<'a> = &'a Self;
7049        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7050            value
7051        }
7052    }
7053
7054    unsafe impl fidl::encoding::TypeMarker for InputEvent {
7055        type Owned = Self;
7056
7057        #[inline(always)]
7058        fn inline_align(_context: fidl::encoding::Context) -> usize {
7059            8
7060        }
7061
7062        #[inline(always)]
7063        fn inline_size(_context: fidl::encoding::Context) -> usize {
7064            16
7065        }
7066    }
7067
7068    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputEvent, D>
7069        for &InputEvent
7070    {
7071        #[inline]
7072        unsafe fn encode(
7073            self,
7074            encoder: &mut fidl::encoding::Encoder<'_, D>,
7075            offset: usize,
7076            _depth: fidl::encoding::Depth,
7077        ) -> fidl::Result<()> {
7078            encoder.debug_check_bounds::<InputEvent>(offset);
7079            encoder.write_num::<u64>(self.ordinal(), offset);
7080            match self {
7081                InputEvent::Pointer(ref val) => {
7082                    fidl::encoding::encode_in_envelope::<PointerEvent, D>(
7083                        <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
7084                        encoder,
7085                        offset + 8,
7086                        _depth,
7087                    )
7088                }
7089                InputEvent::Keyboard(ref val) => {
7090                    fidl::encoding::encode_in_envelope::<KeyboardEvent, D>(
7091                        <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
7092                        encoder,
7093                        offset + 8,
7094                        _depth,
7095                    )
7096                }
7097                InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent, D>(
7098                    <FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
7099                    encoder,
7100                    offset + 8,
7101                    _depth,
7102                ),
7103            }
7104        }
7105    }
7106
7107    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputEvent {
7108        #[inline(always)]
7109        fn new_empty() -> Self {
7110            Self::Pointer(fidl::new_empty!(PointerEvent, D))
7111        }
7112
7113        #[inline]
7114        unsafe fn decode(
7115            &mut self,
7116            decoder: &mut fidl::encoding::Decoder<'_, D>,
7117            offset: usize,
7118            mut depth: fidl::encoding::Depth,
7119        ) -> fidl::Result<()> {
7120            decoder.debug_check_bounds::<Self>(offset);
7121            #[allow(unused_variables)]
7122            let next_out_of_line = decoder.next_out_of_line();
7123            let handles_before = decoder.remaining_handles();
7124            let (ordinal, inlined, num_bytes, num_handles) =
7125                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7126
7127            let member_inline_size = match ordinal {
7128                1 => <PointerEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7129                2 => <KeyboardEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7130                3 => <FocusEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7131                _ => return Err(fidl::Error::UnknownUnionTag),
7132            };
7133
7134            if inlined != (member_inline_size <= 4) {
7135                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7136            }
7137            let _inner_offset;
7138            if inlined {
7139                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7140                _inner_offset = offset + 8;
7141            } else {
7142                depth.increment()?;
7143                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7144            }
7145            match ordinal {
7146                1 => {
7147                    #[allow(irrefutable_let_patterns)]
7148                    if let InputEvent::Pointer(_) = self {
7149                        // Do nothing, read the value into the object
7150                    } else {
7151                        // Initialize `self` to the right variant
7152                        *self = InputEvent::Pointer(fidl::new_empty!(PointerEvent, D));
7153                    }
7154                    #[allow(irrefutable_let_patterns)]
7155                    if let InputEvent::Pointer(ref mut val) = self {
7156                        fidl::decode!(PointerEvent, D, val, decoder, _inner_offset, depth)?;
7157                    } else {
7158                        unreachable!()
7159                    }
7160                }
7161                2 => {
7162                    #[allow(irrefutable_let_patterns)]
7163                    if let InputEvent::Keyboard(_) = self {
7164                        // Do nothing, read the value into the object
7165                    } else {
7166                        // Initialize `self` to the right variant
7167                        *self = InputEvent::Keyboard(fidl::new_empty!(KeyboardEvent, D));
7168                    }
7169                    #[allow(irrefutable_let_patterns)]
7170                    if let InputEvent::Keyboard(ref mut val) = self {
7171                        fidl::decode!(KeyboardEvent, D, val, decoder, _inner_offset, depth)?;
7172                    } else {
7173                        unreachable!()
7174                    }
7175                }
7176                3 => {
7177                    #[allow(irrefutable_let_patterns)]
7178                    if let InputEvent::Focus(_) = self {
7179                        // Do nothing, read the value into the object
7180                    } else {
7181                        // Initialize `self` to the right variant
7182                        *self = InputEvent::Focus(fidl::new_empty!(FocusEvent, D));
7183                    }
7184                    #[allow(irrefutable_let_patterns)]
7185                    if let InputEvent::Focus(ref mut val) = self {
7186                        fidl::decode!(FocusEvent, D, val, decoder, _inner_offset, depth)?;
7187                    } else {
7188                        unreachable!()
7189                    }
7190                }
7191                ordinal => panic!("unexpected ordinal {:?}", ordinal),
7192            }
7193            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7194                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7195            }
7196            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7197                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7198            }
7199            Ok(())
7200        }
7201    }
7202
7203    impl fidl::encoding::ValueTypeMarker for SensorReport {
7204        type Borrowed<'a> = &'a Self;
7205        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7206            value
7207        }
7208    }
7209
7210    unsafe impl fidl::encoding::TypeMarker for SensorReport {
7211        type Owned = Self;
7212
7213        #[inline(always)]
7214        fn inline_align(_context: fidl::encoding::Context) -> usize {
7215            8
7216        }
7217
7218        #[inline(always)]
7219        fn inline_size(_context: fidl::encoding::Context) -> usize {
7220            16
7221        }
7222    }
7223
7224    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorReport, D>
7225        for &SensorReport
7226    {
7227        #[inline]
7228        unsafe fn encode(
7229            self,
7230            encoder: &mut fidl::encoding::Encoder<'_, D>,
7231            offset: usize,
7232            _depth: fidl::encoding::Depth,
7233        ) -> fidl::Result<()> {
7234            encoder.debug_check_bounds::<SensorReport>(offset);
7235            encoder.write_num::<u64>(self.ordinal(), offset);
7236            match self {
7237                SensorReport::Vector(ref val) => fidl::encoding::encode_in_envelope::<
7238                    fidl::encoding::Array<i16, 3>,
7239                    D,
7240                >(
7241                    <fidl::encoding::Array<i16, 3> as fidl::encoding::ValueTypeMarker>::borrow(val),
7242                    encoder,
7243                    offset + 8,
7244                    _depth,
7245                ),
7246                SensorReport::Scalar(ref val) => fidl::encoding::encode_in_envelope::<u16, D>(
7247                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
7248                    encoder,
7249                    offset + 8,
7250                    _depth,
7251                ),
7252            }
7253        }
7254    }
7255
7256    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReport {
7257        #[inline(always)]
7258        fn new_empty() -> Self {
7259            Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>, D))
7260        }
7261
7262        #[inline]
7263        unsafe fn decode(
7264            &mut self,
7265            decoder: &mut fidl::encoding::Decoder<'_, D>,
7266            offset: usize,
7267            mut depth: fidl::encoding::Depth,
7268        ) -> fidl::Result<()> {
7269            decoder.debug_check_bounds::<Self>(offset);
7270            #[allow(unused_variables)]
7271            let next_out_of_line = decoder.next_out_of_line();
7272            let handles_before = decoder.remaining_handles();
7273            let (ordinal, inlined, num_bytes, num_handles) =
7274                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7275
7276            let member_inline_size = match ordinal {
7277                1 => <fidl::encoding::Array<i16, 3> as fidl::encoding::TypeMarker>::inline_size(
7278                    decoder.context,
7279                ),
7280                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7281                _ => return Err(fidl::Error::UnknownUnionTag),
7282            };
7283
7284            if inlined != (member_inline_size <= 4) {
7285                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7286            }
7287            let _inner_offset;
7288            if inlined {
7289                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7290                _inner_offset = offset + 8;
7291            } else {
7292                depth.increment()?;
7293                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7294            }
7295            match ordinal {
7296                1 => {
7297                    #[allow(irrefutable_let_patterns)]
7298                    if let SensorReport::Vector(_) = self {
7299                        // Do nothing, read the value into the object
7300                    } else {
7301                        // Initialize `self` to the right variant
7302                        *self = SensorReport::Vector(
7303                            fidl::new_empty!(fidl::encoding::Array<i16, 3>, D),
7304                        );
7305                    }
7306                    #[allow(irrefutable_let_patterns)]
7307                    if let SensorReport::Vector(ref mut val) = self {
7308                        fidl::decode!(fidl::encoding::Array<i16, 3>, D, val, decoder, _inner_offset, depth)?;
7309                    } else {
7310                        unreachable!()
7311                    }
7312                }
7313                2 => {
7314                    #[allow(irrefutable_let_patterns)]
7315                    if let SensorReport::Scalar(_) = self {
7316                        // Do nothing, read the value into the object
7317                    } else {
7318                        // Initialize `self` to the right variant
7319                        *self = SensorReport::Scalar(fidl::new_empty!(u16, D));
7320                    }
7321                    #[allow(irrefutable_let_patterns)]
7322                    if let SensorReport::Scalar(ref mut val) = self {
7323                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
7324                    } else {
7325                        unreachable!()
7326                    }
7327                }
7328                ordinal => panic!("unexpected ordinal {:?}", ordinal),
7329            }
7330            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7331                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7332            }
7333            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7334                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7335            }
7336            Ok(())
7337        }
7338    }
7339}