Skip to main content

fidl_fuchsia_ui_input__common/
fidl_fuchsia_ui_input__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const 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    /// Represents a swipe up gesture on the touchscreen.
618    SwipeUp,
619    /// Represents a swipe left gesture on the touchscreen.
620    SwipeLeft,
621    /// Represents a swipe right gesture on the touchscreen.
622    SwipeRight,
623    /// Represents a swipe down gesture on the touchscreen.
624    SwipeDown,
625    #[doc(hidden)]
626    __SourceBreaking {
627        unknown_ordinal: u32,
628    },
629}
630
631/// Pattern that matches an unknown `TouchButton` member.
632#[macro_export]
633macro_rules! TouchButtonUnknown {
634    () => {
635        _
636    };
637}
638
639impl TouchButton {
640    #[inline]
641    pub fn from_primitive(prim: u32) -> Option<Self> {
642        match prim {
643            1 => Some(Self::Palm),
644            2 => Some(Self::SwipeUp),
645            3 => Some(Self::SwipeLeft),
646            4 => Some(Self::SwipeRight),
647            5 => Some(Self::SwipeDown),
648            _ => None,
649        }
650    }
651
652    #[inline]
653    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
654        match prim {
655            1 => Self::Palm,
656            2 => Self::SwipeUp,
657            3 => Self::SwipeLeft,
658            4 => Self::SwipeRight,
659            5 => Self::SwipeDown,
660            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
661        }
662    }
663
664    #[inline]
665    pub fn unknown() -> Self {
666        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
667    }
668
669    #[inline]
670    pub const fn into_primitive(self) -> u32 {
671        match self {
672            Self::Palm => 1,
673            Self::SwipeUp => 2,
674            Self::SwipeLeft => 3,
675            Self::SwipeRight => 4,
676            Self::SwipeDown => 5,
677            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
678        }
679    }
680
681    #[inline]
682    pub fn is_unknown(&self) -> bool {
683        match self {
684            Self::__SourceBreaking { unknown_ordinal: _ } => true,
685            _ => false,
686        }
687    }
688}
689
690#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
691pub struct Axis {
692    pub range: Range,
693    pub resolution: i32,
694    pub scale: AxisScale,
695}
696
697impl fidl::Persistable for Axis {}
698
699#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
700pub struct AxisF {
701    pub range: RangeF,
702    pub resolution: f32,
703    pub scale: AxisScale,
704}
705
706impl fidl::Persistable for AxisF {}
707
708#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
709pub struct DeviceDescriptor {
710    pub device_info: Option<Box<DeviceInfo>>,
711    pub keyboard: Option<Box<KeyboardDescriptor>>,
712    pub media_buttons: Option<Box<MediaButtonsDescriptor>>,
713    pub mouse: Option<Box<MouseDescriptor>>,
714    pub stylus: Option<Box<StylusDescriptor>>,
715    pub touchscreen: Option<Box<TouchscreenDescriptor>>,
716    pub sensor: Option<Box<SensorDescriptor>>,
717}
718
719impl fidl::Persistable for DeviceDescriptor {}
720
721#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
722pub struct DeviceInfo {
723    pub vendor_id: u32,
724    pub product_id: u32,
725    pub version: u32,
726    pub name: String,
727}
728
729impl fidl::Persistable for DeviceInfo {}
730
731#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
732pub struct FocusEvent {
733    /// Time the event was delivered. The time is in nanoseconds and corresponds
734    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
735    pub event_time: u64,
736    /// Whether the view has gained input focused or not.
737    pub focused: bool,
738}
739
740impl fidl::Persistable for FocusEvent {}
741
742#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
743pub struct InputDeviceDispatchReportRequest {
744    pub report: InputReport,
745}
746
747impl fidl::Persistable for InputDeviceDispatchReportRequest {}
748
749#[derive(Clone, Debug, PartialEq, PartialOrd)]
750pub struct InputMethodEditorClientDidUpdateStateRequest {
751    pub state: TextInputState,
752    pub event: Option<Box<InputEvent>>,
753}
754
755impl fidl::Persistable for InputMethodEditorClientDidUpdateStateRequest {}
756
757#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
758pub struct InputMethodEditorClientOnActionRequest {
759    pub action: InputMethodAction,
760}
761
762impl fidl::Persistable for InputMethodEditorClientOnActionRequest {}
763
764#[derive(Clone, Debug, PartialEq)]
765pub struct InputMethodEditorDispatchKey3Request {
766    pub event: fidl_fuchsia_ui_input3__common::KeyEvent,
767}
768
769impl fidl::Persistable for InputMethodEditorDispatchKey3Request {}
770
771#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
772pub struct InputMethodEditorDispatchKey3Response {
773    pub handled: bool,
774}
775
776impl fidl::Persistable for InputMethodEditorDispatchKey3Response {}
777
778#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
779pub struct InputMethodEditorInjectInputRequest {
780    pub event: InputEvent,
781}
782
783impl fidl::Persistable for InputMethodEditorInjectInputRequest {}
784
785#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
786pub struct InputMethodEditorSetKeyboardTypeRequest {
787    pub keyboard_type: KeyboardType,
788}
789
790impl fidl::Persistable for InputMethodEditorSetKeyboardTypeRequest {}
791
792#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
793pub struct InputMethodEditorSetStateRequest {
794    pub state: TextInputState,
795}
796
797impl fidl::Persistable for InputMethodEditorSetStateRequest {}
798
799#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
800pub struct InputReport {
801    pub event_time: u64,
802    pub keyboard: Option<Box<KeyboardReport>>,
803    pub media_buttons: Option<Box<MediaButtonsReport>>,
804    pub mouse: Option<Box<MouseReport>>,
805    pub stylus: Option<Box<StylusReport>>,
806    pub touchscreen: Option<Box<TouchscreenReport>>,
807    pub sensor: Option<Box<SensorReport>>,
808    pub trace_id: u64,
809}
810
811impl fidl::Persistable for InputReport {}
812
813#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
814pub struct KeyboardDescriptor {
815    pub keys: Vec<u32>,
816}
817
818impl fidl::Persistable for KeyboardDescriptor {}
819
820/// `KeyboardEvent` represents event generated by a user's interaction with a
821/// keyboard.
822///
823/// Those events are triggered by distinct pressed state changes of the keys.
824///
825/// The state transitions should be as follows:
826/// PRESSED -> (REPEAT ->) RELEASED
827/// or
828/// PRESSED -> (REPEAT ->) CANCELLED
829///
830/// The input system will repeat those events automatically when a code_point is
831/// available.
832///
833/// DEPRECATED: Will be removed in favor of `fuchsia.ui.input.KeyEvent`.
834#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
835pub struct KeyboardEvent {
836    /// Time the event was delivered. The time is in nanoseconds and corresponds
837    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
838    pub event_time: u64,
839    pub device_id: u32,
840    pub phase: KeyboardEventPhase,
841    /// Keyboard HID Usage
842    /// See https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
843    pub hid_usage: u32,
844    /// The unicode code point represented by this key event, if any.
845    /// Dead keys are represented as Unicode combining characters.
846    ///
847    /// If there is no unicode code point, this value is zero.
848    pub code_point: u32,
849    /// Key modifiers as defined by the different kModifier constants such as
850    /// `kModifierCapsLock` currently pressed
851    pub modifiers: u32,
852}
853
854impl fidl::Persistable for KeyboardEvent {}
855
856#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
857pub struct KeyboardReport {
858    pub pressed_keys: Vec<u32>,
859}
860
861impl fidl::Persistable for KeyboardReport {}
862
863#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
864#[repr(C)]
865pub struct MediaButtonsDescriptor {
866    pub buttons: u32,
867}
868
869impl fidl::Persistable for MediaButtonsDescriptor {}
870
871/// `MediaButtonsReport` describes the media buttons event delivered from the event stream.
872/// Each bool in the report represents a single button where true means the button
873/// is being pressed. A single report should be sent on every state change.
874#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
875pub struct MediaButtonsReport {
876    pub volume_up: bool,
877    pub volume_down: bool,
878    pub mic_mute: bool,
879    pub reset: bool,
880    pub pause: bool,
881    pub camera_disable: bool,
882}
883
884impl fidl::Persistable for MediaButtonsReport {}
885
886#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
887pub struct MouseDescriptor {
888    pub rel_x: Axis,
889    pub rel_y: Axis,
890    pub vscroll: Option<Box<Axis>>,
891    pub hscroll: Option<Box<Axis>>,
892    pub buttons: u32,
893}
894
895impl fidl::Persistable for MouseDescriptor {}
896
897#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
898#[repr(C)]
899pub struct MouseReport {
900    pub rel_x: i32,
901    pub rel_y: i32,
902    pub rel_hscroll: i32,
903    pub rel_vscroll: i32,
904    pub pressed_buttons: u32,
905}
906
907impl fidl::Persistable for MouseReport {}
908
909/// Pointers represent raw data about the user's interaction with the screen.
910///
911/// The state transitions should be as follows:
912/// ADD (-> HOVER) -> DOWN -> MOVE -> UP (-> HOVER) -> REMOVE
913///
914/// At any point after the initial ADD, a transition to CANCEL is also possible.
915#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
916pub struct PointerEvent {
917    /// Time the event was delivered. The time is in nanoseconds and corresponds
918    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
919    pub event_time: u64,
920    pub device_id: u32,
921    pub pointer_id: u32,
922    pub type_: PointerEventType,
923    pub phase: PointerEventPhase,
924    /// `x` and `y` are in the coordinate system of the View.
925    pub x: f32,
926    pub y: f32,
927    pub radius_major: f32,
928    pub radius_minor: f32,
929    /// Currently pressed buttons as defined the kButton constants such as
930    /// `kMousePrimaryButton`
931    pub buttons: u32,
932}
933
934impl fidl::Persistable for PointerEvent {}
935
936#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
937#[repr(C)]
938pub struct Range {
939    pub min: i32,
940    pub max: i32,
941}
942
943impl fidl::Persistable for Range {}
944
945#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
946pub struct RangeF {
947    pub min: f32,
948    pub max: f32,
949}
950
951impl fidl::Persistable for RangeF {}
952
953#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
954pub struct SendKeyboardInputCmd {
955    pub compositor_id: u32,
956    pub keyboard_event: KeyboardEvent,
957}
958
959impl fidl::Persistable for SendKeyboardInputCmd {}
960
961#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
962pub struct SendPointerInputCmd {
963    pub compositor_id: u32,
964    pub pointer_event: PointerEvent,
965}
966
967impl fidl::Persistable for SendPointerInputCmd {}
968
969#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
970pub struct SensorDescriptor {
971    pub type_: SensorType,
972    pub loc: SensorLocation,
973    pub min_sampling_freq: u32,
974    pub max_sampling_freq: u32,
975    pub fifo_max_event_count: u32,
976    pub phys_min: i32,
977    pub phys_max: i32,
978}
979
980impl fidl::Persistable for SensorDescriptor {}
981
982#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
983pub struct SetHardKeyboardDeliveryCmd {
984    pub delivery_request: bool,
985}
986
987impl fidl::Persistable for SetHardKeyboardDeliveryCmd {}
988
989#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
990pub struct SetParallelDispatchCmd {
991    pub parallel_dispatch: bool,
992}
993
994impl fidl::Persistable for SetParallelDispatchCmd {}
995
996#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
997pub struct StylusDescriptor {
998    pub x: Axis,
999    pub y: Axis,
1000    pub pressure: Option<Box<Axis>>,
1001    pub is_invertible: bool,
1002    pub buttons: u32,
1003}
1004
1005impl fidl::Persistable for StylusDescriptor {}
1006
1007#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1008pub struct StylusReport {
1009    pub x: i32,
1010    pub y: i32,
1011    pub pressure: u32,
1012    pub is_in_contact: bool,
1013    pub in_range: bool,
1014    pub is_inverted: bool,
1015    pub pressed_buttons: u32,
1016}
1017
1018impl fidl::Persistable for StylusReport {}
1019
1020/// The current text, selection, and composing state for editing a run of text.
1021#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1022pub struct TextInputState {
1023    /// Current state revision to avoid race conditions.
1024    pub revision: u32,
1025    /// The current text being edited.
1026    pub text: String,
1027    /// The range of text that is currently selected.
1028    pub selection: TextSelection,
1029    /// The range of text that is still being composed.
1030    pub composing: TextRange,
1031}
1032
1033impl fidl::Persistable for TextInputState {}
1034
1035/// A range of characters in a string of text. Although strings in FIDL's wire
1036/// format are UTF-8 encoded, these indices are measured in UTF-16 code units
1037/// for legacy reasons. These text input APIs will eventually be replaced by
1038/// fuchsia.ui.text, which uses code points instead.
1039#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1040#[repr(C)]
1041pub struct TextRange {
1042    /// The index of the first UTF-16 code unit in the range.
1043    ///
1044    /// If `start` and `end` are both -1, the text range is empty.
1045    pub start: i64,
1046    /// The next index after the last UTF-16 code unit in this range.
1047    ///
1048    /// If `start` and `end` are both -1, the text range is empty.
1049    pub end: i64,
1050}
1051
1052impl fidl::Persistable for TextRange {}
1053
1054/// A range of text that represents a selection. Although strings in FIDL's wire
1055/// format are UTF-8 encoded, these indices are measured in UTF-16 code units
1056/// for legacy reasons. These text input APIs will eventually be replaced by
1057/// fuchsia.ui.text, which uses code points instead.
1058///
1059/// Text selection is always directional. Direction should be determined by
1060/// comparing base and extent.
1061#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1062pub struct TextSelection {
1063    /// The offset at which the selection originates, as measured in UTF-16 code units.
1064    ///
1065    /// Might be larger than, smaller than, or equal to extent.
1066    pub base: i64,
1067    /// The offset at which the selection terminates, as measured in UTF-16 code units.
1068    ///
1069    /// When the user uses the arrow keys to adjust the selection, this is the
1070    /// value that changes. Similarly, if the current theme paints a caret on one
1071    /// side of the selection, this is the location at which to paint the caret.
1072    ///
1073    /// Might be larger than, smaller than, or equal to base.
1074    pub extent: i64,
1075    /// If the text range is collapsed and has more than one visual location
1076    /// (e.g., occurs at a line break), which of the two locations to use when
1077    /// painting the caret.
1078    pub affinity: TextAffinity,
1079}
1080
1081impl fidl::Persistable for TextSelection {}
1082
1083#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1084#[repr(C)]
1085pub struct Touch {
1086    pub finger_id: u32,
1087    pub x: i32,
1088    pub y: i32,
1089    pub width: u32,
1090    pub height: u32,
1091}
1092
1093impl fidl::Persistable for Touch {}
1094
1095#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1096pub struct TouchscreenDescriptor {
1097    pub x: Axis,
1098    pub y: Axis,
1099    pub max_finger_id: u32,
1100}
1101
1102impl fidl::Persistable for TouchscreenDescriptor {}
1103
1104#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1105pub struct TouchscreenReport {
1106    pub touches: Vec<Touch>,
1107}
1108
1109impl fidl::Persistable for TouchscreenReport {}
1110
1111/// Information about a device that issues touch event streams.
1112#[derive(Clone, Debug, Default, PartialEq)]
1113pub struct TouchDeviceInfo {
1114    /// An identifier for the touch device that issues touch events.
1115    /// Required.
1116    pub id: Option<u32>,
1117    #[doc(hidden)]
1118    pub __source_breaking: fidl::marker::SourceBreaking,
1119}
1120
1121impl fidl::Persistable for TouchDeviceInfo {}
1122
1123#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1124pub enum Command {
1125    SendKeyboardInput(SendKeyboardInputCmd),
1126    SendPointerInput(SendPointerInputCmd),
1127    SetHardKeyboardDelivery(SetHardKeyboardDeliveryCmd),
1128    SetParallelDispatch(SetParallelDispatchCmd),
1129}
1130
1131impl Command {
1132    #[inline]
1133    pub fn ordinal(&self) -> u64 {
1134        match *self {
1135            Self::SendKeyboardInput(_) => 1,
1136            Self::SendPointerInput(_) => 2,
1137            Self::SetHardKeyboardDelivery(_) => 3,
1138            Self::SetParallelDispatch(_) => 4,
1139        }
1140    }
1141}
1142
1143impl fidl::Persistable for Command {}
1144
1145#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1146pub enum InputEvent {
1147    Pointer(PointerEvent),
1148    Keyboard(KeyboardEvent),
1149    Focus(FocusEvent),
1150}
1151
1152impl InputEvent {
1153    #[inline]
1154    pub fn ordinal(&self) -> u64 {
1155        match *self {
1156            Self::Pointer(_) => 1,
1157            Self::Keyboard(_) => 2,
1158            Self::Focus(_) => 3,
1159        }
1160    }
1161}
1162
1163impl fidl::Persistable for InputEvent {}
1164
1165#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1166pub enum SensorReport {
1167    Vector([i16; 3]),
1168    Scalar(u16),
1169}
1170
1171impl SensorReport {
1172    #[inline]
1173    pub fn ordinal(&self) -> u64 {
1174        match *self {
1175            Self::Vector(_) => 1,
1176            Self::Scalar(_) => 2,
1177        }
1178    }
1179}
1180
1181impl fidl::Persistable for SensorReport {}
1182
1183pub mod ime_service_ordinals {
1184    pub const GET_INPUT_METHOD_EDITOR: u64 = 0x148d2e42a1f461fc;
1185    pub const SHOW_KEYBOARD: u64 = 0x38ed2a1de28cfcf0;
1186    pub const HIDE_KEYBOARD: u64 = 0x7667f098198d09fd;
1187}
1188
1189pub mod input_device_ordinals {
1190    pub const DISPATCH_REPORT: u64 = 0x7ee375d01c8e149f;
1191}
1192
1193pub mod input_method_editor_ordinals {
1194    pub const SET_KEYBOARD_TYPE: u64 = 0x14fe60e927d7d487;
1195    pub const SET_STATE: u64 = 0x12b477b779818f45;
1196    pub const INJECT_INPUT: u64 = 0x34af74618a4f82b;
1197    pub const DISPATCH_KEY3: u64 = 0x2e13667c827209ac;
1198    pub const SHOW: u64 = 0x19ba00ba1beb002e;
1199    pub const HIDE: u64 = 0x283e0cd73f0d6d9e;
1200}
1201
1202pub mod input_method_editor_client_ordinals {
1203    pub const DID_UPDATE_STATE: u64 = 0x26681a6b204b679d;
1204    pub const ON_ACTION: u64 = 0x19c420f173275398;
1205}
1206
1207mod internal {
1208    use super::*;
1209    unsafe impl fidl::encoding::TypeMarker for AxisScale {
1210        type Owned = Self;
1211
1212        #[inline(always)]
1213        fn inline_align(_context: fidl::encoding::Context) -> usize {
1214            std::mem::align_of::<u32>()
1215        }
1216
1217        #[inline(always)]
1218        fn inline_size(_context: fidl::encoding::Context) -> usize {
1219            std::mem::size_of::<u32>()
1220        }
1221
1222        #[inline(always)]
1223        fn encode_is_copy() -> bool {
1224            false
1225        }
1226
1227        #[inline(always)]
1228        fn decode_is_copy() -> bool {
1229            false
1230        }
1231    }
1232
1233    impl fidl::encoding::ValueTypeMarker for AxisScale {
1234        type Borrowed<'a> = Self;
1235        #[inline(always)]
1236        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1237            *value
1238        }
1239    }
1240
1241    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AxisScale {
1242        #[inline]
1243        unsafe fn encode(
1244            self,
1245            encoder: &mut fidl::encoding::Encoder<'_, D>,
1246            offset: usize,
1247            _depth: fidl::encoding::Depth,
1248        ) -> fidl::Result<()> {
1249            encoder.debug_check_bounds::<Self>(offset);
1250            encoder.write_num(self.into_primitive(), offset);
1251            Ok(())
1252        }
1253    }
1254
1255    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisScale {
1256        #[inline(always)]
1257        fn new_empty() -> Self {
1258            Self::unknown()
1259        }
1260
1261        #[inline]
1262        unsafe fn decode(
1263            &mut self,
1264            decoder: &mut fidl::encoding::Decoder<'_, D>,
1265            offset: usize,
1266            _depth: fidl::encoding::Depth,
1267        ) -> fidl::Result<()> {
1268            decoder.debug_check_bounds::<Self>(offset);
1269            let prim = decoder.read_num::<u32>(offset);
1270
1271            *self = Self::from_primitive_allow_unknown(prim);
1272            Ok(())
1273        }
1274    }
1275    unsafe impl fidl::encoding::TypeMarker for InputMethodAction {
1276        type Owned = Self;
1277
1278        #[inline(always)]
1279        fn inline_align(_context: fidl::encoding::Context) -> usize {
1280            std::mem::align_of::<u32>()
1281        }
1282
1283        #[inline(always)]
1284        fn inline_size(_context: fidl::encoding::Context) -> usize {
1285            std::mem::size_of::<u32>()
1286        }
1287
1288        #[inline(always)]
1289        fn encode_is_copy() -> bool {
1290            false
1291        }
1292
1293        #[inline(always)]
1294        fn decode_is_copy() -> bool {
1295            false
1296        }
1297    }
1298
1299    impl fidl::encoding::ValueTypeMarker for InputMethodAction {
1300        type Borrowed<'a> = Self;
1301        #[inline(always)]
1302        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1303            *value
1304        }
1305    }
1306
1307    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1308        for InputMethodAction
1309    {
1310        #[inline]
1311        unsafe fn encode(
1312            self,
1313            encoder: &mut fidl::encoding::Encoder<'_, D>,
1314            offset: usize,
1315            _depth: fidl::encoding::Depth,
1316        ) -> fidl::Result<()> {
1317            encoder.debug_check_bounds::<Self>(offset);
1318            encoder.write_num(self.into_primitive(), offset);
1319            Ok(())
1320        }
1321    }
1322
1323    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputMethodAction {
1324        #[inline(always)]
1325        fn new_empty() -> Self {
1326            Self::unknown()
1327        }
1328
1329        #[inline]
1330        unsafe fn decode(
1331            &mut self,
1332            decoder: &mut fidl::encoding::Decoder<'_, D>,
1333            offset: usize,
1334            _depth: fidl::encoding::Depth,
1335        ) -> fidl::Result<()> {
1336            decoder.debug_check_bounds::<Self>(offset);
1337            let prim = decoder.read_num::<u32>(offset);
1338
1339            *self = Self::from_primitive_allow_unknown(prim);
1340            Ok(())
1341        }
1342    }
1343    unsafe impl fidl::encoding::TypeMarker for KeyboardEventPhase {
1344        type Owned = Self;
1345
1346        #[inline(always)]
1347        fn inline_align(_context: fidl::encoding::Context) -> usize {
1348            std::mem::align_of::<u32>()
1349        }
1350
1351        #[inline(always)]
1352        fn inline_size(_context: fidl::encoding::Context) -> usize {
1353            std::mem::size_of::<u32>()
1354        }
1355
1356        #[inline(always)]
1357        fn encode_is_copy() -> bool {
1358            false
1359        }
1360
1361        #[inline(always)]
1362        fn decode_is_copy() -> bool {
1363            false
1364        }
1365    }
1366
1367    impl fidl::encoding::ValueTypeMarker for KeyboardEventPhase {
1368        type Borrowed<'a> = Self;
1369        #[inline(always)]
1370        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1371            *value
1372        }
1373    }
1374
1375    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1376        for KeyboardEventPhase
1377    {
1378        #[inline]
1379        unsafe fn encode(
1380            self,
1381            encoder: &mut fidl::encoding::Encoder<'_, D>,
1382            offset: usize,
1383            _depth: fidl::encoding::Depth,
1384        ) -> fidl::Result<()> {
1385            encoder.debug_check_bounds::<Self>(offset);
1386            encoder.write_num(self.into_primitive(), offset);
1387            Ok(())
1388        }
1389    }
1390
1391    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEventPhase {
1392        #[inline(always)]
1393        fn new_empty() -> Self {
1394            Self::unknown()
1395        }
1396
1397        #[inline]
1398        unsafe fn decode(
1399            &mut self,
1400            decoder: &mut fidl::encoding::Decoder<'_, D>,
1401            offset: usize,
1402            _depth: fidl::encoding::Depth,
1403        ) -> fidl::Result<()> {
1404            decoder.debug_check_bounds::<Self>(offset);
1405            let prim = decoder.read_num::<u32>(offset);
1406
1407            *self = Self::from_primitive_allow_unknown(prim);
1408            Ok(())
1409        }
1410    }
1411    unsafe impl fidl::encoding::TypeMarker for KeyboardType {
1412        type Owned = Self;
1413
1414        #[inline(always)]
1415        fn inline_align(_context: fidl::encoding::Context) -> usize {
1416            std::mem::align_of::<u32>()
1417        }
1418
1419        #[inline(always)]
1420        fn inline_size(_context: fidl::encoding::Context) -> usize {
1421            std::mem::size_of::<u32>()
1422        }
1423
1424        #[inline(always)]
1425        fn encode_is_copy() -> bool {
1426            false
1427        }
1428
1429        #[inline(always)]
1430        fn decode_is_copy() -> bool {
1431            false
1432        }
1433    }
1434
1435    impl fidl::encoding::ValueTypeMarker for KeyboardType {
1436        type Borrowed<'a> = Self;
1437        #[inline(always)]
1438        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1439            *value
1440        }
1441    }
1442
1443    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyboardType {
1444        #[inline]
1445        unsafe fn encode(
1446            self,
1447            encoder: &mut fidl::encoding::Encoder<'_, D>,
1448            offset: usize,
1449            _depth: fidl::encoding::Depth,
1450        ) -> fidl::Result<()> {
1451            encoder.debug_check_bounds::<Self>(offset);
1452            encoder.write_num(self.into_primitive(), offset);
1453            Ok(())
1454        }
1455    }
1456
1457    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardType {
1458        #[inline(always)]
1459        fn new_empty() -> Self {
1460            Self::unknown()
1461        }
1462
1463        #[inline]
1464        unsafe fn decode(
1465            &mut self,
1466            decoder: &mut fidl::encoding::Decoder<'_, D>,
1467            offset: usize,
1468            _depth: fidl::encoding::Depth,
1469        ) -> fidl::Result<()> {
1470            decoder.debug_check_bounds::<Self>(offset);
1471            let prim = decoder.read_num::<u32>(offset);
1472
1473            *self = Self::from_primitive_allow_unknown(prim);
1474            Ok(())
1475        }
1476    }
1477    unsafe impl fidl::encoding::TypeMarker for PointerEventPhase {
1478        type Owned = Self;
1479
1480        #[inline(always)]
1481        fn inline_align(_context: fidl::encoding::Context) -> usize {
1482            std::mem::align_of::<u32>()
1483        }
1484
1485        #[inline(always)]
1486        fn inline_size(_context: fidl::encoding::Context) -> usize {
1487            std::mem::size_of::<u32>()
1488        }
1489
1490        #[inline(always)]
1491        fn encode_is_copy() -> bool {
1492            true
1493        }
1494
1495        #[inline(always)]
1496        fn decode_is_copy() -> bool {
1497            false
1498        }
1499    }
1500
1501    impl fidl::encoding::ValueTypeMarker for PointerEventPhase {
1502        type Borrowed<'a> = Self;
1503        #[inline(always)]
1504        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1505            *value
1506        }
1507    }
1508
1509    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1510        for PointerEventPhase
1511    {
1512        #[inline]
1513        unsafe fn encode(
1514            self,
1515            encoder: &mut fidl::encoding::Encoder<'_, D>,
1516            offset: usize,
1517            _depth: fidl::encoding::Depth,
1518        ) -> fidl::Result<()> {
1519            encoder.debug_check_bounds::<Self>(offset);
1520            encoder.write_num(self.into_primitive(), offset);
1521            Ok(())
1522        }
1523    }
1524
1525    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventPhase {
1526        #[inline(always)]
1527        fn new_empty() -> Self {
1528            Self::Add
1529        }
1530
1531        #[inline]
1532        unsafe fn decode(
1533            &mut self,
1534            decoder: &mut fidl::encoding::Decoder<'_, D>,
1535            offset: usize,
1536            _depth: fidl::encoding::Depth,
1537        ) -> fidl::Result<()> {
1538            decoder.debug_check_bounds::<Self>(offset);
1539            let prim = decoder.read_num::<u32>(offset);
1540
1541            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1542            Ok(())
1543        }
1544    }
1545    unsafe impl fidl::encoding::TypeMarker for PointerEventType {
1546        type Owned = Self;
1547
1548        #[inline(always)]
1549        fn inline_align(_context: fidl::encoding::Context) -> usize {
1550            std::mem::align_of::<u32>()
1551        }
1552
1553        #[inline(always)]
1554        fn inline_size(_context: fidl::encoding::Context) -> usize {
1555            std::mem::size_of::<u32>()
1556        }
1557
1558        #[inline(always)]
1559        fn encode_is_copy() -> bool {
1560            true
1561        }
1562
1563        #[inline(always)]
1564        fn decode_is_copy() -> bool {
1565            false
1566        }
1567    }
1568
1569    impl fidl::encoding::ValueTypeMarker for PointerEventType {
1570        type Borrowed<'a> = Self;
1571        #[inline(always)]
1572        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1573            *value
1574        }
1575    }
1576
1577    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1578        for PointerEventType
1579    {
1580        #[inline]
1581        unsafe fn encode(
1582            self,
1583            encoder: &mut fidl::encoding::Encoder<'_, D>,
1584            offset: usize,
1585            _depth: fidl::encoding::Depth,
1586        ) -> fidl::Result<()> {
1587            encoder.debug_check_bounds::<Self>(offset);
1588            encoder.write_num(self.into_primitive(), offset);
1589            Ok(())
1590        }
1591    }
1592
1593    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventType {
1594        #[inline(always)]
1595        fn new_empty() -> Self {
1596            Self::Touch
1597        }
1598
1599        #[inline]
1600        unsafe fn decode(
1601            &mut self,
1602            decoder: &mut fidl::encoding::Decoder<'_, D>,
1603            offset: usize,
1604            _depth: fidl::encoding::Depth,
1605        ) -> fidl::Result<()> {
1606            decoder.debug_check_bounds::<Self>(offset);
1607            let prim = decoder.read_num::<u32>(offset);
1608
1609            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1610            Ok(())
1611        }
1612    }
1613    unsafe impl fidl::encoding::TypeMarker for SensorLocation {
1614        type Owned = Self;
1615
1616        #[inline(always)]
1617        fn inline_align(_context: fidl::encoding::Context) -> usize {
1618            std::mem::align_of::<u32>()
1619        }
1620
1621        #[inline(always)]
1622        fn inline_size(_context: fidl::encoding::Context) -> usize {
1623            std::mem::size_of::<u32>()
1624        }
1625
1626        #[inline(always)]
1627        fn encode_is_copy() -> bool {
1628            false
1629        }
1630
1631        #[inline(always)]
1632        fn decode_is_copy() -> bool {
1633            false
1634        }
1635    }
1636
1637    impl fidl::encoding::ValueTypeMarker for SensorLocation {
1638        type Borrowed<'a> = Self;
1639        #[inline(always)]
1640        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1641            *value
1642        }
1643    }
1644
1645    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorLocation {
1646        #[inline]
1647        unsafe fn encode(
1648            self,
1649            encoder: &mut fidl::encoding::Encoder<'_, D>,
1650            offset: usize,
1651            _depth: fidl::encoding::Depth,
1652        ) -> fidl::Result<()> {
1653            encoder.debug_check_bounds::<Self>(offset);
1654            encoder.write_num(self.into_primitive(), offset);
1655            Ok(())
1656        }
1657    }
1658
1659    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorLocation {
1660        #[inline(always)]
1661        fn new_empty() -> Self {
1662            Self::unknown()
1663        }
1664
1665        #[inline]
1666        unsafe fn decode(
1667            &mut self,
1668            decoder: &mut fidl::encoding::Decoder<'_, D>,
1669            offset: usize,
1670            _depth: fidl::encoding::Depth,
1671        ) -> fidl::Result<()> {
1672            decoder.debug_check_bounds::<Self>(offset);
1673            let prim = decoder.read_num::<u32>(offset);
1674
1675            *self = Self::from_primitive_allow_unknown(prim);
1676            Ok(())
1677        }
1678    }
1679    unsafe impl fidl::encoding::TypeMarker for SensorType {
1680        type Owned = Self;
1681
1682        #[inline(always)]
1683        fn inline_align(_context: fidl::encoding::Context) -> usize {
1684            std::mem::align_of::<u32>()
1685        }
1686
1687        #[inline(always)]
1688        fn inline_size(_context: fidl::encoding::Context) -> usize {
1689            std::mem::size_of::<u32>()
1690        }
1691
1692        #[inline(always)]
1693        fn encode_is_copy() -> bool {
1694            false
1695        }
1696
1697        #[inline(always)]
1698        fn decode_is_copy() -> bool {
1699            false
1700        }
1701    }
1702
1703    impl fidl::encoding::ValueTypeMarker for SensorType {
1704        type Borrowed<'a> = Self;
1705        #[inline(always)]
1706        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1707            *value
1708        }
1709    }
1710
1711    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1712        #[inline]
1713        unsafe fn encode(
1714            self,
1715            encoder: &mut fidl::encoding::Encoder<'_, D>,
1716            offset: usize,
1717            _depth: fidl::encoding::Depth,
1718        ) -> fidl::Result<()> {
1719            encoder.debug_check_bounds::<Self>(offset);
1720            encoder.write_num(self.into_primitive(), offset);
1721            Ok(())
1722        }
1723    }
1724
1725    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1726        #[inline(always)]
1727        fn new_empty() -> Self {
1728            Self::unknown()
1729        }
1730
1731        #[inline]
1732        unsafe fn decode(
1733            &mut self,
1734            decoder: &mut fidl::encoding::Decoder<'_, D>,
1735            offset: usize,
1736            _depth: fidl::encoding::Depth,
1737        ) -> fidl::Result<()> {
1738            decoder.debug_check_bounds::<Self>(offset);
1739            let prim = decoder.read_num::<u32>(offset);
1740
1741            *self = Self::from_primitive_allow_unknown(prim);
1742            Ok(())
1743        }
1744    }
1745    unsafe impl fidl::encoding::TypeMarker for TextAffinity {
1746        type Owned = Self;
1747
1748        #[inline(always)]
1749        fn inline_align(_context: fidl::encoding::Context) -> usize {
1750            std::mem::align_of::<u32>()
1751        }
1752
1753        #[inline(always)]
1754        fn inline_size(_context: fidl::encoding::Context) -> usize {
1755            std::mem::size_of::<u32>()
1756        }
1757
1758        #[inline(always)]
1759        fn encode_is_copy() -> bool {
1760            true
1761        }
1762
1763        #[inline(always)]
1764        fn decode_is_copy() -> bool {
1765            false
1766        }
1767    }
1768
1769    impl fidl::encoding::ValueTypeMarker for TextAffinity {
1770        type Borrowed<'a> = Self;
1771        #[inline(always)]
1772        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1773            *value
1774        }
1775    }
1776
1777    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TextAffinity {
1778        #[inline]
1779        unsafe fn encode(
1780            self,
1781            encoder: &mut fidl::encoding::Encoder<'_, D>,
1782            offset: usize,
1783            _depth: fidl::encoding::Depth,
1784        ) -> fidl::Result<()> {
1785            encoder.debug_check_bounds::<Self>(offset);
1786            encoder.write_num(self.into_primitive(), offset);
1787            Ok(())
1788        }
1789    }
1790
1791    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextAffinity {
1792        #[inline(always)]
1793        fn new_empty() -> Self {
1794            Self::Upstream
1795        }
1796
1797        #[inline]
1798        unsafe fn decode(
1799            &mut self,
1800            decoder: &mut fidl::encoding::Decoder<'_, D>,
1801            offset: usize,
1802            _depth: fidl::encoding::Depth,
1803        ) -> fidl::Result<()> {
1804            decoder.debug_check_bounds::<Self>(offset);
1805            let prim = decoder.read_num::<u32>(offset);
1806
1807            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1808            Ok(())
1809        }
1810    }
1811    unsafe impl fidl::encoding::TypeMarker for TouchButton {
1812        type Owned = Self;
1813
1814        #[inline(always)]
1815        fn inline_align(_context: fidl::encoding::Context) -> usize {
1816            std::mem::align_of::<u32>()
1817        }
1818
1819        #[inline(always)]
1820        fn inline_size(_context: fidl::encoding::Context) -> usize {
1821            std::mem::size_of::<u32>()
1822        }
1823
1824        #[inline(always)]
1825        fn encode_is_copy() -> bool {
1826            false
1827        }
1828
1829        #[inline(always)]
1830        fn decode_is_copy() -> bool {
1831            false
1832        }
1833    }
1834
1835    impl fidl::encoding::ValueTypeMarker for TouchButton {
1836        type Borrowed<'a> = Self;
1837        #[inline(always)]
1838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1839            *value
1840        }
1841    }
1842
1843    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchButton {
1844        #[inline]
1845        unsafe fn encode(
1846            self,
1847            encoder: &mut fidl::encoding::Encoder<'_, D>,
1848            offset: usize,
1849            _depth: fidl::encoding::Depth,
1850        ) -> fidl::Result<()> {
1851            encoder.debug_check_bounds::<Self>(offset);
1852            encoder.write_num(self.into_primitive(), offset);
1853            Ok(())
1854        }
1855    }
1856
1857    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchButton {
1858        #[inline(always)]
1859        fn new_empty() -> Self {
1860            Self::unknown()
1861        }
1862
1863        #[inline]
1864        unsafe fn decode(
1865            &mut self,
1866            decoder: &mut fidl::encoding::Decoder<'_, D>,
1867            offset: usize,
1868            _depth: fidl::encoding::Depth,
1869        ) -> fidl::Result<()> {
1870            decoder.debug_check_bounds::<Self>(offset);
1871            let prim = decoder.read_num::<u32>(offset);
1872
1873            *self = Self::from_primitive_allow_unknown(prim);
1874            Ok(())
1875        }
1876    }
1877
1878    impl fidl::encoding::ValueTypeMarker for Axis {
1879        type Borrowed<'a> = &'a Self;
1880        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1881            value
1882        }
1883    }
1884
1885    unsafe impl fidl::encoding::TypeMarker for Axis {
1886        type Owned = Self;
1887
1888        #[inline(always)]
1889        fn inline_align(_context: fidl::encoding::Context) -> usize {
1890            4
1891        }
1892
1893        #[inline(always)]
1894        fn inline_size(_context: fidl::encoding::Context) -> usize {
1895            16
1896        }
1897    }
1898
1899    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
1900        #[inline]
1901        unsafe fn encode(
1902            self,
1903            encoder: &mut fidl::encoding::Encoder<'_, D>,
1904            offset: usize,
1905            _depth: fidl::encoding::Depth,
1906        ) -> fidl::Result<()> {
1907            encoder.debug_check_bounds::<Axis>(offset);
1908            // Delegate to tuple encoding.
1909            fidl::encoding::Encode::<Axis, D>::encode(
1910                (
1911                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
1912                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
1913                    <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
1914                ),
1915                encoder,
1916                offset,
1917                _depth,
1918            )
1919        }
1920    }
1921    unsafe impl<
1922        D: fidl::encoding::ResourceDialect,
1923        T0: fidl::encoding::Encode<Range, D>,
1924        T1: fidl::encoding::Encode<i32, D>,
1925        T2: fidl::encoding::Encode<AxisScale, D>,
1926    > fidl::encoding::Encode<Axis, D> for (T0, T1, T2)
1927    {
1928        #[inline]
1929        unsafe fn encode(
1930            self,
1931            encoder: &mut fidl::encoding::Encoder<'_, D>,
1932            offset: usize,
1933            depth: fidl::encoding::Depth,
1934        ) -> fidl::Result<()> {
1935            encoder.debug_check_bounds::<Axis>(offset);
1936            // Zero out padding regions. There's no need to apply masks
1937            // because the unmasked parts will be overwritten by fields.
1938            // Write the fields.
1939            self.0.encode(encoder, offset + 0, depth)?;
1940            self.1.encode(encoder, offset + 8, depth)?;
1941            self.2.encode(encoder, offset + 12, depth)?;
1942            Ok(())
1943        }
1944    }
1945
1946    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
1947        #[inline(always)]
1948        fn new_empty() -> Self {
1949            Self {
1950                range: fidl::new_empty!(Range, D),
1951                resolution: fidl::new_empty!(i32, D),
1952                scale: fidl::new_empty!(AxisScale, D),
1953            }
1954        }
1955
1956        #[inline]
1957        unsafe fn decode(
1958            &mut self,
1959            decoder: &mut fidl::encoding::Decoder<'_, D>,
1960            offset: usize,
1961            _depth: fidl::encoding::Depth,
1962        ) -> fidl::Result<()> {
1963            decoder.debug_check_bounds::<Self>(offset);
1964            // Verify that padding bytes are zero.
1965            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
1966            fidl::decode!(i32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
1967            fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
1968            Ok(())
1969        }
1970    }
1971
1972    impl fidl::encoding::ValueTypeMarker for AxisF {
1973        type Borrowed<'a> = &'a Self;
1974        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1975            value
1976        }
1977    }
1978
1979    unsafe impl fidl::encoding::TypeMarker for AxisF {
1980        type Owned = Self;
1981
1982        #[inline(always)]
1983        fn inline_align(_context: fidl::encoding::Context) -> usize {
1984            4
1985        }
1986
1987        #[inline(always)]
1988        fn inline_size(_context: fidl::encoding::Context) -> usize {
1989            16
1990        }
1991    }
1992
1993    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AxisF, D> for &AxisF {
1994        #[inline]
1995        unsafe fn encode(
1996            self,
1997            encoder: &mut fidl::encoding::Encoder<'_, D>,
1998            offset: usize,
1999            _depth: fidl::encoding::Depth,
2000        ) -> fidl::Result<()> {
2001            encoder.debug_check_bounds::<AxisF>(offset);
2002            // Delegate to tuple encoding.
2003            fidl::encoding::Encode::<AxisF, D>::encode(
2004                (
2005                    <RangeF as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2006                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
2007                    <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
2008                ),
2009                encoder,
2010                offset,
2011                _depth,
2012            )
2013        }
2014    }
2015    unsafe impl<
2016        D: fidl::encoding::ResourceDialect,
2017        T0: fidl::encoding::Encode<RangeF, D>,
2018        T1: fidl::encoding::Encode<f32, D>,
2019        T2: fidl::encoding::Encode<AxisScale, D>,
2020    > fidl::encoding::Encode<AxisF, D> for (T0, T1, T2)
2021    {
2022        #[inline]
2023        unsafe fn encode(
2024            self,
2025            encoder: &mut fidl::encoding::Encoder<'_, D>,
2026            offset: usize,
2027            depth: fidl::encoding::Depth,
2028        ) -> fidl::Result<()> {
2029            encoder.debug_check_bounds::<AxisF>(offset);
2030            // Zero out padding regions. There's no need to apply masks
2031            // because the unmasked parts will be overwritten by fields.
2032            // Write the fields.
2033            self.0.encode(encoder, offset + 0, depth)?;
2034            self.1.encode(encoder, offset + 8, depth)?;
2035            self.2.encode(encoder, offset + 12, depth)?;
2036            Ok(())
2037        }
2038    }
2039
2040    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisF {
2041        #[inline(always)]
2042        fn new_empty() -> Self {
2043            Self {
2044                range: fidl::new_empty!(RangeF, D),
2045                resolution: fidl::new_empty!(f32, D),
2046                scale: fidl::new_empty!(AxisScale, D),
2047            }
2048        }
2049
2050        #[inline]
2051        unsafe fn decode(
2052            &mut self,
2053            decoder: &mut fidl::encoding::Decoder<'_, D>,
2054            offset: usize,
2055            _depth: fidl::encoding::Depth,
2056        ) -> fidl::Result<()> {
2057            decoder.debug_check_bounds::<Self>(offset);
2058            // Verify that padding bytes are zero.
2059            fidl::decode!(RangeF, D, &mut self.range, decoder, offset + 0, _depth)?;
2060            fidl::decode!(f32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
2061            fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
2062            Ok(())
2063        }
2064    }
2065
2066    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
2067        type Borrowed<'a> = &'a Self;
2068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2069            value
2070        }
2071    }
2072
2073    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
2074        type Owned = Self;
2075
2076        #[inline(always)]
2077        fn inline_align(_context: fidl::encoding::Context) -> usize {
2078            8
2079        }
2080
2081        #[inline(always)]
2082        fn inline_size(_context: fidl::encoding::Context) -> usize {
2083            56
2084        }
2085    }
2086
2087    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
2088        for &DeviceDescriptor
2089    {
2090        #[inline]
2091        unsafe fn encode(
2092            self,
2093            encoder: &mut fidl::encoding::Encoder<'_, D>,
2094            offset: usize,
2095            _depth: fidl::encoding::Depth,
2096        ) -> fidl::Result<()> {
2097            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
2098            // Delegate to tuple encoding.
2099            fidl::encoding::Encode::<DeviceDescriptor, D>::encode(
2100                (
2101                    <fidl::encoding::Boxed<DeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_info),
2102                    <fidl::encoding::Boxed<KeyboardDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
2103                    <fidl::encoding::Boxed<MediaButtonsDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
2104                    <fidl::encoding::Boxed<MouseDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
2105                    <fidl::encoding::Boxed<StylusDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
2106                    <fidl::encoding::Boxed<TouchscreenDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
2107                    <fidl::encoding::Boxed<SensorDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
2108                ),
2109                encoder, offset, _depth
2110            )
2111        }
2112    }
2113    unsafe impl<
2114        D: fidl::encoding::ResourceDialect,
2115        T0: fidl::encoding::Encode<fidl::encoding::Boxed<DeviceInfo>, D>,
2116        T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardDescriptor>, D>,
2117        T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsDescriptor>, D>,
2118        T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseDescriptor>, D>,
2119        T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusDescriptor>, D>,
2120        T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenDescriptor>, D>,
2121        T6: fidl::encoding::Encode<fidl::encoding::Boxed<SensorDescriptor>, D>,
2122    > fidl::encoding::Encode<DeviceDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
2123    {
2124        #[inline]
2125        unsafe fn encode(
2126            self,
2127            encoder: &mut fidl::encoding::Encoder<'_, D>,
2128            offset: usize,
2129            depth: fidl::encoding::Depth,
2130        ) -> fidl::Result<()> {
2131            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
2132            // Zero out padding regions. There's no need to apply masks
2133            // because the unmasked parts will be overwritten by fields.
2134            // Write the fields.
2135            self.0.encode(encoder, offset + 0, depth)?;
2136            self.1.encode(encoder, offset + 8, depth)?;
2137            self.2.encode(encoder, offset + 16, depth)?;
2138            self.3.encode(encoder, offset + 24, depth)?;
2139            self.4.encode(encoder, offset + 32, depth)?;
2140            self.5.encode(encoder, offset + 40, depth)?;
2141            self.6.encode(encoder, offset + 48, depth)?;
2142            Ok(())
2143        }
2144    }
2145
2146    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
2147        #[inline(always)]
2148        fn new_empty() -> Self {
2149            Self {
2150                device_info: fidl::new_empty!(fidl::encoding::Boxed<DeviceInfo>, D),
2151                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardDescriptor>, D),
2152                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsDescriptor>, D),
2153                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseDescriptor>, D),
2154                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusDescriptor>, D),
2155                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenDescriptor>, D),
2156                sensor: fidl::new_empty!(fidl::encoding::Boxed<SensorDescriptor>, D),
2157            }
2158        }
2159
2160        #[inline]
2161        unsafe fn decode(
2162            &mut self,
2163            decoder: &mut fidl::encoding::Decoder<'_, D>,
2164            offset: usize,
2165            _depth: fidl::encoding::Depth,
2166        ) -> fidl::Result<()> {
2167            decoder.debug_check_bounds::<Self>(offset);
2168            // Verify that padding bytes are zero.
2169            fidl::decode!(
2170                fidl::encoding::Boxed<DeviceInfo>,
2171                D,
2172                &mut self.device_info,
2173                decoder,
2174                offset + 0,
2175                _depth
2176            )?;
2177            fidl::decode!(
2178                fidl::encoding::Boxed<KeyboardDescriptor>,
2179                D,
2180                &mut self.keyboard,
2181                decoder,
2182                offset + 8,
2183                _depth
2184            )?;
2185            fidl::decode!(
2186                fidl::encoding::Boxed<MediaButtonsDescriptor>,
2187                D,
2188                &mut self.media_buttons,
2189                decoder,
2190                offset + 16,
2191                _depth
2192            )?;
2193            fidl::decode!(
2194                fidl::encoding::Boxed<MouseDescriptor>,
2195                D,
2196                &mut self.mouse,
2197                decoder,
2198                offset + 24,
2199                _depth
2200            )?;
2201            fidl::decode!(
2202                fidl::encoding::Boxed<StylusDescriptor>,
2203                D,
2204                &mut self.stylus,
2205                decoder,
2206                offset + 32,
2207                _depth
2208            )?;
2209            fidl::decode!(
2210                fidl::encoding::Boxed<TouchscreenDescriptor>,
2211                D,
2212                &mut self.touchscreen,
2213                decoder,
2214                offset + 40,
2215                _depth
2216            )?;
2217            fidl::decode!(
2218                fidl::encoding::Boxed<SensorDescriptor>,
2219                D,
2220                &mut self.sensor,
2221                decoder,
2222                offset + 48,
2223                _depth
2224            )?;
2225            Ok(())
2226        }
2227    }
2228
2229    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2230        type Borrowed<'a> = &'a Self;
2231        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2232            value
2233        }
2234    }
2235
2236    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2237        type Owned = Self;
2238
2239        #[inline(always)]
2240        fn inline_align(_context: fidl::encoding::Context) -> usize {
2241            8
2242        }
2243
2244        #[inline(always)]
2245        fn inline_size(_context: fidl::encoding::Context) -> usize {
2246            32
2247        }
2248    }
2249
2250    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2251        for &DeviceInfo
2252    {
2253        #[inline]
2254        unsafe fn encode(
2255            self,
2256            encoder: &mut fidl::encoding::Encoder<'_, D>,
2257            offset: usize,
2258            _depth: fidl::encoding::Depth,
2259        ) -> fidl::Result<()> {
2260            encoder.debug_check_bounds::<DeviceInfo>(offset);
2261            // Delegate to tuple encoding.
2262            fidl::encoding::Encode::<DeviceInfo, D>::encode(
2263                (
2264                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
2265                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.product_id),
2266                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
2267                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2268                        &self.name,
2269                    ),
2270                ),
2271                encoder,
2272                offset,
2273                _depth,
2274            )
2275        }
2276    }
2277    unsafe impl<
2278        D: fidl::encoding::ResourceDialect,
2279        T0: fidl::encoding::Encode<u32, D>,
2280        T1: fidl::encoding::Encode<u32, D>,
2281        T2: fidl::encoding::Encode<u32, D>,
2282        T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
2283    > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3)
2284    {
2285        #[inline]
2286        unsafe fn encode(
2287            self,
2288            encoder: &mut fidl::encoding::Encoder<'_, D>,
2289            offset: usize,
2290            depth: fidl::encoding::Depth,
2291        ) -> fidl::Result<()> {
2292            encoder.debug_check_bounds::<DeviceInfo>(offset);
2293            // Zero out padding regions. There's no need to apply masks
2294            // because the unmasked parts will be overwritten by fields.
2295            unsafe {
2296                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2297                (ptr as *mut u64).write_unaligned(0);
2298            }
2299            // Write the fields.
2300            self.0.encode(encoder, offset + 0, depth)?;
2301            self.1.encode(encoder, offset + 4, depth)?;
2302            self.2.encode(encoder, offset + 8, depth)?;
2303            self.3.encode(encoder, offset + 16, depth)?;
2304            Ok(())
2305        }
2306    }
2307
2308    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2309        #[inline(always)]
2310        fn new_empty() -> Self {
2311            Self {
2312                vendor_id: fidl::new_empty!(u32, D),
2313                product_id: fidl::new_empty!(u32, D),
2314                version: fidl::new_empty!(u32, D),
2315                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
2316            }
2317        }
2318
2319        #[inline]
2320        unsafe fn decode(
2321            &mut self,
2322            decoder: &mut fidl::encoding::Decoder<'_, D>,
2323            offset: usize,
2324            _depth: fidl::encoding::Depth,
2325        ) -> fidl::Result<()> {
2326            decoder.debug_check_bounds::<Self>(offset);
2327            // Verify that padding bytes are zero.
2328            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2329            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2330            let mask = 0xffffffff00000000u64;
2331            let maskedval = padval & mask;
2332            if maskedval != 0 {
2333                return Err(fidl::Error::NonZeroPadding {
2334                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2335                });
2336            }
2337            fidl::decode!(u32, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
2338            fidl::decode!(u32, D, &mut self.product_id, decoder, offset + 4, _depth)?;
2339            fidl::decode!(u32, D, &mut self.version, decoder, offset + 8, _depth)?;
2340            fidl::decode!(
2341                fidl::encoding::UnboundedString,
2342                D,
2343                &mut self.name,
2344                decoder,
2345                offset + 16,
2346                _depth
2347            )?;
2348            Ok(())
2349        }
2350    }
2351
2352    impl fidl::encoding::ValueTypeMarker for FocusEvent {
2353        type Borrowed<'a> = &'a Self;
2354        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2355            value
2356        }
2357    }
2358
2359    unsafe impl fidl::encoding::TypeMarker for FocusEvent {
2360        type Owned = Self;
2361
2362        #[inline(always)]
2363        fn inline_align(_context: fidl::encoding::Context) -> usize {
2364            8
2365        }
2366
2367        #[inline(always)]
2368        fn inline_size(_context: fidl::encoding::Context) -> usize {
2369            16
2370        }
2371    }
2372
2373    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FocusEvent, D>
2374        for &FocusEvent
2375    {
2376        #[inline]
2377        unsafe fn encode(
2378            self,
2379            encoder: &mut fidl::encoding::Encoder<'_, D>,
2380            offset: usize,
2381            _depth: fidl::encoding::Depth,
2382        ) -> fidl::Result<()> {
2383            encoder.debug_check_bounds::<FocusEvent>(offset);
2384            // Delegate to tuple encoding.
2385            fidl::encoding::Encode::<FocusEvent, D>::encode(
2386                (
2387                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
2388                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.focused),
2389                ),
2390                encoder,
2391                offset,
2392                _depth,
2393            )
2394        }
2395    }
2396    unsafe impl<
2397        D: fidl::encoding::ResourceDialect,
2398        T0: fidl::encoding::Encode<u64, D>,
2399        T1: fidl::encoding::Encode<bool, D>,
2400    > fidl::encoding::Encode<FocusEvent, D> for (T0, T1)
2401    {
2402        #[inline]
2403        unsafe fn encode(
2404            self,
2405            encoder: &mut fidl::encoding::Encoder<'_, D>,
2406            offset: usize,
2407            depth: fidl::encoding::Depth,
2408        ) -> fidl::Result<()> {
2409            encoder.debug_check_bounds::<FocusEvent>(offset);
2410            // Zero out padding regions. There's no need to apply masks
2411            // because the unmasked parts will be overwritten by fields.
2412            unsafe {
2413                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2414                (ptr as *mut u64).write_unaligned(0);
2415            }
2416            // Write the fields.
2417            self.0.encode(encoder, offset + 0, depth)?;
2418            self.1.encode(encoder, offset + 8, depth)?;
2419            Ok(())
2420        }
2421    }
2422
2423    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FocusEvent {
2424        #[inline(always)]
2425        fn new_empty() -> Self {
2426            Self { event_time: fidl::new_empty!(u64, D), focused: fidl::new_empty!(bool, D) }
2427        }
2428
2429        #[inline]
2430        unsafe fn decode(
2431            &mut self,
2432            decoder: &mut fidl::encoding::Decoder<'_, D>,
2433            offset: usize,
2434            _depth: fidl::encoding::Depth,
2435        ) -> fidl::Result<()> {
2436            decoder.debug_check_bounds::<Self>(offset);
2437            // Verify that padding bytes are zero.
2438            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2439            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2440            let mask = 0xffffffffffffff00u64;
2441            let maskedval = padval & mask;
2442            if maskedval != 0 {
2443                return Err(fidl::Error::NonZeroPadding {
2444                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2445                });
2446            }
2447            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
2448            fidl::decode!(bool, D, &mut self.focused, decoder, offset + 8, _depth)?;
2449            Ok(())
2450        }
2451    }
2452
2453    impl fidl::encoding::ValueTypeMarker for InputDeviceDispatchReportRequest {
2454        type Borrowed<'a> = &'a Self;
2455        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2456            value
2457        }
2458    }
2459
2460    unsafe impl fidl::encoding::TypeMarker for InputDeviceDispatchReportRequest {
2461        type Owned = Self;
2462
2463        #[inline(always)]
2464        fn inline_align(_context: fidl::encoding::Context) -> usize {
2465            8
2466        }
2467
2468        #[inline(always)]
2469        fn inline_size(_context: fidl::encoding::Context) -> usize {
2470            72
2471        }
2472    }
2473
2474    unsafe impl<D: fidl::encoding::ResourceDialect>
2475        fidl::encoding::Encode<InputDeviceDispatchReportRequest, D>
2476        for &InputDeviceDispatchReportRequest
2477    {
2478        #[inline]
2479        unsafe fn encode(
2480            self,
2481            encoder: &mut fidl::encoding::Encoder<'_, D>,
2482            offset: usize,
2483            _depth: fidl::encoding::Depth,
2484        ) -> fidl::Result<()> {
2485            encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
2486            // Delegate to tuple encoding.
2487            fidl::encoding::Encode::<InputDeviceDispatchReportRequest, D>::encode(
2488                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2489                encoder,
2490                offset,
2491                _depth,
2492            )
2493        }
2494    }
2495    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2496        fidl::encoding::Encode<InputDeviceDispatchReportRequest, D> for (T0,)
2497    {
2498        #[inline]
2499        unsafe fn encode(
2500            self,
2501            encoder: &mut fidl::encoding::Encoder<'_, D>,
2502            offset: usize,
2503            depth: fidl::encoding::Depth,
2504        ) -> fidl::Result<()> {
2505            encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
2506            // Zero out padding regions. There's no need to apply masks
2507            // because the unmasked parts will be overwritten by fields.
2508            // Write the fields.
2509            self.0.encode(encoder, offset + 0, depth)?;
2510            Ok(())
2511        }
2512    }
2513
2514    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2515        for InputDeviceDispatchReportRequest
2516    {
2517        #[inline(always)]
2518        fn new_empty() -> Self {
2519            Self { report: fidl::new_empty!(InputReport, D) }
2520        }
2521
2522        #[inline]
2523        unsafe fn decode(
2524            &mut self,
2525            decoder: &mut fidl::encoding::Decoder<'_, D>,
2526            offset: usize,
2527            _depth: fidl::encoding::Depth,
2528        ) -> fidl::Result<()> {
2529            decoder.debug_check_bounds::<Self>(offset);
2530            // Verify that padding bytes are zero.
2531            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2532            Ok(())
2533        }
2534    }
2535
2536    impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientDidUpdateStateRequest {
2537        type Borrowed<'a> = &'a Self;
2538        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2539            value
2540        }
2541    }
2542
2543    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientDidUpdateStateRequest {
2544        type Owned = Self;
2545
2546        #[inline(always)]
2547        fn inline_align(_context: fidl::encoding::Context) -> usize {
2548            8
2549        }
2550
2551        #[inline(always)]
2552        fn inline_size(_context: fidl::encoding::Context) -> usize {
2553            80
2554        }
2555    }
2556
2557    unsafe impl<D: fidl::encoding::ResourceDialect>
2558        fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D>
2559        for &InputMethodEditorClientDidUpdateStateRequest
2560    {
2561        #[inline]
2562        unsafe fn encode(
2563            self,
2564            encoder: &mut fidl::encoding::Encoder<'_, D>,
2565            offset: usize,
2566            _depth: fidl::encoding::Depth,
2567        ) -> fidl::Result<()> {
2568            encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
2569            // Delegate to tuple encoding.
2570            fidl::encoding::Encode::<InputMethodEditorClientDidUpdateStateRequest, D>::encode(
2571                (
2572                    <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
2573                    <fidl::encoding::OptionalUnion<InputEvent> as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2574                ),
2575                encoder, offset, _depth
2576            )
2577        }
2578    }
2579    unsafe impl<
2580        D: fidl::encoding::ResourceDialect,
2581        T0: fidl::encoding::Encode<TextInputState, D>,
2582        T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<InputEvent>, D>,
2583    > fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D> for (T0, T1)
2584    {
2585        #[inline]
2586        unsafe fn encode(
2587            self,
2588            encoder: &mut fidl::encoding::Encoder<'_, D>,
2589            offset: usize,
2590            depth: fidl::encoding::Depth,
2591        ) -> fidl::Result<()> {
2592            encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
2593            // Zero out padding regions. There's no need to apply masks
2594            // because the unmasked parts will be overwritten by fields.
2595            // Write the fields.
2596            self.0.encode(encoder, offset + 0, depth)?;
2597            self.1.encode(encoder, offset + 64, depth)?;
2598            Ok(())
2599        }
2600    }
2601
2602    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2603        for InputMethodEditorClientDidUpdateStateRequest
2604    {
2605        #[inline(always)]
2606        fn new_empty() -> Self {
2607            Self {
2608                state: fidl::new_empty!(TextInputState, D),
2609                event: fidl::new_empty!(fidl::encoding::OptionalUnion<InputEvent>, D),
2610            }
2611        }
2612
2613        #[inline]
2614        unsafe fn decode(
2615            &mut self,
2616            decoder: &mut fidl::encoding::Decoder<'_, D>,
2617            offset: usize,
2618            _depth: fidl::encoding::Depth,
2619        ) -> fidl::Result<()> {
2620            decoder.debug_check_bounds::<Self>(offset);
2621            // Verify that padding bytes are zero.
2622            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
2623            fidl::decode!(
2624                fidl::encoding::OptionalUnion<InputEvent>,
2625                D,
2626                &mut self.event,
2627                decoder,
2628                offset + 64,
2629                _depth
2630            )?;
2631            Ok(())
2632        }
2633    }
2634
2635    impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientOnActionRequest {
2636        type Borrowed<'a> = &'a Self;
2637        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2638            value
2639        }
2640    }
2641
2642    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientOnActionRequest {
2643        type Owned = Self;
2644
2645        #[inline(always)]
2646        fn inline_align(_context: fidl::encoding::Context) -> usize {
2647            4
2648        }
2649
2650        #[inline(always)]
2651        fn inline_size(_context: fidl::encoding::Context) -> usize {
2652            4
2653        }
2654    }
2655
2656    unsafe impl<D: fidl::encoding::ResourceDialect>
2657        fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D>
2658        for &InputMethodEditorClientOnActionRequest
2659    {
2660        #[inline]
2661        unsafe fn encode(
2662            self,
2663            encoder: &mut fidl::encoding::Encoder<'_, D>,
2664            offset: usize,
2665            _depth: fidl::encoding::Depth,
2666        ) -> fidl::Result<()> {
2667            encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
2668            // Delegate to tuple encoding.
2669            fidl::encoding::Encode::<InputMethodEditorClientOnActionRequest, D>::encode(
2670                (<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
2671                encoder,
2672                offset,
2673                _depth,
2674            )
2675        }
2676    }
2677    unsafe impl<
2678        D: fidl::encoding::ResourceDialect,
2679        T0: fidl::encoding::Encode<InputMethodAction, D>,
2680    > fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D> for (T0,)
2681    {
2682        #[inline]
2683        unsafe fn encode(
2684            self,
2685            encoder: &mut fidl::encoding::Encoder<'_, D>,
2686            offset: usize,
2687            depth: fidl::encoding::Depth,
2688        ) -> fidl::Result<()> {
2689            encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
2690            // Zero out padding regions. There's no need to apply masks
2691            // because the unmasked parts will be overwritten by fields.
2692            // Write the fields.
2693            self.0.encode(encoder, offset + 0, depth)?;
2694            Ok(())
2695        }
2696    }
2697
2698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2699        for InputMethodEditorClientOnActionRequest
2700    {
2701        #[inline(always)]
2702        fn new_empty() -> Self {
2703            Self { action: fidl::new_empty!(InputMethodAction, D) }
2704        }
2705
2706        #[inline]
2707        unsafe fn decode(
2708            &mut self,
2709            decoder: &mut fidl::encoding::Decoder<'_, D>,
2710            offset: usize,
2711            _depth: fidl::encoding::Depth,
2712        ) -> fidl::Result<()> {
2713            decoder.debug_check_bounds::<Self>(offset);
2714            // Verify that padding bytes are zero.
2715            fidl::decode!(InputMethodAction, D, &mut self.action, decoder, offset + 0, _depth)?;
2716            Ok(())
2717        }
2718    }
2719
2720    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
2721        type Borrowed<'a> = &'a Self;
2722        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2723            value
2724        }
2725    }
2726
2727    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Request {
2728        type Owned = Self;
2729
2730        #[inline(always)]
2731        fn inline_align(_context: fidl::encoding::Context) -> usize {
2732            8
2733        }
2734
2735        #[inline(always)]
2736        fn inline_size(_context: fidl::encoding::Context) -> usize {
2737            16
2738        }
2739    }
2740
2741    unsafe impl<D: fidl::encoding::ResourceDialect>
2742        fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D>
2743        for &InputMethodEditorDispatchKey3Request
2744    {
2745        #[inline]
2746        unsafe fn encode(
2747            self,
2748            encoder: &mut fidl::encoding::Encoder<'_, D>,
2749            offset: usize,
2750            _depth: fidl::encoding::Depth,
2751        ) -> fidl::Result<()> {
2752            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2753            // Delegate to tuple encoding.
2754            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request, D>::encode(
2755                (
2756                    <fidl_fuchsia_ui_input3__common::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2757                ),
2758                encoder, offset, _depth
2759            )
2760        }
2761    }
2762    unsafe impl<
2763        D: fidl::encoding::ResourceDialect,
2764        T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3__common::KeyEvent, D>,
2765    > fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D> for (T0,)
2766    {
2767        #[inline]
2768        unsafe fn encode(
2769            self,
2770            encoder: &mut fidl::encoding::Encoder<'_, D>,
2771            offset: usize,
2772            depth: fidl::encoding::Depth,
2773        ) -> fidl::Result<()> {
2774            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2775            // Zero out padding regions. There's no need to apply masks
2776            // because the unmasked parts will be overwritten by fields.
2777            // Write the fields.
2778            self.0.encode(encoder, offset + 0, depth)?;
2779            Ok(())
2780        }
2781    }
2782
2783    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2784        for InputMethodEditorDispatchKey3Request
2785    {
2786        #[inline(always)]
2787        fn new_empty() -> Self {
2788            Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3__common::KeyEvent, D) }
2789        }
2790
2791        #[inline]
2792        unsafe fn decode(
2793            &mut self,
2794            decoder: &mut fidl::encoding::Decoder<'_, D>,
2795            offset: usize,
2796            _depth: fidl::encoding::Depth,
2797        ) -> fidl::Result<()> {
2798            decoder.debug_check_bounds::<Self>(offset);
2799            // Verify that padding bytes are zero.
2800            fidl::decode!(
2801                fidl_fuchsia_ui_input3__common::KeyEvent,
2802                D,
2803                &mut self.event,
2804                decoder,
2805                offset + 0,
2806                _depth
2807            )?;
2808            Ok(())
2809        }
2810    }
2811
2812    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
2813        type Borrowed<'a> = &'a Self;
2814        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2815            value
2816        }
2817    }
2818
2819    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Response {
2820        type Owned = Self;
2821
2822        #[inline(always)]
2823        fn inline_align(_context: fidl::encoding::Context) -> usize {
2824            1
2825        }
2826
2827        #[inline(always)]
2828        fn inline_size(_context: fidl::encoding::Context) -> usize {
2829            1
2830        }
2831    }
2832
2833    unsafe impl<D: fidl::encoding::ResourceDialect>
2834        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D>
2835        for &InputMethodEditorDispatchKey3Response
2836    {
2837        #[inline]
2838        unsafe fn encode(
2839            self,
2840            encoder: &mut fidl::encoding::Encoder<'_, D>,
2841            offset: usize,
2842            _depth: fidl::encoding::Depth,
2843        ) -> fidl::Result<()> {
2844            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2845            // Delegate to tuple encoding.
2846            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response, D>::encode(
2847                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
2848                encoder,
2849                offset,
2850                _depth,
2851            )
2852        }
2853    }
2854    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2855        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D> for (T0,)
2856    {
2857        #[inline]
2858        unsafe fn encode(
2859            self,
2860            encoder: &mut fidl::encoding::Encoder<'_, D>,
2861            offset: usize,
2862            depth: fidl::encoding::Depth,
2863        ) -> fidl::Result<()> {
2864            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2865            // Zero out padding regions. There's no need to apply masks
2866            // because the unmasked parts will be overwritten by fields.
2867            // Write the fields.
2868            self.0.encode(encoder, offset + 0, depth)?;
2869            Ok(())
2870        }
2871    }
2872
2873    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2874        for InputMethodEditorDispatchKey3Response
2875    {
2876        #[inline(always)]
2877        fn new_empty() -> Self {
2878            Self { handled: fidl::new_empty!(bool, D) }
2879        }
2880
2881        #[inline]
2882        unsafe fn decode(
2883            &mut self,
2884            decoder: &mut fidl::encoding::Decoder<'_, D>,
2885            offset: usize,
2886            _depth: fidl::encoding::Depth,
2887        ) -> fidl::Result<()> {
2888            decoder.debug_check_bounds::<Self>(offset);
2889            // Verify that padding bytes are zero.
2890            fidl::decode!(bool, D, &mut self.handled, decoder, offset + 0, _depth)?;
2891            Ok(())
2892        }
2893    }
2894
2895    impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
2896        type Borrowed<'a> = &'a Self;
2897        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2898            value
2899        }
2900    }
2901
2902    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorInjectInputRequest {
2903        type Owned = Self;
2904
2905        #[inline(always)]
2906        fn inline_align(_context: fidl::encoding::Context) -> usize {
2907            8
2908        }
2909
2910        #[inline(always)]
2911        fn inline_size(_context: fidl::encoding::Context) -> usize {
2912            16
2913        }
2914    }
2915
2916    unsafe impl<D: fidl::encoding::ResourceDialect>
2917        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D>
2918        for &InputMethodEditorInjectInputRequest
2919    {
2920        #[inline]
2921        unsafe fn encode(
2922            self,
2923            encoder: &mut fidl::encoding::Encoder<'_, D>,
2924            offset: usize,
2925            _depth: fidl::encoding::Depth,
2926        ) -> fidl::Result<()> {
2927            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2928            // Delegate to tuple encoding.
2929            fidl::encoding::Encode::<InputMethodEditorInjectInputRequest, D>::encode(
2930                (<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
2931                encoder,
2932                offset,
2933                _depth,
2934            )
2935        }
2936    }
2937    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputEvent, D>>
2938        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D> for (T0,)
2939    {
2940        #[inline]
2941        unsafe fn encode(
2942            self,
2943            encoder: &mut fidl::encoding::Encoder<'_, D>,
2944            offset: usize,
2945            depth: fidl::encoding::Depth,
2946        ) -> fidl::Result<()> {
2947            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2948            // Zero out padding regions. There's no need to apply masks
2949            // because the unmasked parts will be overwritten by fields.
2950            // Write the fields.
2951            self.0.encode(encoder, offset + 0, depth)?;
2952            Ok(())
2953        }
2954    }
2955
2956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2957        for InputMethodEditorInjectInputRequest
2958    {
2959        #[inline(always)]
2960        fn new_empty() -> Self {
2961            Self { event: fidl::new_empty!(InputEvent, D) }
2962        }
2963
2964        #[inline]
2965        unsafe fn decode(
2966            &mut self,
2967            decoder: &mut fidl::encoding::Decoder<'_, D>,
2968            offset: usize,
2969            _depth: fidl::encoding::Depth,
2970        ) -> fidl::Result<()> {
2971            decoder.debug_check_bounds::<Self>(offset);
2972            // Verify that padding bytes are zero.
2973            fidl::decode!(InputEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
2974            Ok(())
2975        }
2976    }
2977
2978    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2979        type Borrowed<'a> = &'a Self;
2980        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2981            value
2982        }
2983    }
2984
2985    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2986        type Owned = Self;
2987
2988        #[inline(always)]
2989        fn inline_align(_context: fidl::encoding::Context) -> usize {
2990            4
2991        }
2992
2993        #[inline(always)]
2994        fn inline_size(_context: fidl::encoding::Context) -> usize {
2995            4
2996        }
2997    }
2998
2999    unsafe impl<D: fidl::encoding::ResourceDialect>
3000        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D>
3001        for &InputMethodEditorSetKeyboardTypeRequest
3002    {
3003        #[inline]
3004        unsafe fn encode(
3005            self,
3006            encoder: &mut fidl::encoding::Encoder<'_, D>,
3007            offset: usize,
3008            _depth: fidl::encoding::Depth,
3009        ) -> fidl::Result<()> {
3010            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
3011            // Delegate to tuple encoding.
3012            fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest, D>::encode(
3013                (<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
3014                encoder,
3015                offset,
3016                _depth,
3017            )
3018        }
3019    }
3020    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardType, D>>
3021        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D> for (T0,)
3022    {
3023        #[inline]
3024        unsafe fn encode(
3025            self,
3026            encoder: &mut fidl::encoding::Encoder<'_, D>,
3027            offset: usize,
3028            depth: fidl::encoding::Depth,
3029        ) -> fidl::Result<()> {
3030            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
3031            // Zero out padding regions. There's no need to apply masks
3032            // because the unmasked parts will be overwritten by fields.
3033            // Write the fields.
3034            self.0.encode(encoder, offset + 0, depth)?;
3035            Ok(())
3036        }
3037    }
3038
3039    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3040        for InputMethodEditorSetKeyboardTypeRequest
3041    {
3042        #[inline(always)]
3043        fn new_empty() -> Self {
3044            Self { keyboard_type: fidl::new_empty!(KeyboardType, D) }
3045        }
3046
3047        #[inline]
3048        unsafe fn decode(
3049            &mut self,
3050            decoder: &mut fidl::encoding::Decoder<'_, D>,
3051            offset: usize,
3052            _depth: fidl::encoding::Depth,
3053        ) -> fidl::Result<()> {
3054            decoder.debug_check_bounds::<Self>(offset);
3055            // Verify that padding bytes are zero.
3056            fidl::decode!(KeyboardType, D, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
3057            Ok(())
3058        }
3059    }
3060
3061    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
3062        type Borrowed<'a> = &'a Self;
3063        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3064            value
3065        }
3066    }
3067
3068    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetStateRequest {
3069        type Owned = Self;
3070
3071        #[inline(always)]
3072        fn inline_align(_context: fidl::encoding::Context) -> usize {
3073            8
3074        }
3075
3076        #[inline(always)]
3077        fn inline_size(_context: fidl::encoding::Context) -> usize {
3078            64
3079        }
3080    }
3081
3082    unsafe impl<D: fidl::encoding::ResourceDialect>
3083        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D>
3084        for &InputMethodEditorSetStateRequest
3085    {
3086        #[inline]
3087        unsafe fn encode(
3088            self,
3089            encoder: &mut fidl::encoding::Encoder<'_, D>,
3090            offset: usize,
3091            _depth: fidl::encoding::Depth,
3092        ) -> fidl::Result<()> {
3093            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
3094            // Delegate to tuple encoding.
3095            fidl::encoding::Encode::<InputMethodEditorSetStateRequest, D>::encode(
3096                (<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
3097                encoder,
3098                offset,
3099                _depth,
3100            )
3101        }
3102    }
3103    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TextInputState, D>>
3104        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D> for (T0,)
3105    {
3106        #[inline]
3107        unsafe fn encode(
3108            self,
3109            encoder: &mut fidl::encoding::Encoder<'_, D>,
3110            offset: usize,
3111            depth: fidl::encoding::Depth,
3112        ) -> fidl::Result<()> {
3113            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
3114            // Zero out padding regions. There's no need to apply masks
3115            // because the unmasked parts will be overwritten by fields.
3116            // Write the fields.
3117            self.0.encode(encoder, offset + 0, depth)?;
3118            Ok(())
3119        }
3120    }
3121
3122    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3123        for InputMethodEditorSetStateRequest
3124    {
3125        #[inline(always)]
3126        fn new_empty() -> Self {
3127            Self { state: fidl::new_empty!(TextInputState, D) }
3128        }
3129
3130        #[inline]
3131        unsafe fn decode(
3132            &mut self,
3133            decoder: &mut fidl::encoding::Decoder<'_, D>,
3134            offset: usize,
3135            _depth: fidl::encoding::Depth,
3136        ) -> fidl::Result<()> {
3137            decoder.debug_check_bounds::<Self>(offset);
3138            // Verify that padding bytes are zero.
3139            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
3140            Ok(())
3141        }
3142    }
3143
3144    impl fidl::encoding::ValueTypeMarker for InputReport {
3145        type Borrowed<'a> = &'a Self;
3146        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3147            value
3148        }
3149    }
3150
3151    unsafe impl fidl::encoding::TypeMarker for InputReport {
3152        type Owned = Self;
3153
3154        #[inline(always)]
3155        fn inline_align(_context: fidl::encoding::Context) -> usize {
3156            8
3157        }
3158
3159        #[inline(always)]
3160        fn inline_size(_context: fidl::encoding::Context) -> usize {
3161            72
3162        }
3163    }
3164
3165    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
3166        for &InputReport
3167    {
3168        #[inline]
3169        unsafe fn encode(
3170            self,
3171            encoder: &mut fidl::encoding::Encoder<'_, D>,
3172            offset: usize,
3173            _depth: fidl::encoding::Depth,
3174        ) -> fidl::Result<()> {
3175            encoder.debug_check_bounds::<InputReport>(offset);
3176            // Delegate to tuple encoding.
3177            fidl::encoding::Encode::<InputReport, D>::encode(
3178                (
3179                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3180                    <fidl::encoding::Boxed<KeyboardReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
3181                    <fidl::encoding::Boxed<MediaButtonsReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
3182                    <fidl::encoding::Boxed<MouseReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
3183                    <fidl::encoding::Boxed<StylusReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
3184                    <fidl::encoding::Boxed<TouchscreenReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
3185                    <fidl::encoding::OptionalUnion<SensorReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
3186                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.trace_id),
3187                ),
3188                encoder, offset, _depth
3189            )
3190        }
3191    }
3192    unsafe impl<
3193        D: fidl::encoding::ResourceDialect,
3194        T0: fidl::encoding::Encode<u64, D>,
3195        T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>, D>,
3196        T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>, D>,
3197        T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>, D>,
3198        T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>, D>,
3199        T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>, D>,
3200        T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>, D>,
3201        T7: fidl::encoding::Encode<u64, D>,
3202    > fidl::encoding::Encode<InputReport, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
3203    {
3204        #[inline]
3205        unsafe fn encode(
3206            self,
3207            encoder: &mut fidl::encoding::Encoder<'_, D>,
3208            offset: usize,
3209            depth: fidl::encoding::Depth,
3210        ) -> fidl::Result<()> {
3211            encoder.debug_check_bounds::<InputReport>(offset);
3212            // Zero out padding regions. There's no need to apply masks
3213            // because the unmasked parts will be overwritten by fields.
3214            // Write the fields.
3215            self.0.encode(encoder, offset + 0, depth)?;
3216            self.1.encode(encoder, offset + 8, depth)?;
3217            self.2.encode(encoder, offset + 16, depth)?;
3218            self.3.encode(encoder, offset + 24, depth)?;
3219            self.4.encode(encoder, offset + 32, depth)?;
3220            self.5.encode(encoder, offset + 40, depth)?;
3221            self.6.encode(encoder, offset + 48, depth)?;
3222            self.7.encode(encoder, offset + 64, depth)?;
3223            Ok(())
3224        }
3225    }
3226
3227    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
3228        #[inline(always)]
3229        fn new_empty() -> Self {
3230            Self {
3231                event_time: fidl::new_empty!(u64, D),
3232                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>, D),
3233                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>, D),
3234                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>, D),
3235                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>, D),
3236                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>, D),
3237                sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>, D),
3238                trace_id: fidl::new_empty!(u64, D),
3239            }
3240        }
3241
3242        #[inline]
3243        unsafe fn decode(
3244            &mut self,
3245            decoder: &mut fidl::encoding::Decoder<'_, D>,
3246            offset: usize,
3247            _depth: fidl::encoding::Depth,
3248        ) -> fidl::Result<()> {
3249            decoder.debug_check_bounds::<Self>(offset);
3250            // Verify that padding bytes are zero.
3251            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3252            fidl::decode!(
3253                fidl::encoding::Boxed<KeyboardReport>,
3254                D,
3255                &mut self.keyboard,
3256                decoder,
3257                offset + 8,
3258                _depth
3259            )?;
3260            fidl::decode!(
3261                fidl::encoding::Boxed<MediaButtonsReport>,
3262                D,
3263                &mut self.media_buttons,
3264                decoder,
3265                offset + 16,
3266                _depth
3267            )?;
3268            fidl::decode!(
3269                fidl::encoding::Boxed<MouseReport>,
3270                D,
3271                &mut self.mouse,
3272                decoder,
3273                offset + 24,
3274                _depth
3275            )?;
3276            fidl::decode!(
3277                fidl::encoding::Boxed<StylusReport>,
3278                D,
3279                &mut self.stylus,
3280                decoder,
3281                offset + 32,
3282                _depth
3283            )?;
3284            fidl::decode!(
3285                fidl::encoding::Boxed<TouchscreenReport>,
3286                D,
3287                &mut self.touchscreen,
3288                decoder,
3289                offset + 40,
3290                _depth
3291            )?;
3292            fidl::decode!(
3293                fidl::encoding::OptionalUnion<SensorReport>,
3294                D,
3295                &mut self.sensor,
3296                decoder,
3297                offset + 48,
3298                _depth
3299            )?;
3300            fidl::decode!(u64, D, &mut self.trace_id, decoder, offset + 64, _depth)?;
3301            Ok(())
3302        }
3303    }
3304
3305    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
3306        type Borrowed<'a> = &'a Self;
3307        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3308            value
3309        }
3310    }
3311
3312    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
3313        type Owned = Self;
3314
3315        #[inline(always)]
3316        fn inline_align(_context: fidl::encoding::Context) -> usize {
3317            8
3318        }
3319
3320        #[inline(always)]
3321        fn inline_size(_context: fidl::encoding::Context) -> usize {
3322            16
3323        }
3324    }
3325
3326    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
3327        for &KeyboardDescriptor
3328    {
3329        #[inline]
3330        unsafe fn encode(
3331            self,
3332            encoder: &mut fidl::encoding::Encoder<'_, D>,
3333            offset: usize,
3334            _depth: fidl::encoding::Depth,
3335        ) -> fidl::Result<()> {
3336            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3337            // Delegate to tuple encoding.
3338            fidl::encoding::Encode::<KeyboardDescriptor, D>::encode(
3339                (
3340                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
3341                ),
3342                encoder, offset, _depth
3343            )
3344        }
3345    }
3346    unsafe impl<
3347        D: fidl::encoding::ResourceDialect,
3348        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3349    > fidl::encoding::Encode<KeyboardDescriptor, D> for (T0,)
3350    {
3351        #[inline]
3352        unsafe fn encode(
3353            self,
3354            encoder: &mut fidl::encoding::Encoder<'_, D>,
3355            offset: usize,
3356            depth: fidl::encoding::Depth,
3357        ) -> fidl::Result<()> {
3358            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3359            // Zero out padding regions. There's no need to apply masks
3360            // because the unmasked parts will be overwritten by fields.
3361            // Write the fields.
3362            self.0.encode(encoder, offset + 0, depth)?;
3363            Ok(())
3364        }
3365    }
3366
3367    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
3368        #[inline(always)]
3369        fn new_empty() -> Self {
3370            Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3371        }
3372
3373        #[inline]
3374        unsafe fn decode(
3375            &mut self,
3376            decoder: &mut fidl::encoding::Decoder<'_, D>,
3377            offset: usize,
3378            _depth: fidl::encoding::Depth,
3379        ) -> fidl::Result<()> {
3380            decoder.debug_check_bounds::<Self>(offset);
3381            // Verify that padding bytes are zero.
3382            fidl::decode!(
3383                fidl::encoding::UnboundedVector<u32>,
3384                D,
3385                &mut self.keys,
3386                decoder,
3387                offset + 0,
3388                _depth
3389            )?;
3390            Ok(())
3391        }
3392    }
3393
3394    impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
3395        type Borrowed<'a> = &'a Self;
3396        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3397            value
3398        }
3399    }
3400
3401    unsafe impl fidl::encoding::TypeMarker for KeyboardEvent {
3402        type Owned = Self;
3403
3404        #[inline(always)]
3405        fn inline_align(_context: fidl::encoding::Context) -> usize {
3406            8
3407        }
3408
3409        #[inline(always)]
3410        fn inline_size(_context: fidl::encoding::Context) -> usize {
3411            32
3412        }
3413    }
3414
3415    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardEvent, D>
3416        for &KeyboardEvent
3417    {
3418        #[inline]
3419        unsafe fn encode(
3420            self,
3421            encoder: &mut fidl::encoding::Encoder<'_, D>,
3422            offset: usize,
3423            _depth: fidl::encoding::Depth,
3424        ) -> fidl::Result<()> {
3425            encoder.debug_check_bounds::<KeyboardEvent>(offset);
3426            // Delegate to tuple encoding.
3427            fidl::encoding::Encode::<KeyboardEvent, D>::encode(
3428                (
3429                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3430                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
3431                    <KeyboardEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
3432                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hid_usage),
3433                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.code_point),
3434                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.modifiers),
3435                ),
3436                encoder,
3437                offset,
3438                _depth,
3439            )
3440        }
3441    }
3442    unsafe impl<
3443        D: fidl::encoding::ResourceDialect,
3444        T0: fidl::encoding::Encode<u64, D>,
3445        T1: fidl::encoding::Encode<u32, D>,
3446        T2: fidl::encoding::Encode<KeyboardEventPhase, D>,
3447        T3: fidl::encoding::Encode<u32, D>,
3448        T4: fidl::encoding::Encode<u32, D>,
3449        T5: fidl::encoding::Encode<u32, D>,
3450    > fidl::encoding::Encode<KeyboardEvent, D> for (T0, T1, T2, T3, T4, T5)
3451    {
3452        #[inline]
3453        unsafe fn encode(
3454            self,
3455            encoder: &mut fidl::encoding::Encoder<'_, D>,
3456            offset: usize,
3457            depth: fidl::encoding::Depth,
3458        ) -> fidl::Result<()> {
3459            encoder.debug_check_bounds::<KeyboardEvent>(offset);
3460            // Zero out padding regions. There's no need to apply masks
3461            // because the unmasked parts will be overwritten by fields.
3462            unsafe {
3463                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3464                (ptr as *mut u64).write_unaligned(0);
3465            }
3466            // Write the fields.
3467            self.0.encode(encoder, offset + 0, depth)?;
3468            self.1.encode(encoder, offset + 8, depth)?;
3469            self.2.encode(encoder, offset + 12, depth)?;
3470            self.3.encode(encoder, offset + 16, depth)?;
3471            self.4.encode(encoder, offset + 20, depth)?;
3472            self.5.encode(encoder, offset + 24, depth)?;
3473            Ok(())
3474        }
3475    }
3476
3477    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEvent {
3478        #[inline(always)]
3479        fn new_empty() -> Self {
3480            Self {
3481                event_time: fidl::new_empty!(u64, D),
3482                device_id: fidl::new_empty!(u32, D),
3483                phase: fidl::new_empty!(KeyboardEventPhase, D),
3484                hid_usage: fidl::new_empty!(u32, D),
3485                code_point: fidl::new_empty!(u32, D),
3486                modifiers: fidl::new_empty!(u32, D),
3487            }
3488        }
3489
3490        #[inline]
3491        unsafe fn decode(
3492            &mut self,
3493            decoder: &mut fidl::encoding::Decoder<'_, D>,
3494            offset: usize,
3495            _depth: fidl::encoding::Depth,
3496        ) -> fidl::Result<()> {
3497            decoder.debug_check_bounds::<Self>(offset);
3498            // Verify that padding bytes are zero.
3499            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3500            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3501            let mask = 0xffffffff00000000u64;
3502            let maskedval = padval & mask;
3503            if maskedval != 0 {
3504                return Err(fidl::Error::NonZeroPadding {
3505                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3506                });
3507            }
3508            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3509            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
3510            fidl::decode!(KeyboardEventPhase, D, &mut self.phase, decoder, offset + 12, _depth)?;
3511            fidl::decode!(u32, D, &mut self.hid_usage, decoder, offset + 16, _depth)?;
3512            fidl::decode!(u32, D, &mut self.code_point, decoder, offset + 20, _depth)?;
3513            fidl::decode!(u32, D, &mut self.modifiers, decoder, offset + 24, _depth)?;
3514            Ok(())
3515        }
3516    }
3517
3518    impl fidl::encoding::ValueTypeMarker for KeyboardReport {
3519        type Borrowed<'a> = &'a Self;
3520        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3521            value
3522        }
3523    }
3524
3525    unsafe impl fidl::encoding::TypeMarker for KeyboardReport {
3526        type Owned = Self;
3527
3528        #[inline(always)]
3529        fn inline_align(_context: fidl::encoding::Context) -> usize {
3530            8
3531        }
3532
3533        #[inline(always)]
3534        fn inline_size(_context: fidl::encoding::Context) -> usize {
3535            16
3536        }
3537    }
3538
3539    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardReport, D>
3540        for &KeyboardReport
3541    {
3542        #[inline]
3543        unsafe fn encode(
3544            self,
3545            encoder: &mut fidl::encoding::Encoder<'_, D>,
3546            offset: usize,
3547            _depth: fidl::encoding::Depth,
3548        ) -> fidl::Result<()> {
3549            encoder.debug_check_bounds::<KeyboardReport>(offset);
3550            // Delegate to tuple encoding.
3551            fidl::encoding::Encode::<KeyboardReport, D>::encode(
3552                (
3553                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
3554                ),
3555                encoder, offset, _depth
3556            )
3557        }
3558    }
3559    unsafe impl<
3560        D: fidl::encoding::ResourceDialect,
3561        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3562    > fidl::encoding::Encode<KeyboardReport, D> for (T0,)
3563    {
3564        #[inline]
3565        unsafe fn encode(
3566            self,
3567            encoder: &mut fidl::encoding::Encoder<'_, D>,
3568            offset: usize,
3569            depth: fidl::encoding::Depth,
3570        ) -> fidl::Result<()> {
3571            encoder.debug_check_bounds::<KeyboardReport>(offset);
3572            // Zero out padding regions. There's no need to apply masks
3573            // because the unmasked parts will be overwritten by fields.
3574            // Write the fields.
3575            self.0.encode(encoder, offset + 0, depth)?;
3576            Ok(())
3577        }
3578    }
3579
3580    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardReport {
3581        #[inline(always)]
3582        fn new_empty() -> Self {
3583            Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3584        }
3585
3586        #[inline]
3587        unsafe fn decode(
3588            &mut self,
3589            decoder: &mut fidl::encoding::Decoder<'_, D>,
3590            offset: usize,
3591            _depth: fidl::encoding::Depth,
3592        ) -> fidl::Result<()> {
3593            decoder.debug_check_bounds::<Self>(offset);
3594            // Verify that padding bytes are zero.
3595            fidl::decode!(
3596                fidl::encoding::UnboundedVector<u32>,
3597                D,
3598                &mut self.pressed_keys,
3599                decoder,
3600                offset + 0,
3601                _depth
3602            )?;
3603            Ok(())
3604        }
3605    }
3606
3607    impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
3608        type Borrowed<'a> = &'a Self;
3609        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3610            value
3611        }
3612    }
3613
3614    unsafe impl fidl::encoding::TypeMarker for MediaButtonsDescriptor {
3615        type Owned = Self;
3616
3617        #[inline(always)]
3618        fn inline_align(_context: fidl::encoding::Context) -> usize {
3619            4
3620        }
3621
3622        #[inline(always)]
3623        fn inline_size(_context: fidl::encoding::Context) -> usize {
3624            4
3625        }
3626        #[inline(always)]
3627        fn encode_is_copy() -> bool {
3628            true
3629        }
3630
3631        #[inline(always)]
3632        fn decode_is_copy() -> bool {
3633            true
3634        }
3635    }
3636
3637    unsafe impl<D: fidl::encoding::ResourceDialect>
3638        fidl::encoding::Encode<MediaButtonsDescriptor, D> for &MediaButtonsDescriptor
3639    {
3640        #[inline]
3641        unsafe fn encode(
3642            self,
3643            encoder: &mut fidl::encoding::Encoder<'_, D>,
3644            offset: usize,
3645            _depth: fidl::encoding::Depth,
3646        ) -> fidl::Result<()> {
3647            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3648            unsafe {
3649                // Copy the object into the buffer.
3650                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3651                (buf_ptr as *mut MediaButtonsDescriptor)
3652                    .write_unaligned((self as *const MediaButtonsDescriptor).read());
3653                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3654                // done second because the memcpy will write garbage to these bytes.
3655            }
3656            Ok(())
3657        }
3658    }
3659    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3660        fidl::encoding::Encode<MediaButtonsDescriptor, D> for (T0,)
3661    {
3662        #[inline]
3663        unsafe fn encode(
3664            self,
3665            encoder: &mut fidl::encoding::Encoder<'_, D>,
3666            offset: usize,
3667            depth: fidl::encoding::Depth,
3668        ) -> fidl::Result<()> {
3669            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3670            // Zero out padding regions. There's no need to apply masks
3671            // because the unmasked parts will be overwritten by fields.
3672            // Write the fields.
3673            self.0.encode(encoder, offset + 0, depth)?;
3674            Ok(())
3675        }
3676    }
3677
3678    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3679        for MediaButtonsDescriptor
3680    {
3681        #[inline(always)]
3682        fn new_empty() -> Self {
3683            Self { buttons: fidl::new_empty!(u32, D) }
3684        }
3685
3686        #[inline]
3687        unsafe fn decode(
3688            &mut self,
3689            decoder: &mut fidl::encoding::Decoder<'_, D>,
3690            offset: usize,
3691            _depth: fidl::encoding::Depth,
3692        ) -> fidl::Result<()> {
3693            decoder.debug_check_bounds::<Self>(offset);
3694            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3695            // Verify that padding bytes are zero.
3696            // Copy from the buffer into the object.
3697            unsafe {
3698                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3699            }
3700            Ok(())
3701        }
3702    }
3703
3704    impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
3705        type Borrowed<'a> = &'a Self;
3706        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3707            value
3708        }
3709    }
3710
3711    unsafe impl fidl::encoding::TypeMarker for MediaButtonsReport {
3712        type Owned = Self;
3713
3714        #[inline(always)]
3715        fn inline_align(_context: fidl::encoding::Context) -> usize {
3716            1
3717        }
3718
3719        #[inline(always)]
3720        fn inline_size(_context: fidl::encoding::Context) -> usize {
3721            6
3722        }
3723    }
3724
3725    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsReport, D>
3726        for &MediaButtonsReport
3727    {
3728        #[inline]
3729        unsafe fn encode(
3730            self,
3731            encoder: &mut fidl::encoding::Encoder<'_, D>,
3732            offset: usize,
3733            _depth: fidl::encoding::Depth,
3734        ) -> fidl::Result<()> {
3735            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3736            // Delegate to tuple encoding.
3737            fidl::encoding::Encode::<MediaButtonsReport, D>::encode(
3738                (
3739                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_up),
3740                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_down),
3741                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mic_mute),
3742                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reset),
3743                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.pause),
3744                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.camera_disable),
3745                ),
3746                encoder,
3747                offset,
3748                _depth,
3749            )
3750        }
3751    }
3752    unsafe impl<
3753        D: fidl::encoding::ResourceDialect,
3754        T0: fidl::encoding::Encode<bool, D>,
3755        T1: fidl::encoding::Encode<bool, D>,
3756        T2: fidl::encoding::Encode<bool, D>,
3757        T3: fidl::encoding::Encode<bool, D>,
3758        T4: fidl::encoding::Encode<bool, D>,
3759        T5: fidl::encoding::Encode<bool, D>,
3760    > fidl::encoding::Encode<MediaButtonsReport, D> for (T0, T1, T2, T3, T4, T5)
3761    {
3762        #[inline]
3763        unsafe fn encode(
3764            self,
3765            encoder: &mut fidl::encoding::Encoder<'_, D>,
3766            offset: usize,
3767            depth: fidl::encoding::Depth,
3768        ) -> fidl::Result<()> {
3769            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3770            // Zero out padding regions. There's no need to apply masks
3771            // because the unmasked parts will be overwritten by fields.
3772            // Write the fields.
3773            self.0.encode(encoder, offset + 0, depth)?;
3774            self.1.encode(encoder, offset + 1, depth)?;
3775            self.2.encode(encoder, offset + 2, depth)?;
3776            self.3.encode(encoder, offset + 3, depth)?;
3777            self.4.encode(encoder, offset + 4, depth)?;
3778            self.5.encode(encoder, offset + 5, depth)?;
3779            Ok(())
3780        }
3781    }
3782
3783    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsReport {
3784        #[inline(always)]
3785        fn new_empty() -> Self {
3786            Self {
3787                volume_up: fidl::new_empty!(bool, D),
3788                volume_down: fidl::new_empty!(bool, D),
3789                mic_mute: fidl::new_empty!(bool, D),
3790                reset: fidl::new_empty!(bool, D),
3791                pause: fidl::new_empty!(bool, D),
3792                camera_disable: fidl::new_empty!(bool, D),
3793            }
3794        }
3795
3796        #[inline]
3797        unsafe fn decode(
3798            &mut self,
3799            decoder: &mut fidl::encoding::Decoder<'_, D>,
3800            offset: usize,
3801            _depth: fidl::encoding::Depth,
3802        ) -> fidl::Result<()> {
3803            decoder.debug_check_bounds::<Self>(offset);
3804            // Verify that padding bytes are zero.
3805            fidl::decode!(bool, D, &mut self.volume_up, decoder, offset + 0, _depth)?;
3806            fidl::decode!(bool, D, &mut self.volume_down, decoder, offset + 1, _depth)?;
3807            fidl::decode!(bool, D, &mut self.mic_mute, decoder, offset + 2, _depth)?;
3808            fidl::decode!(bool, D, &mut self.reset, decoder, offset + 3, _depth)?;
3809            fidl::decode!(bool, D, &mut self.pause, decoder, offset + 4, _depth)?;
3810            fidl::decode!(bool, D, &mut self.camera_disable, decoder, offset + 5, _depth)?;
3811            Ok(())
3812        }
3813    }
3814
3815    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
3816        type Borrowed<'a> = &'a Self;
3817        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3818            value
3819        }
3820    }
3821
3822    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
3823        type Owned = Self;
3824
3825        #[inline(always)]
3826        fn inline_align(_context: fidl::encoding::Context) -> usize {
3827            8
3828        }
3829
3830        #[inline(always)]
3831        fn inline_size(_context: fidl::encoding::Context) -> usize {
3832            56
3833        }
3834    }
3835
3836    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
3837        for &MouseDescriptor
3838    {
3839        #[inline]
3840        unsafe fn encode(
3841            self,
3842            encoder: &mut fidl::encoding::Encoder<'_, D>,
3843            offset: usize,
3844            _depth: fidl::encoding::Depth,
3845        ) -> fidl::Result<()> {
3846            encoder.debug_check_bounds::<MouseDescriptor>(offset);
3847            // Delegate to tuple encoding.
3848            fidl::encoding::Encode::<MouseDescriptor, D>::encode(
3849                (
3850                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_x),
3851                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_y),
3852                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3853                        &self.vscroll,
3854                    ),
3855                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3856                        &self.hscroll,
3857                    ),
3858                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
3859                ),
3860                encoder,
3861                offset,
3862                _depth,
3863            )
3864        }
3865    }
3866    unsafe impl<
3867        D: fidl::encoding::ResourceDialect,
3868        T0: fidl::encoding::Encode<Axis, D>,
3869        T1: fidl::encoding::Encode<Axis, D>,
3870        T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3871        T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3872        T4: fidl::encoding::Encode<u32, D>,
3873    > fidl::encoding::Encode<MouseDescriptor, D> for (T0, T1, T2, T3, T4)
3874    {
3875        #[inline]
3876        unsafe fn encode(
3877            self,
3878            encoder: &mut fidl::encoding::Encoder<'_, D>,
3879            offset: usize,
3880            depth: fidl::encoding::Depth,
3881        ) -> fidl::Result<()> {
3882            encoder.debug_check_bounds::<MouseDescriptor>(offset);
3883            // Zero out padding regions. There's no need to apply masks
3884            // because the unmasked parts will be overwritten by fields.
3885            unsafe {
3886                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
3887                (ptr as *mut u64).write_unaligned(0);
3888            }
3889            // Write the fields.
3890            self.0.encode(encoder, offset + 0, depth)?;
3891            self.1.encode(encoder, offset + 16, depth)?;
3892            self.2.encode(encoder, offset + 32, depth)?;
3893            self.3.encode(encoder, offset + 40, depth)?;
3894            self.4.encode(encoder, offset + 48, depth)?;
3895            Ok(())
3896        }
3897    }
3898
3899    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
3900        #[inline(always)]
3901        fn new_empty() -> Self {
3902            Self {
3903                rel_x: fidl::new_empty!(Axis, D),
3904                rel_y: fidl::new_empty!(Axis, D),
3905                vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3906                hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3907                buttons: fidl::new_empty!(u32, D),
3908            }
3909        }
3910
3911        #[inline]
3912        unsafe fn decode(
3913            &mut self,
3914            decoder: &mut fidl::encoding::Decoder<'_, D>,
3915            offset: usize,
3916            _depth: fidl::encoding::Depth,
3917        ) -> fidl::Result<()> {
3918            decoder.debug_check_bounds::<Self>(offset);
3919            // Verify that padding bytes are zero.
3920            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
3921            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3922            let mask = 0xffffffff00000000u64;
3923            let maskedval = padval & mask;
3924            if maskedval != 0 {
3925                return Err(fidl::Error::NonZeroPadding {
3926                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
3927                });
3928            }
3929            fidl::decode!(Axis, D, &mut self.rel_x, decoder, offset + 0, _depth)?;
3930            fidl::decode!(Axis, D, &mut self.rel_y, decoder, offset + 16, _depth)?;
3931            fidl::decode!(
3932                fidl::encoding::Boxed<Axis>,
3933                D,
3934                &mut self.vscroll,
3935                decoder,
3936                offset + 32,
3937                _depth
3938            )?;
3939            fidl::decode!(
3940                fidl::encoding::Boxed<Axis>,
3941                D,
3942                &mut self.hscroll,
3943                decoder,
3944                offset + 40,
3945                _depth
3946            )?;
3947            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 48, _depth)?;
3948            Ok(())
3949        }
3950    }
3951
3952    impl fidl::encoding::ValueTypeMarker for MouseReport {
3953        type Borrowed<'a> = &'a Self;
3954        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3955            value
3956        }
3957    }
3958
3959    unsafe impl fidl::encoding::TypeMarker for MouseReport {
3960        type Owned = Self;
3961
3962        #[inline(always)]
3963        fn inline_align(_context: fidl::encoding::Context) -> usize {
3964            4
3965        }
3966
3967        #[inline(always)]
3968        fn inline_size(_context: fidl::encoding::Context) -> usize {
3969            20
3970        }
3971        #[inline(always)]
3972        fn encode_is_copy() -> bool {
3973            true
3974        }
3975
3976        #[inline(always)]
3977        fn decode_is_copy() -> bool {
3978            true
3979        }
3980    }
3981
3982    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseReport, D>
3983        for &MouseReport
3984    {
3985        #[inline]
3986        unsafe fn encode(
3987            self,
3988            encoder: &mut fidl::encoding::Encoder<'_, D>,
3989            offset: usize,
3990            _depth: fidl::encoding::Depth,
3991        ) -> fidl::Result<()> {
3992            encoder.debug_check_bounds::<MouseReport>(offset);
3993            unsafe {
3994                // Copy the object into the buffer.
3995                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3996                (buf_ptr as *mut MouseReport).write_unaligned((self as *const MouseReport).read());
3997                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3998                // done second because the memcpy will write garbage to these bytes.
3999            }
4000            Ok(())
4001        }
4002    }
4003    unsafe impl<
4004        D: fidl::encoding::ResourceDialect,
4005        T0: fidl::encoding::Encode<i32, D>,
4006        T1: fidl::encoding::Encode<i32, D>,
4007        T2: fidl::encoding::Encode<i32, D>,
4008        T3: fidl::encoding::Encode<i32, D>,
4009        T4: fidl::encoding::Encode<u32, D>,
4010    > fidl::encoding::Encode<MouseReport, D> for (T0, T1, T2, T3, T4)
4011    {
4012        #[inline]
4013        unsafe fn encode(
4014            self,
4015            encoder: &mut fidl::encoding::Encoder<'_, D>,
4016            offset: usize,
4017            depth: fidl::encoding::Depth,
4018        ) -> fidl::Result<()> {
4019            encoder.debug_check_bounds::<MouseReport>(offset);
4020            // Zero out padding regions. There's no need to apply masks
4021            // because the unmasked parts will be overwritten by fields.
4022            // Write the fields.
4023            self.0.encode(encoder, offset + 0, depth)?;
4024            self.1.encode(encoder, offset + 4, depth)?;
4025            self.2.encode(encoder, offset + 8, depth)?;
4026            self.3.encode(encoder, offset + 12, depth)?;
4027            self.4.encode(encoder, offset + 16, depth)?;
4028            Ok(())
4029        }
4030    }
4031
4032    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseReport {
4033        #[inline(always)]
4034        fn new_empty() -> Self {
4035            Self {
4036                rel_x: fidl::new_empty!(i32, D),
4037                rel_y: fidl::new_empty!(i32, D),
4038                rel_hscroll: fidl::new_empty!(i32, D),
4039                rel_vscroll: fidl::new_empty!(i32, D),
4040                pressed_buttons: fidl::new_empty!(u32, D),
4041            }
4042        }
4043
4044        #[inline]
4045        unsafe fn decode(
4046            &mut self,
4047            decoder: &mut fidl::encoding::Decoder<'_, D>,
4048            offset: usize,
4049            _depth: fidl::encoding::Depth,
4050        ) -> fidl::Result<()> {
4051            decoder.debug_check_bounds::<Self>(offset);
4052            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4053            // Verify that padding bytes are zero.
4054            // Copy from the buffer into the object.
4055            unsafe {
4056                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
4057            }
4058            Ok(())
4059        }
4060    }
4061
4062    impl fidl::encoding::ValueTypeMarker for PointerEvent {
4063        type Borrowed<'a> = &'a Self;
4064        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4065            value
4066        }
4067    }
4068
4069    unsafe impl fidl::encoding::TypeMarker for PointerEvent {
4070        type Owned = Self;
4071
4072        #[inline(always)]
4073        fn inline_align(_context: fidl::encoding::Context) -> usize {
4074            8
4075        }
4076
4077        #[inline(always)]
4078        fn inline_size(_context: fidl::encoding::Context) -> usize {
4079            48
4080        }
4081    }
4082
4083    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PointerEvent, D>
4084        for &PointerEvent
4085    {
4086        #[inline]
4087        unsafe fn encode(
4088            self,
4089            encoder: &mut fidl::encoding::Encoder<'_, D>,
4090            offset: usize,
4091            _depth: fidl::encoding::Depth,
4092        ) -> fidl::Result<()> {
4093            encoder.debug_check_bounds::<PointerEvent>(offset);
4094            // Delegate to tuple encoding.
4095            fidl::encoding::Encode::<PointerEvent, D>::encode(
4096                (
4097                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
4098                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
4099                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_id),
4100                    <PointerEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4101                    <PointerEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
4102                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4103                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4104                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_major),
4105                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_minor),
4106                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4107                ),
4108                encoder,
4109                offset,
4110                _depth,
4111            )
4112        }
4113    }
4114    unsafe impl<
4115        D: fidl::encoding::ResourceDialect,
4116        T0: fidl::encoding::Encode<u64, D>,
4117        T1: fidl::encoding::Encode<u32, D>,
4118        T2: fidl::encoding::Encode<u32, D>,
4119        T3: fidl::encoding::Encode<PointerEventType, D>,
4120        T4: fidl::encoding::Encode<PointerEventPhase, D>,
4121        T5: fidl::encoding::Encode<f32, D>,
4122        T6: fidl::encoding::Encode<f32, D>,
4123        T7: fidl::encoding::Encode<f32, D>,
4124        T8: fidl::encoding::Encode<f32, D>,
4125        T9: fidl::encoding::Encode<u32, D>,
4126    > fidl::encoding::Encode<PointerEvent, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
4127    {
4128        #[inline]
4129        unsafe fn encode(
4130            self,
4131            encoder: &mut fidl::encoding::Encoder<'_, D>,
4132            offset: usize,
4133            depth: fidl::encoding::Depth,
4134        ) -> fidl::Result<()> {
4135            encoder.debug_check_bounds::<PointerEvent>(offset);
4136            // Zero out padding regions. There's no need to apply masks
4137            // because the unmasked parts will be overwritten by fields.
4138            unsafe {
4139                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4140                (ptr as *mut u64).write_unaligned(0);
4141            }
4142            // Write the fields.
4143            self.0.encode(encoder, offset + 0, depth)?;
4144            self.1.encode(encoder, offset + 8, depth)?;
4145            self.2.encode(encoder, offset + 12, depth)?;
4146            self.3.encode(encoder, offset + 16, depth)?;
4147            self.4.encode(encoder, offset + 20, depth)?;
4148            self.5.encode(encoder, offset + 24, depth)?;
4149            self.6.encode(encoder, offset + 28, depth)?;
4150            self.7.encode(encoder, offset + 32, depth)?;
4151            self.8.encode(encoder, offset + 36, depth)?;
4152            self.9.encode(encoder, offset + 40, depth)?;
4153            Ok(())
4154        }
4155    }
4156
4157    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEvent {
4158        #[inline(always)]
4159        fn new_empty() -> Self {
4160            Self {
4161                event_time: fidl::new_empty!(u64, D),
4162                device_id: fidl::new_empty!(u32, D),
4163                pointer_id: fidl::new_empty!(u32, D),
4164                type_: fidl::new_empty!(PointerEventType, D),
4165                phase: fidl::new_empty!(PointerEventPhase, D),
4166                x: fidl::new_empty!(f32, D),
4167                y: fidl::new_empty!(f32, D),
4168                radius_major: fidl::new_empty!(f32, D),
4169                radius_minor: fidl::new_empty!(f32, D),
4170                buttons: fidl::new_empty!(u32, D),
4171            }
4172        }
4173
4174        #[inline]
4175        unsafe fn decode(
4176            &mut self,
4177            decoder: &mut fidl::encoding::Decoder<'_, D>,
4178            offset: usize,
4179            _depth: fidl::encoding::Depth,
4180        ) -> fidl::Result<()> {
4181            decoder.debug_check_bounds::<Self>(offset);
4182            // Verify that padding bytes are zero.
4183            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4184            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4185            let mask = 0xffffffff00000000u64;
4186            let maskedval = padval & mask;
4187            if maskedval != 0 {
4188                return Err(fidl::Error::NonZeroPadding {
4189                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4190                });
4191            }
4192            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
4193            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
4194            fidl::decode!(u32, D, &mut self.pointer_id, decoder, offset + 12, _depth)?;
4195            fidl::decode!(PointerEventType, D, &mut self.type_, decoder, offset + 16, _depth)?;
4196            fidl::decode!(PointerEventPhase, D, &mut self.phase, decoder, offset + 20, _depth)?;
4197            fidl::decode!(f32, D, &mut self.x, decoder, offset + 24, _depth)?;
4198            fidl::decode!(f32, D, &mut self.y, decoder, offset + 28, _depth)?;
4199            fidl::decode!(f32, D, &mut self.radius_major, decoder, offset + 32, _depth)?;
4200            fidl::decode!(f32, D, &mut self.radius_minor, decoder, offset + 36, _depth)?;
4201            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 40, _depth)?;
4202            Ok(())
4203        }
4204    }
4205
4206    impl fidl::encoding::ValueTypeMarker for Range {
4207        type Borrowed<'a> = &'a Self;
4208        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4209            value
4210        }
4211    }
4212
4213    unsafe impl fidl::encoding::TypeMarker for Range {
4214        type Owned = Self;
4215
4216        #[inline(always)]
4217        fn inline_align(_context: fidl::encoding::Context) -> usize {
4218            4
4219        }
4220
4221        #[inline(always)]
4222        fn inline_size(_context: fidl::encoding::Context) -> usize {
4223            8
4224        }
4225        #[inline(always)]
4226        fn encode_is_copy() -> bool {
4227            true
4228        }
4229
4230        #[inline(always)]
4231        fn decode_is_copy() -> bool {
4232            true
4233        }
4234    }
4235
4236    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
4237        #[inline]
4238        unsafe fn encode(
4239            self,
4240            encoder: &mut fidl::encoding::Encoder<'_, D>,
4241            offset: usize,
4242            _depth: fidl::encoding::Depth,
4243        ) -> fidl::Result<()> {
4244            encoder.debug_check_bounds::<Range>(offset);
4245            unsafe {
4246                // Copy the object into the buffer.
4247                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4248                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
4249                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4250                // done second because the memcpy will write garbage to these bytes.
4251            }
4252            Ok(())
4253        }
4254    }
4255    unsafe impl<
4256        D: fidl::encoding::ResourceDialect,
4257        T0: fidl::encoding::Encode<i32, D>,
4258        T1: fidl::encoding::Encode<i32, D>,
4259    > fidl::encoding::Encode<Range, D> for (T0, T1)
4260    {
4261        #[inline]
4262        unsafe fn encode(
4263            self,
4264            encoder: &mut fidl::encoding::Encoder<'_, D>,
4265            offset: usize,
4266            depth: fidl::encoding::Depth,
4267        ) -> fidl::Result<()> {
4268            encoder.debug_check_bounds::<Range>(offset);
4269            // Zero out padding regions. There's no need to apply masks
4270            // because the unmasked parts will be overwritten by fields.
4271            // Write the fields.
4272            self.0.encode(encoder, offset + 0, depth)?;
4273            self.1.encode(encoder, offset + 4, depth)?;
4274            Ok(())
4275        }
4276    }
4277
4278    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
4279        #[inline(always)]
4280        fn new_empty() -> Self {
4281            Self { min: fidl::new_empty!(i32, D), max: fidl::new_empty!(i32, D) }
4282        }
4283
4284        #[inline]
4285        unsafe fn decode(
4286            &mut self,
4287            decoder: &mut fidl::encoding::Decoder<'_, D>,
4288            offset: usize,
4289            _depth: fidl::encoding::Depth,
4290        ) -> fidl::Result<()> {
4291            decoder.debug_check_bounds::<Self>(offset);
4292            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4293            // Verify that padding bytes are zero.
4294            // Copy from the buffer into the object.
4295            unsafe {
4296                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4297            }
4298            Ok(())
4299        }
4300    }
4301
4302    impl fidl::encoding::ValueTypeMarker for RangeF {
4303        type Borrowed<'a> = &'a Self;
4304        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4305            value
4306        }
4307    }
4308
4309    unsafe impl fidl::encoding::TypeMarker for RangeF {
4310        type Owned = Self;
4311
4312        #[inline(always)]
4313        fn inline_align(_context: fidl::encoding::Context) -> usize {
4314            4
4315        }
4316
4317        #[inline(always)]
4318        fn inline_size(_context: fidl::encoding::Context) -> usize {
4319            8
4320        }
4321    }
4322
4323    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RangeF, D> for &RangeF {
4324        #[inline]
4325        unsafe fn encode(
4326            self,
4327            encoder: &mut fidl::encoding::Encoder<'_, D>,
4328            offset: usize,
4329            _depth: fidl::encoding::Depth,
4330        ) -> fidl::Result<()> {
4331            encoder.debug_check_bounds::<RangeF>(offset);
4332            // Delegate to tuple encoding.
4333            fidl::encoding::Encode::<RangeF, D>::encode(
4334                (
4335                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
4336                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
4337                ),
4338                encoder,
4339                offset,
4340                _depth,
4341            )
4342        }
4343    }
4344    unsafe impl<
4345        D: fidl::encoding::ResourceDialect,
4346        T0: fidl::encoding::Encode<f32, D>,
4347        T1: fidl::encoding::Encode<f32, D>,
4348    > fidl::encoding::Encode<RangeF, D> for (T0, T1)
4349    {
4350        #[inline]
4351        unsafe fn encode(
4352            self,
4353            encoder: &mut fidl::encoding::Encoder<'_, D>,
4354            offset: usize,
4355            depth: fidl::encoding::Depth,
4356        ) -> fidl::Result<()> {
4357            encoder.debug_check_bounds::<RangeF>(offset);
4358            // Zero out padding regions. There's no need to apply masks
4359            // because the unmasked parts will be overwritten by fields.
4360            // Write the fields.
4361            self.0.encode(encoder, offset + 0, depth)?;
4362            self.1.encode(encoder, offset + 4, depth)?;
4363            Ok(())
4364        }
4365    }
4366
4367    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RangeF {
4368        #[inline(always)]
4369        fn new_empty() -> Self {
4370            Self { min: fidl::new_empty!(f32, D), max: fidl::new_empty!(f32, D) }
4371        }
4372
4373        #[inline]
4374        unsafe fn decode(
4375            &mut self,
4376            decoder: &mut fidl::encoding::Decoder<'_, D>,
4377            offset: usize,
4378            _depth: fidl::encoding::Depth,
4379        ) -> fidl::Result<()> {
4380            decoder.debug_check_bounds::<Self>(offset);
4381            // Verify that padding bytes are zero.
4382            fidl::decode!(f32, D, &mut self.min, decoder, offset + 0, _depth)?;
4383            fidl::decode!(f32, D, &mut self.max, decoder, offset + 4, _depth)?;
4384            Ok(())
4385        }
4386    }
4387
4388    impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
4389        type Borrowed<'a> = &'a Self;
4390        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4391            value
4392        }
4393    }
4394
4395    unsafe impl fidl::encoding::TypeMarker for SendKeyboardInputCmd {
4396        type Owned = Self;
4397
4398        #[inline(always)]
4399        fn inline_align(_context: fidl::encoding::Context) -> usize {
4400            8
4401        }
4402
4403        #[inline(always)]
4404        fn inline_size(_context: fidl::encoding::Context) -> usize {
4405            40
4406        }
4407    }
4408
4409    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendKeyboardInputCmd, D>
4410        for &SendKeyboardInputCmd
4411    {
4412        #[inline]
4413        unsafe fn encode(
4414            self,
4415            encoder: &mut fidl::encoding::Encoder<'_, D>,
4416            offset: usize,
4417            _depth: fidl::encoding::Depth,
4418        ) -> fidl::Result<()> {
4419            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4420            // Delegate to tuple encoding.
4421            fidl::encoding::Encode::<SendKeyboardInputCmd, D>::encode(
4422                (
4423                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4424                    <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
4425                        &self.keyboard_event,
4426                    ),
4427                ),
4428                encoder,
4429                offset,
4430                _depth,
4431            )
4432        }
4433    }
4434    unsafe impl<
4435        D: fidl::encoding::ResourceDialect,
4436        T0: fidl::encoding::Encode<u32, D>,
4437        T1: fidl::encoding::Encode<KeyboardEvent, D>,
4438    > fidl::encoding::Encode<SendKeyboardInputCmd, D> for (T0, T1)
4439    {
4440        #[inline]
4441        unsafe fn encode(
4442            self,
4443            encoder: &mut fidl::encoding::Encoder<'_, D>,
4444            offset: usize,
4445            depth: fidl::encoding::Depth,
4446        ) -> fidl::Result<()> {
4447            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4448            // Zero out padding regions. There's no need to apply masks
4449            // because the unmasked parts will be overwritten by fields.
4450            unsafe {
4451                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4452                (ptr as *mut u64).write_unaligned(0);
4453            }
4454            // Write the fields.
4455            self.0.encode(encoder, offset + 0, depth)?;
4456            self.1.encode(encoder, offset + 8, depth)?;
4457            Ok(())
4458        }
4459    }
4460
4461    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendKeyboardInputCmd {
4462        #[inline(always)]
4463        fn new_empty() -> Self {
4464            Self {
4465                compositor_id: fidl::new_empty!(u32, D),
4466                keyboard_event: fidl::new_empty!(KeyboardEvent, D),
4467            }
4468        }
4469
4470        #[inline]
4471        unsafe fn decode(
4472            &mut self,
4473            decoder: &mut fidl::encoding::Decoder<'_, D>,
4474            offset: usize,
4475            _depth: fidl::encoding::Depth,
4476        ) -> fidl::Result<()> {
4477            decoder.debug_check_bounds::<Self>(offset);
4478            // Verify that padding bytes are zero.
4479            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4480            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4481            let mask = 0xffffffff00000000u64;
4482            let maskedval = padval & mask;
4483            if maskedval != 0 {
4484                return Err(fidl::Error::NonZeroPadding {
4485                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4486                });
4487            }
4488            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4489            fidl::decode!(KeyboardEvent, D, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
4490            Ok(())
4491        }
4492    }
4493
4494    impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
4495        type Borrowed<'a> = &'a Self;
4496        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4497            value
4498        }
4499    }
4500
4501    unsafe impl fidl::encoding::TypeMarker for SendPointerInputCmd {
4502        type Owned = Self;
4503
4504        #[inline(always)]
4505        fn inline_align(_context: fidl::encoding::Context) -> usize {
4506            8
4507        }
4508
4509        #[inline(always)]
4510        fn inline_size(_context: fidl::encoding::Context) -> usize {
4511            56
4512        }
4513    }
4514
4515    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendPointerInputCmd, D>
4516        for &SendPointerInputCmd
4517    {
4518        #[inline]
4519        unsafe fn encode(
4520            self,
4521            encoder: &mut fidl::encoding::Encoder<'_, D>,
4522            offset: usize,
4523            _depth: fidl::encoding::Depth,
4524        ) -> fidl::Result<()> {
4525            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4526            // Delegate to tuple encoding.
4527            fidl::encoding::Encode::<SendPointerInputCmd, D>::encode(
4528                (
4529                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4530                    <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
4531                ),
4532                encoder,
4533                offset,
4534                _depth,
4535            )
4536        }
4537    }
4538    unsafe impl<
4539        D: fidl::encoding::ResourceDialect,
4540        T0: fidl::encoding::Encode<u32, D>,
4541        T1: fidl::encoding::Encode<PointerEvent, D>,
4542    > fidl::encoding::Encode<SendPointerInputCmd, D> for (T0, T1)
4543    {
4544        #[inline]
4545        unsafe fn encode(
4546            self,
4547            encoder: &mut fidl::encoding::Encoder<'_, D>,
4548            offset: usize,
4549            depth: fidl::encoding::Depth,
4550        ) -> fidl::Result<()> {
4551            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4552            // Zero out padding regions. There's no need to apply masks
4553            // because the unmasked parts will be overwritten by fields.
4554            unsafe {
4555                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4556                (ptr as *mut u64).write_unaligned(0);
4557            }
4558            // Write the fields.
4559            self.0.encode(encoder, offset + 0, depth)?;
4560            self.1.encode(encoder, offset + 8, depth)?;
4561            Ok(())
4562        }
4563    }
4564
4565    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendPointerInputCmd {
4566        #[inline(always)]
4567        fn new_empty() -> Self {
4568            Self {
4569                compositor_id: fidl::new_empty!(u32, D),
4570                pointer_event: fidl::new_empty!(PointerEvent, D),
4571            }
4572        }
4573
4574        #[inline]
4575        unsafe fn decode(
4576            &mut self,
4577            decoder: &mut fidl::encoding::Decoder<'_, D>,
4578            offset: usize,
4579            _depth: fidl::encoding::Depth,
4580        ) -> fidl::Result<()> {
4581            decoder.debug_check_bounds::<Self>(offset);
4582            // Verify that padding bytes are zero.
4583            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4584            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4585            let mask = 0xffffffff00000000u64;
4586            let maskedval = padval & mask;
4587            if maskedval != 0 {
4588                return Err(fidl::Error::NonZeroPadding {
4589                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4590                });
4591            }
4592            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4593            fidl::decode!(PointerEvent, D, &mut self.pointer_event, decoder, offset + 8, _depth)?;
4594            Ok(())
4595        }
4596    }
4597
4598    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
4599        type Borrowed<'a> = &'a Self;
4600        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4601            value
4602        }
4603    }
4604
4605    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
4606        type Owned = Self;
4607
4608        #[inline(always)]
4609        fn inline_align(_context: fidl::encoding::Context) -> usize {
4610            4
4611        }
4612
4613        #[inline(always)]
4614        fn inline_size(_context: fidl::encoding::Context) -> usize {
4615            28
4616        }
4617    }
4618
4619    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
4620        for &SensorDescriptor
4621    {
4622        #[inline]
4623        unsafe fn encode(
4624            self,
4625            encoder: &mut fidl::encoding::Encoder<'_, D>,
4626            offset: usize,
4627            _depth: fidl::encoding::Depth,
4628        ) -> fidl::Result<()> {
4629            encoder.debug_check_bounds::<SensorDescriptor>(offset);
4630            // Delegate to tuple encoding.
4631            fidl::encoding::Encode::<SensorDescriptor, D>::encode(
4632                (
4633                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4634                    <SensorLocation as fidl::encoding::ValueTypeMarker>::borrow(&self.loc),
4635                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_sampling_freq),
4636                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_sampling_freq),
4637                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fifo_max_event_count),
4638                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_min),
4639                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_max),
4640                ),
4641                encoder,
4642                offset,
4643                _depth,
4644            )
4645        }
4646    }
4647    unsafe impl<
4648        D: fidl::encoding::ResourceDialect,
4649        T0: fidl::encoding::Encode<SensorType, D>,
4650        T1: fidl::encoding::Encode<SensorLocation, D>,
4651        T2: fidl::encoding::Encode<u32, D>,
4652        T3: fidl::encoding::Encode<u32, D>,
4653        T4: fidl::encoding::Encode<u32, D>,
4654        T5: fidl::encoding::Encode<i32, D>,
4655        T6: fidl::encoding::Encode<i32, D>,
4656    > fidl::encoding::Encode<SensorDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
4657    {
4658        #[inline]
4659        unsafe fn encode(
4660            self,
4661            encoder: &mut fidl::encoding::Encoder<'_, D>,
4662            offset: usize,
4663            depth: fidl::encoding::Depth,
4664        ) -> fidl::Result<()> {
4665            encoder.debug_check_bounds::<SensorDescriptor>(offset);
4666            // Zero out padding regions. There's no need to apply masks
4667            // because the unmasked parts will be overwritten by fields.
4668            // Write the fields.
4669            self.0.encode(encoder, offset + 0, depth)?;
4670            self.1.encode(encoder, offset + 4, depth)?;
4671            self.2.encode(encoder, offset + 8, depth)?;
4672            self.3.encode(encoder, offset + 12, depth)?;
4673            self.4.encode(encoder, offset + 16, depth)?;
4674            self.5.encode(encoder, offset + 20, depth)?;
4675            self.6.encode(encoder, offset + 24, depth)?;
4676            Ok(())
4677        }
4678    }
4679
4680    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
4681        #[inline(always)]
4682        fn new_empty() -> Self {
4683            Self {
4684                type_: fidl::new_empty!(SensorType, D),
4685                loc: fidl::new_empty!(SensorLocation, D),
4686                min_sampling_freq: fidl::new_empty!(u32, D),
4687                max_sampling_freq: fidl::new_empty!(u32, D),
4688                fifo_max_event_count: fidl::new_empty!(u32, D),
4689                phys_min: fidl::new_empty!(i32, D),
4690                phys_max: fidl::new_empty!(i32, D),
4691            }
4692        }
4693
4694        #[inline]
4695        unsafe fn decode(
4696            &mut self,
4697            decoder: &mut fidl::encoding::Decoder<'_, D>,
4698            offset: usize,
4699            _depth: fidl::encoding::Depth,
4700        ) -> fidl::Result<()> {
4701            decoder.debug_check_bounds::<Self>(offset);
4702            // Verify that padding bytes are zero.
4703            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 0, _depth)?;
4704            fidl::decode!(SensorLocation, D, &mut self.loc, decoder, offset + 4, _depth)?;
4705            fidl::decode!(u32, D, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
4706            fidl::decode!(u32, D, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
4707            fidl::decode!(u32, D, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
4708            fidl::decode!(i32, D, &mut self.phys_min, decoder, offset + 20, _depth)?;
4709            fidl::decode!(i32, D, &mut self.phys_max, decoder, offset + 24, _depth)?;
4710            Ok(())
4711        }
4712    }
4713
4714    impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
4715        type Borrowed<'a> = &'a Self;
4716        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4717            value
4718        }
4719    }
4720
4721    unsafe impl fidl::encoding::TypeMarker for SetHardKeyboardDeliveryCmd {
4722        type Owned = Self;
4723
4724        #[inline(always)]
4725        fn inline_align(_context: fidl::encoding::Context) -> usize {
4726            1
4727        }
4728
4729        #[inline(always)]
4730        fn inline_size(_context: fidl::encoding::Context) -> usize {
4731            1
4732        }
4733    }
4734
4735    unsafe impl<D: fidl::encoding::ResourceDialect>
4736        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for &SetHardKeyboardDeliveryCmd
4737    {
4738        #[inline]
4739        unsafe fn encode(
4740            self,
4741            encoder: &mut fidl::encoding::Encoder<'_, D>,
4742            offset: usize,
4743            _depth: fidl::encoding::Depth,
4744        ) -> fidl::Result<()> {
4745            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4746            // Delegate to tuple encoding.
4747            fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd, D>::encode(
4748                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
4749                encoder,
4750                offset,
4751                _depth,
4752            )
4753        }
4754    }
4755    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4756        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for (T0,)
4757    {
4758        #[inline]
4759        unsafe fn encode(
4760            self,
4761            encoder: &mut fidl::encoding::Encoder<'_, D>,
4762            offset: usize,
4763            depth: fidl::encoding::Depth,
4764        ) -> fidl::Result<()> {
4765            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4766            // Zero out padding regions. There's no need to apply masks
4767            // because the unmasked parts will be overwritten by fields.
4768            // Write the fields.
4769            self.0.encode(encoder, offset + 0, depth)?;
4770            Ok(())
4771        }
4772    }
4773
4774    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4775        for SetHardKeyboardDeliveryCmd
4776    {
4777        #[inline(always)]
4778        fn new_empty() -> Self {
4779            Self { delivery_request: fidl::new_empty!(bool, D) }
4780        }
4781
4782        #[inline]
4783        unsafe fn decode(
4784            &mut self,
4785            decoder: &mut fidl::encoding::Decoder<'_, D>,
4786            offset: usize,
4787            _depth: fidl::encoding::Depth,
4788        ) -> fidl::Result<()> {
4789            decoder.debug_check_bounds::<Self>(offset);
4790            // Verify that padding bytes are zero.
4791            fidl::decode!(bool, D, &mut self.delivery_request, decoder, offset + 0, _depth)?;
4792            Ok(())
4793        }
4794    }
4795
4796    impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
4797        type Borrowed<'a> = &'a Self;
4798        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4799            value
4800        }
4801    }
4802
4803    unsafe impl fidl::encoding::TypeMarker for SetParallelDispatchCmd {
4804        type Owned = Self;
4805
4806        #[inline(always)]
4807        fn inline_align(_context: fidl::encoding::Context) -> usize {
4808            1
4809        }
4810
4811        #[inline(always)]
4812        fn inline_size(_context: fidl::encoding::Context) -> usize {
4813            1
4814        }
4815    }
4816
4817    unsafe impl<D: fidl::encoding::ResourceDialect>
4818        fidl::encoding::Encode<SetParallelDispatchCmd, D> for &SetParallelDispatchCmd
4819    {
4820        #[inline]
4821        unsafe fn encode(
4822            self,
4823            encoder: &mut fidl::encoding::Encoder<'_, D>,
4824            offset: usize,
4825            _depth: fidl::encoding::Depth,
4826        ) -> fidl::Result<()> {
4827            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4828            // Delegate to tuple encoding.
4829            fidl::encoding::Encode::<SetParallelDispatchCmd, D>::encode(
4830                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
4831                encoder,
4832                offset,
4833                _depth,
4834            )
4835        }
4836    }
4837    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4838        fidl::encoding::Encode<SetParallelDispatchCmd, D> for (T0,)
4839    {
4840        #[inline]
4841        unsafe fn encode(
4842            self,
4843            encoder: &mut fidl::encoding::Encoder<'_, D>,
4844            offset: usize,
4845            depth: fidl::encoding::Depth,
4846        ) -> fidl::Result<()> {
4847            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4848            // Zero out padding regions. There's no need to apply masks
4849            // because the unmasked parts will be overwritten by fields.
4850            // Write the fields.
4851            self.0.encode(encoder, offset + 0, depth)?;
4852            Ok(())
4853        }
4854    }
4855
4856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4857        for SetParallelDispatchCmd
4858    {
4859        #[inline(always)]
4860        fn new_empty() -> Self {
4861            Self { parallel_dispatch: fidl::new_empty!(bool, D) }
4862        }
4863
4864        #[inline]
4865        unsafe fn decode(
4866            &mut self,
4867            decoder: &mut fidl::encoding::Decoder<'_, D>,
4868            offset: usize,
4869            _depth: fidl::encoding::Depth,
4870        ) -> fidl::Result<()> {
4871            decoder.debug_check_bounds::<Self>(offset);
4872            // Verify that padding bytes are zero.
4873            fidl::decode!(bool, D, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
4874            Ok(())
4875        }
4876    }
4877
4878    impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
4879        type Borrowed<'a> = &'a Self;
4880        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4881            value
4882        }
4883    }
4884
4885    unsafe impl fidl::encoding::TypeMarker for StylusDescriptor {
4886        type Owned = Self;
4887
4888        #[inline(always)]
4889        fn inline_align(_context: fidl::encoding::Context) -> usize {
4890            8
4891        }
4892
4893        #[inline(always)]
4894        fn inline_size(_context: fidl::encoding::Context) -> usize {
4895            48
4896        }
4897    }
4898
4899    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusDescriptor, D>
4900        for &StylusDescriptor
4901    {
4902        #[inline]
4903        unsafe fn encode(
4904            self,
4905            encoder: &mut fidl::encoding::Encoder<'_, D>,
4906            offset: usize,
4907            _depth: fidl::encoding::Depth,
4908        ) -> fidl::Result<()> {
4909            encoder.debug_check_bounds::<StylusDescriptor>(offset);
4910            // Delegate to tuple encoding.
4911            fidl::encoding::Encode::<StylusDescriptor, D>::encode(
4912                (
4913                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4914                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4915                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
4916                        &self.pressure,
4917                    ),
4918                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_invertible),
4919                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4920                ),
4921                encoder,
4922                offset,
4923                _depth,
4924            )
4925        }
4926    }
4927    unsafe impl<
4928        D: fidl::encoding::ResourceDialect,
4929        T0: fidl::encoding::Encode<Axis, D>,
4930        T1: fidl::encoding::Encode<Axis, D>,
4931        T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
4932        T3: fidl::encoding::Encode<bool, D>,
4933        T4: fidl::encoding::Encode<u32, D>,
4934    > fidl::encoding::Encode<StylusDescriptor, D> for (T0, T1, T2, T3, T4)
4935    {
4936        #[inline]
4937        unsafe fn encode(
4938            self,
4939            encoder: &mut fidl::encoding::Encoder<'_, D>,
4940            offset: usize,
4941            depth: fidl::encoding::Depth,
4942        ) -> fidl::Result<()> {
4943            encoder.debug_check_bounds::<StylusDescriptor>(offset);
4944            // Zero out padding regions. There's no need to apply masks
4945            // because the unmasked parts will be overwritten by fields.
4946            unsafe {
4947                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4948                (ptr as *mut u64).write_unaligned(0);
4949            }
4950            // Write the fields.
4951            self.0.encode(encoder, offset + 0, depth)?;
4952            self.1.encode(encoder, offset + 16, depth)?;
4953            self.2.encode(encoder, offset + 32, depth)?;
4954            self.3.encode(encoder, offset + 40, depth)?;
4955            self.4.encode(encoder, offset + 44, depth)?;
4956            Ok(())
4957        }
4958    }
4959
4960    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusDescriptor {
4961        #[inline(always)]
4962        fn new_empty() -> Self {
4963            Self {
4964                x: fidl::new_empty!(Axis, D),
4965                y: fidl::new_empty!(Axis, D),
4966                pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
4967                is_invertible: fidl::new_empty!(bool, D),
4968                buttons: fidl::new_empty!(u32, D),
4969            }
4970        }
4971
4972        #[inline]
4973        unsafe fn decode(
4974            &mut self,
4975            decoder: &mut fidl::encoding::Decoder<'_, D>,
4976            offset: usize,
4977            _depth: fidl::encoding::Depth,
4978        ) -> fidl::Result<()> {
4979            decoder.debug_check_bounds::<Self>(offset);
4980            // Verify that padding bytes are zero.
4981            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4982            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4983            let mask = 0xffffff00u64;
4984            let maskedval = padval & mask;
4985            if maskedval != 0 {
4986                return Err(fidl::Error::NonZeroPadding {
4987                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4988                });
4989            }
4990            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
4991            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
4992            fidl::decode!(
4993                fidl::encoding::Boxed<Axis>,
4994                D,
4995                &mut self.pressure,
4996                decoder,
4997                offset + 32,
4998                _depth
4999            )?;
5000            fidl::decode!(bool, D, &mut self.is_invertible, decoder, offset + 40, _depth)?;
5001            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 44, _depth)?;
5002            Ok(())
5003        }
5004    }
5005
5006    impl fidl::encoding::ValueTypeMarker for StylusReport {
5007        type Borrowed<'a> = &'a Self;
5008        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5009            value
5010        }
5011    }
5012
5013    unsafe impl fidl::encoding::TypeMarker for StylusReport {
5014        type Owned = Self;
5015
5016        #[inline(always)]
5017        fn inline_align(_context: fidl::encoding::Context) -> usize {
5018            4
5019        }
5020
5021        #[inline(always)]
5022        fn inline_size(_context: fidl::encoding::Context) -> usize {
5023            20
5024        }
5025    }
5026
5027    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusReport, D>
5028        for &StylusReport
5029    {
5030        #[inline]
5031        unsafe fn encode(
5032            self,
5033            encoder: &mut fidl::encoding::Encoder<'_, D>,
5034            offset: usize,
5035            _depth: fidl::encoding::Depth,
5036        ) -> fidl::Result<()> {
5037            encoder.debug_check_bounds::<StylusReport>(offset);
5038            // Delegate to tuple encoding.
5039            fidl::encoding::Encode::<StylusReport, D>::encode(
5040                (
5041                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5042                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5043                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressure),
5044                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_in_contact),
5045                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_range),
5046                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_inverted),
5047                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_buttons),
5048                ),
5049                encoder,
5050                offset,
5051                _depth,
5052            )
5053        }
5054    }
5055    unsafe impl<
5056        D: fidl::encoding::ResourceDialect,
5057        T0: fidl::encoding::Encode<i32, D>,
5058        T1: fidl::encoding::Encode<i32, D>,
5059        T2: fidl::encoding::Encode<u32, D>,
5060        T3: fidl::encoding::Encode<bool, D>,
5061        T4: fidl::encoding::Encode<bool, D>,
5062        T5: fidl::encoding::Encode<bool, D>,
5063        T6: fidl::encoding::Encode<u32, D>,
5064    > fidl::encoding::Encode<StylusReport, D> for (T0, T1, T2, T3, T4, T5, T6)
5065    {
5066        #[inline]
5067        unsafe fn encode(
5068            self,
5069            encoder: &mut fidl::encoding::Encoder<'_, D>,
5070            offset: usize,
5071            depth: fidl::encoding::Depth,
5072        ) -> fidl::Result<()> {
5073            encoder.debug_check_bounds::<StylusReport>(offset);
5074            // Zero out padding regions. There's no need to apply masks
5075            // because the unmasked parts will be overwritten by fields.
5076            unsafe {
5077                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
5078                (ptr as *mut u32).write_unaligned(0);
5079            }
5080            // Write the fields.
5081            self.0.encode(encoder, offset + 0, depth)?;
5082            self.1.encode(encoder, offset + 4, depth)?;
5083            self.2.encode(encoder, offset + 8, depth)?;
5084            self.3.encode(encoder, offset + 12, depth)?;
5085            self.4.encode(encoder, offset + 13, depth)?;
5086            self.5.encode(encoder, offset + 14, depth)?;
5087            self.6.encode(encoder, offset + 16, depth)?;
5088            Ok(())
5089        }
5090    }
5091
5092    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusReport {
5093        #[inline(always)]
5094        fn new_empty() -> Self {
5095            Self {
5096                x: fidl::new_empty!(i32, D),
5097                y: fidl::new_empty!(i32, D),
5098                pressure: fidl::new_empty!(u32, D),
5099                is_in_contact: fidl::new_empty!(bool, D),
5100                in_range: fidl::new_empty!(bool, D),
5101                is_inverted: fidl::new_empty!(bool, D),
5102                pressed_buttons: fidl::new_empty!(u32, D),
5103            }
5104        }
5105
5106        #[inline]
5107        unsafe fn decode(
5108            &mut self,
5109            decoder: &mut fidl::encoding::Decoder<'_, D>,
5110            offset: usize,
5111            _depth: fidl::encoding::Depth,
5112        ) -> fidl::Result<()> {
5113            decoder.debug_check_bounds::<Self>(offset);
5114            // Verify that padding bytes are zero.
5115            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
5116            let padval = unsafe { (ptr as *const u32).read_unaligned() };
5117            let mask = 0xff000000u32;
5118            let maskedval = padval & mask;
5119            if maskedval != 0 {
5120                return Err(fidl::Error::NonZeroPadding {
5121                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
5122                });
5123            }
5124            fidl::decode!(i32, D, &mut self.x, decoder, offset + 0, _depth)?;
5125            fidl::decode!(i32, D, &mut self.y, decoder, offset + 4, _depth)?;
5126            fidl::decode!(u32, D, &mut self.pressure, decoder, offset + 8, _depth)?;
5127            fidl::decode!(bool, D, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
5128            fidl::decode!(bool, D, &mut self.in_range, decoder, offset + 13, _depth)?;
5129            fidl::decode!(bool, D, &mut self.is_inverted, decoder, offset + 14, _depth)?;
5130            fidl::decode!(u32, D, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
5131            Ok(())
5132        }
5133    }
5134
5135    impl fidl::encoding::ValueTypeMarker for TextInputState {
5136        type Borrowed<'a> = &'a Self;
5137        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5138            value
5139        }
5140    }
5141
5142    unsafe impl fidl::encoding::TypeMarker for TextInputState {
5143        type Owned = Self;
5144
5145        #[inline(always)]
5146        fn inline_align(_context: fidl::encoding::Context) -> usize {
5147            8
5148        }
5149
5150        #[inline(always)]
5151        fn inline_size(_context: fidl::encoding::Context) -> usize {
5152            64
5153        }
5154    }
5155
5156    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextInputState, D>
5157        for &TextInputState
5158    {
5159        #[inline]
5160        unsafe fn encode(
5161            self,
5162            encoder: &mut fidl::encoding::Encoder<'_, D>,
5163            offset: usize,
5164            _depth: fidl::encoding::Depth,
5165        ) -> fidl::Result<()> {
5166            encoder.debug_check_bounds::<TextInputState>(offset);
5167            // Delegate to tuple encoding.
5168            fidl::encoding::Encode::<TextInputState, D>::encode(
5169                (
5170                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision),
5171                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
5172                        &self.text,
5173                    ),
5174                    <TextSelection as fidl::encoding::ValueTypeMarker>::borrow(&self.selection),
5175                    <TextRange as fidl::encoding::ValueTypeMarker>::borrow(&self.composing),
5176                ),
5177                encoder,
5178                offset,
5179                _depth,
5180            )
5181        }
5182    }
5183    unsafe impl<
5184        D: fidl::encoding::ResourceDialect,
5185        T0: fidl::encoding::Encode<u32, D>,
5186        T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
5187        T2: fidl::encoding::Encode<TextSelection, D>,
5188        T3: fidl::encoding::Encode<TextRange, D>,
5189    > fidl::encoding::Encode<TextInputState, D> for (T0, T1, T2, T3)
5190    {
5191        #[inline]
5192        unsafe fn encode(
5193            self,
5194            encoder: &mut fidl::encoding::Encoder<'_, D>,
5195            offset: usize,
5196            depth: fidl::encoding::Depth,
5197        ) -> fidl::Result<()> {
5198            encoder.debug_check_bounds::<TextInputState>(offset);
5199            // Zero out padding regions. There's no need to apply masks
5200            // because the unmasked parts will be overwritten by fields.
5201            unsafe {
5202                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5203                (ptr as *mut u64).write_unaligned(0);
5204            }
5205            // Write the fields.
5206            self.0.encode(encoder, offset + 0, depth)?;
5207            self.1.encode(encoder, offset + 8, depth)?;
5208            self.2.encode(encoder, offset + 24, depth)?;
5209            self.3.encode(encoder, offset + 48, depth)?;
5210            Ok(())
5211        }
5212    }
5213
5214    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextInputState {
5215        #[inline(always)]
5216        fn new_empty() -> Self {
5217            Self {
5218                revision: fidl::new_empty!(u32, D),
5219                text: fidl::new_empty!(fidl::encoding::UnboundedString, D),
5220                selection: fidl::new_empty!(TextSelection, D),
5221                composing: fidl::new_empty!(TextRange, D),
5222            }
5223        }
5224
5225        #[inline]
5226        unsafe fn decode(
5227            &mut self,
5228            decoder: &mut fidl::encoding::Decoder<'_, D>,
5229            offset: usize,
5230            _depth: fidl::encoding::Depth,
5231        ) -> fidl::Result<()> {
5232            decoder.debug_check_bounds::<Self>(offset);
5233            // Verify that padding bytes are zero.
5234            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5235            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5236            let mask = 0xffffffff00000000u64;
5237            let maskedval = padval & mask;
5238            if maskedval != 0 {
5239                return Err(fidl::Error::NonZeroPadding {
5240                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5241                });
5242            }
5243            fidl::decode!(u32, D, &mut self.revision, decoder, offset + 0, _depth)?;
5244            fidl::decode!(
5245                fidl::encoding::UnboundedString,
5246                D,
5247                &mut self.text,
5248                decoder,
5249                offset + 8,
5250                _depth
5251            )?;
5252            fidl::decode!(TextSelection, D, &mut self.selection, decoder, offset + 24, _depth)?;
5253            fidl::decode!(TextRange, D, &mut self.composing, decoder, offset + 48, _depth)?;
5254            Ok(())
5255        }
5256    }
5257
5258    impl fidl::encoding::ValueTypeMarker for TextRange {
5259        type Borrowed<'a> = &'a Self;
5260        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5261            value
5262        }
5263    }
5264
5265    unsafe impl fidl::encoding::TypeMarker for TextRange {
5266        type Owned = Self;
5267
5268        #[inline(always)]
5269        fn inline_align(_context: fidl::encoding::Context) -> usize {
5270            8
5271        }
5272
5273        #[inline(always)]
5274        fn inline_size(_context: fidl::encoding::Context) -> usize {
5275            16
5276        }
5277        #[inline(always)]
5278        fn encode_is_copy() -> bool {
5279            true
5280        }
5281
5282        #[inline(always)]
5283        fn decode_is_copy() -> bool {
5284            true
5285        }
5286    }
5287
5288    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextRange, D>
5289        for &TextRange
5290    {
5291        #[inline]
5292        unsafe fn encode(
5293            self,
5294            encoder: &mut fidl::encoding::Encoder<'_, D>,
5295            offset: usize,
5296            _depth: fidl::encoding::Depth,
5297        ) -> fidl::Result<()> {
5298            encoder.debug_check_bounds::<TextRange>(offset);
5299            unsafe {
5300                // Copy the object into the buffer.
5301                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5302                (buf_ptr as *mut TextRange).write_unaligned((self as *const TextRange).read());
5303                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5304                // done second because the memcpy will write garbage to these bytes.
5305            }
5306            Ok(())
5307        }
5308    }
5309    unsafe impl<
5310        D: fidl::encoding::ResourceDialect,
5311        T0: fidl::encoding::Encode<i64, D>,
5312        T1: fidl::encoding::Encode<i64, D>,
5313    > fidl::encoding::Encode<TextRange, D> for (T0, T1)
5314    {
5315        #[inline]
5316        unsafe fn encode(
5317            self,
5318            encoder: &mut fidl::encoding::Encoder<'_, D>,
5319            offset: usize,
5320            depth: fidl::encoding::Depth,
5321        ) -> fidl::Result<()> {
5322            encoder.debug_check_bounds::<TextRange>(offset);
5323            // Zero out padding regions. There's no need to apply masks
5324            // because the unmasked parts will be overwritten by fields.
5325            // Write the fields.
5326            self.0.encode(encoder, offset + 0, depth)?;
5327            self.1.encode(encoder, offset + 8, depth)?;
5328            Ok(())
5329        }
5330    }
5331
5332    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextRange {
5333        #[inline(always)]
5334        fn new_empty() -> Self {
5335            Self { start: fidl::new_empty!(i64, D), end: fidl::new_empty!(i64, D) }
5336        }
5337
5338        #[inline]
5339        unsafe fn decode(
5340            &mut self,
5341            decoder: &mut fidl::encoding::Decoder<'_, D>,
5342            offset: usize,
5343            _depth: fidl::encoding::Depth,
5344        ) -> fidl::Result<()> {
5345            decoder.debug_check_bounds::<Self>(offset);
5346            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5347            // Verify that padding bytes are zero.
5348            // Copy from the buffer into the object.
5349            unsafe {
5350                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
5351            }
5352            Ok(())
5353        }
5354    }
5355
5356    impl fidl::encoding::ValueTypeMarker for TextSelection {
5357        type Borrowed<'a> = &'a Self;
5358        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5359            value
5360        }
5361    }
5362
5363    unsafe impl fidl::encoding::TypeMarker for TextSelection {
5364        type Owned = Self;
5365
5366        #[inline(always)]
5367        fn inline_align(_context: fidl::encoding::Context) -> usize {
5368            8
5369        }
5370
5371        #[inline(always)]
5372        fn inline_size(_context: fidl::encoding::Context) -> usize {
5373            24
5374        }
5375    }
5376
5377    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextSelection, D>
5378        for &TextSelection
5379    {
5380        #[inline]
5381        unsafe fn encode(
5382            self,
5383            encoder: &mut fidl::encoding::Encoder<'_, D>,
5384            offset: usize,
5385            _depth: fidl::encoding::Depth,
5386        ) -> fidl::Result<()> {
5387            encoder.debug_check_bounds::<TextSelection>(offset);
5388            // Delegate to tuple encoding.
5389            fidl::encoding::Encode::<TextSelection, D>::encode(
5390                (
5391                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
5392                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
5393                    <TextAffinity as fidl::encoding::ValueTypeMarker>::borrow(&self.affinity),
5394                ),
5395                encoder,
5396                offset,
5397                _depth,
5398            )
5399        }
5400    }
5401    unsafe impl<
5402        D: fidl::encoding::ResourceDialect,
5403        T0: fidl::encoding::Encode<i64, D>,
5404        T1: fidl::encoding::Encode<i64, D>,
5405        T2: fidl::encoding::Encode<TextAffinity, D>,
5406    > fidl::encoding::Encode<TextSelection, D> for (T0, T1, T2)
5407    {
5408        #[inline]
5409        unsafe fn encode(
5410            self,
5411            encoder: &mut fidl::encoding::Encoder<'_, D>,
5412            offset: usize,
5413            depth: fidl::encoding::Depth,
5414        ) -> fidl::Result<()> {
5415            encoder.debug_check_bounds::<TextSelection>(offset);
5416            // Zero out padding regions. There's no need to apply masks
5417            // because the unmasked parts will be overwritten by fields.
5418            unsafe {
5419                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5420                (ptr as *mut u64).write_unaligned(0);
5421            }
5422            // Write the fields.
5423            self.0.encode(encoder, offset + 0, depth)?;
5424            self.1.encode(encoder, offset + 8, depth)?;
5425            self.2.encode(encoder, offset + 16, depth)?;
5426            Ok(())
5427        }
5428    }
5429
5430    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextSelection {
5431        #[inline(always)]
5432        fn new_empty() -> Self {
5433            Self {
5434                base: fidl::new_empty!(i64, D),
5435                extent: fidl::new_empty!(i64, D),
5436                affinity: fidl::new_empty!(TextAffinity, D),
5437            }
5438        }
5439
5440        #[inline]
5441        unsafe fn decode(
5442            &mut self,
5443            decoder: &mut fidl::encoding::Decoder<'_, D>,
5444            offset: usize,
5445            _depth: fidl::encoding::Depth,
5446        ) -> fidl::Result<()> {
5447            decoder.debug_check_bounds::<Self>(offset);
5448            // Verify that padding bytes are zero.
5449            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5450            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5451            let mask = 0xffffffff00000000u64;
5452            let maskedval = padval & mask;
5453            if maskedval != 0 {
5454                return Err(fidl::Error::NonZeroPadding {
5455                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5456                });
5457            }
5458            fidl::decode!(i64, D, &mut self.base, decoder, offset + 0, _depth)?;
5459            fidl::decode!(i64, D, &mut self.extent, decoder, offset + 8, _depth)?;
5460            fidl::decode!(TextAffinity, D, &mut self.affinity, decoder, offset + 16, _depth)?;
5461            Ok(())
5462        }
5463    }
5464
5465    impl fidl::encoding::ValueTypeMarker for Touch {
5466        type Borrowed<'a> = &'a Self;
5467        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5468            value
5469        }
5470    }
5471
5472    unsafe impl fidl::encoding::TypeMarker for Touch {
5473        type Owned = Self;
5474
5475        #[inline(always)]
5476        fn inline_align(_context: fidl::encoding::Context) -> usize {
5477            4
5478        }
5479
5480        #[inline(always)]
5481        fn inline_size(_context: fidl::encoding::Context) -> usize {
5482            20
5483        }
5484        #[inline(always)]
5485        fn encode_is_copy() -> bool {
5486            true
5487        }
5488
5489        #[inline(always)]
5490        fn decode_is_copy() -> bool {
5491            true
5492        }
5493    }
5494
5495    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Touch, D> for &Touch {
5496        #[inline]
5497        unsafe fn encode(
5498            self,
5499            encoder: &mut fidl::encoding::Encoder<'_, D>,
5500            offset: usize,
5501            _depth: fidl::encoding::Depth,
5502        ) -> fidl::Result<()> {
5503            encoder.debug_check_bounds::<Touch>(offset);
5504            unsafe {
5505                // Copy the object into the buffer.
5506                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5507                (buf_ptr as *mut Touch).write_unaligned((self as *const Touch).read());
5508                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5509                // done second because the memcpy will write garbage to these bytes.
5510            }
5511            Ok(())
5512        }
5513    }
5514    unsafe impl<
5515        D: fidl::encoding::ResourceDialect,
5516        T0: fidl::encoding::Encode<u32, D>,
5517        T1: fidl::encoding::Encode<i32, D>,
5518        T2: fidl::encoding::Encode<i32, D>,
5519        T3: fidl::encoding::Encode<u32, D>,
5520        T4: fidl::encoding::Encode<u32, D>,
5521    > fidl::encoding::Encode<Touch, D> for (T0, T1, T2, T3, T4)
5522    {
5523        #[inline]
5524        unsafe fn encode(
5525            self,
5526            encoder: &mut fidl::encoding::Encoder<'_, D>,
5527            offset: usize,
5528            depth: fidl::encoding::Depth,
5529        ) -> fidl::Result<()> {
5530            encoder.debug_check_bounds::<Touch>(offset);
5531            // Zero out padding regions. There's no need to apply masks
5532            // because the unmasked parts will be overwritten by fields.
5533            // Write the fields.
5534            self.0.encode(encoder, offset + 0, depth)?;
5535            self.1.encode(encoder, offset + 4, depth)?;
5536            self.2.encode(encoder, offset + 8, depth)?;
5537            self.3.encode(encoder, offset + 12, depth)?;
5538            self.4.encode(encoder, offset + 16, depth)?;
5539            Ok(())
5540        }
5541    }
5542
5543    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Touch {
5544        #[inline(always)]
5545        fn new_empty() -> Self {
5546            Self {
5547                finger_id: fidl::new_empty!(u32, D),
5548                x: fidl::new_empty!(i32, D),
5549                y: fidl::new_empty!(i32, D),
5550                width: fidl::new_empty!(u32, D),
5551                height: fidl::new_empty!(u32, D),
5552            }
5553        }
5554
5555        #[inline]
5556        unsafe fn decode(
5557            &mut self,
5558            decoder: &mut fidl::encoding::Decoder<'_, D>,
5559            offset: usize,
5560            _depth: fidl::encoding::Depth,
5561        ) -> fidl::Result<()> {
5562            decoder.debug_check_bounds::<Self>(offset);
5563            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5564            // Verify that padding bytes are zero.
5565            // Copy from the buffer into the object.
5566            unsafe {
5567                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
5568            }
5569            Ok(())
5570        }
5571    }
5572
5573    impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
5574        type Borrowed<'a> = &'a Self;
5575        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5576            value
5577        }
5578    }
5579
5580    unsafe impl fidl::encoding::TypeMarker for TouchscreenDescriptor {
5581        type Owned = Self;
5582
5583        #[inline(always)]
5584        fn inline_align(_context: fidl::encoding::Context) -> usize {
5585            4
5586        }
5587
5588        #[inline(always)]
5589        fn inline_size(_context: fidl::encoding::Context) -> usize {
5590            36
5591        }
5592    }
5593
5594    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenDescriptor, D>
5595        for &TouchscreenDescriptor
5596    {
5597        #[inline]
5598        unsafe fn encode(
5599            self,
5600            encoder: &mut fidl::encoding::Encoder<'_, D>,
5601            offset: usize,
5602            _depth: fidl::encoding::Depth,
5603        ) -> fidl::Result<()> {
5604            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5605            // Delegate to tuple encoding.
5606            fidl::encoding::Encode::<TouchscreenDescriptor, D>::encode(
5607                (
5608                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5609                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5610                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_finger_id),
5611                ),
5612                encoder,
5613                offset,
5614                _depth,
5615            )
5616        }
5617    }
5618    unsafe impl<
5619        D: fidl::encoding::ResourceDialect,
5620        T0: fidl::encoding::Encode<Axis, D>,
5621        T1: fidl::encoding::Encode<Axis, D>,
5622        T2: fidl::encoding::Encode<u32, D>,
5623    > fidl::encoding::Encode<TouchscreenDescriptor, D> for (T0, T1, T2)
5624    {
5625        #[inline]
5626        unsafe fn encode(
5627            self,
5628            encoder: &mut fidl::encoding::Encoder<'_, D>,
5629            offset: usize,
5630            depth: fidl::encoding::Depth,
5631        ) -> fidl::Result<()> {
5632            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5633            // Zero out padding regions. There's no need to apply masks
5634            // because the unmasked parts will be overwritten by fields.
5635            // Write the fields.
5636            self.0.encode(encoder, offset + 0, depth)?;
5637            self.1.encode(encoder, offset + 16, depth)?;
5638            self.2.encode(encoder, offset + 32, depth)?;
5639            Ok(())
5640        }
5641    }
5642
5643    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenDescriptor {
5644        #[inline(always)]
5645        fn new_empty() -> Self {
5646            Self {
5647                x: fidl::new_empty!(Axis, D),
5648                y: fidl::new_empty!(Axis, D),
5649                max_finger_id: fidl::new_empty!(u32, D),
5650            }
5651        }
5652
5653        #[inline]
5654        unsafe fn decode(
5655            &mut self,
5656            decoder: &mut fidl::encoding::Decoder<'_, D>,
5657            offset: usize,
5658            _depth: fidl::encoding::Depth,
5659        ) -> fidl::Result<()> {
5660            decoder.debug_check_bounds::<Self>(offset);
5661            // Verify that padding bytes are zero.
5662            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
5663            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
5664            fidl::decode!(u32, D, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
5665            Ok(())
5666        }
5667    }
5668
5669    impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
5670        type Borrowed<'a> = &'a Self;
5671        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5672            value
5673        }
5674    }
5675
5676    unsafe impl fidl::encoding::TypeMarker for TouchscreenReport {
5677        type Owned = Self;
5678
5679        #[inline(always)]
5680        fn inline_align(_context: fidl::encoding::Context) -> usize {
5681            8
5682        }
5683
5684        #[inline(always)]
5685        fn inline_size(_context: fidl::encoding::Context) -> usize {
5686            16
5687        }
5688    }
5689
5690    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenReport, D>
5691        for &TouchscreenReport
5692    {
5693        #[inline]
5694        unsafe fn encode(
5695            self,
5696            encoder: &mut fidl::encoding::Encoder<'_, D>,
5697            offset: usize,
5698            _depth: fidl::encoding::Depth,
5699        ) -> fidl::Result<()> {
5700            encoder.debug_check_bounds::<TouchscreenReport>(offset);
5701            // Delegate to tuple encoding.
5702            fidl::encoding::Encode::<TouchscreenReport, D>::encode(
5703                (
5704                    <fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
5705                ),
5706                encoder, offset, _depth
5707            )
5708        }
5709    }
5710    unsafe impl<
5711        D: fidl::encoding::ResourceDialect,
5712        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>, D>,
5713    > fidl::encoding::Encode<TouchscreenReport, D> for (T0,)
5714    {
5715        #[inline]
5716        unsafe fn encode(
5717            self,
5718            encoder: &mut fidl::encoding::Encoder<'_, D>,
5719            offset: usize,
5720            depth: fidl::encoding::Depth,
5721        ) -> fidl::Result<()> {
5722            encoder.debug_check_bounds::<TouchscreenReport>(offset);
5723            // Zero out padding regions. There's no need to apply masks
5724            // because the unmasked parts will be overwritten by fields.
5725            // Write the fields.
5726            self.0.encode(encoder, offset + 0, depth)?;
5727            Ok(())
5728        }
5729    }
5730
5731    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenReport {
5732        #[inline(always)]
5733        fn new_empty() -> Self {
5734            Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>, D) }
5735        }
5736
5737        #[inline]
5738        unsafe fn decode(
5739            &mut self,
5740            decoder: &mut fidl::encoding::Decoder<'_, D>,
5741            offset: usize,
5742            _depth: fidl::encoding::Depth,
5743        ) -> fidl::Result<()> {
5744            decoder.debug_check_bounds::<Self>(offset);
5745            // Verify that padding bytes are zero.
5746            fidl::decode!(
5747                fidl::encoding::UnboundedVector<Touch>,
5748                D,
5749                &mut self.touches,
5750                decoder,
5751                offset + 0,
5752                _depth
5753            )?;
5754            Ok(())
5755        }
5756    }
5757
5758    impl TouchDeviceInfo {
5759        #[inline(always)]
5760        fn max_ordinal_present(&self) -> u64 {
5761            if let Some(_) = self.id {
5762                return 1;
5763            }
5764            0
5765        }
5766    }
5767
5768    impl fidl::encoding::ValueTypeMarker for TouchDeviceInfo {
5769        type Borrowed<'a> = &'a Self;
5770        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5771            value
5772        }
5773    }
5774
5775    unsafe impl fidl::encoding::TypeMarker for TouchDeviceInfo {
5776        type Owned = Self;
5777
5778        #[inline(always)]
5779        fn inline_align(_context: fidl::encoding::Context) -> usize {
5780            8
5781        }
5782
5783        #[inline(always)]
5784        fn inline_size(_context: fidl::encoding::Context) -> usize {
5785            16
5786        }
5787    }
5788
5789    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDeviceInfo, D>
5790        for &TouchDeviceInfo
5791    {
5792        unsafe fn encode(
5793            self,
5794            encoder: &mut fidl::encoding::Encoder<'_, D>,
5795            offset: usize,
5796            mut depth: fidl::encoding::Depth,
5797        ) -> fidl::Result<()> {
5798            encoder.debug_check_bounds::<TouchDeviceInfo>(offset);
5799            // Vector header
5800            let max_ordinal: u64 = self.max_ordinal_present();
5801            encoder.write_num(max_ordinal, offset);
5802            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5803            // Calling encoder.out_of_line_offset(0) is not allowed.
5804            if max_ordinal == 0 {
5805                return Ok(());
5806            }
5807            depth.increment()?;
5808            let envelope_size = 8;
5809            let bytes_len = max_ordinal as usize * envelope_size;
5810            #[allow(unused_variables)]
5811            let offset = encoder.out_of_line_offset(bytes_len);
5812            let mut _prev_end_offset: usize = 0;
5813            if 1 > max_ordinal {
5814                return Ok(());
5815            }
5816
5817            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5818            // are envelope_size bytes.
5819            let cur_offset: usize = (1 - 1) * envelope_size;
5820
5821            // Zero reserved fields.
5822            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5823
5824            // Safety:
5825            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5826            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5827            //   envelope_size bytes, there is always sufficient room.
5828            fidl::encoding::encode_in_envelope_optional::<u32, D>(
5829                self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5830                encoder,
5831                offset + cur_offset,
5832                depth,
5833            )?;
5834
5835            _prev_end_offset = cur_offset + envelope_size;
5836
5837            Ok(())
5838        }
5839    }
5840
5841    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDeviceInfo {
5842        #[inline(always)]
5843        fn new_empty() -> Self {
5844            Self::default()
5845        }
5846
5847        unsafe fn decode(
5848            &mut self,
5849            decoder: &mut fidl::encoding::Decoder<'_, D>,
5850            offset: usize,
5851            mut depth: fidl::encoding::Depth,
5852        ) -> fidl::Result<()> {
5853            decoder.debug_check_bounds::<Self>(offset);
5854            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5855                None => return Err(fidl::Error::NotNullable),
5856                Some(len) => len,
5857            };
5858            // Calling decoder.out_of_line_offset(0) is not allowed.
5859            if len == 0 {
5860                return Ok(());
5861            };
5862            depth.increment()?;
5863            let envelope_size = 8;
5864            let bytes_len = len * envelope_size;
5865            let offset = decoder.out_of_line_offset(bytes_len)?;
5866            // Decode the envelope for each type.
5867            let mut _next_ordinal_to_read = 0;
5868            let mut next_offset = offset;
5869            let end_offset = offset + bytes_len;
5870            _next_ordinal_to_read += 1;
5871            if next_offset >= end_offset {
5872                return Ok(());
5873            }
5874
5875            // Decode unknown envelopes for gaps in ordinals.
5876            while _next_ordinal_to_read < 1 {
5877                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5878                _next_ordinal_to_read += 1;
5879                next_offset += envelope_size;
5880            }
5881
5882            let next_out_of_line = decoder.next_out_of_line();
5883            let handles_before = decoder.remaining_handles();
5884            if let Some((inlined, num_bytes, num_handles)) =
5885                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5886            {
5887                let member_inline_size =
5888                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5889                if inlined != (member_inline_size <= 4) {
5890                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5891                }
5892                let inner_offset;
5893                let mut inner_depth = depth.clone();
5894                if inlined {
5895                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5896                    inner_offset = next_offset;
5897                } else {
5898                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5899                    inner_depth.increment()?;
5900                }
5901                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5902                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5903                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5904                {
5905                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5906                }
5907                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5908                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5909                }
5910            }
5911
5912            next_offset += envelope_size;
5913
5914            // Decode the remaining unknown envelopes.
5915            while next_offset < end_offset {
5916                _next_ordinal_to_read += 1;
5917                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5918                next_offset += envelope_size;
5919            }
5920
5921            Ok(())
5922        }
5923    }
5924
5925    impl fidl::encoding::ValueTypeMarker for Command {
5926        type Borrowed<'a> = &'a Self;
5927        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5928            value
5929        }
5930    }
5931
5932    unsafe impl fidl::encoding::TypeMarker for Command {
5933        type Owned = Self;
5934
5935        #[inline(always)]
5936        fn inline_align(_context: fidl::encoding::Context) -> usize {
5937            8
5938        }
5939
5940        #[inline(always)]
5941        fn inline_size(_context: fidl::encoding::Context) -> usize {
5942            16
5943        }
5944    }
5945
5946    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Command, D> for &Command {
5947        #[inline]
5948        unsafe fn encode(
5949            self,
5950            encoder: &mut fidl::encoding::Encoder<'_, D>,
5951            offset: usize,
5952            _depth: fidl::encoding::Depth,
5953        ) -> fidl::Result<()> {
5954            encoder.debug_check_bounds::<Command>(offset);
5955            encoder.write_num::<u64>(self.ordinal(), offset);
5956            match self {
5957                Command::SendKeyboardInput(ref val) => {
5958                    fidl::encoding::encode_in_envelope::<SendKeyboardInputCmd, D>(
5959                        <SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
5960                        encoder,
5961                        offset + 8,
5962                        _depth,
5963                    )
5964                }
5965                Command::SendPointerInput(ref val) => {
5966                    fidl::encoding::encode_in_envelope::<SendPointerInputCmd, D>(
5967                        <SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
5968                        encoder,
5969                        offset + 8,
5970                        _depth,
5971                    )
5972                }
5973                Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
5974                    SetHardKeyboardDeliveryCmd,
5975                    D,
5976                >(
5977                    <SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
5978                    encoder,
5979                    offset + 8,
5980                    _depth,
5981                ),
5982                Command::SetParallelDispatch(ref val) => {
5983                    fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd, D>(
5984                        <SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
5985                        encoder,
5986                        offset + 8,
5987                        _depth,
5988                    )
5989                }
5990            }
5991        }
5992    }
5993
5994    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
5995        #[inline(always)]
5996        fn new_empty() -> Self {
5997            Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D))
5998        }
5999
6000        #[inline]
6001        unsafe fn decode(
6002            &mut self,
6003            decoder: &mut fidl::encoding::Decoder<'_, D>,
6004            offset: usize,
6005            mut depth: fidl::encoding::Depth,
6006        ) -> fidl::Result<()> {
6007            decoder.debug_check_bounds::<Self>(offset);
6008            #[allow(unused_variables)]
6009            let next_out_of_line = decoder.next_out_of_line();
6010            let handles_before = decoder.remaining_handles();
6011            let (ordinal, inlined, num_bytes, num_handles) =
6012                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6013
6014            let member_inline_size = match ordinal {
6015                1 => <SendKeyboardInputCmd as fidl::encoding::TypeMarker>::inline_size(
6016                    decoder.context,
6017                ),
6018                2 => <SendPointerInputCmd as fidl::encoding::TypeMarker>::inline_size(
6019                    decoder.context,
6020                ),
6021                3 => <SetHardKeyboardDeliveryCmd as fidl::encoding::TypeMarker>::inline_size(
6022                    decoder.context,
6023                ),
6024                4 => <SetParallelDispatchCmd as fidl::encoding::TypeMarker>::inline_size(
6025                    decoder.context,
6026                ),
6027                _ => return Err(fidl::Error::UnknownUnionTag),
6028            };
6029
6030            if inlined != (member_inline_size <= 4) {
6031                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6032            }
6033            let _inner_offset;
6034            if inlined {
6035                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6036                _inner_offset = offset + 8;
6037            } else {
6038                depth.increment()?;
6039                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6040            }
6041            match ordinal {
6042                1 => {
6043                    #[allow(irrefutable_let_patterns)]
6044                    if let Command::SendKeyboardInput(_) = self {
6045                        // Do nothing, read the value into the object
6046                    } else {
6047                        // Initialize `self` to the right variant
6048                        *self =
6049                            Command::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D));
6050                    }
6051                    #[allow(irrefutable_let_patterns)]
6052                    if let Command::SendKeyboardInput(ref mut val) = self {
6053                        fidl::decode!(SendKeyboardInputCmd, D, val, decoder, _inner_offset, depth)?;
6054                    } else {
6055                        unreachable!()
6056                    }
6057                }
6058                2 => {
6059                    #[allow(irrefutable_let_patterns)]
6060                    if let Command::SendPointerInput(_) = self {
6061                        // Do nothing, read the value into the object
6062                    } else {
6063                        // Initialize `self` to the right variant
6064                        *self = Command::SendPointerInput(fidl::new_empty!(SendPointerInputCmd, D));
6065                    }
6066                    #[allow(irrefutable_let_patterns)]
6067                    if let Command::SendPointerInput(ref mut val) = self {
6068                        fidl::decode!(SendPointerInputCmd, D, val, decoder, _inner_offset, depth)?;
6069                    } else {
6070                        unreachable!()
6071                    }
6072                }
6073                3 => {
6074                    #[allow(irrefutable_let_patterns)]
6075                    if let Command::SetHardKeyboardDelivery(_) = self {
6076                        // Do nothing, read the value into the object
6077                    } else {
6078                        // Initialize `self` to the right variant
6079                        *self = Command::SetHardKeyboardDelivery(fidl::new_empty!(
6080                            SetHardKeyboardDeliveryCmd,
6081                            D
6082                        ));
6083                    }
6084                    #[allow(irrefutable_let_patterns)]
6085                    if let Command::SetHardKeyboardDelivery(ref mut val) = self {
6086                        fidl::decode!(
6087                            SetHardKeyboardDeliveryCmd,
6088                            D,
6089                            val,
6090                            decoder,
6091                            _inner_offset,
6092                            depth
6093                        )?;
6094                    } else {
6095                        unreachable!()
6096                    }
6097                }
6098                4 => {
6099                    #[allow(irrefutable_let_patterns)]
6100                    if let Command::SetParallelDispatch(_) = self {
6101                        // Do nothing, read the value into the object
6102                    } else {
6103                        // Initialize `self` to the right variant
6104                        *self = Command::SetParallelDispatch(fidl::new_empty!(
6105                            SetParallelDispatchCmd,
6106                            D
6107                        ));
6108                    }
6109                    #[allow(irrefutable_let_patterns)]
6110                    if let Command::SetParallelDispatch(ref mut val) = self {
6111                        fidl::decode!(
6112                            SetParallelDispatchCmd,
6113                            D,
6114                            val,
6115                            decoder,
6116                            _inner_offset,
6117                            depth
6118                        )?;
6119                    } else {
6120                        unreachable!()
6121                    }
6122                }
6123                ordinal => panic!("unexpected ordinal {:?}", ordinal),
6124            }
6125            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6126                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6127            }
6128            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6129                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6130            }
6131            Ok(())
6132        }
6133    }
6134
6135    impl fidl::encoding::ValueTypeMarker for InputEvent {
6136        type Borrowed<'a> = &'a Self;
6137        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6138            value
6139        }
6140    }
6141
6142    unsafe impl fidl::encoding::TypeMarker for InputEvent {
6143        type Owned = Self;
6144
6145        #[inline(always)]
6146        fn inline_align(_context: fidl::encoding::Context) -> usize {
6147            8
6148        }
6149
6150        #[inline(always)]
6151        fn inline_size(_context: fidl::encoding::Context) -> usize {
6152            16
6153        }
6154    }
6155
6156    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputEvent, D>
6157        for &InputEvent
6158    {
6159        #[inline]
6160        unsafe fn encode(
6161            self,
6162            encoder: &mut fidl::encoding::Encoder<'_, D>,
6163            offset: usize,
6164            _depth: fidl::encoding::Depth,
6165        ) -> fidl::Result<()> {
6166            encoder.debug_check_bounds::<InputEvent>(offset);
6167            encoder.write_num::<u64>(self.ordinal(), offset);
6168            match self {
6169                InputEvent::Pointer(ref val) => {
6170                    fidl::encoding::encode_in_envelope::<PointerEvent, D>(
6171                        <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
6172                        encoder,
6173                        offset + 8,
6174                        _depth,
6175                    )
6176                }
6177                InputEvent::Keyboard(ref val) => {
6178                    fidl::encoding::encode_in_envelope::<KeyboardEvent, D>(
6179                        <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
6180                        encoder,
6181                        offset + 8,
6182                        _depth,
6183                    )
6184                }
6185                InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent, D>(
6186                    <FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
6187                    encoder,
6188                    offset + 8,
6189                    _depth,
6190                ),
6191            }
6192        }
6193    }
6194
6195    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputEvent {
6196        #[inline(always)]
6197        fn new_empty() -> Self {
6198            Self::Pointer(fidl::new_empty!(PointerEvent, D))
6199        }
6200
6201        #[inline]
6202        unsafe fn decode(
6203            &mut self,
6204            decoder: &mut fidl::encoding::Decoder<'_, D>,
6205            offset: usize,
6206            mut depth: fidl::encoding::Depth,
6207        ) -> fidl::Result<()> {
6208            decoder.debug_check_bounds::<Self>(offset);
6209            #[allow(unused_variables)]
6210            let next_out_of_line = decoder.next_out_of_line();
6211            let handles_before = decoder.remaining_handles();
6212            let (ordinal, inlined, num_bytes, num_handles) =
6213                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6214
6215            let member_inline_size = match ordinal {
6216                1 => <PointerEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6217                2 => <KeyboardEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6218                3 => <FocusEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6219                _ => return Err(fidl::Error::UnknownUnionTag),
6220            };
6221
6222            if inlined != (member_inline_size <= 4) {
6223                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6224            }
6225            let _inner_offset;
6226            if inlined {
6227                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6228                _inner_offset = offset + 8;
6229            } else {
6230                depth.increment()?;
6231                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6232            }
6233            match ordinal {
6234                1 => {
6235                    #[allow(irrefutable_let_patterns)]
6236                    if let InputEvent::Pointer(_) = self {
6237                        // Do nothing, read the value into the object
6238                    } else {
6239                        // Initialize `self` to the right variant
6240                        *self = InputEvent::Pointer(fidl::new_empty!(PointerEvent, D));
6241                    }
6242                    #[allow(irrefutable_let_patterns)]
6243                    if let InputEvent::Pointer(ref mut val) = self {
6244                        fidl::decode!(PointerEvent, D, val, decoder, _inner_offset, depth)?;
6245                    } else {
6246                        unreachable!()
6247                    }
6248                }
6249                2 => {
6250                    #[allow(irrefutable_let_patterns)]
6251                    if let InputEvent::Keyboard(_) = self {
6252                        // Do nothing, read the value into the object
6253                    } else {
6254                        // Initialize `self` to the right variant
6255                        *self = InputEvent::Keyboard(fidl::new_empty!(KeyboardEvent, D));
6256                    }
6257                    #[allow(irrefutable_let_patterns)]
6258                    if let InputEvent::Keyboard(ref mut val) = self {
6259                        fidl::decode!(KeyboardEvent, D, val, decoder, _inner_offset, depth)?;
6260                    } else {
6261                        unreachable!()
6262                    }
6263                }
6264                3 => {
6265                    #[allow(irrefutable_let_patterns)]
6266                    if let InputEvent::Focus(_) = self {
6267                        // Do nothing, read the value into the object
6268                    } else {
6269                        // Initialize `self` to the right variant
6270                        *self = InputEvent::Focus(fidl::new_empty!(FocusEvent, D));
6271                    }
6272                    #[allow(irrefutable_let_patterns)]
6273                    if let InputEvent::Focus(ref mut val) = self {
6274                        fidl::decode!(FocusEvent, D, val, decoder, _inner_offset, depth)?;
6275                    } else {
6276                        unreachable!()
6277                    }
6278                }
6279                ordinal => panic!("unexpected ordinal {:?}", ordinal),
6280            }
6281            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6282                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6283            }
6284            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6285                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6286            }
6287            Ok(())
6288        }
6289    }
6290
6291    impl fidl::encoding::ValueTypeMarker for SensorReport {
6292        type Borrowed<'a> = &'a Self;
6293        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6294            value
6295        }
6296    }
6297
6298    unsafe impl fidl::encoding::TypeMarker for SensorReport {
6299        type Owned = Self;
6300
6301        #[inline(always)]
6302        fn inline_align(_context: fidl::encoding::Context) -> usize {
6303            8
6304        }
6305
6306        #[inline(always)]
6307        fn inline_size(_context: fidl::encoding::Context) -> usize {
6308            16
6309        }
6310    }
6311
6312    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorReport, D>
6313        for &SensorReport
6314    {
6315        #[inline]
6316        unsafe fn encode(
6317            self,
6318            encoder: &mut fidl::encoding::Encoder<'_, D>,
6319            offset: usize,
6320            _depth: fidl::encoding::Depth,
6321        ) -> fidl::Result<()> {
6322            encoder.debug_check_bounds::<SensorReport>(offset);
6323            encoder.write_num::<u64>(self.ordinal(), offset);
6324            match self {
6325                SensorReport::Vector(ref val) => fidl::encoding::encode_in_envelope::<
6326                    fidl::encoding::Array<i16, 3>,
6327                    D,
6328                >(
6329                    <fidl::encoding::Array<i16, 3> as fidl::encoding::ValueTypeMarker>::borrow(val),
6330                    encoder,
6331                    offset + 8,
6332                    _depth,
6333                ),
6334                SensorReport::Scalar(ref val) => fidl::encoding::encode_in_envelope::<u16, D>(
6335                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
6336                    encoder,
6337                    offset + 8,
6338                    _depth,
6339                ),
6340            }
6341        }
6342    }
6343
6344    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReport {
6345        #[inline(always)]
6346        fn new_empty() -> Self {
6347            Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>, D))
6348        }
6349
6350        #[inline]
6351        unsafe fn decode(
6352            &mut self,
6353            decoder: &mut fidl::encoding::Decoder<'_, D>,
6354            offset: usize,
6355            mut depth: fidl::encoding::Depth,
6356        ) -> fidl::Result<()> {
6357            decoder.debug_check_bounds::<Self>(offset);
6358            #[allow(unused_variables)]
6359            let next_out_of_line = decoder.next_out_of_line();
6360            let handles_before = decoder.remaining_handles();
6361            let (ordinal, inlined, num_bytes, num_handles) =
6362                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6363
6364            let member_inline_size = match ordinal {
6365                1 => <fidl::encoding::Array<i16, 3> as fidl::encoding::TypeMarker>::inline_size(
6366                    decoder.context,
6367                ),
6368                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6369                _ => return Err(fidl::Error::UnknownUnionTag),
6370            };
6371
6372            if inlined != (member_inline_size <= 4) {
6373                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6374            }
6375            let _inner_offset;
6376            if inlined {
6377                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6378                _inner_offset = offset + 8;
6379            } else {
6380                depth.increment()?;
6381                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6382            }
6383            match ordinal {
6384                1 => {
6385                    #[allow(irrefutable_let_patterns)]
6386                    if let SensorReport::Vector(_) = self {
6387                        // Do nothing, read the value into the object
6388                    } else {
6389                        // Initialize `self` to the right variant
6390                        *self = SensorReport::Vector(
6391                            fidl::new_empty!(fidl::encoding::Array<i16, 3>, D),
6392                        );
6393                    }
6394                    #[allow(irrefutable_let_patterns)]
6395                    if let SensorReport::Vector(ref mut val) = self {
6396                        fidl::decode!(fidl::encoding::Array<i16, 3>, D, val, decoder, _inner_offset, depth)?;
6397                    } else {
6398                        unreachable!()
6399                    }
6400                }
6401                2 => {
6402                    #[allow(irrefutable_let_patterns)]
6403                    if let SensorReport::Scalar(_) = self {
6404                        // Do nothing, read the value into the object
6405                    } else {
6406                        // Initialize `self` to the right variant
6407                        *self = SensorReport::Scalar(fidl::new_empty!(u16, D));
6408                    }
6409                    #[allow(irrefutable_let_patterns)]
6410                    if let SensorReport::Scalar(ref mut val) = self {
6411                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
6412                    } else {
6413                        unreachable!()
6414                    }
6415                }
6416                ordinal => panic!("unexpected ordinal {:?}", ordinal),
6417            }
6418            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6419                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6420            }
6421            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6422                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6423            }
6424            Ok(())
6425        }
6426    }
6427}