fidl_fuchsia_ui_input__common/
fidl_fuchsia_ui_input__common.rs

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