fidl_fuchsia_ui_test_input_common/
fidl_fuchsia_ui_test_input_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_FINGERS: u8 = 10;
12
13/// A hardcoded number of max mouse buttons. This should be increased in the future
14/// if we ever see mice with more buttons.
15pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
16
17/// Indicates the units used to specify spatial event parameters (unless otherwise
18/// noted).
19#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
20pub enum CoordinateUnit {
21    /// The physical display is mapped to a coordinate space spanning [-1000, 1000]
22    /// on both the x and y axes, where positive x extends rightward and positive y
23    /// extends downward.
24    ///
25    /// Example: (500, -500) in the default coordinate space maps to the center of
26    /// the top-right quadrant of the physical display.
27    Default,
28    /// The physical display is mapped to a coordinate space spanning (0, 0) -
29    /// (dispaly width, display height), where positive x extends rightward and
30    /// positive y extends downward.
31    ///
32    /// Test writers should use `fuchsia.ui.display.singleton.Info` to retrieve
33    /// the physical dimensions of the display.
34    ///
35    /// Note that this space matches both the size AND orientation of the physical
36    /// display, so it will NOT mirror any rotations applied to the scene graph.
37    ///
38    /// In general, test writers should NOT assume that a particular view's logical
39    /// coordinate space matches the physical coordinate space.
40    PhysicalPixels,
41    #[doc(hidden)]
42    __SourceBreaking { unknown_ordinal: u32 },
43}
44
45/// Pattern that matches an unknown `CoordinateUnit` member.
46#[macro_export]
47macro_rules! CoordinateUnitUnknown {
48    () => {
49        _
50    };
51}
52
53impl CoordinateUnit {
54    #[inline]
55    pub fn from_primitive(prim: u32) -> Option<Self> {
56        match prim {
57            0 => Some(Self::Default),
58            1 => Some(Self::PhysicalPixels),
59            _ => None,
60        }
61    }
62
63    #[inline]
64    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
65        match prim {
66            0 => Self::Default,
67            1 => Self::PhysicalPixels,
68            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
69        }
70    }
71
72    #[inline]
73    pub fn unknown() -> Self {
74        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
75    }
76
77    #[inline]
78    pub const fn into_primitive(self) -> u32 {
79        match self {
80            Self::Default => 0,
81            Self::PhysicalPixels => 1,
82            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
83        }
84    }
85
86    #[inline]
87    pub fn is_unknown(&self) -> bool {
88        match self {
89            Self::__SourceBreaking { unknown_ordinal: _ } => true,
90            _ => false,
91        }
92    }
93}
94
95/// Identifies various buttons on a standard mouse.
96#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
97pub enum MouseButton {
98    /// "Left" mouse button.
99    First,
100    /// "Right" mouse button.
101    Second,
102    /// "Third" mouse button.
103    Third,
104    #[doc(hidden)]
105    __SourceBreaking { unknown_ordinal: u32 },
106}
107
108/// Pattern that matches an unknown `MouseButton` member.
109#[macro_export]
110macro_rules! MouseButtonUnknown {
111    () => {
112        _
113    };
114}
115
116impl MouseButton {
117    #[inline]
118    pub fn from_primitive(prim: u32) -> Option<Self> {
119        match prim {
120            0 => Some(Self::First),
121            1 => Some(Self::Second),
122            2 => Some(Self::Third),
123            _ => None,
124        }
125    }
126
127    #[inline]
128    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
129        match prim {
130            0 => Self::First,
131            1 => Self::Second,
132            2 => Self::Third,
133            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
134        }
135    }
136
137    #[inline]
138    pub fn unknown() -> Self {
139        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
140    }
141
142    #[inline]
143    pub const fn into_primitive(self) -> u32 {
144        match self {
145            Self::First => 0,
146            Self::Second => 1,
147            Self::Third => 2,
148            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
149        }
150    }
151
152    #[inline]
153    pub fn is_unknown(&self) -> bool {
154        match self {
155            Self::__SourceBreaking { unknown_ordinal: _ } => true,
156            _ => false,
157        }
158    }
159}
160
161/// Identifies the phase of a mouse event.
162#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
163pub enum MouseEventPhase {
164    /// The observer has started tracking the mouse.
165    Add,
166    /// The mouse has moved since the last ADD event, without an interceding DOWN
167    /// event.
168    Hover,
169    /// One or more mouse buttons have been pressed.
170    Down,
171    /// The mouse has moved since the last DOWN event.
172    Move,
173    /// All pressed buttons have been released.
174    Up,
175    /// The mouse wheel was manipulated.
176    Wheel,
177    #[doc(hidden)]
178    __SourceBreaking { unknown_ordinal: u32 },
179}
180
181/// Pattern that matches an unknown `MouseEventPhase` member.
182#[macro_export]
183macro_rules! MouseEventPhaseUnknown {
184    () => {
185        _
186    };
187}
188
189impl MouseEventPhase {
190    #[inline]
191    pub fn from_primitive(prim: u32) -> Option<Self> {
192        match prim {
193            0 => Some(Self::Add),
194            1 => Some(Self::Hover),
195            2 => Some(Self::Down),
196            3 => Some(Self::Move),
197            4 => Some(Self::Up),
198            5 => Some(Self::Wheel),
199            _ => None,
200        }
201    }
202
203    #[inline]
204    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
205        match prim {
206            0 => Self::Add,
207            1 => Self::Hover,
208            2 => Self::Down,
209            3 => Self::Move,
210            4 => Self::Up,
211            5 => Self::Wheel,
212            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
213        }
214    }
215
216    #[inline]
217    pub fn unknown() -> Self {
218        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
219    }
220
221    #[inline]
222    pub const fn into_primitive(self) -> u32 {
223        match self {
224            Self::Add => 0,
225            Self::Hover => 1,
226            Self::Down => 2,
227            Self::Move => 3,
228            Self::Up => 4,
229            Self::Wheel => 5,
230            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
231        }
232    }
233
234    #[inline]
235    pub fn is_unknown(&self) -> bool {
236        match self {
237            Self::__SourceBreaking { unknown_ordinal: _ } => true,
238            _ => false,
239        }
240    }
241}
242
243#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
244pub enum TestAppStatus {
245    /// Must of input tests (mouse / touch) only require HANDLERS_REGISTERED.
246    /// HANDLERS_REGISTERED means test app has started and event handlers are
247    /// registered.
248    HandlersRegistered,
249    /// Keyboard related tests may require ELEMENT_FOCUSED status before inject
250    /// key events. For example Chromium related tests, event handler is
251    /// registered to a <textarea>, test suites should inject a touch event to
252    /// move focus to the <textarea> before inject key events.
253    ElementFocused,
254    #[doc(hidden)]
255    __SourceBreaking { unknown_ordinal: u16 },
256}
257
258/// Pattern that matches an unknown `TestAppStatus` member.
259#[macro_export]
260macro_rules! TestAppStatusUnknown {
261    () => {
262        _
263    };
264}
265
266impl TestAppStatus {
267    #[inline]
268    pub fn from_primitive(prim: u16) -> Option<Self> {
269        match prim {
270            1 => Some(Self::HandlersRegistered),
271            2 => Some(Self::ElementFocused),
272            _ => None,
273        }
274    }
275
276    #[inline]
277    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
278        match prim {
279            1 => Self::HandlersRegistered,
280            2 => Self::ElementFocused,
281            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
282        }
283    }
284
285    #[inline]
286    pub fn unknown() -> Self {
287        Self::__SourceBreaking { unknown_ordinal: 0xffff }
288    }
289
290    #[inline]
291    pub const fn into_primitive(self) -> u16 {
292        match self {
293            Self::HandlersRegistered => 1,
294            Self::ElementFocused => 2,
295            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
296        }
297    }
298
299    #[inline]
300    pub fn is_unknown(&self) -> bool {
301        match self {
302            Self::__SourceBreaking { unknown_ordinal: _ } => true,
303            _ => false,
304        }
305    }
306}
307
308#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
309pub struct TestAppStatusListenerReportStatusRequest {
310    pub status: TestAppStatus,
311}
312
313impl fidl::Persistable for TestAppStatusListenerReportStatusRequest {}
314
315#[derive(Clone, Debug, PartialEq)]
316pub struct TouchScreenSimulateTouchEventRequest {
317    pub report: fidl_fuchsia_input_report::TouchInputReport,
318}
319
320impl fidl::Persistable for TouchScreenSimulateTouchEventRequest {}
321
322#[derive(Clone, Debug, Default, PartialEq)]
323pub struct KeyboardInputListenerReportTextInputRequest {
324    /// The content of the text input received by the reporter.
325    pub text: Option<String>,
326    /// The non printable key received by the reporter.
327    pub non_printable: Option<fidl_fuchsia_ui_input3::NonPrintableKey>,
328    pub device_id: Option<u32>,
329    #[doc(hidden)]
330    pub __source_breaking: fidl::marker::SourceBreaking,
331}
332
333impl fidl::Persistable for KeyboardInputListenerReportTextInputRequest {}
334
335#[derive(Clone, Debug, Default, PartialEq)]
336pub struct KeyboardSimulateKeyEventRequest {
337    pub report: Option<fidl_fuchsia_input_report::KeyboardInputReport>,
338    #[doc(hidden)]
339    pub __source_breaking: fidl::marker::SourceBreaking,
340}
341
342impl fidl::Persistable for KeyboardSimulateKeyEventRequest {}
343
344#[derive(Clone, Debug, Default, PartialEq)]
345pub struct KeyboardSimulateKeyPressRequest {
346    pub key_code: Option<fidl_fuchsia_input::Key>,
347    #[doc(hidden)]
348    pub __source_breaking: fidl::marker::SourceBreaking,
349}
350
351impl fidl::Persistable for KeyboardSimulateKeyPressRequest {}
352
353#[derive(Clone, Debug, Default, PartialEq)]
354pub struct KeyboardSimulateUsAsciiTextEntryRequest {
355    pub text: Option<String>,
356    #[doc(hidden)]
357    pub __source_breaking: fidl::marker::SourceBreaking,
358}
359
360impl fidl::Persistable for KeyboardSimulateUsAsciiTextEntryRequest {}
361
362#[derive(Clone, Debug, Default, PartialEq)]
363pub struct MediaButtonsDeviceSendButtonsStateRequest {
364    /// The button receiving the button press.
365    pub buttons: Option<Vec<fidl_fuchsia_input_report::ConsumerControlButton>>,
366    #[doc(hidden)]
367    pub __source_breaking: fidl::marker::SourceBreaking,
368}
369
370impl fidl::Persistable for MediaButtonsDeviceSendButtonsStateRequest {}
371
372#[derive(Clone, Debug, Default, PartialEq)]
373pub struct MediaButtonsDeviceSimulateButtonPressRequest {
374    /// The button receiving the button press.
375    pub button: Option<fidl_fuchsia_input_report::ConsumerControlButton>,
376    #[doc(hidden)]
377    pub __source_breaking: fidl::marker::SourceBreaking,
378}
379
380impl fidl::Persistable for MediaButtonsDeviceSimulateButtonPressRequest {}
381
382#[derive(Clone, Debug, Default, PartialEq)]
383pub struct MouseInputListenerReportMouseInputRequest {
384    /// The horizontal coordinate in the reporter's coordinate system.
385    pub local_x: Option<f64>,
386    /// The vertical coordinate in the reporter's coordinate system.
387    pub local_y: Option<f64>,
388    /// The monotonic time (ns) the mouse event was received by the client.
389    /// Note that this value should be used with caution. Some reporters may not be
390    /// capable of ns-level precision, but still report in ns-level units.
391    pub time_received: Option<i64>,
392    /// Name of the component to help distinguish responses from multiple components.
393    ///
394    /// NOTE: This name is *independent* of component framework, so the reporter and
395    /// listener are free to agree on an arbitrary value.
396    pub component_name: Option<String>,
397    /// The pressed buttons that the reporter received.
398    pub buttons: Option<Vec<MouseButton>>,
399    /// The phase of the mouse event that the reporter received.
400    pub phase: Option<MouseEventPhase>,
401    /// The device pixel ratio of which the reporter is aware.
402    ///
403    /// Some reporters may account for this scale factor when converting to local
404    /// coordinates.
405    pub device_pixel_ratio: Option<f64>,
406    /// The horizontal wheel scroll delta in physical pixels.
407    pub wheel_x_physical_pixel: Option<f64>,
408    /// The vertical wheel scroll delta in physical pixels.
409    pub wheel_y_physical_pixel: Option<f64>,
410    pub device_id: Option<u32>,
411    #[doc(hidden)]
412    pub __source_breaking: fidl::marker::SourceBreaking,
413}
414
415impl fidl::Persistable for MouseInputListenerReportMouseInputRequest {}
416
417#[derive(Clone, Debug, Default, PartialEq)]
418pub struct MouseSimulateMouseEventRequest {
419    /// Set of buttons that are currently pressed.
420    /// Must NOT contain duplicates.
421    pub pressed_buttons: Option<Vec<MouseButton>>,
422    /// Relative X positional displacement.
423    pub movement_x: Option<i64>,
424    /// Relative Y positional displacement.
425    pub movement_y: Option<i64>,
426    /// Relative vertical scrolling displacement by detent.
427    pub scroll_v_detent: Option<i64>,
428    /// Relative horizontal scrolling displacement by detent.
429    pub scroll_h_detent: Option<i64>,
430    /// Recommended vertical scrolling displacement by physical pixel, it is
431    /// computed with accelerator, detent / mm to pixel ratio, etc.
432    pub scroll_v_physical_pixel: Option<f64>,
433    /// Recommended horizontal scrolling displacement by physical pixel, it
434    /// is computed with accelerator, detent / mm to pixel ratio, etc.
435    pub scroll_h_physical_pixel: Option<f64>,
436    #[doc(hidden)]
437    pub __source_breaking: fidl::marker::SourceBreaking,
438}
439
440impl fidl::Persistable for MouseSimulateMouseEventRequest {}
441
442#[derive(Clone, Debug, Default, PartialEq)]
443pub struct TouchInputListenerReportTouchInputRequest {
444    /// The horizontal coordinate, in the reporter's coordinate system.
445    pub local_x: Option<f64>,
446    /// The vertical coordinate, in the reporter's coordinate system.
447    pub local_y: Option<f64>,
448    /// The monotonic time (ns) the pointer data was received by the reporter.
449    /// Note that this value should be used with caution. Some reporters may not be
450    /// capable of ns-level precision, but still report in ns-level units.
451    pub time_received: Option<i64>,
452    /// The number of physical pixels, per logical pixel, as reported by the reporter.
453    pub device_pixel_ratio: Option<f64>,
454    /// Name of the component to help distinguish responses from multiple components.
455    ///
456    /// NOTE: This name is *independent* of component framework, so the reporter and
457    /// listener are free to agree on an arbitrary value.
458    pub component_name: Option<String>,
459    /// The phase of the touch event.
460    pub phase: Option<fidl_fuchsia_ui_pointer::EventPhase>,
461    /// pointer_id is used to identify finger in multi touch. each finger
462    /// is sent in a separate call to `ReportTouchInput()`, and the callee
463    /// is responsible for assembling the fingers as needed
464    pub pointer_id: Option<u32>,
465    pub device_id: Option<u32>,
466    #[doc(hidden)]
467    pub __source_breaking: fidl::marker::SourceBreaking,
468}
469
470impl fidl::Persistable for TouchInputListenerReportTouchInputRequest {}
471
472#[derive(Clone, Debug, Default, PartialEq)]
473pub struct TouchScreenSimulateMultiFingerGestureRequest {
474    /// Starting locations of the gesture, in the coordinate units specified during
475    /// registration.
476    pub start_locations: Option<[fidl_fuchsia_math::Vec_; 10]>,
477    /// End locations of the gesture, in the coordinate units specified during
478    /// registration.
479    pub end_locations: Option<[fidl_fuchsia_math::Vec_; 10]>,
480    /// Number of move events in the pinch.
481    pub move_event_count: Option<u32>,
482    /// Number of fingers, because `array<fuchsia.math.Vec, MAX_FINGERS>` is
483    /// fixed length, we use this field to know how many fingers in gesture.
484    pub finger_count: Option<u32>,
485    #[doc(hidden)]
486    pub __source_breaking: fidl::marker::SourceBreaking,
487}
488
489impl fidl::Persistable for TouchScreenSimulateMultiFingerGestureRequest {}
490
491#[derive(Clone, Debug, Default, PartialEq)]
492pub struct TouchScreenSimulateMultiTapRequest {
493    /// Locations of the tap event, in the coordinate units specified during
494    /// registration.
495    pub tap_locations: Option<Vec<fidl_fuchsia_math::Vec_>>,
496    #[doc(hidden)]
497    pub __source_breaking: fidl::marker::SourceBreaking,
498}
499
500impl fidl::Persistable for TouchScreenSimulateMultiTapRequest {}
501
502#[derive(Clone, Debug, Default, PartialEq)]
503pub struct TouchScreenSimulateSwipeRequest {
504    /// Starting location of the swipe, in the coordinate units specified during
505    /// registration.
506    pub start_location: Option<fidl_fuchsia_math::Vec_>,
507    /// End location of the swipe, in the coordinate units specified during
508    /// registration.
509    pub end_location: Option<fidl_fuchsia_math::Vec_>,
510    /// Number of move events in the swipe.
511    pub move_event_count: Option<u32>,
512    /// The duration of the swipe gesture.
513    /// Per step delay = duration / ( move_event_count + 1).
514    /// DOWN - wait per step delay - CHANGE_1 - wait per step delay - ... -
515    /// CHANGE_n - wait per step delay - UP.
516    pub duration: Option<i64>,
517    #[doc(hidden)]
518    pub __source_breaking: fidl::marker::SourceBreaking,
519}
520
521impl fidl::Persistable for TouchScreenSimulateSwipeRequest {}
522
523#[derive(Clone, Debug, Default, PartialEq)]
524pub struct TouchScreenSimulateTapRequest {
525    /// Location of the tap event, in the coordinate units specified during
526    /// registration.
527    pub tap_location: Option<fidl_fuchsia_math::Vec_>,
528    #[doc(hidden)]
529    pub __source_breaking: fidl::marker::SourceBreaking,
530}
531
532impl fidl::Persistable for TouchScreenSimulateTapRequest {}
533
534mod internal {
535    use super::*;
536    unsafe impl fidl::encoding::TypeMarker for CoordinateUnit {
537        type Owned = Self;
538
539        #[inline(always)]
540        fn inline_align(_context: fidl::encoding::Context) -> usize {
541            std::mem::align_of::<u32>()
542        }
543
544        #[inline(always)]
545        fn inline_size(_context: fidl::encoding::Context) -> usize {
546            std::mem::size_of::<u32>()
547        }
548
549        #[inline(always)]
550        fn encode_is_copy() -> bool {
551            false
552        }
553
554        #[inline(always)]
555        fn decode_is_copy() -> bool {
556            false
557        }
558    }
559
560    impl fidl::encoding::ValueTypeMarker for CoordinateUnit {
561        type Borrowed<'a> = Self;
562        #[inline(always)]
563        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
564            *value
565        }
566    }
567
568    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CoordinateUnit {
569        #[inline]
570        unsafe fn encode(
571            self,
572            encoder: &mut fidl::encoding::Encoder<'_, D>,
573            offset: usize,
574            _depth: fidl::encoding::Depth,
575        ) -> fidl::Result<()> {
576            encoder.debug_check_bounds::<Self>(offset);
577            encoder.write_num(self.into_primitive(), offset);
578            Ok(())
579        }
580    }
581
582    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoordinateUnit {
583        #[inline(always)]
584        fn new_empty() -> Self {
585            Self::unknown()
586        }
587
588        #[inline]
589        unsafe fn decode(
590            &mut self,
591            decoder: &mut fidl::encoding::Decoder<'_, D>,
592            offset: usize,
593            _depth: fidl::encoding::Depth,
594        ) -> fidl::Result<()> {
595            decoder.debug_check_bounds::<Self>(offset);
596            let prim = decoder.read_num::<u32>(offset);
597
598            *self = Self::from_primitive_allow_unknown(prim);
599            Ok(())
600        }
601    }
602    unsafe impl fidl::encoding::TypeMarker for MouseButton {
603        type Owned = Self;
604
605        #[inline(always)]
606        fn inline_align(_context: fidl::encoding::Context) -> usize {
607            std::mem::align_of::<u32>()
608        }
609
610        #[inline(always)]
611        fn inline_size(_context: fidl::encoding::Context) -> usize {
612            std::mem::size_of::<u32>()
613        }
614
615        #[inline(always)]
616        fn encode_is_copy() -> bool {
617            false
618        }
619
620        #[inline(always)]
621        fn decode_is_copy() -> bool {
622            false
623        }
624    }
625
626    impl fidl::encoding::ValueTypeMarker for MouseButton {
627        type Borrowed<'a> = Self;
628        #[inline(always)]
629        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
630            *value
631        }
632    }
633
634    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MouseButton {
635        #[inline]
636        unsafe fn encode(
637            self,
638            encoder: &mut fidl::encoding::Encoder<'_, D>,
639            offset: usize,
640            _depth: fidl::encoding::Depth,
641        ) -> fidl::Result<()> {
642            encoder.debug_check_bounds::<Self>(offset);
643            encoder.write_num(self.into_primitive(), offset);
644            Ok(())
645        }
646    }
647
648    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseButton {
649        #[inline(always)]
650        fn new_empty() -> Self {
651            Self::unknown()
652        }
653
654        #[inline]
655        unsafe fn decode(
656            &mut self,
657            decoder: &mut fidl::encoding::Decoder<'_, D>,
658            offset: usize,
659            _depth: fidl::encoding::Depth,
660        ) -> fidl::Result<()> {
661            decoder.debug_check_bounds::<Self>(offset);
662            let prim = decoder.read_num::<u32>(offset);
663
664            *self = Self::from_primitive_allow_unknown(prim);
665            Ok(())
666        }
667    }
668    unsafe impl fidl::encoding::TypeMarker for MouseEventPhase {
669        type Owned = Self;
670
671        #[inline(always)]
672        fn inline_align(_context: fidl::encoding::Context) -> usize {
673            std::mem::align_of::<u32>()
674        }
675
676        #[inline(always)]
677        fn inline_size(_context: fidl::encoding::Context) -> usize {
678            std::mem::size_of::<u32>()
679        }
680
681        #[inline(always)]
682        fn encode_is_copy() -> bool {
683            false
684        }
685
686        #[inline(always)]
687        fn decode_is_copy() -> bool {
688            false
689        }
690    }
691
692    impl fidl::encoding::ValueTypeMarker for MouseEventPhase {
693        type Borrowed<'a> = Self;
694        #[inline(always)]
695        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
696            *value
697        }
698    }
699
700    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
701        for MouseEventPhase
702    {
703        #[inline]
704        unsafe fn encode(
705            self,
706            encoder: &mut fidl::encoding::Encoder<'_, D>,
707            offset: usize,
708            _depth: fidl::encoding::Depth,
709        ) -> fidl::Result<()> {
710            encoder.debug_check_bounds::<Self>(offset);
711            encoder.write_num(self.into_primitive(), offset);
712            Ok(())
713        }
714    }
715
716    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseEventPhase {
717        #[inline(always)]
718        fn new_empty() -> Self {
719            Self::unknown()
720        }
721
722        #[inline]
723        unsafe fn decode(
724            &mut self,
725            decoder: &mut fidl::encoding::Decoder<'_, D>,
726            offset: usize,
727            _depth: fidl::encoding::Depth,
728        ) -> fidl::Result<()> {
729            decoder.debug_check_bounds::<Self>(offset);
730            let prim = decoder.read_num::<u32>(offset);
731
732            *self = Self::from_primitive_allow_unknown(prim);
733            Ok(())
734        }
735    }
736    unsafe impl fidl::encoding::TypeMarker for TestAppStatus {
737        type Owned = Self;
738
739        #[inline(always)]
740        fn inline_align(_context: fidl::encoding::Context) -> usize {
741            std::mem::align_of::<u16>()
742        }
743
744        #[inline(always)]
745        fn inline_size(_context: fidl::encoding::Context) -> usize {
746            std::mem::size_of::<u16>()
747        }
748
749        #[inline(always)]
750        fn encode_is_copy() -> bool {
751            false
752        }
753
754        #[inline(always)]
755        fn decode_is_copy() -> bool {
756            false
757        }
758    }
759
760    impl fidl::encoding::ValueTypeMarker for TestAppStatus {
761        type Borrowed<'a> = Self;
762        #[inline(always)]
763        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
764            *value
765        }
766    }
767
768    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TestAppStatus {
769        #[inline]
770        unsafe fn encode(
771            self,
772            encoder: &mut fidl::encoding::Encoder<'_, D>,
773            offset: usize,
774            _depth: fidl::encoding::Depth,
775        ) -> fidl::Result<()> {
776            encoder.debug_check_bounds::<Self>(offset);
777            encoder.write_num(self.into_primitive(), offset);
778            Ok(())
779        }
780    }
781
782    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestAppStatus {
783        #[inline(always)]
784        fn new_empty() -> Self {
785            Self::unknown()
786        }
787
788        #[inline]
789        unsafe fn decode(
790            &mut self,
791            decoder: &mut fidl::encoding::Decoder<'_, D>,
792            offset: usize,
793            _depth: fidl::encoding::Depth,
794        ) -> fidl::Result<()> {
795            decoder.debug_check_bounds::<Self>(offset);
796            let prim = decoder.read_num::<u16>(offset);
797
798            *self = Self::from_primitive_allow_unknown(prim);
799            Ok(())
800        }
801    }
802
803    impl fidl::encoding::ValueTypeMarker for TestAppStatusListenerReportStatusRequest {
804        type Borrowed<'a> = &'a Self;
805        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
806            value
807        }
808    }
809
810    unsafe impl fidl::encoding::TypeMarker for TestAppStatusListenerReportStatusRequest {
811        type Owned = Self;
812
813        #[inline(always)]
814        fn inline_align(_context: fidl::encoding::Context) -> usize {
815            2
816        }
817
818        #[inline(always)]
819        fn inline_size(_context: fidl::encoding::Context) -> usize {
820            2
821        }
822    }
823
824    unsafe impl<D: fidl::encoding::ResourceDialect>
825        fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D>
826        for &TestAppStatusListenerReportStatusRequest
827    {
828        #[inline]
829        unsafe fn encode(
830            self,
831            encoder: &mut fidl::encoding::Encoder<'_, D>,
832            offset: usize,
833            _depth: fidl::encoding::Depth,
834        ) -> fidl::Result<()> {
835            encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
836            // Delegate to tuple encoding.
837            fidl::encoding::Encode::<TestAppStatusListenerReportStatusRequest, D>::encode(
838                (<TestAppStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
839                encoder,
840                offset,
841                _depth,
842            )
843        }
844    }
845    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestAppStatus, D>>
846        fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D> for (T0,)
847    {
848        #[inline]
849        unsafe fn encode(
850            self,
851            encoder: &mut fidl::encoding::Encoder<'_, D>,
852            offset: usize,
853            depth: fidl::encoding::Depth,
854        ) -> fidl::Result<()> {
855            encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
856            // Zero out padding regions. There's no need to apply masks
857            // because the unmasked parts will be overwritten by fields.
858            // Write the fields.
859            self.0.encode(encoder, offset + 0, depth)?;
860            Ok(())
861        }
862    }
863
864    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
865        for TestAppStatusListenerReportStatusRequest
866    {
867        #[inline(always)]
868        fn new_empty() -> Self {
869            Self { status: fidl::new_empty!(TestAppStatus, D) }
870        }
871
872        #[inline]
873        unsafe fn decode(
874            &mut self,
875            decoder: &mut fidl::encoding::Decoder<'_, D>,
876            offset: usize,
877            _depth: fidl::encoding::Depth,
878        ) -> fidl::Result<()> {
879            decoder.debug_check_bounds::<Self>(offset);
880            // Verify that padding bytes are zero.
881            fidl::decode!(TestAppStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
882            Ok(())
883        }
884    }
885
886    impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTouchEventRequest {
887        type Borrowed<'a> = &'a Self;
888        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
889            value
890        }
891    }
892
893    unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTouchEventRequest {
894        type Owned = Self;
895
896        #[inline(always)]
897        fn inline_align(_context: fidl::encoding::Context) -> usize {
898            8
899        }
900
901        #[inline(always)]
902        fn inline_size(_context: fidl::encoding::Context) -> usize {
903            16
904        }
905    }
906
907    unsafe impl<D: fidl::encoding::ResourceDialect>
908        fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D>
909        for &TouchScreenSimulateTouchEventRequest
910    {
911        #[inline]
912        unsafe fn encode(
913            self,
914            encoder: &mut fidl::encoding::Encoder<'_, D>,
915            offset: usize,
916            _depth: fidl::encoding::Depth,
917        ) -> fidl::Result<()> {
918            encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
919            // Delegate to tuple encoding.
920            fidl::encoding::Encode::<TouchScreenSimulateTouchEventRequest, D>::encode(
921                (
922                    <fidl_fuchsia_input_report::TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),
923                ),
924                encoder, offset, _depth
925            )
926        }
927    }
928    unsafe impl<
929            D: fidl::encoding::ResourceDialect,
930            T0: fidl::encoding::Encode<fidl_fuchsia_input_report::TouchInputReport, D>,
931        > fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D> for (T0,)
932    {
933        #[inline]
934        unsafe fn encode(
935            self,
936            encoder: &mut fidl::encoding::Encoder<'_, D>,
937            offset: usize,
938            depth: fidl::encoding::Depth,
939        ) -> fidl::Result<()> {
940            encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
941            // Zero out padding regions. There's no need to apply masks
942            // because the unmasked parts will be overwritten by fields.
943            // Write the fields.
944            self.0.encode(encoder, offset + 0, depth)?;
945            Ok(())
946        }
947    }
948
949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
950        for TouchScreenSimulateTouchEventRequest
951    {
952        #[inline(always)]
953        fn new_empty() -> Self {
954            Self { report: fidl::new_empty!(fidl_fuchsia_input_report::TouchInputReport, D) }
955        }
956
957        #[inline]
958        unsafe fn decode(
959            &mut self,
960            decoder: &mut fidl::encoding::Decoder<'_, D>,
961            offset: usize,
962            _depth: fidl::encoding::Depth,
963        ) -> fidl::Result<()> {
964            decoder.debug_check_bounds::<Self>(offset);
965            // Verify that padding bytes are zero.
966            fidl::decode!(
967                fidl_fuchsia_input_report::TouchInputReport,
968                D,
969                &mut self.report,
970                decoder,
971                offset + 0,
972                _depth
973            )?;
974            Ok(())
975        }
976    }
977
978    impl KeyboardInputListenerReportTextInputRequest {
979        #[inline(always)]
980        fn max_ordinal_present(&self) -> u64 {
981            if let Some(_) = self.device_id {
982                return 3;
983            }
984            if let Some(_) = self.non_printable {
985                return 2;
986            }
987            if let Some(_) = self.text {
988                return 1;
989            }
990            0
991        }
992    }
993
994    impl fidl::encoding::ValueTypeMarker for KeyboardInputListenerReportTextInputRequest {
995        type Borrowed<'a> = &'a Self;
996        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
997            value
998        }
999    }
1000
1001    unsafe impl fidl::encoding::TypeMarker for KeyboardInputListenerReportTextInputRequest {
1002        type Owned = Self;
1003
1004        #[inline(always)]
1005        fn inline_align(_context: fidl::encoding::Context) -> usize {
1006            8
1007        }
1008
1009        #[inline(always)]
1010        fn inline_size(_context: fidl::encoding::Context) -> usize {
1011            16
1012        }
1013    }
1014
1015    unsafe impl<D: fidl::encoding::ResourceDialect>
1016        fidl::encoding::Encode<KeyboardInputListenerReportTextInputRequest, D>
1017        for &KeyboardInputListenerReportTextInputRequest
1018    {
1019        unsafe fn encode(
1020            self,
1021            encoder: &mut fidl::encoding::Encoder<'_, D>,
1022            offset: usize,
1023            mut depth: fidl::encoding::Depth,
1024        ) -> fidl::Result<()> {
1025            encoder.debug_check_bounds::<KeyboardInputListenerReportTextInputRequest>(offset);
1026            // Vector header
1027            let max_ordinal: u64 = self.max_ordinal_present();
1028            encoder.write_num(max_ordinal, offset);
1029            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1030            // Calling encoder.out_of_line_offset(0) is not allowed.
1031            if max_ordinal == 0 {
1032                return Ok(());
1033            }
1034            depth.increment()?;
1035            let envelope_size = 8;
1036            let bytes_len = max_ordinal as usize * envelope_size;
1037            #[allow(unused_variables)]
1038            let offset = encoder.out_of_line_offset(bytes_len);
1039            let mut _prev_end_offset: usize = 0;
1040            if 1 > max_ordinal {
1041                return Ok(());
1042            }
1043
1044            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1045            // are envelope_size bytes.
1046            let cur_offset: usize = (1 - 1) * envelope_size;
1047
1048            // Zero reserved fields.
1049            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1050
1051            // Safety:
1052            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1053            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1054            //   envelope_size bytes, there is always sufficient room.
1055            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1056            self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1057            encoder, offset + cur_offset, depth
1058        )?;
1059
1060            _prev_end_offset = cur_offset + envelope_size;
1061            if 2 > max_ordinal {
1062                return Ok(());
1063            }
1064
1065            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1066            // are envelope_size bytes.
1067            let cur_offset: usize = (2 - 1) * envelope_size;
1068
1069            // Zero reserved fields.
1070            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1071
1072            // Safety:
1073            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1074            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1075            //   envelope_size bytes, there is always sufficient room.
1076            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_input3::NonPrintableKey, D>(
1077            self.non_printable.as_ref().map(<fidl_fuchsia_ui_input3::NonPrintableKey as fidl::encoding::ValueTypeMarker>::borrow),
1078            encoder, offset + cur_offset, depth
1079        )?;
1080
1081            _prev_end_offset = cur_offset + envelope_size;
1082            if 3 > max_ordinal {
1083                return Ok(());
1084            }
1085
1086            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1087            // are envelope_size bytes.
1088            let cur_offset: usize = (3 - 1) * envelope_size;
1089
1090            // Zero reserved fields.
1091            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1092
1093            // Safety:
1094            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1095            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1096            //   envelope_size bytes, there is always sufficient room.
1097            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1098                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1099                encoder,
1100                offset + cur_offset,
1101                depth,
1102            )?;
1103
1104            _prev_end_offset = cur_offset + envelope_size;
1105
1106            Ok(())
1107        }
1108    }
1109
1110    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1111        for KeyboardInputListenerReportTextInputRequest
1112    {
1113        #[inline(always)]
1114        fn new_empty() -> Self {
1115            Self::default()
1116        }
1117
1118        unsafe fn decode(
1119            &mut self,
1120            decoder: &mut fidl::encoding::Decoder<'_, D>,
1121            offset: usize,
1122            mut depth: fidl::encoding::Depth,
1123        ) -> fidl::Result<()> {
1124            decoder.debug_check_bounds::<Self>(offset);
1125            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1126                None => return Err(fidl::Error::NotNullable),
1127                Some(len) => len,
1128            };
1129            // Calling decoder.out_of_line_offset(0) is not allowed.
1130            if len == 0 {
1131                return Ok(());
1132            };
1133            depth.increment()?;
1134            let envelope_size = 8;
1135            let bytes_len = len * envelope_size;
1136            let offset = decoder.out_of_line_offset(bytes_len)?;
1137            // Decode the envelope for each type.
1138            let mut _next_ordinal_to_read = 0;
1139            let mut next_offset = offset;
1140            let end_offset = offset + bytes_len;
1141            _next_ordinal_to_read += 1;
1142            if next_offset >= end_offset {
1143                return Ok(());
1144            }
1145
1146            // Decode unknown envelopes for gaps in ordinals.
1147            while _next_ordinal_to_read < 1 {
1148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1149                _next_ordinal_to_read += 1;
1150                next_offset += envelope_size;
1151            }
1152
1153            let next_out_of_line = decoder.next_out_of_line();
1154            let handles_before = decoder.remaining_handles();
1155            if let Some((inlined, num_bytes, num_handles)) =
1156                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1157            {
1158                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1159                if inlined != (member_inline_size <= 4) {
1160                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1161                }
1162                let inner_offset;
1163                let mut inner_depth = depth.clone();
1164                if inlined {
1165                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1166                    inner_offset = next_offset;
1167                } else {
1168                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1169                    inner_depth.increment()?;
1170                }
1171                let val_ref = self.text.get_or_insert_with(|| {
1172                    fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1173                });
1174                fidl::decode!(
1175                    fidl::encoding::BoundedString<1024>,
1176                    D,
1177                    val_ref,
1178                    decoder,
1179                    inner_offset,
1180                    inner_depth
1181                )?;
1182                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1183                {
1184                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1185                }
1186                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1187                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1188                }
1189            }
1190
1191            next_offset += envelope_size;
1192            _next_ordinal_to_read += 1;
1193            if next_offset >= end_offset {
1194                return Ok(());
1195            }
1196
1197            // Decode unknown envelopes for gaps in ordinals.
1198            while _next_ordinal_to_read < 2 {
1199                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1200                _next_ordinal_to_read += 1;
1201                next_offset += envelope_size;
1202            }
1203
1204            let next_out_of_line = decoder.next_out_of_line();
1205            let handles_before = decoder.remaining_handles();
1206            if let Some((inlined, num_bytes, num_handles)) =
1207                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1208            {
1209                let member_inline_size = <fidl_fuchsia_ui_input3::NonPrintableKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1210                if inlined != (member_inline_size <= 4) {
1211                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1212                }
1213                let inner_offset;
1214                let mut inner_depth = depth.clone();
1215                if inlined {
1216                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1217                    inner_offset = next_offset;
1218                } else {
1219                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1220                    inner_depth.increment()?;
1221                }
1222                let val_ref = self.non_printable.get_or_insert_with(|| {
1223                    fidl::new_empty!(fidl_fuchsia_ui_input3::NonPrintableKey, D)
1224                });
1225                fidl::decode!(
1226                    fidl_fuchsia_ui_input3::NonPrintableKey,
1227                    D,
1228                    val_ref,
1229                    decoder,
1230                    inner_offset,
1231                    inner_depth
1232                )?;
1233                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1234                {
1235                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1236                }
1237                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1238                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1239                }
1240            }
1241
1242            next_offset += envelope_size;
1243            _next_ordinal_to_read += 1;
1244            if next_offset >= end_offset {
1245                return Ok(());
1246            }
1247
1248            // Decode unknown envelopes for gaps in ordinals.
1249            while _next_ordinal_to_read < 3 {
1250                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1251                _next_ordinal_to_read += 1;
1252                next_offset += envelope_size;
1253            }
1254
1255            let next_out_of_line = decoder.next_out_of_line();
1256            let handles_before = decoder.remaining_handles();
1257            if let Some((inlined, num_bytes, num_handles)) =
1258                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1259            {
1260                let member_inline_size =
1261                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1262                if inlined != (member_inline_size <= 4) {
1263                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1264                }
1265                let inner_offset;
1266                let mut inner_depth = depth.clone();
1267                if inlined {
1268                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1269                    inner_offset = next_offset;
1270                } else {
1271                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1272                    inner_depth.increment()?;
1273                }
1274                let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1275                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1276                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1277                {
1278                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1279                }
1280                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1281                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1282                }
1283            }
1284
1285            next_offset += envelope_size;
1286
1287            // Decode the remaining unknown envelopes.
1288            while next_offset < end_offset {
1289                _next_ordinal_to_read += 1;
1290                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1291                next_offset += envelope_size;
1292            }
1293
1294            Ok(())
1295        }
1296    }
1297
1298    impl KeyboardSimulateKeyEventRequest {
1299        #[inline(always)]
1300        fn max_ordinal_present(&self) -> u64 {
1301            if let Some(_) = self.report {
1302                return 1;
1303            }
1304            0
1305        }
1306    }
1307
1308    impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyEventRequest {
1309        type Borrowed<'a> = &'a Self;
1310        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1311            value
1312        }
1313    }
1314
1315    unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyEventRequest {
1316        type Owned = Self;
1317
1318        #[inline(always)]
1319        fn inline_align(_context: fidl::encoding::Context) -> usize {
1320            8
1321        }
1322
1323        #[inline(always)]
1324        fn inline_size(_context: fidl::encoding::Context) -> usize {
1325            16
1326        }
1327    }
1328
1329    unsafe impl<D: fidl::encoding::ResourceDialect>
1330        fidl::encoding::Encode<KeyboardSimulateKeyEventRequest, D>
1331        for &KeyboardSimulateKeyEventRequest
1332    {
1333        unsafe fn encode(
1334            self,
1335            encoder: &mut fidl::encoding::Encoder<'_, D>,
1336            offset: usize,
1337            mut depth: fidl::encoding::Depth,
1338        ) -> fidl::Result<()> {
1339            encoder.debug_check_bounds::<KeyboardSimulateKeyEventRequest>(offset);
1340            // Vector header
1341            let max_ordinal: u64 = self.max_ordinal_present();
1342            encoder.write_num(max_ordinal, offset);
1343            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1344            // Calling encoder.out_of_line_offset(0) is not allowed.
1345            if max_ordinal == 0 {
1346                return Ok(());
1347            }
1348            depth.increment()?;
1349            let envelope_size = 8;
1350            let bytes_len = max_ordinal as usize * envelope_size;
1351            #[allow(unused_variables)]
1352            let offset = encoder.out_of_line_offset(bytes_len);
1353            let mut _prev_end_offset: usize = 0;
1354            if 1 > max_ordinal {
1355                return Ok(());
1356            }
1357
1358            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1359            // are envelope_size bytes.
1360            let cur_offset: usize = (1 - 1) * envelope_size;
1361
1362            // Zero reserved fields.
1363            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1364
1365            // Safety:
1366            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1367            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1368            //   envelope_size bytes, there is always sufficient room.
1369            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report::KeyboardInputReport, D>(
1370            self.report.as_ref().map(<fidl_fuchsia_input_report::KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
1371            encoder, offset + cur_offset, depth
1372        )?;
1373
1374            _prev_end_offset = cur_offset + envelope_size;
1375
1376            Ok(())
1377        }
1378    }
1379
1380    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1381        for KeyboardSimulateKeyEventRequest
1382    {
1383        #[inline(always)]
1384        fn new_empty() -> Self {
1385            Self::default()
1386        }
1387
1388        unsafe fn decode(
1389            &mut self,
1390            decoder: &mut fidl::encoding::Decoder<'_, D>,
1391            offset: usize,
1392            mut depth: fidl::encoding::Depth,
1393        ) -> fidl::Result<()> {
1394            decoder.debug_check_bounds::<Self>(offset);
1395            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1396                None => return Err(fidl::Error::NotNullable),
1397                Some(len) => len,
1398            };
1399            // Calling decoder.out_of_line_offset(0) is not allowed.
1400            if len == 0 {
1401                return Ok(());
1402            };
1403            depth.increment()?;
1404            let envelope_size = 8;
1405            let bytes_len = len * envelope_size;
1406            let offset = decoder.out_of_line_offset(bytes_len)?;
1407            // Decode the envelope for each type.
1408            let mut _next_ordinal_to_read = 0;
1409            let mut next_offset = offset;
1410            let end_offset = offset + bytes_len;
1411            _next_ordinal_to_read += 1;
1412            if next_offset >= end_offset {
1413                return Ok(());
1414            }
1415
1416            // Decode unknown envelopes for gaps in ordinals.
1417            while _next_ordinal_to_read < 1 {
1418                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1419                _next_ordinal_to_read += 1;
1420                next_offset += envelope_size;
1421            }
1422
1423            let next_out_of_line = decoder.next_out_of_line();
1424            let handles_before = decoder.remaining_handles();
1425            if let Some((inlined, num_bytes, num_handles)) =
1426                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1427            {
1428                let member_inline_size = <fidl_fuchsia_input_report::KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1429                if inlined != (member_inline_size <= 4) {
1430                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1431                }
1432                let inner_offset;
1433                let mut inner_depth = depth.clone();
1434                if inlined {
1435                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1436                    inner_offset = next_offset;
1437                } else {
1438                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1439                    inner_depth.increment()?;
1440                }
1441                let val_ref = self.report.get_or_insert_with(|| {
1442                    fidl::new_empty!(fidl_fuchsia_input_report::KeyboardInputReport, D)
1443                });
1444                fidl::decode!(
1445                    fidl_fuchsia_input_report::KeyboardInputReport,
1446                    D,
1447                    val_ref,
1448                    decoder,
1449                    inner_offset,
1450                    inner_depth
1451                )?;
1452                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1453                {
1454                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1455                }
1456                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1457                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1458                }
1459            }
1460
1461            next_offset += envelope_size;
1462
1463            // Decode the remaining unknown envelopes.
1464            while next_offset < end_offset {
1465                _next_ordinal_to_read += 1;
1466                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1467                next_offset += envelope_size;
1468            }
1469
1470            Ok(())
1471        }
1472    }
1473
1474    impl KeyboardSimulateKeyPressRequest {
1475        #[inline(always)]
1476        fn max_ordinal_present(&self) -> u64 {
1477            if let Some(_) = self.key_code {
1478                return 1;
1479            }
1480            0
1481        }
1482    }
1483
1484    impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyPressRequest {
1485        type Borrowed<'a> = &'a Self;
1486        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1487            value
1488        }
1489    }
1490
1491    unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyPressRequest {
1492        type Owned = Self;
1493
1494        #[inline(always)]
1495        fn inline_align(_context: fidl::encoding::Context) -> usize {
1496            8
1497        }
1498
1499        #[inline(always)]
1500        fn inline_size(_context: fidl::encoding::Context) -> usize {
1501            16
1502        }
1503    }
1504
1505    unsafe impl<D: fidl::encoding::ResourceDialect>
1506        fidl::encoding::Encode<KeyboardSimulateKeyPressRequest, D>
1507        for &KeyboardSimulateKeyPressRequest
1508    {
1509        unsafe fn encode(
1510            self,
1511            encoder: &mut fidl::encoding::Encoder<'_, D>,
1512            offset: usize,
1513            mut depth: fidl::encoding::Depth,
1514        ) -> fidl::Result<()> {
1515            encoder.debug_check_bounds::<KeyboardSimulateKeyPressRequest>(offset);
1516            // Vector header
1517            let max_ordinal: u64 = self.max_ordinal_present();
1518            encoder.write_num(max_ordinal, offset);
1519            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1520            // Calling encoder.out_of_line_offset(0) is not allowed.
1521            if max_ordinal == 0 {
1522                return Ok(());
1523            }
1524            depth.increment()?;
1525            let envelope_size = 8;
1526            let bytes_len = max_ordinal as usize * envelope_size;
1527            #[allow(unused_variables)]
1528            let offset = encoder.out_of_line_offset(bytes_len);
1529            let mut _prev_end_offset: usize = 0;
1530            if 1 > max_ordinal {
1531                return Ok(());
1532            }
1533
1534            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1535            // are envelope_size bytes.
1536            let cur_offset: usize = (1 - 1) * envelope_size;
1537
1538            // Zero reserved fields.
1539            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1540
1541            // Safety:
1542            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1543            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1544            //   envelope_size bytes, there is always sufficient room.
1545            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input::Key, D>(
1546                self.key_code
1547                    .as_ref()
1548                    .map(<fidl_fuchsia_input::Key as fidl::encoding::ValueTypeMarker>::borrow),
1549                encoder,
1550                offset + cur_offset,
1551                depth,
1552            )?;
1553
1554            _prev_end_offset = cur_offset + envelope_size;
1555
1556            Ok(())
1557        }
1558    }
1559
1560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1561        for KeyboardSimulateKeyPressRequest
1562    {
1563        #[inline(always)]
1564        fn new_empty() -> Self {
1565            Self::default()
1566        }
1567
1568        unsafe fn decode(
1569            &mut self,
1570            decoder: &mut fidl::encoding::Decoder<'_, D>,
1571            offset: usize,
1572            mut depth: fidl::encoding::Depth,
1573        ) -> fidl::Result<()> {
1574            decoder.debug_check_bounds::<Self>(offset);
1575            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1576                None => return Err(fidl::Error::NotNullable),
1577                Some(len) => len,
1578            };
1579            // Calling decoder.out_of_line_offset(0) is not allowed.
1580            if len == 0 {
1581                return Ok(());
1582            };
1583            depth.increment()?;
1584            let envelope_size = 8;
1585            let bytes_len = len * envelope_size;
1586            let offset = decoder.out_of_line_offset(bytes_len)?;
1587            // Decode the envelope for each type.
1588            let mut _next_ordinal_to_read = 0;
1589            let mut next_offset = offset;
1590            let end_offset = offset + bytes_len;
1591            _next_ordinal_to_read += 1;
1592            if next_offset >= end_offset {
1593                return Ok(());
1594            }
1595
1596            // Decode unknown envelopes for gaps in ordinals.
1597            while _next_ordinal_to_read < 1 {
1598                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1599                _next_ordinal_to_read += 1;
1600                next_offset += envelope_size;
1601            }
1602
1603            let next_out_of_line = decoder.next_out_of_line();
1604            let handles_before = decoder.remaining_handles();
1605            if let Some((inlined, num_bytes, num_handles)) =
1606                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1607            {
1608                let member_inline_size =
1609                    <fidl_fuchsia_input::Key as fidl::encoding::TypeMarker>::inline_size(
1610                        decoder.context,
1611                    );
1612                if inlined != (member_inline_size <= 4) {
1613                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1614                }
1615                let inner_offset;
1616                let mut inner_depth = depth.clone();
1617                if inlined {
1618                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1619                    inner_offset = next_offset;
1620                } else {
1621                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1622                    inner_depth.increment()?;
1623                }
1624                let val_ref = self
1625                    .key_code
1626                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input::Key, D));
1627                fidl::decode!(
1628                    fidl_fuchsia_input::Key,
1629                    D,
1630                    val_ref,
1631                    decoder,
1632                    inner_offset,
1633                    inner_depth
1634                )?;
1635                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1636                {
1637                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1638                }
1639                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1640                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1641                }
1642            }
1643
1644            next_offset += envelope_size;
1645
1646            // Decode the remaining unknown envelopes.
1647            while next_offset < end_offset {
1648                _next_ordinal_to_read += 1;
1649                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1650                next_offset += envelope_size;
1651            }
1652
1653            Ok(())
1654        }
1655    }
1656
1657    impl KeyboardSimulateUsAsciiTextEntryRequest {
1658        #[inline(always)]
1659        fn max_ordinal_present(&self) -> u64 {
1660            if let Some(_) = self.text {
1661                return 1;
1662            }
1663            0
1664        }
1665    }
1666
1667    impl fidl::encoding::ValueTypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1668        type Borrowed<'a> = &'a Self;
1669        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1670            value
1671        }
1672    }
1673
1674    unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1675        type Owned = Self;
1676
1677        #[inline(always)]
1678        fn inline_align(_context: fidl::encoding::Context) -> usize {
1679            8
1680        }
1681
1682        #[inline(always)]
1683        fn inline_size(_context: fidl::encoding::Context) -> usize {
1684            16
1685        }
1686    }
1687
1688    unsafe impl<D: fidl::encoding::ResourceDialect>
1689        fidl::encoding::Encode<KeyboardSimulateUsAsciiTextEntryRequest, D>
1690        for &KeyboardSimulateUsAsciiTextEntryRequest
1691    {
1692        unsafe fn encode(
1693            self,
1694            encoder: &mut fidl::encoding::Encoder<'_, D>,
1695            offset: usize,
1696            mut depth: fidl::encoding::Depth,
1697        ) -> fidl::Result<()> {
1698            encoder.debug_check_bounds::<KeyboardSimulateUsAsciiTextEntryRequest>(offset);
1699            // Vector header
1700            let max_ordinal: u64 = self.max_ordinal_present();
1701            encoder.write_num(max_ordinal, offset);
1702            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1703            // Calling encoder.out_of_line_offset(0) is not allowed.
1704            if max_ordinal == 0 {
1705                return Ok(());
1706            }
1707            depth.increment()?;
1708            let envelope_size = 8;
1709            let bytes_len = max_ordinal as usize * envelope_size;
1710            #[allow(unused_variables)]
1711            let offset = encoder.out_of_line_offset(bytes_len);
1712            let mut _prev_end_offset: usize = 0;
1713            if 1 > max_ordinal {
1714                return Ok(());
1715            }
1716
1717            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1718            // are envelope_size bytes.
1719            let cur_offset: usize = (1 - 1) * envelope_size;
1720
1721            // Zero reserved fields.
1722            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1723
1724            // Safety:
1725            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1726            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1727            //   envelope_size bytes, there is always sufficient room.
1728            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1729            self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1730            encoder, offset + cur_offset, depth
1731        )?;
1732
1733            _prev_end_offset = cur_offset + envelope_size;
1734
1735            Ok(())
1736        }
1737    }
1738
1739    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1740        for KeyboardSimulateUsAsciiTextEntryRequest
1741    {
1742        #[inline(always)]
1743        fn new_empty() -> Self {
1744            Self::default()
1745        }
1746
1747        unsafe fn decode(
1748            &mut self,
1749            decoder: &mut fidl::encoding::Decoder<'_, D>,
1750            offset: usize,
1751            mut depth: fidl::encoding::Depth,
1752        ) -> fidl::Result<()> {
1753            decoder.debug_check_bounds::<Self>(offset);
1754            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1755                None => return Err(fidl::Error::NotNullable),
1756                Some(len) => len,
1757            };
1758            // Calling decoder.out_of_line_offset(0) is not allowed.
1759            if len == 0 {
1760                return Ok(());
1761            };
1762            depth.increment()?;
1763            let envelope_size = 8;
1764            let bytes_len = len * envelope_size;
1765            let offset = decoder.out_of_line_offset(bytes_len)?;
1766            // Decode the envelope for each type.
1767            let mut _next_ordinal_to_read = 0;
1768            let mut next_offset = offset;
1769            let end_offset = offset + bytes_len;
1770            _next_ordinal_to_read += 1;
1771            if next_offset >= end_offset {
1772                return Ok(());
1773            }
1774
1775            // Decode unknown envelopes for gaps in ordinals.
1776            while _next_ordinal_to_read < 1 {
1777                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1778                _next_ordinal_to_read += 1;
1779                next_offset += envelope_size;
1780            }
1781
1782            let next_out_of_line = decoder.next_out_of_line();
1783            let handles_before = decoder.remaining_handles();
1784            if let Some((inlined, num_bytes, num_handles)) =
1785                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1786            {
1787                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1788                if inlined != (member_inline_size <= 4) {
1789                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1790                }
1791                let inner_offset;
1792                let mut inner_depth = depth.clone();
1793                if inlined {
1794                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1795                    inner_offset = next_offset;
1796                } else {
1797                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1798                    inner_depth.increment()?;
1799                }
1800                let val_ref = self.text.get_or_insert_with(|| {
1801                    fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1802                });
1803                fidl::decode!(
1804                    fidl::encoding::BoundedString<1024>,
1805                    D,
1806                    val_ref,
1807                    decoder,
1808                    inner_offset,
1809                    inner_depth
1810                )?;
1811                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1812                {
1813                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1814                }
1815                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1816                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1817                }
1818            }
1819
1820            next_offset += envelope_size;
1821
1822            // Decode the remaining unknown envelopes.
1823            while next_offset < end_offset {
1824                _next_ordinal_to_read += 1;
1825                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1826                next_offset += envelope_size;
1827            }
1828
1829            Ok(())
1830        }
1831    }
1832
1833    impl MediaButtonsDeviceSendButtonsStateRequest {
1834        #[inline(always)]
1835        fn max_ordinal_present(&self) -> u64 {
1836            if let Some(_) = self.buttons {
1837                return 1;
1838            }
1839            0
1840        }
1841    }
1842
1843    impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
1844        type Borrowed<'a> = &'a Self;
1845        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1846            value
1847        }
1848    }
1849
1850    unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
1851        type Owned = Self;
1852
1853        #[inline(always)]
1854        fn inline_align(_context: fidl::encoding::Context) -> usize {
1855            8
1856        }
1857
1858        #[inline(always)]
1859        fn inline_size(_context: fidl::encoding::Context) -> usize {
1860            16
1861        }
1862    }
1863
1864    unsafe impl<D: fidl::encoding::ResourceDialect>
1865        fidl::encoding::Encode<MediaButtonsDeviceSendButtonsStateRequest, D>
1866        for &MediaButtonsDeviceSendButtonsStateRequest
1867    {
1868        unsafe fn encode(
1869            self,
1870            encoder: &mut fidl::encoding::Encoder<'_, D>,
1871            offset: usize,
1872            mut depth: fidl::encoding::Depth,
1873        ) -> fidl::Result<()> {
1874            encoder.debug_check_bounds::<MediaButtonsDeviceSendButtonsStateRequest>(offset);
1875            // Vector header
1876            let max_ordinal: u64 = self.max_ordinal_present();
1877            encoder.write_num(max_ordinal, offset);
1878            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1879            // Calling encoder.out_of_line_offset(0) is not allowed.
1880            if max_ordinal == 0 {
1881                return Ok(());
1882            }
1883            depth.increment()?;
1884            let envelope_size = 8;
1885            let bytes_len = max_ordinal as usize * envelope_size;
1886            #[allow(unused_variables)]
1887            let offset = encoder.out_of_line_offset(bytes_len);
1888            let mut _prev_end_offset: usize = 0;
1889            if 1 > max_ordinal {
1890                return Ok(());
1891            }
1892
1893            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1894            // are envelope_size bytes.
1895            let cur_offset: usize = (1 - 1) * envelope_size;
1896
1897            // Zero reserved fields.
1898            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1899
1900            // Safety:
1901            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1902            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1903            //   envelope_size bytes, there is always sufficient room.
1904            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input_report::ConsumerControlButton, 255>, D>(
1905            self.buttons.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input_report::ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
1906            encoder, offset + cur_offset, depth
1907        )?;
1908
1909            _prev_end_offset = cur_offset + envelope_size;
1910
1911            Ok(())
1912        }
1913    }
1914
1915    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1916        for MediaButtonsDeviceSendButtonsStateRequest
1917    {
1918        #[inline(always)]
1919        fn new_empty() -> Self {
1920            Self::default()
1921        }
1922
1923        unsafe fn decode(
1924            &mut self,
1925            decoder: &mut fidl::encoding::Decoder<'_, D>,
1926            offset: usize,
1927            mut depth: fidl::encoding::Depth,
1928        ) -> fidl::Result<()> {
1929            decoder.debug_check_bounds::<Self>(offset);
1930            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1931                None => return Err(fidl::Error::NotNullable),
1932                Some(len) => len,
1933            };
1934            // Calling decoder.out_of_line_offset(0) is not allowed.
1935            if len == 0 {
1936                return Ok(());
1937            };
1938            depth.increment()?;
1939            let envelope_size = 8;
1940            let bytes_len = len * envelope_size;
1941            let offset = decoder.out_of_line_offset(bytes_len)?;
1942            // Decode the envelope for each type.
1943            let mut _next_ordinal_to_read = 0;
1944            let mut next_offset = offset;
1945            let end_offset = offset + bytes_len;
1946            _next_ordinal_to_read += 1;
1947            if next_offset >= end_offset {
1948                return Ok(());
1949            }
1950
1951            // Decode unknown envelopes for gaps in ordinals.
1952            while _next_ordinal_to_read < 1 {
1953                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1954                _next_ordinal_to_read += 1;
1955                next_offset += envelope_size;
1956            }
1957
1958            let next_out_of_line = decoder.next_out_of_line();
1959            let handles_before = decoder.remaining_handles();
1960            if let Some((inlined, num_bytes, num_handles)) =
1961                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1962            {
1963                let member_inline_size = <fidl::encoding::Vector<
1964                    fidl_fuchsia_input_report::ConsumerControlButton,
1965                    255,
1966                > as fidl::encoding::TypeMarker>::inline_size(
1967                    decoder.context
1968                );
1969                if inlined != (member_inline_size <= 4) {
1970                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1971                }
1972                let inner_offset;
1973                let mut inner_depth = depth.clone();
1974                if inlined {
1975                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1976                    inner_offset = next_offset;
1977                } else {
1978                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1979                    inner_depth.increment()?;
1980                }
1981                let val_ref =
1982                self.buttons.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input_report::ConsumerControlButton, 255>, D));
1983                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input_report::ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
1984                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1985                {
1986                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1987                }
1988                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1989                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1990                }
1991            }
1992
1993            next_offset += envelope_size;
1994
1995            // Decode the remaining unknown envelopes.
1996            while next_offset < end_offset {
1997                _next_ordinal_to_read += 1;
1998                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1999                next_offset += envelope_size;
2000            }
2001
2002            Ok(())
2003        }
2004    }
2005
2006    impl MediaButtonsDeviceSimulateButtonPressRequest {
2007        #[inline(always)]
2008        fn max_ordinal_present(&self) -> u64 {
2009            if let Some(_) = self.button {
2010                return 1;
2011            }
2012            0
2013        }
2014    }
2015
2016    impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2017        type Borrowed<'a> = &'a Self;
2018        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2019            value
2020        }
2021    }
2022
2023    unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2024        type Owned = Self;
2025
2026        #[inline(always)]
2027        fn inline_align(_context: fidl::encoding::Context) -> usize {
2028            8
2029        }
2030
2031        #[inline(always)]
2032        fn inline_size(_context: fidl::encoding::Context) -> usize {
2033            16
2034        }
2035    }
2036
2037    unsafe impl<D: fidl::encoding::ResourceDialect>
2038        fidl::encoding::Encode<MediaButtonsDeviceSimulateButtonPressRequest, D>
2039        for &MediaButtonsDeviceSimulateButtonPressRequest
2040    {
2041        unsafe fn encode(
2042            self,
2043            encoder: &mut fidl::encoding::Encoder<'_, D>,
2044            offset: usize,
2045            mut depth: fidl::encoding::Depth,
2046        ) -> fidl::Result<()> {
2047            encoder.debug_check_bounds::<MediaButtonsDeviceSimulateButtonPressRequest>(offset);
2048            // Vector header
2049            let max_ordinal: u64 = self.max_ordinal_present();
2050            encoder.write_num(max_ordinal, offset);
2051            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2052            // Calling encoder.out_of_line_offset(0) is not allowed.
2053            if max_ordinal == 0 {
2054                return Ok(());
2055            }
2056            depth.increment()?;
2057            let envelope_size = 8;
2058            let bytes_len = max_ordinal as usize * envelope_size;
2059            #[allow(unused_variables)]
2060            let offset = encoder.out_of_line_offset(bytes_len);
2061            let mut _prev_end_offset: usize = 0;
2062            if 1 > max_ordinal {
2063                return Ok(());
2064            }
2065
2066            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2067            // are envelope_size bytes.
2068            let cur_offset: usize = (1 - 1) * envelope_size;
2069
2070            // Zero reserved fields.
2071            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2072
2073            // Safety:
2074            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2075            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2076            //   envelope_size bytes, there is always sufficient room.
2077            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report::ConsumerControlButton, D>(
2078            self.button.as_ref().map(<fidl_fuchsia_input_report::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2079            encoder, offset + cur_offset, depth
2080        )?;
2081
2082            _prev_end_offset = cur_offset + envelope_size;
2083
2084            Ok(())
2085        }
2086    }
2087
2088    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2089        for MediaButtonsDeviceSimulateButtonPressRequest
2090    {
2091        #[inline(always)]
2092        fn new_empty() -> Self {
2093            Self::default()
2094        }
2095
2096        unsafe fn decode(
2097            &mut self,
2098            decoder: &mut fidl::encoding::Decoder<'_, D>,
2099            offset: usize,
2100            mut depth: fidl::encoding::Depth,
2101        ) -> fidl::Result<()> {
2102            decoder.debug_check_bounds::<Self>(offset);
2103            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2104                None => return Err(fidl::Error::NotNullable),
2105                Some(len) => len,
2106            };
2107            // Calling decoder.out_of_line_offset(0) is not allowed.
2108            if len == 0 {
2109                return Ok(());
2110            };
2111            depth.increment()?;
2112            let envelope_size = 8;
2113            let bytes_len = len * envelope_size;
2114            let offset = decoder.out_of_line_offset(bytes_len)?;
2115            // Decode the envelope for each type.
2116            let mut _next_ordinal_to_read = 0;
2117            let mut next_offset = offset;
2118            let end_offset = offset + bytes_len;
2119            _next_ordinal_to_read += 1;
2120            if next_offset >= end_offset {
2121                return Ok(());
2122            }
2123
2124            // Decode unknown envelopes for gaps in ordinals.
2125            while _next_ordinal_to_read < 1 {
2126                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2127                _next_ordinal_to_read += 1;
2128                next_offset += envelope_size;
2129            }
2130
2131            let next_out_of_line = decoder.next_out_of_line();
2132            let handles_before = decoder.remaining_handles();
2133            if let Some((inlined, num_bytes, num_handles)) =
2134                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2135            {
2136                let member_inline_size = <fidl_fuchsia_input_report::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2137                if inlined != (member_inline_size <= 4) {
2138                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2139                }
2140                let inner_offset;
2141                let mut inner_depth = depth.clone();
2142                if inlined {
2143                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2144                    inner_offset = next_offset;
2145                } else {
2146                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2147                    inner_depth.increment()?;
2148                }
2149                let val_ref = self.button.get_or_insert_with(|| {
2150                    fidl::new_empty!(fidl_fuchsia_input_report::ConsumerControlButton, D)
2151                });
2152                fidl::decode!(
2153                    fidl_fuchsia_input_report::ConsumerControlButton,
2154                    D,
2155                    val_ref,
2156                    decoder,
2157                    inner_offset,
2158                    inner_depth
2159                )?;
2160                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2161                {
2162                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2163                }
2164                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2165                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2166                }
2167            }
2168
2169            next_offset += envelope_size;
2170
2171            // Decode the remaining unknown envelopes.
2172            while next_offset < end_offset {
2173                _next_ordinal_to_read += 1;
2174                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2175                next_offset += envelope_size;
2176            }
2177
2178            Ok(())
2179        }
2180    }
2181
2182    impl MouseInputListenerReportMouseInputRequest {
2183        #[inline(always)]
2184        fn max_ordinal_present(&self) -> u64 {
2185            if let Some(_) = self.device_id {
2186                return 10;
2187            }
2188            if let Some(_) = self.wheel_y_physical_pixel {
2189                return 9;
2190            }
2191            if let Some(_) = self.wheel_x_physical_pixel {
2192                return 8;
2193            }
2194            if let Some(_) = self.device_pixel_ratio {
2195                return 7;
2196            }
2197            if let Some(_) = self.phase {
2198                return 6;
2199            }
2200            if let Some(_) = self.buttons {
2201                return 5;
2202            }
2203            if let Some(_) = self.component_name {
2204                return 4;
2205            }
2206            if let Some(_) = self.time_received {
2207                return 3;
2208            }
2209            if let Some(_) = self.local_y {
2210                return 2;
2211            }
2212            if let Some(_) = self.local_x {
2213                return 1;
2214            }
2215            0
2216        }
2217    }
2218
2219    impl fidl::encoding::ValueTypeMarker for MouseInputListenerReportMouseInputRequest {
2220        type Borrowed<'a> = &'a Self;
2221        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2222            value
2223        }
2224    }
2225
2226    unsafe impl fidl::encoding::TypeMarker for MouseInputListenerReportMouseInputRequest {
2227        type Owned = Self;
2228
2229        #[inline(always)]
2230        fn inline_align(_context: fidl::encoding::Context) -> usize {
2231            8
2232        }
2233
2234        #[inline(always)]
2235        fn inline_size(_context: fidl::encoding::Context) -> usize {
2236            16
2237        }
2238    }
2239
2240    unsafe impl<D: fidl::encoding::ResourceDialect>
2241        fidl::encoding::Encode<MouseInputListenerReportMouseInputRequest, D>
2242        for &MouseInputListenerReportMouseInputRequest
2243    {
2244        unsafe fn encode(
2245            self,
2246            encoder: &mut fidl::encoding::Encoder<'_, D>,
2247            offset: usize,
2248            mut depth: fidl::encoding::Depth,
2249        ) -> fidl::Result<()> {
2250            encoder.debug_check_bounds::<MouseInputListenerReportMouseInputRequest>(offset);
2251            // Vector header
2252            let max_ordinal: u64 = self.max_ordinal_present();
2253            encoder.write_num(max_ordinal, offset);
2254            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2255            // Calling encoder.out_of_line_offset(0) is not allowed.
2256            if max_ordinal == 0 {
2257                return Ok(());
2258            }
2259            depth.increment()?;
2260            let envelope_size = 8;
2261            let bytes_len = max_ordinal as usize * envelope_size;
2262            #[allow(unused_variables)]
2263            let offset = encoder.out_of_line_offset(bytes_len);
2264            let mut _prev_end_offset: usize = 0;
2265            if 1 > max_ordinal {
2266                return Ok(());
2267            }
2268
2269            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2270            // are envelope_size bytes.
2271            let cur_offset: usize = (1 - 1) * envelope_size;
2272
2273            // Zero reserved fields.
2274            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2275
2276            // Safety:
2277            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2278            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2279            //   envelope_size bytes, there is always sufficient room.
2280            fidl::encoding::encode_in_envelope_optional::<f64, D>(
2281                self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2282                encoder,
2283                offset + cur_offset,
2284                depth,
2285            )?;
2286
2287            _prev_end_offset = cur_offset + envelope_size;
2288            if 2 > max_ordinal {
2289                return Ok(());
2290            }
2291
2292            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2293            // are envelope_size bytes.
2294            let cur_offset: usize = (2 - 1) * envelope_size;
2295
2296            // Zero reserved fields.
2297            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2298
2299            // Safety:
2300            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2301            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2302            //   envelope_size bytes, there is always sufficient room.
2303            fidl::encoding::encode_in_envelope_optional::<f64, D>(
2304                self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2305                encoder,
2306                offset + cur_offset,
2307                depth,
2308            )?;
2309
2310            _prev_end_offset = cur_offset + envelope_size;
2311            if 3 > max_ordinal {
2312                return Ok(());
2313            }
2314
2315            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2316            // are envelope_size bytes.
2317            let cur_offset: usize = (3 - 1) * envelope_size;
2318
2319            // Zero reserved fields.
2320            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2321
2322            // Safety:
2323            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2324            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2325            //   envelope_size bytes, there is always sufficient room.
2326            fidl::encoding::encode_in_envelope_optional::<i64, D>(
2327                self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2328                encoder,
2329                offset + cur_offset,
2330                depth,
2331            )?;
2332
2333            _prev_end_offset = cur_offset + envelope_size;
2334            if 4 > max_ordinal {
2335                return Ok(());
2336            }
2337
2338            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2339            // are envelope_size bytes.
2340            let cur_offset: usize = (4 - 1) * envelope_size;
2341
2342            // Zero reserved fields.
2343            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2344
2345            // Safety:
2346            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2347            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2348            //   envelope_size bytes, there is always sufficient room.
2349            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
2350            self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
2351            encoder, offset + cur_offset, depth
2352        )?;
2353
2354            _prev_end_offset = cur_offset + envelope_size;
2355            if 5 > max_ordinal {
2356                return Ok(());
2357            }
2358
2359            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2360            // are envelope_size bytes.
2361            let cur_offset: usize = (5 - 1) * envelope_size;
2362
2363            // Zero reserved fields.
2364            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2365
2366            // Safety:
2367            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2368            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2369            //   envelope_size bytes, there is always sufficient room.
2370            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
2371            self.buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
2372            encoder, offset + cur_offset, depth
2373        )?;
2374
2375            _prev_end_offset = cur_offset + envelope_size;
2376            if 6 > max_ordinal {
2377                return Ok(());
2378            }
2379
2380            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2381            // are envelope_size bytes.
2382            let cur_offset: usize = (6 - 1) * envelope_size;
2383
2384            // Zero reserved fields.
2385            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2386
2387            // Safety:
2388            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2389            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2390            //   envelope_size bytes, there is always sufficient room.
2391            fidl::encoding::encode_in_envelope_optional::<MouseEventPhase, D>(
2392                self.phase
2393                    .as_ref()
2394                    .map(<MouseEventPhase as fidl::encoding::ValueTypeMarker>::borrow),
2395                encoder,
2396                offset + cur_offset,
2397                depth,
2398            )?;
2399
2400            _prev_end_offset = cur_offset + envelope_size;
2401            if 7 > max_ordinal {
2402                return Ok(());
2403            }
2404
2405            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2406            // are envelope_size bytes.
2407            let cur_offset: usize = (7 - 1) * envelope_size;
2408
2409            // Zero reserved fields.
2410            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2411
2412            // Safety:
2413            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2414            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2415            //   envelope_size bytes, there is always sufficient room.
2416            fidl::encoding::encode_in_envelope_optional::<f64, D>(
2417                self.device_pixel_ratio
2418                    .as_ref()
2419                    .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2420                encoder,
2421                offset + cur_offset,
2422                depth,
2423            )?;
2424
2425            _prev_end_offset = cur_offset + envelope_size;
2426            if 8 > max_ordinal {
2427                return Ok(());
2428            }
2429
2430            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2431            // are envelope_size bytes.
2432            let cur_offset: usize = (8 - 1) * envelope_size;
2433
2434            // Zero reserved fields.
2435            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2436
2437            // Safety:
2438            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2439            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2440            //   envelope_size bytes, there is always sufficient room.
2441            fidl::encoding::encode_in_envelope_optional::<f64, D>(
2442                self.wheel_x_physical_pixel
2443                    .as_ref()
2444                    .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2445                encoder,
2446                offset + cur_offset,
2447                depth,
2448            )?;
2449
2450            _prev_end_offset = cur_offset + envelope_size;
2451            if 9 > max_ordinal {
2452                return Ok(());
2453            }
2454
2455            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2456            // are envelope_size bytes.
2457            let cur_offset: usize = (9 - 1) * envelope_size;
2458
2459            // Zero reserved fields.
2460            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2461
2462            // Safety:
2463            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2464            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2465            //   envelope_size bytes, there is always sufficient room.
2466            fidl::encoding::encode_in_envelope_optional::<f64, D>(
2467                self.wheel_y_physical_pixel
2468                    .as_ref()
2469                    .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2470                encoder,
2471                offset + cur_offset,
2472                depth,
2473            )?;
2474
2475            _prev_end_offset = cur_offset + envelope_size;
2476            if 10 > max_ordinal {
2477                return Ok(());
2478            }
2479
2480            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2481            // are envelope_size bytes.
2482            let cur_offset: usize = (10 - 1) * envelope_size;
2483
2484            // Zero reserved fields.
2485            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2486
2487            // Safety:
2488            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2489            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2490            //   envelope_size bytes, there is always sufficient room.
2491            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2492                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2493                encoder,
2494                offset + cur_offset,
2495                depth,
2496            )?;
2497
2498            _prev_end_offset = cur_offset + envelope_size;
2499
2500            Ok(())
2501        }
2502    }
2503
2504    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2505        for MouseInputListenerReportMouseInputRequest
2506    {
2507        #[inline(always)]
2508        fn new_empty() -> Self {
2509            Self::default()
2510        }
2511
2512        unsafe fn decode(
2513            &mut self,
2514            decoder: &mut fidl::encoding::Decoder<'_, D>,
2515            offset: usize,
2516            mut depth: fidl::encoding::Depth,
2517        ) -> fidl::Result<()> {
2518            decoder.debug_check_bounds::<Self>(offset);
2519            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2520                None => return Err(fidl::Error::NotNullable),
2521                Some(len) => len,
2522            };
2523            // Calling decoder.out_of_line_offset(0) is not allowed.
2524            if len == 0 {
2525                return Ok(());
2526            };
2527            depth.increment()?;
2528            let envelope_size = 8;
2529            let bytes_len = len * envelope_size;
2530            let offset = decoder.out_of_line_offset(bytes_len)?;
2531            // Decode the envelope for each type.
2532            let mut _next_ordinal_to_read = 0;
2533            let mut next_offset = offset;
2534            let end_offset = offset + bytes_len;
2535            _next_ordinal_to_read += 1;
2536            if next_offset >= end_offset {
2537                return Ok(());
2538            }
2539
2540            // Decode unknown envelopes for gaps in ordinals.
2541            while _next_ordinal_to_read < 1 {
2542                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2543                _next_ordinal_to_read += 1;
2544                next_offset += envelope_size;
2545            }
2546
2547            let next_out_of_line = decoder.next_out_of_line();
2548            let handles_before = decoder.remaining_handles();
2549            if let Some((inlined, num_bytes, num_handles)) =
2550                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2551            {
2552                let member_inline_size =
2553                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2554                if inlined != (member_inline_size <= 4) {
2555                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2556                }
2557                let inner_offset;
2558                let mut inner_depth = depth.clone();
2559                if inlined {
2560                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2561                    inner_offset = next_offset;
2562                } else {
2563                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2564                    inner_depth.increment()?;
2565                }
2566                let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
2567                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2568                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2569                {
2570                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2571                }
2572                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2573                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2574                }
2575            }
2576
2577            next_offset += envelope_size;
2578            _next_ordinal_to_read += 1;
2579            if next_offset >= end_offset {
2580                return Ok(());
2581            }
2582
2583            // Decode unknown envelopes for gaps in ordinals.
2584            while _next_ordinal_to_read < 2 {
2585                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2586                _next_ordinal_to_read += 1;
2587                next_offset += envelope_size;
2588            }
2589
2590            let next_out_of_line = decoder.next_out_of_line();
2591            let handles_before = decoder.remaining_handles();
2592            if let Some((inlined, num_bytes, num_handles)) =
2593                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2594            {
2595                let member_inline_size =
2596                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2597                if inlined != (member_inline_size <= 4) {
2598                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2599                }
2600                let inner_offset;
2601                let mut inner_depth = depth.clone();
2602                if inlined {
2603                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2604                    inner_offset = next_offset;
2605                } else {
2606                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2607                    inner_depth.increment()?;
2608                }
2609                let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
2610                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2611                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2612                {
2613                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2614                }
2615                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2616                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2617                }
2618            }
2619
2620            next_offset += envelope_size;
2621            _next_ordinal_to_read += 1;
2622            if next_offset >= end_offset {
2623                return Ok(());
2624            }
2625
2626            // Decode unknown envelopes for gaps in ordinals.
2627            while _next_ordinal_to_read < 3 {
2628                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2629                _next_ordinal_to_read += 1;
2630                next_offset += envelope_size;
2631            }
2632
2633            let next_out_of_line = decoder.next_out_of_line();
2634            let handles_before = decoder.remaining_handles();
2635            if let Some((inlined, num_bytes, num_handles)) =
2636                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2637            {
2638                let member_inline_size =
2639                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2640                if inlined != (member_inline_size <= 4) {
2641                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2642                }
2643                let inner_offset;
2644                let mut inner_depth = depth.clone();
2645                if inlined {
2646                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2647                    inner_offset = next_offset;
2648                } else {
2649                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2650                    inner_depth.increment()?;
2651                }
2652                let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
2653                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2654                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2655                {
2656                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2657                }
2658                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2659                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2660                }
2661            }
2662
2663            next_offset += envelope_size;
2664            _next_ordinal_to_read += 1;
2665            if next_offset >= end_offset {
2666                return Ok(());
2667            }
2668
2669            // Decode unknown envelopes for gaps in ordinals.
2670            while _next_ordinal_to_read < 4 {
2671                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2672                _next_ordinal_to_read += 1;
2673                next_offset += envelope_size;
2674            }
2675
2676            let next_out_of_line = decoder.next_out_of_line();
2677            let handles_before = decoder.remaining_handles();
2678            if let Some((inlined, num_bytes, num_handles)) =
2679                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2680            {
2681                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2682                if inlined != (member_inline_size <= 4) {
2683                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2684                }
2685                let inner_offset;
2686                let mut inner_depth = depth.clone();
2687                if inlined {
2688                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2689                    inner_offset = next_offset;
2690                } else {
2691                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2692                    inner_depth.increment()?;
2693                }
2694                let val_ref = self.component_name.get_or_insert_with(|| {
2695                    fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
2696                });
2697                fidl::decode!(
2698                    fidl::encoding::BoundedString<1024>,
2699                    D,
2700                    val_ref,
2701                    decoder,
2702                    inner_offset,
2703                    inner_depth
2704                )?;
2705                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2706                {
2707                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2708                }
2709                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2710                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2711                }
2712            }
2713
2714            next_offset += envelope_size;
2715            _next_ordinal_to_read += 1;
2716            if next_offset >= end_offset {
2717                return Ok(());
2718            }
2719
2720            // Decode unknown envelopes for gaps in ordinals.
2721            while _next_ordinal_to_read < 5 {
2722                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2723                _next_ordinal_to_read += 1;
2724                next_offset += envelope_size;
2725            }
2726
2727            let next_out_of_line = decoder.next_out_of_line();
2728            let handles_before = decoder.remaining_handles();
2729            if let Some((inlined, num_bytes, num_handles)) =
2730                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2731            {
2732                let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2733                if inlined != (member_inline_size <= 4) {
2734                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2735                }
2736                let inner_offset;
2737                let mut inner_depth = depth.clone();
2738                if inlined {
2739                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2740                    inner_offset = next_offset;
2741                } else {
2742                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2743                    inner_depth.increment()?;
2744                }
2745                let val_ref = self.buttons.get_or_insert_with(
2746                    || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
2747                );
2748                fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2749                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2750                {
2751                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2752                }
2753                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2754                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2755                }
2756            }
2757
2758            next_offset += envelope_size;
2759            _next_ordinal_to_read += 1;
2760            if next_offset >= end_offset {
2761                return Ok(());
2762            }
2763
2764            // Decode unknown envelopes for gaps in ordinals.
2765            while _next_ordinal_to_read < 6 {
2766                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2767                _next_ordinal_to_read += 1;
2768                next_offset += envelope_size;
2769            }
2770
2771            let next_out_of_line = decoder.next_out_of_line();
2772            let handles_before = decoder.remaining_handles();
2773            if let Some((inlined, num_bytes, num_handles)) =
2774                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2775            {
2776                let member_inline_size =
2777                    <MouseEventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2778                if inlined != (member_inline_size <= 4) {
2779                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2780                }
2781                let inner_offset;
2782                let mut inner_depth = depth.clone();
2783                if inlined {
2784                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2785                    inner_offset = next_offset;
2786                } else {
2787                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2788                    inner_depth.increment()?;
2789                }
2790                let val_ref =
2791                    self.phase.get_or_insert_with(|| fidl::new_empty!(MouseEventPhase, D));
2792                fidl::decode!(MouseEventPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
2793                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2794                {
2795                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2796                }
2797                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2798                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2799                }
2800            }
2801
2802            next_offset += envelope_size;
2803            _next_ordinal_to_read += 1;
2804            if next_offset >= end_offset {
2805                return Ok(());
2806            }
2807
2808            // Decode unknown envelopes for gaps in ordinals.
2809            while _next_ordinal_to_read < 7 {
2810                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2811                _next_ordinal_to_read += 1;
2812                next_offset += envelope_size;
2813            }
2814
2815            let next_out_of_line = decoder.next_out_of_line();
2816            let handles_before = decoder.remaining_handles();
2817            if let Some((inlined, num_bytes, num_handles)) =
2818                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2819            {
2820                let member_inline_size =
2821                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2822                if inlined != (member_inline_size <= 4) {
2823                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2824                }
2825                let inner_offset;
2826                let mut inner_depth = depth.clone();
2827                if inlined {
2828                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2829                    inner_offset = next_offset;
2830                } else {
2831                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2832                    inner_depth.increment()?;
2833                }
2834                let val_ref =
2835                    self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
2836                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2837                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2838                {
2839                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2840                }
2841                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2842                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2843                }
2844            }
2845
2846            next_offset += envelope_size;
2847            _next_ordinal_to_read += 1;
2848            if next_offset >= end_offset {
2849                return Ok(());
2850            }
2851
2852            // Decode unknown envelopes for gaps in ordinals.
2853            while _next_ordinal_to_read < 8 {
2854                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2855                _next_ordinal_to_read += 1;
2856                next_offset += envelope_size;
2857            }
2858
2859            let next_out_of_line = decoder.next_out_of_line();
2860            let handles_before = decoder.remaining_handles();
2861            if let Some((inlined, num_bytes, num_handles)) =
2862                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2863            {
2864                let member_inline_size =
2865                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2866                if inlined != (member_inline_size <= 4) {
2867                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2868                }
2869                let inner_offset;
2870                let mut inner_depth = depth.clone();
2871                if inlined {
2872                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2873                    inner_offset = next_offset;
2874                } else {
2875                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2876                    inner_depth.increment()?;
2877                }
2878                let val_ref =
2879                    self.wheel_x_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
2880                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2881                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2882                {
2883                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2884                }
2885                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2886                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2887                }
2888            }
2889
2890            next_offset += envelope_size;
2891            _next_ordinal_to_read += 1;
2892            if next_offset >= end_offset {
2893                return Ok(());
2894            }
2895
2896            // Decode unknown envelopes for gaps in ordinals.
2897            while _next_ordinal_to_read < 9 {
2898                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2899                _next_ordinal_to_read += 1;
2900                next_offset += envelope_size;
2901            }
2902
2903            let next_out_of_line = decoder.next_out_of_line();
2904            let handles_before = decoder.remaining_handles();
2905            if let Some((inlined, num_bytes, num_handles)) =
2906                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2907            {
2908                let member_inline_size =
2909                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2910                if inlined != (member_inline_size <= 4) {
2911                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2912                }
2913                let inner_offset;
2914                let mut inner_depth = depth.clone();
2915                if inlined {
2916                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2917                    inner_offset = next_offset;
2918                } else {
2919                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2920                    inner_depth.increment()?;
2921                }
2922                let val_ref =
2923                    self.wheel_y_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
2924                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2925                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2926                {
2927                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2928                }
2929                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2930                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2931                }
2932            }
2933
2934            next_offset += envelope_size;
2935            _next_ordinal_to_read += 1;
2936            if next_offset >= end_offset {
2937                return Ok(());
2938            }
2939
2940            // Decode unknown envelopes for gaps in ordinals.
2941            while _next_ordinal_to_read < 10 {
2942                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2943                _next_ordinal_to_read += 1;
2944                next_offset += envelope_size;
2945            }
2946
2947            let next_out_of_line = decoder.next_out_of_line();
2948            let handles_before = decoder.remaining_handles();
2949            if let Some((inlined, num_bytes, num_handles)) =
2950                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2951            {
2952                let member_inline_size =
2953                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2954                if inlined != (member_inline_size <= 4) {
2955                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2956                }
2957                let inner_offset;
2958                let mut inner_depth = depth.clone();
2959                if inlined {
2960                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2961                    inner_offset = next_offset;
2962                } else {
2963                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2964                    inner_depth.increment()?;
2965                }
2966                let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
2967                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2968                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2969                {
2970                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2971                }
2972                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2973                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2974                }
2975            }
2976
2977            next_offset += envelope_size;
2978
2979            // Decode the remaining unknown envelopes.
2980            while next_offset < end_offset {
2981                _next_ordinal_to_read += 1;
2982                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2983                next_offset += envelope_size;
2984            }
2985
2986            Ok(())
2987        }
2988    }
2989
2990    impl MouseSimulateMouseEventRequest {
2991        #[inline(always)]
2992        fn max_ordinal_present(&self) -> u64 {
2993            if let Some(_) = self.scroll_h_physical_pixel {
2994                return 7;
2995            }
2996            if let Some(_) = self.scroll_v_physical_pixel {
2997                return 6;
2998            }
2999            if let Some(_) = self.scroll_h_detent {
3000                return 5;
3001            }
3002            if let Some(_) = self.scroll_v_detent {
3003                return 4;
3004            }
3005            if let Some(_) = self.movement_y {
3006                return 3;
3007            }
3008            if let Some(_) = self.movement_x {
3009                return 2;
3010            }
3011            if let Some(_) = self.pressed_buttons {
3012                return 1;
3013            }
3014            0
3015        }
3016    }
3017
3018    impl fidl::encoding::ValueTypeMarker for MouseSimulateMouseEventRequest {
3019        type Borrowed<'a> = &'a Self;
3020        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3021            value
3022        }
3023    }
3024
3025    unsafe impl fidl::encoding::TypeMarker for MouseSimulateMouseEventRequest {
3026        type Owned = Self;
3027
3028        #[inline(always)]
3029        fn inline_align(_context: fidl::encoding::Context) -> usize {
3030            8
3031        }
3032
3033        #[inline(always)]
3034        fn inline_size(_context: fidl::encoding::Context) -> usize {
3035            16
3036        }
3037    }
3038
3039    unsafe impl<D: fidl::encoding::ResourceDialect>
3040        fidl::encoding::Encode<MouseSimulateMouseEventRequest, D>
3041        for &MouseSimulateMouseEventRequest
3042    {
3043        unsafe fn encode(
3044            self,
3045            encoder: &mut fidl::encoding::Encoder<'_, D>,
3046            offset: usize,
3047            mut depth: fidl::encoding::Depth,
3048        ) -> fidl::Result<()> {
3049            encoder.debug_check_bounds::<MouseSimulateMouseEventRequest>(offset);
3050            // Vector header
3051            let max_ordinal: u64 = self.max_ordinal_present();
3052            encoder.write_num(max_ordinal, offset);
3053            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3054            // Calling encoder.out_of_line_offset(0) is not allowed.
3055            if max_ordinal == 0 {
3056                return Ok(());
3057            }
3058            depth.increment()?;
3059            let envelope_size = 8;
3060            let bytes_len = max_ordinal as usize * envelope_size;
3061            #[allow(unused_variables)]
3062            let offset = encoder.out_of_line_offset(bytes_len);
3063            let mut _prev_end_offset: usize = 0;
3064            if 1 > max_ordinal {
3065                return Ok(());
3066            }
3067
3068            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3069            // are envelope_size bytes.
3070            let cur_offset: usize = (1 - 1) * envelope_size;
3071
3072            // Zero reserved fields.
3073            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3074
3075            // Safety:
3076            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3077            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3078            //   envelope_size bytes, there is always sufficient room.
3079            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
3080            self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
3081            encoder, offset + cur_offset, depth
3082        )?;
3083
3084            _prev_end_offset = cur_offset + envelope_size;
3085            if 2 > max_ordinal {
3086                return Ok(());
3087            }
3088
3089            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3090            // are envelope_size bytes.
3091            let cur_offset: usize = (2 - 1) * envelope_size;
3092
3093            // Zero reserved fields.
3094            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3095
3096            // Safety:
3097            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3098            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3099            //   envelope_size bytes, there is always sufficient room.
3100            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3101                self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3102                encoder,
3103                offset + cur_offset,
3104                depth,
3105            )?;
3106
3107            _prev_end_offset = cur_offset + envelope_size;
3108            if 3 > max_ordinal {
3109                return Ok(());
3110            }
3111
3112            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3113            // are envelope_size bytes.
3114            let cur_offset: usize = (3 - 1) * envelope_size;
3115
3116            // Zero reserved fields.
3117            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3118
3119            // Safety:
3120            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3121            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3122            //   envelope_size bytes, there is always sufficient room.
3123            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3124                self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3125                encoder,
3126                offset + cur_offset,
3127                depth,
3128            )?;
3129
3130            _prev_end_offset = cur_offset + envelope_size;
3131            if 4 > max_ordinal {
3132                return Ok(());
3133            }
3134
3135            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3136            // are envelope_size bytes.
3137            let cur_offset: usize = (4 - 1) * envelope_size;
3138
3139            // Zero reserved fields.
3140            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3141
3142            // Safety:
3143            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3144            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3145            //   envelope_size bytes, there is always sufficient room.
3146            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3147                self.scroll_v_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3148                encoder,
3149                offset + cur_offset,
3150                depth,
3151            )?;
3152
3153            _prev_end_offset = cur_offset + envelope_size;
3154            if 5 > max_ordinal {
3155                return Ok(());
3156            }
3157
3158            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3159            // are envelope_size bytes.
3160            let cur_offset: usize = (5 - 1) * envelope_size;
3161
3162            // Zero reserved fields.
3163            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3164
3165            // Safety:
3166            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3167            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3168            //   envelope_size bytes, there is always sufficient room.
3169            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3170                self.scroll_h_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3171                encoder,
3172                offset + cur_offset,
3173                depth,
3174            )?;
3175
3176            _prev_end_offset = cur_offset + envelope_size;
3177            if 6 > max_ordinal {
3178                return Ok(());
3179            }
3180
3181            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3182            // are envelope_size bytes.
3183            let cur_offset: usize = (6 - 1) * envelope_size;
3184
3185            // Zero reserved fields.
3186            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3187
3188            // Safety:
3189            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3190            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3191            //   envelope_size bytes, there is always sufficient room.
3192            fidl::encoding::encode_in_envelope_optional::<f64, D>(
3193                self.scroll_v_physical_pixel
3194                    .as_ref()
3195                    .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3196                encoder,
3197                offset + cur_offset,
3198                depth,
3199            )?;
3200
3201            _prev_end_offset = cur_offset + envelope_size;
3202            if 7 > max_ordinal {
3203                return Ok(());
3204            }
3205
3206            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3207            // are envelope_size bytes.
3208            let cur_offset: usize = (7 - 1) * envelope_size;
3209
3210            // Zero reserved fields.
3211            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3212
3213            // Safety:
3214            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3215            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3216            //   envelope_size bytes, there is always sufficient room.
3217            fidl::encoding::encode_in_envelope_optional::<f64, D>(
3218                self.scroll_h_physical_pixel
3219                    .as_ref()
3220                    .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3221                encoder,
3222                offset + cur_offset,
3223                depth,
3224            )?;
3225
3226            _prev_end_offset = cur_offset + envelope_size;
3227
3228            Ok(())
3229        }
3230    }
3231
3232    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3233        for MouseSimulateMouseEventRequest
3234    {
3235        #[inline(always)]
3236        fn new_empty() -> Self {
3237            Self::default()
3238        }
3239
3240        unsafe fn decode(
3241            &mut self,
3242            decoder: &mut fidl::encoding::Decoder<'_, D>,
3243            offset: usize,
3244            mut depth: fidl::encoding::Depth,
3245        ) -> fidl::Result<()> {
3246            decoder.debug_check_bounds::<Self>(offset);
3247            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3248                None => return Err(fidl::Error::NotNullable),
3249                Some(len) => len,
3250            };
3251            // Calling decoder.out_of_line_offset(0) is not allowed.
3252            if len == 0 {
3253                return Ok(());
3254            };
3255            depth.increment()?;
3256            let envelope_size = 8;
3257            let bytes_len = len * envelope_size;
3258            let offset = decoder.out_of_line_offset(bytes_len)?;
3259            // Decode the envelope for each type.
3260            let mut _next_ordinal_to_read = 0;
3261            let mut next_offset = offset;
3262            let end_offset = offset + bytes_len;
3263            _next_ordinal_to_read += 1;
3264            if next_offset >= end_offset {
3265                return Ok(());
3266            }
3267
3268            // Decode unknown envelopes for gaps in ordinals.
3269            while _next_ordinal_to_read < 1 {
3270                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3271                _next_ordinal_to_read += 1;
3272                next_offset += envelope_size;
3273            }
3274
3275            let next_out_of_line = decoder.next_out_of_line();
3276            let handles_before = decoder.remaining_handles();
3277            if let Some((inlined, num_bytes, num_handles)) =
3278                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3279            {
3280                let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3281                if inlined != (member_inline_size <= 4) {
3282                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3283                }
3284                let inner_offset;
3285                let mut inner_depth = depth.clone();
3286                if inlined {
3287                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3288                    inner_offset = next_offset;
3289                } else {
3290                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3291                    inner_depth.increment()?;
3292                }
3293                let val_ref = self.pressed_buttons.get_or_insert_with(
3294                    || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3295                );
3296                fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3297                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3298                {
3299                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3300                }
3301                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3302                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3303                }
3304            }
3305
3306            next_offset += envelope_size;
3307            _next_ordinal_to_read += 1;
3308            if next_offset >= end_offset {
3309                return Ok(());
3310            }
3311
3312            // Decode unknown envelopes for gaps in ordinals.
3313            while _next_ordinal_to_read < 2 {
3314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3315                _next_ordinal_to_read += 1;
3316                next_offset += envelope_size;
3317            }
3318
3319            let next_out_of_line = decoder.next_out_of_line();
3320            let handles_before = decoder.remaining_handles();
3321            if let Some((inlined, num_bytes, num_handles)) =
3322                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3323            {
3324                let member_inline_size =
3325                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3326                if inlined != (member_inline_size <= 4) {
3327                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3328                }
3329                let inner_offset;
3330                let mut inner_depth = depth.clone();
3331                if inlined {
3332                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3333                    inner_offset = next_offset;
3334                } else {
3335                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3336                    inner_depth.increment()?;
3337                }
3338                let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
3339                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3340                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3341                {
3342                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3343                }
3344                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3345                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3346                }
3347            }
3348
3349            next_offset += envelope_size;
3350            _next_ordinal_to_read += 1;
3351            if next_offset >= end_offset {
3352                return Ok(());
3353            }
3354
3355            // Decode unknown envelopes for gaps in ordinals.
3356            while _next_ordinal_to_read < 3 {
3357                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3358                _next_ordinal_to_read += 1;
3359                next_offset += envelope_size;
3360            }
3361
3362            let next_out_of_line = decoder.next_out_of_line();
3363            let handles_before = decoder.remaining_handles();
3364            if let Some((inlined, num_bytes, num_handles)) =
3365                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3366            {
3367                let member_inline_size =
3368                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3369                if inlined != (member_inline_size <= 4) {
3370                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3371                }
3372                let inner_offset;
3373                let mut inner_depth = depth.clone();
3374                if inlined {
3375                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3376                    inner_offset = next_offset;
3377                } else {
3378                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3379                    inner_depth.increment()?;
3380                }
3381                let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
3382                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3383                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3384                {
3385                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3386                }
3387                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3388                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3389                }
3390            }
3391
3392            next_offset += envelope_size;
3393            _next_ordinal_to_read += 1;
3394            if next_offset >= end_offset {
3395                return Ok(());
3396            }
3397
3398            // Decode unknown envelopes for gaps in ordinals.
3399            while _next_ordinal_to_read < 4 {
3400                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3401                _next_ordinal_to_read += 1;
3402                next_offset += envelope_size;
3403            }
3404
3405            let next_out_of_line = decoder.next_out_of_line();
3406            let handles_before = decoder.remaining_handles();
3407            if let Some((inlined, num_bytes, num_handles)) =
3408                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3409            {
3410                let member_inline_size =
3411                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3412                if inlined != (member_inline_size <= 4) {
3413                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3414                }
3415                let inner_offset;
3416                let mut inner_depth = depth.clone();
3417                if inlined {
3418                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3419                    inner_offset = next_offset;
3420                } else {
3421                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3422                    inner_depth.increment()?;
3423                }
3424                let val_ref = self.scroll_v_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3425                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3426                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3427                {
3428                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3429                }
3430                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3431                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3432                }
3433            }
3434
3435            next_offset += envelope_size;
3436            _next_ordinal_to_read += 1;
3437            if next_offset >= end_offset {
3438                return Ok(());
3439            }
3440
3441            // Decode unknown envelopes for gaps in ordinals.
3442            while _next_ordinal_to_read < 5 {
3443                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3444                _next_ordinal_to_read += 1;
3445                next_offset += envelope_size;
3446            }
3447
3448            let next_out_of_line = decoder.next_out_of_line();
3449            let handles_before = decoder.remaining_handles();
3450            if let Some((inlined, num_bytes, num_handles)) =
3451                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3452            {
3453                let member_inline_size =
3454                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3455                if inlined != (member_inline_size <= 4) {
3456                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3457                }
3458                let inner_offset;
3459                let mut inner_depth = depth.clone();
3460                if inlined {
3461                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3462                    inner_offset = next_offset;
3463                } else {
3464                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3465                    inner_depth.increment()?;
3466                }
3467                let val_ref = self.scroll_h_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3468                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3469                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3470                {
3471                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3472                }
3473                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3474                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3475                }
3476            }
3477
3478            next_offset += envelope_size;
3479            _next_ordinal_to_read += 1;
3480            if next_offset >= end_offset {
3481                return Ok(());
3482            }
3483
3484            // Decode unknown envelopes for gaps in ordinals.
3485            while _next_ordinal_to_read < 6 {
3486                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3487                _next_ordinal_to_read += 1;
3488                next_offset += envelope_size;
3489            }
3490
3491            let next_out_of_line = decoder.next_out_of_line();
3492            let handles_before = decoder.remaining_handles();
3493            if let Some((inlined, num_bytes, num_handles)) =
3494                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3495            {
3496                let member_inline_size =
3497                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3498                if inlined != (member_inline_size <= 4) {
3499                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3500                }
3501                let inner_offset;
3502                let mut inner_depth = depth.clone();
3503                if inlined {
3504                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3505                    inner_offset = next_offset;
3506                } else {
3507                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3508                    inner_depth.increment()?;
3509                }
3510                let val_ref =
3511                    self.scroll_v_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3512                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3513                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3514                {
3515                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3516                }
3517                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3518                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3519                }
3520            }
3521
3522            next_offset += envelope_size;
3523            _next_ordinal_to_read += 1;
3524            if next_offset >= end_offset {
3525                return Ok(());
3526            }
3527
3528            // Decode unknown envelopes for gaps in ordinals.
3529            while _next_ordinal_to_read < 7 {
3530                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3531                _next_ordinal_to_read += 1;
3532                next_offset += envelope_size;
3533            }
3534
3535            let next_out_of_line = decoder.next_out_of_line();
3536            let handles_before = decoder.remaining_handles();
3537            if let Some((inlined, num_bytes, num_handles)) =
3538                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3539            {
3540                let member_inline_size =
3541                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3542                if inlined != (member_inline_size <= 4) {
3543                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3544                }
3545                let inner_offset;
3546                let mut inner_depth = depth.clone();
3547                if inlined {
3548                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3549                    inner_offset = next_offset;
3550                } else {
3551                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3552                    inner_depth.increment()?;
3553                }
3554                let val_ref =
3555                    self.scroll_h_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3556                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3557                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3558                {
3559                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3560                }
3561                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3562                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3563                }
3564            }
3565
3566            next_offset += envelope_size;
3567
3568            // Decode the remaining unknown envelopes.
3569            while next_offset < end_offset {
3570                _next_ordinal_to_read += 1;
3571                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3572                next_offset += envelope_size;
3573            }
3574
3575            Ok(())
3576        }
3577    }
3578
3579    impl TouchInputListenerReportTouchInputRequest {
3580        #[inline(always)]
3581        fn max_ordinal_present(&self) -> u64 {
3582            if let Some(_) = self.device_id {
3583                return 8;
3584            }
3585            if let Some(_) = self.pointer_id {
3586                return 7;
3587            }
3588            if let Some(_) = self.phase {
3589                return 6;
3590            }
3591            if let Some(_) = self.component_name {
3592                return 5;
3593            }
3594            if let Some(_) = self.device_pixel_ratio {
3595                return 4;
3596            }
3597            if let Some(_) = self.time_received {
3598                return 3;
3599            }
3600            if let Some(_) = self.local_y {
3601                return 2;
3602            }
3603            if let Some(_) = self.local_x {
3604                return 1;
3605            }
3606            0
3607        }
3608    }
3609
3610    impl fidl::encoding::ValueTypeMarker for TouchInputListenerReportTouchInputRequest {
3611        type Borrowed<'a> = &'a Self;
3612        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3613            value
3614        }
3615    }
3616
3617    unsafe impl fidl::encoding::TypeMarker for TouchInputListenerReportTouchInputRequest {
3618        type Owned = Self;
3619
3620        #[inline(always)]
3621        fn inline_align(_context: fidl::encoding::Context) -> usize {
3622            8
3623        }
3624
3625        #[inline(always)]
3626        fn inline_size(_context: fidl::encoding::Context) -> usize {
3627            16
3628        }
3629    }
3630
3631    unsafe impl<D: fidl::encoding::ResourceDialect>
3632        fidl::encoding::Encode<TouchInputListenerReportTouchInputRequest, D>
3633        for &TouchInputListenerReportTouchInputRequest
3634    {
3635        unsafe fn encode(
3636            self,
3637            encoder: &mut fidl::encoding::Encoder<'_, D>,
3638            offset: usize,
3639            mut depth: fidl::encoding::Depth,
3640        ) -> fidl::Result<()> {
3641            encoder.debug_check_bounds::<TouchInputListenerReportTouchInputRequest>(offset);
3642            // Vector header
3643            let max_ordinal: u64 = self.max_ordinal_present();
3644            encoder.write_num(max_ordinal, offset);
3645            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3646            // Calling encoder.out_of_line_offset(0) is not allowed.
3647            if max_ordinal == 0 {
3648                return Ok(());
3649            }
3650            depth.increment()?;
3651            let envelope_size = 8;
3652            let bytes_len = max_ordinal as usize * envelope_size;
3653            #[allow(unused_variables)]
3654            let offset = encoder.out_of_line_offset(bytes_len);
3655            let mut _prev_end_offset: usize = 0;
3656            if 1 > max_ordinal {
3657                return Ok(());
3658            }
3659
3660            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3661            // are envelope_size bytes.
3662            let cur_offset: usize = (1 - 1) * envelope_size;
3663
3664            // Zero reserved fields.
3665            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3666
3667            // Safety:
3668            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3669            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3670            //   envelope_size bytes, there is always sufficient room.
3671            fidl::encoding::encode_in_envelope_optional::<f64, D>(
3672                self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3673                encoder,
3674                offset + cur_offset,
3675                depth,
3676            )?;
3677
3678            _prev_end_offset = cur_offset + envelope_size;
3679            if 2 > max_ordinal {
3680                return Ok(());
3681            }
3682
3683            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3684            // are envelope_size bytes.
3685            let cur_offset: usize = (2 - 1) * envelope_size;
3686
3687            // Zero reserved fields.
3688            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3689
3690            // Safety:
3691            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3692            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3693            //   envelope_size bytes, there is always sufficient room.
3694            fidl::encoding::encode_in_envelope_optional::<f64, D>(
3695                self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3696                encoder,
3697                offset + cur_offset,
3698                depth,
3699            )?;
3700
3701            _prev_end_offset = cur_offset + envelope_size;
3702            if 3 > max_ordinal {
3703                return Ok(());
3704            }
3705
3706            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3707            // are envelope_size bytes.
3708            let cur_offset: usize = (3 - 1) * envelope_size;
3709
3710            // Zero reserved fields.
3711            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3712
3713            // Safety:
3714            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3715            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3716            //   envelope_size bytes, there is always sufficient room.
3717            fidl::encoding::encode_in_envelope_optional::<i64, D>(
3718                self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3719                encoder,
3720                offset + cur_offset,
3721                depth,
3722            )?;
3723
3724            _prev_end_offset = cur_offset + envelope_size;
3725            if 4 > max_ordinal {
3726                return Ok(());
3727            }
3728
3729            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3730            // are envelope_size bytes.
3731            let cur_offset: usize = (4 - 1) * envelope_size;
3732
3733            // Zero reserved fields.
3734            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3735
3736            // Safety:
3737            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3738            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3739            //   envelope_size bytes, there is always sufficient room.
3740            fidl::encoding::encode_in_envelope_optional::<f64, D>(
3741                self.device_pixel_ratio
3742                    .as_ref()
3743                    .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3744                encoder,
3745                offset + cur_offset,
3746                depth,
3747            )?;
3748
3749            _prev_end_offset = cur_offset + envelope_size;
3750            if 5 > max_ordinal {
3751                return Ok(());
3752            }
3753
3754            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3755            // are envelope_size bytes.
3756            let cur_offset: usize = (5 - 1) * envelope_size;
3757
3758            // Zero reserved fields.
3759            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3760
3761            // Safety:
3762            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3763            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3764            //   envelope_size bytes, there is always sufficient room.
3765            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
3766            self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
3767            encoder, offset + cur_offset, depth
3768        )?;
3769
3770            _prev_end_offset = cur_offset + envelope_size;
3771            if 6 > max_ordinal {
3772                return Ok(());
3773            }
3774
3775            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3776            // are envelope_size bytes.
3777            let cur_offset: usize = (6 - 1) * envelope_size;
3778
3779            // Zero reserved fields.
3780            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3781
3782            // Safety:
3783            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3784            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3785            //   envelope_size bytes, there is always sufficient room.
3786            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_pointer::EventPhase, D>(
3787            self.phase.as_ref().map(<fidl_fuchsia_ui_pointer::EventPhase as fidl::encoding::ValueTypeMarker>::borrow),
3788            encoder, offset + cur_offset, depth
3789        )?;
3790
3791            _prev_end_offset = cur_offset + envelope_size;
3792            if 7 > max_ordinal {
3793                return Ok(());
3794            }
3795
3796            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3797            // are envelope_size bytes.
3798            let cur_offset: usize = (7 - 1) * envelope_size;
3799
3800            // Zero reserved fields.
3801            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3802
3803            // Safety:
3804            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3805            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3806            //   envelope_size bytes, there is always sufficient room.
3807            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3808                self.pointer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3809                encoder,
3810                offset + cur_offset,
3811                depth,
3812            )?;
3813
3814            _prev_end_offset = cur_offset + envelope_size;
3815            if 8 > max_ordinal {
3816                return Ok(());
3817            }
3818
3819            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3820            // are envelope_size bytes.
3821            let cur_offset: usize = (8 - 1) * envelope_size;
3822
3823            // Zero reserved fields.
3824            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3825
3826            // Safety:
3827            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3828            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3829            //   envelope_size bytes, there is always sufficient room.
3830            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3831                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3832                encoder,
3833                offset + cur_offset,
3834                depth,
3835            )?;
3836
3837            _prev_end_offset = cur_offset + envelope_size;
3838
3839            Ok(())
3840        }
3841    }
3842
3843    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3844        for TouchInputListenerReportTouchInputRequest
3845    {
3846        #[inline(always)]
3847        fn new_empty() -> Self {
3848            Self::default()
3849        }
3850
3851        unsafe fn decode(
3852            &mut self,
3853            decoder: &mut fidl::encoding::Decoder<'_, D>,
3854            offset: usize,
3855            mut depth: fidl::encoding::Depth,
3856        ) -> fidl::Result<()> {
3857            decoder.debug_check_bounds::<Self>(offset);
3858            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3859                None => return Err(fidl::Error::NotNullable),
3860                Some(len) => len,
3861            };
3862            // Calling decoder.out_of_line_offset(0) is not allowed.
3863            if len == 0 {
3864                return Ok(());
3865            };
3866            depth.increment()?;
3867            let envelope_size = 8;
3868            let bytes_len = len * envelope_size;
3869            let offset = decoder.out_of_line_offset(bytes_len)?;
3870            // Decode the envelope for each type.
3871            let mut _next_ordinal_to_read = 0;
3872            let mut next_offset = offset;
3873            let end_offset = offset + bytes_len;
3874            _next_ordinal_to_read += 1;
3875            if next_offset >= end_offset {
3876                return Ok(());
3877            }
3878
3879            // Decode unknown envelopes for gaps in ordinals.
3880            while _next_ordinal_to_read < 1 {
3881                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3882                _next_ordinal_to_read += 1;
3883                next_offset += envelope_size;
3884            }
3885
3886            let next_out_of_line = decoder.next_out_of_line();
3887            let handles_before = decoder.remaining_handles();
3888            if let Some((inlined, num_bytes, num_handles)) =
3889                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3890            {
3891                let member_inline_size =
3892                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3893                if inlined != (member_inline_size <= 4) {
3894                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3895                }
3896                let inner_offset;
3897                let mut inner_depth = depth.clone();
3898                if inlined {
3899                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3900                    inner_offset = next_offset;
3901                } else {
3902                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3903                    inner_depth.increment()?;
3904                }
3905                let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
3906                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3907                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3908                {
3909                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3910                }
3911                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3912                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3913                }
3914            }
3915
3916            next_offset += envelope_size;
3917            _next_ordinal_to_read += 1;
3918            if next_offset >= end_offset {
3919                return Ok(());
3920            }
3921
3922            // Decode unknown envelopes for gaps in ordinals.
3923            while _next_ordinal_to_read < 2 {
3924                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3925                _next_ordinal_to_read += 1;
3926                next_offset += envelope_size;
3927            }
3928
3929            let next_out_of_line = decoder.next_out_of_line();
3930            let handles_before = decoder.remaining_handles();
3931            if let Some((inlined, num_bytes, num_handles)) =
3932                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3933            {
3934                let member_inline_size =
3935                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3936                if inlined != (member_inline_size <= 4) {
3937                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3938                }
3939                let inner_offset;
3940                let mut inner_depth = depth.clone();
3941                if inlined {
3942                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3943                    inner_offset = next_offset;
3944                } else {
3945                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3946                    inner_depth.increment()?;
3947                }
3948                let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
3949                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3950                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3951                {
3952                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3953                }
3954                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3955                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3956                }
3957            }
3958
3959            next_offset += envelope_size;
3960            _next_ordinal_to_read += 1;
3961            if next_offset >= end_offset {
3962                return Ok(());
3963            }
3964
3965            // Decode unknown envelopes for gaps in ordinals.
3966            while _next_ordinal_to_read < 3 {
3967                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3968                _next_ordinal_to_read += 1;
3969                next_offset += envelope_size;
3970            }
3971
3972            let next_out_of_line = decoder.next_out_of_line();
3973            let handles_before = decoder.remaining_handles();
3974            if let Some((inlined, num_bytes, num_handles)) =
3975                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3976            {
3977                let member_inline_size =
3978                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3979                if inlined != (member_inline_size <= 4) {
3980                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3981                }
3982                let inner_offset;
3983                let mut inner_depth = depth.clone();
3984                if inlined {
3985                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3986                    inner_offset = next_offset;
3987                } else {
3988                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3989                    inner_depth.increment()?;
3990                }
3991                let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
3992                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3993                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3994                {
3995                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3996                }
3997                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3998                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3999                }
4000            }
4001
4002            next_offset += envelope_size;
4003            _next_ordinal_to_read += 1;
4004            if next_offset >= end_offset {
4005                return Ok(());
4006            }
4007
4008            // Decode unknown envelopes for gaps in ordinals.
4009            while _next_ordinal_to_read < 4 {
4010                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4011                _next_ordinal_to_read += 1;
4012                next_offset += envelope_size;
4013            }
4014
4015            let next_out_of_line = decoder.next_out_of_line();
4016            let handles_before = decoder.remaining_handles();
4017            if let Some((inlined, num_bytes, num_handles)) =
4018                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4019            {
4020                let member_inline_size =
4021                    <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4022                if inlined != (member_inline_size <= 4) {
4023                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4024                }
4025                let inner_offset;
4026                let mut inner_depth = depth.clone();
4027                if inlined {
4028                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4029                    inner_offset = next_offset;
4030                } else {
4031                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4032                    inner_depth.increment()?;
4033                }
4034                let val_ref =
4035                    self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
4036                fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4037                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4038                {
4039                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4040                }
4041                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4042                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4043                }
4044            }
4045
4046            next_offset += envelope_size;
4047            _next_ordinal_to_read += 1;
4048            if next_offset >= end_offset {
4049                return Ok(());
4050            }
4051
4052            // Decode unknown envelopes for gaps in ordinals.
4053            while _next_ordinal_to_read < 5 {
4054                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4055                _next_ordinal_to_read += 1;
4056                next_offset += envelope_size;
4057            }
4058
4059            let next_out_of_line = decoder.next_out_of_line();
4060            let handles_before = decoder.remaining_handles();
4061            if let Some((inlined, num_bytes, num_handles)) =
4062                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4063            {
4064                let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4065                if inlined != (member_inline_size <= 4) {
4066                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4067                }
4068                let inner_offset;
4069                let mut inner_depth = depth.clone();
4070                if inlined {
4071                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4072                    inner_offset = next_offset;
4073                } else {
4074                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4075                    inner_depth.increment()?;
4076                }
4077                let val_ref = self.component_name.get_or_insert_with(|| {
4078                    fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
4079                });
4080                fidl::decode!(
4081                    fidl::encoding::BoundedString<1024>,
4082                    D,
4083                    val_ref,
4084                    decoder,
4085                    inner_offset,
4086                    inner_depth
4087                )?;
4088                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4089                {
4090                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4091                }
4092                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4093                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4094                }
4095            }
4096
4097            next_offset += envelope_size;
4098            _next_ordinal_to_read += 1;
4099            if next_offset >= end_offset {
4100                return Ok(());
4101            }
4102
4103            // Decode unknown envelopes for gaps in ordinals.
4104            while _next_ordinal_to_read < 6 {
4105                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4106                _next_ordinal_to_read += 1;
4107                next_offset += envelope_size;
4108            }
4109
4110            let next_out_of_line = decoder.next_out_of_line();
4111            let handles_before = decoder.remaining_handles();
4112            if let Some((inlined, num_bytes, num_handles)) =
4113                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4114            {
4115                let member_inline_size = <fidl_fuchsia_ui_pointer::EventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4116                if inlined != (member_inline_size <= 4) {
4117                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4118                }
4119                let inner_offset;
4120                let mut inner_depth = depth.clone();
4121                if inlined {
4122                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4123                    inner_offset = next_offset;
4124                } else {
4125                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4126                    inner_depth.increment()?;
4127                }
4128                let val_ref = self.phase.get_or_insert_with(|| {
4129                    fidl::new_empty!(fidl_fuchsia_ui_pointer::EventPhase, D)
4130                });
4131                fidl::decode!(
4132                    fidl_fuchsia_ui_pointer::EventPhase,
4133                    D,
4134                    val_ref,
4135                    decoder,
4136                    inner_offset,
4137                    inner_depth
4138                )?;
4139                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4140                {
4141                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4142                }
4143                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4144                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4145                }
4146            }
4147
4148            next_offset += envelope_size;
4149            _next_ordinal_to_read += 1;
4150            if next_offset >= end_offset {
4151                return Ok(());
4152            }
4153
4154            // Decode unknown envelopes for gaps in ordinals.
4155            while _next_ordinal_to_read < 7 {
4156                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4157                _next_ordinal_to_read += 1;
4158                next_offset += envelope_size;
4159            }
4160
4161            let next_out_of_line = decoder.next_out_of_line();
4162            let handles_before = decoder.remaining_handles();
4163            if let Some((inlined, num_bytes, num_handles)) =
4164                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4165            {
4166                let member_inline_size =
4167                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4168                if inlined != (member_inline_size <= 4) {
4169                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4170                }
4171                let inner_offset;
4172                let mut inner_depth = depth.clone();
4173                if inlined {
4174                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4175                    inner_offset = next_offset;
4176                } else {
4177                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4178                    inner_depth.increment()?;
4179                }
4180                let val_ref = self.pointer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4181                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4182                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4183                {
4184                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4185                }
4186                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4187                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4188                }
4189            }
4190
4191            next_offset += envelope_size;
4192            _next_ordinal_to_read += 1;
4193            if next_offset >= end_offset {
4194                return Ok(());
4195            }
4196
4197            // Decode unknown envelopes for gaps in ordinals.
4198            while _next_ordinal_to_read < 8 {
4199                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4200                _next_ordinal_to_read += 1;
4201                next_offset += envelope_size;
4202            }
4203
4204            let next_out_of_line = decoder.next_out_of_line();
4205            let handles_before = decoder.remaining_handles();
4206            if let Some((inlined, num_bytes, num_handles)) =
4207                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4208            {
4209                let member_inline_size =
4210                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4211                if inlined != (member_inline_size <= 4) {
4212                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4213                }
4214                let inner_offset;
4215                let mut inner_depth = depth.clone();
4216                if inlined {
4217                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4218                    inner_offset = next_offset;
4219                } else {
4220                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4221                    inner_depth.increment()?;
4222                }
4223                let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4224                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4225                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4226                {
4227                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4228                }
4229                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4230                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4231                }
4232            }
4233
4234            next_offset += envelope_size;
4235
4236            // Decode the remaining unknown envelopes.
4237            while next_offset < end_offset {
4238                _next_ordinal_to_read += 1;
4239                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4240                next_offset += envelope_size;
4241            }
4242
4243            Ok(())
4244        }
4245    }
4246
4247    impl TouchScreenSimulateMultiFingerGestureRequest {
4248        #[inline(always)]
4249        fn max_ordinal_present(&self) -> u64 {
4250            if let Some(_) = self.finger_count {
4251                return 4;
4252            }
4253            if let Some(_) = self.move_event_count {
4254                return 3;
4255            }
4256            if let Some(_) = self.end_locations {
4257                return 2;
4258            }
4259            if let Some(_) = self.start_locations {
4260                return 1;
4261            }
4262            0
4263        }
4264    }
4265
4266    impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4267        type Borrowed<'a> = &'a Self;
4268        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4269            value
4270        }
4271    }
4272
4273    unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4274        type Owned = Self;
4275
4276        #[inline(always)]
4277        fn inline_align(_context: fidl::encoding::Context) -> usize {
4278            8
4279        }
4280
4281        #[inline(always)]
4282        fn inline_size(_context: fidl::encoding::Context) -> usize {
4283            16
4284        }
4285    }
4286
4287    unsafe impl<D: fidl::encoding::ResourceDialect>
4288        fidl::encoding::Encode<TouchScreenSimulateMultiFingerGestureRequest, D>
4289        for &TouchScreenSimulateMultiFingerGestureRequest
4290    {
4291        unsafe fn encode(
4292            self,
4293            encoder: &mut fidl::encoding::Encoder<'_, D>,
4294            offset: usize,
4295            mut depth: fidl::encoding::Depth,
4296        ) -> fidl::Result<()> {
4297            encoder.debug_check_bounds::<TouchScreenSimulateMultiFingerGestureRequest>(offset);
4298            // Vector header
4299            let max_ordinal: u64 = self.max_ordinal_present();
4300            encoder.write_num(max_ordinal, offset);
4301            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4302            // Calling encoder.out_of_line_offset(0) is not allowed.
4303            if max_ordinal == 0 {
4304                return Ok(());
4305            }
4306            depth.increment()?;
4307            let envelope_size = 8;
4308            let bytes_len = max_ordinal as usize * envelope_size;
4309            #[allow(unused_variables)]
4310            let offset = encoder.out_of_line_offset(bytes_len);
4311            let mut _prev_end_offset: usize = 0;
4312            if 1 > max_ordinal {
4313                return Ok(());
4314            }
4315
4316            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4317            // are envelope_size bytes.
4318            let cur_offset: usize = (1 - 1) * envelope_size;
4319
4320            // Zero reserved fields.
4321            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4322
4323            // Safety:
4324            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4325            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4326            //   envelope_size bytes, there is always sufficient room.
4327            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10>, D>(
4328            self.start_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4329            encoder, offset + cur_offset, depth
4330        )?;
4331
4332            _prev_end_offset = cur_offset + envelope_size;
4333            if 2 > max_ordinal {
4334                return Ok(());
4335            }
4336
4337            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4338            // are envelope_size bytes.
4339            let cur_offset: usize = (2 - 1) * envelope_size;
4340
4341            // Zero reserved fields.
4342            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4343
4344            // Safety:
4345            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4346            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4347            //   envelope_size bytes, there is always sufficient room.
4348            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10>, D>(
4349            self.end_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4350            encoder, offset + cur_offset, depth
4351        )?;
4352
4353            _prev_end_offset = cur_offset + envelope_size;
4354            if 3 > max_ordinal {
4355                return Ok(());
4356            }
4357
4358            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4359            // are envelope_size bytes.
4360            let cur_offset: usize = (3 - 1) * envelope_size;
4361
4362            // Zero reserved fields.
4363            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4364
4365            // Safety:
4366            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4367            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4368            //   envelope_size bytes, there is always sufficient room.
4369            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4370                self.move_event_count
4371                    .as_ref()
4372                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4373                encoder,
4374                offset + cur_offset,
4375                depth,
4376            )?;
4377
4378            _prev_end_offset = cur_offset + envelope_size;
4379            if 4 > max_ordinal {
4380                return Ok(());
4381            }
4382
4383            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4384            // are envelope_size bytes.
4385            let cur_offset: usize = (4 - 1) * envelope_size;
4386
4387            // Zero reserved fields.
4388            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4389
4390            // Safety:
4391            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4392            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4393            //   envelope_size bytes, there is always sufficient room.
4394            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4395                self.finger_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4396                encoder,
4397                offset + cur_offset,
4398                depth,
4399            )?;
4400
4401            _prev_end_offset = cur_offset + envelope_size;
4402
4403            Ok(())
4404        }
4405    }
4406
4407    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4408        for TouchScreenSimulateMultiFingerGestureRequest
4409    {
4410        #[inline(always)]
4411        fn new_empty() -> Self {
4412            Self::default()
4413        }
4414
4415        unsafe fn decode(
4416            &mut self,
4417            decoder: &mut fidl::encoding::Decoder<'_, D>,
4418            offset: usize,
4419            mut depth: fidl::encoding::Depth,
4420        ) -> fidl::Result<()> {
4421            decoder.debug_check_bounds::<Self>(offset);
4422            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4423                None => return Err(fidl::Error::NotNullable),
4424                Some(len) => len,
4425            };
4426            // Calling decoder.out_of_line_offset(0) is not allowed.
4427            if len == 0 {
4428                return Ok(());
4429            };
4430            depth.increment()?;
4431            let envelope_size = 8;
4432            let bytes_len = len * envelope_size;
4433            let offset = decoder.out_of_line_offset(bytes_len)?;
4434            // Decode the envelope for each type.
4435            let mut _next_ordinal_to_read = 0;
4436            let mut next_offset = offset;
4437            let end_offset = offset + bytes_len;
4438            _next_ordinal_to_read += 1;
4439            if next_offset >= end_offset {
4440                return Ok(());
4441            }
4442
4443            // Decode unknown envelopes for gaps in ordinals.
4444            while _next_ordinal_to_read < 1 {
4445                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4446                _next_ordinal_to_read += 1;
4447                next_offset += envelope_size;
4448            }
4449
4450            let next_out_of_line = decoder.next_out_of_line();
4451            let handles_before = decoder.remaining_handles();
4452            if let Some((inlined, num_bytes, num_handles)) =
4453                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4454            {
4455                let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4456                if inlined != (member_inline_size <= 4) {
4457                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4458                }
4459                let inner_offset;
4460                let mut inner_depth = depth.clone();
4461                if inlined {
4462                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4463                    inner_offset = next_offset;
4464                } else {
4465                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4466                    inner_depth.increment()?;
4467                }
4468                let val_ref = self.start_locations.get_or_insert_with(
4469                    || fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10>, D),
4470                );
4471                fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4472                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4473                {
4474                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4475                }
4476                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4477                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4478                }
4479            }
4480
4481            next_offset += envelope_size;
4482            _next_ordinal_to_read += 1;
4483            if next_offset >= end_offset {
4484                return Ok(());
4485            }
4486
4487            // Decode unknown envelopes for gaps in ordinals.
4488            while _next_ordinal_to_read < 2 {
4489                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4490                _next_ordinal_to_read += 1;
4491                next_offset += envelope_size;
4492            }
4493
4494            let next_out_of_line = decoder.next_out_of_line();
4495            let handles_before = decoder.remaining_handles();
4496            if let Some((inlined, num_bytes, num_handles)) =
4497                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4498            {
4499                let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4500                if inlined != (member_inline_size <= 4) {
4501                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4502                }
4503                let inner_offset;
4504                let mut inner_depth = depth.clone();
4505                if inlined {
4506                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4507                    inner_offset = next_offset;
4508                } else {
4509                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4510                    inner_depth.increment()?;
4511                }
4512                let val_ref = self.end_locations.get_or_insert_with(
4513                    || fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10>, D),
4514                );
4515                fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4516                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4517                {
4518                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4519                }
4520                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4521                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4522                }
4523            }
4524
4525            next_offset += envelope_size;
4526            _next_ordinal_to_read += 1;
4527            if next_offset >= end_offset {
4528                return Ok(());
4529            }
4530
4531            // Decode unknown envelopes for gaps in ordinals.
4532            while _next_ordinal_to_read < 3 {
4533                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4534                _next_ordinal_to_read += 1;
4535                next_offset += envelope_size;
4536            }
4537
4538            let next_out_of_line = decoder.next_out_of_line();
4539            let handles_before = decoder.remaining_handles();
4540            if let Some((inlined, num_bytes, num_handles)) =
4541                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4542            {
4543                let member_inline_size =
4544                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4545                if inlined != (member_inline_size <= 4) {
4546                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4547                }
4548                let inner_offset;
4549                let mut inner_depth = depth.clone();
4550                if inlined {
4551                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4552                    inner_offset = next_offset;
4553                } else {
4554                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4555                    inner_depth.increment()?;
4556                }
4557                let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
4558                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4559                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4560                {
4561                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4562                }
4563                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4564                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4565                }
4566            }
4567
4568            next_offset += envelope_size;
4569            _next_ordinal_to_read += 1;
4570            if next_offset >= end_offset {
4571                return Ok(());
4572            }
4573
4574            // Decode unknown envelopes for gaps in ordinals.
4575            while _next_ordinal_to_read < 4 {
4576                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4577                _next_ordinal_to_read += 1;
4578                next_offset += envelope_size;
4579            }
4580
4581            let next_out_of_line = decoder.next_out_of_line();
4582            let handles_before = decoder.remaining_handles();
4583            if let Some((inlined, num_bytes, num_handles)) =
4584                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4585            {
4586                let member_inline_size =
4587                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4588                if inlined != (member_inline_size <= 4) {
4589                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4590                }
4591                let inner_offset;
4592                let mut inner_depth = depth.clone();
4593                if inlined {
4594                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4595                    inner_offset = next_offset;
4596                } else {
4597                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4598                    inner_depth.increment()?;
4599                }
4600                let val_ref = self.finger_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
4601                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4602                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4603                {
4604                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4605                }
4606                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4607                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4608                }
4609            }
4610
4611            next_offset += envelope_size;
4612
4613            // Decode the remaining unknown envelopes.
4614            while next_offset < end_offset {
4615                _next_ordinal_to_read += 1;
4616                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4617                next_offset += envelope_size;
4618            }
4619
4620            Ok(())
4621        }
4622    }
4623
4624    impl TouchScreenSimulateMultiTapRequest {
4625        #[inline(always)]
4626        fn max_ordinal_present(&self) -> u64 {
4627            if let Some(_) = self.tap_locations {
4628                return 1;
4629            }
4630            0
4631        }
4632    }
4633
4634    impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiTapRequest {
4635        type Borrowed<'a> = &'a Self;
4636        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4637            value
4638        }
4639    }
4640
4641    unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiTapRequest {
4642        type Owned = Self;
4643
4644        #[inline(always)]
4645        fn inline_align(_context: fidl::encoding::Context) -> usize {
4646            8
4647        }
4648
4649        #[inline(always)]
4650        fn inline_size(_context: fidl::encoding::Context) -> usize {
4651            16
4652        }
4653    }
4654
4655    unsafe impl<D: fidl::encoding::ResourceDialect>
4656        fidl::encoding::Encode<TouchScreenSimulateMultiTapRequest, D>
4657        for &TouchScreenSimulateMultiTapRequest
4658    {
4659        unsafe fn encode(
4660            self,
4661            encoder: &mut fidl::encoding::Encoder<'_, D>,
4662            offset: usize,
4663            mut depth: fidl::encoding::Depth,
4664        ) -> fidl::Result<()> {
4665            encoder.debug_check_bounds::<TouchScreenSimulateMultiTapRequest>(offset);
4666            // Vector header
4667            let max_ordinal: u64 = self.max_ordinal_present();
4668            encoder.write_num(max_ordinal, offset);
4669            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4670            // Calling encoder.out_of_line_offset(0) is not allowed.
4671            if max_ordinal == 0 {
4672                return Ok(());
4673            }
4674            depth.increment()?;
4675            let envelope_size = 8;
4676            let bytes_len = max_ordinal as usize * envelope_size;
4677            #[allow(unused_variables)]
4678            let offset = encoder.out_of_line_offset(bytes_len);
4679            let mut _prev_end_offset: usize = 0;
4680            if 1 > max_ordinal {
4681                return Ok(());
4682            }
4683
4684            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4685            // are envelope_size bytes.
4686            let cur_offset: usize = (1 - 1) * envelope_size;
4687
4688            // Zero reserved fields.
4689            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4690
4691            // Safety:
4692            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4693            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4694            //   envelope_size bytes, there is always sufficient room.
4695            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math::Vec_, 10>, D>(
4696            self.tap_locations.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4697            encoder, offset + cur_offset, depth
4698        )?;
4699
4700            _prev_end_offset = cur_offset + envelope_size;
4701
4702            Ok(())
4703        }
4704    }
4705
4706    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4707        for TouchScreenSimulateMultiTapRequest
4708    {
4709        #[inline(always)]
4710        fn new_empty() -> Self {
4711            Self::default()
4712        }
4713
4714        unsafe fn decode(
4715            &mut self,
4716            decoder: &mut fidl::encoding::Decoder<'_, D>,
4717            offset: usize,
4718            mut depth: fidl::encoding::Depth,
4719        ) -> fidl::Result<()> {
4720            decoder.debug_check_bounds::<Self>(offset);
4721            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4722                None => return Err(fidl::Error::NotNullable),
4723                Some(len) => len,
4724            };
4725            // Calling decoder.out_of_line_offset(0) is not allowed.
4726            if len == 0 {
4727                return Ok(());
4728            };
4729            depth.increment()?;
4730            let envelope_size = 8;
4731            let bytes_len = len * envelope_size;
4732            let offset = decoder.out_of_line_offset(bytes_len)?;
4733            // Decode the envelope for each type.
4734            let mut _next_ordinal_to_read = 0;
4735            let mut next_offset = offset;
4736            let end_offset = offset + bytes_len;
4737            _next_ordinal_to_read += 1;
4738            if next_offset >= end_offset {
4739                return Ok(());
4740            }
4741
4742            // Decode unknown envelopes for gaps in ordinals.
4743            while _next_ordinal_to_read < 1 {
4744                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4745                _next_ordinal_to_read += 1;
4746                next_offset += envelope_size;
4747            }
4748
4749            let next_out_of_line = decoder.next_out_of_line();
4750            let handles_before = decoder.remaining_handles();
4751            if let Some((inlined, num_bytes, num_handles)) =
4752                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4753            {
4754                let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_math::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4755                if inlined != (member_inline_size <= 4) {
4756                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4757                }
4758                let inner_offset;
4759                let mut inner_depth = depth.clone();
4760                if inlined {
4761                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4762                    inner_offset = next_offset;
4763                } else {
4764                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4765                    inner_depth.increment()?;
4766                }
4767                let val_ref = self.tap_locations.get_or_insert_with(
4768                    || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math::Vec_, 10>, D),
4769                );
4770                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4771                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4772                {
4773                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4774                }
4775                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4776                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4777                }
4778            }
4779
4780            next_offset += envelope_size;
4781
4782            // Decode the remaining unknown envelopes.
4783            while next_offset < end_offset {
4784                _next_ordinal_to_read += 1;
4785                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4786                next_offset += envelope_size;
4787            }
4788
4789            Ok(())
4790        }
4791    }
4792
4793    impl TouchScreenSimulateSwipeRequest {
4794        #[inline(always)]
4795        fn max_ordinal_present(&self) -> u64 {
4796            if let Some(_) = self.duration {
4797                return 4;
4798            }
4799            if let Some(_) = self.move_event_count {
4800                return 3;
4801            }
4802            if let Some(_) = self.end_location {
4803                return 2;
4804            }
4805            if let Some(_) = self.start_location {
4806                return 1;
4807            }
4808            0
4809        }
4810    }
4811
4812    impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateSwipeRequest {
4813        type Borrowed<'a> = &'a Self;
4814        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4815            value
4816        }
4817    }
4818
4819    unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateSwipeRequest {
4820        type Owned = Self;
4821
4822        #[inline(always)]
4823        fn inline_align(_context: fidl::encoding::Context) -> usize {
4824            8
4825        }
4826
4827        #[inline(always)]
4828        fn inline_size(_context: fidl::encoding::Context) -> usize {
4829            16
4830        }
4831    }
4832
4833    unsafe impl<D: fidl::encoding::ResourceDialect>
4834        fidl::encoding::Encode<TouchScreenSimulateSwipeRequest, D>
4835        for &TouchScreenSimulateSwipeRequest
4836    {
4837        unsafe fn encode(
4838            self,
4839            encoder: &mut fidl::encoding::Encoder<'_, D>,
4840            offset: usize,
4841            mut depth: fidl::encoding::Depth,
4842        ) -> fidl::Result<()> {
4843            encoder.debug_check_bounds::<TouchScreenSimulateSwipeRequest>(offset);
4844            // Vector header
4845            let max_ordinal: u64 = self.max_ordinal_present();
4846            encoder.write_num(max_ordinal, offset);
4847            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4848            // Calling encoder.out_of_line_offset(0) is not allowed.
4849            if max_ordinal == 0 {
4850                return Ok(());
4851            }
4852            depth.increment()?;
4853            let envelope_size = 8;
4854            let bytes_len = max_ordinal as usize * envelope_size;
4855            #[allow(unused_variables)]
4856            let offset = encoder.out_of_line_offset(bytes_len);
4857            let mut _prev_end_offset: usize = 0;
4858            if 1 > max_ordinal {
4859                return Ok(());
4860            }
4861
4862            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4863            // are envelope_size bytes.
4864            let cur_offset: usize = (1 - 1) * envelope_size;
4865
4866            // Zero reserved fields.
4867            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4868
4869            // Safety:
4870            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4871            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4872            //   envelope_size bytes, there is always sufficient room.
4873            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::Vec_, D>(
4874                self.start_location
4875                    .as_ref()
4876                    .map(<fidl_fuchsia_math::Vec_ as fidl::encoding::ValueTypeMarker>::borrow),
4877                encoder,
4878                offset + cur_offset,
4879                depth,
4880            )?;
4881
4882            _prev_end_offset = cur_offset + envelope_size;
4883            if 2 > max_ordinal {
4884                return Ok(());
4885            }
4886
4887            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4888            // are envelope_size bytes.
4889            let cur_offset: usize = (2 - 1) * envelope_size;
4890
4891            // Zero reserved fields.
4892            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4893
4894            // Safety:
4895            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4896            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4897            //   envelope_size bytes, there is always sufficient room.
4898            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::Vec_, D>(
4899                self.end_location
4900                    .as_ref()
4901                    .map(<fidl_fuchsia_math::Vec_ as fidl::encoding::ValueTypeMarker>::borrow),
4902                encoder,
4903                offset + cur_offset,
4904                depth,
4905            )?;
4906
4907            _prev_end_offset = cur_offset + envelope_size;
4908            if 3 > max_ordinal {
4909                return Ok(());
4910            }
4911
4912            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4913            // are envelope_size bytes.
4914            let cur_offset: usize = (3 - 1) * envelope_size;
4915
4916            // Zero reserved fields.
4917            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4918
4919            // Safety:
4920            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4921            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4922            //   envelope_size bytes, there is always sufficient room.
4923            fidl::encoding::encode_in_envelope_optional::<u32, D>(
4924                self.move_event_count
4925                    .as_ref()
4926                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4927                encoder,
4928                offset + cur_offset,
4929                depth,
4930            )?;
4931
4932            _prev_end_offset = cur_offset + envelope_size;
4933            if 4 > max_ordinal {
4934                return Ok(());
4935            }
4936
4937            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4938            // are envelope_size bytes.
4939            let cur_offset: usize = (4 - 1) * envelope_size;
4940
4941            // Zero reserved fields.
4942            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4943
4944            // Safety:
4945            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4946            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4947            //   envelope_size bytes, there is always sufficient room.
4948            fidl::encoding::encode_in_envelope_optional::<i64, D>(
4949                self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4950                encoder,
4951                offset + cur_offset,
4952                depth,
4953            )?;
4954
4955            _prev_end_offset = cur_offset + envelope_size;
4956
4957            Ok(())
4958        }
4959    }
4960
4961    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4962        for TouchScreenSimulateSwipeRequest
4963    {
4964        #[inline(always)]
4965        fn new_empty() -> Self {
4966            Self::default()
4967        }
4968
4969        unsafe fn decode(
4970            &mut self,
4971            decoder: &mut fidl::encoding::Decoder<'_, D>,
4972            offset: usize,
4973            mut depth: fidl::encoding::Depth,
4974        ) -> fidl::Result<()> {
4975            decoder.debug_check_bounds::<Self>(offset);
4976            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4977                None => return Err(fidl::Error::NotNullable),
4978                Some(len) => len,
4979            };
4980            // Calling decoder.out_of_line_offset(0) is not allowed.
4981            if len == 0 {
4982                return Ok(());
4983            };
4984            depth.increment()?;
4985            let envelope_size = 8;
4986            let bytes_len = len * envelope_size;
4987            let offset = decoder.out_of_line_offset(bytes_len)?;
4988            // Decode the envelope for each type.
4989            let mut _next_ordinal_to_read = 0;
4990            let mut next_offset = offset;
4991            let end_offset = offset + bytes_len;
4992            _next_ordinal_to_read += 1;
4993            if next_offset >= end_offset {
4994                return Ok(());
4995            }
4996
4997            // Decode unknown envelopes for gaps in ordinals.
4998            while _next_ordinal_to_read < 1 {
4999                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5000                _next_ordinal_to_read += 1;
5001                next_offset += envelope_size;
5002            }
5003
5004            let next_out_of_line = decoder.next_out_of_line();
5005            let handles_before = decoder.remaining_handles();
5006            if let Some((inlined, num_bytes, num_handles)) =
5007                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5008            {
5009                let member_inline_size =
5010                    <fidl_fuchsia_math::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5011                        decoder.context,
5012                    );
5013                if inlined != (member_inline_size <= 4) {
5014                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5015                }
5016                let inner_offset;
5017                let mut inner_depth = depth.clone();
5018                if inlined {
5019                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5020                    inner_offset = next_offset;
5021                } else {
5022                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5023                    inner_depth.increment()?;
5024                }
5025                let val_ref = self
5026                    .start_location
5027                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::Vec_, D));
5028                fidl::decode!(
5029                    fidl_fuchsia_math::Vec_,
5030                    D,
5031                    val_ref,
5032                    decoder,
5033                    inner_offset,
5034                    inner_depth
5035                )?;
5036                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5037                {
5038                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5039                }
5040                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5041                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5042                }
5043            }
5044
5045            next_offset += envelope_size;
5046            _next_ordinal_to_read += 1;
5047            if next_offset >= end_offset {
5048                return Ok(());
5049            }
5050
5051            // Decode unknown envelopes for gaps in ordinals.
5052            while _next_ordinal_to_read < 2 {
5053                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5054                _next_ordinal_to_read += 1;
5055                next_offset += envelope_size;
5056            }
5057
5058            let next_out_of_line = decoder.next_out_of_line();
5059            let handles_before = decoder.remaining_handles();
5060            if let Some((inlined, num_bytes, num_handles)) =
5061                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5062            {
5063                let member_inline_size =
5064                    <fidl_fuchsia_math::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5065                        decoder.context,
5066                    );
5067                if inlined != (member_inline_size <= 4) {
5068                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5069                }
5070                let inner_offset;
5071                let mut inner_depth = depth.clone();
5072                if inlined {
5073                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5074                    inner_offset = next_offset;
5075                } else {
5076                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5077                    inner_depth.increment()?;
5078                }
5079                let val_ref = self
5080                    .end_location
5081                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::Vec_, D));
5082                fidl::decode!(
5083                    fidl_fuchsia_math::Vec_,
5084                    D,
5085                    val_ref,
5086                    decoder,
5087                    inner_offset,
5088                    inner_depth
5089                )?;
5090                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5091                {
5092                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5093                }
5094                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5095                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5096                }
5097            }
5098
5099            next_offset += envelope_size;
5100            _next_ordinal_to_read += 1;
5101            if next_offset >= end_offset {
5102                return Ok(());
5103            }
5104
5105            // Decode unknown envelopes for gaps in ordinals.
5106            while _next_ordinal_to_read < 3 {
5107                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5108                _next_ordinal_to_read += 1;
5109                next_offset += envelope_size;
5110            }
5111
5112            let next_out_of_line = decoder.next_out_of_line();
5113            let handles_before = decoder.remaining_handles();
5114            if let Some((inlined, num_bytes, num_handles)) =
5115                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5116            {
5117                let member_inline_size =
5118                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5119                if inlined != (member_inline_size <= 4) {
5120                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5121                }
5122                let inner_offset;
5123                let mut inner_depth = depth.clone();
5124                if inlined {
5125                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5126                    inner_offset = next_offset;
5127                } else {
5128                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5129                    inner_depth.increment()?;
5130                }
5131                let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5132                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5133                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5134                {
5135                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5136                }
5137                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5138                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5139                }
5140            }
5141
5142            next_offset += envelope_size;
5143            _next_ordinal_to_read += 1;
5144            if next_offset >= end_offset {
5145                return Ok(());
5146            }
5147
5148            // Decode unknown envelopes for gaps in ordinals.
5149            while _next_ordinal_to_read < 4 {
5150                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5151                _next_ordinal_to_read += 1;
5152                next_offset += envelope_size;
5153            }
5154
5155            let next_out_of_line = decoder.next_out_of_line();
5156            let handles_before = decoder.remaining_handles();
5157            if let Some((inlined, num_bytes, num_handles)) =
5158                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5159            {
5160                let member_inline_size =
5161                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5162                if inlined != (member_inline_size <= 4) {
5163                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5164                }
5165                let inner_offset;
5166                let mut inner_depth = depth.clone();
5167                if inlined {
5168                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5169                    inner_offset = next_offset;
5170                } else {
5171                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5172                    inner_depth.increment()?;
5173                }
5174                let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
5175                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5176                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5177                {
5178                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5179                }
5180                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5181                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5182                }
5183            }
5184
5185            next_offset += envelope_size;
5186
5187            // Decode the remaining unknown envelopes.
5188            while next_offset < end_offset {
5189                _next_ordinal_to_read += 1;
5190                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5191                next_offset += envelope_size;
5192            }
5193
5194            Ok(())
5195        }
5196    }
5197
5198    impl TouchScreenSimulateTapRequest {
5199        #[inline(always)]
5200        fn max_ordinal_present(&self) -> u64 {
5201            if let Some(_) = self.tap_location {
5202                return 1;
5203            }
5204            0
5205        }
5206    }
5207
5208    impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTapRequest {
5209        type Borrowed<'a> = &'a Self;
5210        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5211            value
5212        }
5213    }
5214
5215    unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTapRequest {
5216        type Owned = Self;
5217
5218        #[inline(always)]
5219        fn inline_align(_context: fidl::encoding::Context) -> usize {
5220            8
5221        }
5222
5223        #[inline(always)]
5224        fn inline_size(_context: fidl::encoding::Context) -> usize {
5225            16
5226        }
5227    }
5228
5229    unsafe impl<D: fidl::encoding::ResourceDialect>
5230        fidl::encoding::Encode<TouchScreenSimulateTapRequest, D>
5231        for &TouchScreenSimulateTapRequest
5232    {
5233        unsafe fn encode(
5234            self,
5235            encoder: &mut fidl::encoding::Encoder<'_, D>,
5236            offset: usize,
5237            mut depth: fidl::encoding::Depth,
5238        ) -> fidl::Result<()> {
5239            encoder.debug_check_bounds::<TouchScreenSimulateTapRequest>(offset);
5240            // Vector header
5241            let max_ordinal: u64 = self.max_ordinal_present();
5242            encoder.write_num(max_ordinal, offset);
5243            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5244            // Calling encoder.out_of_line_offset(0) is not allowed.
5245            if max_ordinal == 0 {
5246                return Ok(());
5247            }
5248            depth.increment()?;
5249            let envelope_size = 8;
5250            let bytes_len = max_ordinal as usize * envelope_size;
5251            #[allow(unused_variables)]
5252            let offset = encoder.out_of_line_offset(bytes_len);
5253            let mut _prev_end_offset: usize = 0;
5254            if 1 > max_ordinal {
5255                return Ok(());
5256            }
5257
5258            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5259            // are envelope_size bytes.
5260            let cur_offset: usize = (1 - 1) * envelope_size;
5261
5262            // Zero reserved fields.
5263            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5264
5265            // Safety:
5266            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5267            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5268            //   envelope_size bytes, there is always sufficient room.
5269            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math::Vec_, D>(
5270                self.tap_location
5271                    .as_ref()
5272                    .map(<fidl_fuchsia_math::Vec_ as fidl::encoding::ValueTypeMarker>::borrow),
5273                encoder,
5274                offset + cur_offset,
5275                depth,
5276            )?;
5277
5278            _prev_end_offset = cur_offset + envelope_size;
5279
5280            Ok(())
5281        }
5282    }
5283
5284    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5285        for TouchScreenSimulateTapRequest
5286    {
5287        #[inline(always)]
5288        fn new_empty() -> Self {
5289            Self::default()
5290        }
5291
5292        unsafe fn decode(
5293            &mut self,
5294            decoder: &mut fidl::encoding::Decoder<'_, D>,
5295            offset: usize,
5296            mut depth: fidl::encoding::Depth,
5297        ) -> fidl::Result<()> {
5298            decoder.debug_check_bounds::<Self>(offset);
5299            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5300                None => return Err(fidl::Error::NotNullable),
5301                Some(len) => len,
5302            };
5303            // Calling decoder.out_of_line_offset(0) is not allowed.
5304            if len == 0 {
5305                return Ok(());
5306            };
5307            depth.increment()?;
5308            let envelope_size = 8;
5309            let bytes_len = len * envelope_size;
5310            let offset = decoder.out_of_line_offset(bytes_len)?;
5311            // Decode the envelope for each type.
5312            let mut _next_ordinal_to_read = 0;
5313            let mut next_offset = offset;
5314            let end_offset = offset + bytes_len;
5315            _next_ordinal_to_read += 1;
5316            if next_offset >= end_offset {
5317                return Ok(());
5318            }
5319
5320            // Decode unknown envelopes for gaps in ordinals.
5321            while _next_ordinal_to_read < 1 {
5322                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5323                _next_ordinal_to_read += 1;
5324                next_offset += envelope_size;
5325            }
5326
5327            let next_out_of_line = decoder.next_out_of_line();
5328            let handles_before = decoder.remaining_handles();
5329            if let Some((inlined, num_bytes, num_handles)) =
5330                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5331            {
5332                let member_inline_size =
5333                    <fidl_fuchsia_math::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5334                        decoder.context,
5335                    );
5336                if inlined != (member_inline_size <= 4) {
5337                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5338                }
5339                let inner_offset;
5340                let mut inner_depth = depth.clone();
5341                if inlined {
5342                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5343                    inner_offset = next_offset;
5344                } else {
5345                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5346                    inner_depth.increment()?;
5347                }
5348                let val_ref = self
5349                    .tap_location
5350                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math::Vec_, D));
5351                fidl::decode!(
5352                    fidl_fuchsia_math::Vec_,
5353                    D,
5354                    val_ref,
5355                    decoder,
5356                    inner_offset,
5357                    inner_depth
5358                )?;
5359                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5360                {
5361                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5362                }
5363                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5364                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5365                }
5366            }
5367
5368            next_offset += envelope_size;
5369
5370            // Decode the remaining unknown envelopes.
5371            while next_offset < end_offset {
5372                _next_ordinal_to_read += 1;
5373                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5374                next_offset += envelope_size;
5375            }
5376
5377            Ok(())
5378        }
5379    }
5380}