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