fidl_fuchsia_ui_input/
fidl_fuchsia_ui_input.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub const MODIFIER_ALT: u32 = 96;
14
15pub const MODIFIER_CAPS_LOCK: u32 = 1;
16
17pub const MODIFIER_CONTROL: u32 = 24;
18
19pub const MODIFIER_LEFT_ALT: u32 = 32;
20
21pub const MODIFIER_LEFT_CONTROL: u32 = 8;
22
23pub const MODIFIER_LEFT_SHIFT: u32 = 2;
24
25pub const MODIFIER_LEFT_SUPER: u32 = 128;
26
27/// Keyboard modifiers
28pub const MODIFIER_NONE: u32 = 0;
29
30pub const MODIFIER_RIGHT_ALT: u32 = 64;
31
32pub const MODIFIER_RIGHT_CONTROL: u32 = 16;
33
34pub const MODIFIER_RIGHT_SHIFT: u32 = 4;
35
36pub const MODIFIER_RIGHT_SUPER: u32 = 256;
37
38pub const MODIFIER_SHIFT: u32 = 6;
39
40pub const MODIFIER_SUPER: u32 = 384;
41
42#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
43pub enum AxisScale {
44    Linear,
45    Logarithmic,
46    #[doc(hidden)]
47    __SourceBreaking {
48        unknown_ordinal: u32,
49    },
50}
51
52/// Pattern that matches an unknown `AxisScale` member.
53#[macro_export]
54macro_rules! AxisScaleUnknown {
55    () => {
56        _
57    };
58}
59
60impl AxisScale {
61    #[inline]
62    pub fn from_primitive(prim: u32) -> Option<Self> {
63        match prim {
64            0 => Some(Self::Linear),
65            1 => Some(Self::Logarithmic),
66            _ => None,
67        }
68    }
69
70    #[inline]
71    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
72        match prim {
73            0 => Self::Linear,
74            1 => Self::Logarithmic,
75            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
76        }
77    }
78
79    #[inline]
80    pub fn unknown() -> Self {
81        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
82    }
83
84    #[inline]
85    pub const fn into_primitive(self) -> u32 {
86        match self {
87            Self::Linear => 0,
88            Self::Logarithmic => 1,
89            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
90        }
91    }
92
93    #[inline]
94    pub fn is_unknown(&self) -> bool {
95        match self {
96            Self::__SourceBreaking { unknown_ordinal: _ } => true,
97            _ => false,
98        }
99    }
100}
101
102/// Determines what happens if the "action" key is pressed on the keyboard,
103/// typically would either be the "Enter" key on a physical keyboard, or an
104/// action button on a virtual keyboard, which is usually placed where Enter
105/// would be, but with a custom label.
106#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
107pub enum InputMethodAction {
108    /// The method action was not specified at all.
109    Unspecified,
110    /// No special action is requested.
111    None,
112    /// The action is "Go", e.g. execute a command.
113    Go,
114    /// The action is to invoke a search.
115    Search,
116    /// The action is to invoke "send", e.g. if this is an email or a SMS
117    /// message.
118    Send,
119    /// The action is to move to the next field in the focus sequence.
120    Next,
121    /// The action is to end the text editing.
122    Done,
123    /// The action is to move to the previous field in the focus sequence.
124    Previous,
125    /// Pressing the action key inserts a new line into the text field. In
126    /// contrast to other values, which all stop editing and invoke a specific
127    /// action.
128    Newline,
129    #[doc(hidden)]
130    __SourceBreaking { unknown_ordinal: u32 },
131}
132
133/// Pattern that matches an unknown `InputMethodAction` member.
134#[macro_export]
135macro_rules! InputMethodActionUnknown {
136    () => {
137        _
138    };
139}
140
141impl InputMethodAction {
142    #[inline]
143    pub fn from_primitive(prim: u32) -> Option<Self> {
144        match prim {
145            0 => Some(Self::Unspecified),
146            1 => Some(Self::None),
147            2 => Some(Self::Go),
148            3 => Some(Self::Search),
149            4 => Some(Self::Send),
150            5 => Some(Self::Next),
151            6 => Some(Self::Done),
152            7 => Some(Self::Previous),
153            8 => Some(Self::Newline),
154            _ => None,
155        }
156    }
157
158    #[inline]
159    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
160        match prim {
161            0 => Self::Unspecified,
162            1 => Self::None,
163            2 => Self::Go,
164            3 => Self::Search,
165            4 => Self::Send,
166            5 => Self::Next,
167            6 => Self::Done,
168            7 => Self::Previous,
169            8 => Self::Newline,
170            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
171        }
172    }
173
174    #[inline]
175    pub fn unknown() -> Self {
176        Self::__SourceBreaking { unknown_ordinal: 0x0 }
177    }
178
179    #[inline]
180    pub const fn into_primitive(self) -> u32 {
181        match self {
182            Self::Unspecified => 0,
183            Self::None => 1,
184            Self::Go => 2,
185            Self::Search => 3,
186            Self::Send => 4,
187            Self::Next => 5,
188            Self::Done => 6,
189            Self::Previous => 7,
190            Self::Newline => 8,
191            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
192        }
193    }
194
195    #[inline]
196    pub fn is_unknown(&self) -> bool {
197        match self {
198            Self::__SourceBreaking { unknown_ordinal: _ } => true,
199            _ => false,
200        }
201    }
202}
203
204#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
205pub enum KeyboardEventPhase {
206    /// When key is pressed down.
207    Pressed,
208    /// When key is released.
209    Released,
210    /// This key `PRESSED` is not directed to this input client anymore.
211    Cancelled,
212    /// Whether this is an automatically generated key repeat
213    Repeat,
214    #[doc(hidden)]
215    __SourceBreaking { unknown_ordinal: u32 },
216}
217
218/// Pattern that matches an unknown `KeyboardEventPhase` member.
219#[macro_export]
220macro_rules! KeyboardEventPhaseUnknown {
221    () => {
222        _
223    };
224}
225
226impl KeyboardEventPhase {
227    #[inline]
228    pub fn from_primitive(prim: u32) -> Option<Self> {
229        match prim {
230            0 => Some(Self::Pressed),
231            1 => Some(Self::Released),
232            2 => Some(Self::Cancelled),
233            3 => Some(Self::Repeat),
234            _ => None,
235        }
236    }
237
238    #[inline]
239    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
240        match prim {
241            0 => Self::Pressed,
242            1 => Self::Released,
243            2 => Self::Cancelled,
244            3 => Self::Repeat,
245            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
246        }
247    }
248
249    #[inline]
250    pub fn unknown() -> Self {
251        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
252    }
253
254    #[inline]
255    pub const fn into_primitive(self) -> u32 {
256        match self {
257            Self::Pressed => 0,
258            Self::Released => 1,
259            Self::Cancelled => 2,
260            Self::Repeat => 3,
261            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
262        }
263    }
264
265    #[inline]
266    pub fn is_unknown(&self) -> bool {
267        match self {
268            Self::__SourceBreaking { unknown_ordinal: _ } => true,
269            _ => false,
270        }
271    }
272}
273
274/// Requests a specific keyboard type from the text editing subsystem.
275///
276/// This is most relevant for virtual keyboards which have some leeway in how
277/// the keyboard is presented to the user, as well as which input is acceptable.
278///
279/// For example, a `NUMBER` keyboard type may only allow decimal numbers to be
280/// entered.  In addition, a virtual keyboard might only show a numeric keypad
281/// for text entry.
282#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
283pub enum KeyboardType {
284    /// Single-line text fields only.  Use MULTILINE below for multiline text.
285    Text,
286    /// A text field intended for entering numbers only.
287    Number,
288    /// A text field for entering phone numbers only (e.g. digits, limited
289    /// punctuation, perhaps some validation).
290    Phone,
291    /// A text field for entering date and time. For example, may have a
292    /// calendar widget on the side, to aid in date time entry.
293    Datetime,
294    /// Multi-line text.
295    Multiline,
296    #[doc(hidden)]
297    __SourceBreaking { unknown_ordinal: u32 },
298}
299
300/// Pattern that matches an unknown `KeyboardType` member.
301#[macro_export]
302macro_rules! KeyboardTypeUnknown {
303    () => {
304        _
305    };
306}
307
308impl KeyboardType {
309    #[inline]
310    pub fn from_primitive(prim: u32) -> Option<Self> {
311        match prim {
312            0 => Some(Self::Text),
313            1 => Some(Self::Number),
314            2 => Some(Self::Phone),
315            3 => Some(Self::Datetime),
316            4 => Some(Self::Multiline),
317            _ => None,
318        }
319    }
320
321    #[inline]
322    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
323        match prim {
324            0 => Self::Text,
325            1 => Self::Number,
326            2 => Self::Phone,
327            3 => Self::Datetime,
328            4 => Self::Multiline,
329            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
330        }
331    }
332
333    #[inline]
334    pub fn unknown() -> Self {
335        Self::__SourceBreaking { unknown_ordinal: 0x0 }
336    }
337
338    #[inline]
339    pub const fn into_primitive(self) -> u32 {
340        match self {
341            Self::Text => 0,
342            Self::Number => 1,
343            Self::Phone => 2,
344            Self::Datetime => 3,
345            Self::Multiline => 4,
346            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
347        }
348    }
349
350    #[inline]
351    pub fn is_unknown(&self) -> bool {
352        match self {
353            Self::__SourceBreaking { unknown_ordinal: _ } => true,
354            _ => false,
355        }
356    }
357}
358
359#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
360#[repr(u32)]
361pub enum PointerEventPhase {
362    /// The device has started tracking the pointer.
363    ///
364    /// For example, the pointer might be hovering above the device, having not yet
365    /// made contact with the surface of the device.
366    Add = 0,
367    /// The pointer has moved with respect to the device while not in contact with
368    /// the device.
369    Hover = 1,
370    /// The pointer has made contact with the device.
371    ///
372    /// For `MOUSE` devices, this is triggered when the primary button is pressed
373    /// down to emulate a touch on the screen.
374    Down = 2,
375    /// The pointer has moved with respect to the device while in contact with the
376    /// device.
377    Move = 3,
378    /// The pointer has stopped making contact with the device.
379    ///
380    /// For `MOUSE` devices, this is triggered when the primary button is
381    /// released.
382    Up = 4,
383    /// The device is no longer tracking the pointer.
384    ///
385    /// For example, the pointer might have drifted out of the device's hover
386    /// detection range or might have been disconnected from the system entirely.
387    Remove = 5,
388    /// The input from the pointer is no longer directed towards this receiver.
389    Cancel = 6,
390}
391
392impl PointerEventPhase {
393    #[inline]
394    pub fn from_primitive(prim: u32) -> Option<Self> {
395        match prim {
396            0 => Some(Self::Add),
397            1 => Some(Self::Hover),
398            2 => Some(Self::Down),
399            3 => Some(Self::Move),
400            4 => Some(Self::Up),
401            5 => Some(Self::Remove),
402            6 => Some(Self::Cancel),
403            _ => None,
404        }
405    }
406
407    #[inline]
408    pub const fn into_primitive(self) -> u32 {
409        self as u32
410    }
411
412    #[deprecated = "Strict enums should not use `is_unknown`"]
413    #[inline]
414    pub fn is_unknown(&self) -> bool {
415        false
416    }
417}
418
419#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
420#[repr(u32)]
421pub enum PointerEventType {
422    /// A touch-based pointer device.
423    Touch = 0,
424    /// A pointer device with a stylus.
425    Stylus = 1,
426    /// A pointer device with a stylus that has been inverted.
427    InvertedStylus = 2,
428    /// A pointer device without a stylus.
429    Mouse = 3,
430}
431
432impl PointerEventType {
433    #[inline]
434    pub fn from_primitive(prim: u32) -> Option<Self> {
435        match prim {
436            0 => Some(Self::Touch),
437            1 => Some(Self::Stylus),
438            2 => Some(Self::InvertedStylus),
439            3 => Some(Self::Mouse),
440            _ => None,
441        }
442    }
443
444    #[inline]
445    pub const fn into_primitive(self) -> u32 {
446        self as u32
447    }
448
449    #[deprecated = "Strict enums should not use `is_unknown`"]
450    #[inline]
451    pub fn is_unknown(&self) -> bool {
452        false
453    }
454}
455
456#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
457pub enum SensorLocation {
458    Unknown,
459    Base,
460    Lid,
461    #[doc(hidden)]
462    __SourceBreaking {
463        unknown_ordinal: u32,
464    },
465}
466
467/// Pattern that matches an unknown `SensorLocation` member.
468#[macro_export]
469macro_rules! SensorLocationUnknown {
470    () => {
471        _
472    };
473}
474
475impl SensorLocation {
476    #[inline]
477    pub fn from_primitive(prim: u32) -> Option<Self> {
478        match prim {
479            0 => Some(Self::Unknown),
480            1 => Some(Self::Base),
481            2 => Some(Self::Lid),
482            _ => None,
483        }
484    }
485
486    #[inline]
487    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
488        match prim {
489            0 => Self::Unknown,
490            1 => Self::Base,
491            2 => Self::Lid,
492            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
493        }
494    }
495
496    #[inline]
497    pub fn unknown() -> Self {
498        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
499    }
500
501    #[inline]
502    pub const fn into_primitive(self) -> u32 {
503        match self {
504            Self::Unknown => 0,
505            Self::Base => 1,
506            Self::Lid => 2,
507            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
508        }
509    }
510
511    #[inline]
512    pub fn is_unknown(&self) -> bool {
513        match self {
514            Self::__SourceBreaking { unknown_ordinal: _ } => true,
515            _ => false,
516        }
517    }
518}
519
520#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
521pub enum SensorType {
522    Accelerometer,
523    Gyroscope,
524    Magnetometer,
525    Lightmeter,
526    #[doc(hidden)]
527    __SourceBreaking {
528        unknown_ordinal: u32,
529    },
530}
531
532/// Pattern that matches an unknown `SensorType` member.
533#[macro_export]
534macro_rules! SensorTypeUnknown {
535    () => {
536        _
537    };
538}
539
540impl SensorType {
541    #[inline]
542    pub fn from_primitive(prim: u32) -> Option<Self> {
543        match prim {
544            0 => Some(Self::Accelerometer),
545            1 => Some(Self::Gyroscope),
546            2 => Some(Self::Magnetometer),
547            3 => Some(Self::Lightmeter),
548            _ => None,
549        }
550    }
551
552    #[inline]
553    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
554        match prim {
555            0 => Self::Accelerometer,
556            1 => Self::Gyroscope,
557            2 => Self::Magnetometer,
558            3 => Self::Lightmeter,
559            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
560        }
561    }
562
563    #[inline]
564    pub fn unknown() -> Self {
565        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
566    }
567
568    #[inline]
569    pub const fn into_primitive(self) -> u32 {
570        match self {
571            Self::Accelerometer => 0,
572            Self::Gyroscope => 1,
573            Self::Magnetometer => 2,
574            Self::Lightmeter => 3,
575            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
576        }
577    }
578
579    #[inline]
580    pub fn is_unknown(&self) -> bool {
581        match self {
582            Self::__SourceBreaking { unknown_ordinal: _ } => true,
583            _ => false,
584        }
585    }
586}
587
588/// Whether a TextPosition is visually upstream or downstream of its offset.
589///
590/// For example, when a text position exists at a line break, a single offset has
591/// two visual positions, one prior to the line break (at the end of the first
592/// line) and one after the line break (at the start of the second line). A text
593/// affinity disambiguates between those cases. (Something similar happens with
594/// between runs of bidirectional text.)
595///
596/// We do not expect new values to be added to this enum.
597#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
598#[repr(u32)]
599pub enum TextAffinity {
600    /// The position has affinity for the upstream side of the text position.
601    ///
602    /// For example, if the offset of the text position is a line break, the
603    /// position represents the end of the first line.
604    Upstream = 0,
605    /// The position has affinity for the downstream side of the text position.
606    ///
607    /// For example, if the offset of the text position is a line break, the
608    /// position represents the start of the second line.
609    Downstream = 1,
610}
611
612impl TextAffinity {
613    #[inline]
614    pub fn from_primitive(prim: u32) -> Option<Self> {
615        match prim {
616            0 => Some(Self::Upstream),
617            1 => Some(Self::Downstream),
618            _ => None,
619        }
620    }
621
622    #[inline]
623    pub const fn into_primitive(self) -> u32 {
624        self as u32
625    }
626
627    #[deprecated = "Strict enums should not use `is_unknown`"]
628    #[inline]
629    pub fn is_unknown(&self) -> bool {
630        false
631    }
632}
633
634#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
635pub struct Axis {
636    pub range: Range,
637    pub resolution: i32,
638    pub scale: AxisScale,
639}
640
641impl fidl::Persistable for Axis {}
642
643#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
644pub struct AxisF {
645    pub range: RangeF,
646    pub resolution: f32,
647    pub scale: AxisScale,
648}
649
650impl fidl::Persistable for AxisF {}
651
652#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
653pub struct DeviceDescriptor {
654    pub device_info: Option<Box<DeviceInfo>>,
655    pub keyboard: Option<Box<KeyboardDescriptor>>,
656    pub media_buttons: Option<Box<MediaButtonsDescriptor>>,
657    pub mouse: Option<Box<MouseDescriptor>>,
658    pub stylus: Option<Box<StylusDescriptor>>,
659    pub touchscreen: Option<Box<TouchscreenDescriptor>>,
660    pub sensor: Option<Box<SensorDescriptor>>,
661}
662
663impl fidl::Persistable for DeviceDescriptor {}
664
665#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
666pub struct DeviceInfo {
667    pub vendor_id: u32,
668    pub product_id: u32,
669    pub version: u32,
670    pub name: String,
671}
672
673impl fidl::Persistable for DeviceInfo {}
674
675#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
676pub struct FocusEvent {
677    /// Time the event was delivered. The time is in nanoseconds and corresponds
678    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
679    pub event_time: u64,
680    /// Whether the view has gained input focused or not.
681    pub focused: bool,
682}
683
684impl fidl::Persistable for FocusEvent {}
685
686#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
687pub struct ImeServiceGetInputMethodEditorRequest {
688    pub keyboard_type: KeyboardType,
689    pub action: InputMethodAction,
690    pub initial_state: TextInputState,
691    pub client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
692    pub editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
693}
694
695impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
696    for ImeServiceGetInputMethodEditorRequest
697{
698}
699
700#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
701pub struct InputDeviceDispatchReportRequest {
702    pub report: InputReport,
703}
704
705impl fidl::Persistable for InputDeviceDispatchReportRequest {}
706
707#[derive(Clone, Debug, PartialEq, PartialOrd)]
708pub struct InputMethodEditorClientDidUpdateStateRequest {
709    pub state: TextInputState,
710    pub event: Option<Box<InputEvent>>,
711}
712
713impl fidl::Persistable for InputMethodEditorClientDidUpdateStateRequest {}
714
715#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
716pub struct InputMethodEditorClientOnActionRequest {
717    pub action: InputMethodAction,
718}
719
720impl fidl::Persistable for InputMethodEditorClientOnActionRequest {}
721
722#[derive(Clone, Debug, PartialEq)]
723pub struct InputMethodEditorDispatchKey3Request {
724    pub event: fidl_fuchsia_ui_input3::KeyEvent,
725}
726
727impl fidl::Persistable for InputMethodEditorDispatchKey3Request {}
728
729#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
730pub struct InputMethodEditorDispatchKey3Response {
731    pub handled: bool,
732}
733
734impl fidl::Persistable for InputMethodEditorDispatchKey3Response {}
735
736#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
737pub struct InputMethodEditorInjectInputRequest {
738    pub event: InputEvent,
739}
740
741impl fidl::Persistable for InputMethodEditorInjectInputRequest {}
742
743#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
744pub struct InputMethodEditorSetKeyboardTypeRequest {
745    pub keyboard_type: KeyboardType,
746}
747
748impl fidl::Persistable for InputMethodEditorSetKeyboardTypeRequest {}
749
750#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
751pub struct InputMethodEditorSetStateRequest {
752    pub state: TextInputState,
753}
754
755impl fidl::Persistable for InputMethodEditorSetStateRequest {}
756
757#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
758pub struct InputReport {
759    pub event_time: u64,
760    pub keyboard: Option<Box<KeyboardReport>>,
761    pub media_buttons: Option<Box<MediaButtonsReport>>,
762    pub mouse: Option<Box<MouseReport>>,
763    pub stylus: Option<Box<StylusReport>>,
764    pub touchscreen: Option<Box<TouchscreenReport>>,
765    pub sensor: Option<Box<SensorReport>>,
766    pub trace_id: u64,
767}
768
769impl fidl::Persistable for InputReport {}
770
771#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
772pub struct KeyboardDescriptor {
773    pub keys: Vec<u32>,
774}
775
776impl fidl::Persistable for KeyboardDescriptor {}
777
778/// `KeyboardEvent` represents event generated by a user's interaction with a
779/// keyboard.
780///
781/// Those events are triggered by distinct pressed state changes of the keys.
782///
783/// The state transitions should be as follows:
784/// PRESSED -> (REPEAT ->) RELEASED
785/// or
786/// PRESSED -> (REPEAT ->) CANCELLED
787///
788/// The input system will repeat those events automatically when a code_point is
789/// available.
790///
791/// DEPRECATED: Will be removed in favor of `fuchsia.ui.input.KeyEvent`.
792#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
793pub struct KeyboardEvent {
794    /// Time the event was delivered. The time is in nanoseconds and corresponds
795    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
796    pub event_time: u64,
797    pub device_id: u32,
798    pub phase: KeyboardEventPhase,
799    /// Keyboard HID Usage
800    /// See https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
801    pub hid_usage: u32,
802    /// The unicode code point represented by this key event, if any.
803    /// Dead keys are represented as Unicode combining characters.
804    ///
805    /// If there is no unicode code point, this value is zero.
806    pub code_point: u32,
807    /// Key modifiers as defined by the different kModifier constants such as
808    /// `kModifierCapsLock` currently pressed
809    pub modifiers: u32,
810}
811
812impl fidl::Persistable for KeyboardEvent {}
813
814#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
815pub struct KeyboardReport {
816    pub pressed_keys: Vec<u32>,
817}
818
819impl fidl::Persistable for KeyboardReport {}
820
821#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
822#[repr(C)]
823pub struct MediaButtonsDescriptor {
824    pub buttons: u32,
825}
826
827impl fidl::Persistable for MediaButtonsDescriptor {}
828
829/// `MediaButtonsReport` describes the media buttons event delivered from the event stream.
830/// Each bool in the report represents a single button where true means the button
831/// is being pressed. A single report should be sent on every state change.
832#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
833pub struct MediaButtonsReport {
834    pub volume_up: bool,
835    pub volume_down: bool,
836    pub mic_mute: bool,
837    pub reset: bool,
838    pub pause: bool,
839    pub camera_disable: bool,
840}
841
842impl fidl::Persistable for MediaButtonsReport {}
843
844#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
845pub struct MouseDescriptor {
846    pub rel_x: Axis,
847    pub rel_y: Axis,
848    pub vscroll: Option<Box<Axis>>,
849    pub hscroll: Option<Box<Axis>>,
850    pub buttons: u32,
851}
852
853impl fidl::Persistable for MouseDescriptor {}
854
855#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
856#[repr(C)]
857pub struct MouseReport {
858    pub rel_x: i32,
859    pub rel_y: i32,
860    pub rel_hscroll: i32,
861    pub rel_vscroll: i32,
862    pub pressed_buttons: u32,
863}
864
865impl fidl::Persistable for MouseReport {}
866
867/// Pointers represent raw data about the user's interaction with the screen.
868///
869/// The state transitions should be as follows:
870/// ADD (-> HOVER) -> DOWN -> MOVE -> UP (-> HOVER) -> REMOVE
871///
872/// At any point after the initial ADD, a transition to CANCEL is also possible.
873#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
874pub struct PointerEvent {
875    /// Time the event was delivered. The time is in nanoseconds and corresponds
876    /// to the monotonic time as determined by the zx_clock_get_monotonic syscall.
877    pub event_time: u64,
878    pub device_id: u32,
879    pub pointer_id: u32,
880    pub type_: PointerEventType,
881    pub phase: PointerEventPhase,
882    /// `x` and `y` are in the coordinate system of the View.
883    pub x: f32,
884    pub y: f32,
885    pub radius_major: f32,
886    pub radius_minor: f32,
887    /// Currently pressed buttons as defined the kButton constants such as
888    /// `kMousePrimaryButton`
889    pub buttons: u32,
890}
891
892impl fidl::Persistable for PointerEvent {}
893
894#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
895#[repr(C)]
896pub struct Range {
897    pub min: i32,
898    pub max: i32,
899}
900
901impl fidl::Persistable for Range {}
902
903#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
904pub struct RangeF {
905    pub min: f32,
906    pub max: f32,
907}
908
909impl fidl::Persistable for RangeF {}
910
911#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
912pub struct SendKeyboardInputCmd {
913    pub compositor_id: u32,
914    pub keyboard_event: KeyboardEvent,
915}
916
917impl fidl::Persistable for SendKeyboardInputCmd {}
918
919#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
920pub struct SendPointerInputCmd {
921    pub compositor_id: u32,
922    pub pointer_event: PointerEvent,
923}
924
925impl fidl::Persistable for SendPointerInputCmd {}
926
927#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
928pub struct SensorDescriptor {
929    pub type_: SensorType,
930    pub loc: SensorLocation,
931    pub min_sampling_freq: u32,
932    pub max_sampling_freq: u32,
933    pub fifo_max_event_count: u32,
934    pub phys_min: i32,
935    pub phys_max: i32,
936}
937
938impl fidl::Persistable for SensorDescriptor {}
939
940#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
941pub struct SetHardKeyboardDeliveryCmd {
942    pub delivery_request: bool,
943}
944
945impl fidl::Persistable for SetHardKeyboardDeliveryCmd {}
946
947#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
948pub struct SetParallelDispatchCmd {
949    pub parallel_dispatch: bool,
950}
951
952impl fidl::Persistable for SetParallelDispatchCmd {}
953
954#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
955pub struct StylusDescriptor {
956    pub x: Axis,
957    pub y: Axis,
958    pub pressure: Option<Box<Axis>>,
959    pub is_invertible: bool,
960    pub buttons: u32,
961}
962
963impl fidl::Persistable for StylusDescriptor {}
964
965#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
966pub struct StylusReport {
967    pub x: i32,
968    pub y: i32,
969    pub pressure: u32,
970    pub is_in_contact: bool,
971    pub in_range: bool,
972    pub is_inverted: bool,
973    pub pressed_buttons: u32,
974}
975
976impl fidl::Persistable for StylusReport {}
977
978/// The current text, selection, and composing state for editing a run of text.
979#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
980pub struct TextInputState {
981    /// Current state revision to avoid race conditions.
982    pub revision: u32,
983    /// The current text being edited.
984    pub text: String,
985    /// The range of text that is currently selected.
986    pub selection: TextSelection,
987    /// The range of text that is still being composed.
988    pub composing: TextRange,
989}
990
991impl fidl::Persistable for TextInputState {}
992
993/// A range of characters in a string of text. Although strings in FIDL's wire
994/// format are UTF-8 encoded, these indices are measured in UTF-16 code units
995/// for legacy reasons. These text input APIs will eventually be replaced by
996/// fuchsia.ui.text, which uses code points instead.
997#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
998#[repr(C)]
999pub struct TextRange {
1000    /// The index of the first UTF-16 code unit in the range.
1001    ///
1002    /// If `start` and `end` are both -1, the text range is empty.
1003    pub start: i64,
1004    /// The next index after the last UTF-16 code unit in this range.
1005    ///
1006    /// If `start` and `end` are both -1, the text range is empty.
1007    pub end: i64,
1008}
1009
1010impl fidl::Persistable for TextRange {}
1011
1012/// A range of text that represents a selection. Although strings in FIDL's wire
1013/// format are UTF-8 encoded, these indices are measured in UTF-16 code units
1014/// for legacy reasons. These text input APIs will eventually be replaced by
1015/// fuchsia.ui.text, which uses code points instead.
1016///
1017/// Text selection is always directional. Direction should be determined by
1018/// comparing base and extent.
1019#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1020pub struct TextSelection {
1021    /// The offset at which the selection originates, as measured in UTF-16 code units.
1022    ///
1023    /// Might be larger than, smaller than, or equal to extent.
1024    pub base: i64,
1025    /// The offset at which the selection terminates, as measured in UTF-16 code units.
1026    ///
1027    /// When the user uses the arrow keys to adjust the selection, this is the
1028    /// value that changes. Similarly, if the current theme paints a caret on one
1029    /// side of the selection, this is the location at which to paint the caret.
1030    ///
1031    /// Might be larger than, smaller than, or equal to base.
1032    pub extent: i64,
1033    /// If the text range is collapsed and has more than one visual location
1034    /// (e.g., occurs at a line break), which of the two locations to use when
1035    /// painting the caret.
1036    pub affinity: TextAffinity,
1037}
1038
1039impl fidl::Persistable for TextSelection {}
1040
1041#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1042#[repr(C)]
1043pub struct Touch {
1044    pub finger_id: u32,
1045    pub x: i32,
1046    pub y: i32,
1047    pub width: u32,
1048    pub height: u32,
1049}
1050
1051impl fidl::Persistable for Touch {}
1052
1053#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1054pub struct TouchscreenDescriptor {
1055    pub x: Axis,
1056    pub y: Axis,
1057    pub max_finger_id: u32,
1058}
1059
1060impl fidl::Persistable for TouchscreenDescriptor {}
1061
1062#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1063pub struct TouchscreenReport {
1064    pub touches: Vec<Touch>,
1065}
1066
1067impl fidl::Persistable for TouchscreenReport {}
1068
1069#[derive(Clone, Debug, Default, PartialEq)]
1070pub struct MediaButtonsEvent {
1071    pub volume: Option<i8>,
1072    pub mic_mute: Option<bool>,
1073    pub pause: Option<bool>,
1074    pub camera_disable: Option<bool>,
1075    pub power: Option<bool>,
1076    pub function: Option<bool>,
1077    pub device_id: Option<u32>,
1078    #[doc(hidden)]
1079    pub __source_breaking: fidl::marker::SourceBreaking,
1080}
1081
1082impl fidl::Persistable for MediaButtonsEvent {}
1083
1084#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1085pub enum Command {
1086    SendKeyboardInput(SendKeyboardInputCmd),
1087    SendPointerInput(SendPointerInputCmd),
1088    SetHardKeyboardDelivery(SetHardKeyboardDeliveryCmd),
1089    SetParallelDispatch(SetParallelDispatchCmd),
1090}
1091
1092impl Command {
1093    #[inline]
1094    pub fn ordinal(&self) -> u64 {
1095        match *self {
1096            Self::SendKeyboardInput(_) => 1,
1097            Self::SendPointerInput(_) => 2,
1098            Self::SetHardKeyboardDelivery(_) => 3,
1099            Self::SetParallelDispatch(_) => 4,
1100        }
1101    }
1102
1103    #[deprecated = "Strict unions should not use `is_unknown`"]
1104    #[inline]
1105    pub fn is_unknown(&self) -> bool {
1106        false
1107    }
1108}
1109
1110impl fidl::Persistable for Command {}
1111
1112#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1113pub enum InputEvent {
1114    Pointer(PointerEvent),
1115    Keyboard(KeyboardEvent),
1116    Focus(FocusEvent),
1117}
1118
1119impl InputEvent {
1120    #[inline]
1121    pub fn ordinal(&self) -> u64 {
1122        match *self {
1123            Self::Pointer(_) => 1,
1124            Self::Keyboard(_) => 2,
1125            Self::Focus(_) => 3,
1126        }
1127    }
1128
1129    #[deprecated = "Strict unions should not use `is_unknown`"]
1130    #[inline]
1131    pub fn is_unknown(&self) -> bool {
1132        false
1133    }
1134}
1135
1136impl fidl::Persistable for InputEvent {}
1137
1138#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1139pub enum SensorReport {
1140    Vector([i16; 3]),
1141    Scalar(u16),
1142}
1143
1144impl SensorReport {
1145    #[inline]
1146    pub fn ordinal(&self) -> u64 {
1147        match *self {
1148            Self::Vector(_) => 1,
1149            Self::Scalar(_) => 2,
1150        }
1151    }
1152
1153    #[deprecated = "Strict unions should not use `is_unknown`"]
1154    #[inline]
1155    pub fn is_unknown(&self) -> bool {
1156        false
1157    }
1158}
1159
1160impl fidl::Persistable for SensorReport {}
1161
1162#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1163pub struct ImeServiceMarker;
1164
1165impl fidl::endpoints::ProtocolMarker for ImeServiceMarker {
1166    type Proxy = ImeServiceProxy;
1167    type RequestStream = ImeServiceRequestStream;
1168    #[cfg(target_os = "fuchsia")]
1169    type SynchronousProxy = ImeServiceSynchronousProxy;
1170
1171    const DEBUG_NAME: &'static str = "fuchsia.ui.input.ImeService";
1172}
1173impl fidl::endpoints::DiscoverableProtocolMarker for ImeServiceMarker {}
1174
1175pub trait ImeServiceProxyInterface: Send + Sync {
1176    fn r#get_input_method_editor(
1177        &self,
1178        keyboard_type: KeyboardType,
1179        action: InputMethodAction,
1180        initial_state: &TextInputState,
1181        client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
1182        editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
1183    ) -> Result<(), fidl::Error>;
1184    fn r#show_keyboard(&self) -> Result<(), fidl::Error>;
1185    fn r#hide_keyboard(&self) -> Result<(), fidl::Error>;
1186}
1187#[derive(Debug)]
1188#[cfg(target_os = "fuchsia")]
1189pub struct ImeServiceSynchronousProxy {
1190    client: fidl::client::sync::Client,
1191}
1192
1193#[cfg(target_os = "fuchsia")]
1194impl fidl::endpoints::SynchronousProxy for ImeServiceSynchronousProxy {
1195    type Proxy = ImeServiceProxy;
1196    type Protocol = ImeServiceMarker;
1197
1198    fn from_channel(inner: fidl::Channel) -> Self {
1199        Self::new(inner)
1200    }
1201
1202    fn into_channel(self) -> fidl::Channel {
1203        self.client.into_channel()
1204    }
1205
1206    fn as_channel(&self) -> &fidl::Channel {
1207        self.client.as_channel()
1208    }
1209}
1210
1211#[cfg(target_os = "fuchsia")]
1212impl ImeServiceSynchronousProxy {
1213    pub fn new(channel: fidl::Channel) -> Self {
1214        let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1215        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1216    }
1217
1218    pub fn into_channel(self) -> fidl::Channel {
1219        self.client.into_channel()
1220    }
1221
1222    /// Waits until an event arrives and returns it. It is safe for other
1223    /// threads to make concurrent requests while waiting for an event.
1224    pub fn wait_for_event(
1225        &self,
1226        deadline: zx::MonotonicInstant,
1227    ) -> Result<ImeServiceEvent, fidl::Error> {
1228        ImeServiceEvent::decode(self.client.wait_for_event(deadline)?)
1229    }
1230
1231    pub fn r#get_input_method_editor(
1232        &self,
1233        mut keyboard_type: KeyboardType,
1234        mut action: InputMethodAction,
1235        mut initial_state: &TextInputState,
1236        mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
1237        mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
1238    ) -> Result<(), fidl::Error> {
1239        self.client.send::<ImeServiceGetInputMethodEditorRequest>(
1240            (keyboard_type, action, initial_state, client, editor),
1241            0x148d2e42a1f461fc,
1242            fidl::encoding::DynamicFlags::empty(),
1243        )
1244    }
1245
1246    pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
1247        self.client.send::<fidl::encoding::EmptyPayload>(
1248            (),
1249            0x38ed2a1de28cfcf0,
1250            fidl::encoding::DynamicFlags::empty(),
1251        )
1252    }
1253
1254    pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
1255        self.client.send::<fidl::encoding::EmptyPayload>(
1256            (),
1257            0x7667f098198d09fd,
1258            fidl::encoding::DynamicFlags::empty(),
1259        )
1260    }
1261}
1262
1263#[derive(Debug, Clone)]
1264pub struct ImeServiceProxy {
1265    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1266}
1267
1268impl fidl::endpoints::Proxy for ImeServiceProxy {
1269    type Protocol = ImeServiceMarker;
1270
1271    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1272        Self::new(inner)
1273    }
1274
1275    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1276        self.client.into_channel().map_err(|client| Self { client })
1277    }
1278
1279    fn as_channel(&self) -> &::fidl::AsyncChannel {
1280        self.client.as_channel()
1281    }
1282}
1283
1284impl ImeServiceProxy {
1285    /// Create a new Proxy for fuchsia.ui.input/ImeService.
1286    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1287        let protocol_name = <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1288        Self { client: fidl::client::Client::new(channel, protocol_name) }
1289    }
1290
1291    /// Get a Stream of events from the remote end of the protocol.
1292    ///
1293    /// # Panics
1294    ///
1295    /// Panics if the event stream was already taken.
1296    pub fn take_event_stream(&self) -> ImeServiceEventStream {
1297        ImeServiceEventStream { event_receiver: self.client.take_event_receiver() }
1298    }
1299
1300    pub fn r#get_input_method_editor(
1301        &self,
1302        mut keyboard_type: KeyboardType,
1303        mut action: InputMethodAction,
1304        mut initial_state: &TextInputState,
1305        mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
1306        mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
1307    ) -> Result<(), fidl::Error> {
1308        ImeServiceProxyInterface::r#get_input_method_editor(
1309            self,
1310            keyboard_type,
1311            action,
1312            initial_state,
1313            client,
1314            editor,
1315        )
1316    }
1317
1318    pub fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
1319        ImeServiceProxyInterface::r#show_keyboard(self)
1320    }
1321
1322    pub fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
1323        ImeServiceProxyInterface::r#hide_keyboard(self)
1324    }
1325}
1326
1327impl ImeServiceProxyInterface for ImeServiceProxy {
1328    fn r#get_input_method_editor(
1329        &self,
1330        mut keyboard_type: KeyboardType,
1331        mut action: InputMethodAction,
1332        mut initial_state: &TextInputState,
1333        mut client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
1334        mut editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
1335    ) -> Result<(), fidl::Error> {
1336        self.client.send::<ImeServiceGetInputMethodEditorRequest>(
1337            (keyboard_type, action, initial_state, client, editor),
1338            0x148d2e42a1f461fc,
1339            fidl::encoding::DynamicFlags::empty(),
1340        )
1341    }
1342
1343    fn r#show_keyboard(&self) -> Result<(), fidl::Error> {
1344        self.client.send::<fidl::encoding::EmptyPayload>(
1345            (),
1346            0x38ed2a1de28cfcf0,
1347            fidl::encoding::DynamicFlags::empty(),
1348        )
1349    }
1350
1351    fn r#hide_keyboard(&self) -> Result<(), fidl::Error> {
1352        self.client.send::<fidl::encoding::EmptyPayload>(
1353            (),
1354            0x7667f098198d09fd,
1355            fidl::encoding::DynamicFlags::empty(),
1356        )
1357    }
1358}
1359
1360pub struct ImeServiceEventStream {
1361    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1362}
1363
1364impl std::marker::Unpin for ImeServiceEventStream {}
1365
1366impl futures::stream::FusedStream for ImeServiceEventStream {
1367    fn is_terminated(&self) -> bool {
1368        self.event_receiver.is_terminated()
1369    }
1370}
1371
1372impl futures::Stream for ImeServiceEventStream {
1373    type Item = Result<ImeServiceEvent, fidl::Error>;
1374
1375    fn poll_next(
1376        mut self: std::pin::Pin<&mut Self>,
1377        cx: &mut std::task::Context<'_>,
1378    ) -> std::task::Poll<Option<Self::Item>> {
1379        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1380            &mut self.event_receiver,
1381            cx
1382        )?) {
1383            Some(buf) => std::task::Poll::Ready(Some(ImeServiceEvent::decode(buf))),
1384            None => std::task::Poll::Ready(None),
1385        }
1386    }
1387}
1388
1389#[derive(Debug)]
1390pub enum ImeServiceEvent {}
1391
1392impl ImeServiceEvent {
1393    /// Decodes a message buffer as a [`ImeServiceEvent`].
1394    fn decode(
1395        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1396    ) -> Result<ImeServiceEvent, fidl::Error> {
1397        let (bytes, _handles) = buf.split_mut();
1398        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1399        debug_assert_eq!(tx_header.tx_id, 0);
1400        match tx_header.ordinal {
1401            _ => Err(fidl::Error::UnknownOrdinal {
1402                ordinal: tx_header.ordinal,
1403                protocol_name: <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1404            }),
1405        }
1406    }
1407}
1408
1409/// A Stream of incoming requests for fuchsia.ui.input/ImeService.
1410pub struct ImeServiceRequestStream {
1411    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1412    is_terminated: bool,
1413}
1414
1415impl std::marker::Unpin for ImeServiceRequestStream {}
1416
1417impl futures::stream::FusedStream for ImeServiceRequestStream {
1418    fn is_terminated(&self) -> bool {
1419        self.is_terminated
1420    }
1421}
1422
1423impl fidl::endpoints::RequestStream for ImeServiceRequestStream {
1424    type Protocol = ImeServiceMarker;
1425    type ControlHandle = ImeServiceControlHandle;
1426
1427    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1428        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1429    }
1430
1431    fn control_handle(&self) -> Self::ControlHandle {
1432        ImeServiceControlHandle { inner: self.inner.clone() }
1433    }
1434
1435    fn into_inner(
1436        self,
1437    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1438    {
1439        (self.inner, self.is_terminated)
1440    }
1441
1442    fn from_inner(
1443        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1444        is_terminated: bool,
1445    ) -> Self {
1446        Self { inner, is_terminated }
1447    }
1448}
1449
1450impl futures::Stream for ImeServiceRequestStream {
1451    type Item = Result<ImeServiceRequest, fidl::Error>;
1452
1453    fn poll_next(
1454        mut self: std::pin::Pin<&mut Self>,
1455        cx: &mut std::task::Context<'_>,
1456    ) -> std::task::Poll<Option<Self::Item>> {
1457        let this = &mut *self;
1458        if this.inner.check_shutdown(cx) {
1459            this.is_terminated = true;
1460            return std::task::Poll::Ready(None);
1461        }
1462        if this.is_terminated {
1463            panic!("polled ImeServiceRequestStream after completion");
1464        }
1465        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1466            |bytes, handles| {
1467                match this.inner.channel().read_etc(cx, bytes, handles) {
1468                    std::task::Poll::Ready(Ok(())) => {}
1469                    std::task::Poll::Pending => return std::task::Poll::Pending,
1470                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1471                        this.is_terminated = true;
1472                        return std::task::Poll::Ready(None);
1473                    }
1474                    std::task::Poll::Ready(Err(e)) => {
1475                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1476                            e.into(),
1477                        ))))
1478                    }
1479                }
1480
1481                // A message has been received from the channel
1482                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1483
1484                std::task::Poll::Ready(Some(match header.ordinal {
1485                    0x148d2e42a1f461fc => {
1486                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1487                        let mut req = fidl::new_empty!(
1488                            ImeServiceGetInputMethodEditorRequest,
1489                            fidl::encoding::DefaultFuchsiaResourceDialect
1490                        );
1491                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ImeServiceGetInputMethodEditorRequest>(&header, _body_bytes, handles, &mut req)?;
1492                        let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
1493                        Ok(ImeServiceRequest::GetInputMethodEditor {
1494                            keyboard_type: req.keyboard_type,
1495                            action: req.action,
1496                            initial_state: req.initial_state,
1497                            client: req.client,
1498                            editor: req.editor,
1499
1500                            control_handle,
1501                        })
1502                    }
1503                    0x38ed2a1de28cfcf0 => {
1504                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1505                        let mut req = fidl::new_empty!(
1506                            fidl::encoding::EmptyPayload,
1507                            fidl::encoding::DefaultFuchsiaResourceDialect
1508                        );
1509                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1510                        let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
1511                        Ok(ImeServiceRequest::ShowKeyboard { control_handle })
1512                    }
1513                    0x7667f098198d09fd => {
1514                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1515                        let mut req = fidl::new_empty!(
1516                            fidl::encoding::EmptyPayload,
1517                            fidl::encoding::DefaultFuchsiaResourceDialect
1518                        );
1519                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1520                        let control_handle = ImeServiceControlHandle { inner: this.inner.clone() };
1521                        Ok(ImeServiceRequest::HideKeyboard { control_handle })
1522                    }
1523                    _ => Err(fidl::Error::UnknownOrdinal {
1524                        ordinal: header.ordinal,
1525                        protocol_name:
1526                            <ImeServiceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1527                    }),
1528                }))
1529            },
1530        )
1531    }
1532}
1533
1534/// The service provided by an IME
1535#[derive(Debug)]
1536pub enum ImeServiceRequest {
1537    GetInputMethodEditor {
1538        keyboard_type: KeyboardType,
1539        action: InputMethodAction,
1540        initial_state: TextInputState,
1541        client: fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
1542        editor: fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
1543        control_handle: ImeServiceControlHandle,
1544    },
1545    ShowKeyboard {
1546        control_handle: ImeServiceControlHandle,
1547    },
1548    HideKeyboard {
1549        control_handle: ImeServiceControlHandle,
1550    },
1551}
1552
1553impl ImeServiceRequest {
1554    #[allow(irrefutable_let_patterns)]
1555    pub fn into_get_input_method_editor(
1556        self,
1557    ) -> Option<(
1558        KeyboardType,
1559        InputMethodAction,
1560        TextInputState,
1561        fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
1562        fidl::endpoints::ServerEnd<InputMethodEditorMarker>,
1563        ImeServiceControlHandle,
1564    )> {
1565        if let ImeServiceRequest::GetInputMethodEditor {
1566            keyboard_type,
1567            action,
1568            initial_state,
1569            client,
1570            editor,
1571            control_handle,
1572        } = self
1573        {
1574            Some((keyboard_type, action, initial_state, client, editor, control_handle))
1575        } else {
1576            None
1577        }
1578    }
1579
1580    #[allow(irrefutable_let_patterns)]
1581    pub fn into_show_keyboard(self) -> Option<(ImeServiceControlHandle)> {
1582        if let ImeServiceRequest::ShowKeyboard { control_handle } = self {
1583            Some((control_handle))
1584        } else {
1585            None
1586        }
1587    }
1588
1589    #[allow(irrefutable_let_patterns)]
1590    pub fn into_hide_keyboard(self) -> Option<(ImeServiceControlHandle)> {
1591        if let ImeServiceRequest::HideKeyboard { control_handle } = self {
1592            Some((control_handle))
1593        } else {
1594            None
1595        }
1596    }
1597
1598    /// Name of the method defined in FIDL
1599    pub fn method_name(&self) -> &'static str {
1600        match *self {
1601            ImeServiceRequest::GetInputMethodEditor { .. } => "get_input_method_editor",
1602            ImeServiceRequest::ShowKeyboard { .. } => "show_keyboard",
1603            ImeServiceRequest::HideKeyboard { .. } => "hide_keyboard",
1604        }
1605    }
1606}
1607
1608#[derive(Debug, Clone)]
1609pub struct ImeServiceControlHandle {
1610    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1611}
1612
1613impl fidl::endpoints::ControlHandle for ImeServiceControlHandle {
1614    fn shutdown(&self) {
1615        self.inner.shutdown()
1616    }
1617    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1618        self.inner.shutdown_with_epitaph(status)
1619    }
1620
1621    fn is_closed(&self) -> bool {
1622        self.inner.channel().is_closed()
1623    }
1624    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1625        self.inner.channel().on_closed()
1626    }
1627
1628    #[cfg(target_os = "fuchsia")]
1629    fn signal_peer(
1630        &self,
1631        clear_mask: zx::Signals,
1632        set_mask: zx::Signals,
1633    ) -> Result<(), zx_status::Status> {
1634        use fidl::Peered;
1635        self.inner.channel().signal_peer(clear_mask, set_mask)
1636    }
1637}
1638
1639impl ImeServiceControlHandle {}
1640
1641#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1642pub struct InputDeviceMarker;
1643
1644impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
1645    type Proxy = InputDeviceProxy;
1646    type RequestStream = InputDeviceRequestStream;
1647    #[cfg(target_os = "fuchsia")]
1648    type SynchronousProxy = InputDeviceSynchronousProxy;
1649
1650    const DEBUG_NAME: &'static str = "(anonymous) InputDevice";
1651}
1652
1653pub trait InputDeviceProxyInterface: Send + Sync {
1654    fn r#dispatch_report(&self, report: &InputReport) -> Result<(), fidl::Error>;
1655}
1656#[derive(Debug)]
1657#[cfg(target_os = "fuchsia")]
1658pub struct InputDeviceSynchronousProxy {
1659    client: fidl::client::sync::Client,
1660}
1661
1662#[cfg(target_os = "fuchsia")]
1663impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
1664    type Proxy = InputDeviceProxy;
1665    type Protocol = InputDeviceMarker;
1666
1667    fn from_channel(inner: fidl::Channel) -> Self {
1668        Self::new(inner)
1669    }
1670
1671    fn into_channel(self) -> fidl::Channel {
1672        self.client.into_channel()
1673    }
1674
1675    fn as_channel(&self) -> &fidl::Channel {
1676        self.client.as_channel()
1677    }
1678}
1679
1680#[cfg(target_os = "fuchsia")]
1681impl InputDeviceSynchronousProxy {
1682    pub fn new(channel: fidl::Channel) -> Self {
1683        let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1684        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1685    }
1686
1687    pub fn into_channel(self) -> fidl::Channel {
1688        self.client.into_channel()
1689    }
1690
1691    /// Waits until an event arrives and returns it. It is safe for other
1692    /// threads to make concurrent requests while waiting for an event.
1693    pub fn wait_for_event(
1694        &self,
1695        deadline: zx::MonotonicInstant,
1696    ) -> Result<InputDeviceEvent, fidl::Error> {
1697        InputDeviceEvent::decode(self.client.wait_for_event(deadline)?)
1698    }
1699
1700    /// Dispatch an `InputReport` from the device `token`
1701    pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
1702        self.client.send::<InputDeviceDispatchReportRequest>(
1703            (report,),
1704            0x7ee375d01c8e149f,
1705            fidl::encoding::DynamicFlags::empty(),
1706        )
1707    }
1708}
1709
1710#[derive(Debug, Clone)]
1711pub struct InputDeviceProxy {
1712    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1713}
1714
1715impl fidl::endpoints::Proxy for InputDeviceProxy {
1716    type Protocol = InputDeviceMarker;
1717
1718    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1719        Self::new(inner)
1720    }
1721
1722    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1723        self.client.into_channel().map_err(|client| Self { client })
1724    }
1725
1726    fn as_channel(&self) -> &::fidl::AsyncChannel {
1727        self.client.as_channel()
1728    }
1729}
1730
1731impl InputDeviceProxy {
1732    /// Create a new Proxy for fuchsia.ui.input/InputDevice.
1733    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1734        let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1735        Self { client: fidl::client::Client::new(channel, protocol_name) }
1736    }
1737
1738    /// Get a Stream of events from the remote end of the protocol.
1739    ///
1740    /// # Panics
1741    ///
1742    /// Panics if the event stream was already taken.
1743    pub fn take_event_stream(&self) -> InputDeviceEventStream {
1744        InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
1745    }
1746
1747    /// Dispatch an `InputReport` from the device `token`
1748    pub fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
1749        InputDeviceProxyInterface::r#dispatch_report(self, report)
1750    }
1751}
1752
1753impl InputDeviceProxyInterface for InputDeviceProxy {
1754    fn r#dispatch_report(&self, mut report: &InputReport) -> Result<(), fidl::Error> {
1755        self.client.send::<InputDeviceDispatchReportRequest>(
1756            (report,),
1757            0x7ee375d01c8e149f,
1758            fidl::encoding::DynamicFlags::empty(),
1759        )
1760    }
1761}
1762
1763pub struct InputDeviceEventStream {
1764    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1765}
1766
1767impl std::marker::Unpin for InputDeviceEventStream {}
1768
1769impl futures::stream::FusedStream for InputDeviceEventStream {
1770    fn is_terminated(&self) -> bool {
1771        self.event_receiver.is_terminated()
1772    }
1773}
1774
1775impl futures::Stream for InputDeviceEventStream {
1776    type Item = Result<InputDeviceEvent, fidl::Error>;
1777
1778    fn poll_next(
1779        mut self: std::pin::Pin<&mut Self>,
1780        cx: &mut std::task::Context<'_>,
1781    ) -> std::task::Poll<Option<Self::Item>> {
1782        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1783            &mut self.event_receiver,
1784            cx
1785        )?) {
1786            Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
1787            None => std::task::Poll::Ready(None),
1788        }
1789    }
1790}
1791
1792#[derive(Debug)]
1793pub enum InputDeviceEvent {}
1794
1795impl InputDeviceEvent {
1796    /// Decodes a message buffer as a [`InputDeviceEvent`].
1797    fn decode(
1798        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1799    ) -> Result<InputDeviceEvent, fidl::Error> {
1800        let (bytes, _handles) = buf.split_mut();
1801        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1802        debug_assert_eq!(tx_header.tx_id, 0);
1803        match tx_header.ordinal {
1804            _ => Err(fidl::Error::UnknownOrdinal {
1805                ordinal: tx_header.ordinal,
1806                protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1807            }),
1808        }
1809    }
1810}
1811
1812/// A Stream of incoming requests for fuchsia.ui.input/InputDevice.
1813pub struct InputDeviceRequestStream {
1814    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1815    is_terminated: bool,
1816}
1817
1818impl std::marker::Unpin for InputDeviceRequestStream {}
1819
1820impl futures::stream::FusedStream for InputDeviceRequestStream {
1821    fn is_terminated(&self) -> bool {
1822        self.is_terminated
1823    }
1824}
1825
1826impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
1827    type Protocol = InputDeviceMarker;
1828    type ControlHandle = InputDeviceControlHandle;
1829
1830    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1831        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1832    }
1833
1834    fn control_handle(&self) -> Self::ControlHandle {
1835        InputDeviceControlHandle { inner: self.inner.clone() }
1836    }
1837
1838    fn into_inner(
1839        self,
1840    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1841    {
1842        (self.inner, self.is_terminated)
1843    }
1844
1845    fn from_inner(
1846        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1847        is_terminated: bool,
1848    ) -> Self {
1849        Self { inner, is_terminated }
1850    }
1851}
1852
1853impl futures::Stream for InputDeviceRequestStream {
1854    type Item = Result<InputDeviceRequest, fidl::Error>;
1855
1856    fn poll_next(
1857        mut self: std::pin::Pin<&mut Self>,
1858        cx: &mut std::task::Context<'_>,
1859    ) -> std::task::Poll<Option<Self::Item>> {
1860        let this = &mut *self;
1861        if this.inner.check_shutdown(cx) {
1862            this.is_terminated = true;
1863            return std::task::Poll::Ready(None);
1864        }
1865        if this.is_terminated {
1866            panic!("polled InputDeviceRequestStream after completion");
1867        }
1868        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1869            |bytes, handles| {
1870                match this.inner.channel().read_etc(cx, bytes, handles) {
1871                    std::task::Poll::Ready(Ok(())) => {}
1872                    std::task::Poll::Pending => return std::task::Poll::Pending,
1873                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1874                        this.is_terminated = true;
1875                        return std::task::Poll::Ready(None);
1876                    }
1877                    std::task::Poll::Ready(Err(e)) => {
1878                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1879                            e.into(),
1880                        ))))
1881                    }
1882                }
1883
1884                // A message has been received from the channel
1885                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1886
1887                std::task::Poll::Ready(Some(match header.ordinal {
1888                    0x7ee375d01c8e149f => {
1889                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1890                        let mut req = fidl::new_empty!(
1891                            InputDeviceDispatchReportRequest,
1892                            fidl::encoding::DefaultFuchsiaResourceDialect
1893                        );
1894                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceDispatchReportRequest>(&header, _body_bytes, handles, &mut req)?;
1895                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
1896                        Ok(InputDeviceRequest::DispatchReport {
1897                            report: req.report,
1898
1899                            control_handle,
1900                        })
1901                    }
1902                    _ => Err(fidl::Error::UnknownOrdinal {
1903                        ordinal: header.ordinal,
1904                        protocol_name:
1905                            <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1906                    }),
1907                }))
1908            },
1909        )
1910    }
1911}
1912
1913#[derive(Debug)]
1914pub enum InputDeviceRequest {
1915    /// Dispatch an `InputReport` from the device `token`
1916    DispatchReport { report: InputReport, control_handle: InputDeviceControlHandle },
1917}
1918
1919impl InputDeviceRequest {
1920    #[allow(irrefutable_let_patterns)]
1921    pub fn into_dispatch_report(self) -> Option<(InputReport, InputDeviceControlHandle)> {
1922        if let InputDeviceRequest::DispatchReport { report, control_handle } = self {
1923            Some((report, control_handle))
1924        } else {
1925            None
1926        }
1927    }
1928
1929    /// Name of the method defined in FIDL
1930    pub fn method_name(&self) -> &'static str {
1931        match *self {
1932            InputDeviceRequest::DispatchReport { .. } => "dispatch_report",
1933        }
1934    }
1935}
1936
1937#[derive(Debug, Clone)]
1938pub struct InputDeviceControlHandle {
1939    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1940}
1941
1942impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
1943    fn shutdown(&self) {
1944        self.inner.shutdown()
1945    }
1946    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1947        self.inner.shutdown_with_epitaph(status)
1948    }
1949
1950    fn is_closed(&self) -> bool {
1951        self.inner.channel().is_closed()
1952    }
1953    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1954        self.inner.channel().on_closed()
1955    }
1956
1957    #[cfg(target_os = "fuchsia")]
1958    fn signal_peer(
1959        &self,
1960        clear_mask: zx::Signals,
1961        set_mask: zx::Signals,
1962    ) -> Result<(), zx_status::Status> {
1963        use fidl::Peered;
1964        self.inner.channel().signal_peer(clear_mask, set_mask)
1965    }
1966}
1967
1968impl InputDeviceControlHandle {}
1969
1970#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1971pub struct InputMethodEditorMarker;
1972
1973impl fidl::endpoints::ProtocolMarker for InputMethodEditorMarker {
1974    type Proxy = InputMethodEditorProxy;
1975    type RequestStream = InputMethodEditorRequestStream;
1976    #[cfg(target_os = "fuchsia")]
1977    type SynchronousProxy = InputMethodEditorSynchronousProxy;
1978
1979    const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditor";
1980}
1981
1982pub trait InputMethodEditorProxyInterface: Send + Sync {
1983    fn r#set_keyboard_type(&self, keyboard_type: KeyboardType) -> Result<(), fidl::Error>;
1984    fn r#set_state(&self, state: &TextInputState) -> Result<(), fidl::Error>;
1985    fn r#inject_input(&self, event: &InputEvent) -> Result<(), fidl::Error>;
1986    type DispatchKey3ResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
1987    fn r#dispatch_key3(
1988        &self,
1989        event: &fidl_fuchsia_ui_input3::KeyEvent,
1990    ) -> Self::DispatchKey3ResponseFut;
1991    fn r#show(&self) -> Result<(), fidl::Error>;
1992    fn r#hide(&self) -> Result<(), fidl::Error>;
1993}
1994#[derive(Debug)]
1995#[cfg(target_os = "fuchsia")]
1996pub struct InputMethodEditorSynchronousProxy {
1997    client: fidl::client::sync::Client,
1998}
1999
2000#[cfg(target_os = "fuchsia")]
2001impl fidl::endpoints::SynchronousProxy for InputMethodEditorSynchronousProxy {
2002    type Proxy = InputMethodEditorProxy;
2003    type Protocol = InputMethodEditorMarker;
2004
2005    fn from_channel(inner: fidl::Channel) -> Self {
2006        Self::new(inner)
2007    }
2008
2009    fn into_channel(self) -> fidl::Channel {
2010        self.client.into_channel()
2011    }
2012
2013    fn as_channel(&self) -> &fidl::Channel {
2014        self.client.as_channel()
2015    }
2016}
2017
2018#[cfg(target_os = "fuchsia")]
2019impl InputMethodEditorSynchronousProxy {
2020    pub fn new(channel: fidl::Channel) -> Self {
2021        let protocol_name =
2022            <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2023        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2024    }
2025
2026    pub fn into_channel(self) -> fidl::Channel {
2027        self.client.into_channel()
2028    }
2029
2030    /// Waits until an event arrives and returns it. It is safe for other
2031    /// threads to make concurrent requests while waiting for an event.
2032    pub fn wait_for_event(
2033        &self,
2034        deadline: zx::MonotonicInstant,
2035    ) -> Result<InputMethodEditorEvent, fidl::Error> {
2036        InputMethodEditorEvent::decode(self.client.wait_for_event(deadline)?)
2037    }
2038
2039    pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
2040        self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
2041            (keyboard_type,),
2042            0x14fe60e927d7d487,
2043            fidl::encoding::DynamicFlags::empty(),
2044        )
2045    }
2046
2047    pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
2048        self.client.send::<InputMethodEditorSetStateRequest>(
2049            (state,),
2050            0x12b477b779818f45,
2051            fidl::encoding::DynamicFlags::empty(),
2052        )
2053    }
2054
2055    pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
2056        self.client.send::<InputMethodEditorInjectInputRequest>(
2057            (event,),
2058            0x34af74618a4f82b,
2059            fidl::encoding::DynamicFlags::empty(),
2060        )
2061    }
2062
2063    pub fn r#dispatch_key3(
2064        &self,
2065        mut event: &fidl_fuchsia_ui_input3::KeyEvent,
2066        ___deadline: zx::MonotonicInstant,
2067    ) -> Result<bool, fidl::Error> {
2068        let _response = self.client.send_query::<
2069            InputMethodEditorDispatchKey3Request,
2070            InputMethodEditorDispatchKey3Response,
2071        >(
2072            (event,),
2073            0x2e13667c827209ac,
2074            fidl::encoding::DynamicFlags::empty(),
2075            ___deadline,
2076        )?;
2077        Ok(_response.handled)
2078    }
2079
2080    pub fn r#show(&self) -> Result<(), fidl::Error> {
2081        self.client.send::<fidl::encoding::EmptyPayload>(
2082            (),
2083            0x19ba00ba1beb002e,
2084            fidl::encoding::DynamicFlags::empty(),
2085        )
2086    }
2087
2088    pub fn r#hide(&self) -> Result<(), fidl::Error> {
2089        self.client.send::<fidl::encoding::EmptyPayload>(
2090            (),
2091            0x283e0cd73f0d6d9e,
2092            fidl::encoding::DynamicFlags::empty(),
2093        )
2094    }
2095}
2096
2097#[derive(Debug, Clone)]
2098pub struct InputMethodEditorProxy {
2099    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2100}
2101
2102impl fidl::endpoints::Proxy for InputMethodEditorProxy {
2103    type Protocol = InputMethodEditorMarker;
2104
2105    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2106        Self::new(inner)
2107    }
2108
2109    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2110        self.client.into_channel().map_err(|client| Self { client })
2111    }
2112
2113    fn as_channel(&self) -> &::fidl::AsyncChannel {
2114        self.client.as_channel()
2115    }
2116}
2117
2118impl InputMethodEditorProxy {
2119    /// Create a new Proxy for fuchsia.ui.input/InputMethodEditor.
2120    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2121        let protocol_name =
2122            <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2123        Self { client: fidl::client::Client::new(channel, protocol_name) }
2124    }
2125
2126    /// Get a Stream of events from the remote end of the protocol.
2127    ///
2128    /// # Panics
2129    ///
2130    /// Panics if the event stream was already taken.
2131    pub fn take_event_stream(&self) -> InputMethodEditorEventStream {
2132        InputMethodEditorEventStream { event_receiver: self.client.take_event_receiver() }
2133    }
2134
2135    pub fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
2136        InputMethodEditorProxyInterface::r#set_keyboard_type(self, keyboard_type)
2137    }
2138
2139    pub fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
2140        InputMethodEditorProxyInterface::r#set_state(self, state)
2141    }
2142
2143    pub fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
2144        InputMethodEditorProxyInterface::r#inject_input(self, event)
2145    }
2146
2147    pub fn r#dispatch_key3(
2148        &self,
2149        mut event: &fidl_fuchsia_ui_input3::KeyEvent,
2150    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
2151        InputMethodEditorProxyInterface::r#dispatch_key3(self, event)
2152    }
2153
2154    pub fn r#show(&self) -> Result<(), fidl::Error> {
2155        InputMethodEditorProxyInterface::r#show(self)
2156    }
2157
2158    pub fn r#hide(&self) -> Result<(), fidl::Error> {
2159        InputMethodEditorProxyInterface::r#hide(self)
2160    }
2161}
2162
2163impl InputMethodEditorProxyInterface for InputMethodEditorProxy {
2164    fn r#set_keyboard_type(&self, mut keyboard_type: KeyboardType) -> Result<(), fidl::Error> {
2165        self.client.send::<InputMethodEditorSetKeyboardTypeRequest>(
2166            (keyboard_type,),
2167            0x14fe60e927d7d487,
2168            fidl::encoding::DynamicFlags::empty(),
2169        )
2170    }
2171
2172    fn r#set_state(&self, mut state: &TextInputState) -> Result<(), fidl::Error> {
2173        self.client.send::<InputMethodEditorSetStateRequest>(
2174            (state,),
2175            0x12b477b779818f45,
2176            fidl::encoding::DynamicFlags::empty(),
2177        )
2178    }
2179
2180    fn r#inject_input(&self, mut event: &InputEvent) -> Result<(), fidl::Error> {
2181        self.client.send::<InputMethodEditorInjectInputRequest>(
2182            (event,),
2183            0x34af74618a4f82b,
2184            fidl::encoding::DynamicFlags::empty(),
2185        )
2186    }
2187
2188    type DispatchKey3ResponseFut =
2189        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
2190    fn r#dispatch_key3(
2191        &self,
2192        mut event: &fidl_fuchsia_ui_input3::KeyEvent,
2193    ) -> Self::DispatchKey3ResponseFut {
2194        fn _decode(
2195            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2196        ) -> Result<bool, fidl::Error> {
2197            let _response = fidl::client::decode_transaction_body::<
2198                InputMethodEditorDispatchKey3Response,
2199                fidl::encoding::DefaultFuchsiaResourceDialect,
2200                0x2e13667c827209ac,
2201            >(_buf?)?;
2202            Ok(_response.handled)
2203        }
2204        self.client.send_query_and_decode::<InputMethodEditorDispatchKey3Request, bool>(
2205            (event,),
2206            0x2e13667c827209ac,
2207            fidl::encoding::DynamicFlags::empty(),
2208            _decode,
2209        )
2210    }
2211
2212    fn r#show(&self) -> Result<(), fidl::Error> {
2213        self.client.send::<fidl::encoding::EmptyPayload>(
2214            (),
2215            0x19ba00ba1beb002e,
2216            fidl::encoding::DynamicFlags::empty(),
2217        )
2218    }
2219
2220    fn r#hide(&self) -> Result<(), fidl::Error> {
2221        self.client.send::<fidl::encoding::EmptyPayload>(
2222            (),
2223            0x283e0cd73f0d6d9e,
2224            fidl::encoding::DynamicFlags::empty(),
2225        )
2226    }
2227}
2228
2229pub struct InputMethodEditorEventStream {
2230    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2231}
2232
2233impl std::marker::Unpin for InputMethodEditorEventStream {}
2234
2235impl futures::stream::FusedStream for InputMethodEditorEventStream {
2236    fn is_terminated(&self) -> bool {
2237        self.event_receiver.is_terminated()
2238    }
2239}
2240
2241impl futures::Stream for InputMethodEditorEventStream {
2242    type Item = Result<InputMethodEditorEvent, fidl::Error>;
2243
2244    fn poll_next(
2245        mut self: std::pin::Pin<&mut Self>,
2246        cx: &mut std::task::Context<'_>,
2247    ) -> std::task::Poll<Option<Self::Item>> {
2248        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2249            &mut self.event_receiver,
2250            cx
2251        )?) {
2252            Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorEvent::decode(buf))),
2253            None => std::task::Poll::Ready(None),
2254        }
2255    }
2256}
2257
2258#[derive(Debug)]
2259pub enum InputMethodEditorEvent {}
2260
2261impl InputMethodEditorEvent {
2262    /// Decodes a message buffer as a [`InputMethodEditorEvent`].
2263    fn decode(
2264        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2265    ) -> Result<InputMethodEditorEvent, fidl::Error> {
2266        let (bytes, _handles) = buf.split_mut();
2267        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2268        debug_assert_eq!(tx_header.tx_id, 0);
2269        match tx_header.ordinal {
2270            _ => Err(fidl::Error::UnknownOrdinal {
2271                ordinal: tx_header.ordinal,
2272                protocol_name:
2273                    <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2274            }),
2275        }
2276    }
2277}
2278
2279/// A Stream of incoming requests for fuchsia.ui.input/InputMethodEditor.
2280pub struct InputMethodEditorRequestStream {
2281    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2282    is_terminated: bool,
2283}
2284
2285impl std::marker::Unpin for InputMethodEditorRequestStream {}
2286
2287impl futures::stream::FusedStream for InputMethodEditorRequestStream {
2288    fn is_terminated(&self) -> bool {
2289        self.is_terminated
2290    }
2291}
2292
2293impl fidl::endpoints::RequestStream for InputMethodEditorRequestStream {
2294    type Protocol = InputMethodEditorMarker;
2295    type ControlHandle = InputMethodEditorControlHandle;
2296
2297    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2298        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2299    }
2300
2301    fn control_handle(&self) -> Self::ControlHandle {
2302        InputMethodEditorControlHandle { inner: self.inner.clone() }
2303    }
2304
2305    fn into_inner(
2306        self,
2307    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2308    {
2309        (self.inner, self.is_terminated)
2310    }
2311
2312    fn from_inner(
2313        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2314        is_terminated: bool,
2315    ) -> Self {
2316        Self { inner, is_terminated }
2317    }
2318}
2319
2320impl futures::Stream for InputMethodEditorRequestStream {
2321    type Item = Result<InputMethodEditorRequest, fidl::Error>;
2322
2323    fn poll_next(
2324        mut self: std::pin::Pin<&mut Self>,
2325        cx: &mut std::task::Context<'_>,
2326    ) -> std::task::Poll<Option<Self::Item>> {
2327        let this = &mut *self;
2328        if this.inner.check_shutdown(cx) {
2329            this.is_terminated = true;
2330            return std::task::Poll::Ready(None);
2331        }
2332        if this.is_terminated {
2333            panic!("polled InputMethodEditorRequestStream after completion");
2334        }
2335        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2336            |bytes, handles| {
2337                match this.inner.channel().read_etc(cx, bytes, handles) {
2338                    std::task::Poll::Ready(Ok(())) => {}
2339                    std::task::Poll::Pending => return std::task::Poll::Pending,
2340                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2341                        this.is_terminated = true;
2342                        return std::task::Poll::Ready(None);
2343                    }
2344                    std::task::Poll::Ready(Err(e)) => {
2345                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2346                            e.into(),
2347                        ))))
2348                    }
2349                }
2350
2351                // A message has been received from the channel
2352                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2353
2354                std::task::Poll::Ready(Some(match header.ordinal {
2355                    0x14fe60e927d7d487 => {
2356                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2357                        let mut req = fidl::new_empty!(
2358                            InputMethodEditorSetKeyboardTypeRequest,
2359                            fidl::encoding::DefaultFuchsiaResourceDialect
2360                        );
2361                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetKeyboardTypeRequest>(&header, _body_bytes, handles, &mut req)?;
2362                        let control_handle =
2363                            InputMethodEditorControlHandle { inner: this.inner.clone() };
2364                        Ok(InputMethodEditorRequest::SetKeyboardType {
2365                            keyboard_type: req.keyboard_type,
2366
2367                            control_handle,
2368                        })
2369                    }
2370                    0x12b477b779818f45 => {
2371                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2372                        let mut req = fidl::new_empty!(
2373                            InputMethodEditorSetStateRequest,
2374                            fidl::encoding::DefaultFuchsiaResourceDialect
2375                        );
2376                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorSetStateRequest>(&header, _body_bytes, handles, &mut req)?;
2377                        let control_handle =
2378                            InputMethodEditorControlHandle { inner: this.inner.clone() };
2379                        Ok(InputMethodEditorRequest::SetState { state: req.state, control_handle })
2380                    }
2381                    0x34af74618a4f82b => {
2382                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2383                        let mut req = fidl::new_empty!(
2384                            InputMethodEditorInjectInputRequest,
2385                            fidl::encoding::DefaultFuchsiaResourceDialect
2386                        );
2387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorInjectInputRequest>(&header, _body_bytes, handles, &mut req)?;
2388                        let control_handle =
2389                            InputMethodEditorControlHandle { inner: this.inner.clone() };
2390                        Ok(InputMethodEditorRequest::InjectInput {
2391                            event: req.event,
2392
2393                            control_handle,
2394                        })
2395                    }
2396                    0x2e13667c827209ac => {
2397                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2398                        let mut req = fidl::new_empty!(
2399                            InputMethodEditorDispatchKey3Request,
2400                            fidl::encoding::DefaultFuchsiaResourceDialect
2401                        );
2402                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorDispatchKey3Request>(&header, _body_bytes, handles, &mut req)?;
2403                        let control_handle =
2404                            InputMethodEditorControlHandle { inner: this.inner.clone() };
2405                        Ok(InputMethodEditorRequest::DispatchKey3 {
2406                            event: req.event,
2407
2408                            responder: InputMethodEditorDispatchKey3Responder {
2409                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2410                                tx_id: header.tx_id,
2411                            },
2412                        })
2413                    }
2414                    0x19ba00ba1beb002e => {
2415                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2416                        let mut req = fidl::new_empty!(
2417                            fidl::encoding::EmptyPayload,
2418                            fidl::encoding::DefaultFuchsiaResourceDialect
2419                        );
2420                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2421                        let control_handle =
2422                            InputMethodEditorControlHandle { inner: this.inner.clone() };
2423                        Ok(InputMethodEditorRequest::Show { control_handle })
2424                    }
2425                    0x283e0cd73f0d6d9e => {
2426                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2427                        let mut req = fidl::new_empty!(
2428                            fidl::encoding::EmptyPayload,
2429                            fidl::encoding::DefaultFuchsiaResourceDialect
2430                        );
2431                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2432                        let control_handle =
2433                            InputMethodEditorControlHandle { inner: this.inner.clone() };
2434                        Ok(InputMethodEditorRequest::Hide { control_handle })
2435                    }
2436                    _ => Err(fidl::Error::UnknownOrdinal {
2437                        ordinal: header.ordinal,
2438                        protocol_name:
2439                            <InputMethodEditorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2440                    }),
2441                }))
2442            },
2443        )
2444    }
2445}
2446
2447/// A interface for interacting with a text input control.
2448#[derive(Debug)]
2449pub enum InputMethodEditorRequest {
2450    SetKeyboardType {
2451        keyboard_type: KeyboardType,
2452        control_handle: InputMethodEditorControlHandle,
2453    },
2454    SetState {
2455        state: TextInputState,
2456        control_handle: InputMethodEditorControlHandle,
2457    },
2458    InjectInput {
2459        event: InputEvent,
2460        control_handle: InputMethodEditorControlHandle,
2461    },
2462    DispatchKey3 {
2463        event: fidl_fuchsia_ui_input3::KeyEvent,
2464        responder: InputMethodEditorDispatchKey3Responder,
2465    },
2466    Show {
2467        control_handle: InputMethodEditorControlHandle,
2468    },
2469    Hide {
2470        control_handle: InputMethodEditorControlHandle,
2471    },
2472}
2473
2474impl InputMethodEditorRequest {
2475    #[allow(irrefutable_let_patterns)]
2476    pub fn into_set_keyboard_type(self) -> Option<(KeyboardType, InputMethodEditorControlHandle)> {
2477        if let InputMethodEditorRequest::SetKeyboardType { keyboard_type, control_handle } = self {
2478            Some((keyboard_type, control_handle))
2479        } else {
2480            None
2481        }
2482    }
2483
2484    #[allow(irrefutable_let_patterns)]
2485    pub fn into_set_state(self) -> Option<(TextInputState, InputMethodEditorControlHandle)> {
2486        if let InputMethodEditorRequest::SetState { state, control_handle } = self {
2487            Some((state, control_handle))
2488        } else {
2489            None
2490        }
2491    }
2492
2493    #[allow(irrefutable_let_patterns)]
2494    pub fn into_inject_input(self) -> Option<(InputEvent, InputMethodEditorControlHandle)> {
2495        if let InputMethodEditorRequest::InjectInput { event, control_handle } = self {
2496            Some((event, control_handle))
2497        } else {
2498            None
2499        }
2500    }
2501
2502    #[allow(irrefutable_let_patterns)]
2503    pub fn into_dispatch_key3(
2504        self,
2505    ) -> Option<(fidl_fuchsia_ui_input3::KeyEvent, InputMethodEditorDispatchKey3Responder)> {
2506        if let InputMethodEditorRequest::DispatchKey3 { event, responder } = self {
2507            Some((event, responder))
2508        } else {
2509            None
2510        }
2511    }
2512
2513    #[allow(irrefutable_let_patterns)]
2514    pub fn into_show(self) -> Option<(InputMethodEditorControlHandle)> {
2515        if let InputMethodEditorRequest::Show { control_handle } = self {
2516            Some((control_handle))
2517        } else {
2518            None
2519        }
2520    }
2521
2522    #[allow(irrefutable_let_patterns)]
2523    pub fn into_hide(self) -> Option<(InputMethodEditorControlHandle)> {
2524        if let InputMethodEditorRequest::Hide { control_handle } = self {
2525            Some((control_handle))
2526        } else {
2527            None
2528        }
2529    }
2530
2531    /// Name of the method defined in FIDL
2532    pub fn method_name(&self) -> &'static str {
2533        match *self {
2534            InputMethodEditorRequest::SetKeyboardType { .. } => "set_keyboard_type",
2535            InputMethodEditorRequest::SetState { .. } => "set_state",
2536            InputMethodEditorRequest::InjectInput { .. } => "inject_input",
2537            InputMethodEditorRequest::DispatchKey3 { .. } => "dispatch_key3",
2538            InputMethodEditorRequest::Show { .. } => "show",
2539            InputMethodEditorRequest::Hide { .. } => "hide",
2540        }
2541    }
2542}
2543
2544#[derive(Debug, Clone)]
2545pub struct InputMethodEditorControlHandle {
2546    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2547}
2548
2549impl fidl::endpoints::ControlHandle for InputMethodEditorControlHandle {
2550    fn shutdown(&self) {
2551        self.inner.shutdown()
2552    }
2553    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2554        self.inner.shutdown_with_epitaph(status)
2555    }
2556
2557    fn is_closed(&self) -> bool {
2558        self.inner.channel().is_closed()
2559    }
2560    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2561        self.inner.channel().on_closed()
2562    }
2563
2564    #[cfg(target_os = "fuchsia")]
2565    fn signal_peer(
2566        &self,
2567        clear_mask: zx::Signals,
2568        set_mask: zx::Signals,
2569    ) -> Result<(), zx_status::Status> {
2570        use fidl::Peered;
2571        self.inner.channel().signal_peer(clear_mask, set_mask)
2572    }
2573}
2574
2575impl InputMethodEditorControlHandle {}
2576
2577#[must_use = "FIDL methods require a response to be sent"]
2578#[derive(Debug)]
2579pub struct InputMethodEditorDispatchKey3Responder {
2580    control_handle: std::mem::ManuallyDrop<InputMethodEditorControlHandle>,
2581    tx_id: u32,
2582}
2583
2584/// Set the the channel to be shutdown (see [`InputMethodEditorControlHandle::shutdown`])
2585/// if the responder is dropped without sending a response, so that the client
2586/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2587impl std::ops::Drop for InputMethodEditorDispatchKey3Responder {
2588    fn drop(&mut self) {
2589        self.control_handle.shutdown();
2590        // Safety: drops once, never accessed again
2591        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2592    }
2593}
2594
2595impl fidl::endpoints::Responder for InputMethodEditorDispatchKey3Responder {
2596    type ControlHandle = InputMethodEditorControlHandle;
2597
2598    fn control_handle(&self) -> &InputMethodEditorControlHandle {
2599        &self.control_handle
2600    }
2601
2602    fn drop_without_shutdown(mut self) {
2603        // Safety: drops once, never accessed again due to mem::forget
2604        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2605        // Prevent Drop from running (which would shut down the channel)
2606        std::mem::forget(self);
2607    }
2608}
2609
2610impl InputMethodEditorDispatchKey3Responder {
2611    /// Sends a response to the FIDL transaction.
2612    ///
2613    /// Sets the channel to shutdown if an error occurs.
2614    pub fn send(self, mut handled: bool) -> Result<(), fidl::Error> {
2615        let _result = self.send_raw(handled);
2616        if _result.is_err() {
2617            self.control_handle.shutdown();
2618        }
2619        self.drop_without_shutdown();
2620        _result
2621    }
2622
2623    /// Similar to "send" but does not shutdown the channel if an error occurs.
2624    pub fn send_no_shutdown_on_err(self, mut handled: bool) -> Result<(), fidl::Error> {
2625        let _result = self.send_raw(handled);
2626        self.drop_without_shutdown();
2627        _result
2628    }
2629
2630    fn send_raw(&self, mut handled: bool) -> Result<(), fidl::Error> {
2631        self.control_handle.inner.send::<InputMethodEditorDispatchKey3Response>(
2632            (handled,),
2633            self.tx_id,
2634            0x2e13667c827209ac,
2635            fidl::encoding::DynamicFlags::empty(),
2636        )
2637    }
2638}
2639
2640#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2641pub struct InputMethodEditorClientMarker;
2642
2643impl fidl::endpoints::ProtocolMarker for InputMethodEditorClientMarker {
2644    type Proxy = InputMethodEditorClientProxy;
2645    type RequestStream = InputMethodEditorClientRequestStream;
2646    #[cfg(target_os = "fuchsia")]
2647    type SynchronousProxy = InputMethodEditorClientSynchronousProxy;
2648
2649    const DEBUG_NAME: &'static str = "(anonymous) InputMethodEditorClient";
2650}
2651
2652pub trait InputMethodEditorClientProxyInterface: Send + Sync {
2653    fn r#did_update_state(
2654        &self,
2655        state: &TextInputState,
2656        event: Option<&InputEvent>,
2657    ) -> Result<(), fidl::Error>;
2658    fn r#on_action(&self, action: InputMethodAction) -> Result<(), fidl::Error>;
2659}
2660#[derive(Debug)]
2661#[cfg(target_os = "fuchsia")]
2662pub struct InputMethodEditorClientSynchronousProxy {
2663    client: fidl::client::sync::Client,
2664}
2665
2666#[cfg(target_os = "fuchsia")]
2667impl fidl::endpoints::SynchronousProxy for InputMethodEditorClientSynchronousProxy {
2668    type Proxy = InputMethodEditorClientProxy;
2669    type Protocol = InputMethodEditorClientMarker;
2670
2671    fn from_channel(inner: fidl::Channel) -> Self {
2672        Self::new(inner)
2673    }
2674
2675    fn into_channel(self) -> fidl::Channel {
2676        self.client.into_channel()
2677    }
2678
2679    fn as_channel(&self) -> &fidl::Channel {
2680        self.client.as_channel()
2681    }
2682}
2683
2684#[cfg(target_os = "fuchsia")]
2685impl InputMethodEditorClientSynchronousProxy {
2686    pub fn new(channel: fidl::Channel) -> Self {
2687        let protocol_name =
2688            <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2689        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2690    }
2691
2692    pub fn into_channel(self) -> fidl::Channel {
2693        self.client.into_channel()
2694    }
2695
2696    /// Waits until an event arrives and returns it. It is safe for other
2697    /// threads to make concurrent requests while waiting for an event.
2698    pub fn wait_for_event(
2699        &self,
2700        deadline: zx::MonotonicInstant,
2701    ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
2702        InputMethodEditorClientEvent::decode(self.client.wait_for_event(deadline)?)
2703    }
2704
2705    pub fn r#did_update_state(
2706        &self,
2707        mut state: &TextInputState,
2708        mut event: Option<&InputEvent>,
2709    ) -> Result<(), fidl::Error> {
2710        self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
2711            (state, event),
2712            0x26681a6b204b679d,
2713            fidl::encoding::DynamicFlags::empty(),
2714        )
2715    }
2716
2717    pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
2718        self.client.send::<InputMethodEditorClientOnActionRequest>(
2719            (action,),
2720            0x19c420f173275398,
2721            fidl::encoding::DynamicFlags::empty(),
2722        )
2723    }
2724}
2725
2726#[derive(Debug, Clone)]
2727pub struct InputMethodEditorClientProxy {
2728    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2729}
2730
2731impl fidl::endpoints::Proxy for InputMethodEditorClientProxy {
2732    type Protocol = InputMethodEditorClientMarker;
2733
2734    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2735        Self::new(inner)
2736    }
2737
2738    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2739        self.client.into_channel().map_err(|client| Self { client })
2740    }
2741
2742    fn as_channel(&self) -> &::fidl::AsyncChannel {
2743        self.client.as_channel()
2744    }
2745}
2746
2747impl InputMethodEditorClientProxy {
2748    /// Create a new Proxy for fuchsia.ui.input/InputMethodEditorClient.
2749    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2750        let protocol_name =
2751            <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2752        Self { client: fidl::client::Client::new(channel, protocol_name) }
2753    }
2754
2755    /// Get a Stream of events from the remote end of the protocol.
2756    ///
2757    /// # Panics
2758    ///
2759    /// Panics if the event stream was already taken.
2760    pub fn take_event_stream(&self) -> InputMethodEditorClientEventStream {
2761        InputMethodEditorClientEventStream { event_receiver: self.client.take_event_receiver() }
2762    }
2763
2764    pub fn r#did_update_state(
2765        &self,
2766        mut state: &TextInputState,
2767        mut event: Option<&InputEvent>,
2768    ) -> Result<(), fidl::Error> {
2769        InputMethodEditorClientProxyInterface::r#did_update_state(self, state, event)
2770    }
2771
2772    pub fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
2773        InputMethodEditorClientProxyInterface::r#on_action(self, action)
2774    }
2775}
2776
2777impl InputMethodEditorClientProxyInterface for InputMethodEditorClientProxy {
2778    fn r#did_update_state(
2779        &self,
2780        mut state: &TextInputState,
2781        mut event: Option<&InputEvent>,
2782    ) -> Result<(), fidl::Error> {
2783        self.client.send::<InputMethodEditorClientDidUpdateStateRequest>(
2784            (state, event),
2785            0x26681a6b204b679d,
2786            fidl::encoding::DynamicFlags::empty(),
2787        )
2788    }
2789
2790    fn r#on_action(&self, mut action: InputMethodAction) -> Result<(), fidl::Error> {
2791        self.client.send::<InputMethodEditorClientOnActionRequest>(
2792            (action,),
2793            0x19c420f173275398,
2794            fidl::encoding::DynamicFlags::empty(),
2795        )
2796    }
2797}
2798
2799pub struct InputMethodEditorClientEventStream {
2800    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2801}
2802
2803impl std::marker::Unpin for InputMethodEditorClientEventStream {}
2804
2805impl futures::stream::FusedStream for InputMethodEditorClientEventStream {
2806    fn is_terminated(&self) -> bool {
2807        self.event_receiver.is_terminated()
2808    }
2809}
2810
2811impl futures::Stream for InputMethodEditorClientEventStream {
2812    type Item = Result<InputMethodEditorClientEvent, fidl::Error>;
2813
2814    fn poll_next(
2815        mut self: std::pin::Pin<&mut Self>,
2816        cx: &mut std::task::Context<'_>,
2817    ) -> std::task::Poll<Option<Self::Item>> {
2818        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2819            &mut self.event_receiver,
2820            cx
2821        )?) {
2822            Some(buf) => std::task::Poll::Ready(Some(InputMethodEditorClientEvent::decode(buf))),
2823            None => std::task::Poll::Ready(None),
2824        }
2825    }
2826}
2827
2828#[derive(Debug)]
2829pub enum InputMethodEditorClientEvent {}
2830
2831impl InputMethodEditorClientEvent {
2832    /// Decodes a message buffer as a [`InputMethodEditorClientEvent`].
2833    fn decode(
2834        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2835    ) -> Result<InputMethodEditorClientEvent, fidl::Error> {
2836        let (bytes, _handles) = buf.split_mut();
2837        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2838        debug_assert_eq!(tx_header.tx_id, 0);
2839        match tx_header.ordinal {
2840            _ => Err(fidl::Error::UnknownOrdinal {
2841                ordinal: tx_header.ordinal,
2842                protocol_name:
2843                    <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2844            }),
2845        }
2846    }
2847}
2848
2849/// A Stream of incoming requests for fuchsia.ui.input/InputMethodEditorClient.
2850pub struct InputMethodEditorClientRequestStream {
2851    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2852    is_terminated: bool,
2853}
2854
2855impl std::marker::Unpin for InputMethodEditorClientRequestStream {}
2856
2857impl futures::stream::FusedStream for InputMethodEditorClientRequestStream {
2858    fn is_terminated(&self) -> bool {
2859        self.is_terminated
2860    }
2861}
2862
2863impl fidl::endpoints::RequestStream for InputMethodEditorClientRequestStream {
2864    type Protocol = InputMethodEditorClientMarker;
2865    type ControlHandle = InputMethodEditorClientControlHandle;
2866
2867    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2868        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2869    }
2870
2871    fn control_handle(&self) -> Self::ControlHandle {
2872        InputMethodEditorClientControlHandle { inner: self.inner.clone() }
2873    }
2874
2875    fn into_inner(
2876        self,
2877    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2878    {
2879        (self.inner, self.is_terminated)
2880    }
2881
2882    fn from_inner(
2883        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2884        is_terminated: bool,
2885    ) -> Self {
2886        Self { inner, is_terminated }
2887    }
2888}
2889
2890impl futures::Stream for InputMethodEditorClientRequestStream {
2891    type Item = Result<InputMethodEditorClientRequest, fidl::Error>;
2892
2893    fn poll_next(
2894        mut self: std::pin::Pin<&mut Self>,
2895        cx: &mut std::task::Context<'_>,
2896    ) -> std::task::Poll<Option<Self::Item>> {
2897        let this = &mut *self;
2898        if this.inner.check_shutdown(cx) {
2899            this.is_terminated = true;
2900            return std::task::Poll::Ready(None);
2901        }
2902        if this.is_terminated {
2903            panic!("polled InputMethodEditorClientRequestStream after completion");
2904        }
2905        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2906            |bytes, handles| {
2907                match this.inner.channel().read_etc(cx, bytes, handles) {
2908                    std::task::Poll::Ready(Ok(())) => {}
2909                    std::task::Poll::Pending => return std::task::Poll::Pending,
2910                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2911                        this.is_terminated = true;
2912                        return std::task::Poll::Ready(None);
2913                    }
2914                    std::task::Poll::Ready(Err(e)) => {
2915                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2916                            e.into(),
2917                        ))))
2918                    }
2919                }
2920
2921                // A message has been received from the channel
2922                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2923
2924                std::task::Poll::Ready(Some(match header.ordinal {
2925                0x26681a6b204b679d => {
2926                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2927                    let mut req = fidl::new_empty!(InputMethodEditorClientDidUpdateStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2928                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientDidUpdateStateRequest>(&header, _body_bytes, handles, &mut req)?;
2929                    let control_handle = InputMethodEditorClientControlHandle {
2930                        inner: this.inner.clone(),
2931                    };
2932                    Ok(InputMethodEditorClientRequest::DidUpdateState {state: req.state,
2933event: req.event,
2934
2935                        control_handle,
2936                    })
2937                }
2938                0x19c420f173275398 => {
2939                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2940                    let mut req = fidl::new_empty!(InputMethodEditorClientOnActionRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2941                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputMethodEditorClientOnActionRequest>(&header, _body_bytes, handles, &mut req)?;
2942                    let control_handle = InputMethodEditorClientControlHandle {
2943                        inner: this.inner.clone(),
2944                    };
2945                    Ok(InputMethodEditorClientRequest::OnAction {action: req.action,
2946
2947                        control_handle,
2948                    })
2949                }
2950                _ => Err(fidl::Error::UnknownOrdinal {
2951                    ordinal: header.ordinal,
2952                    protocol_name: <InputMethodEditorClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2953                }),
2954            }))
2955            },
2956        )
2957    }
2958}
2959
2960/// An interface to receive information from `TextInputService`.
2961#[derive(Debug)]
2962pub enum InputMethodEditorClientRequest {
2963    DidUpdateState {
2964        state: TextInputState,
2965        event: Option<Box<InputEvent>>,
2966        control_handle: InputMethodEditorClientControlHandle,
2967    },
2968    OnAction {
2969        action: InputMethodAction,
2970        control_handle: InputMethodEditorClientControlHandle,
2971    },
2972}
2973
2974impl InputMethodEditorClientRequest {
2975    #[allow(irrefutable_let_patterns)]
2976    pub fn into_did_update_state(
2977        self,
2978    ) -> Option<(TextInputState, Option<Box<InputEvent>>, InputMethodEditorClientControlHandle)>
2979    {
2980        if let InputMethodEditorClientRequest::DidUpdateState { state, event, control_handle } =
2981            self
2982        {
2983            Some((state, event, control_handle))
2984        } else {
2985            None
2986        }
2987    }
2988
2989    #[allow(irrefutable_let_patterns)]
2990    pub fn into_on_action(
2991        self,
2992    ) -> Option<(InputMethodAction, InputMethodEditorClientControlHandle)> {
2993        if let InputMethodEditorClientRequest::OnAction { action, control_handle } = self {
2994            Some((action, control_handle))
2995        } else {
2996            None
2997        }
2998    }
2999
3000    /// Name of the method defined in FIDL
3001    pub fn method_name(&self) -> &'static str {
3002        match *self {
3003            InputMethodEditorClientRequest::DidUpdateState { .. } => "did_update_state",
3004            InputMethodEditorClientRequest::OnAction { .. } => "on_action",
3005        }
3006    }
3007}
3008
3009#[derive(Debug, Clone)]
3010pub struct InputMethodEditorClientControlHandle {
3011    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3012}
3013
3014impl fidl::endpoints::ControlHandle for InputMethodEditorClientControlHandle {
3015    fn shutdown(&self) {
3016        self.inner.shutdown()
3017    }
3018    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3019        self.inner.shutdown_with_epitaph(status)
3020    }
3021
3022    fn is_closed(&self) -> bool {
3023        self.inner.channel().is_closed()
3024    }
3025    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3026        self.inner.channel().on_closed()
3027    }
3028
3029    #[cfg(target_os = "fuchsia")]
3030    fn signal_peer(
3031        &self,
3032        clear_mask: zx::Signals,
3033        set_mask: zx::Signals,
3034    ) -> Result<(), zx_status::Status> {
3035        use fidl::Peered;
3036        self.inner.channel().signal_peer(clear_mask, set_mask)
3037    }
3038}
3039
3040impl InputMethodEditorClientControlHandle {}
3041
3042mod internal {
3043    use super::*;
3044    unsafe impl fidl::encoding::TypeMarker for AxisScale {
3045        type Owned = Self;
3046
3047        #[inline(always)]
3048        fn inline_align(_context: fidl::encoding::Context) -> usize {
3049            std::mem::align_of::<u32>()
3050        }
3051
3052        #[inline(always)]
3053        fn inline_size(_context: fidl::encoding::Context) -> usize {
3054            std::mem::size_of::<u32>()
3055        }
3056
3057        #[inline(always)]
3058        fn encode_is_copy() -> bool {
3059            false
3060        }
3061
3062        #[inline(always)]
3063        fn decode_is_copy() -> bool {
3064            false
3065        }
3066    }
3067
3068    impl fidl::encoding::ValueTypeMarker for AxisScale {
3069        type Borrowed<'a> = Self;
3070        #[inline(always)]
3071        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3072            *value
3073        }
3074    }
3075
3076    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AxisScale {
3077        #[inline]
3078        unsafe fn encode(
3079            self,
3080            encoder: &mut fidl::encoding::Encoder<'_, D>,
3081            offset: usize,
3082            _depth: fidl::encoding::Depth,
3083        ) -> fidl::Result<()> {
3084            encoder.debug_check_bounds::<Self>(offset);
3085            encoder.write_num(self.into_primitive(), offset);
3086            Ok(())
3087        }
3088    }
3089
3090    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisScale {
3091        #[inline(always)]
3092        fn new_empty() -> Self {
3093            Self::unknown()
3094        }
3095
3096        #[inline]
3097        unsafe fn decode(
3098            &mut self,
3099            decoder: &mut fidl::encoding::Decoder<'_, D>,
3100            offset: usize,
3101            _depth: fidl::encoding::Depth,
3102        ) -> fidl::Result<()> {
3103            decoder.debug_check_bounds::<Self>(offset);
3104            let prim = decoder.read_num::<u32>(offset);
3105
3106            *self = Self::from_primitive_allow_unknown(prim);
3107            Ok(())
3108        }
3109    }
3110    unsafe impl fidl::encoding::TypeMarker for InputMethodAction {
3111        type Owned = Self;
3112
3113        #[inline(always)]
3114        fn inline_align(_context: fidl::encoding::Context) -> usize {
3115            std::mem::align_of::<u32>()
3116        }
3117
3118        #[inline(always)]
3119        fn inline_size(_context: fidl::encoding::Context) -> usize {
3120            std::mem::size_of::<u32>()
3121        }
3122
3123        #[inline(always)]
3124        fn encode_is_copy() -> bool {
3125            false
3126        }
3127
3128        #[inline(always)]
3129        fn decode_is_copy() -> bool {
3130            false
3131        }
3132    }
3133
3134    impl fidl::encoding::ValueTypeMarker for InputMethodAction {
3135        type Borrowed<'a> = Self;
3136        #[inline(always)]
3137        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3138            *value
3139        }
3140    }
3141
3142    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3143        for InputMethodAction
3144    {
3145        #[inline]
3146        unsafe fn encode(
3147            self,
3148            encoder: &mut fidl::encoding::Encoder<'_, D>,
3149            offset: usize,
3150            _depth: fidl::encoding::Depth,
3151        ) -> fidl::Result<()> {
3152            encoder.debug_check_bounds::<Self>(offset);
3153            encoder.write_num(self.into_primitive(), offset);
3154            Ok(())
3155        }
3156    }
3157
3158    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputMethodAction {
3159        #[inline(always)]
3160        fn new_empty() -> Self {
3161            Self::unknown()
3162        }
3163
3164        #[inline]
3165        unsafe fn decode(
3166            &mut self,
3167            decoder: &mut fidl::encoding::Decoder<'_, D>,
3168            offset: usize,
3169            _depth: fidl::encoding::Depth,
3170        ) -> fidl::Result<()> {
3171            decoder.debug_check_bounds::<Self>(offset);
3172            let prim = decoder.read_num::<u32>(offset);
3173
3174            *self = Self::from_primitive_allow_unknown(prim);
3175            Ok(())
3176        }
3177    }
3178    unsafe impl fidl::encoding::TypeMarker for KeyboardEventPhase {
3179        type Owned = Self;
3180
3181        #[inline(always)]
3182        fn inline_align(_context: fidl::encoding::Context) -> usize {
3183            std::mem::align_of::<u32>()
3184        }
3185
3186        #[inline(always)]
3187        fn inline_size(_context: fidl::encoding::Context) -> usize {
3188            std::mem::size_of::<u32>()
3189        }
3190
3191        #[inline(always)]
3192        fn encode_is_copy() -> bool {
3193            false
3194        }
3195
3196        #[inline(always)]
3197        fn decode_is_copy() -> bool {
3198            false
3199        }
3200    }
3201
3202    impl fidl::encoding::ValueTypeMarker for KeyboardEventPhase {
3203        type Borrowed<'a> = Self;
3204        #[inline(always)]
3205        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3206            *value
3207        }
3208    }
3209
3210    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3211        for KeyboardEventPhase
3212    {
3213        #[inline]
3214        unsafe fn encode(
3215            self,
3216            encoder: &mut fidl::encoding::Encoder<'_, D>,
3217            offset: usize,
3218            _depth: fidl::encoding::Depth,
3219        ) -> fidl::Result<()> {
3220            encoder.debug_check_bounds::<Self>(offset);
3221            encoder.write_num(self.into_primitive(), offset);
3222            Ok(())
3223        }
3224    }
3225
3226    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEventPhase {
3227        #[inline(always)]
3228        fn new_empty() -> Self {
3229            Self::unknown()
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            let prim = decoder.read_num::<u32>(offset);
3241
3242            *self = Self::from_primitive_allow_unknown(prim);
3243            Ok(())
3244        }
3245    }
3246    unsafe impl fidl::encoding::TypeMarker for KeyboardType {
3247        type Owned = Self;
3248
3249        #[inline(always)]
3250        fn inline_align(_context: fidl::encoding::Context) -> usize {
3251            std::mem::align_of::<u32>()
3252        }
3253
3254        #[inline(always)]
3255        fn inline_size(_context: fidl::encoding::Context) -> usize {
3256            std::mem::size_of::<u32>()
3257        }
3258
3259        #[inline(always)]
3260        fn encode_is_copy() -> bool {
3261            false
3262        }
3263
3264        #[inline(always)]
3265        fn decode_is_copy() -> bool {
3266            false
3267        }
3268    }
3269
3270    impl fidl::encoding::ValueTypeMarker for KeyboardType {
3271        type Borrowed<'a> = Self;
3272        #[inline(always)]
3273        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3274            *value
3275        }
3276    }
3277
3278    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyboardType {
3279        #[inline]
3280        unsafe fn encode(
3281            self,
3282            encoder: &mut fidl::encoding::Encoder<'_, D>,
3283            offset: usize,
3284            _depth: fidl::encoding::Depth,
3285        ) -> fidl::Result<()> {
3286            encoder.debug_check_bounds::<Self>(offset);
3287            encoder.write_num(self.into_primitive(), offset);
3288            Ok(())
3289        }
3290    }
3291
3292    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardType {
3293        #[inline(always)]
3294        fn new_empty() -> Self {
3295            Self::unknown()
3296        }
3297
3298        #[inline]
3299        unsafe fn decode(
3300            &mut self,
3301            decoder: &mut fidl::encoding::Decoder<'_, D>,
3302            offset: usize,
3303            _depth: fidl::encoding::Depth,
3304        ) -> fidl::Result<()> {
3305            decoder.debug_check_bounds::<Self>(offset);
3306            let prim = decoder.read_num::<u32>(offset);
3307
3308            *self = Self::from_primitive_allow_unknown(prim);
3309            Ok(())
3310        }
3311    }
3312    unsafe impl fidl::encoding::TypeMarker for PointerEventPhase {
3313        type Owned = Self;
3314
3315        #[inline(always)]
3316        fn inline_align(_context: fidl::encoding::Context) -> usize {
3317            std::mem::align_of::<u32>()
3318        }
3319
3320        #[inline(always)]
3321        fn inline_size(_context: fidl::encoding::Context) -> usize {
3322            std::mem::size_of::<u32>()
3323        }
3324
3325        #[inline(always)]
3326        fn encode_is_copy() -> bool {
3327            true
3328        }
3329
3330        #[inline(always)]
3331        fn decode_is_copy() -> bool {
3332            false
3333        }
3334    }
3335
3336    impl fidl::encoding::ValueTypeMarker for PointerEventPhase {
3337        type Borrowed<'a> = Self;
3338        #[inline(always)]
3339        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3340            *value
3341        }
3342    }
3343
3344    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3345        for PointerEventPhase
3346    {
3347        #[inline]
3348        unsafe fn encode(
3349            self,
3350            encoder: &mut fidl::encoding::Encoder<'_, D>,
3351            offset: usize,
3352            _depth: fidl::encoding::Depth,
3353        ) -> fidl::Result<()> {
3354            encoder.debug_check_bounds::<Self>(offset);
3355            encoder.write_num(self.into_primitive(), offset);
3356            Ok(())
3357        }
3358    }
3359
3360    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventPhase {
3361        #[inline(always)]
3362        fn new_empty() -> Self {
3363            Self::Add
3364        }
3365
3366        #[inline]
3367        unsafe fn decode(
3368            &mut self,
3369            decoder: &mut fidl::encoding::Decoder<'_, D>,
3370            offset: usize,
3371            _depth: fidl::encoding::Depth,
3372        ) -> fidl::Result<()> {
3373            decoder.debug_check_bounds::<Self>(offset);
3374            let prim = decoder.read_num::<u32>(offset);
3375
3376            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3377            Ok(())
3378        }
3379    }
3380    unsafe impl fidl::encoding::TypeMarker for PointerEventType {
3381        type Owned = Self;
3382
3383        #[inline(always)]
3384        fn inline_align(_context: fidl::encoding::Context) -> usize {
3385            std::mem::align_of::<u32>()
3386        }
3387
3388        #[inline(always)]
3389        fn inline_size(_context: fidl::encoding::Context) -> usize {
3390            std::mem::size_of::<u32>()
3391        }
3392
3393        #[inline(always)]
3394        fn encode_is_copy() -> bool {
3395            true
3396        }
3397
3398        #[inline(always)]
3399        fn decode_is_copy() -> bool {
3400            false
3401        }
3402    }
3403
3404    impl fidl::encoding::ValueTypeMarker for PointerEventType {
3405        type Borrowed<'a> = Self;
3406        #[inline(always)]
3407        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3408            *value
3409        }
3410    }
3411
3412    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3413        for PointerEventType
3414    {
3415        #[inline]
3416        unsafe fn encode(
3417            self,
3418            encoder: &mut fidl::encoding::Encoder<'_, D>,
3419            offset: usize,
3420            _depth: fidl::encoding::Depth,
3421        ) -> fidl::Result<()> {
3422            encoder.debug_check_bounds::<Self>(offset);
3423            encoder.write_num(self.into_primitive(), offset);
3424            Ok(())
3425        }
3426    }
3427
3428    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventType {
3429        #[inline(always)]
3430        fn new_empty() -> Self {
3431            Self::Touch
3432        }
3433
3434        #[inline]
3435        unsafe fn decode(
3436            &mut self,
3437            decoder: &mut fidl::encoding::Decoder<'_, D>,
3438            offset: usize,
3439            _depth: fidl::encoding::Depth,
3440        ) -> fidl::Result<()> {
3441            decoder.debug_check_bounds::<Self>(offset);
3442            let prim = decoder.read_num::<u32>(offset);
3443
3444            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3445            Ok(())
3446        }
3447    }
3448    unsafe impl fidl::encoding::TypeMarker for SensorLocation {
3449        type Owned = Self;
3450
3451        #[inline(always)]
3452        fn inline_align(_context: fidl::encoding::Context) -> usize {
3453            std::mem::align_of::<u32>()
3454        }
3455
3456        #[inline(always)]
3457        fn inline_size(_context: fidl::encoding::Context) -> usize {
3458            std::mem::size_of::<u32>()
3459        }
3460
3461        #[inline(always)]
3462        fn encode_is_copy() -> bool {
3463            false
3464        }
3465
3466        #[inline(always)]
3467        fn decode_is_copy() -> bool {
3468            false
3469        }
3470    }
3471
3472    impl fidl::encoding::ValueTypeMarker for SensorLocation {
3473        type Borrowed<'a> = Self;
3474        #[inline(always)]
3475        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3476            *value
3477        }
3478    }
3479
3480    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorLocation {
3481        #[inline]
3482        unsafe fn encode(
3483            self,
3484            encoder: &mut fidl::encoding::Encoder<'_, D>,
3485            offset: usize,
3486            _depth: fidl::encoding::Depth,
3487        ) -> fidl::Result<()> {
3488            encoder.debug_check_bounds::<Self>(offset);
3489            encoder.write_num(self.into_primitive(), offset);
3490            Ok(())
3491        }
3492    }
3493
3494    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorLocation {
3495        #[inline(always)]
3496        fn new_empty() -> Self {
3497            Self::unknown()
3498        }
3499
3500        #[inline]
3501        unsafe fn decode(
3502            &mut self,
3503            decoder: &mut fidl::encoding::Decoder<'_, D>,
3504            offset: usize,
3505            _depth: fidl::encoding::Depth,
3506        ) -> fidl::Result<()> {
3507            decoder.debug_check_bounds::<Self>(offset);
3508            let prim = decoder.read_num::<u32>(offset);
3509
3510            *self = Self::from_primitive_allow_unknown(prim);
3511            Ok(())
3512        }
3513    }
3514    unsafe impl fidl::encoding::TypeMarker for SensorType {
3515        type Owned = Self;
3516
3517        #[inline(always)]
3518        fn inline_align(_context: fidl::encoding::Context) -> usize {
3519            std::mem::align_of::<u32>()
3520        }
3521
3522        #[inline(always)]
3523        fn inline_size(_context: fidl::encoding::Context) -> usize {
3524            std::mem::size_of::<u32>()
3525        }
3526
3527        #[inline(always)]
3528        fn encode_is_copy() -> bool {
3529            false
3530        }
3531
3532        #[inline(always)]
3533        fn decode_is_copy() -> bool {
3534            false
3535        }
3536    }
3537
3538    impl fidl::encoding::ValueTypeMarker for SensorType {
3539        type Borrowed<'a> = Self;
3540        #[inline(always)]
3541        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3542            *value
3543        }
3544    }
3545
3546    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
3547        #[inline]
3548        unsafe fn encode(
3549            self,
3550            encoder: &mut fidl::encoding::Encoder<'_, D>,
3551            offset: usize,
3552            _depth: fidl::encoding::Depth,
3553        ) -> fidl::Result<()> {
3554            encoder.debug_check_bounds::<Self>(offset);
3555            encoder.write_num(self.into_primitive(), offset);
3556            Ok(())
3557        }
3558    }
3559
3560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
3561        #[inline(always)]
3562        fn new_empty() -> Self {
3563            Self::unknown()
3564        }
3565
3566        #[inline]
3567        unsafe fn decode(
3568            &mut self,
3569            decoder: &mut fidl::encoding::Decoder<'_, D>,
3570            offset: usize,
3571            _depth: fidl::encoding::Depth,
3572        ) -> fidl::Result<()> {
3573            decoder.debug_check_bounds::<Self>(offset);
3574            let prim = decoder.read_num::<u32>(offset);
3575
3576            *self = Self::from_primitive_allow_unknown(prim);
3577            Ok(())
3578        }
3579    }
3580    unsafe impl fidl::encoding::TypeMarker for TextAffinity {
3581        type Owned = Self;
3582
3583        #[inline(always)]
3584        fn inline_align(_context: fidl::encoding::Context) -> usize {
3585            std::mem::align_of::<u32>()
3586        }
3587
3588        #[inline(always)]
3589        fn inline_size(_context: fidl::encoding::Context) -> usize {
3590            std::mem::size_of::<u32>()
3591        }
3592
3593        #[inline(always)]
3594        fn encode_is_copy() -> bool {
3595            true
3596        }
3597
3598        #[inline(always)]
3599        fn decode_is_copy() -> bool {
3600            false
3601        }
3602    }
3603
3604    impl fidl::encoding::ValueTypeMarker for TextAffinity {
3605        type Borrowed<'a> = Self;
3606        #[inline(always)]
3607        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3608            *value
3609        }
3610    }
3611
3612    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TextAffinity {
3613        #[inline]
3614        unsafe fn encode(
3615            self,
3616            encoder: &mut fidl::encoding::Encoder<'_, D>,
3617            offset: usize,
3618            _depth: fidl::encoding::Depth,
3619        ) -> fidl::Result<()> {
3620            encoder.debug_check_bounds::<Self>(offset);
3621            encoder.write_num(self.into_primitive(), offset);
3622            Ok(())
3623        }
3624    }
3625
3626    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextAffinity {
3627        #[inline(always)]
3628        fn new_empty() -> Self {
3629            Self::Upstream
3630        }
3631
3632        #[inline]
3633        unsafe fn decode(
3634            &mut self,
3635            decoder: &mut fidl::encoding::Decoder<'_, D>,
3636            offset: usize,
3637            _depth: fidl::encoding::Depth,
3638        ) -> fidl::Result<()> {
3639            decoder.debug_check_bounds::<Self>(offset);
3640            let prim = decoder.read_num::<u32>(offset);
3641
3642            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3643            Ok(())
3644        }
3645    }
3646
3647    impl fidl::encoding::ValueTypeMarker for Axis {
3648        type Borrowed<'a> = &'a Self;
3649        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3650            value
3651        }
3652    }
3653
3654    unsafe impl fidl::encoding::TypeMarker for Axis {
3655        type Owned = Self;
3656
3657        #[inline(always)]
3658        fn inline_align(_context: fidl::encoding::Context) -> usize {
3659            4
3660        }
3661
3662        #[inline(always)]
3663        fn inline_size(_context: fidl::encoding::Context) -> usize {
3664            16
3665        }
3666    }
3667
3668    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
3669        #[inline]
3670        unsafe fn encode(
3671            self,
3672            encoder: &mut fidl::encoding::Encoder<'_, D>,
3673            offset: usize,
3674            _depth: fidl::encoding::Depth,
3675        ) -> fidl::Result<()> {
3676            encoder.debug_check_bounds::<Axis>(offset);
3677            // Delegate to tuple encoding.
3678            fidl::encoding::Encode::<Axis, D>::encode(
3679                (
3680                    <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
3681                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
3682                    <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
3683                ),
3684                encoder,
3685                offset,
3686                _depth,
3687            )
3688        }
3689    }
3690    unsafe impl<
3691            D: fidl::encoding::ResourceDialect,
3692            T0: fidl::encoding::Encode<Range, D>,
3693            T1: fidl::encoding::Encode<i32, D>,
3694            T2: fidl::encoding::Encode<AxisScale, D>,
3695        > fidl::encoding::Encode<Axis, D> for (T0, T1, T2)
3696    {
3697        #[inline]
3698        unsafe fn encode(
3699            self,
3700            encoder: &mut fidl::encoding::Encoder<'_, D>,
3701            offset: usize,
3702            depth: fidl::encoding::Depth,
3703        ) -> fidl::Result<()> {
3704            encoder.debug_check_bounds::<Axis>(offset);
3705            // Zero out padding regions. There's no need to apply masks
3706            // because the unmasked parts will be overwritten by fields.
3707            // Write the fields.
3708            self.0.encode(encoder, offset + 0, depth)?;
3709            self.1.encode(encoder, offset + 8, depth)?;
3710            self.2.encode(encoder, offset + 12, depth)?;
3711            Ok(())
3712        }
3713    }
3714
3715    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
3716        #[inline(always)]
3717        fn new_empty() -> Self {
3718            Self {
3719                range: fidl::new_empty!(Range, D),
3720                resolution: fidl::new_empty!(i32, D),
3721                scale: fidl::new_empty!(AxisScale, D),
3722            }
3723        }
3724
3725        #[inline]
3726        unsafe fn decode(
3727            &mut self,
3728            decoder: &mut fidl::encoding::Decoder<'_, D>,
3729            offset: usize,
3730            _depth: fidl::encoding::Depth,
3731        ) -> fidl::Result<()> {
3732            decoder.debug_check_bounds::<Self>(offset);
3733            // Verify that padding bytes are zero.
3734            fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
3735            fidl::decode!(i32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
3736            fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
3737            Ok(())
3738        }
3739    }
3740
3741    impl fidl::encoding::ValueTypeMarker for AxisF {
3742        type Borrowed<'a> = &'a Self;
3743        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3744            value
3745        }
3746    }
3747
3748    unsafe impl fidl::encoding::TypeMarker for AxisF {
3749        type Owned = Self;
3750
3751        #[inline(always)]
3752        fn inline_align(_context: fidl::encoding::Context) -> usize {
3753            4
3754        }
3755
3756        #[inline(always)]
3757        fn inline_size(_context: fidl::encoding::Context) -> usize {
3758            16
3759        }
3760    }
3761
3762    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AxisF, D> for &AxisF {
3763        #[inline]
3764        unsafe fn encode(
3765            self,
3766            encoder: &mut fidl::encoding::Encoder<'_, D>,
3767            offset: usize,
3768            _depth: fidl::encoding::Depth,
3769        ) -> fidl::Result<()> {
3770            encoder.debug_check_bounds::<AxisF>(offset);
3771            // Delegate to tuple encoding.
3772            fidl::encoding::Encode::<AxisF, D>::encode(
3773                (
3774                    <RangeF as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
3775                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
3776                    <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
3777                ),
3778                encoder,
3779                offset,
3780                _depth,
3781            )
3782        }
3783    }
3784    unsafe impl<
3785            D: fidl::encoding::ResourceDialect,
3786            T0: fidl::encoding::Encode<RangeF, D>,
3787            T1: fidl::encoding::Encode<f32, D>,
3788            T2: fidl::encoding::Encode<AxisScale, D>,
3789        > fidl::encoding::Encode<AxisF, D> for (T0, T1, T2)
3790    {
3791        #[inline]
3792        unsafe fn encode(
3793            self,
3794            encoder: &mut fidl::encoding::Encoder<'_, D>,
3795            offset: usize,
3796            depth: fidl::encoding::Depth,
3797        ) -> fidl::Result<()> {
3798            encoder.debug_check_bounds::<AxisF>(offset);
3799            // Zero out padding regions. There's no need to apply masks
3800            // because the unmasked parts will be overwritten by fields.
3801            // Write the fields.
3802            self.0.encode(encoder, offset + 0, depth)?;
3803            self.1.encode(encoder, offset + 8, depth)?;
3804            self.2.encode(encoder, offset + 12, depth)?;
3805            Ok(())
3806        }
3807    }
3808
3809    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisF {
3810        #[inline(always)]
3811        fn new_empty() -> Self {
3812            Self {
3813                range: fidl::new_empty!(RangeF, D),
3814                resolution: fidl::new_empty!(f32, D),
3815                scale: fidl::new_empty!(AxisScale, D),
3816            }
3817        }
3818
3819        #[inline]
3820        unsafe fn decode(
3821            &mut self,
3822            decoder: &mut fidl::encoding::Decoder<'_, D>,
3823            offset: usize,
3824            _depth: fidl::encoding::Depth,
3825        ) -> fidl::Result<()> {
3826            decoder.debug_check_bounds::<Self>(offset);
3827            // Verify that padding bytes are zero.
3828            fidl::decode!(RangeF, D, &mut self.range, decoder, offset + 0, _depth)?;
3829            fidl::decode!(f32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
3830            fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
3831            Ok(())
3832        }
3833    }
3834
3835    impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
3836        type Borrowed<'a> = &'a Self;
3837        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3838            value
3839        }
3840    }
3841
3842    unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
3843        type Owned = Self;
3844
3845        #[inline(always)]
3846        fn inline_align(_context: fidl::encoding::Context) -> usize {
3847            8
3848        }
3849
3850        #[inline(always)]
3851        fn inline_size(_context: fidl::encoding::Context) -> usize {
3852            56
3853        }
3854    }
3855
3856    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
3857        for &DeviceDescriptor
3858    {
3859        #[inline]
3860        unsafe fn encode(
3861            self,
3862            encoder: &mut fidl::encoding::Encoder<'_, D>,
3863            offset: usize,
3864            _depth: fidl::encoding::Depth,
3865        ) -> fidl::Result<()> {
3866            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
3867            // Delegate to tuple encoding.
3868            fidl::encoding::Encode::<DeviceDescriptor, D>::encode(
3869                (
3870                    <fidl::encoding::Boxed<DeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_info),
3871                    <fidl::encoding::Boxed<KeyboardDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
3872                    <fidl::encoding::Boxed<MediaButtonsDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
3873                    <fidl::encoding::Boxed<MouseDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
3874                    <fidl::encoding::Boxed<StylusDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
3875                    <fidl::encoding::Boxed<TouchscreenDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
3876                    <fidl::encoding::Boxed<SensorDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
3877                ),
3878                encoder, offset, _depth
3879            )
3880        }
3881    }
3882    unsafe impl<
3883            D: fidl::encoding::ResourceDialect,
3884            T0: fidl::encoding::Encode<fidl::encoding::Boxed<DeviceInfo>, D>,
3885            T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardDescriptor>, D>,
3886            T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsDescriptor>, D>,
3887            T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseDescriptor>, D>,
3888            T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusDescriptor>, D>,
3889            T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenDescriptor>, D>,
3890            T6: fidl::encoding::Encode<fidl::encoding::Boxed<SensorDescriptor>, D>,
3891        > fidl::encoding::Encode<DeviceDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
3892    {
3893        #[inline]
3894        unsafe fn encode(
3895            self,
3896            encoder: &mut fidl::encoding::Encoder<'_, D>,
3897            offset: usize,
3898            depth: fidl::encoding::Depth,
3899        ) -> fidl::Result<()> {
3900            encoder.debug_check_bounds::<DeviceDescriptor>(offset);
3901            // Zero out padding regions. There's no need to apply masks
3902            // because the unmasked parts will be overwritten by fields.
3903            // Write the fields.
3904            self.0.encode(encoder, offset + 0, depth)?;
3905            self.1.encode(encoder, offset + 8, depth)?;
3906            self.2.encode(encoder, offset + 16, depth)?;
3907            self.3.encode(encoder, offset + 24, depth)?;
3908            self.4.encode(encoder, offset + 32, depth)?;
3909            self.5.encode(encoder, offset + 40, depth)?;
3910            self.6.encode(encoder, offset + 48, depth)?;
3911            Ok(())
3912        }
3913    }
3914
3915    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
3916        #[inline(always)]
3917        fn new_empty() -> Self {
3918            Self {
3919                device_info: fidl::new_empty!(fidl::encoding::Boxed<DeviceInfo>, D),
3920                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardDescriptor>, D),
3921                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsDescriptor>, D),
3922                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseDescriptor>, D),
3923                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusDescriptor>, D),
3924                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenDescriptor>, D),
3925                sensor: fidl::new_empty!(fidl::encoding::Boxed<SensorDescriptor>, D),
3926            }
3927        }
3928
3929        #[inline]
3930        unsafe fn decode(
3931            &mut self,
3932            decoder: &mut fidl::encoding::Decoder<'_, D>,
3933            offset: usize,
3934            _depth: fidl::encoding::Depth,
3935        ) -> fidl::Result<()> {
3936            decoder.debug_check_bounds::<Self>(offset);
3937            // Verify that padding bytes are zero.
3938            fidl::decode!(
3939                fidl::encoding::Boxed<DeviceInfo>,
3940                D,
3941                &mut self.device_info,
3942                decoder,
3943                offset + 0,
3944                _depth
3945            )?;
3946            fidl::decode!(
3947                fidl::encoding::Boxed<KeyboardDescriptor>,
3948                D,
3949                &mut self.keyboard,
3950                decoder,
3951                offset + 8,
3952                _depth
3953            )?;
3954            fidl::decode!(
3955                fidl::encoding::Boxed<MediaButtonsDescriptor>,
3956                D,
3957                &mut self.media_buttons,
3958                decoder,
3959                offset + 16,
3960                _depth
3961            )?;
3962            fidl::decode!(
3963                fidl::encoding::Boxed<MouseDescriptor>,
3964                D,
3965                &mut self.mouse,
3966                decoder,
3967                offset + 24,
3968                _depth
3969            )?;
3970            fidl::decode!(
3971                fidl::encoding::Boxed<StylusDescriptor>,
3972                D,
3973                &mut self.stylus,
3974                decoder,
3975                offset + 32,
3976                _depth
3977            )?;
3978            fidl::decode!(
3979                fidl::encoding::Boxed<TouchscreenDescriptor>,
3980                D,
3981                &mut self.touchscreen,
3982                decoder,
3983                offset + 40,
3984                _depth
3985            )?;
3986            fidl::decode!(
3987                fidl::encoding::Boxed<SensorDescriptor>,
3988                D,
3989                &mut self.sensor,
3990                decoder,
3991                offset + 48,
3992                _depth
3993            )?;
3994            Ok(())
3995        }
3996    }
3997
3998    impl fidl::encoding::ValueTypeMarker for DeviceInfo {
3999        type Borrowed<'a> = &'a Self;
4000        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4001            value
4002        }
4003    }
4004
4005    unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
4006        type Owned = Self;
4007
4008        #[inline(always)]
4009        fn inline_align(_context: fidl::encoding::Context) -> usize {
4010            8
4011        }
4012
4013        #[inline(always)]
4014        fn inline_size(_context: fidl::encoding::Context) -> usize {
4015            32
4016        }
4017    }
4018
4019    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
4020        for &DeviceInfo
4021    {
4022        #[inline]
4023        unsafe fn encode(
4024            self,
4025            encoder: &mut fidl::encoding::Encoder<'_, D>,
4026            offset: usize,
4027            _depth: fidl::encoding::Depth,
4028        ) -> fidl::Result<()> {
4029            encoder.debug_check_bounds::<DeviceInfo>(offset);
4030            // Delegate to tuple encoding.
4031            fidl::encoding::Encode::<DeviceInfo, D>::encode(
4032                (
4033                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
4034                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.product_id),
4035                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
4036                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
4037                        &self.name,
4038                    ),
4039                ),
4040                encoder,
4041                offset,
4042                _depth,
4043            )
4044        }
4045    }
4046    unsafe impl<
4047            D: fidl::encoding::ResourceDialect,
4048            T0: fidl::encoding::Encode<u32, D>,
4049            T1: fidl::encoding::Encode<u32, D>,
4050            T2: fidl::encoding::Encode<u32, D>,
4051            T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
4052        > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3)
4053    {
4054        #[inline]
4055        unsafe fn encode(
4056            self,
4057            encoder: &mut fidl::encoding::Encoder<'_, D>,
4058            offset: usize,
4059            depth: fidl::encoding::Depth,
4060        ) -> fidl::Result<()> {
4061            encoder.debug_check_bounds::<DeviceInfo>(offset);
4062            // Zero out padding regions. There's no need to apply masks
4063            // because the unmasked parts will be overwritten by fields.
4064            unsafe {
4065                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4066                (ptr as *mut u64).write_unaligned(0);
4067            }
4068            // Write the fields.
4069            self.0.encode(encoder, offset + 0, depth)?;
4070            self.1.encode(encoder, offset + 4, depth)?;
4071            self.2.encode(encoder, offset + 8, depth)?;
4072            self.3.encode(encoder, offset + 16, depth)?;
4073            Ok(())
4074        }
4075    }
4076
4077    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
4078        #[inline(always)]
4079        fn new_empty() -> Self {
4080            Self {
4081                vendor_id: fidl::new_empty!(u32, D),
4082                product_id: fidl::new_empty!(u32, D),
4083                version: fidl::new_empty!(u32, D),
4084                name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
4085            }
4086        }
4087
4088        #[inline]
4089        unsafe fn decode(
4090            &mut self,
4091            decoder: &mut fidl::encoding::Decoder<'_, D>,
4092            offset: usize,
4093            _depth: fidl::encoding::Depth,
4094        ) -> fidl::Result<()> {
4095            decoder.debug_check_bounds::<Self>(offset);
4096            // Verify that padding bytes are zero.
4097            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4098            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4099            let mask = 0xffffffff00000000u64;
4100            let maskedval = padval & mask;
4101            if maskedval != 0 {
4102                return Err(fidl::Error::NonZeroPadding {
4103                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4104                });
4105            }
4106            fidl::decode!(u32, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
4107            fidl::decode!(u32, D, &mut self.product_id, decoder, offset + 4, _depth)?;
4108            fidl::decode!(u32, D, &mut self.version, decoder, offset + 8, _depth)?;
4109            fidl::decode!(
4110                fidl::encoding::UnboundedString,
4111                D,
4112                &mut self.name,
4113                decoder,
4114                offset + 16,
4115                _depth
4116            )?;
4117            Ok(())
4118        }
4119    }
4120
4121    impl fidl::encoding::ValueTypeMarker for FocusEvent {
4122        type Borrowed<'a> = &'a Self;
4123        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4124            value
4125        }
4126    }
4127
4128    unsafe impl fidl::encoding::TypeMarker for FocusEvent {
4129        type Owned = Self;
4130
4131        #[inline(always)]
4132        fn inline_align(_context: fidl::encoding::Context) -> usize {
4133            8
4134        }
4135
4136        #[inline(always)]
4137        fn inline_size(_context: fidl::encoding::Context) -> usize {
4138            16
4139        }
4140    }
4141
4142    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FocusEvent, D>
4143        for &FocusEvent
4144    {
4145        #[inline]
4146        unsafe fn encode(
4147            self,
4148            encoder: &mut fidl::encoding::Encoder<'_, D>,
4149            offset: usize,
4150            _depth: fidl::encoding::Depth,
4151        ) -> fidl::Result<()> {
4152            encoder.debug_check_bounds::<FocusEvent>(offset);
4153            // Delegate to tuple encoding.
4154            fidl::encoding::Encode::<FocusEvent, D>::encode(
4155                (
4156                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
4157                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.focused),
4158                ),
4159                encoder,
4160                offset,
4161                _depth,
4162            )
4163        }
4164    }
4165    unsafe impl<
4166            D: fidl::encoding::ResourceDialect,
4167            T0: fidl::encoding::Encode<u64, D>,
4168            T1: fidl::encoding::Encode<bool, D>,
4169        > fidl::encoding::Encode<FocusEvent, D> for (T0, T1)
4170    {
4171        #[inline]
4172        unsafe fn encode(
4173            self,
4174            encoder: &mut fidl::encoding::Encoder<'_, D>,
4175            offset: usize,
4176            depth: fidl::encoding::Depth,
4177        ) -> fidl::Result<()> {
4178            encoder.debug_check_bounds::<FocusEvent>(offset);
4179            // Zero out padding regions. There's no need to apply masks
4180            // because the unmasked parts will be overwritten by fields.
4181            unsafe {
4182                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4183                (ptr as *mut u64).write_unaligned(0);
4184            }
4185            // Write the fields.
4186            self.0.encode(encoder, offset + 0, depth)?;
4187            self.1.encode(encoder, offset + 8, depth)?;
4188            Ok(())
4189        }
4190    }
4191
4192    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FocusEvent {
4193        #[inline(always)]
4194        fn new_empty() -> Self {
4195            Self { event_time: fidl::new_empty!(u64, D), focused: fidl::new_empty!(bool, D) }
4196        }
4197
4198        #[inline]
4199        unsafe fn decode(
4200            &mut self,
4201            decoder: &mut fidl::encoding::Decoder<'_, D>,
4202            offset: usize,
4203            _depth: fidl::encoding::Depth,
4204        ) -> fidl::Result<()> {
4205            decoder.debug_check_bounds::<Self>(offset);
4206            // Verify that padding bytes are zero.
4207            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4208            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4209            let mask = 0xffffffffffffff00u64;
4210            let maskedval = padval & mask;
4211            if maskedval != 0 {
4212                return Err(fidl::Error::NonZeroPadding {
4213                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4214                });
4215            }
4216            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
4217            fidl::decode!(bool, D, &mut self.focused, decoder, offset + 8, _depth)?;
4218            Ok(())
4219        }
4220    }
4221
4222    impl fidl::encoding::ResourceTypeMarker for ImeServiceGetInputMethodEditorRequest {
4223        type Borrowed<'a> = &'a mut Self;
4224        fn take_or_borrow<'a>(
4225            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4226        ) -> Self::Borrowed<'a> {
4227            value
4228        }
4229    }
4230
4231    unsafe impl fidl::encoding::TypeMarker for ImeServiceGetInputMethodEditorRequest {
4232        type Owned = Self;
4233
4234        #[inline(always)]
4235        fn inline_align(_context: fidl::encoding::Context) -> usize {
4236            8
4237        }
4238
4239        #[inline(always)]
4240        fn inline_size(_context: fidl::encoding::Context) -> usize {
4241            80
4242        }
4243    }
4244
4245    unsafe impl
4246        fidl::encoding::Encode<
4247            ImeServiceGetInputMethodEditorRequest,
4248            fidl::encoding::DefaultFuchsiaResourceDialect,
4249        > for &mut ImeServiceGetInputMethodEditorRequest
4250    {
4251        #[inline]
4252        unsafe fn encode(
4253            self,
4254            encoder: &mut fidl::encoding::Encoder<
4255                '_,
4256                fidl::encoding::DefaultFuchsiaResourceDialect,
4257            >,
4258            offset: usize,
4259            _depth: fidl::encoding::Depth,
4260        ) -> fidl::Result<()> {
4261            encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
4262            // Delegate to tuple encoding.
4263            fidl::encoding::Encode::<ImeServiceGetInputMethodEditorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4264                (
4265                    <KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),
4266                    <InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
4267                    <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.initial_state),
4268                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.client),
4269                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.editor),
4270                ),
4271                encoder, offset, _depth
4272            )
4273        }
4274    }
4275    unsafe impl<
4276            T0: fidl::encoding::Encode<KeyboardType, fidl::encoding::DefaultFuchsiaResourceDialect>,
4277            T1: fidl::encoding::Encode<
4278                InputMethodAction,
4279                fidl::encoding::DefaultFuchsiaResourceDialect,
4280            >,
4281            T2: fidl::encoding::Encode<TextInputState, fidl::encoding::DefaultFuchsiaResourceDialect>,
4282            T3: fidl::encoding::Encode<
4283                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
4284                fidl::encoding::DefaultFuchsiaResourceDialect,
4285            >,
4286            T4: fidl::encoding::Encode<
4287                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
4288                fidl::encoding::DefaultFuchsiaResourceDialect,
4289            >,
4290        >
4291        fidl::encoding::Encode<
4292            ImeServiceGetInputMethodEditorRequest,
4293            fidl::encoding::DefaultFuchsiaResourceDialect,
4294        > for (T0, T1, T2, T3, T4)
4295    {
4296        #[inline]
4297        unsafe fn encode(
4298            self,
4299            encoder: &mut fidl::encoding::Encoder<
4300                '_,
4301                fidl::encoding::DefaultFuchsiaResourceDialect,
4302            >,
4303            offset: usize,
4304            depth: fidl::encoding::Depth,
4305        ) -> fidl::Result<()> {
4306            encoder.debug_check_bounds::<ImeServiceGetInputMethodEditorRequest>(offset);
4307            // Zero out padding regions. There's no need to apply masks
4308            // because the unmasked parts will be overwritten by fields.
4309            // Write the fields.
4310            self.0.encode(encoder, offset + 0, depth)?;
4311            self.1.encode(encoder, offset + 4, depth)?;
4312            self.2.encode(encoder, offset + 8, depth)?;
4313            self.3.encode(encoder, offset + 72, depth)?;
4314            self.4.encode(encoder, offset + 76, depth)?;
4315            Ok(())
4316        }
4317    }
4318
4319    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4320        for ImeServiceGetInputMethodEditorRequest
4321    {
4322        #[inline(always)]
4323        fn new_empty() -> Self {
4324            Self {
4325                keyboard_type: fidl::new_empty!(
4326                    KeyboardType,
4327                    fidl::encoding::DefaultFuchsiaResourceDialect
4328                ),
4329                action: fidl::new_empty!(
4330                    InputMethodAction,
4331                    fidl::encoding::DefaultFuchsiaResourceDialect
4332                ),
4333                initial_state: fidl::new_empty!(
4334                    TextInputState,
4335                    fidl::encoding::DefaultFuchsiaResourceDialect
4336                ),
4337                client: fidl::new_empty!(
4338                    fidl::encoding::Endpoint<
4339                        fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>,
4340                    >,
4341                    fidl::encoding::DefaultFuchsiaResourceDialect
4342                ),
4343                editor: fidl::new_empty!(
4344                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
4345                    fidl::encoding::DefaultFuchsiaResourceDialect
4346                ),
4347            }
4348        }
4349
4350        #[inline]
4351        unsafe fn decode(
4352            &mut self,
4353            decoder: &mut fidl::encoding::Decoder<
4354                '_,
4355                fidl::encoding::DefaultFuchsiaResourceDialect,
4356            >,
4357            offset: usize,
4358            _depth: fidl::encoding::Depth,
4359        ) -> fidl::Result<()> {
4360            decoder.debug_check_bounds::<Self>(offset);
4361            // Verify that padding bytes are zero.
4362            fidl::decode!(
4363                KeyboardType,
4364                fidl::encoding::DefaultFuchsiaResourceDialect,
4365                &mut self.keyboard_type,
4366                decoder,
4367                offset + 0,
4368                _depth
4369            )?;
4370            fidl::decode!(
4371                InputMethodAction,
4372                fidl::encoding::DefaultFuchsiaResourceDialect,
4373                &mut self.action,
4374                decoder,
4375                offset + 4,
4376                _depth
4377            )?;
4378            fidl::decode!(
4379                TextInputState,
4380                fidl::encoding::DefaultFuchsiaResourceDialect,
4381                &mut self.initial_state,
4382                decoder,
4383                offset + 8,
4384                _depth
4385            )?;
4386            fidl::decode!(
4387                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<InputMethodEditorClientMarker>>,
4388                fidl::encoding::DefaultFuchsiaResourceDialect,
4389                &mut self.client,
4390                decoder,
4391                offset + 72,
4392                _depth
4393            )?;
4394            fidl::decode!(
4395                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputMethodEditorMarker>>,
4396                fidl::encoding::DefaultFuchsiaResourceDialect,
4397                &mut self.editor,
4398                decoder,
4399                offset + 76,
4400                _depth
4401            )?;
4402            Ok(())
4403        }
4404    }
4405
4406    impl fidl::encoding::ValueTypeMarker for InputDeviceDispatchReportRequest {
4407        type Borrowed<'a> = &'a Self;
4408        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4409            value
4410        }
4411    }
4412
4413    unsafe impl fidl::encoding::TypeMarker for InputDeviceDispatchReportRequest {
4414        type Owned = Self;
4415
4416        #[inline(always)]
4417        fn inline_align(_context: fidl::encoding::Context) -> usize {
4418            8
4419        }
4420
4421        #[inline(always)]
4422        fn inline_size(_context: fidl::encoding::Context) -> usize {
4423            72
4424        }
4425    }
4426
4427    unsafe impl<D: fidl::encoding::ResourceDialect>
4428        fidl::encoding::Encode<InputDeviceDispatchReportRequest, D>
4429        for &InputDeviceDispatchReportRequest
4430    {
4431        #[inline]
4432        unsafe fn encode(
4433            self,
4434            encoder: &mut fidl::encoding::Encoder<'_, D>,
4435            offset: usize,
4436            _depth: fidl::encoding::Depth,
4437        ) -> fidl::Result<()> {
4438            encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
4439            // Delegate to tuple encoding.
4440            fidl::encoding::Encode::<InputDeviceDispatchReportRequest, D>::encode(
4441                (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
4442                encoder,
4443                offset,
4444                _depth,
4445            )
4446        }
4447    }
4448    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
4449        fidl::encoding::Encode<InputDeviceDispatchReportRequest, D> for (T0,)
4450    {
4451        #[inline]
4452        unsafe fn encode(
4453            self,
4454            encoder: &mut fidl::encoding::Encoder<'_, D>,
4455            offset: usize,
4456            depth: fidl::encoding::Depth,
4457        ) -> fidl::Result<()> {
4458            encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
4459            // Zero out padding regions. There's no need to apply masks
4460            // because the unmasked parts will be overwritten by fields.
4461            // Write the fields.
4462            self.0.encode(encoder, offset + 0, depth)?;
4463            Ok(())
4464        }
4465    }
4466
4467    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4468        for InputDeviceDispatchReportRequest
4469    {
4470        #[inline(always)]
4471        fn new_empty() -> Self {
4472            Self { report: fidl::new_empty!(InputReport, D) }
4473        }
4474
4475        #[inline]
4476        unsafe fn decode(
4477            &mut self,
4478            decoder: &mut fidl::encoding::Decoder<'_, D>,
4479            offset: usize,
4480            _depth: fidl::encoding::Depth,
4481        ) -> fidl::Result<()> {
4482            decoder.debug_check_bounds::<Self>(offset);
4483            // Verify that padding bytes are zero.
4484            fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
4485            Ok(())
4486        }
4487    }
4488
4489    impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientDidUpdateStateRequest {
4490        type Borrowed<'a> = &'a Self;
4491        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4492            value
4493        }
4494    }
4495
4496    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientDidUpdateStateRequest {
4497        type Owned = Self;
4498
4499        #[inline(always)]
4500        fn inline_align(_context: fidl::encoding::Context) -> usize {
4501            8
4502        }
4503
4504        #[inline(always)]
4505        fn inline_size(_context: fidl::encoding::Context) -> usize {
4506            80
4507        }
4508    }
4509
4510    unsafe impl<D: fidl::encoding::ResourceDialect>
4511        fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D>
4512        for &InputMethodEditorClientDidUpdateStateRequest
4513    {
4514        #[inline]
4515        unsafe fn encode(
4516            self,
4517            encoder: &mut fidl::encoding::Encoder<'_, D>,
4518            offset: usize,
4519            _depth: fidl::encoding::Depth,
4520        ) -> fidl::Result<()> {
4521            encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
4522            // Delegate to tuple encoding.
4523            fidl::encoding::Encode::<InputMethodEditorClientDidUpdateStateRequest, D>::encode(
4524                (
4525                    <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
4526                    <fidl::encoding::OptionalUnion<InputEvent> as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
4527                ),
4528                encoder, offset, _depth
4529            )
4530        }
4531    }
4532    unsafe impl<
4533            D: fidl::encoding::ResourceDialect,
4534            T0: fidl::encoding::Encode<TextInputState, D>,
4535            T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<InputEvent>, D>,
4536        > fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D> for (T0, T1)
4537    {
4538        #[inline]
4539        unsafe fn encode(
4540            self,
4541            encoder: &mut fidl::encoding::Encoder<'_, D>,
4542            offset: usize,
4543            depth: fidl::encoding::Depth,
4544        ) -> fidl::Result<()> {
4545            encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
4546            // Zero out padding regions. There's no need to apply masks
4547            // because the unmasked parts will be overwritten by fields.
4548            // Write the fields.
4549            self.0.encode(encoder, offset + 0, depth)?;
4550            self.1.encode(encoder, offset + 64, depth)?;
4551            Ok(())
4552        }
4553    }
4554
4555    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4556        for InputMethodEditorClientDidUpdateStateRequest
4557    {
4558        #[inline(always)]
4559        fn new_empty() -> Self {
4560            Self {
4561                state: fidl::new_empty!(TextInputState, D),
4562                event: fidl::new_empty!(fidl::encoding::OptionalUnion<InputEvent>, D),
4563            }
4564        }
4565
4566        #[inline]
4567        unsafe fn decode(
4568            &mut self,
4569            decoder: &mut fidl::encoding::Decoder<'_, D>,
4570            offset: usize,
4571            _depth: fidl::encoding::Depth,
4572        ) -> fidl::Result<()> {
4573            decoder.debug_check_bounds::<Self>(offset);
4574            // Verify that padding bytes are zero.
4575            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
4576            fidl::decode!(
4577                fidl::encoding::OptionalUnion<InputEvent>,
4578                D,
4579                &mut self.event,
4580                decoder,
4581                offset + 64,
4582                _depth
4583            )?;
4584            Ok(())
4585        }
4586    }
4587
4588    impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientOnActionRequest {
4589        type Borrowed<'a> = &'a Self;
4590        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4591            value
4592        }
4593    }
4594
4595    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientOnActionRequest {
4596        type Owned = Self;
4597
4598        #[inline(always)]
4599        fn inline_align(_context: fidl::encoding::Context) -> usize {
4600            4
4601        }
4602
4603        #[inline(always)]
4604        fn inline_size(_context: fidl::encoding::Context) -> usize {
4605            4
4606        }
4607    }
4608
4609    unsafe impl<D: fidl::encoding::ResourceDialect>
4610        fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D>
4611        for &InputMethodEditorClientOnActionRequest
4612    {
4613        #[inline]
4614        unsafe fn encode(
4615            self,
4616            encoder: &mut fidl::encoding::Encoder<'_, D>,
4617            offset: usize,
4618            _depth: fidl::encoding::Depth,
4619        ) -> fidl::Result<()> {
4620            encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
4621            // Delegate to tuple encoding.
4622            fidl::encoding::Encode::<InputMethodEditorClientOnActionRequest, D>::encode(
4623                (<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
4624                encoder,
4625                offset,
4626                _depth,
4627            )
4628        }
4629    }
4630    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputMethodAction, D>>
4631        fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D> for (T0,)
4632    {
4633        #[inline]
4634        unsafe fn encode(
4635            self,
4636            encoder: &mut fidl::encoding::Encoder<'_, D>,
4637            offset: usize,
4638            depth: fidl::encoding::Depth,
4639        ) -> fidl::Result<()> {
4640            encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
4641            // Zero out padding regions. There's no need to apply masks
4642            // because the unmasked parts will be overwritten by fields.
4643            // Write the fields.
4644            self.0.encode(encoder, offset + 0, depth)?;
4645            Ok(())
4646        }
4647    }
4648
4649    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4650        for InputMethodEditorClientOnActionRequest
4651    {
4652        #[inline(always)]
4653        fn new_empty() -> Self {
4654            Self { action: fidl::new_empty!(InputMethodAction, D) }
4655        }
4656
4657        #[inline]
4658        unsafe fn decode(
4659            &mut self,
4660            decoder: &mut fidl::encoding::Decoder<'_, D>,
4661            offset: usize,
4662            _depth: fidl::encoding::Depth,
4663        ) -> fidl::Result<()> {
4664            decoder.debug_check_bounds::<Self>(offset);
4665            // Verify that padding bytes are zero.
4666            fidl::decode!(InputMethodAction, D, &mut self.action, decoder, offset + 0, _depth)?;
4667            Ok(())
4668        }
4669    }
4670
4671    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
4672        type Borrowed<'a> = &'a Self;
4673        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4674            value
4675        }
4676    }
4677
4678    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Request {
4679        type Owned = Self;
4680
4681        #[inline(always)]
4682        fn inline_align(_context: fidl::encoding::Context) -> usize {
4683            8
4684        }
4685
4686        #[inline(always)]
4687        fn inline_size(_context: fidl::encoding::Context) -> usize {
4688            16
4689        }
4690    }
4691
4692    unsafe impl<D: fidl::encoding::ResourceDialect>
4693        fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D>
4694        for &InputMethodEditorDispatchKey3Request
4695    {
4696        #[inline]
4697        unsafe fn encode(
4698            self,
4699            encoder: &mut fidl::encoding::Encoder<'_, D>,
4700            offset: usize,
4701            _depth: fidl::encoding::Depth,
4702        ) -> fidl::Result<()> {
4703            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
4704            // Delegate to tuple encoding.
4705            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request, D>::encode(
4706                (<fidl_fuchsia_ui_input3::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(
4707                    &self.event,
4708                ),),
4709                encoder,
4710                offset,
4711                _depth,
4712            )
4713        }
4714    }
4715    unsafe impl<
4716            D: fidl::encoding::ResourceDialect,
4717            T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3::KeyEvent, D>,
4718        > fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D> for (T0,)
4719    {
4720        #[inline]
4721        unsafe fn encode(
4722            self,
4723            encoder: &mut fidl::encoding::Encoder<'_, D>,
4724            offset: usize,
4725            depth: fidl::encoding::Depth,
4726        ) -> fidl::Result<()> {
4727            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
4728            // Zero out padding regions. There's no need to apply masks
4729            // because the unmasked parts will be overwritten by fields.
4730            // Write the fields.
4731            self.0.encode(encoder, offset + 0, depth)?;
4732            Ok(())
4733        }
4734    }
4735
4736    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4737        for InputMethodEditorDispatchKey3Request
4738    {
4739        #[inline(always)]
4740        fn new_empty() -> Self {
4741            Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3::KeyEvent, D) }
4742        }
4743
4744        #[inline]
4745        unsafe fn decode(
4746            &mut self,
4747            decoder: &mut fidl::encoding::Decoder<'_, D>,
4748            offset: usize,
4749            _depth: fidl::encoding::Depth,
4750        ) -> fidl::Result<()> {
4751            decoder.debug_check_bounds::<Self>(offset);
4752            // Verify that padding bytes are zero.
4753            fidl::decode!(
4754                fidl_fuchsia_ui_input3::KeyEvent,
4755                D,
4756                &mut self.event,
4757                decoder,
4758                offset + 0,
4759                _depth
4760            )?;
4761            Ok(())
4762        }
4763    }
4764
4765    impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
4766        type Borrowed<'a> = &'a Self;
4767        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4768            value
4769        }
4770    }
4771
4772    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Response {
4773        type Owned = Self;
4774
4775        #[inline(always)]
4776        fn inline_align(_context: fidl::encoding::Context) -> usize {
4777            1
4778        }
4779
4780        #[inline(always)]
4781        fn inline_size(_context: fidl::encoding::Context) -> usize {
4782            1
4783        }
4784    }
4785
4786    unsafe impl<D: fidl::encoding::ResourceDialect>
4787        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D>
4788        for &InputMethodEditorDispatchKey3Response
4789    {
4790        #[inline]
4791        unsafe fn encode(
4792            self,
4793            encoder: &mut fidl::encoding::Encoder<'_, D>,
4794            offset: usize,
4795            _depth: fidl::encoding::Depth,
4796        ) -> fidl::Result<()> {
4797            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
4798            // Delegate to tuple encoding.
4799            fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response, D>::encode(
4800                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
4801                encoder,
4802                offset,
4803                _depth,
4804            )
4805        }
4806    }
4807    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4808        fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D> for (T0,)
4809    {
4810        #[inline]
4811        unsafe fn encode(
4812            self,
4813            encoder: &mut fidl::encoding::Encoder<'_, D>,
4814            offset: usize,
4815            depth: fidl::encoding::Depth,
4816        ) -> fidl::Result<()> {
4817            encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
4818            // Zero out padding regions. There's no need to apply masks
4819            // because the unmasked parts will be overwritten by fields.
4820            // Write the fields.
4821            self.0.encode(encoder, offset + 0, depth)?;
4822            Ok(())
4823        }
4824    }
4825
4826    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4827        for InputMethodEditorDispatchKey3Response
4828    {
4829        #[inline(always)]
4830        fn new_empty() -> Self {
4831            Self { handled: fidl::new_empty!(bool, D) }
4832        }
4833
4834        #[inline]
4835        unsafe fn decode(
4836            &mut self,
4837            decoder: &mut fidl::encoding::Decoder<'_, D>,
4838            offset: usize,
4839            _depth: fidl::encoding::Depth,
4840        ) -> fidl::Result<()> {
4841            decoder.debug_check_bounds::<Self>(offset);
4842            // Verify that padding bytes are zero.
4843            fidl::decode!(bool, D, &mut self.handled, decoder, offset + 0, _depth)?;
4844            Ok(())
4845        }
4846    }
4847
4848    impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
4849        type Borrowed<'a> = &'a Self;
4850        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4851            value
4852        }
4853    }
4854
4855    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorInjectInputRequest {
4856        type Owned = Self;
4857
4858        #[inline(always)]
4859        fn inline_align(_context: fidl::encoding::Context) -> usize {
4860            8
4861        }
4862
4863        #[inline(always)]
4864        fn inline_size(_context: fidl::encoding::Context) -> usize {
4865            16
4866        }
4867    }
4868
4869    unsafe impl<D: fidl::encoding::ResourceDialect>
4870        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D>
4871        for &InputMethodEditorInjectInputRequest
4872    {
4873        #[inline]
4874        unsafe fn encode(
4875            self,
4876            encoder: &mut fidl::encoding::Encoder<'_, D>,
4877            offset: usize,
4878            _depth: fidl::encoding::Depth,
4879        ) -> fidl::Result<()> {
4880            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
4881            // Delegate to tuple encoding.
4882            fidl::encoding::Encode::<InputMethodEditorInjectInputRequest, D>::encode(
4883                (<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
4884                encoder,
4885                offset,
4886                _depth,
4887            )
4888        }
4889    }
4890    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputEvent, D>>
4891        fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D> for (T0,)
4892    {
4893        #[inline]
4894        unsafe fn encode(
4895            self,
4896            encoder: &mut fidl::encoding::Encoder<'_, D>,
4897            offset: usize,
4898            depth: fidl::encoding::Depth,
4899        ) -> fidl::Result<()> {
4900            encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
4901            // Zero out padding regions. There's no need to apply masks
4902            // because the unmasked parts will be overwritten by fields.
4903            // Write the fields.
4904            self.0.encode(encoder, offset + 0, depth)?;
4905            Ok(())
4906        }
4907    }
4908
4909    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4910        for InputMethodEditorInjectInputRequest
4911    {
4912        #[inline(always)]
4913        fn new_empty() -> Self {
4914            Self { event: fidl::new_empty!(InputEvent, D) }
4915        }
4916
4917        #[inline]
4918        unsafe fn decode(
4919            &mut self,
4920            decoder: &mut fidl::encoding::Decoder<'_, D>,
4921            offset: usize,
4922            _depth: fidl::encoding::Depth,
4923        ) -> fidl::Result<()> {
4924            decoder.debug_check_bounds::<Self>(offset);
4925            // Verify that padding bytes are zero.
4926            fidl::decode!(InputEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
4927            Ok(())
4928        }
4929    }
4930
4931    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
4932        type Borrowed<'a> = &'a Self;
4933        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4934            value
4935        }
4936    }
4937
4938    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetKeyboardTypeRequest {
4939        type Owned = Self;
4940
4941        #[inline(always)]
4942        fn inline_align(_context: fidl::encoding::Context) -> usize {
4943            4
4944        }
4945
4946        #[inline(always)]
4947        fn inline_size(_context: fidl::encoding::Context) -> usize {
4948            4
4949        }
4950    }
4951
4952    unsafe impl<D: fidl::encoding::ResourceDialect>
4953        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D>
4954        for &InputMethodEditorSetKeyboardTypeRequest
4955    {
4956        #[inline]
4957        unsafe fn encode(
4958            self,
4959            encoder: &mut fidl::encoding::Encoder<'_, D>,
4960            offset: usize,
4961            _depth: fidl::encoding::Depth,
4962        ) -> fidl::Result<()> {
4963            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
4964            // Delegate to tuple encoding.
4965            fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest, D>::encode(
4966                (<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
4967                encoder,
4968                offset,
4969                _depth,
4970            )
4971        }
4972    }
4973    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardType, D>>
4974        fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D> for (T0,)
4975    {
4976        #[inline]
4977        unsafe fn encode(
4978            self,
4979            encoder: &mut fidl::encoding::Encoder<'_, D>,
4980            offset: usize,
4981            depth: fidl::encoding::Depth,
4982        ) -> fidl::Result<()> {
4983            encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
4984            // Zero out padding regions. There's no need to apply masks
4985            // because the unmasked parts will be overwritten by fields.
4986            // Write the fields.
4987            self.0.encode(encoder, offset + 0, depth)?;
4988            Ok(())
4989        }
4990    }
4991
4992    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4993        for InputMethodEditorSetKeyboardTypeRequest
4994    {
4995        #[inline(always)]
4996        fn new_empty() -> Self {
4997            Self { keyboard_type: fidl::new_empty!(KeyboardType, D) }
4998        }
4999
5000        #[inline]
5001        unsafe fn decode(
5002            &mut self,
5003            decoder: &mut fidl::encoding::Decoder<'_, D>,
5004            offset: usize,
5005            _depth: fidl::encoding::Depth,
5006        ) -> fidl::Result<()> {
5007            decoder.debug_check_bounds::<Self>(offset);
5008            // Verify that padding bytes are zero.
5009            fidl::decode!(KeyboardType, D, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
5010            Ok(())
5011        }
5012    }
5013
5014    impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
5015        type Borrowed<'a> = &'a Self;
5016        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5017            value
5018        }
5019    }
5020
5021    unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetStateRequest {
5022        type Owned = Self;
5023
5024        #[inline(always)]
5025        fn inline_align(_context: fidl::encoding::Context) -> usize {
5026            8
5027        }
5028
5029        #[inline(always)]
5030        fn inline_size(_context: fidl::encoding::Context) -> usize {
5031            64
5032        }
5033    }
5034
5035    unsafe impl<D: fidl::encoding::ResourceDialect>
5036        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D>
5037        for &InputMethodEditorSetStateRequest
5038    {
5039        #[inline]
5040        unsafe fn encode(
5041            self,
5042            encoder: &mut fidl::encoding::Encoder<'_, D>,
5043            offset: usize,
5044            _depth: fidl::encoding::Depth,
5045        ) -> fidl::Result<()> {
5046            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
5047            // Delegate to tuple encoding.
5048            fidl::encoding::Encode::<InputMethodEditorSetStateRequest, D>::encode(
5049                (<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
5050                encoder,
5051                offset,
5052                _depth,
5053            )
5054        }
5055    }
5056    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TextInputState, D>>
5057        fidl::encoding::Encode<InputMethodEditorSetStateRequest, D> for (T0,)
5058    {
5059        #[inline]
5060        unsafe fn encode(
5061            self,
5062            encoder: &mut fidl::encoding::Encoder<'_, D>,
5063            offset: usize,
5064            depth: fidl::encoding::Depth,
5065        ) -> fidl::Result<()> {
5066            encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
5067            // Zero out padding regions. There's no need to apply masks
5068            // because the unmasked parts will be overwritten by fields.
5069            // Write the fields.
5070            self.0.encode(encoder, offset + 0, depth)?;
5071            Ok(())
5072        }
5073    }
5074
5075    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5076        for InputMethodEditorSetStateRequest
5077    {
5078        #[inline(always)]
5079        fn new_empty() -> Self {
5080            Self { state: fidl::new_empty!(TextInputState, D) }
5081        }
5082
5083        #[inline]
5084        unsafe fn decode(
5085            &mut self,
5086            decoder: &mut fidl::encoding::Decoder<'_, D>,
5087            offset: usize,
5088            _depth: fidl::encoding::Depth,
5089        ) -> fidl::Result<()> {
5090            decoder.debug_check_bounds::<Self>(offset);
5091            // Verify that padding bytes are zero.
5092            fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
5093            Ok(())
5094        }
5095    }
5096
5097    impl fidl::encoding::ValueTypeMarker for InputReport {
5098        type Borrowed<'a> = &'a Self;
5099        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5100            value
5101        }
5102    }
5103
5104    unsafe impl fidl::encoding::TypeMarker for InputReport {
5105        type Owned = Self;
5106
5107        #[inline(always)]
5108        fn inline_align(_context: fidl::encoding::Context) -> usize {
5109            8
5110        }
5111
5112        #[inline(always)]
5113        fn inline_size(_context: fidl::encoding::Context) -> usize {
5114            72
5115        }
5116    }
5117
5118    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
5119        for &InputReport
5120    {
5121        #[inline]
5122        unsafe fn encode(
5123            self,
5124            encoder: &mut fidl::encoding::Encoder<'_, D>,
5125            offset: usize,
5126            _depth: fidl::encoding::Depth,
5127        ) -> fidl::Result<()> {
5128            encoder.debug_check_bounds::<InputReport>(offset);
5129            // Delegate to tuple encoding.
5130            fidl::encoding::Encode::<InputReport, D>::encode(
5131                (
5132                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
5133                    <fidl::encoding::Boxed<KeyboardReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
5134                    <fidl::encoding::Boxed<MediaButtonsReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
5135                    <fidl::encoding::Boxed<MouseReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
5136                    <fidl::encoding::Boxed<StylusReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
5137                    <fidl::encoding::Boxed<TouchscreenReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
5138                    <fidl::encoding::OptionalUnion<SensorReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
5139                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.trace_id),
5140                ),
5141                encoder, offset, _depth
5142            )
5143        }
5144    }
5145    unsafe impl<
5146            D: fidl::encoding::ResourceDialect,
5147            T0: fidl::encoding::Encode<u64, D>,
5148            T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>, D>,
5149            T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>, D>,
5150            T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>, D>,
5151            T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>, D>,
5152            T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>, D>,
5153            T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>, D>,
5154            T7: fidl::encoding::Encode<u64, D>,
5155        > fidl::encoding::Encode<InputReport, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
5156    {
5157        #[inline]
5158        unsafe fn encode(
5159            self,
5160            encoder: &mut fidl::encoding::Encoder<'_, D>,
5161            offset: usize,
5162            depth: fidl::encoding::Depth,
5163        ) -> fidl::Result<()> {
5164            encoder.debug_check_bounds::<InputReport>(offset);
5165            // Zero out padding regions. There's no need to apply masks
5166            // because the unmasked parts will be overwritten by fields.
5167            // Write the fields.
5168            self.0.encode(encoder, offset + 0, depth)?;
5169            self.1.encode(encoder, offset + 8, depth)?;
5170            self.2.encode(encoder, offset + 16, depth)?;
5171            self.3.encode(encoder, offset + 24, depth)?;
5172            self.4.encode(encoder, offset + 32, depth)?;
5173            self.5.encode(encoder, offset + 40, depth)?;
5174            self.6.encode(encoder, offset + 48, depth)?;
5175            self.7.encode(encoder, offset + 64, depth)?;
5176            Ok(())
5177        }
5178    }
5179
5180    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
5181        #[inline(always)]
5182        fn new_empty() -> Self {
5183            Self {
5184                event_time: fidl::new_empty!(u64, D),
5185                keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>, D),
5186                media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>, D),
5187                mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>, D),
5188                stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>, D),
5189                touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>, D),
5190                sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>, D),
5191                trace_id: fidl::new_empty!(u64, D),
5192            }
5193        }
5194
5195        #[inline]
5196        unsafe fn decode(
5197            &mut self,
5198            decoder: &mut fidl::encoding::Decoder<'_, D>,
5199            offset: usize,
5200            _depth: fidl::encoding::Depth,
5201        ) -> fidl::Result<()> {
5202            decoder.debug_check_bounds::<Self>(offset);
5203            // Verify that padding bytes are zero.
5204            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
5205            fidl::decode!(
5206                fidl::encoding::Boxed<KeyboardReport>,
5207                D,
5208                &mut self.keyboard,
5209                decoder,
5210                offset + 8,
5211                _depth
5212            )?;
5213            fidl::decode!(
5214                fidl::encoding::Boxed<MediaButtonsReport>,
5215                D,
5216                &mut self.media_buttons,
5217                decoder,
5218                offset + 16,
5219                _depth
5220            )?;
5221            fidl::decode!(
5222                fidl::encoding::Boxed<MouseReport>,
5223                D,
5224                &mut self.mouse,
5225                decoder,
5226                offset + 24,
5227                _depth
5228            )?;
5229            fidl::decode!(
5230                fidl::encoding::Boxed<StylusReport>,
5231                D,
5232                &mut self.stylus,
5233                decoder,
5234                offset + 32,
5235                _depth
5236            )?;
5237            fidl::decode!(
5238                fidl::encoding::Boxed<TouchscreenReport>,
5239                D,
5240                &mut self.touchscreen,
5241                decoder,
5242                offset + 40,
5243                _depth
5244            )?;
5245            fidl::decode!(
5246                fidl::encoding::OptionalUnion<SensorReport>,
5247                D,
5248                &mut self.sensor,
5249                decoder,
5250                offset + 48,
5251                _depth
5252            )?;
5253            fidl::decode!(u64, D, &mut self.trace_id, decoder, offset + 64, _depth)?;
5254            Ok(())
5255        }
5256    }
5257
5258    impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
5259        type Borrowed<'a> = &'a Self;
5260        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5261            value
5262        }
5263    }
5264
5265    unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
5266        type Owned = Self;
5267
5268        #[inline(always)]
5269        fn inline_align(_context: fidl::encoding::Context) -> usize {
5270            8
5271        }
5272
5273        #[inline(always)]
5274        fn inline_size(_context: fidl::encoding::Context) -> usize {
5275            16
5276        }
5277    }
5278
5279    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
5280        for &KeyboardDescriptor
5281    {
5282        #[inline]
5283        unsafe fn encode(
5284            self,
5285            encoder: &mut fidl::encoding::Encoder<'_, D>,
5286            offset: usize,
5287            _depth: fidl::encoding::Depth,
5288        ) -> fidl::Result<()> {
5289            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
5290            // Delegate to tuple encoding.
5291            fidl::encoding::Encode::<KeyboardDescriptor, D>::encode(
5292                (
5293                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
5294                ),
5295                encoder, offset, _depth
5296            )
5297        }
5298    }
5299    unsafe impl<
5300            D: fidl::encoding::ResourceDialect,
5301            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
5302        > fidl::encoding::Encode<KeyboardDescriptor, D> for (T0,)
5303    {
5304        #[inline]
5305        unsafe fn encode(
5306            self,
5307            encoder: &mut fidl::encoding::Encoder<'_, D>,
5308            offset: usize,
5309            depth: fidl::encoding::Depth,
5310        ) -> fidl::Result<()> {
5311            encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
5312            // Zero out padding regions. There's no need to apply masks
5313            // because the unmasked parts will be overwritten by fields.
5314            // Write the fields.
5315            self.0.encode(encoder, offset + 0, depth)?;
5316            Ok(())
5317        }
5318    }
5319
5320    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
5321        #[inline(always)]
5322        fn new_empty() -> Self {
5323            Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
5324        }
5325
5326        #[inline]
5327        unsafe fn decode(
5328            &mut self,
5329            decoder: &mut fidl::encoding::Decoder<'_, D>,
5330            offset: usize,
5331            _depth: fidl::encoding::Depth,
5332        ) -> fidl::Result<()> {
5333            decoder.debug_check_bounds::<Self>(offset);
5334            // Verify that padding bytes are zero.
5335            fidl::decode!(
5336                fidl::encoding::UnboundedVector<u32>,
5337                D,
5338                &mut self.keys,
5339                decoder,
5340                offset + 0,
5341                _depth
5342            )?;
5343            Ok(())
5344        }
5345    }
5346
5347    impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
5348        type Borrowed<'a> = &'a Self;
5349        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5350            value
5351        }
5352    }
5353
5354    unsafe impl fidl::encoding::TypeMarker for KeyboardEvent {
5355        type Owned = Self;
5356
5357        #[inline(always)]
5358        fn inline_align(_context: fidl::encoding::Context) -> usize {
5359            8
5360        }
5361
5362        #[inline(always)]
5363        fn inline_size(_context: fidl::encoding::Context) -> usize {
5364            32
5365        }
5366    }
5367
5368    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardEvent, D>
5369        for &KeyboardEvent
5370    {
5371        #[inline]
5372        unsafe fn encode(
5373            self,
5374            encoder: &mut fidl::encoding::Encoder<'_, D>,
5375            offset: usize,
5376            _depth: fidl::encoding::Depth,
5377        ) -> fidl::Result<()> {
5378            encoder.debug_check_bounds::<KeyboardEvent>(offset);
5379            // Delegate to tuple encoding.
5380            fidl::encoding::Encode::<KeyboardEvent, D>::encode(
5381                (
5382                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
5383                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
5384                    <KeyboardEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
5385                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hid_usage),
5386                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.code_point),
5387                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.modifiers),
5388                ),
5389                encoder,
5390                offset,
5391                _depth,
5392            )
5393        }
5394    }
5395    unsafe impl<
5396            D: fidl::encoding::ResourceDialect,
5397            T0: fidl::encoding::Encode<u64, D>,
5398            T1: fidl::encoding::Encode<u32, D>,
5399            T2: fidl::encoding::Encode<KeyboardEventPhase, D>,
5400            T3: fidl::encoding::Encode<u32, D>,
5401            T4: fidl::encoding::Encode<u32, D>,
5402            T5: fidl::encoding::Encode<u32, D>,
5403        > fidl::encoding::Encode<KeyboardEvent, D> for (T0, T1, T2, T3, T4, T5)
5404    {
5405        #[inline]
5406        unsafe fn encode(
5407            self,
5408            encoder: &mut fidl::encoding::Encoder<'_, D>,
5409            offset: usize,
5410            depth: fidl::encoding::Depth,
5411        ) -> fidl::Result<()> {
5412            encoder.debug_check_bounds::<KeyboardEvent>(offset);
5413            // Zero out padding regions. There's no need to apply masks
5414            // because the unmasked parts will be overwritten by fields.
5415            unsafe {
5416                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
5417                (ptr as *mut u64).write_unaligned(0);
5418            }
5419            // Write the fields.
5420            self.0.encode(encoder, offset + 0, depth)?;
5421            self.1.encode(encoder, offset + 8, depth)?;
5422            self.2.encode(encoder, offset + 12, depth)?;
5423            self.3.encode(encoder, offset + 16, depth)?;
5424            self.4.encode(encoder, offset + 20, depth)?;
5425            self.5.encode(encoder, offset + 24, depth)?;
5426            Ok(())
5427        }
5428    }
5429
5430    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEvent {
5431        #[inline(always)]
5432        fn new_empty() -> Self {
5433            Self {
5434                event_time: fidl::new_empty!(u64, D),
5435                device_id: fidl::new_empty!(u32, D),
5436                phase: fidl::new_empty!(KeyboardEventPhase, D),
5437                hid_usage: fidl::new_empty!(u32, D),
5438                code_point: fidl::new_empty!(u32, D),
5439                modifiers: fidl::new_empty!(u32, D),
5440            }
5441        }
5442
5443        #[inline]
5444        unsafe fn decode(
5445            &mut self,
5446            decoder: &mut fidl::encoding::Decoder<'_, D>,
5447            offset: usize,
5448            _depth: fidl::encoding::Depth,
5449        ) -> fidl::Result<()> {
5450            decoder.debug_check_bounds::<Self>(offset);
5451            // Verify that padding bytes are zero.
5452            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
5453            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5454            let mask = 0xffffffff00000000u64;
5455            let maskedval = padval & mask;
5456            if maskedval != 0 {
5457                return Err(fidl::Error::NonZeroPadding {
5458                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
5459                });
5460            }
5461            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
5462            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
5463            fidl::decode!(KeyboardEventPhase, D, &mut self.phase, decoder, offset + 12, _depth)?;
5464            fidl::decode!(u32, D, &mut self.hid_usage, decoder, offset + 16, _depth)?;
5465            fidl::decode!(u32, D, &mut self.code_point, decoder, offset + 20, _depth)?;
5466            fidl::decode!(u32, D, &mut self.modifiers, decoder, offset + 24, _depth)?;
5467            Ok(())
5468        }
5469    }
5470
5471    impl fidl::encoding::ValueTypeMarker for KeyboardReport {
5472        type Borrowed<'a> = &'a Self;
5473        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5474            value
5475        }
5476    }
5477
5478    unsafe impl fidl::encoding::TypeMarker for KeyboardReport {
5479        type Owned = Self;
5480
5481        #[inline(always)]
5482        fn inline_align(_context: fidl::encoding::Context) -> usize {
5483            8
5484        }
5485
5486        #[inline(always)]
5487        fn inline_size(_context: fidl::encoding::Context) -> usize {
5488            16
5489        }
5490    }
5491
5492    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardReport, D>
5493        for &KeyboardReport
5494    {
5495        #[inline]
5496        unsafe fn encode(
5497            self,
5498            encoder: &mut fidl::encoding::Encoder<'_, D>,
5499            offset: usize,
5500            _depth: fidl::encoding::Depth,
5501        ) -> fidl::Result<()> {
5502            encoder.debug_check_bounds::<KeyboardReport>(offset);
5503            // Delegate to tuple encoding.
5504            fidl::encoding::Encode::<KeyboardReport, D>::encode(
5505                (
5506                    <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
5507                ),
5508                encoder, offset, _depth
5509            )
5510        }
5511    }
5512    unsafe impl<
5513            D: fidl::encoding::ResourceDialect,
5514            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
5515        > fidl::encoding::Encode<KeyboardReport, D> for (T0,)
5516    {
5517        #[inline]
5518        unsafe fn encode(
5519            self,
5520            encoder: &mut fidl::encoding::Encoder<'_, D>,
5521            offset: usize,
5522            depth: fidl::encoding::Depth,
5523        ) -> fidl::Result<()> {
5524            encoder.debug_check_bounds::<KeyboardReport>(offset);
5525            // Zero out padding regions. There's no need to apply masks
5526            // because the unmasked parts will be overwritten by fields.
5527            // Write the fields.
5528            self.0.encode(encoder, offset + 0, depth)?;
5529            Ok(())
5530        }
5531    }
5532
5533    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardReport {
5534        #[inline(always)]
5535        fn new_empty() -> Self {
5536            Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
5537        }
5538
5539        #[inline]
5540        unsafe fn decode(
5541            &mut self,
5542            decoder: &mut fidl::encoding::Decoder<'_, D>,
5543            offset: usize,
5544            _depth: fidl::encoding::Depth,
5545        ) -> fidl::Result<()> {
5546            decoder.debug_check_bounds::<Self>(offset);
5547            // Verify that padding bytes are zero.
5548            fidl::decode!(
5549                fidl::encoding::UnboundedVector<u32>,
5550                D,
5551                &mut self.pressed_keys,
5552                decoder,
5553                offset + 0,
5554                _depth
5555            )?;
5556            Ok(())
5557        }
5558    }
5559
5560    impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
5561        type Borrowed<'a> = &'a Self;
5562        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5563            value
5564        }
5565    }
5566
5567    unsafe impl fidl::encoding::TypeMarker for MediaButtonsDescriptor {
5568        type Owned = Self;
5569
5570        #[inline(always)]
5571        fn inline_align(_context: fidl::encoding::Context) -> usize {
5572            4
5573        }
5574
5575        #[inline(always)]
5576        fn inline_size(_context: fidl::encoding::Context) -> usize {
5577            4
5578        }
5579        #[inline(always)]
5580        fn encode_is_copy() -> bool {
5581            true
5582        }
5583
5584        #[inline(always)]
5585        fn decode_is_copy() -> bool {
5586            true
5587        }
5588    }
5589
5590    unsafe impl<D: fidl::encoding::ResourceDialect>
5591        fidl::encoding::Encode<MediaButtonsDescriptor, D> for &MediaButtonsDescriptor
5592    {
5593        #[inline]
5594        unsafe fn encode(
5595            self,
5596            encoder: &mut fidl::encoding::Encoder<'_, D>,
5597            offset: usize,
5598            _depth: fidl::encoding::Depth,
5599        ) -> fidl::Result<()> {
5600            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
5601            unsafe {
5602                // Copy the object into the buffer.
5603                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5604                (buf_ptr as *mut MediaButtonsDescriptor)
5605                    .write_unaligned((self as *const MediaButtonsDescriptor).read());
5606                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5607                // done second because the memcpy will write garbage to these bytes.
5608            }
5609            Ok(())
5610        }
5611    }
5612    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
5613        fidl::encoding::Encode<MediaButtonsDescriptor, D> for (T0,)
5614    {
5615        #[inline]
5616        unsafe fn encode(
5617            self,
5618            encoder: &mut fidl::encoding::Encoder<'_, D>,
5619            offset: usize,
5620            depth: fidl::encoding::Depth,
5621        ) -> fidl::Result<()> {
5622            encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
5623            // Zero out padding regions. There's no need to apply masks
5624            // because the unmasked parts will be overwritten by fields.
5625            // Write the fields.
5626            self.0.encode(encoder, offset + 0, depth)?;
5627            Ok(())
5628        }
5629    }
5630
5631    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5632        for MediaButtonsDescriptor
5633    {
5634        #[inline(always)]
5635        fn new_empty() -> Self {
5636            Self { buttons: fidl::new_empty!(u32, D) }
5637        }
5638
5639        #[inline]
5640        unsafe fn decode(
5641            &mut self,
5642            decoder: &mut fidl::encoding::Decoder<'_, D>,
5643            offset: usize,
5644            _depth: fidl::encoding::Depth,
5645        ) -> fidl::Result<()> {
5646            decoder.debug_check_bounds::<Self>(offset);
5647            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5648            // Verify that padding bytes are zero.
5649            // Copy from the buffer into the object.
5650            unsafe {
5651                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
5652            }
5653            Ok(())
5654        }
5655    }
5656
5657    impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
5658        type Borrowed<'a> = &'a Self;
5659        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5660            value
5661        }
5662    }
5663
5664    unsafe impl fidl::encoding::TypeMarker for MediaButtonsReport {
5665        type Owned = Self;
5666
5667        #[inline(always)]
5668        fn inline_align(_context: fidl::encoding::Context) -> usize {
5669            1
5670        }
5671
5672        #[inline(always)]
5673        fn inline_size(_context: fidl::encoding::Context) -> usize {
5674            6
5675        }
5676    }
5677
5678    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsReport, D>
5679        for &MediaButtonsReport
5680    {
5681        #[inline]
5682        unsafe fn encode(
5683            self,
5684            encoder: &mut fidl::encoding::Encoder<'_, D>,
5685            offset: usize,
5686            _depth: fidl::encoding::Depth,
5687        ) -> fidl::Result<()> {
5688            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
5689            // Delegate to tuple encoding.
5690            fidl::encoding::Encode::<MediaButtonsReport, D>::encode(
5691                (
5692                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_up),
5693                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_down),
5694                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mic_mute),
5695                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reset),
5696                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.pause),
5697                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.camera_disable),
5698                ),
5699                encoder,
5700                offset,
5701                _depth,
5702            )
5703        }
5704    }
5705    unsafe impl<
5706            D: fidl::encoding::ResourceDialect,
5707            T0: fidl::encoding::Encode<bool, D>,
5708            T1: fidl::encoding::Encode<bool, D>,
5709            T2: fidl::encoding::Encode<bool, D>,
5710            T3: fidl::encoding::Encode<bool, D>,
5711            T4: fidl::encoding::Encode<bool, D>,
5712            T5: fidl::encoding::Encode<bool, D>,
5713        > fidl::encoding::Encode<MediaButtonsReport, D> for (T0, T1, T2, T3, T4, T5)
5714    {
5715        #[inline]
5716        unsafe fn encode(
5717            self,
5718            encoder: &mut fidl::encoding::Encoder<'_, D>,
5719            offset: usize,
5720            depth: fidl::encoding::Depth,
5721        ) -> fidl::Result<()> {
5722            encoder.debug_check_bounds::<MediaButtonsReport>(offset);
5723            // Zero out padding regions. There's no need to apply masks
5724            // because the unmasked parts will be overwritten by fields.
5725            // Write the fields.
5726            self.0.encode(encoder, offset + 0, depth)?;
5727            self.1.encode(encoder, offset + 1, depth)?;
5728            self.2.encode(encoder, offset + 2, depth)?;
5729            self.3.encode(encoder, offset + 3, depth)?;
5730            self.4.encode(encoder, offset + 4, depth)?;
5731            self.5.encode(encoder, offset + 5, depth)?;
5732            Ok(())
5733        }
5734    }
5735
5736    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsReport {
5737        #[inline(always)]
5738        fn new_empty() -> Self {
5739            Self {
5740                volume_up: fidl::new_empty!(bool, D),
5741                volume_down: fidl::new_empty!(bool, D),
5742                mic_mute: fidl::new_empty!(bool, D),
5743                reset: fidl::new_empty!(bool, D),
5744                pause: fidl::new_empty!(bool, D),
5745                camera_disable: fidl::new_empty!(bool, D),
5746            }
5747        }
5748
5749        #[inline]
5750        unsafe fn decode(
5751            &mut self,
5752            decoder: &mut fidl::encoding::Decoder<'_, D>,
5753            offset: usize,
5754            _depth: fidl::encoding::Depth,
5755        ) -> fidl::Result<()> {
5756            decoder.debug_check_bounds::<Self>(offset);
5757            // Verify that padding bytes are zero.
5758            fidl::decode!(bool, D, &mut self.volume_up, decoder, offset + 0, _depth)?;
5759            fidl::decode!(bool, D, &mut self.volume_down, decoder, offset + 1, _depth)?;
5760            fidl::decode!(bool, D, &mut self.mic_mute, decoder, offset + 2, _depth)?;
5761            fidl::decode!(bool, D, &mut self.reset, decoder, offset + 3, _depth)?;
5762            fidl::decode!(bool, D, &mut self.pause, decoder, offset + 4, _depth)?;
5763            fidl::decode!(bool, D, &mut self.camera_disable, decoder, offset + 5, _depth)?;
5764            Ok(())
5765        }
5766    }
5767
5768    impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
5769        type Borrowed<'a> = &'a Self;
5770        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5771            value
5772        }
5773    }
5774
5775    unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
5776        type Owned = Self;
5777
5778        #[inline(always)]
5779        fn inline_align(_context: fidl::encoding::Context) -> usize {
5780            8
5781        }
5782
5783        #[inline(always)]
5784        fn inline_size(_context: fidl::encoding::Context) -> usize {
5785            56
5786        }
5787    }
5788
5789    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
5790        for &MouseDescriptor
5791    {
5792        #[inline]
5793        unsafe fn encode(
5794            self,
5795            encoder: &mut fidl::encoding::Encoder<'_, D>,
5796            offset: usize,
5797            _depth: fidl::encoding::Depth,
5798        ) -> fidl::Result<()> {
5799            encoder.debug_check_bounds::<MouseDescriptor>(offset);
5800            // Delegate to tuple encoding.
5801            fidl::encoding::Encode::<MouseDescriptor, D>::encode(
5802                (
5803                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_x),
5804                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_y),
5805                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
5806                        &self.vscroll,
5807                    ),
5808                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
5809                        &self.hscroll,
5810                    ),
5811                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
5812                ),
5813                encoder,
5814                offset,
5815                _depth,
5816            )
5817        }
5818    }
5819    unsafe impl<
5820            D: fidl::encoding::ResourceDialect,
5821            T0: fidl::encoding::Encode<Axis, D>,
5822            T1: fidl::encoding::Encode<Axis, D>,
5823            T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
5824            T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
5825            T4: fidl::encoding::Encode<u32, D>,
5826        > fidl::encoding::Encode<MouseDescriptor, D> for (T0, T1, T2, T3, T4)
5827    {
5828        #[inline]
5829        unsafe fn encode(
5830            self,
5831            encoder: &mut fidl::encoding::Encoder<'_, D>,
5832            offset: usize,
5833            depth: fidl::encoding::Depth,
5834        ) -> fidl::Result<()> {
5835            encoder.debug_check_bounds::<MouseDescriptor>(offset);
5836            // Zero out padding regions. There's no need to apply masks
5837            // because the unmasked parts will be overwritten by fields.
5838            unsafe {
5839                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
5840                (ptr as *mut u64).write_unaligned(0);
5841            }
5842            // Write the fields.
5843            self.0.encode(encoder, offset + 0, depth)?;
5844            self.1.encode(encoder, offset + 16, depth)?;
5845            self.2.encode(encoder, offset + 32, depth)?;
5846            self.3.encode(encoder, offset + 40, depth)?;
5847            self.4.encode(encoder, offset + 48, depth)?;
5848            Ok(())
5849        }
5850    }
5851
5852    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
5853        #[inline(always)]
5854        fn new_empty() -> Self {
5855            Self {
5856                rel_x: fidl::new_empty!(Axis, D),
5857                rel_y: fidl::new_empty!(Axis, D),
5858                vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
5859                hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
5860                buttons: fidl::new_empty!(u32, D),
5861            }
5862        }
5863
5864        #[inline]
5865        unsafe fn decode(
5866            &mut self,
5867            decoder: &mut fidl::encoding::Decoder<'_, D>,
5868            offset: usize,
5869            _depth: fidl::encoding::Depth,
5870        ) -> fidl::Result<()> {
5871            decoder.debug_check_bounds::<Self>(offset);
5872            // Verify that padding bytes are zero.
5873            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
5874            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5875            let mask = 0xffffffff00000000u64;
5876            let maskedval = padval & mask;
5877            if maskedval != 0 {
5878                return Err(fidl::Error::NonZeroPadding {
5879                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
5880                });
5881            }
5882            fidl::decode!(Axis, D, &mut self.rel_x, decoder, offset + 0, _depth)?;
5883            fidl::decode!(Axis, D, &mut self.rel_y, decoder, offset + 16, _depth)?;
5884            fidl::decode!(
5885                fidl::encoding::Boxed<Axis>,
5886                D,
5887                &mut self.vscroll,
5888                decoder,
5889                offset + 32,
5890                _depth
5891            )?;
5892            fidl::decode!(
5893                fidl::encoding::Boxed<Axis>,
5894                D,
5895                &mut self.hscroll,
5896                decoder,
5897                offset + 40,
5898                _depth
5899            )?;
5900            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 48, _depth)?;
5901            Ok(())
5902        }
5903    }
5904
5905    impl fidl::encoding::ValueTypeMarker for MouseReport {
5906        type Borrowed<'a> = &'a Self;
5907        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5908            value
5909        }
5910    }
5911
5912    unsafe impl fidl::encoding::TypeMarker for MouseReport {
5913        type Owned = Self;
5914
5915        #[inline(always)]
5916        fn inline_align(_context: fidl::encoding::Context) -> usize {
5917            4
5918        }
5919
5920        #[inline(always)]
5921        fn inline_size(_context: fidl::encoding::Context) -> usize {
5922            20
5923        }
5924        #[inline(always)]
5925        fn encode_is_copy() -> bool {
5926            true
5927        }
5928
5929        #[inline(always)]
5930        fn decode_is_copy() -> bool {
5931            true
5932        }
5933    }
5934
5935    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseReport, D>
5936        for &MouseReport
5937    {
5938        #[inline]
5939        unsafe fn encode(
5940            self,
5941            encoder: &mut fidl::encoding::Encoder<'_, D>,
5942            offset: usize,
5943            _depth: fidl::encoding::Depth,
5944        ) -> fidl::Result<()> {
5945            encoder.debug_check_bounds::<MouseReport>(offset);
5946            unsafe {
5947                // Copy the object into the buffer.
5948                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5949                (buf_ptr as *mut MouseReport).write_unaligned((self as *const MouseReport).read());
5950                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
5951                // done second because the memcpy will write garbage to these bytes.
5952            }
5953            Ok(())
5954        }
5955    }
5956    unsafe impl<
5957            D: fidl::encoding::ResourceDialect,
5958            T0: fidl::encoding::Encode<i32, D>,
5959            T1: fidl::encoding::Encode<i32, D>,
5960            T2: fidl::encoding::Encode<i32, D>,
5961            T3: fidl::encoding::Encode<i32, D>,
5962            T4: fidl::encoding::Encode<u32, D>,
5963        > fidl::encoding::Encode<MouseReport, D> for (T0, T1, T2, T3, T4)
5964    {
5965        #[inline]
5966        unsafe fn encode(
5967            self,
5968            encoder: &mut fidl::encoding::Encoder<'_, D>,
5969            offset: usize,
5970            depth: fidl::encoding::Depth,
5971        ) -> fidl::Result<()> {
5972            encoder.debug_check_bounds::<MouseReport>(offset);
5973            // Zero out padding regions. There's no need to apply masks
5974            // because the unmasked parts will be overwritten by fields.
5975            // Write the fields.
5976            self.0.encode(encoder, offset + 0, depth)?;
5977            self.1.encode(encoder, offset + 4, depth)?;
5978            self.2.encode(encoder, offset + 8, depth)?;
5979            self.3.encode(encoder, offset + 12, depth)?;
5980            self.4.encode(encoder, offset + 16, depth)?;
5981            Ok(())
5982        }
5983    }
5984
5985    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseReport {
5986        #[inline(always)]
5987        fn new_empty() -> Self {
5988            Self {
5989                rel_x: fidl::new_empty!(i32, D),
5990                rel_y: fidl::new_empty!(i32, D),
5991                rel_hscroll: fidl::new_empty!(i32, D),
5992                rel_vscroll: fidl::new_empty!(i32, D),
5993                pressed_buttons: fidl::new_empty!(u32, D),
5994            }
5995        }
5996
5997        #[inline]
5998        unsafe fn decode(
5999            &mut self,
6000            decoder: &mut fidl::encoding::Decoder<'_, D>,
6001            offset: usize,
6002            _depth: fidl::encoding::Depth,
6003        ) -> fidl::Result<()> {
6004            decoder.debug_check_bounds::<Self>(offset);
6005            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6006            // Verify that padding bytes are zero.
6007            // Copy from the buffer into the object.
6008            unsafe {
6009                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
6010            }
6011            Ok(())
6012        }
6013    }
6014
6015    impl fidl::encoding::ValueTypeMarker for PointerEvent {
6016        type Borrowed<'a> = &'a Self;
6017        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6018            value
6019        }
6020    }
6021
6022    unsafe impl fidl::encoding::TypeMarker for PointerEvent {
6023        type Owned = Self;
6024
6025        #[inline(always)]
6026        fn inline_align(_context: fidl::encoding::Context) -> usize {
6027            8
6028        }
6029
6030        #[inline(always)]
6031        fn inline_size(_context: fidl::encoding::Context) -> usize {
6032            48
6033        }
6034    }
6035
6036    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PointerEvent, D>
6037        for &PointerEvent
6038    {
6039        #[inline]
6040        unsafe fn encode(
6041            self,
6042            encoder: &mut fidl::encoding::Encoder<'_, D>,
6043            offset: usize,
6044            _depth: fidl::encoding::Depth,
6045        ) -> fidl::Result<()> {
6046            encoder.debug_check_bounds::<PointerEvent>(offset);
6047            // Delegate to tuple encoding.
6048            fidl::encoding::Encode::<PointerEvent, D>::encode(
6049                (
6050                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
6051                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
6052                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_id),
6053                    <PointerEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
6054                    <PointerEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
6055                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
6056                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
6057                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_major),
6058                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_minor),
6059                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
6060                ),
6061                encoder,
6062                offset,
6063                _depth,
6064            )
6065        }
6066    }
6067    unsafe impl<
6068            D: fidl::encoding::ResourceDialect,
6069            T0: fidl::encoding::Encode<u64, D>,
6070            T1: fidl::encoding::Encode<u32, D>,
6071            T2: fidl::encoding::Encode<u32, D>,
6072            T3: fidl::encoding::Encode<PointerEventType, D>,
6073            T4: fidl::encoding::Encode<PointerEventPhase, D>,
6074            T5: fidl::encoding::Encode<f32, D>,
6075            T6: fidl::encoding::Encode<f32, D>,
6076            T7: fidl::encoding::Encode<f32, D>,
6077            T8: fidl::encoding::Encode<f32, D>,
6078            T9: fidl::encoding::Encode<u32, D>,
6079        > fidl::encoding::Encode<PointerEvent, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
6080    {
6081        #[inline]
6082        unsafe fn encode(
6083            self,
6084            encoder: &mut fidl::encoding::Encoder<'_, D>,
6085            offset: usize,
6086            depth: fidl::encoding::Depth,
6087        ) -> fidl::Result<()> {
6088            encoder.debug_check_bounds::<PointerEvent>(offset);
6089            // Zero out padding regions. There's no need to apply masks
6090            // because the unmasked parts will be overwritten by fields.
6091            unsafe {
6092                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
6093                (ptr as *mut u64).write_unaligned(0);
6094            }
6095            // Write the fields.
6096            self.0.encode(encoder, offset + 0, depth)?;
6097            self.1.encode(encoder, offset + 8, depth)?;
6098            self.2.encode(encoder, offset + 12, depth)?;
6099            self.3.encode(encoder, offset + 16, depth)?;
6100            self.4.encode(encoder, offset + 20, depth)?;
6101            self.5.encode(encoder, offset + 24, depth)?;
6102            self.6.encode(encoder, offset + 28, depth)?;
6103            self.7.encode(encoder, offset + 32, depth)?;
6104            self.8.encode(encoder, offset + 36, depth)?;
6105            self.9.encode(encoder, offset + 40, depth)?;
6106            Ok(())
6107        }
6108    }
6109
6110    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEvent {
6111        #[inline(always)]
6112        fn new_empty() -> Self {
6113            Self {
6114                event_time: fidl::new_empty!(u64, D),
6115                device_id: fidl::new_empty!(u32, D),
6116                pointer_id: fidl::new_empty!(u32, D),
6117                type_: fidl::new_empty!(PointerEventType, D),
6118                phase: fidl::new_empty!(PointerEventPhase, D),
6119                x: fidl::new_empty!(f32, D),
6120                y: fidl::new_empty!(f32, D),
6121                radius_major: fidl::new_empty!(f32, D),
6122                radius_minor: fidl::new_empty!(f32, D),
6123                buttons: fidl::new_empty!(u32, D),
6124            }
6125        }
6126
6127        #[inline]
6128        unsafe fn decode(
6129            &mut self,
6130            decoder: &mut fidl::encoding::Decoder<'_, D>,
6131            offset: usize,
6132            _depth: fidl::encoding::Depth,
6133        ) -> fidl::Result<()> {
6134            decoder.debug_check_bounds::<Self>(offset);
6135            // Verify that padding bytes are zero.
6136            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
6137            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6138            let mask = 0xffffffff00000000u64;
6139            let maskedval = padval & mask;
6140            if maskedval != 0 {
6141                return Err(fidl::Error::NonZeroPadding {
6142                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
6143                });
6144            }
6145            fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
6146            fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
6147            fidl::decode!(u32, D, &mut self.pointer_id, decoder, offset + 12, _depth)?;
6148            fidl::decode!(PointerEventType, D, &mut self.type_, decoder, offset + 16, _depth)?;
6149            fidl::decode!(PointerEventPhase, D, &mut self.phase, decoder, offset + 20, _depth)?;
6150            fidl::decode!(f32, D, &mut self.x, decoder, offset + 24, _depth)?;
6151            fidl::decode!(f32, D, &mut self.y, decoder, offset + 28, _depth)?;
6152            fidl::decode!(f32, D, &mut self.radius_major, decoder, offset + 32, _depth)?;
6153            fidl::decode!(f32, D, &mut self.radius_minor, decoder, offset + 36, _depth)?;
6154            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 40, _depth)?;
6155            Ok(())
6156        }
6157    }
6158
6159    impl fidl::encoding::ValueTypeMarker for Range {
6160        type Borrowed<'a> = &'a Self;
6161        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6162            value
6163        }
6164    }
6165
6166    unsafe impl fidl::encoding::TypeMarker for Range {
6167        type Owned = Self;
6168
6169        #[inline(always)]
6170        fn inline_align(_context: fidl::encoding::Context) -> usize {
6171            4
6172        }
6173
6174        #[inline(always)]
6175        fn inline_size(_context: fidl::encoding::Context) -> usize {
6176            8
6177        }
6178        #[inline(always)]
6179        fn encode_is_copy() -> bool {
6180            true
6181        }
6182
6183        #[inline(always)]
6184        fn decode_is_copy() -> bool {
6185            true
6186        }
6187    }
6188
6189    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
6190        #[inline]
6191        unsafe fn encode(
6192            self,
6193            encoder: &mut fidl::encoding::Encoder<'_, D>,
6194            offset: usize,
6195            _depth: fidl::encoding::Depth,
6196        ) -> fidl::Result<()> {
6197            encoder.debug_check_bounds::<Range>(offset);
6198            unsafe {
6199                // Copy the object into the buffer.
6200                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
6201                (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
6202                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
6203                // done second because the memcpy will write garbage to these bytes.
6204            }
6205            Ok(())
6206        }
6207    }
6208    unsafe impl<
6209            D: fidl::encoding::ResourceDialect,
6210            T0: fidl::encoding::Encode<i32, D>,
6211            T1: fidl::encoding::Encode<i32, D>,
6212        > fidl::encoding::Encode<Range, D> for (T0, T1)
6213    {
6214        #[inline]
6215        unsafe fn encode(
6216            self,
6217            encoder: &mut fidl::encoding::Encoder<'_, D>,
6218            offset: usize,
6219            depth: fidl::encoding::Depth,
6220        ) -> fidl::Result<()> {
6221            encoder.debug_check_bounds::<Range>(offset);
6222            // Zero out padding regions. There's no need to apply masks
6223            // because the unmasked parts will be overwritten by fields.
6224            // Write the fields.
6225            self.0.encode(encoder, offset + 0, depth)?;
6226            self.1.encode(encoder, offset + 4, depth)?;
6227            Ok(())
6228        }
6229    }
6230
6231    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
6232        #[inline(always)]
6233        fn new_empty() -> Self {
6234            Self { min: fidl::new_empty!(i32, D), max: fidl::new_empty!(i32, D) }
6235        }
6236
6237        #[inline]
6238        unsafe fn decode(
6239            &mut self,
6240            decoder: &mut fidl::encoding::Decoder<'_, D>,
6241            offset: usize,
6242            _depth: fidl::encoding::Depth,
6243        ) -> fidl::Result<()> {
6244            decoder.debug_check_bounds::<Self>(offset);
6245            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
6246            // Verify that padding bytes are zero.
6247            // Copy from the buffer into the object.
6248            unsafe {
6249                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
6250            }
6251            Ok(())
6252        }
6253    }
6254
6255    impl fidl::encoding::ValueTypeMarker for RangeF {
6256        type Borrowed<'a> = &'a Self;
6257        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6258            value
6259        }
6260    }
6261
6262    unsafe impl fidl::encoding::TypeMarker for RangeF {
6263        type Owned = Self;
6264
6265        #[inline(always)]
6266        fn inline_align(_context: fidl::encoding::Context) -> usize {
6267            4
6268        }
6269
6270        #[inline(always)]
6271        fn inline_size(_context: fidl::encoding::Context) -> usize {
6272            8
6273        }
6274    }
6275
6276    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RangeF, D> for &RangeF {
6277        #[inline]
6278        unsafe fn encode(
6279            self,
6280            encoder: &mut fidl::encoding::Encoder<'_, D>,
6281            offset: usize,
6282            _depth: fidl::encoding::Depth,
6283        ) -> fidl::Result<()> {
6284            encoder.debug_check_bounds::<RangeF>(offset);
6285            // Delegate to tuple encoding.
6286            fidl::encoding::Encode::<RangeF, D>::encode(
6287                (
6288                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
6289                    <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
6290                ),
6291                encoder,
6292                offset,
6293                _depth,
6294            )
6295        }
6296    }
6297    unsafe impl<
6298            D: fidl::encoding::ResourceDialect,
6299            T0: fidl::encoding::Encode<f32, D>,
6300            T1: fidl::encoding::Encode<f32, D>,
6301        > fidl::encoding::Encode<RangeF, D> for (T0, T1)
6302    {
6303        #[inline]
6304        unsafe fn encode(
6305            self,
6306            encoder: &mut fidl::encoding::Encoder<'_, D>,
6307            offset: usize,
6308            depth: fidl::encoding::Depth,
6309        ) -> fidl::Result<()> {
6310            encoder.debug_check_bounds::<RangeF>(offset);
6311            // Zero out padding regions. There's no need to apply masks
6312            // because the unmasked parts will be overwritten by fields.
6313            // Write the fields.
6314            self.0.encode(encoder, offset + 0, depth)?;
6315            self.1.encode(encoder, offset + 4, depth)?;
6316            Ok(())
6317        }
6318    }
6319
6320    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RangeF {
6321        #[inline(always)]
6322        fn new_empty() -> Self {
6323            Self { min: fidl::new_empty!(f32, D), max: fidl::new_empty!(f32, D) }
6324        }
6325
6326        #[inline]
6327        unsafe fn decode(
6328            &mut self,
6329            decoder: &mut fidl::encoding::Decoder<'_, D>,
6330            offset: usize,
6331            _depth: fidl::encoding::Depth,
6332        ) -> fidl::Result<()> {
6333            decoder.debug_check_bounds::<Self>(offset);
6334            // Verify that padding bytes are zero.
6335            fidl::decode!(f32, D, &mut self.min, decoder, offset + 0, _depth)?;
6336            fidl::decode!(f32, D, &mut self.max, decoder, offset + 4, _depth)?;
6337            Ok(())
6338        }
6339    }
6340
6341    impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
6342        type Borrowed<'a> = &'a Self;
6343        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6344            value
6345        }
6346    }
6347
6348    unsafe impl fidl::encoding::TypeMarker for SendKeyboardInputCmd {
6349        type Owned = Self;
6350
6351        #[inline(always)]
6352        fn inline_align(_context: fidl::encoding::Context) -> usize {
6353            8
6354        }
6355
6356        #[inline(always)]
6357        fn inline_size(_context: fidl::encoding::Context) -> usize {
6358            40
6359        }
6360    }
6361
6362    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendKeyboardInputCmd, D>
6363        for &SendKeyboardInputCmd
6364    {
6365        #[inline]
6366        unsafe fn encode(
6367            self,
6368            encoder: &mut fidl::encoding::Encoder<'_, D>,
6369            offset: usize,
6370            _depth: fidl::encoding::Depth,
6371        ) -> fidl::Result<()> {
6372            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
6373            // Delegate to tuple encoding.
6374            fidl::encoding::Encode::<SendKeyboardInputCmd, D>::encode(
6375                (
6376                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
6377                    <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
6378                        &self.keyboard_event,
6379                    ),
6380                ),
6381                encoder,
6382                offset,
6383                _depth,
6384            )
6385        }
6386    }
6387    unsafe impl<
6388            D: fidl::encoding::ResourceDialect,
6389            T0: fidl::encoding::Encode<u32, D>,
6390            T1: fidl::encoding::Encode<KeyboardEvent, D>,
6391        > fidl::encoding::Encode<SendKeyboardInputCmd, D> for (T0, T1)
6392    {
6393        #[inline]
6394        unsafe fn encode(
6395            self,
6396            encoder: &mut fidl::encoding::Encoder<'_, D>,
6397            offset: usize,
6398            depth: fidl::encoding::Depth,
6399        ) -> fidl::Result<()> {
6400            encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
6401            // Zero out padding regions. There's no need to apply masks
6402            // because the unmasked parts will be overwritten by fields.
6403            unsafe {
6404                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6405                (ptr as *mut u64).write_unaligned(0);
6406            }
6407            // Write the fields.
6408            self.0.encode(encoder, offset + 0, depth)?;
6409            self.1.encode(encoder, offset + 8, depth)?;
6410            Ok(())
6411        }
6412    }
6413
6414    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendKeyboardInputCmd {
6415        #[inline(always)]
6416        fn new_empty() -> Self {
6417            Self {
6418                compositor_id: fidl::new_empty!(u32, D),
6419                keyboard_event: fidl::new_empty!(KeyboardEvent, D),
6420            }
6421        }
6422
6423        #[inline]
6424        unsafe fn decode(
6425            &mut self,
6426            decoder: &mut fidl::encoding::Decoder<'_, D>,
6427            offset: usize,
6428            _depth: fidl::encoding::Depth,
6429        ) -> fidl::Result<()> {
6430            decoder.debug_check_bounds::<Self>(offset);
6431            // Verify that padding bytes are zero.
6432            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6433            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6434            let mask = 0xffffffff00000000u64;
6435            let maskedval = padval & mask;
6436            if maskedval != 0 {
6437                return Err(fidl::Error::NonZeroPadding {
6438                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6439                });
6440            }
6441            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
6442            fidl::decode!(KeyboardEvent, D, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
6443            Ok(())
6444        }
6445    }
6446
6447    impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
6448        type Borrowed<'a> = &'a Self;
6449        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6450            value
6451        }
6452    }
6453
6454    unsafe impl fidl::encoding::TypeMarker for SendPointerInputCmd {
6455        type Owned = Self;
6456
6457        #[inline(always)]
6458        fn inline_align(_context: fidl::encoding::Context) -> usize {
6459            8
6460        }
6461
6462        #[inline(always)]
6463        fn inline_size(_context: fidl::encoding::Context) -> usize {
6464            56
6465        }
6466    }
6467
6468    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendPointerInputCmd, D>
6469        for &SendPointerInputCmd
6470    {
6471        #[inline]
6472        unsafe fn encode(
6473            self,
6474            encoder: &mut fidl::encoding::Encoder<'_, D>,
6475            offset: usize,
6476            _depth: fidl::encoding::Depth,
6477        ) -> fidl::Result<()> {
6478            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
6479            // Delegate to tuple encoding.
6480            fidl::encoding::Encode::<SendPointerInputCmd, D>::encode(
6481                (
6482                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
6483                    <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
6484                ),
6485                encoder,
6486                offset,
6487                _depth,
6488            )
6489        }
6490    }
6491    unsafe impl<
6492            D: fidl::encoding::ResourceDialect,
6493            T0: fidl::encoding::Encode<u32, D>,
6494            T1: fidl::encoding::Encode<PointerEvent, D>,
6495        > fidl::encoding::Encode<SendPointerInputCmd, D> for (T0, T1)
6496    {
6497        #[inline]
6498        unsafe fn encode(
6499            self,
6500            encoder: &mut fidl::encoding::Encoder<'_, D>,
6501            offset: usize,
6502            depth: fidl::encoding::Depth,
6503        ) -> fidl::Result<()> {
6504            encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
6505            // Zero out padding regions. There's no need to apply masks
6506            // because the unmasked parts will be overwritten by fields.
6507            unsafe {
6508                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
6509                (ptr as *mut u64).write_unaligned(0);
6510            }
6511            // Write the fields.
6512            self.0.encode(encoder, offset + 0, depth)?;
6513            self.1.encode(encoder, offset + 8, depth)?;
6514            Ok(())
6515        }
6516    }
6517
6518    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendPointerInputCmd {
6519        #[inline(always)]
6520        fn new_empty() -> Self {
6521            Self {
6522                compositor_id: fidl::new_empty!(u32, D),
6523                pointer_event: fidl::new_empty!(PointerEvent, D),
6524            }
6525        }
6526
6527        #[inline]
6528        unsafe fn decode(
6529            &mut self,
6530            decoder: &mut fidl::encoding::Decoder<'_, D>,
6531            offset: usize,
6532            _depth: fidl::encoding::Depth,
6533        ) -> fidl::Result<()> {
6534            decoder.debug_check_bounds::<Self>(offset);
6535            // Verify that padding bytes are zero.
6536            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
6537            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6538            let mask = 0xffffffff00000000u64;
6539            let maskedval = padval & mask;
6540            if maskedval != 0 {
6541                return Err(fidl::Error::NonZeroPadding {
6542                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
6543                });
6544            }
6545            fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
6546            fidl::decode!(PointerEvent, D, &mut self.pointer_event, decoder, offset + 8, _depth)?;
6547            Ok(())
6548        }
6549    }
6550
6551    impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
6552        type Borrowed<'a> = &'a Self;
6553        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6554            value
6555        }
6556    }
6557
6558    unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
6559        type Owned = Self;
6560
6561        #[inline(always)]
6562        fn inline_align(_context: fidl::encoding::Context) -> usize {
6563            4
6564        }
6565
6566        #[inline(always)]
6567        fn inline_size(_context: fidl::encoding::Context) -> usize {
6568            28
6569        }
6570    }
6571
6572    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
6573        for &SensorDescriptor
6574    {
6575        #[inline]
6576        unsafe fn encode(
6577            self,
6578            encoder: &mut fidl::encoding::Encoder<'_, D>,
6579            offset: usize,
6580            _depth: fidl::encoding::Depth,
6581        ) -> fidl::Result<()> {
6582            encoder.debug_check_bounds::<SensorDescriptor>(offset);
6583            // Delegate to tuple encoding.
6584            fidl::encoding::Encode::<SensorDescriptor, D>::encode(
6585                (
6586                    <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
6587                    <SensorLocation as fidl::encoding::ValueTypeMarker>::borrow(&self.loc),
6588                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_sampling_freq),
6589                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_sampling_freq),
6590                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fifo_max_event_count),
6591                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_min),
6592                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_max),
6593                ),
6594                encoder,
6595                offset,
6596                _depth,
6597            )
6598        }
6599    }
6600    unsafe impl<
6601            D: fidl::encoding::ResourceDialect,
6602            T0: fidl::encoding::Encode<SensorType, D>,
6603            T1: fidl::encoding::Encode<SensorLocation, D>,
6604            T2: fidl::encoding::Encode<u32, D>,
6605            T3: fidl::encoding::Encode<u32, D>,
6606            T4: fidl::encoding::Encode<u32, D>,
6607            T5: fidl::encoding::Encode<i32, D>,
6608            T6: fidl::encoding::Encode<i32, D>,
6609        > fidl::encoding::Encode<SensorDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
6610    {
6611        #[inline]
6612        unsafe fn encode(
6613            self,
6614            encoder: &mut fidl::encoding::Encoder<'_, D>,
6615            offset: usize,
6616            depth: fidl::encoding::Depth,
6617        ) -> fidl::Result<()> {
6618            encoder.debug_check_bounds::<SensorDescriptor>(offset);
6619            // Zero out padding regions. There's no need to apply masks
6620            // because the unmasked parts will be overwritten by fields.
6621            // Write the fields.
6622            self.0.encode(encoder, offset + 0, depth)?;
6623            self.1.encode(encoder, offset + 4, depth)?;
6624            self.2.encode(encoder, offset + 8, depth)?;
6625            self.3.encode(encoder, offset + 12, depth)?;
6626            self.4.encode(encoder, offset + 16, depth)?;
6627            self.5.encode(encoder, offset + 20, depth)?;
6628            self.6.encode(encoder, offset + 24, depth)?;
6629            Ok(())
6630        }
6631    }
6632
6633    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
6634        #[inline(always)]
6635        fn new_empty() -> Self {
6636            Self {
6637                type_: fidl::new_empty!(SensorType, D),
6638                loc: fidl::new_empty!(SensorLocation, D),
6639                min_sampling_freq: fidl::new_empty!(u32, D),
6640                max_sampling_freq: fidl::new_empty!(u32, D),
6641                fifo_max_event_count: fidl::new_empty!(u32, D),
6642                phys_min: fidl::new_empty!(i32, D),
6643                phys_max: fidl::new_empty!(i32, D),
6644            }
6645        }
6646
6647        #[inline]
6648        unsafe fn decode(
6649            &mut self,
6650            decoder: &mut fidl::encoding::Decoder<'_, D>,
6651            offset: usize,
6652            _depth: fidl::encoding::Depth,
6653        ) -> fidl::Result<()> {
6654            decoder.debug_check_bounds::<Self>(offset);
6655            // Verify that padding bytes are zero.
6656            fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 0, _depth)?;
6657            fidl::decode!(SensorLocation, D, &mut self.loc, decoder, offset + 4, _depth)?;
6658            fidl::decode!(u32, D, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
6659            fidl::decode!(u32, D, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
6660            fidl::decode!(u32, D, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
6661            fidl::decode!(i32, D, &mut self.phys_min, decoder, offset + 20, _depth)?;
6662            fidl::decode!(i32, D, &mut self.phys_max, decoder, offset + 24, _depth)?;
6663            Ok(())
6664        }
6665    }
6666
6667    impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
6668        type Borrowed<'a> = &'a Self;
6669        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6670            value
6671        }
6672    }
6673
6674    unsafe impl fidl::encoding::TypeMarker for SetHardKeyboardDeliveryCmd {
6675        type Owned = Self;
6676
6677        #[inline(always)]
6678        fn inline_align(_context: fidl::encoding::Context) -> usize {
6679            1
6680        }
6681
6682        #[inline(always)]
6683        fn inline_size(_context: fidl::encoding::Context) -> usize {
6684            1
6685        }
6686    }
6687
6688    unsafe impl<D: fidl::encoding::ResourceDialect>
6689        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for &SetHardKeyboardDeliveryCmd
6690    {
6691        #[inline]
6692        unsafe fn encode(
6693            self,
6694            encoder: &mut fidl::encoding::Encoder<'_, D>,
6695            offset: usize,
6696            _depth: fidl::encoding::Depth,
6697        ) -> fidl::Result<()> {
6698            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
6699            // Delegate to tuple encoding.
6700            fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd, D>::encode(
6701                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
6702                encoder,
6703                offset,
6704                _depth,
6705            )
6706        }
6707    }
6708    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
6709        fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for (T0,)
6710    {
6711        #[inline]
6712        unsafe fn encode(
6713            self,
6714            encoder: &mut fidl::encoding::Encoder<'_, D>,
6715            offset: usize,
6716            depth: fidl::encoding::Depth,
6717        ) -> fidl::Result<()> {
6718            encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
6719            // Zero out padding regions. There's no need to apply masks
6720            // because the unmasked parts will be overwritten by fields.
6721            // Write the fields.
6722            self.0.encode(encoder, offset + 0, depth)?;
6723            Ok(())
6724        }
6725    }
6726
6727    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6728        for SetHardKeyboardDeliveryCmd
6729    {
6730        #[inline(always)]
6731        fn new_empty() -> Self {
6732            Self { delivery_request: fidl::new_empty!(bool, D) }
6733        }
6734
6735        #[inline]
6736        unsafe fn decode(
6737            &mut self,
6738            decoder: &mut fidl::encoding::Decoder<'_, D>,
6739            offset: usize,
6740            _depth: fidl::encoding::Depth,
6741        ) -> fidl::Result<()> {
6742            decoder.debug_check_bounds::<Self>(offset);
6743            // Verify that padding bytes are zero.
6744            fidl::decode!(bool, D, &mut self.delivery_request, decoder, offset + 0, _depth)?;
6745            Ok(())
6746        }
6747    }
6748
6749    impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
6750        type Borrowed<'a> = &'a Self;
6751        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6752            value
6753        }
6754    }
6755
6756    unsafe impl fidl::encoding::TypeMarker for SetParallelDispatchCmd {
6757        type Owned = Self;
6758
6759        #[inline(always)]
6760        fn inline_align(_context: fidl::encoding::Context) -> usize {
6761            1
6762        }
6763
6764        #[inline(always)]
6765        fn inline_size(_context: fidl::encoding::Context) -> usize {
6766            1
6767        }
6768    }
6769
6770    unsafe impl<D: fidl::encoding::ResourceDialect>
6771        fidl::encoding::Encode<SetParallelDispatchCmd, D> for &SetParallelDispatchCmd
6772    {
6773        #[inline]
6774        unsafe fn encode(
6775            self,
6776            encoder: &mut fidl::encoding::Encoder<'_, D>,
6777            offset: usize,
6778            _depth: fidl::encoding::Depth,
6779        ) -> fidl::Result<()> {
6780            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
6781            // Delegate to tuple encoding.
6782            fidl::encoding::Encode::<SetParallelDispatchCmd, D>::encode(
6783                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
6784                encoder,
6785                offset,
6786                _depth,
6787            )
6788        }
6789    }
6790    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
6791        fidl::encoding::Encode<SetParallelDispatchCmd, D> for (T0,)
6792    {
6793        #[inline]
6794        unsafe fn encode(
6795            self,
6796            encoder: &mut fidl::encoding::Encoder<'_, D>,
6797            offset: usize,
6798            depth: fidl::encoding::Depth,
6799        ) -> fidl::Result<()> {
6800            encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
6801            // Zero out padding regions. There's no need to apply masks
6802            // because the unmasked parts will be overwritten by fields.
6803            // Write the fields.
6804            self.0.encode(encoder, offset + 0, depth)?;
6805            Ok(())
6806        }
6807    }
6808
6809    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6810        for SetParallelDispatchCmd
6811    {
6812        #[inline(always)]
6813        fn new_empty() -> Self {
6814            Self { parallel_dispatch: fidl::new_empty!(bool, D) }
6815        }
6816
6817        #[inline]
6818        unsafe fn decode(
6819            &mut self,
6820            decoder: &mut fidl::encoding::Decoder<'_, D>,
6821            offset: usize,
6822            _depth: fidl::encoding::Depth,
6823        ) -> fidl::Result<()> {
6824            decoder.debug_check_bounds::<Self>(offset);
6825            // Verify that padding bytes are zero.
6826            fidl::decode!(bool, D, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
6827            Ok(())
6828        }
6829    }
6830
6831    impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
6832        type Borrowed<'a> = &'a Self;
6833        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6834            value
6835        }
6836    }
6837
6838    unsafe impl fidl::encoding::TypeMarker for StylusDescriptor {
6839        type Owned = Self;
6840
6841        #[inline(always)]
6842        fn inline_align(_context: fidl::encoding::Context) -> usize {
6843            8
6844        }
6845
6846        #[inline(always)]
6847        fn inline_size(_context: fidl::encoding::Context) -> usize {
6848            48
6849        }
6850    }
6851
6852    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusDescriptor, D>
6853        for &StylusDescriptor
6854    {
6855        #[inline]
6856        unsafe fn encode(
6857            self,
6858            encoder: &mut fidl::encoding::Encoder<'_, D>,
6859            offset: usize,
6860            _depth: fidl::encoding::Depth,
6861        ) -> fidl::Result<()> {
6862            encoder.debug_check_bounds::<StylusDescriptor>(offset);
6863            // Delegate to tuple encoding.
6864            fidl::encoding::Encode::<StylusDescriptor, D>::encode(
6865                (
6866                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
6867                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
6868                    <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
6869                        &self.pressure,
6870                    ),
6871                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_invertible),
6872                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
6873                ),
6874                encoder,
6875                offset,
6876                _depth,
6877            )
6878        }
6879    }
6880    unsafe impl<
6881            D: fidl::encoding::ResourceDialect,
6882            T0: fidl::encoding::Encode<Axis, D>,
6883            T1: fidl::encoding::Encode<Axis, D>,
6884            T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
6885            T3: fidl::encoding::Encode<bool, D>,
6886            T4: fidl::encoding::Encode<u32, D>,
6887        > fidl::encoding::Encode<StylusDescriptor, D> for (T0, T1, T2, T3, T4)
6888    {
6889        #[inline]
6890        unsafe fn encode(
6891            self,
6892            encoder: &mut fidl::encoding::Encoder<'_, D>,
6893            offset: usize,
6894            depth: fidl::encoding::Depth,
6895        ) -> fidl::Result<()> {
6896            encoder.debug_check_bounds::<StylusDescriptor>(offset);
6897            // Zero out padding regions. There's no need to apply masks
6898            // because the unmasked parts will be overwritten by fields.
6899            unsafe {
6900                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
6901                (ptr as *mut u64).write_unaligned(0);
6902            }
6903            // Write the fields.
6904            self.0.encode(encoder, offset + 0, depth)?;
6905            self.1.encode(encoder, offset + 16, depth)?;
6906            self.2.encode(encoder, offset + 32, depth)?;
6907            self.3.encode(encoder, offset + 40, depth)?;
6908            self.4.encode(encoder, offset + 44, depth)?;
6909            Ok(())
6910        }
6911    }
6912
6913    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusDescriptor {
6914        #[inline(always)]
6915        fn new_empty() -> Self {
6916            Self {
6917                x: fidl::new_empty!(Axis, D),
6918                y: fidl::new_empty!(Axis, D),
6919                pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
6920                is_invertible: fidl::new_empty!(bool, D),
6921                buttons: fidl::new_empty!(u32, D),
6922            }
6923        }
6924
6925        #[inline]
6926        unsafe fn decode(
6927            &mut self,
6928            decoder: &mut fidl::encoding::Decoder<'_, D>,
6929            offset: usize,
6930            _depth: fidl::encoding::Depth,
6931        ) -> fidl::Result<()> {
6932            decoder.debug_check_bounds::<Self>(offset);
6933            // Verify that padding bytes are zero.
6934            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
6935            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6936            let mask = 0xffffff00u64;
6937            let maskedval = padval & mask;
6938            if maskedval != 0 {
6939                return Err(fidl::Error::NonZeroPadding {
6940                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
6941                });
6942            }
6943            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
6944            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
6945            fidl::decode!(
6946                fidl::encoding::Boxed<Axis>,
6947                D,
6948                &mut self.pressure,
6949                decoder,
6950                offset + 32,
6951                _depth
6952            )?;
6953            fidl::decode!(bool, D, &mut self.is_invertible, decoder, offset + 40, _depth)?;
6954            fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 44, _depth)?;
6955            Ok(())
6956        }
6957    }
6958
6959    impl fidl::encoding::ValueTypeMarker for StylusReport {
6960        type Borrowed<'a> = &'a Self;
6961        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6962            value
6963        }
6964    }
6965
6966    unsafe impl fidl::encoding::TypeMarker for StylusReport {
6967        type Owned = Self;
6968
6969        #[inline(always)]
6970        fn inline_align(_context: fidl::encoding::Context) -> usize {
6971            4
6972        }
6973
6974        #[inline(always)]
6975        fn inline_size(_context: fidl::encoding::Context) -> usize {
6976            20
6977        }
6978    }
6979
6980    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusReport, D>
6981        for &StylusReport
6982    {
6983        #[inline]
6984        unsafe fn encode(
6985            self,
6986            encoder: &mut fidl::encoding::Encoder<'_, D>,
6987            offset: usize,
6988            _depth: fidl::encoding::Depth,
6989        ) -> fidl::Result<()> {
6990            encoder.debug_check_bounds::<StylusReport>(offset);
6991            // Delegate to tuple encoding.
6992            fidl::encoding::Encode::<StylusReport, D>::encode(
6993                (
6994                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
6995                    <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
6996                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressure),
6997                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_in_contact),
6998                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_range),
6999                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_inverted),
7000                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_buttons),
7001                ),
7002                encoder,
7003                offset,
7004                _depth,
7005            )
7006        }
7007    }
7008    unsafe impl<
7009            D: fidl::encoding::ResourceDialect,
7010            T0: fidl::encoding::Encode<i32, D>,
7011            T1: fidl::encoding::Encode<i32, D>,
7012            T2: fidl::encoding::Encode<u32, D>,
7013            T3: fidl::encoding::Encode<bool, D>,
7014            T4: fidl::encoding::Encode<bool, D>,
7015            T5: fidl::encoding::Encode<bool, D>,
7016            T6: fidl::encoding::Encode<u32, D>,
7017        > fidl::encoding::Encode<StylusReport, D> for (T0, T1, T2, T3, T4, T5, T6)
7018    {
7019        #[inline]
7020        unsafe fn encode(
7021            self,
7022            encoder: &mut fidl::encoding::Encoder<'_, D>,
7023            offset: usize,
7024            depth: fidl::encoding::Depth,
7025        ) -> fidl::Result<()> {
7026            encoder.debug_check_bounds::<StylusReport>(offset);
7027            // Zero out padding regions. There's no need to apply masks
7028            // because the unmasked parts will be overwritten by fields.
7029            unsafe {
7030                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
7031                (ptr as *mut u32).write_unaligned(0);
7032            }
7033            // Write the fields.
7034            self.0.encode(encoder, offset + 0, depth)?;
7035            self.1.encode(encoder, offset + 4, depth)?;
7036            self.2.encode(encoder, offset + 8, depth)?;
7037            self.3.encode(encoder, offset + 12, depth)?;
7038            self.4.encode(encoder, offset + 13, depth)?;
7039            self.5.encode(encoder, offset + 14, depth)?;
7040            self.6.encode(encoder, offset + 16, depth)?;
7041            Ok(())
7042        }
7043    }
7044
7045    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusReport {
7046        #[inline(always)]
7047        fn new_empty() -> Self {
7048            Self {
7049                x: fidl::new_empty!(i32, D),
7050                y: fidl::new_empty!(i32, D),
7051                pressure: fidl::new_empty!(u32, D),
7052                is_in_contact: fidl::new_empty!(bool, D),
7053                in_range: fidl::new_empty!(bool, D),
7054                is_inverted: fidl::new_empty!(bool, D),
7055                pressed_buttons: fidl::new_empty!(u32, D),
7056            }
7057        }
7058
7059        #[inline]
7060        unsafe fn decode(
7061            &mut self,
7062            decoder: &mut fidl::encoding::Decoder<'_, D>,
7063            offset: usize,
7064            _depth: fidl::encoding::Depth,
7065        ) -> fidl::Result<()> {
7066            decoder.debug_check_bounds::<Self>(offset);
7067            // Verify that padding bytes are zero.
7068            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
7069            let padval = unsafe { (ptr as *const u32).read_unaligned() };
7070            let mask = 0xff000000u32;
7071            let maskedval = padval & mask;
7072            if maskedval != 0 {
7073                return Err(fidl::Error::NonZeroPadding {
7074                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
7075                });
7076            }
7077            fidl::decode!(i32, D, &mut self.x, decoder, offset + 0, _depth)?;
7078            fidl::decode!(i32, D, &mut self.y, decoder, offset + 4, _depth)?;
7079            fidl::decode!(u32, D, &mut self.pressure, decoder, offset + 8, _depth)?;
7080            fidl::decode!(bool, D, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
7081            fidl::decode!(bool, D, &mut self.in_range, decoder, offset + 13, _depth)?;
7082            fidl::decode!(bool, D, &mut self.is_inverted, decoder, offset + 14, _depth)?;
7083            fidl::decode!(u32, D, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
7084            Ok(())
7085        }
7086    }
7087
7088    impl fidl::encoding::ValueTypeMarker for TextInputState {
7089        type Borrowed<'a> = &'a Self;
7090        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7091            value
7092        }
7093    }
7094
7095    unsafe impl fidl::encoding::TypeMarker for TextInputState {
7096        type Owned = Self;
7097
7098        #[inline(always)]
7099        fn inline_align(_context: fidl::encoding::Context) -> usize {
7100            8
7101        }
7102
7103        #[inline(always)]
7104        fn inline_size(_context: fidl::encoding::Context) -> usize {
7105            64
7106        }
7107    }
7108
7109    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextInputState, D>
7110        for &TextInputState
7111    {
7112        #[inline]
7113        unsafe fn encode(
7114            self,
7115            encoder: &mut fidl::encoding::Encoder<'_, D>,
7116            offset: usize,
7117            _depth: fidl::encoding::Depth,
7118        ) -> fidl::Result<()> {
7119            encoder.debug_check_bounds::<TextInputState>(offset);
7120            // Delegate to tuple encoding.
7121            fidl::encoding::Encode::<TextInputState, D>::encode(
7122                (
7123                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision),
7124                    <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
7125                        &self.text,
7126                    ),
7127                    <TextSelection as fidl::encoding::ValueTypeMarker>::borrow(&self.selection),
7128                    <TextRange as fidl::encoding::ValueTypeMarker>::borrow(&self.composing),
7129                ),
7130                encoder,
7131                offset,
7132                _depth,
7133            )
7134        }
7135    }
7136    unsafe impl<
7137            D: fidl::encoding::ResourceDialect,
7138            T0: fidl::encoding::Encode<u32, D>,
7139            T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
7140            T2: fidl::encoding::Encode<TextSelection, D>,
7141            T3: fidl::encoding::Encode<TextRange, D>,
7142        > fidl::encoding::Encode<TextInputState, D> for (T0, T1, T2, T3)
7143    {
7144        #[inline]
7145        unsafe fn encode(
7146            self,
7147            encoder: &mut fidl::encoding::Encoder<'_, D>,
7148            offset: usize,
7149            depth: fidl::encoding::Depth,
7150        ) -> fidl::Result<()> {
7151            encoder.debug_check_bounds::<TextInputState>(offset);
7152            // Zero out padding regions. There's no need to apply masks
7153            // because the unmasked parts will be overwritten by fields.
7154            unsafe {
7155                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
7156                (ptr as *mut u64).write_unaligned(0);
7157            }
7158            // Write the fields.
7159            self.0.encode(encoder, offset + 0, depth)?;
7160            self.1.encode(encoder, offset + 8, depth)?;
7161            self.2.encode(encoder, offset + 24, depth)?;
7162            self.3.encode(encoder, offset + 48, depth)?;
7163            Ok(())
7164        }
7165    }
7166
7167    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextInputState {
7168        #[inline(always)]
7169        fn new_empty() -> Self {
7170            Self {
7171                revision: fidl::new_empty!(u32, D),
7172                text: fidl::new_empty!(fidl::encoding::UnboundedString, D),
7173                selection: fidl::new_empty!(TextSelection, D),
7174                composing: fidl::new_empty!(TextRange, D),
7175            }
7176        }
7177
7178        #[inline]
7179        unsafe fn decode(
7180            &mut self,
7181            decoder: &mut fidl::encoding::Decoder<'_, D>,
7182            offset: usize,
7183            _depth: fidl::encoding::Depth,
7184        ) -> fidl::Result<()> {
7185            decoder.debug_check_bounds::<Self>(offset);
7186            // Verify that padding bytes are zero.
7187            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
7188            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7189            let mask = 0xffffffff00000000u64;
7190            let maskedval = padval & mask;
7191            if maskedval != 0 {
7192                return Err(fidl::Error::NonZeroPadding {
7193                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
7194                });
7195            }
7196            fidl::decode!(u32, D, &mut self.revision, decoder, offset + 0, _depth)?;
7197            fidl::decode!(
7198                fidl::encoding::UnboundedString,
7199                D,
7200                &mut self.text,
7201                decoder,
7202                offset + 8,
7203                _depth
7204            )?;
7205            fidl::decode!(TextSelection, D, &mut self.selection, decoder, offset + 24, _depth)?;
7206            fidl::decode!(TextRange, D, &mut self.composing, decoder, offset + 48, _depth)?;
7207            Ok(())
7208        }
7209    }
7210
7211    impl fidl::encoding::ValueTypeMarker for TextRange {
7212        type Borrowed<'a> = &'a Self;
7213        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7214            value
7215        }
7216    }
7217
7218    unsafe impl fidl::encoding::TypeMarker for TextRange {
7219        type Owned = Self;
7220
7221        #[inline(always)]
7222        fn inline_align(_context: fidl::encoding::Context) -> usize {
7223            8
7224        }
7225
7226        #[inline(always)]
7227        fn inline_size(_context: fidl::encoding::Context) -> usize {
7228            16
7229        }
7230        #[inline(always)]
7231        fn encode_is_copy() -> bool {
7232            true
7233        }
7234
7235        #[inline(always)]
7236        fn decode_is_copy() -> bool {
7237            true
7238        }
7239    }
7240
7241    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextRange, D>
7242        for &TextRange
7243    {
7244        #[inline]
7245        unsafe fn encode(
7246            self,
7247            encoder: &mut fidl::encoding::Encoder<'_, D>,
7248            offset: usize,
7249            _depth: fidl::encoding::Depth,
7250        ) -> fidl::Result<()> {
7251            encoder.debug_check_bounds::<TextRange>(offset);
7252            unsafe {
7253                // Copy the object into the buffer.
7254                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7255                (buf_ptr as *mut TextRange).write_unaligned((self as *const TextRange).read());
7256                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7257                // done second because the memcpy will write garbage to these bytes.
7258            }
7259            Ok(())
7260        }
7261    }
7262    unsafe impl<
7263            D: fidl::encoding::ResourceDialect,
7264            T0: fidl::encoding::Encode<i64, D>,
7265            T1: fidl::encoding::Encode<i64, D>,
7266        > fidl::encoding::Encode<TextRange, D> for (T0, T1)
7267    {
7268        #[inline]
7269        unsafe fn encode(
7270            self,
7271            encoder: &mut fidl::encoding::Encoder<'_, D>,
7272            offset: usize,
7273            depth: fidl::encoding::Depth,
7274        ) -> fidl::Result<()> {
7275            encoder.debug_check_bounds::<TextRange>(offset);
7276            // Zero out padding regions. There's no need to apply masks
7277            // because the unmasked parts will be overwritten by fields.
7278            // Write the fields.
7279            self.0.encode(encoder, offset + 0, depth)?;
7280            self.1.encode(encoder, offset + 8, depth)?;
7281            Ok(())
7282        }
7283    }
7284
7285    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextRange {
7286        #[inline(always)]
7287        fn new_empty() -> Self {
7288            Self { start: fidl::new_empty!(i64, D), end: fidl::new_empty!(i64, D) }
7289        }
7290
7291        #[inline]
7292        unsafe fn decode(
7293            &mut self,
7294            decoder: &mut fidl::encoding::Decoder<'_, D>,
7295            offset: usize,
7296            _depth: fidl::encoding::Depth,
7297        ) -> fidl::Result<()> {
7298            decoder.debug_check_bounds::<Self>(offset);
7299            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7300            // Verify that padding bytes are zero.
7301            // Copy from the buffer into the object.
7302            unsafe {
7303                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
7304            }
7305            Ok(())
7306        }
7307    }
7308
7309    impl fidl::encoding::ValueTypeMarker for TextSelection {
7310        type Borrowed<'a> = &'a Self;
7311        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7312            value
7313        }
7314    }
7315
7316    unsafe impl fidl::encoding::TypeMarker for TextSelection {
7317        type Owned = Self;
7318
7319        #[inline(always)]
7320        fn inline_align(_context: fidl::encoding::Context) -> usize {
7321            8
7322        }
7323
7324        #[inline(always)]
7325        fn inline_size(_context: fidl::encoding::Context) -> usize {
7326            24
7327        }
7328    }
7329
7330    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextSelection, D>
7331        for &TextSelection
7332    {
7333        #[inline]
7334        unsafe fn encode(
7335            self,
7336            encoder: &mut fidl::encoding::Encoder<'_, D>,
7337            offset: usize,
7338            _depth: fidl::encoding::Depth,
7339        ) -> fidl::Result<()> {
7340            encoder.debug_check_bounds::<TextSelection>(offset);
7341            // Delegate to tuple encoding.
7342            fidl::encoding::Encode::<TextSelection, D>::encode(
7343                (
7344                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
7345                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
7346                    <TextAffinity as fidl::encoding::ValueTypeMarker>::borrow(&self.affinity),
7347                ),
7348                encoder,
7349                offset,
7350                _depth,
7351            )
7352        }
7353    }
7354    unsafe impl<
7355            D: fidl::encoding::ResourceDialect,
7356            T0: fidl::encoding::Encode<i64, D>,
7357            T1: fidl::encoding::Encode<i64, D>,
7358            T2: fidl::encoding::Encode<TextAffinity, D>,
7359        > fidl::encoding::Encode<TextSelection, D> for (T0, T1, T2)
7360    {
7361        #[inline]
7362        unsafe fn encode(
7363            self,
7364            encoder: &mut fidl::encoding::Encoder<'_, D>,
7365            offset: usize,
7366            depth: fidl::encoding::Depth,
7367        ) -> fidl::Result<()> {
7368            encoder.debug_check_bounds::<TextSelection>(offset);
7369            // Zero out padding regions. There's no need to apply masks
7370            // because the unmasked parts will be overwritten by fields.
7371            unsafe {
7372                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7373                (ptr as *mut u64).write_unaligned(0);
7374            }
7375            // Write the fields.
7376            self.0.encode(encoder, offset + 0, depth)?;
7377            self.1.encode(encoder, offset + 8, depth)?;
7378            self.2.encode(encoder, offset + 16, depth)?;
7379            Ok(())
7380        }
7381    }
7382
7383    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextSelection {
7384        #[inline(always)]
7385        fn new_empty() -> Self {
7386            Self {
7387                base: fidl::new_empty!(i64, D),
7388                extent: fidl::new_empty!(i64, D),
7389                affinity: fidl::new_empty!(TextAffinity, D),
7390            }
7391        }
7392
7393        #[inline]
7394        unsafe fn decode(
7395            &mut self,
7396            decoder: &mut fidl::encoding::Decoder<'_, D>,
7397            offset: usize,
7398            _depth: fidl::encoding::Depth,
7399        ) -> fidl::Result<()> {
7400            decoder.debug_check_bounds::<Self>(offset);
7401            // Verify that padding bytes are zero.
7402            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7403            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7404            let mask = 0xffffffff00000000u64;
7405            let maskedval = padval & mask;
7406            if maskedval != 0 {
7407                return Err(fidl::Error::NonZeroPadding {
7408                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7409                });
7410            }
7411            fidl::decode!(i64, D, &mut self.base, decoder, offset + 0, _depth)?;
7412            fidl::decode!(i64, D, &mut self.extent, decoder, offset + 8, _depth)?;
7413            fidl::decode!(TextAffinity, D, &mut self.affinity, decoder, offset + 16, _depth)?;
7414            Ok(())
7415        }
7416    }
7417
7418    impl fidl::encoding::ValueTypeMarker for Touch {
7419        type Borrowed<'a> = &'a Self;
7420        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7421            value
7422        }
7423    }
7424
7425    unsafe impl fidl::encoding::TypeMarker for Touch {
7426        type Owned = Self;
7427
7428        #[inline(always)]
7429        fn inline_align(_context: fidl::encoding::Context) -> usize {
7430            4
7431        }
7432
7433        #[inline(always)]
7434        fn inline_size(_context: fidl::encoding::Context) -> usize {
7435            20
7436        }
7437        #[inline(always)]
7438        fn encode_is_copy() -> bool {
7439            true
7440        }
7441
7442        #[inline(always)]
7443        fn decode_is_copy() -> bool {
7444            true
7445        }
7446    }
7447
7448    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Touch, D> for &Touch {
7449        #[inline]
7450        unsafe fn encode(
7451            self,
7452            encoder: &mut fidl::encoding::Encoder<'_, D>,
7453            offset: usize,
7454            _depth: fidl::encoding::Depth,
7455        ) -> fidl::Result<()> {
7456            encoder.debug_check_bounds::<Touch>(offset);
7457            unsafe {
7458                // Copy the object into the buffer.
7459                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
7460                (buf_ptr as *mut Touch).write_unaligned((self as *const Touch).read());
7461                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
7462                // done second because the memcpy will write garbage to these bytes.
7463            }
7464            Ok(())
7465        }
7466    }
7467    unsafe impl<
7468            D: fidl::encoding::ResourceDialect,
7469            T0: fidl::encoding::Encode<u32, D>,
7470            T1: fidl::encoding::Encode<i32, D>,
7471            T2: fidl::encoding::Encode<i32, D>,
7472            T3: fidl::encoding::Encode<u32, D>,
7473            T4: fidl::encoding::Encode<u32, D>,
7474        > fidl::encoding::Encode<Touch, D> for (T0, T1, T2, T3, T4)
7475    {
7476        #[inline]
7477        unsafe fn encode(
7478            self,
7479            encoder: &mut fidl::encoding::Encoder<'_, D>,
7480            offset: usize,
7481            depth: fidl::encoding::Depth,
7482        ) -> fidl::Result<()> {
7483            encoder.debug_check_bounds::<Touch>(offset);
7484            // Zero out padding regions. There's no need to apply masks
7485            // because the unmasked parts will be overwritten by fields.
7486            // Write the fields.
7487            self.0.encode(encoder, offset + 0, depth)?;
7488            self.1.encode(encoder, offset + 4, depth)?;
7489            self.2.encode(encoder, offset + 8, depth)?;
7490            self.3.encode(encoder, offset + 12, depth)?;
7491            self.4.encode(encoder, offset + 16, depth)?;
7492            Ok(())
7493        }
7494    }
7495
7496    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Touch {
7497        #[inline(always)]
7498        fn new_empty() -> Self {
7499            Self {
7500                finger_id: fidl::new_empty!(u32, D),
7501                x: fidl::new_empty!(i32, D),
7502                y: fidl::new_empty!(i32, D),
7503                width: fidl::new_empty!(u32, D),
7504                height: fidl::new_empty!(u32, D),
7505            }
7506        }
7507
7508        #[inline]
7509        unsafe fn decode(
7510            &mut self,
7511            decoder: &mut fidl::encoding::Decoder<'_, D>,
7512            offset: usize,
7513            _depth: fidl::encoding::Depth,
7514        ) -> fidl::Result<()> {
7515            decoder.debug_check_bounds::<Self>(offset);
7516            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
7517            // Verify that padding bytes are zero.
7518            // Copy from the buffer into the object.
7519            unsafe {
7520                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
7521            }
7522            Ok(())
7523        }
7524    }
7525
7526    impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
7527        type Borrowed<'a> = &'a Self;
7528        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7529            value
7530        }
7531    }
7532
7533    unsafe impl fidl::encoding::TypeMarker for TouchscreenDescriptor {
7534        type Owned = Self;
7535
7536        #[inline(always)]
7537        fn inline_align(_context: fidl::encoding::Context) -> usize {
7538            4
7539        }
7540
7541        #[inline(always)]
7542        fn inline_size(_context: fidl::encoding::Context) -> usize {
7543            36
7544        }
7545    }
7546
7547    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenDescriptor, D>
7548        for &TouchscreenDescriptor
7549    {
7550        #[inline]
7551        unsafe fn encode(
7552            self,
7553            encoder: &mut fidl::encoding::Encoder<'_, D>,
7554            offset: usize,
7555            _depth: fidl::encoding::Depth,
7556        ) -> fidl::Result<()> {
7557            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
7558            // Delegate to tuple encoding.
7559            fidl::encoding::Encode::<TouchscreenDescriptor, D>::encode(
7560                (
7561                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
7562                    <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
7563                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_finger_id),
7564                ),
7565                encoder,
7566                offset,
7567                _depth,
7568            )
7569        }
7570    }
7571    unsafe impl<
7572            D: fidl::encoding::ResourceDialect,
7573            T0: fidl::encoding::Encode<Axis, D>,
7574            T1: fidl::encoding::Encode<Axis, D>,
7575            T2: fidl::encoding::Encode<u32, D>,
7576        > fidl::encoding::Encode<TouchscreenDescriptor, D> for (T0, T1, T2)
7577    {
7578        #[inline]
7579        unsafe fn encode(
7580            self,
7581            encoder: &mut fidl::encoding::Encoder<'_, D>,
7582            offset: usize,
7583            depth: fidl::encoding::Depth,
7584        ) -> fidl::Result<()> {
7585            encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
7586            // Zero out padding regions. There's no need to apply masks
7587            // because the unmasked parts will be overwritten by fields.
7588            // Write the fields.
7589            self.0.encode(encoder, offset + 0, depth)?;
7590            self.1.encode(encoder, offset + 16, depth)?;
7591            self.2.encode(encoder, offset + 32, depth)?;
7592            Ok(())
7593        }
7594    }
7595
7596    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenDescriptor {
7597        #[inline(always)]
7598        fn new_empty() -> Self {
7599            Self {
7600                x: fidl::new_empty!(Axis, D),
7601                y: fidl::new_empty!(Axis, D),
7602                max_finger_id: fidl::new_empty!(u32, D),
7603            }
7604        }
7605
7606        #[inline]
7607        unsafe fn decode(
7608            &mut self,
7609            decoder: &mut fidl::encoding::Decoder<'_, D>,
7610            offset: usize,
7611            _depth: fidl::encoding::Depth,
7612        ) -> fidl::Result<()> {
7613            decoder.debug_check_bounds::<Self>(offset);
7614            // Verify that padding bytes are zero.
7615            fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
7616            fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
7617            fidl::decode!(u32, D, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
7618            Ok(())
7619        }
7620    }
7621
7622    impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
7623        type Borrowed<'a> = &'a Self;
7624        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7625            value
7626        }
7627    }
7628
7629    unsafe impl fidl::encoding::TypeMarker for TouchscreenReport {
7630        type Owned = Self;
7631
7632        #[inline(always)]
7633        fn inline_align(_context: fidl::encoding::Context) -> usize {
7634            8
7635        }
7636
7637        #[inline(always)]
7638        fn inline_size(_context: fidl::encoding::Context) -> usize {
7639            16
7640        }
7641    }
7642
7643    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenReport, D>
7644        for &TouchscreenReport
7645    {
7646        #[inline]
7647        unsafe fn encode(
7648            self,
7649            encoder: &mut fidl::encoding::Encoder<'_, D>,
7650            offset: usize,
7651            _depth: fidl::encoding::Depth,
7652        ) -> fidl::Result<()> {
7653            encoder.debug_check_bounds::<TouchscreenReport>(offset);
7654            // Delegate to tuple encoding.
7655            fidl::encoding::Encode::<TouchscreenReport, D>::encode(
7656                (
7657                    <fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
7658                ),
7659                encoder, offset, _depth
7660            )
7661        }
7662    }
7663    unsafe impl<
7664            D: fidl::encoding::ResourceDialect,
7665            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>, D>,
7666        > fidl::encoding::Encode<TouchscreenReport, D> for (T0,)
7667    {
7668        #[inline]
7669        unsafe fn encode(
7670            self,
7671            encoder: &mut fidl::encoding::Encoder<'_, D>,
7672            offset: usize,
7673            depth: fidl::encoding::Depth,
7674        ) -> fidl::Result<()> {
7675            encoder.debug_check_bounds::<TouchscreenReport>(offset);
7676            // Zero out padding regions. There's no need to apply masks
7677            // because the unmasked parts will be overwritten by fields.
7678            // Write the fields.
7679            self.0.encode(encoder, offset + 0, depth)?;
7680            Ok(())
7681        }
7682    }
7683
7684    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenReport {
7685        #[inline(always)]
7686        fn new_empty() -> Self {
7687            Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>, D) }
7688        }
7689
7690        #[inline]
7691        unsafe fn decode(
7692            &mut self,
7693            decoder: &mut fidl::encoding::Decoder<'_, D>,
7694            offset: usize,
7695            _depth: fidl::encoding::Depth,
7696        ) -> fidl::Result<()> {
7697            decoder.debug_check_bounds::<Self>(offset);
7698            // Verify that padding bytes are zero.
7699            fidl::decode!(
7700                fidl::encoding::UnboundedVector<Touch>,
7701                D,
7702                &mut self.touches,
7703                decoder,
7704                offset + 0,
7705                _depth
7706            )?;
7707            Ok(())
7708        }
7709    }
7710
7711    impl MediaButtonsEvent {
7712        #[inline(always)]
7713        fn max_ordinal_present(&self) -> u64 {
7714            if let Some(_) = self.device_id {
7715                return 7;
7716            }
7717            if let Some(_) = self.function {
7718                return 6;
7719            }
7720            if let Some(_) = self.power {
7721                return 5;
7722            }
7723            if let Some(_) = self.camera_disable {
7724                return 4;
7725            }
7726            if let Some(_) = self.pause {
7727                return 3;
7728            }
7729            if let Some(_) = self.mic_mute {
7730                return 2;
7731            }
7732            if let Some(_) = self.volume {
7733                return 1;
7734            }
7735            0
7736        }
7737    }
7738
7739    impl fidl::encoding::ValueTypeMarker for MediaButtonsEvent {
7740        type Borrowed<'a> = &'a Self;
7741        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7742            value
7743        }
7744    }
7745
7746    unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
7747        type Owned = Self;
7748
7749        #[inline(always)]
7750        fn inline_align(_context: fidl::encoding::Context) -> usize {
7751            8
7752        }
7753
7754        #[inline(always)]
7755        fn inline_size(_context: fidl::encoding::Context) -> usize {
7756            16
7757        }
7758    }
7759
7760    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsEvent, D>
7761        for &MediaButtonsEvent
7762    {
7763        unsafe fn encode(
7764            self,
7765            encoder: &mut fidl::encoding::Encoder<'_, D>,
7766            offset: usize,
7767            mut depth: fidl::encoding::Depth,
7768        ) -> fidl::Result<()> {
7769            encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
7770            // Vector header
7771            let max_ordinal: u64 = self.max_ordinal_present();
7772            encoder.write_num(max_ordinal, offset);
7773            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7774            // Calling encoder.out_of_line_offset(0) is not allowed.
7775            if max_ordinal == 0 {
7776                return Ok(());
7777            }
7778            depth.increment()?;
7779            let envelope_size = 8;
7780            let bytes_len = max_ordinal as usize * envelope_size;
7781            #[allow(unused_variables)]
7782            let offset = encoder.out_of_line_offset(bytes_len);
7783            let mut _prev_end_offset: usize = 0;
7784            if 1 > max_ordinal {
7785                return Ok(());
7786            }
7787
7788            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7789            // are envelope_size bytes.
7790            let cur_offset: usize = (1 - 1) * envelope_size;
7791
7792            // Zero reserved fields.
7793            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7794
7795            // Safety:
7796            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7797            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7798            //   envelope_size bytes, there is always sufficient room.
7799            fidl::encoding::encode_in_envelope_optional::<i8, D>(
7800                self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
7801                encoder,
7802                offset + cur_offset,
7803                depth,
7804            )?;
7805
7806            _prev_end_offset = cur_offset + envelope_size;
7807            if 2 > max_ordinal {
7808                return Ok(());
7809            }
7810
7811            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7812            // are envelope_size bytes.
7813            let cur_offset: usize = (2 - 1) * envelope_size;
7814
7815            // Zero reserved fields.
7816            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7817
7818            // Safety:
7819            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7820            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7821            //   envelope_size bytes, there is always sufficient room.
7822            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7823                self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7824                encoder,
7825                offset + cur_offset,
7826                depth,
7827            )?;
7828
7829            _prev_end_offset = cur_offset + envelope_size;
7830            if 3 > max_ordinal {
7831                return Ok(());
7832            }
7833
7834            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7835            // are envelope_size bytes.
7836            let cur_offset: usize = (3 - 1) * envelope_size;
7837
7838            // Zero reserved fields.
7839            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7840
7841            // Safety:
7842            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7843            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7844            //   envelope_size bytes, there is always sufficient room.
7845            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7846                self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7847                encoder,
7848                offset + cur_offset,
7849                depth,
7850            )?;
7851
7852            _prev_end_offset = cur_offset + envelope_size;
7853            if 4 > max_ordinal {
7854                return Ok(());
7855            }
7856
7857            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7858            // are envelope_size bytes.
7859            let cur_offset: usize = (4 - 1) * envelope_size;
7860
7861            // Zero reserved fields.
7862            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7863
7864            // Safety:
7865            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7866            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7867            //   envelope_size bytes, there is always sufficient room.
7868            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7869                self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7870                encoder,
7871                offset + cur_offset,
7872                depth,
7873            )?;
7874
7875            _prev_end_offset = cur_offset + envelope_size;
7876            if 5 > max_ordinal {
7877                return Ok(());
7878            }
7879
7880            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7881            // are envelope_size bytes.
7882            let cur_offset: usize = (5 - 1) * envelope_size;
7883
7884            // Zero reserved fields.
7885            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7886
7887            // Safety:
7888            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7889            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7890            //   envelope_size bytes, there is always sufficient room.
7891            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7892                self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7893                encoder,
7894                offset + cur_offset,
7895                depth,
7896            )?;
7897
7898            _prev_end_offset = cur_offset + envelope_size;
7899            if 6 > max_ordinal {
7900                return Ok(());
7901            }
7902
7903            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7904            // are envelope_size bytes.
7905            let cur_offset: usize = (6 - 1) * envelope_size;
7906
7907            // Zero reserved fields.
7908            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7909
7910            // Safety:
7911            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7912            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7913            //   envelope_size bytes, there is always sufficient room.
7914            fidl::encoding::encode_in_envelope_optional::<bool, D>(
7915                self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
7916                encoder,
7917                offset + cur_offset,
7918                depth,
7919            )?;
7920
7921            _prev_end_offset = cur_offset + envelope_size;
7922            if 7 > max_ordinal {
7923                return Ok(());
7924            }
7925
7926            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7927            // are envelope_size bytes.
7928            let cur_offset: usize = (7 - 1) * envelope_size;
7929
7930            // Zero reserved fields.
7931            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7932
7933            // Safety:
7934            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7935            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7936            //   envelope_size bytes, there is always sufficient room.
7937            fidl::encoding::encode_in_envelope_optional::<u32, D>(
7938                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7939                encoder,
7940                offset + cur_offset,
7941                depth,
7942            )?;
7943
7944            _prev_end_offset = cur_offset + envelope_size;
7945
7946            Ok(())
7947        }
7948    }
7949
7950    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsEvent {
7951        #[inline(always)]
7952        fn new_empty() -> Self {
7953            Self::default()
7954        }
7955
7956        unsafe fn decode(
7957            &mut self,
7958            decoder: &mut fidl::encoding::Decoder<'_, D>,
7959            offset: usize,
7960            mut depth: fidl::encoding::Depth,
7961        ) -> fidl::Result<()> {
7962            decoder.debug_check_bounds::<Self>(offset);
7963            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7964                None => return Err(fidl::Error::NotNullable),
7965                Some(len) => len,
7966            };
7967            // Calling decoder.out_of_line_offset(0) is not allowed.
7968            if len == 0 {
7969                return Ok(());
7970            };
7971            depth.increment()?;
7972            let envelope_size = 8;
7973            let bytes_len = len * envelope_size;
7974            let offset = decoder.out_of_line_offset(bytes_len)?;
7975            // Decode the envelope for each type.
7976            let mut _next_ordinal_to_read = 0;
7977            let mut next_offset = offset;
7978            let end_offset = offset + bytes_len;
7979            _next_ordinal_to_read += 1;
7980            if next_offset >= end_offset {
7981                return Ok(());
7982            }
7983
7984            // Decode unknown envelopes for gaps in ordinals.
7985            while _next_ordinal_to_read < 1 {
7986                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7987                _next_ordinal_to_read += 1;
7988                next_offset += envelope_size;
7989            }
7990
7991            let next_out_of_line = decoder.next_out_of_line();
7992            let handles_before = decoder.remaining_handles();
7993            if let Some((inlined, num_bytes, num_handles)) =
7994                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7995            {
7996                let member_inline_size =
7997                    <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7998                if inlined != (member_inline_size <= 4) {
7999                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8000                }
8001                let inner_offset;
8002                let mut inner_depth = depth.clone();
8003                if inlined {
8004                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8005                    inner_offset = next_offset;
8006                } else {
8007                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8008                    inner_depth.increment()?;
8009                }
8010                let val_ref = self.volume.get_or_insert_with(|| fidl::new_empty!(i8, D));
8011                fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
8012                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8013                {
8014                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8015                }
8016                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8017                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8018                }
8019            }
8020
8021            next_offset += envelope_size;
8022            _next_ordinal_to_read += 1;
8023            if next_offset >= end_offset {
8024                return Ok(());
8025            }
8026
8027            // Decode unknown envelopes for gaps in ordinals.
8028            while _next_ordinal_to_read < 2 {
8029                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8030                _next_ordinal_to_read += 1;
8031                next_offset += envelope_size;
8032            }
8033
8034            let next_out_of_line = decoder.next_out_of_line();
8035            let handles_before = decoder.remaining_handles();
8036            if let Some((inlined, num_bytes, num_handles)) =
8037                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8038            {
8039                let member_inline_size =
8040                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8041                if inlined != (member_inline_size <= 4) {
8042                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8043                }
8044                let inner_offset;
8045                let mut inner_depth = depth.clone();
8046                if inlined {
8047                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8048                    inner_offset = next_offset;
8049                } else {
8050                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8051                    inner_depth.increment()?;
8052                }
8053                let val_ref = self.mic_mute.get_or_insert_with(|| fidl::new_empty!(bool, D));
8054                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8055                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8056                {
8057                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8058                }
8059                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8060                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8061                }
8062            }
8063
8064            next_offset += envelope_size;
8065            _next_ordinal_to_read += 1;
8066            if next_offset >= end_offset {
8067                return Ok(());
8068            }
8069
8070            // Decode unknown envelopes for gaps in ordinals.
8071            while _next_ordinal_to_read < 3 {
8072                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8073                _next_ordinal_to_read += 1;
8074                next_offset += envelope_size;
8075            }
8076
8077            let next_out_of_line = decoder.next_out_of_line();
8078            let handles_before = decoder.remaining_handles();
8079            if let Some((inlined, num_bytes, num_handles)) =
8080                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8081            {
8082                let member_inline_size =
8083                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8084                if inlined != (member_inline_size <= 4) {
8085                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8086                }
8087                let inner_offset;
8088                let mut inner_depth = depth.clone();
8089                if inlined {
8090                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8091                    inner_offset = next_offset;
8092                } else {
8093                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8094                    inner_depth.increment()?;
8095                }
8096                let val_ref = self.pause.get_or_insert_with(|| fidl::new_empty!(bool, D));
8097                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8098                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8099                {
8100                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8101                }
8102                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8103                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8104                }
8105            }
8106
8107            next_offset += envelope_size;
8108            _next_ordinal_to_read += 1;
8109            if next_offset >= end_offset {
8110                return Ok(());
8111            }
8112
8113            // Decode unknown envelopes for gaps in ordinals.
8114            while _next_ordinal_to_read < 4 {
8115                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8116                _next_ordinal_to_read += 1;
8117                next_offset += envelope_size;
8118            }
8119
8120            let next_out_of_line = decoder.next_out_of_line();
8121            let handles_before = decoder.remaining_handles();
8122            if let Some((inlined, num_bytes, num_handles)) =
8123                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8124            {
8125                let member_inline_size =
8126                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8127                if inlined != (member_inline_size <= 4) {
8128                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8129                }
8130                let inner_offset;
8131                let mut inner_depth = depth.clone();
8132                if inlined {
8133                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8134                    inner_offset = next_offset;
8135                } else {
8136                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8137                    inner_depth.increment()?;
8138                }
8139                let val_ref = self.camera_disable.get_or_insert_with(|| fidl::new_empty!(bool, D));
8140                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8141                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8142                {
8143                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8144                }
8145                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8146                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8147                }
8148            }
8149
8150            next_offset += envelope_size;
8151            _next_ordinal_to_read += 1;
8152            if next_offset >= end_offset {
8153                return Ok(());
8154            }
8155
8156            // Decode unknown envelopes for gaps in ordinals.
8157            while _next_ordinal_to_read < 5 {
8158                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8159                _next_ordinal_to_read += 1;
8160                next_offset += envelope_size;
8161            }
8162
8163            let next_out_of_line = decoder.next_out_of_line();
8164            let handles_before = decoder.remaining_handles();
8165            if let Some((inlined, num_bytes, num_handles)) =
8166                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8167            {
8168                let member_inline_size =
8169                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8170                if inlined != (member_inline_size <= 4) {
8171                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8172                }
8173                let inner_offset;
8174                let mut inner_depth = depth.clone();
8175                if inlined {
8176                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8177                    inner_offset = next_offset;
8178                } else {
8179                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8180                    inner_depth.increment()?;
8181                }
8182                let val_ref = self.power.get_or_insert_with(|| fidl::new_empty!(bool, D));
8183                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8184                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8185                {
8186                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8187                }
8188                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8189                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8190                }
8191            }
8192
8193            next_offset += envelope_size;
8194            _next_ordinal_to_read += 1;
8195            if next_offset >= end_offset {
8196                return Ok(());
8197            }
8198
8199            // Decode unknown envelopes for gaps in ordinals.
8200            while _next_ordinal_to_read < 6 {
8201                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8202                _next_ordinal_to_read += 1;
8203                next_offset += envelope_size;
8204            }
8205
8206            let next_out_of_line = decoder.next_out_of_line();
8207            let handles_before = decoder.remaining_handles();
8208            if let Some((inlined, num_bytes, num_handles)) =
8209                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8210            {
8211                let member_inline_size =
8212                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8213                if inlined != (member_inline_size <= 4) {
8214                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8215                }
8216                let inner_offset;
8217                let mut inner_depth = depth.clone();
8218                if inlined {
8219                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8220                    inner_offset = next_offset;
8221                } else {
8222                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8223                    inner_depth.increment()?;
8224                }
8225                let val_ref = self.function.get_or_insert_with(|| fidl::new_empty!(bool, D));
8226                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
8227                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8228                {
8229                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8230                }
8231                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8232                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8233                }
8234            }
8235
8236            next_offset += envelope_size;
8237            _next_ordinal_to_read += 1;
8238            if next_offset >= end_offset {
8239                return Ok(());
8240            }
8241
8242            // Decode unknown envelopes for gaps in ordinals.
8243            while _next_ordinal_to_read < 7 {
8244                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8245                _next_ordinal_to_read += 1;
8246                next_offset += envelope_size;
8247            }
8248
8249            let next_out_of_line = decoder.next_out_of_line();
8250            let handles_before = decoder.remaining_handles();
8251            if let Some((inlined, num_bytes, num_handles)) =
8252                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8253            {
8254                let member_inline_size =
8255                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8256                if inlined != (member_inline_size <= 4) {
8257                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8258                }
8259                let inner_offset;
8260                let mut inner_depth = depth.clone();
8261                if inlined {
8262                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8263                    inner_offset = next_offset;
8264                } else {
8265                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8266                    inner_depth.increment()?;
8267                }
8268                let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
8269                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
8270                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8271                {
8272                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8273                }
8274                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8275                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8276                }
8277            }
8278
8279            next_offset += envelope_size;
8280
8281            // Decode the remaining unknown envelopes.
8282            while next_offset < end_offset {
8283                _next_ordinal_to_read += 1;
8284                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8285                next_offset += envelope_size;
8286            }
8287
8288            Ok(())
8289        }
8290    }
8291
8292    impl fidl::encoding::ValueTypeMarker for Command {
8293        type Borrowed<'a> = &'a Self;
8294        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8295            value
8296        }
8297    }
8298
8299    unsafe impl fidl::encoding::TypeMarker for Command {
8300        type Owned = Self;
8301
8302        #[inline(always)]
8303        fn inline_align(_context: fidl::encoding::Context) -> usize {
8304            8
8305        }
8306
8307        #[inline(always)]
8308        fn inline_size(_context: fidl::encoding::Context) -> usize {
8309            16
8310        }
8311    }
8312
8313    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Command, D> for &Command {
8314        #[inline]
8315        unsafe fn encode(
8316            self,
8317            encoder: &mut fidl::encoding::Encoder<'_, D>,
8318            offset: usize,
8319            _depth: fidl::encoding::Depth,
8320        ) -> fidl::Result<()> {
8321            encoder.debug_check_bounds::<Command>(offset);
8322            encoder.write_num::<u64>(self.ordinal(), offset);
8323            match self {
8324                Command::SendKeyboardInput(ref val) => {
8325                    fidl::encoding::encode_in_envelope::<SendKeyboardInputCmd, D>(
8326                        <SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
8327                        encoder,
8328                        offset + 8,
8329                        _depth,
8330                    )
8331                }
8332                Command::SendPointerInput(ref val) => {
8333                    fidl::encoding::encode_in_envelope::<SendPointerInputCmd, D>(
8334                        <SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
8335                        encoder,
8336                        offset + 8,
8337                        _depth,
8338                    )
8339                }
8340                Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
8341                    SetHardKeyboardDeliveryCmd,
8342                    D,
8343                >(
8344                    <SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
8345                    encoder,
8346                    offset + 8,
8347                    _depth,
8348                ),
8349                Command::SetParallelDispatch(ref val) => {
8350                    fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd, D>(
8351                        <SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
8352                        encoder,
8353                        offset + 8,
8354                        _depth,
8355                    )
8356                }
8357            }
8358        }
8359    }
8360
8361    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
8362        #[inline(always)]
8363        fn new_empty() -> Self {
8364            Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D))
8365        }
8366
8367        #[inline]
8368        unsafe fn decode(
8369            &mut self,
8370            decoder: &mut fidl::encoding::Decoder<'_, D>,
8371            offset: usize,
8372            mut depth: fidl::encoding::Depth,
8373        ) -> fidl::Result<()> {
8374            decoder.debug_check_bounds::<Self>(offset);
8375            #[allow(unused_variables)]
8376            let next_out_of_line = decoder.next_out_of_line();
8377            let handles_before = decoder.remaining_handles();
8378            let (ordinal, inlined, num_bytes, num_handles) =
8379                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8380
8381            let member_inline_size = match ordinal {
8382                1 => <SendKeyboardInputCmd as fidl::encoding::TypeMarker>::inline_size(
8383                    decoder.context,
8384                ),
8385                2 => <SendPointerInputCmd as fidl::encoding::TypeMarker>::inline_size(
8386                    decoder.context,
8387                ),
8388                3 => <SetHardKeyboardDeliveryCmd as fidl::encoding::TypeMarker>::inline_size(
8389                    decoder.context,
8390                ),
8391                4 => <SetParallelDispatchCmd as fidl::encoding::TypeMarker>::inline_size(
8392                    decoder.context,
8393                ),
8394                _ => return Err(fidl::Error::UnknownUnionTag),
8395            };
8396
8397            if inlined != (member_inline_size <= 4) {
8398                return Err(fidl::Error::InvalidInlineBitInEnvelope);
8399            }
8400            let _inner_offset;
8401            if inlined {
8402                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8403                _inner_offset = offset + 8;
8404            } else {
8405                depth.increment()?;
8406                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8407            }
8408            match ordinal {
8409                1 => {
8410                    #[allow(irrefutable_let_patterns)]
8411                    if let Command::SendKeyboardInput(_) = self {
8412                        // Do nothing, read the value into the object
8413                    } else {
8414                        // Initialize `self` to the right variant
8415                        *self =
8416                            Command::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D));
8417                    }
8418                    #[allow(irrefutable_let_patterns)]
8419                    if let Command::SendKeyboardInput(ref mut val) = self {
8420                        fidl::decode!(SendKeyboardInputCmd, D, val, decoder, _inner_offset, depth)?;
8421                    } else {
8422                        unreachable!()
8423                    }
8424                }
8425                2 => {
8426                    #[allow(irrefutable_let_patterns)]
8427                    if let Command::SendPointerInput(_) = self {
8428                        // Do nothing, read the value into the object
8429                    } else {
8430                        // Initialize `self` to the right variant
8431                        *self = Command::SendPointerInput(fidl::new_empty!(SendPointerInputCmd, D));
8432                    }
8433                    #[allow(irrefutable_let_patterns)]
8434                    if let Command::SendPointerInput(ref mut val) = self {
8435                        fidl::decode!(SendPointerInputCmd, D, val, decoder, _inner_offset, depth)?;
8436                    } else {
8437                        unreachable!()
8438                    }
8439                }
8440                3 => {
8441                    #[allow(irrefutable_let_patterns)]
8442                    if let Command::SetHardKeyboardDelivery(_) = self {
8443                        // Do nothing, read the value into the object
8444                    } else {
8445                        // Initialize `self` to the right variant
8446                        *self = Command::SetHardKeyboardDelivery(fidl::new_empty!(
8447                            SetHardKeyboardDeliveryCmd,
8448                            D
8449                        ));
8450                    }
8451                    #[allow(irrefutable_let_patterns)]
8452                    if let Command::SetHardKeyboardDelivery(ref mut val) = self {
8453                        fidl::decode!(
8454                            SetHardKeyboardDeliveryCmd,
8455                            D,
8456                            val,
8457                            decoder,
8458                            _inner_offset,
8459                            depth
8460                        )?;
8461                    } else {
8462                        unreachable!()
8463                    }
8464                }
8465                4 => {
8466                    #[allow(irrefutable_let_patterns)]
8467                    if let Command::SetParallelDispatch(_) = self {
8468                        // Do nothing, read the value into the object
8469                    } else {
8470                        // Initialize `self` to the right variant
8471                        *self = Command::SetParallelDispatch(fidl::new_empty!(
8472                            SetParallelDispatchCmd,
8473                            D
8474                        ));
8475                    }
8476                    #[allow(irrefutable_let_patterns)]
8477                    if let Command::SetParallelDispatch(ref mut val) = self {
8478                        fidl::decode!(
8479                            SetParallelDispatchCmd,
8480                            D,
8481                            val,
8482                            decoder,
8483                            _inner_offset,
8484                            depth
8485                        )?;
8486                    } else {
8487                        unreachable!()
8488                    }
8489                }
8490                ordinal => panic!("unexpected ordinal {:?}", ordinal),
8491            }
8492            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8493                return Err(fidl::Error::InvalidNumBytesInEnvelope);
8494            }
8495            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8496                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8497            }
8498            Ok(())
8499        }
8500    }
8501
8502    impl fidl::encoding::ValueTypeMarker for InputEvent {
8503        type Borrowed<'a> = &'a Self;
8504        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8505            value
8506        }
8507    }
8508
8509    unsafe impl fidl::encoding::TypeMarker for InputEvent {
8510        type Owned = Self;
8511
8512        #[inline(always)]
8513        fn inline_align(_context: fidl::encoding::Context) -> usize {
8514            8
8515        }
8516
8517        #[inline(always)]
8518        fn inline_size(_context: fidl::encoding::Context) -> usize {
8519            16
8520        }
8521    }
8522
8523    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputEvent, D>
8524        for &InputEvent
8525    {
8526        #[inline]
8527        unsafe fn encode(
8528            self,
8529            encoder: &mut fidl::encoding::Encoder<'_, D>,
8530            offset: usize,
8531            _depth: fidl::encoding::Depth,
8532        ) -> fidl::Result<()> {
8533            encoder.debug_check_bounds::<InputEvent>(offset);
8534            encoder.write_num::<u64>(self.ordinal(), offset);
8535            match self {
8536                InputEvent::Pointer(ref val) => {
8537                    fidl::encoding::encode_in_envelope::<PointerEvent, D>(
8538                        <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
8539                        encoder,
8540                        offset + 8,
8541                        _depth,
8542                    )
8543                }
8544                InputEvent::Keyboard(ref val) => {
8545                    fidl::encoding::encode_in_envelope::<KeyboardEvent, D>(
8546                        <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
8547                        encoder,
8548                        offset + 8,
8549                        _depth,
8550                    )
8551                }
8552                InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent, D>(
8553                    <FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
8554                    encoder,
8555                    offset + 8,
8556                    _depth,
8557                ),
8558            }
8559        }
8560    }
8561
8562    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputEvent {
8563        #[inline(always)]
8564        fn new_empty() -> Self {
8565            Self::Pointer(fidl::new_empty!(PointerEvent, D))
8566        }
8567
8568        #[inline]
8569        unsafe fn decode(
8570            &mut self,
8571            decoder: &mut fidl::encoding::Decoder<'_, D>,
8572            offset: usize,
8573            mut depth: fidl::encoding::Depth,
8574        ) -> fidl::Result<()> {
8575            decoder.debug_check_bounds::<Self>(offset);
8576            #[allow(unused_variables)]
8577            let next_out_of_line = decoder.next_out_of_line();
8578            let handles_before = decoder.remaining_handles();
8579            let (ordinal, inlined, num_bytes, num_handles) =
8580                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8581
8582            let member_inline_size = match ordinal {
8583                1 => <PointerEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8584                2 => <KeyboardEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8585                3 => <FocusEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8586                _ => return Err(fidl::Error::UnknownUnionTag),
8587            };
8588
8589            if inlined != (member_inline_size <= 4) {
8590                return Err(fidl::Error::InvalidInlineBitInEnvelope);
8591            }
8592            let _inner_offset;
8593            if inlined {
8594                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8595                _inner_offset = offset + 8;
8596            } else {
8597                depth.increment()?;
8598                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8599            }
8600            match ordinal {
8601                1 => {
8602                    #[allow(irrefutable_let_patterns)]
8603                    if let InputEvent::Pointer(_) = self {
8604                        // Do nothing, read the value into the object
8605                    } else {
8606                        // Initialize `self` to the right variant
8607                        *self = InputEvent::Pointer(fidl::new_empty!(PointerEvent, D));
8608                    }
8609                    #[allow(irrefutable_let_patterns)]
8610                    if let InputEvent::Pointer(ref mut val) = self {
8611                        fidl::decode!(PointerEvent, D, val, decoder, _inner_offset, depth)?;
8612                    } else {
8613                        unreachable!()
8614                    }
8615                }
8616                2 => {
8617                    #[allow(irrefutable_let_patterns)]
8618                    if let InputEvent::Keyboard(_) = self {
8619                        // Do nothing, read the value into the object
8620                    } else {
8621                        // Initialize `self` to the right variant
8622                        *self = InputEvent::Keyboard(fidl::new_empty!(KeyboardEvent, D));
8623                    }
8624                    #[allow(irrefutable_let_patterns)]
8625                    if let InputEvent::Keyboard(ref mut val) = self {
8626                        fidl::decode!(KeyboardEvent, D, val, decoder, _inner_offset, depth)?;
8627                    } else {
8628                        unreachable!()
8629                    }
8630                }
8631                3 => {
8632                    #[allow(irrefutable_let_patterns)]
8633                    if let InputEvent::Focus(_) = self {
8634                        // Do nothing, read the value into the object
8635                    } else {
8636                        // Initialize `self` to the right variant
8637                        *self = InputEvent::Focus(fidl::new_empty!(FocusEvent, D));
8638                    }
8639                    #[allow(irrefutable_let_patterns)]
8640                    if let InputEvent::Focus(ref mut val) = self {
8641                        fidl::decode!(FocusEvent, D, val, decoder, _inner_offset, depth)?;
8642                    } else {
8643                        unreachable!()
8644                    }
8645                }
8646                ordinal => panic!("unexpected ordinal {:?}", ordinal),
8647            }
8648            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8649                return Err(fidl::Error::InvalidNumBytesInEnvelope);
8650            }
8651            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8652                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8653            }
8654            Ok(())
8655        }
8656    }
8657
8658    impl fidl::encoding::ValueTypeMarker for SensorReport {
8659        type Borrowed<'a> = &'a Self;
8660        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8661            value
8662        }
8663    }
8664
8665    unsafe impl fidl::encoding::TypeMarker for SensorReport {
8666        type Owned = Self;
8667
8668        #[inline(always)]
8669        fn inline_align(_context: fidl::encoding::Context) -> usize {
8670            8
8671        }
8672
8673        #[inline(always)]
8674        fn inline_size(_context: fidl::encoding::Context) -> usize {
8675            16
8676        }
8677    }
8678
8679    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorReport, D>
8680        for &SensorReport
8681    {
8682        #[inline]
8683        unsafe fn encode(
8684            self,
8685            encoder: &mut fidl::encoding::Encoder<'_, D>,
8686            offset: usize,
8687            _depth: fidl::encoding::Depth,
8688        ) -> fidl::Result<()> {
8689            encoder.debug_check_bounds::<SensorReport>(offset);
8690            encoder.write_num::<u64>(self.ordinal(), offset);
8691            match self {
8692                SensorReport::Vector(ref val) => fidl::encoding::encode_in_envelope::<
8693                    fidl::encoding::Array<i16, 3>,
8694                    D,
8695                >(
8696                    <fidl::encoding::Array<i16, 3> as fidl::encoding::ValueTypeMarker>::borrow(val),
8697                    encoder,
8698                    offset + 8,
8699                    _depth,
8700                ),
8701                SensorReport::Scalar(ref val) => fidl::encoding::encode_in_envelope::<u16, D>(
8702                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
8703                    encoder,
8704                    offset + 8,
8705                    _depth,
8706                ),
8707            }
8708        }
8709    }
8710
8711    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReport {
8712        #[inline(always)]
8713        fn new_empty() -> Self {
8714            Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>, D))
8715        }
8716
8717        #[inline]
8718        unsafe fn decode(
8719            &mut self,
8720            decoder: &mut fidl::encoding::Decoder<'_, D>,
8721            offset: usize,
8722            mut depth: fidl::encoding::Depth,
8723        ) -> fidl::Result<()> {
8724            decoder.debug_check_bounds::<Self>(offset);
8725            #[allow(unused_variables)]
8726            let next_out_of_line = decoder.next_out_of_line();
8727            let handles_before = decoder.remaining_handles();
8728            let (ordinal, inlined, num_bytes, num_handles) =
8729                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
8730
8731            let member_inline_size = match ordinal {
8732                1 => <fidl::encoding::Array<i16, 3> as fidl::encoding::TypeMarker>::inline_size(
8733                    decoder.context,
8734                ),
8735                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
8736                _ => return Err(fidl::Error::UnknownUnionTag),
8737            };
8738
8739            if inlined != (member_inline_size <= 4) {
8740                return Err(fidl::Error::InvalidInlineBitInEnvelope);
8741            }
8742            let _inner_offset;
8743            if inlined {
8744                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
8745                _inner_offset = offset + 8;
8746            } else {
8747                depth.increment()?;
8748                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8749            }
8750            match ordinal {
8751                1 => {
8752                    #[allow(irrefutable_let_patterns)]
8753                    if let SensorReport::Vector(_) = self {
8754                        // Do nothing, read the value into the object
8755                    } else {
8756                        // Initialize `self` to the right variant
8757                        *self = SensorReport::Vector(
8758                            fidl::new_empty!(fidl::encoding::Array<i16, 3>, D),
8759                        );
8760                    }
8761                    #[allow(irrefutable_let_patterns)]
8762                    if let SensorReport::Vector(ref mut val) = self {
8763                        fidl::decode!(fidl::encoding::Array<i16, 3>, D, val, decoder, _inner_offset, depth)?;
8764                    } else {
8765                        unreachable!()
8766                    }
8767                }
8768                2 => {
8769                    #[allow(irrefutable_let_patterns)]
8770                    if let SensorReport::Scalar(_) = self {
8771                        // Do nothing, read the value into the object
8772                    } else {
8773                        // Initialize `self` to the right variant
8774                        *self = SensorReport::Scalar(fidl::new_empty!(u16, D));
8775                    }
8776                    #[allow(irrefutable_let_patterns)]
8777                    if let SensorReport::Scalar(ref mut val) = self {
8778                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
8779                    } else {
8780                        unreachable!()
8781                    }
8782                }
8783                ordinal => panic!("unexpected ordinal {:?}", ordinal),
8784            }
8785            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
8786                return Err(fidl::Error::InvalidNumBytesInEnvelope);
8787            }
8788            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8789                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8790            }
8791            Ok(())
8792        }
8793    }
8794}