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