1#![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
13pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
16
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
20pub enum CoordinateUnit {
21 Default,
28 PhysicalPixels,
41 RegisteredDimensions,
44 #[doc(hidden)]
45 __SourceBreaking { unknown_ordinal: u32 },
46}
47
48#[macro_export]
50macro_rules! CoordinateUnitUnknown {
51 () => {
52 _
53 };
54}
55
56impl CoordinateUnit {
57 #[inline]
58 pub fn from_primitive(prim: u32) -> Option<Self> {
59 match prim {
60 0 => Some(Self::Default),
61 1 => Some(Self::PhysicalPixels),
62 2 => Some(Self::RegisteredDimensions),
63 _ => None,
64 }
65 }
66
67 #[inline]
68 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
69 match prim {
70 0 => Self::Default,
71 1 => Self::PhysicalPixels,
72 2 => Self::RegisteredDimensions,
73 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
74 }
75 }
76
77 #[inline]
78 pub fn unknown() -> Self {
79 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
80 }
81
82 #[inline]
83 pub const fn into_primitive(self) -> u32 {
84 match self {
85 Self::Default => 0,
86 Self::PhysicalPixels => 1,
87 Self::RegisteredDimensions => 2,
88 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
89 }
90 }
91
92 #[inline]
93 pub fn is_unknown(&self) -> bool {
94 match self {
95 Self::__SourceBreaking { unknown_ordinal: _ } => true,
96 _ => false,
97 }
98 }
99}
100
101#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
103pub enum MouseButton {
104 First,
106 Second,
108 Third,
110 #[doc(hidden)]
111 __SourceBreaking { unknown_ordinal: u32 },
112}
113
114#[macro_export]
116macro_rules! MouseButtonUnknown {
117 () => {
118 _
119 };
120}
121
122impl MouseButton {
123 #[inline]
124 pub fn from_primitive(prim: u32) -> Option<Self> {
125 match prim {
126 0 => Some(Self::First),
127 1 => Some(Self::Second),
128 2 => Some(Self::Third),
129 _ => None,
130 }
131 }
132
133 #[inline]
134 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
135 match prim {
136 0 => Self::First,
137 1 => Self::Second,
138 2 => Self::Third,
139 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
140 }
141 }
142
143 #[inline]
144 pub fn unknown() -> Self {
145 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
146 }
147
148 #[inline]
149 pub const fn into_primitive(self) -> u32 {
150 match self {
151 Self::First => 0,
152 Self::Second => 1,
153 Self::Third => 2,
154 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
155 }
156 }
157
158 #[inline]
159 pub fn is_unknown(&self) -> bool {
160 match self {
161 Self::__SourceBreaking { unknown_ordinal: _ } => true,
162 _ => false,
163 }
164 }
165}
166
167#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
169pub enum MouseEventPhase {
170 Add,
172 Hover,
175 Down,
177 Move,
179 Up,
181 Wheel,
183 #[doc(hidden)]
184 __SourceBreaking { unknown_ordinal: u32 },
185}
186
187#[macro_export]
189macro_rules! MouseEventPhaseUnknown {
190 () => {
191 _
192 };
193}
194
195impl MouseEventPhase {
196 #[inline]
197 pub fn from_primitive(prim: u32) -> Option<Self> {
198 match prim {
199 0 => Some(Self::Add),
200 1 => Some(Self::Hover),
201 2 => Some(Self::Down),
202 3 => Some(Self::Move),
203 4 => Some(Self::Up),
204 5 => Some(Self::Wheel),
205 _ => None,
206 }
207 }
208
209 #[inline]
210 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
211 match prim {
212 0 => Self::Add,
213 1 => Self::Hover,
214 2 => Self::Down,
215 3 => Self::Move,
216 4 => Self::Up,
217 5 => Self::Wheel,
218 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
219 }
220 }
221
222 #[inline]
223 pub fn unknown() -> Self {
224 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
225 }
226
227 #[inline]
228 pub const fn into_primitive(self) -> u32 {
229 match self {
230 Self::Add => 0,
231 Self::Hover => 1,
232 Self::Down => 2,
233 Self::Move => 3,
234 Self::Up => 4,
235 Self::Wheel => 5,
236 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
237 }
238 }
239
240 #[inline]
241 pub fn is_unknown(&self) -> bool {
242 match self {
243 Self::__SourceBreaking { unknown_ordinal: _ } => true,
244 _ => false,
245 }
246 }
247}
248
249#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
250pub enum TestAppStatus {
251 HandlersRegistered,
255 ElementFocused,
260 #[doc(hidden)]
261 __SourceBreaking { unknown_ordinal: u16 },
262}
263
264#[macro_export]
266macro_rules! TestAppStatusUnknown {
267 () => {
268 _
269 };
270}
271
272impl TestAppStatus {
273 #[inline]
274 pub fn from_primitive(prim: u16) -> Option<Self> {
275 match prim {
276 1 => Some(Self::HandlersRegistered),
277 2 => Some(Self::ElementFocused),
278 _ => None,
279 }
280 }
281
282 #[inline]
283 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
284 match prim {
285 1 => Self::HandlersRegistered,
286 2 => Self::ElementFocused,
287 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
288 }
289 }
290
291 #[inline]
292 pub fn unknown() -> Self {
293 Self::__SourceBreaking { unknown_ordinal: 0xffff }
294 }
295
296 #[inline]
297 pub const fn into_primitive(self) -> u16 {
298 match self {
299 Self::HandlersRegistered => 1,
300 Self::ElementFocused => 2,
301 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
302 }
303 }
304
305 #[inline]
306 pub fn is_unknown(&self) -> bool {
307 match self {
308 Self::__SourceBreaking { unknown_ordinal: _ } => true,
309 _ => false,
310 }
311 }
312}
313
314#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
315#[repr(C)]
316pub struct DisplayDimensions {
317 pub min_x: i64,
319 pub min_y: i64,
321 pub max_x: i64,
323 pub max_y: i64,
325}
326
327impl fidl::Persistable for DisplayDimensions {}
328
329#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
330pub struct TestAppStatusListenerReportStatusRequest {
331 pub status: TestAppStatus,
332}
333
334impl fidl::Persistable for TestAppStatusListenerReportStatusRequest {}
335
336#[derive(Clone, Debug, PartialEq)]
337pub struct TouchScreenSimulateTouchEventRequest {
338 pub report: fidl_fuchsia_input_report__common::TouchInputReport,
339}
340
341impl fidl::Persistable for TouchScreenSimulateTouchEventRequest {}
342
343#[derive(Clone, Debug, Default, PartialEq)]
344pub struct KeyboardInputListenerReportTextInputRequest {
345 pub text: Option<String>,
347 pub non_printable: Option<fidl_fuchsia_ui_input3__common::NonPrintableKey>,
349 pub device_id: Option<u32>,
350 #[doc(hidden)]
351 pub __source_breaking: fidl::marker::SourceBreaking,
352}
353
354impl fidl::Persistable for KeyboardInputListenerReportTextInputRequest {}
355
356#[derive(Clone, Debug, Default, PartialEq)]
357pub struct KeyboardSimulateKeyEventRequest {
358 pub report: Option<fidl_fuchsia_input_report__common::KeyboardInputReport>,
359 #[doc(hidden)]
360 pub __source_breaking: fidl::marker::SourceBreaking,
361}
362
363impl fidl::Persistable for KeyboardSimulateKeyEventRequest {}
364
365#[derive(Clone, Debug, Default, PartialEq)]
366pub struct KeyboardSimulateKeyPressRequest {
367 pub key_code: Option<fidl_fuchsia_input__common::Key>,
368 #[doc(hidden)]
369 pub __source_breaking: fidl::marker::SourceBreaking,
370}
371
372impl fidl::Persistable for KeyboardSimulateKeyPressRequest {}
373
374#[derive(Clone, Debug, Default, PartialEq)]
375pub struct KeyboardSimulateUsAsciiTextEntryRequest {
376 pub text: Option<String>,
377 #[doc(hidden)]
378 pub __source_breaking: fidl::marker::SourceBreaking,
379}
380
381impl fidl::Persistable for KeyboardSimulateUsAsciiTextEntryRequest {}
382
383#[derive(Clone, Debug, Default, PartialEq)]
384pub struct MediaButtonsDeviceScheduleSimulateButtonPressRequest {
385 pub button: Option<fidl_fuchsia_input_report__common::ConsumerControlButton>,
387 pub delay: Option<i64>,
389 #[doc(hidden)]
390 pub __source_breaking: fidl::marker::SourceBreaking,
391}
392
393impl fidl::Persistable for MediaButtonsDeviceScheduleSimulateButtonPressRequest {}
394
395#[derive(Clone, Debug, Default, PartialEq)]
396pub struct MediaButtonsDeviceSendButtonsStateRequest {
397 pub buttons: Option<Vec<fidl_fuchsia_input_report__common::ConsumerControlButton>>,
399 #[doc(hidden)]
400 pub __source_breaking: fidl::marker::SourceBreaking,
401}
402
403impl fidl::Persistable for MediaButtonsDeviceSendButtonsStateRequest {}
404
405#[derive(Clone, Debug, Default, PartialEq)]
406pub struct MediaButtonsDeviceSimulateButtonPressRequest {
407 pub button: Option<fidl_fuchsia_input_report__common::ConsumerControlButton>,
409 #[doc(hidden)]
410 pub __source_breaking: fidl::marker::SourceBreaking,
411}
412
413impl fidl::Persistable for MediaButtonsDeviceSimulateButtonPressRequest {}
414
415#[derive(Clone, Debug, Default, PartialEq)]
416pub struct MouseInputListenerReportMouseInputRequest {
417 pub local_x: Option<f64>,
419 pub local_y: Option<f64>,
421 pub time_received: Option<i64>,
425 pub component_name: Option<String>,
430 pub buttons: Option<Vec<MouseButton>>,
432 pub phase: Option<MouseEventPhase>,
434 pub device_pixel_ratio: Option<f64>,
439 pub wheel_x_physical_pixel: Option<f64>,
441 pub wheel_y_physical_pixel: Option<f64>,
443 pub device_id: Option<u32>,
444 #[doc(hidden)]
445 pub __source_breaking: fidl::marker::SourceBreaking,
446}
447
448impl fidl::Persistable for MouseInputListenerReportMouseInputRequest {}
449
450#[derive(Clone, Debug, Default, PartialEq)]
451pub struct MouseSimulateMouseEventRequest {
452 pub pressed_buttons: Option<Vec<MouseButton>>,
455 pub movement_x: Option<i64>,
457 pub movement_y: Option<i64>,
459 pub scroll_v_detent: Option<i64>,
461 pub scroll_h_detent: Option<i64>,
463 pub scroll_v_physical_pixel: Option<f64>,
466 pub scroll_h_physical_pixel: Option<f64>,
469 #[doc(hidden)]
470 pub __source_breaking: fidl::marker::SourceBreaking,
471}
472
473impl fidl::Persistable for MouseSimulateMouseEventRequest {}
474
475#[derive(Clone, Debug, Default, PartialEq)]
476pub struct TouchInputListenerReportTouchInputRequest {
477 pub local_x: Option<f64>,
479 pub local_y: Option<f64>,
481 pub time_received: Option<i64>,
485 pub device_pixel_ratio: Option<f64>,
487 pub component_name: Option<String>,
492 pub phase: Option<fidl_fuchsia_ui_pointer__common::EventPhase>,
494 pub pointer_id: Option<u32>,
498 pub device_id: Option<u32>,
499 #[doc(hidden)]
500 pub __source_breaking: fidl::marker::SourceBreaking,
501}
502
503impl fidl::Persistable for TouchInputListenerReportTouchInputRequest {}
504
505#[derive(Clone, Debug, Default, PartialEq)]
506pub struct TouchScreenSimulateMultiFingerGestureRequest {
507 pub start_locations: Option<[fidl_fuchsia_math__common::Vec_; 10]>,
510 pub end_locations: Option<[fidl_fuchsia_math__common::Vec_; 10]>,
513 pub move_event_count: Option<u32>,
515 pub finger_count: Option<u32>,
518 #[doc(hidden)]
519 pub __source_breaking: fidl::marker::SourceBreaking,
520}
521
522impl fidl::Persistable for TouchScreenSimulateMultiFingerGestureRequest {}
523
524#[derive(Clone, Debug, Default, PartialEq)]
525pub struct TouchScreenSimulateMultiTapRequest {
526 pub tap_locations: Option<Vec<fidl_fuchsia_math__common::Vec_>>,
529 #[doc(hidden)]
530 pub __source_breaking: fidl::marker::SourceBreaking,
531}
532
533impl fidl::Persistable for TouchScreenSimulateMultiTapRequest {}
534
535#[derive(Clone, Debug, Default, PartialEq)]
536pub struct TouchScreenSimulateSwipeRequest {
537 pub start_location: Option<fidl_fuchsia_math__common::Vec_>,
540 pub end_location: Option<fidl_fuchsia_math__common::Vec_>,
543 pub move_event_count: Option<u32>,
545 pub duration: Option<i64>,
550 #[doc(hidden)]
551 pub __source_breaking: fidl::marker::SourceBreaking,
552}
553
554impl fidl::Persistable for TouchScreenSimulateSwipeRequest {}
555
556#[derive(Clone, Debug, Default, PartialEq)]
557pub struct TouchScreenSimulateTapRequest {
558 pub tap_location: Option<fidl_fuchsia_math__common::Vec_>,
561 #[doc(hidden)]
562 pub __source_breaking: fidl::marker::SourceBreaking,
563}
564
565impl fidl::Persistable for TouchScreenSimulateTapRequest {}
566
567pub mod keyboard_ordinals {
568 pub const SIMULATE_US_ASCII_TEXT_ENTRY: u64 = 0x7111724d25453cfb;
569 pub const SIMULATE_KEY_EVENT: u64 = 0x23e0ae9874a68211;
570 pub const SIMULATE_KEY_PRESS: u64 = 0xb3ba0ef4996ebaf;
571}
572
573pub mod keyboard_input_listener_ordinals {
574 pub const REPORT_READY: u64 = 0x4b7f18cd3570971b;
575 pub const REPORT_TEXT_INPUT: u64 = 0x4d53b1fe481185d1;
576}
577
578pub mod media_buttons_device_ordinals {
579 pub const SIMULATE_BUTTON_PRESS: u64 = 0x256d8b895296c5b2;
580 pub const SEND_BUTTONS_STATE: u64 = 0x254fc23643cdef6b;
581 pub const SCHEDULE_SIMULATE_BUTTON_PRESS: u64 = 0x6ea3a2530301eca;
582}
583
584pub mod mouse_ordinals {
585 pub const SIMULATE_MOUSE_EVENT: u64 = 0x55c55dcd35c8768f;
586}
587
588pub mod mouse_input_listener_ordinals {
589 pub const REPORT_MOUSE_INPUT: u64 = 0x78182130ca3aff13;
590}
591
592pub mod registry_ordinals {
593 pub const REGISTER_TOUCH_SCREEN: u64 = 0x406fb450685ecb73;
594 pub const REGISTER_TOUCH_SCREEN_AND_GET_DEVICE_INFO: u64 = 0x2e8df048a411ed2b;
595 pub const REGISTER_MEDIA_BUTTONS_DEVICE: u64 = 0x3a0b22e6d40e9629;
596 pub const REGISTER_MEDIA_BUTTONS_DEVICE_AND_GET_DEVICE_INFO: u64 = 0x15fb627d190ebd73;
597 pub const REGISTER_KEYBOARD: u64 = 0x291c697601404b38;
598 pub const REGISTER_KEYBOARD_AND_GET_DEVICE_INFO: u64 = 0x1e4edc6c56d2ac7e;
599 pub const REGISTER_MOUSE: u64 = 0xf330169355a1add;
600 pub const REGISTER_MOUSE_AND_GET_DEVICE_INFO: u64 = 0x34aa807670bbae29;
601}
602
603pub mod test_app_status_listener_ordinals {
604 pub const REPORT_STATUS: u64 = 0x6bde93eb7bb3da54;
605}
606
607pub mod touch_input_listener_ordinals {
608 pub const REPORT_TOUCH_INPUT: u64 = 0x371dcd048ac842aa;
609}
610
611pub mod touch_screen_ordinals {
612 pub const SIMULATE_TAP: u64 = 0x2301a93caf2527fd;
613 pub const SIMULATE_MULTI_TAP: u64 = 0x101f5014bda76352;
614 pub const SIMULATE_SWIPE: u64 = 0xcebf566f3f489e4;
615 pub const SIMULATE_MULTI_FINGER_GESTURE: u64 = 0x426074401c1f212b;
616 pub const SIMULATE_TOUCH_EVENT: u64 = 0x557ab909d22a837d;
617}
618
619mod internal {
620 use super::*;
621 unsafe impl fidl::encoding::TypeMarker for CoordinateUnit {
622 type Owned = Self;
623
624 #[inline(always)]
625 fn inline_align(_context: fidl::encoding::Context) -> usize {
626 std::mem::align_of::<u32>()
627 }
628
629 #[inline(always)]
630 fn inline_size(_context: fidl::encoding::Context) -> usize {
631 std::mem::size_of::<u32>()
632 }
633
634 #[inline(always)]
635 fn encode_is_copy() -> bool {
636 false
637 }
638
639 #[inline(always)]
640 fn decode_is_copy() -> bool {
641 false
642 }
643 }
644
645 impl fidl::encoding::ValueTypeMarker for CoordinateUnit {
646 type Borrowed<'a> = Self;
647 #[inline(always)]
648 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
649 *value
650 }
651 }
652
653 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CoordinateUnit {
654 #[inline]
655 unsafe fn encode(
656 self,
657 encoder: &mut fidl::encoding::Encoder<'_, D>,
658 offset: usize,
659 _depth: fidl::encoding::Depth,
660 ) -> fidl::Result<()> {
661 encoder.debug_check_bounds::<Self>(offset);
662 encoder.write_num(self.into_primitive(), offset);
663 Ok(())
664 }
665 }
666
667 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoordinateUnit {
668 #[inline(always)]
669 fn new_empty() -> Self {
670 Self::unknown()
671 }
672
673 #[inline]
674 unsafe fn decode(
675 &mut self,
676 decoder: &mut fidl::encoding::Decoder<'_, D>,
677 offset: usize,
678 _depth: fidl::encoding::Depth,
679 ) -> fidl::Result<()> {
680 decoder.debug_check_bounds::<Self>(offset);
681 let prim = decoder.read_num::<u32>(offset);
682
683 *self = Self::from_primitive_allow_unknown(prim);
684 Ok(())
685 }
686 }
687 unsafe impl fidl::encoding::TypeMarker for MouseButton {
688 type Owned = Self;
689
690 #[inline(always)]
691 fn inline_align(_context: fidl::encoding::Context) -> usize {
692 std::mem::align_of::<u32>()
693 }
694
695 #[inline(always)]
696 fn inline_size(_context: fidl::encoding::Context) -> usize {
697 std::mem::size_of::<u32>()
698 }
699
700 #[inline(always)]
701 fn encode_is_copy() -> bool {
702 false
703 }
704
705 #[inline(always)]
706 fn decode_is_copy() -> bool {
707 false
708 }
709 }
710
711 impl fidl::encoding::ValueTypeMarker for MouseButton {
712 type Borrowed<'a> = Self;
713 #[inline(always)]
714 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
715 *value
716 }
717 }
718
719 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MouseButton {
720 #[inline]
721 unsafe fn encode(
722 self,
723 encoder: &mut fidl::encoding::Encoder<'_, D>,
724 offset: usize,
725 _depth: fidl::encoding::Depth,
726 ) -> fidl::Result<()> {
727 encoder.debug_check_bounds::<Self>(offset);
728 encoder.write_num(self.into_primitive(), offset);
729 Ok(())
730 }
731 }
732
733 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseButton {
734 #[inline(always)]
735 fn new_empty() -> Self {
736 Self::unknown()
737 }
738
739 #[inline]
740 unsafe fn decode(
741 &mut self,
742 decoder: &mut fidl::encoding::Decoder<'_, D>,
743 offset: usize,
744 _depth: fidl::encoding::Depth,
745 ) -> fidl::Result<()> {
746 decoder.debug_check_bounds::<Self>(offset);
747 let prim = decoder.read_num::<u32>(offset);
748
749 *self = Self::from_primitive_allow_unknown(prim);
750 Ok(())
751 }
752 }
753 unsafe impl fidl::encoding::TypeMarker for MouseEventPhase {
754 type Owned = Self;
755
756 #[inline(always)]
757 fn inline_align(_context: fidl::encoding::Context) -> usize {
758 std::mem::align_of::<u32>()
759 }
760
761 #[inline(always)]
762 fn inline_size(_context: fidl::encoding::Context) -> usize {
763 std::mem::size_of::<u32>()
764 }
765
766 #[inline(always)]
767 fn encode_is_copy() -> bool {
768 false
769 }
770
771 #[inline(always)]
772 fn decode_is_copy() -> bool {
773 false
774 }
775 }
776
777 impl fidl::encoding::ValueTypeMarker for MouseEventPhase {
778 type Borrowed<'a> = Self;
779 #[inline(always)]
780 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
781 *value
782 }
783 }
784
785 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
786 for MouseEventPhase
787 {
788 #[inline]
789 unsafe fn encode(
790 self,
791 encoder: &mut fidl::encoding::Encoder<'_, D>,
792 offset: usize,
793 _depth: fidl::encoding::Depth,
794 ) -> fidl::Result<()> {
795 encoder.debug_check_bounds::<Self>(offset);
796 encoder.write_num(self.into_primitive(), offset);
797 Ok(())
798 }
799 }
800
801 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseEventPhase {
802 #[inline(always)]
803 fn new_empty() -> Self {
804 Self::unknown()
805 }
806
807 #[inline]
808 unsafe fn decode(
809 &mut self,
810 decoder: &mut fidl::encoding::Decoder<'_, D>,
811 offset: usize,
812 _depth: fidl::encoding::Depth,
813 ) -> fidl::Result<()> {
814 decoder.debug_check_bounds::<Self>(offset);
815 let prim = decoder.read_num::<u32>(offset);
816
817 *self = Self::from_primitive_allow_unknown(prim);
818 Ok(())
819 }
820 }
821 unsafe impl fidl::encoding::TypeMarker for TestAppStatus {
822 type Owned = Self;
823
824 #[inline(always)]
825 fn inline_align(_context: fidl::encoding::Context) -> usize {
826 std::mem::align_of::<u16>()
827 }
828
829 #[inline(always)]
830 fn inline_size(_context: fidl::encoding::Context) -> usize {
831 std::mem::size_of::<u16>()
832 }
833
834 #[inline(always)]
835 fn encode_is_copy() -> bool {
836 false
837 }
838
839 #[inline(always)]
840 fn decode_is_copy() -> bool {
841 false
842 }
843 }
844
845 impl fidl::encoding::ValueTypeMarker for TestAppStatus {
846 type Borrowed<'a> = Self;
847 #[inline(always)]
848 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
849 *value
850 }
851 }
852
853 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TestAppStatus {
854 #[inline]
855 unsafe fn encode(
856 self,
857 encoder: &mut fidl::encoding::Encoder<'_, D>,
858 offset: usize,
859 _depth: fidl::encoding::Depth,
860 ) -> fidl::Result<()> {
861 encoder.debug_check_bounds::<Self>(offset);
862 encoder.write_num(self.into_primitive(), offset);
863 Ok(())
864 }
865 }
866
867 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestAppStatus {
868 #[inline(always)]
869 fn new_empty() -> Self {
870 Self::unknown()
871 }
872
873 #[inline]
874 unsafe fn decode(
875 &mut self,
876 decoder: &mut fidl::encoding::Decoder<'_, D>,
877 offset: usize,
878 _depth: fidl::encoding::Depth,
879 ) -> fidl::Result<()> {
880 decoder.debug_check_bounds::<Self>(offset);
881 let prim = decoder.read_num::<u16>(offset);
882
883 *self = Self::from_primitive_allow_unknown(prim);
884 Ok(())
885 }
886 }
887
888 impl fidl::encoding::ValueTypeMarker for DisplayDimensions {
889 type Borrowed<'a> = &'a Self;
890 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
891 value
892 }
893 }
894
895 unsafe impl fidl::encoding::TypeMarker for DisplayDimensions {
896 type Owned = Self;
897
898 #[inline(always)]
899 fn inline_align(_context: fidl::encoding::Context) -> usize {
900 8
901 }
902
903 #[inline(always)]
904 fn inline_size(_context: fidl::encoding::Context) -> usize {
905 32
906 }
907 #[inline(always)]
908 fn encode_is_copy() -> bool {
909 true
910 }
911
912 #[inline(always)]
913 fn decode_is_copy() -> bool {
914 true
915 }
916 }
917
918 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisplayDimensions, D>
919 for &DisplayDimensions
920 {
921 #[inline]
922 unsafe fn encode(
923 self,
924 encoder: &mut fidl::encoding::Encoder<'_, D>,
925 offset: usize,
926 _depth: fidl::encoding::Depth,
927 ) -> fidl::Result<()> {
928 encoder.debug_check_bounds::<DisplayDimensions>(offset);
929 unsafe {
930 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
932 (buf_ptr as *mut DisplayDimensions)
933 .write_unaligned((self as *const DisplayDimensions).read());
934 }
937 Ok(())
938 }
939 }
940 unsafe impl<
941 D: fidl::encoding::ResourceDialect,
942 T0: fidl::encoding::Encode<i64, D>,
943 T1: fidl::encoding::Encode<i64, D>,
944 T2: fidl::encoding::Encode<i64, D>,
945 T3: fidl::encoding::Encode<i64, D>,
946 > fidl::encoding::Encode<DisplayDimensions, D> for (T0, T1, T2, T3)
947 {
948 #[inline]
949 unsafe fn encode(
950 self,
951 encoder: &mut fidl::encoding::Encoder<'_, D>,
952 offset: usize,
953 depth: fidl::encoding::Depth,
954 ) -> fidl::Result<()> {
955 encoder.debug_check_bounds::<DisplayDimensions>(offset);
956 self.0.encode(encoder, offset + 0, depth)?;
960 self.1.encode(encoder, offset + 8, depth)?;
961 self.2.encode(encoder, offset + 16, depth)?;
962 self.3.encode(encoder, offset + 24, depth)?;
963 Ok(())
964 }
965 }
966
967 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisplayDimensions {
968 #[inline(always)]
969 fn new_empty() -> Self {
970 Self {
971 min_x: fidl::new_empty!(i64, D),
972 min_y: fidl::new_empty!(i64, D),
973 max_x: fidl::new_empty!(i64, D),
974 max_y: fidl::new_empty!(i64, D),
975 }
976 }
977
978 #[inline]
979 unsafe fn decode(
980 &mut self,
981 decoder: &mut fidl::encoding::Decoder<'_, D>,
982 offset: usize,
983 _depth: fidl::encoding::Depth,
984 ) -> fidl::Result<()> {
985 decoder.debug_check_bounds::<Self>(offset);
986 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
987 unsafe {
990 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
991 }
992 Ok(())
993 }
994 }
995
996 impl fidl::encoding::ValueTypeMarker for TestAppStatusListenerReportStatusRequest {
997 type Borrowed<'a> = &'a Self;
998 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
999 value
1000 }
1001 }
1002
1003 unsafe impl fidl::encoding::TypeMarker for TestAppStatusListenerReportStatusRequest {
1004 type Owned = Self;
1005
1006 #[inline(always)]
1007 fn inline_align(_context: fidl::encoding::Context) -> usize {
1008 2
1009 }
1010
1011 #[inline(always)]
1012 fn inline_size(_context: fidl::encoding::Context) -> usize {
1013 2
1014 }
1015 }
1016
1017 unsafe impl<D: fidl::encoding::ResourceDialect>
1018 fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D>
1019 for &TestAppStatusListenerReportStatusRequest
1020 {
1021 #[inline]
1022 unsafe fn encode(
1023 self,
1024 encoder: &mut fidl::encoding::Encoder<'_, D>,
1025 offset: usize,
1026 _depth: fidl::encoding::Depth,
1027 ) -> fidl::Result<()> {
1028 encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
1029 fidl::encoding::Encode::<TestAppStatusListenerReportStatusRequest, D>::encode(
1031 (<TestAppStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
1032 encoder,
1033 offset,
1034 _depth,
1035 )
1036 }
1037 }
1038 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestAppStatus, D>>
1039 fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D> for (T0,)
1040 {
1041 #[inline]
1042 unsafe fn encode(
1043 self,
1044 encoder: &mut fidl::encoding::Encoder<'_, D>,
1045 offset: usize,
1046 depth: fidl::encoding::Depth,
1047 ) -> fidl::Result<()> {
1048 encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
1049 self.0.encode(encoder, offset + 0, depth)?;
1053 Ok(())
1054 }
1055 }
1056
1057 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1058 for TestAppStatusListenerReportStatusRequest
1059 {
1060 #[inline(always)]
1061 fn new_empty() -> Self {
1062 Self { status: fidl::new_empty!(TestAppStatus, D) }
1063 }
1064
1065 #[inline]
1066 unsafe fn decode(
1067 &mut self,
1068 decoder: &mut fidl::encoding::Decoder<'_, D>,
1069 offset: usize,
1070 _depth: fidl::encoding::Depth,
1071 ) -> fidl::Result<()> {
1072 decoder.debug_check_bounds::<Self>(offset);
1073 fidl::decode!(TestAppStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
1075 Ok(())
1076 }
1077 }
1078
1079 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTouchEventRequest {
1080 type Borrowed<'a> = &'a Self;
1081 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1082 value
1083 }
1084 }
1085
1086 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTouchEventRequest {
1087 type Owned = Self;
1088
1089 #[inline(always)]
1090 fn inline_align(_context: fidl::encoding::Context) -> usize {
1091 8
1092 }
1093
1094 #[inline(always)]
1095 fn inline_size(_context: fidl::encoding::Context) -> usize {
1096 16
1097 }
1098 }
1099
1100 unsafe impl<D: fidl::encoding::ResourceDialect>
1101 fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D>
1102 for &TouchScreenSimulateTouchEventRequest
1103 {
1104 #[inline]
1105 unsafe fn encode(
1106 self,
1107 encoder: &mut fidl::encoding::Encoder<'_, D>,
1108 offset: usize,
1109 _depth: fidl::encoding::Depth,
1110 ) -> fidl::Result<()> {
1111 encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
1112 fidl::encoding::Encode::<TouchScreenSimulateTouchEventRequest, D>::encode(
1114 (
1115 <fidl_fuchsia_input_report__common::TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),
1116 ),
1117 encoder, offset, _depth
1118 )
1119 }
1120 }
1121 unsafe impl<
1122 D: fidl::encoding::ResourceDialect,
1123 T0: fidl::encoding::Encode<fidl_fuchsia_input_report__common::TouchInputReport, D>,
1124 > fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D> for (T0,)
1125 {
1126 #[inline]
1127 unsafe fn encode(
1128 self,
1129 encoder: &mut fidl::encoding::Encoder<'_, D>,
1130 offset: usize,
1131 depth: fidl::encoding::Depth,
1132 ) -> fidl::Result<()> {
1133 encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
1134 self.0.encode(encoder, offset + 0, depth)?;
1138 Ok(())
1139 }
1140 }
1141
1142 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1143 for TouchScreenSimulateTouchEventRequest
1144 {
1145 #[inline(always)]
1146 fn new_empty() -> Self {
1147 Self {
1148 report: fidl::new_empty!(fidl_fuchsia_input_report__common::TouchInputReport, D),
1149 }
1150 }
1151
1152 #[inline]
1153 unsafe fn decode(
1154 &mut self,
1155 decoder: &mut fidl::encoding::Decoder<'_, D>,
1156 offset: usize,
1157 _depth: fidl::encoding::Depth,
1158 ) -> fidl::Result<()> {
1159 decoder.debug_check_bounds::<Self>(offset);
1160 fidl::decode!(
1162 fidl_fuchsia_input_report__common::TouchInputReport,
1163 D,
1164 &mut self.report,
1165 decoder,
1166 offset + 0,
1167 _depth
1168 )?;
1169 Ok(())
1170 }
1171 }
1172
1173 impl KeyboardInputListenerReportTextInputRequest {
1174 #[inline(always)]
1175 fn max_ordinal_present(&self) -> u64 {
1176 if let Some(_) = self.device_id {
1177 return 3;
1178 }
1179 if let Some(_) = self.non_printable {
1180 return 2;
1181 }
1182 if let Some(_) = self.text {
1183 return 1;
1184 }
1185 0
1186 }
1187 }
1188
1189 impl fidl::encoding::ValueTypeMarker for KeyboardInputListenerReportTextInputRequest {
1190 type Borrowed<'a> = &'a Self;
1191 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1192 value
1193 }
1194 }
1195
1196 unsafe impl fidl::encoding::TypeMarker for KeyboardInputListenerReportTextInputRequest {
1197 type Owned = Self;
1198
1199 #[inline(always)]
1200 fn inline_align(_context: fidl::encoding::Context) -> usize {
1201 8
1202 }
1203
1204 #[inline(always)]
1205 fn inline_size(_context: fidl::encoding::Context) -> usize {
1206 16
1207 }
1208 }
1209
1210 unsafe impl<D: fidl::encoding::ResourceDialect>
1211 fidl::encoding::Encode<KeyboardInputListenerReportTextInputRequest, D>
1212 for &KeyboardInputListenerReportTextInputRequest
1213 {
1214 unsafe fn encode(
1215 self,
1216 encoder: &mut fidl::encoding::Encoder<'_, D>,
1217 offset: usize,
1218 mut depth: fidl::encoding::Depth,
1219 ) -> fidl::Result<()> {
1220 encoder.debug_check_bounds::<KeyboardInputListenerReportTextInputRequest>(offset);
1221 let max_ordinal: u64 = self.max_ordinal_present();
1223 encoder.write_num(max_ordinal, offset);
1224 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1225 if max_ordinal == 0 {
1227 return Ok(());
1228 }
1229 depth.increment()?;
1230 let envelope_size = 8;
1231 let bytes_len = max_ordinal as usize * envelope_size;
1232 #[allow(unused_variables)]
1233 let offset = encoder.out_of_line_offset(bytes_len);
1234 let mut _prev_end_offset: usize = 0;
1235 if 1 > max_ordinal {
1236 return Ok(());
1237 }
1238
1239 let cur_offset: usize = (1 - 1) * envelope_size;
1242
1243 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1245
1246 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1251 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1252 encoder, offset + cur_offset, depth
1253 )?;
1254
1255 _prev_end_offset = cur_offset + envelope_size;
1256 if 2 > max_ordinal {
1257 return Ok(());
1258 }
1259
1260 let cur_offset: usize = (2 - 1) * envelope_size;
1263
1264 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1266
1267 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_input3__common::NonPrintableKey, D>(
1272 self.non_printable.as_ref().map(<fidl_fuchsia_ui_input3__common::NonPrintableKey as fidl::encoding::ValueTypeMarker>::borrow),
1273 encoder, offset + cur_offset, depth
1274 )?;
1275
1276 _prev_end_offset = cur_offset + envelope_size;
1277 if 3 > max_ordinal {
1278 return Ok(());
1279 }
1280
1281 let cur_offset: usize = (3 - 1) * envelope_size;
1284
1285 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1287
1288 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1293 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1294 encoder,
1295 offset + cur_offset,
1296 depth,
1297 )?;
1298
1299 _prev_end_offset = cur_offset + envelope_size;
1300
1301 Ok(())
1302 }
1303 }
1304
1305 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1306 for KeyboardInputListenerReportTextInputRequest
1307 {
1308 #[inline(always)]
1309 fn new_empty() -> Self {
1310 Self::default()
1311 }
1312
1313 unsafe fn decode(
1314 &mut self,
1315 decoder: &mut fidl::encoding::Decoder<'_, D>,
1316 offset: usize,
1317 mut depth: fidl::encoding::Depth,
1318 ) -> fidl::Result<()> {
1319 decoder.debug_check_bounds::<Self>(offset);
1320 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1321 None => return Err(fidl::Error::NotNullable),
1322 Some(len) => len,
1323 };
1324 if len == 0 {
1326 return Ok(());
1327 };
1328 depth.increment()?;
1329 let envelope_size = 8;
1330 let bytes_len = len * envelope_size;
1331 let offset = decoder.out_of_line_offset(bytes_len)?;
1332 let mut _next_ordinal_to_read = 0;
1334 let mut next_offset = offset;
1335 let end_offset = offset + bytes_len;
1336 _next_ordinal_to_read += 1;
1337 if next_offset >= end_offset {
1338 return Ok(());
1339 }
1340
1341 while _next_ordinal_to_read < 1 {
1343 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1344 _next_ordinal_to_read += 1;
1345 next_offset += envelope_size;
1346 }
1347
1348 let next_out_of_line = decoder.next_out_of_line();
1349 let handles_before = decoder.remaining_handles();
1350 if let Some((inlined, num_bytes, num_handles)) =
1351 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1352 {
1353 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1354 if inlined != (member_inline_size <= 4) {
1355 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1356 }
1357 let inner_offset;
1358 let mut inner_depth = depth.clone();
1359 if inlined {
1360 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1361 inner_offset = next_offset;
1362 } else {
1363 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1364 inner_depth.increment()?;
1365 }
1366 let val_ref = self.text.get_or_insert_with(|| {
1367 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1368 });
1369 fidl::decode!(
1370 fidl::encoding::BoundedString<1024>,
1371 D,
1372 val_ref,
1373 decoder,
1374 inner_offset,
1375 inner_depth
1376 )?;
1377 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1378 {
1379 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1380 }
1381 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1382 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1383 }
1384 }
1385
1386 next_offset += envelope_size;
1387 _next_ordinal_to_read += 1;
1388 if next_offset >= end_offset {
1389 return Ok(());
1390 }
1391
1392 while _next_ordinal_to_read < 2 {
1394 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1395 _next_ordinal_to_read += 1;
1396 next_offset += envelope_size;
1397 }
1398
1399 let next_out_of_line = decoder.next_out_of_line();
1400 let handles_before = decoder.remaining_handles();
1401 if let Some((inlined, num_bytes, num_handles)) =
1402 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1403 {
1404 let member_inline_size = <fidl_fuchsia_ui_input3__common::NonPrintableKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1405 if inlined != (member_inline_size <= 4) {
1406 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1407 }
1408 let inner_offset;
1409 let mut inner_depth = depth.clone();
1410 if inlined {
1411 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1412 inner_offset = next_offset;
1413 } else {
1414 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1415 inner_depth.increment()?;
1416 }
1417 let val_ref = self.non_printable.get_or_insert_with(|| {
1418 fidl::new_empty!(fidl_fuchsia_ui_input3__common::NonPrintableKey, D)
1419 });
1420 fidl::decode!(
1421 fidl_fuchsia_ui_input3__common::NonPrintableKey,
1422 D,
1423 val_ref,
1424 decoder,
1425 inner_offset,
1426 inner_depth
1427 )?;
1428 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1429 {
1430 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1431 }
1432 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1433 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1434 }
1435 }
1436
1437 next_offset += envelope_size;
1438 _next_ordinal_to_read += 1;
1439 if next_offset >= end_offset {
1440 return Ok(());
1441 }
1442
1443 while _next_ordinal_to_read < 3 {
1445 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1446 _next_ordinal_to_read += 1;
1447 next_offset += envelope_size;
1448 }
1449
1450 let next_out_of_line = decoder.next_out_of_line();
1451 let handles_before = decoder.remaining_handles();
1452 if let Some((inlined, num_bytes, num_handles)) =
1453 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1454 {
1455 let member_inline_size =
1456 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1457 if inlined != (member_inline_size <= 4) {
1458 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1459 }
1460 let inner_offset;
1461 let mut inner_depth = depth.clone();
1462 if inlined {
1463 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1464 inner_offset = next_offset;
1465 } else {
1466 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1467 inner_depth.increment()?;
1468 }
1469 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1470 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1471 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1472 {
1473 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1474 }
1475 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1476 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1477 }
1478 }
1479
1480 next_offset += envelope_size;
1481
1482 while next_offset < end_offset {
1484 _next_ordinal_to_read += 1;
1485 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1486 next_offset += envelope_size;
1487 }
1488
1489 Ok(())
1490 }
1491 }
1492
1493 impl KeyboardSimulateKeyEventRequest {
1494 #[inline(always)]
1495 fn max_ordinal_present(&self) -> u64 {
1496 if let Some(_) = self.report {
1497 return 1;
1498 }
1499 0
1500 }
1501 }
1502
1503 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyEventRequest {
1504 type Borrowed<'a> = &'a Self;
1505 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1506 value
1507 }
1508 }
1509
1510 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyEventRequest {
1511 type Owned = Self;
1512
1513 #[inline(always)]
1514 fn inline_align(_context: fidl::encoding::Context) -> usize {
1515 8
1516 }
1517
1518 #[inline(always)]
1519 fn inline_size(_context: fidl::encoding::Context) -> usize {
1520 16
1521 }
1522 }
1523
1524 unsafe impl<D: fidl::encoding::ResourceDialect>
1525 fidl::encoding::Encode<KeyboardSimulateKeyEventRequest, D>
1526 for &KeyboardSimulateKeyEventRequest
1527 {
1528 unsafe fn encode(
1529 self,
1530 encoder: &mut fidl::encoding::Encoder<'_, D>,
1531 offset: usize,
1532 mut depth: fidl::encoding::Depth,
1533 ) -> fidl::Result<()> {
1534 encoder.debug_check_bounds::<KeyboardSimulateKeyEventRequest>(offset);
1535 let max_ordinal: u64 = self.max_ordinal_present();
1537 encoder.write_num(max_ordinal, offset);
1538 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1539 if max_ordinal == 0 {
1541 return Ok(());
1542 }
1543 depth.increment()?;
1544 let envelope_size = 8;
1545 let bytes_len = max_ordinal as usize * envelope_size;
1546 #[allow(unused_variables)]
1547 let offset = encoder.out_of_line_offset(bytes_len);
1548 let mut _prev_end_offset: usize = 0;
1549 if 1 > max_ordinal {
1550 return Ok(());
1551 }
1552
1553 let cur_offset: usize = (1 - 1) * envelope_size;
1556
1557 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1559
1560 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report__common::KeyboardInputReport, D>(
1565 self.report.as_ref().map(<fidl_fuchsia_input_report__common::KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
1566 encoder, offset + cur_offset, depth
1567 )?;
1568
1569 _prev_end_offset = cur_offset + envelope_size;
1570
1571 Ok(())
1572 }
1573 }
1574
1575 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1576 for KeyboardSimulateKeyEventRequest
1577 {
1578 #[inline(always)]
1579 fn new_empty() -> Self {
1580 Self::default()
1581 }
1582
1583 unsafe fn decode(
1584 &mut self,
1585 decoder: &mut fidl::encoding::Decoder<'_, D>,
1586 offset: usize,
1587 mut depth: fidl::encoding::Depth,
1588 ) -> fidl::Result<()> {
1589 decoder.debug_check_bounds::<Self>(offset);
1590 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1591 None => return Err(fidl::Error::NotNullable),
1592 Some(len) => len,
1593 };
1594 if len == 0 {
1596 return Ok(());
1597 };
1598 depth.increment()?;
1599 let envelope_size = 8;
1600 let bytes_len = len * envelope_size;
1601 let offset = decoder.out_of_line_offset(bytes_len)?;
1602 let mut _next_ordinal_to_read = 0;
1604 let mut next_offset = offset;
1605 let end_offset = offset + bytes_len;
1606 _next_ordinal_to_read += 1;
1607 if next_offset >= end_offset {
1608 return Ok(());
1609 }
1610
1611 while _next_ordinal_to_read < 1 {
1613 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1614 _next_ordinal_to_read += 1;
1615 next_offset += envelope_size;
1616 }
1617
1618 let next_out_of_line = decoder.next_out_of_line();
1619 let handles_before = decoder.remaining_handles();
1620 if let Some((inlined, num_bytes, num_handles)) =
1621 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1622 {
1623 let member_inline_size = <fidl_fuchsia_input_report__common::KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1624 if inlined != (member_inline_size <= 4) {
1625 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1626 }
1627 let inner_offset;
1628 let mut inner_depth = depth.clone();
1629 if inlined {
1630 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1631 inner_offset = next_offset;
1632 } else {
1633 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1634 inner_depth.increment()?;
1635 }
1636 let val_ref = self.report.get_or_insert_with(|| {
1637 fidl::new_empty!(fidl_fuchsia_input_report__common::KeyboardInputReport, D)
1638 });
1639 fidl::decode!(
1640 fidl_fuchsia_input_report__common::KeyboardInputReport,
1641 D,
1642 val_ref,
1643 decoder,
1644 inner_offset,
1645 inner_depth
1646 )?;
1647 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1648 {
1649 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1650 }
1651 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1652 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1653 }
1654 }
1655
1656 next_offset += envelope_size;
1657
1658 while next_offset < end_offset {
1660 _next_ordinal_to_read += 1;
1661 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1662 next_offset += envelope_size;
1663 }
1664
1665 Ok(())
1666 }
1667 }
1668
1669 impl KeyboardSimulateKeyPressRequest {
1670 #[inline(always)]
1671 fn max_ordinal_present(&self) -> u64 {
1672 if let Some(_) = self.key_code {
1673 return 1;
1674 }
1675 0
1676 }
1677 }
1678
1679 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyPressRequest {
1680 type Borrowed<'a> = &'a Self;
1681 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1682 value
1683 }
1684 }
1685
1686 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyPressRequest {
1687 type Owned = Self;
1688
1689 #[inline(always)]
1690 fn inline_align(_context: fidl::encoding::Context) -> usize {
1691 8
1692 }
1693
1694 #[inline(always)]
1695 fn inline_size(_context: fidl::encoding::Context) -> usize {
1696 16
1697 }
1698 }
1699
1700 unsafe impl<D: fidl::encoding::ResourceDialect>
1701 fidl::encoding::Encode<KeyboardSimulateKeyPressRequest, D>
1702 for &KeyboardSimulateKeyPressRequest
1703 {
1704 unsafe fn encode(
1705 self,
1706 encoder: &mut fidl::encoding::Encoder<'_, D>,
1707 offset: usize,
1708 mut depth: fidl::encoding::Depth,
1709 ) -> fidl::Result<()> {
1710 encoder.debug_check_bounds::<KeyboardSimulateKeyPressRequest>(offset);
1711 let max_ordinal: u64 = self.max_ordinal_present();
1713 encoder.write_num(max_ordinal, offset);
1714 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1715 if max_ordinal == 0 {
1717 return Ok(());
1718 }
1719 depth.increment()?;
1720 let envelope_size = 8;
1721 let bytes_len = max_ordinal as usize * envelope_size;
1722 #[allow(unused_variables)]
1723 let offset = encoder.out_of_line_offset(bytes_len);
1724 let mut _prev_end_offset: usize = 0;
1725 if 1 > max_ordinal {
1726 return Ok(());
1727 }
1728
1729 let cur_offset: usize = (1 - 1) * envelope_size;
1732
1733 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1735
1736 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input__common::Key, D>(
1741 self.key_code.as_ref().map(
1742 <fidl_fuchsia_input__common::Key as fidl::encoding::ValueTypeMarker>::borrow,
1743 ),
1744 encoder,
1745 offset + cur_offset,
1746 depth,
1747 )?;
1748
1749 _prev_end_offset = cur_offset + envelope_size;
1750
1751 Ok(())
1752 }
1753 }
1754
1755 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1756 for KeyboardSimulateKeyPressRequest
1757 {
1758 #[inline(always)]
1759 fn new_empty() -> Self {
1760 Self::default()
1761 }
1762
1763 unsafe fn decode(
1764 &mut self,
1765 decoder: &mut fidl::encoding::Decoder<'_, D>,
1766 offset: usize,
1767 mut depth: fidl::encoding::Depth,
1768 ) -> fidl::Result<()> {
1769 decoder.debug_check_bounds::<Self>(offset);
1770 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1771 None => return Err(fidl::Error::NotNullable),
1772 Some(len) => len,
1773 };
1774 if len == 0 {
1776 return Ok(());
1777 };
1778 depth.increment()?;
1779 let envelope_size = 8;
1780 let bytes_len = len * envelope_size;
1781 let offset = decoder.out_of_line_offset(bytes_len)?;
1782 let mut _next_ordinal_to_read = 0;
1784 let mut next_offset = offset;
1785 let end_offset = offset + bytes_len;
1786 _next_ordinal_to_read += 1;
1787 if next_offset >= end_offset {
1788 return Ok(());
1789 }
1790
1791 while _next_ordinal_to_read < 1 {
1793 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1794 _next_ordinal_to_read += 1;
1795 next_offset += envelope_size;
1796 }
1797
1798 let next_out_of_line = decoder.next_out_of_line();
1799 let handles_before = decoder.remaining_handles();
1800 if let Some((inlined, num_bytes, num_handles)) =
1801 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1802 {
1803 let member_inline_size =
1804 <fidl_fuchsia_input__common::Key as fidl::encoding::TypeMarker>::inline_size(
1805 decoder.context,
1806 );
1807 if inlined != (member_inline_size <= 4) {
1808 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1809 }
1810 let inner_offset;
1811 let mut inner_depth = depth.clone();
1812 if inlined {
1813 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1814 inner_offset = next_offset;
1815 } else {
1816 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1817 inner_depth.increment()?;
1818 }
1819 let val_ref = self
1820 .key_code
1821 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input__common::Key, D));
1822 fidl::decode!(
1823 fidl_fuchsia_input__common::Key,
1824 D,
1825 val_ref,
1826 decoder,
1827 inner_offset,
1828 inner_depth
1829 )?;
1830 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1831 {
1832 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1833 }
1834 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1835 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1836 }
1837 }
1838
1839 next_offset += envelope_size;
1840
1841 while next_offset < end_offset {
1843 _next_ordinal_to_read += 1;
1844 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1845 next_offset += envelope_size;
1846 }
1847
1848 Ok(())
1849 }
1850 }
1851
1852 impl KeyboardSimulateUsAsciiTextEntryRequest {
1853 #[inline(always)]
1854 fn max_ordinal_present(&self) -> u64 {
1855 if let Some(_) = self.text {
1856 return 1;
1857 }
1858 0
1859 }
1860 }
1861
1862 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1863 type Borrowed<'a> = &'a Self;
1864 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1865 value
1866 }
1867 }
1868
1869 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1870 type Owned = Self;
1871
1872 #[inline(always)]
1873 fn inline_align(_context: fidl::encoding::Context) -> usize {
1874 8
1875 }
1876
1877 #[inline(always)]
1878 fn inline_size(_context: fidl::encoding::Context) -> usize {
1879 16
1880 }
1881 }
1882
1883 unsafe impl<D: fidl::encoding::ResourceDialect>
1884 fidl::encoding::Encode<KeyboardSimulateUsAsciiTextEntryRequest, D>
1885 for &KeyboardSimulateUsAsciiTextEntryRequest
1886 {
1887 unsafe fn encode(
1888 self,
1889 encoder: &mut fidl::encoding::Encoder<'_, D>,
1890 offset: usize,
1891 mut depth: fidl::encoding::Depth,
1892 ) -> fidl::Result<()> {
1893 encoder.debug_check_bounds::<KeyboardSimulateUsAsciiTextEntryRequest>(offset);
1894 let max_ordinal: u64 = self.max_ordinal_present();
1896 encoder.write_num(max_ordinal, offset);
1897 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1898 if max_ordinal == 0 {
1900 return Ok(());
1901 }
1902 depth.increment()?;
1903 let envelope_size = 8;
1904 let bytes_len = max_ordinal as usize * envelope_size;
1905 #[allow(unused_variables)]
1906 let offset = encoder.out_of_line_offset(bytes_len);
1907 let mut _prev_end_offset: usize = 0;
1908 if 1 > max_ordinal {
1909 return Ok(());
1910 }
1911
1912 let cur_offset: usize = (1 - 1) * envelope_size;
1915
1916 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1918
1919 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1924 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1925 encoder, offset + cur_offset, depth
1926 )?;
1927
1928 _prev_end_offset = cur_offset + envelope_size;
1929
1930 Ok(())
1931 }
1932 }
1933
1934 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1935 for KeyboardSimulateUsAsciiTextEntryRequest
1936 {
1937 #[inline(always)]
1938 fn new_empty() -> Self {
1939 Self::default()
1940 }
1941
1942 unsafe fn decode(
1943 &mut self,
1944 decoder: &mut fidl::encoding::Decoder<'_, D>,
1945 offset: usize,
1946 mut depth: fidl::encoding::Depth,
1947 ) -> fidl::Result<()> {
1948 decoder.debug_check_bounds::<Self>(offset);
1949 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1950 None => return Err(fidl::Error::NotNullable),
1951 Some(len) => len,
1952 };
1953 if len == 0 {
1955 return Ok(());
1956 };
1957 depth.increment()?;
1958 let envelope_size = 8;
1959 let bytes_len = len * envelope_size;
1960 let offset = decoder.out_of_line_offset(bytes_len)?;
1961 let mut _next_ordinal_to_read = 0;
1963 let mut next_offset = offset;
1964 let end_offset = offset + bytes_len;
1965 _next_ordinal_to_read += 1;
1966 if next_offset >= end_offset {
1967 return Ok(());
1968 }
1969
1970 while _next_ordinal_to_read < 1 {
1972 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1973 _next_ordinal_to_read += 1;
1974 next_offset += envelope_size;
1975 }
1976
1977 let next_out_of_line = decoder.next_out_of_line();
1978 let handles_before = decoder.remaining_handles();
1979 if let Some((inlined, num_bytes, num_handles)) =
1980 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1981 {
1982 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1983 if inlined != (member_inline_size <= 4) {
1984 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1985 }
1986 let inner_offset;
1987 let mut inner_depth = depth.clone();
1988 if inlined {
1989 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1990 inner_offset = next_offset;
1991 } else {
1992 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1993 inner_depth.increment()?;
1994 }
1995 let val_ref = self.text.get_or_insert_with(|| {
1996 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1997 });
1998 fidl::decode!(
1999 fidl::encoding::BoundedString<1024>,
2000 D,
2001 val_ref,
2002 decoder,
2003 inner_offset,
2004 inner_depth
2005 )?;
2006 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2007 {
2008 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2009 }
2010 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2011 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2012 }
2013 }
2014
2015 next_offset += envelope_size;
2016
2017 while next_offset < end_offset {
2019 _next_ordinal_to_read += 1;
2020 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2021 next_offset += envelope_size;
2022 }
2023
2024 Ok(())
2025 }
2026 }
2027
2028 impl MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2029 #[inline(always)]
2030 fn max_ordinal_present(&self) -> u64 {
2031 if let Some(_) = self.delay {
2032 return 2;
2033 }
2034 if let Some(_) = self.button {
2035 return 1;
2036 }
2037 0
2038 }
2039 }
2040
2041 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2042 type Borrowed<'a> = &'a Self;
2043 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2044 value
2045 }
2046 }
2047
2048 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2049 type Owned = Self;
2050
2051 #[inline(always)]
2052 fn inline_align(_context: fidl::encoding::Context) -> usize {
2053 8
2054 }
2055
2056 #[inline(always)]
2057 fn inline_size(_context: fidl::encoding::Context) -> usize {
2058 16
2059 }
2060 }
2061
2062 unsafe impl<D: fidl::encoding::ResourceDialect>
2063 fidl::encoding::Encode<MediaButtonsDeviceScheduleSimulateButtonPressRequest, D>
2064 for &MediaButtonsDeviceScheduleSimulateButtonPressRequest
2065 {
2066 unsafe fn encode(
2067 self,
2068 encoder: &mut fidl::encoding::Encoder<'_, D>,
2069 offset: usize,
2070 mut depth: fidl::encoding::Depth,
2071 ) -> fidl::Result<()> {
2072 encoder
2073 .debug_check_bounds::<MediaButtonsDeviceScheduleSimulateButtonPressRequest>(offset);
2074 let max_ordinal: u64 = self.max_ordinal_present();
2076 encoder.write_num(max_ordinal, offset);
2077 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2078 if max_ordinal == 0 {
2080 return Ok(());
2081 }
2082 depth.increment()?;
2083 let envelope_size = 8;
2084 let bytes_len = max_ordinal as usize * envelope_size;
2085 #[allow(unused_variables)]
2086 let offset = encoder.out_of_line_offset(bytes_len);
2087 let mut _prev_end_offset: usize = 0;
2088 if 1 > max_ordinal {
2089 return Ok(());
2090 }
2091
2092 let cur_offset: usize = (1 - 1) * envelope_size;
2095
2096 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2098
2099 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report__common::ConsumerControlButton, D>(
2104 self.button.as_ref().map(<fidl_fuchsia_input_report__common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2105 encoder, offset + cur_offset, depth
2106 )?;
2107
2108 _prev_end_offset = cur_offset + envelope_size;
2109 if 2 > max_ordinal {
2110 return Ok(());
2111 }
2112
2113 let cur_offset: usize = (2 - 1) * envelope_size;
2116
2117 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2119
2120 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2125 self.delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2126 encoder,
2127 offset + cur_offset,
2128 depth,
2129 )?;
2130
2131 _prev_end_offset = cur_offset + envelope_size;
2132
2133 Ok(())
2134 }
2135 }
2136
2137 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2138 for MediaButtonsDeviceScheduleSimulateButtonPressRequest
2139 {
2140 #[inline(always)]
2141 fn new_empty() -> Self {
2142 Self::default()
2143 }
2144
2145 unsafe fn decode(
2146 &mut self,
2147 decoder: &mut fidl::encoding::Decoder<'_, D>,
2148 offset: usize,
2149 mut depth: fidl::encoding::Depth,
2150 ) -> fidl::Result<()> {
2151 decoder.debug_check_bounds::<Self>(offset);
2152 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2153 None => return Err(fidl::Error::NotNullable),
2154 Some(len) => len,
2155 };
2156 if len == 0 {
2158 return Ok(());
2159 };
2160 depth.increment()?;
2161 let envelope_size = 8;
2162 let bytes_len = len * envelope_size;
2163 let offset = decoder.out_of_line_offset(bytes_len)?;
2164 let mut _next_ordinal_to_read = 0;
2166 let mut next_offset = offset;
2167 let end_offset = offset + bytes_len;
2168 _next_ordinal_to_read += 1;
2169 if next_offset >= end_offset {
2170 return Ok(());
2171 }
2172
2173 while _next_ordinal_to_read < 1 {
2175 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2176 _next_ordinal_to_read += 1;
2177 next_offset += envelope_size;
2178 }
2179
2180 let next_out_of_line = decoder.next_out_of_line();
2181 let handles_before = decoder.remaining_handles();
2182 if let Some((inlined, num_bytes, num_handles)) =
2183 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2184 {
2185 let member_inline_size = <fidl_fuchsia_input_report__common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2186 if inlined != (member_inline_size <= 4) {
2187 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2188 }
2189 let inner_offset;
2190 let mut inner_depth = depth.clone();
2191 if inlined {
2192 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2193 inner_offset = next_offset;
2194 } else {
2195 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2196 inner_depth.increment()?;
2197 }
2198 let val_ref = self.button.get_or_insert_with(|| {
2199 fidl::new_empty!(fidl_fuchsia_input_report__common::ConsumerControlButton, D)
2200 });
2201 fidl::decode!(
2202 fidl_fuchsia_input_report__common::ConsumerControlButton,
2203 D,
2204 val_ref,
2205 decoder,
2206 inner_offset,
2207 inner_depth
2208 )?;
2209 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2210 {
2211 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2212 }
2213 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2214 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2215 }
2216 }
2217
2218 next_offset += envelope_size;
2219 _next_ordinal_to_read += 1;
2220 if next_offset >= end_offset {
2221 return Ok(());
2222 }
2223
2224 while _next_ordinal_to_read < 2 {
2226 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2227 _next_ordinal_to_read += 1;
2228 next_offset += envelope_size;
2229 }
2230
2231 let next_out_of_line = decoder.next_out_of_line();
2232 let handles_before = decoder.remaining_handles();
2233 if let Some((inlined, num_bytes, num_handles)) =
2234 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2235 {
2236 let member_inline_size =
2237 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2238 if inlined != (member_inline_size <= 4) {
2239 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2240 }
2241 let inner_offset;
2242 let mut inner_depth = depth.clone();
2243 if inlined {
2244 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2245 inner_offset = next_offset;
2246 } else {
2247 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2248 inner_depth.increment()?;
2249 }
2250 let val_ref = self.delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
2251 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2252 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2253 {
2254 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2255 }
2256 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2257 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2258 }
2259 }
2260
2261 next_offset += envelope_size;
2262
2263 while next_offset < end_offset {
2265 _next_ordinal_to_read += 1;
2266 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2267 next_offset += envelope_size;
2268 }
2269
2270 Ok(())
2271 }
2272 }
2273
2274 impl MediaButtonsDeviceSendButtonsStateRequest {
2275 #[inline(always)]
2276 fn max_ordinal_present(&self) -> u64 {
2277 if let Some(_) = self.buttons {
2278 return 1;
2279 }
2280 0
2281 }
2282 }
2283
2284 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
2285 type Borrowed<'a> = &'a Self;
2286 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2287 value
2288 }
2289 }
2290
2291 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
2292 type Owned = Self;
2293
2294 #[inline(always)]
2295 fn inline_align(_context: fidl::encoding::Context) -> usize {
2296 8
2297 }
2298
2299 #[inline(always)]
2300 fn inline_size(_context: fidl::encoding::Context) -> usize {
2301 16
2302 }
2303 }
2304
2305 unsafe impl<D: fidl::encoding::ResourceDialect>
2306 fidl::encoding::Encode<MediaButtonsDeviceSendButtonsStateRequest, D>
2307 for &MediaButtonsDeviceSendButtonsStateRequest
2308 {
2309 unsafe fn encode(
2310 self,
2311 encoder: &mut fidl::encoding::Encoder<'_, D>,
2312 offset: usize,
2313 mut depth: fidl::encoding::Depth,
2314 ) -> fidl::Result<()> {
2315 encoder.debug_check_bounds::<MediaButtonsDeviceSendButtonsStateRequest>(offset);
2316 let max_ordinal: u64 = self.max_ordinal_present();
2318 encoder.write_num(max_ordinal, offset);
2319 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2320 if max_ordinal == 0 {
2322 return Ok(());
2323 }
2324 depth.increment()?;
2325 let envelope_size = 8;
2326 let bytes_len = max_ordinal as usize * envelope_size;
2327 #[allow(unused_variables)]
2328 let offset = encoder.out_of_line_offset(bytes_len);
2329 let mut _prev_end_offset: usize = 0;
2330 if 1 > max_ordinal {
2331 return Ok(());
2332 }
2333
2334 let cur_offset: usize = (1 - 1) * envelope_size;
2337
2338 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2340
2341 fidl::encoding::encode_in_envelope_optional::<
2346 fidl::encoding::Vector<
2347 fidl_fuchsia_input_report__common::ConsumerControlButton,
2348 255,
2349 >,
2350 D,
2351 >(
2352 self.buttons.as_ref().map(
2353 <fidl::encoding::Vector<
2354 fidl_fuchsia_input_report__common::ConsumerControlButton,
2355 255,
2356 > as fidl::encoding::ValueTypeMarker>::borrow,
2357 ),
2358 encoder,
2359 offset + cur_offset,
2360 depth,
2361 )?;
2362
2363 _prev_end_offset = cur_offset + envelope_size;
2364
2365 Ok(())
2366 }
2367 }
2368
2369 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2370 for MediaButtonsDeviceSendButtonsStateRequest
2371 {
2372 #[inline(always)]
2373 fn new_empty() -> Self {
2374 Self::default()
2375 }
2376
2377 unsafe fn decode(
2378 &mut self,
2379 decoder: &mut fidl::encoding::Decoder<'_, D>,
2380 offset: usize,
2381 mut depth: fidl::encoding::Depth,
2382 ) -> fidl::Result<()> {
2383 decoder.debug_check_bounds::<Self>(offset);
2384 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2385 None => return Err(fidl::Error::NotNullable),
2386 Some(len) => len,
2387 };
2388 if len == 0 {
2390 return Ok(());
2391 };
2392 depth.increment()?;
2393 let envelope_size = 8;
2394 let bytes_len = len * envelope_size;
2395 let offset = decoder.out_of_line_offset(bytes_len)?;
2396 let mut _next_ordinal_to_read = 0;
2398 let mut next_offset = offset;
2399 let end_offset = offset + bytes_len;
2400 _next_ordinal_to_read += 1;
2401 if next_offset >= end_offset {
2402 return Ok(());
2403 }
2404
2405 while _next_ordinal_to_read < 1 {
2407 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2408 _next_ordinal_to_read += 1;
2409 next_offset += envelope_size;
2410 }
2411
2412 let next_out_of_line = decoder.next_out_of_line();
2413 let handles_before = decoder.remaining_handles();
2414 if let Some((inlined, num_bytes, num_handles)) =
2415 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2416 {
2417 let member_inline_size = <fidl::encoding::Vector<
2418 fidl_fuchsia_input_report__common::ConsumerControlButton,
2419 255,
2420 > as fidl::encoding::TypeMarker>::inline_size(
2421 decoder.context
2422 );
2423 if inlined != (member_inline_size <= 4) {
2424 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2425 }
2426 let inner_offset;
2427 let mut inner_depth = depth.clone();
2428 if inlined {
2429 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2430 inner_offset = next_offset;
2431 } else {
2432 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2433 inner_depth.increment()?;
2434 }
2435 let val_ref =
2436 self.buttons.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input_report__common::ConsumerControlButton, 255>, D));
2437 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input_report__common::ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
2438 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2439 {
2440 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2441 }
2442 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2443 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2444 }
2445 }
2446
2447 next_offset += envelope_size;
2448
2449 while next_offset < end_offset {
2451 _next_ordinal_to_read += 1;
2452 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2453 next_offset += envelope_size;
2454 }
2455
2456 Ok(())
2457 }
2458 }
2459
2460 impl MediaButtonsDeviceSimulateButtonPressRequest {
2461 #[inline(always)]
2462 fn max_ordinal_present(&self) -> u64 {
2463 if let Some(_) = self.button {
2464 return 1;
2465 }
2466 0
2467 }
2468 }
2469
2470 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2471 type Borrowed<'a> = &'a Self;
2472 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2473 value
2474 }
2475 }
2476
2477 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2478 type Owned = Self;
2479
2480 #[inline(always)]
2481 fn inline_align(_context: fidl::encoding::Context) -> usize {
2482 8
2483 }
2484
2485 #[inline(always)]
2486 fn inline_size(_context: fidl::encoding::Context) -> usize {
2487 16
2488 }
2489 }
2490
2491 unsafe impl<D: fidl::encoding::ResourceDialect>
2492 fidl::encoding::Encode<MediaButtonsDeviceSimulateButtonPressRequest, D>
2493 for &MediaButtonsDeviceSimulateButtonPressRequest
2494 {
2495 unsafe fn encode(
2496 self,
2497 encoder: &mut fidl::encoding::Encoder<'_, D>,
2498 offset: usize,
2499 mut depth: fidl::encoding::Depth,
2500 ) -> fidl::Result<()> {
2501 encoder.debug_check_bounds::<MediaButtonsDeviceSimulateButtonPressRequest>(offset);
2502 let max_ordinal: u64 = self.max_ordinal_present();
2504 encoder.write_num(max_ordinal, offset);
2505 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2506 if max_ordinal == 0 {
2508 return Ok(());
2509 }
2510 depth.increment()?;
2511 let envelope_size = 8;
2512 let bytes_len = max_ordinal as usize * envelope_size;
2513 #[allow(unused_variables)]
2514 let offset = encoder.out_of_line_offset(bytes_len);
2515 let mut _prev_end_offset: usize = 0;
2516 if 1 > max_ordinal {
2517 return Ok(());
2518 }
2519
2520 let cur_offset: usize = (1 - 1) * envelope_size;
2523
2524 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2526
2527 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report__common::ConsumerControlButton, D>(
2532 self.button.as_ref().map(<fidl_fuchsia_input_report__common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2533 encoder, offset + cur_offset, depth
2534 )?;
2535
2536 _prev_end_offset = cur_offset + envelope_size;
2537
2538 Ok(())
2539 }
2540 }
2541
2542 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2543 for MediaButtonsDeviceSimulateButtonPressRequest
2544 {
2545 #[inline(always)]
2546 fn new_empty() -> Self {
2547 Self::default()
2548 }
2549
2550 unsafe fn decode(
2551 &mut self,
2552 decoder: &mut fidl::encoding::Decoder<'_, D>,
2553 offset: usize,
2554 mut depth: fidl::encoding::Depth,
2555 ) -> fidl::Result<()> {
2556 decoder.debug_check_bounds::<Self>(offset);
2557 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2558 None => return Err(fidl::Error::NotNullable),
2559 Some(len) => len,
2560 };
2561 if len == 0 {
2563 return Ok(());
2564 };
2565 depth.increment()?;
2566 let envelope_size = 8;
2567 let bytes_len = len * envelope_size;
2568 let offset = decoder.out_of_line_offset(bytes_len)?;
2569 let mut _next_ordinal_to_read = 0;
2571 let mut next_offset = offset;
2572 let end_offset = offset + bytes_len;
2573 _next_ordinal_to_read += 1;
2574 if next_offset >= end_offset {
2575 return Ok(());
2576 }
2577
2578 while _next_ordinal_to_read < 1 {
2580 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2581 _next_ordinal_to_read += 1;
2582 next_offset += envelope_size;
2583 }
2584
2585 let next_out_of_line = decoder.next_out_of_line();
2586 let handles_before = decoder.remaining_handles();
2587 if let Some((inlined, num_bytes, num_handles)) =
2588 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2589 {
2590 let member_inline_size = <fidl_fuchsia_input_report__common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2591 if inlined != (member_inline_size <= 4) {
2592 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2593 }
2594 let inner_offset;
2595 let mut inner_depth = depth.clone();
2596 if inlined {
2597 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2598 inner_offset = next_offset;
2599 } else {
2600 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2601 inner_depth.increment()?;
2602 }
2603 let val_ref = self.button.get_or_insert_with(|| {
2604 fidl::new_empty!(fidl_fuchsia_input_report__common::ConsumerControlButton, D)
2605 });
2606 fidl::decode!(
2607 fidl_fuchsia_input_report__common::ConsumerControlButton,
2608 D,
2609 val_ref,
2610 decoder,
2611 inner_offset,
2612 inner_depth
2613 )?;
2614 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2615 {
2616 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2617 }
2618 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2619 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2620 }
2621 }
2622
2623 next_offset += envelope_size;
2624
2625 while next_offset < end_offset {
2627 _next_ordinal_to_read += 1;
2628 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2629 next_offset += envelope_size;
2630 }
2631
2632 Ok(())
2633 }
2634 }
2635
2636 impl MouseInputListenerReportMouseInputRequest {
2637 #[inline(always)]
2638 fn max_ordinal_present(&self) -> u64 {
2639 if let Some(_) = self.device_id {
2640 return 10;
2641 }
2642 if let Some(_) = self.wheel_y_physical_pixel {
2643 return 9;
2644 }
2645 if let Some(_) = self.wheel_x_physical_pixel {
2646 return 8;
2647 }
2648 if let Some(_) = self.device_pixel_ratio {
2649 return 7;
2650 }
2651 if let Some(_) = self.phase {
2652 return 6;
2653 }
2654 if let Some(_) = self.buttons {
2655 return 5;
2656 }
2657 if let Some(_) = self.component_name {
2658 return 4;
2659 }
2660 if let Some(_) = self.time_received {
2661 return 3;
2662 }
2663 if let Some(_) = self.local_y {
2664 return 2;
2665 }
2666 if let Some(_) = self.local_x {
2667 return 1;
2668 }
2669 0
2670 }
2671 }
2672
2673 impl fidl::encoding::ValueTypeMarker for MouseInputListenerReportMouseInputRequest {
2674 type Borrowed<'a> = &'a Self;
2675 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2676 value
2677 }
2678 }
2679
2680 unsafe impl fidl::encoding::TypeMarker for MouseInputListenerReportMouseInputRequest {
2681 type Owned = Self;
2682
2683 #[inline(always)]
2684 fn inline_align(_context: fidl::encoding::Context) -> usize {
2685 8
2686 }
2687
2688 #[inline(always)]
2689 fn inline_size(_context: fidl::encoding::Context) -> usize {
2690 16
2691 }
2692 }
2693
2694 unsafe impl<D: fidl::encoding::ResourceDialect>
2695 fidl::encoding::Encode<MouseInputListenerReportMouseInputRequest, D>
2696 for &MouseInputListenerReportMouseInputRequest
2697 {
2698 unsafe fn encode(
2699 self,
2700 encoder: &mut fidl::encoding::Encoder<'_, D>,
2701 offset: usize,
2702 mut depth: fidl::encoding::Depth,
2703 ) -> fidl::Result<()> {
2704 encoder.debug_check_bounds::<MouseInputListenerReportMouseInputRequest>(offset);
2705 let max_ordinal: u64 = self.max_ordinal_present();
2707 encoder.write_num(max_ordinal, offset);
2708 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2709 if max_ordinal == 0 {
2711 return Ok(());
2712 }
2713 depth.increment()?;
2714 let envelope_size = 8;
2715 let bytes_len = max_ordinal as usize * envelope_size;
2716 #[allow(unused_variables)]
2717 let offset = encoder.out_of_line_offset(bytes_len);
2718 let mut _prev_end_offset: usize = 0;
2719 if 1 > max_ordinal {
2720 return Ok(());
2721 }
2722
2723 let cur_offset: usize = (1 - 1) * envelope_size;
2726
2727 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2729
2730 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2735 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2736 encoder,
2737 offset + cur_offset,
2738 depth,
2739 )?;
2740
2741 _prev_end_offset = cur_offset + envelope_size;
2742 if 2 > max_ordinal {
2743 return Ok(());
2744 }
2745
2746 let cur_offset: usize = (2 - 1) * envelope_size;
2749
2750 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2752
2753 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2758 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2759 encoder,
2760 offset + cur_offset,
2761 depth,
2762 )?;
2763
2764 _prev_end_offset = cur_offset + envelope_size;
2765 if 3 > max_ordinal {
2766 return Ok(());
2767 }
2768
2769 let cur_offset: usize = (3 - 1) * envelope_size;
2772
2773 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2775
2776 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2781 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2782 encoder,
2783 offset + cur_offset,
2784 depth,
2785 )?;
2786
2787 _prev_end_offset = cur_offset + envelope_size;
2788 if 4 > max_ordinal {
2789 return Ok(());
2790 }
2791
2792 let cur_offset: usize = (4 - 1) * envelope_size;
2795
2796 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2798
2799 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
2804 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
2805 encoder, offset + cur_offset, depth
2806 )?;
2807
2808 _prev_end_offset = cur_offset + envelope_size;
2809 if 5 > max_ordinal {
2810 return Ok(());
2811 }
2812
2813 let cur_offset: usize = (5 - 1) * envelope_size;
2816
2817 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2819
2820 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
2825 self.buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
2826 encoder, offset + cur_offset, depth
2827 )?;
2828
2829 _prev_end_offset = cur_offset + envelope_size;
2830 if 6 > max_ordinal {
2831 return Ok(());
2832 }
2833
2834 let cur_offset: usize = (6 - 1) * envelope_size;
2837
2838 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2840
2841 fidl::encoding::encode_in_envelope_optional::<MouseEventPhase, D>(
2846 self.phase
2847 .as_ref()
2848 .map(<MouseEventPhase as fidl::encoding::ValueTypeMarker>::borrow),
2849 encoder,
2850 offset + cur_offset,
2851 depth,
2852 )?;
2853
2854 _prev_end_offset = cur_offset + envelope_size;
2855 if 7 > max_ordinal {
2856 return Ok(());
2857 }
2858
2859 let cur_offset: usize = (7 - 1) * envelope_size;
2862
2863 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2865
2866 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2871 self.device_pixel_ratio
2872 .as_ref()
2873 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2874 encoder,
2875 offset + cur_offset,
2876 depth,
2877 )?;
2878
2879 _prev_end_offset = cur_offset + envelope_size;
2880 if 8 > max_ordinal {
2881 return Ok(());
2882 }
2883
2884 let cur_offset: usize = (8 - 1) * envelope_size;
2887
2888 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2890
2891 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2896 self.wheel_x_physical_pixel
2897 .as_ref()
2898 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2899 encoder,
2900 offset + cur_offset,
2901 depth,
2902 )?;
2903
2904 _prev_end_offset = cur_offset + envelope_size;
2905 if 9 > max_ordinal {
2906 return Ok(());
2907 }
2908
2909 let cur_offset: usize = (9 - 1) * envelope_size;
2912
2913 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2915
2916 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2921 self.wheel_y_physical_pixel
2922 .as_ref()
2923 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2924 encoder,
2925 offset + cur_offset,
2926 depth,
2927 )?;
2928
2929 _prev_end_offset = cur_offset + envelope_size;
2930 if 10 > max_ordinal {
2931 return Ok(());
2932 }
2933
2934 let cur_offset: usize = (10 - 1) * envelope_size;
2937
2938 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2940
2941 fidl::encoding::encode_in_envelope_optional::<u32, D>(
2946 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2947 encoder,
2948 offset + cur_offset,
2949 depth,
2950 )?;
2951
2952 _prev_end_offset = cur_offset + envelope_size;
2953
2954 Ok(())
2955 }
2956 }
2957
2958 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2959 for MouseInputListenerReportMouseInputRequest
2960 {
2961 #[inline(always)]
2962 fn new_empty() -> Self {
2963 Self::default()
2964 }
2965
2966 unsafe fn decode(
2967 &mut self,
2968 decoder: &mut fidl::encoding::Decoder<'_, D>,
2969 offset: usize,
2970 mut depth: fidl::encoding::Depth,
2971 ) -> fidl::Result<()> {
2972 decoder.debug_check_bounds::<Self>(offset);
2973 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2974 None => return Err(fidl::Error::NotNullable),
2975 Some(len) => len,
2976 };
2977 if len == 0 {
2979 return Ok(());
2980 };
2981 depth.increment()?;
2982 let envelope_size = 8;
2983 let bytes_len = len * envelope_size;
2984 let offset = decoder.out_of_line_offset(bytes_len)?;
2985 let mut _next_ordinal_to_read = 0;
2987 let mut next_offset = offset;
2988 let end_offset = offset + bytes_len;
2989 _next_ordinal_to_read += 1;
2990 if next_offset >= end_offset {
2991 return Ok(());
2992 }
2993
2994 while _next_ordinal_to_read < 1 {
2996 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2997 _next_ordinal_to_read += 1;
2998 next_offset += envelope_size;
2999 }
3000
3001 let next_out_of_line = decoder.next_out_of_line();
3002 let handles_before = decoder.remaining_handles();
3003 if let Some((inlined, num_bytes, num_handles)) =
3004 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3005 {
3006 let member_inline_size =
3007 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3008 if inlined != (member_inline_size <= 4) {
3009 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3010 }
3011 let inner_offset;
3012 let mut inner_depth = depth.clone();
3013 if inlined {
3014 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3015 inner_offset = next_offset;
3016 } else {
3017 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3018 inner_depth.increment()?;
3019 }
3020 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
3021 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3022 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3023 {
3024 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3025 }
3026 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3027 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3028 }
3029 }
3030
3031 next_offset += envelope_size;
3032 _next_ordinal_to_read += 1;
3033 if next_offset >= end_offset {
3034 return Ok(());
3035 }
3036
3037 while _next_ordinal_to_read < 2 {
3039 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3040 _next_ordinal_to_read += 1;
3041 next_offset += envelope_size;
3042 }
3043
3044 let next_out_of_line = decoder.next_out_of_line();
3045 let handles_before = decoder.remaining_handles();
3046 if let Some((inlined, num_bytes, num_handles)) =
3047 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3048 {
3049 let member_inline_size =
3050 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3051 if inlined != (member_inline_size <= 4) {
3052 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3053 }
3054 let inner_offset;
3055 let mut inner_depth = depth.clone();
3056 if inlined {
3057 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3058 inner_offset = next_offset;
3059 } else {
3060 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3061 inner_depth.increment()?;
3062 }
3063 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
3064 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3065 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3066 {
3067 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3068 }
3069 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3070 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3071 }
3072 }
3073
3074 next_offset += envelope_size;
3075 _next_ordinal_to_read += 1;
3076 if next_offset >= end_offset {
3077 return Ok(());
3078 }
3079
3080 while _next_ordinal_to_read < 3 {
3082 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3083 _next_ordinal_to_read += 1;
3084 next_offset += envelope_size;
3085 }
3086
3087 let next_out_of_line = decoder.next_out_of_line();
3088 let handles_before = decoder.remaining_handles();
3089 if let Some((inlined, num_bytes, num_handles)) =
3090 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3091 {
3092 let member_inline_size =
3093 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3094 if inlined != (member_inline_size <= 4) {
3095 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3096 }
3097 let inner_offset;
3098 let mut inner_depth = depth.clone();
3099 if inlined {
3100 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3101 inner_offset = next_offset;
3102 } else {
3103 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3104 inner_depth.increment()?;
3105 }
3106 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
3107 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3108 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3109 {
3110 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3111 }
3112 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3113 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3114 }
3115 }
3116
3117 next_offset += envelope_size;
3118 _next_ordinal_to_read += 1;
3119 if next_offset >= end_offset {
3120 return Ok(());
3121 }
3122
3123 while _next_ordinal_to_read < 4 {
3125 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3126 _next_ordinal_to_read += 1;
3127 next_offset += envelope_size;
3128 }
3129
3130 let next_out_of_line = decoder.next_out_of_line();
3131 let handles_before = decoder.remaining_handles();
3132 if let Some((inlined, num_bytes, num_handles)) =
3133 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3134 {
3135 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3136 if inlined != (member_inline_size <= 4) {
3137 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3138 }
3139 let inner_offset;
3140 let mut inner_depth = depth.clone();
3141 if inlined {
3142 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3143 inner_offset = next_offset;
3144 } else {
3145 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3146 inner_depth.increment()?;
3147 }
3148 let val_ref = self.component_name.get_or_insert_with(|| {
3149 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
3150 });
3151 fidl::decode!(
3152 fidl::encoding::BoundedString<1024>,
3153 D,
3154 val_ref,
3155 decoder,
3156 inner_offset,
3157 inner_depth
3158 )?;
3159 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3160 {
3161 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3162 }
3163 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3164 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3165 }
3166 }
3167
3168 next_offset += envelope_size;
3169 _next_ordinal_to_read += 1;
3170 if next_offset >= end_offset {
3171 return Ok(());
3172 }
3173
3174 while _next_ordinal_to_read < 5 {
3176 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3177 _next_ordinal_to_read += 1;
3178 next_offset += envelope_size;
3179 }
3180
3181 let next_out_of_line = decoder.next_out_of_line();
3182 let handles_before = decoder.remaining_handles();
3183 if let Some((inlined, num_bytes, num_handles)) =
3184 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3185 {
3186 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3187 if inlined != (member_inline_size <= 4) {
3188 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3189 }
3190 let inner_offset;
3191 let mut inner_depth = depth.clone();
3192 if inlined {
3193 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3194 inner_offset = next_offset;
3195 } else {
3196 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3197 inner_depth.increment()?;
3198 }
3199 let val_ref = self.buttons.get_or_insert_with(
3200 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3201 );
3202 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3203 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3204 {
3205 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3206 }
3207 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3208 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3209 }
3210 }
3211
3212 next_offset += envelope_size;
3213 _next_ordinal_to_read += 1;
3214 if next_offset >= end_offset {
3215 return Ok(());
3216 }
3217
3218 while _next_ordinal_to_read < 6 {
3220 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3221 _next_ordinal_to_read += 1;
3222 next_offset += envelope_size;
3223 }
3224
3225 let next_out_of_line = decoder.next_out_of_line();
3226 let handles_before = decoder.remaining_handles();
3227 if let Some((inlined, num_bytes, num_handles)) =
3228 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3229 {
3230 let member_inline_size =
3231 <MouseEventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3232 if inlined != (member_inline_size <= 4) {
3233 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3234 }
3235 let inner_offset;
3236 let mut inner_depth = depth.clone();
3237 if inlined {
3238 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3239 inner_offset = next_offset;
3240 } else {
3241 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3242 inner_depth.increment()?;
3243 }
3244 let val_ref =
3245 self.phase.get_or_insert_with(|| fidl::new_empty!(MouseEventPhase, D));
3246 fidl::decode!(MouseEventPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
3247 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3248 {
3249 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3250 }
3251 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3252 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3253 }
3254 }
3255
3256 next_offset += envelope_size;
3257 _next_ordinal_to_read += 1;
3258 if next_offset >= end_offset {
3259 return Ok(());
3260 }
3261
3262 while _next_ordinal_to_read < 7 {
3264 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3265 _next_ordinal_to_read += 1;
3266 next_offset += envelope_size;
3267 }
3268
3269 let next_out_of_line = decoder.next_out_of_line();
3270 let handles_before = decoder.remaining_handles();
3271 if let Some((inlined, num_bytes, num_handles)) =
3272 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3273 {
3274 let member_inline_size =
3275 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3276 if inlined != (member_inline_size <= 4) {
3277 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3278 }
3279 let inner_offset;
3280 let mut inner_depth = depth.clone();
3281 if inlined {
3282 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3283 inner_offset = next_offset;
3284 } else {
3285 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3286 inner_depth.increment()?;
3287 }
3288 let val_ref =
3289 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
3290 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3291 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3292 {
3293 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3294 }
3295 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3296 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3297 }
3298 }
3299
3300 next_offset += envelope_size;
3301 _next_ordinal_to_read += 1;
3302 if next_offset >= end_offset {
3303 return Ok(());
3304 }
3305
3306 while _next_ordinal_to_read < 8 {
3308 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3309 _next_ordinal_to_read += 1;
3310 next_offset += envelope_size;
3311 }
3312
3313 let next_out_of_line = decoder.next_out_of_line();
3314 let handles_before = decoder.remaining_handles();
3315 if let Some((inlined, num_bytes, num_handles)) =
3316 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3317 {
3318 let member_inline_size =
3319 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3320 if inlined != (member_inline_size <= 4) {
3321 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3322 }
3323 let inner_offset;
3324 let mut inner_depth = depth.clone();
3325 if inlined {
3326 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3327 inner_offset = next_offset;
3328 } else {
3329 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3330 inner_depth.increment()?;
3331 }
3332 let val_ref =
3333 self.wheel_x_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3334 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3335 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3336 {
3337 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3338 }
3339 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3340 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3341 }
3342 }
3343
3344 next_offset += envelope_size;
3345 _next_ordinal_to_read += 1;
3346 if next_offset >= end_offset {
3347 return Ok(());
3348 }
3349
3350 while _next_ordinal_to_read < 9 {
3352 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3353 _next_ordinal_to_read += 1;
3354 next_offset += envelope_size;
3355 }
3356
3357 let next_out_of_line = decoder.next_out_of_line();
3358 let handles_before = decoder.remaining_handles();
3359 if let Some((inlined, num_bytes, num_handles)) =
3360 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3361 {
3362 let member_inline_size =
3363 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3364 if inlined != (member_inline_size <= 4) {
3365 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3366 }
3367 let inner_offset;
3368 let mut inner_depth = depth.clone();
3369 if inlined {
3370 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3371 inner_offset = next_offset;
3372 } else {
3373 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3374 inner_depth.increment()?;
3375 }
3376 let val_ref =
3377 self.wheel_y_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3378 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3379 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3380 {
3381 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3382 }
3383 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3384 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3385 }
3386 }
3387
3388 next_offset += envelope_size;
3389 _next_ordinal_to_read += 1;
3390 if next_offset >= end_offset {
3391 return Ok(());
3392 }
3393
3394 while _next_ordinal_to_read < 10 {
3396 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3397 _next_ordinal_to_read += 1;
3398 next_offset += envelope_size;
3399 }
3400
3401 let next_out_of_line = decoder.next_out_of_line();
3402 let handles_before = decoder.remaining_handles();
3403 if let Some((inlined, num_bytes, num_handles)) =
3404 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3405 {
3406 let member_inline_size =
3407 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3408 if inlined != (member_inline_size <= 4) {
3409 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3410 }
3411 let inner_offset;
3412 let mut inner_depth = depth.clone();
3413 if inlined {
3414 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3415 inner_offset = next_offset;
3416 } else {
3417 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3418 inner_depth.increment()?;
3419 }
3420 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
3421 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3422 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3423 {
3424 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3425 }
3426 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3427 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3428 }
3429 }
3430
3431 next_offset += envelope_size;
3432
3433 while next_offset < end_offset {
3435 _next_ordinal_to_read += 1;
3436 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3437 next_offset += envelope_size;
3438 }
3439
3440 Ok(())
3441 }
3442 }
3443
3444 impl MouseSimulateMouseEventRequest {
3445 #[inline(always)]
3446 fn max_ordinal_present(&self) -> u64 {
3447 if let Some(_) = self.scroll_h_physical_pixel {
3448 return 7;
3449 }
3450 if let Some(_) = self.scroll_v_physical_pixel {
3451 return 6;
3452 }
3453 if let Some(_) = self.scroll_h_detent {
3454 return 5;
3455 }
3456 if let Some(_) = self.scroll_v_detent {
3457 return 4;
3458 }
3459 if let Some(_) = self.movement_y {
3460 return 3;
3461 }
3462 if let Some(_) = self.movement_x {
3463 return 2;
3464 }
3465 if let Some(_) = self.pressed_buttons {
3466 return 1;
3467 }
3468 0
3469 }
3470 }
3471
3472 impl fidl::encoding::ValueTypeMarker for MouseSimulateMouseEventRequest {
3473 type Borrowed<'a> = &'a Self;
3474 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3475 value
3476 }
3477 }
3478
3479 unsafe impl fidl::encoding::TypeMarker for MouseSimulateMouseEventRequest {
3480 type Owned = Self;
3481
3482 #[inline(always)]
3483 fn inline_align(_context: fidl::encoding::Context) -> usize {
3484 8
3485 }
3486
3487 #[inline(always)]
3488 fn inline_size(_context: fidl::encoding::Context) -> usize {
3489 16
3490 }
3491 }
3492
3493 unsafe impl<D: fidl::encoding::ResourceDialect>
3494 fidl::encoding::Encode<MouseSimulateMouseEventRequest, D>
3495 for &MouseSimulateMouseEventRequest
3496 {
3497 unsafe fn encode(
3498 self,
3499 encoder: &mut fidl::encoding::Encoder<'_, D>,
3500 offset: usize,
3501 mut depth: fidl::encoding::Depth,
3502 ) -> fidl::Result<()> {
3503 encoder.debug_check_bounds::<MouseSimulateMouseEventRequest>(offset);
3504 let max_ordinal: u64 = self.max_ordinal_present();
3506 encoder.write_num(max_ordinal, offset);
3507 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3508 if max_ordinal == 0 {
3510 return Ok(());
3511 }
3512 depth.increment()?;
3513 let envelope_size = 8;
3514 let bytes_len = max_ordinal as usize * envelope_size;
3515 #[allow(unused_variables)]
3516 let offset = encoder.out_of_line_offset(bytes_len);
3517 let mut _prev_end_offset: usize = 0;
3518 if 1 > max_ordinal {
3519 return Ok(());
3520 }
3521
3522 let cur_offset: usize = (1 - 1) * envelope_size;
3525
3526 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3528
3529 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
3534 self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
3535 encoder, offset + cur_offset, depth
3536 )?;
3537
3538 _prev_end_offset = cur_offset + envelope_size;
3539 if 2 > max_ordinal {
3540 return Ok(());
3541 }
3542
3543 let cur_offset: usize = (2 - 1) * envelope_size;
3546
3547 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3549
3550 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3555 self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3556 encoder,
3557 offset + cur_offset,
3558 depth,
3559 )?;
3560
3561 _prev_end_offset = cur_offset + envelope_size;
3562 if 3 > max_ordinal {
3563 return Ok(());
3564 }
3565
3566 let cur_offset: usize = (3 - 1) * envelope_size;
3569
3570 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3572
3573 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3578 self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3579 encoder,
3580 offset + cur_offset,
3581 depth,
3582 )?;
3583
3584 _prev_end_offset = cur_offset + envelope_size;
3585 if 4 > max_ordinal {
3586 return Ok(());
3587 }
3588
3589 let cur_offset: usize = (4 - 1) * envelope_size;
3592
3593 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3595
3596 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3601 self.scroll_v_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3602 encoder,
3603 offset + cur_offset,
3604 depth,
3605 )?;
3606
3607 _prev_end_offset = cur_offset + envelope_size;
3608 if 5 > max_ordinal {
3609 return Ok(());
3610 }
3611
3612 let cur_offset: usize = (5 - 1) * envelope_size;
3615
3616 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3618
3619 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3624 self.scroll_h_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3625 encoder,
3626 offset + cur_offset,
3627 depth,
3628 )?;
3629
3630 _prev_end_offset = cur_offset + envelope_size;
3631 if 6 > max_ordinal {
3632 return Ok(());
3633 }
3634
3635 let cur_offset: usize = (6 - 1) * envelope_size;
3638
3639 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3641
3642 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3647 self.scroll_v_physical_pixel
3648 .as_ref()
3649 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3650 encoder,
3651 offset + cur_offset,
3652 depth,
3653 )?;
3654
3655 _prev_end_offset = cur_offset + envelope_size;
3656 if 7 > max_ordinal {
3657 return Ok(());
3658 }
3659
3660 let cur_offset: usize = (7 - 1) * envelope_size;
3663
3664 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3666
3667 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3672 self.scroll_h_physical_pixel
3673 .as_ref()
3674 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3675 encoder,
3676 offset + cur_offset,
3677 depth,
3678 )?;
3679
3680 _prev_end_offset = cur_offset + envelope_size;
3681
3682 Ok(())
3683 }
3684 }
3685
3686 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3687 for MouseSimulateMouseEventRequest
3688 {
3689 #[inline(always)]
3690 fn new_empty() -> Self {
3691 Self::default()
3692 }
3693
3694 unsafe fn decode(
3695 &mut self,
3696 decoder: &mut fidl::encoding::Decoder<'_, D>,
3697 offset: usize,
3698 mut depth: fidl::encoding::Depth,
3699 ) -> fidl::Result<()> {
3700 decoder.debug_check_bounds::<Self>(offset);
3701 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3702 None => return Err(fidl::Error::NotNullable),
3703 Some(len) => len,
3704 };
3705 if len == 0 {
3707 return Ok(());
3708 };
3709 depth.increment()?;
3710 let envelope_size = 8;
3711 let bytes_len = len * envelope_size;
3712 let offset = decoder.out_of_line_offset(bytes_len)?;
3713 let mut _next_ordinal_to_read = 0;
3715 let mut next_offset = offset;
3716 let end_offset = offset + bytes_len;
3717 _next_ordinal_to_read += 1;
3718 if next_offset >= end_offset {
3719 return Ok(());
3720 }
3721
3722 while _next_ordinal_to_read < 1 {
3724 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3725 _next_ordinal_to_read += 1;
3726 next_offset += envelope_size;
3727 }
3728
3729 let next_out_of_line = decoder.next_out_of_line();
3730 let handles_before = decoder.remaining_handles();
3731 if let Some((inlined, num_bytes, num_handles)) =
3732 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3733 {
3734 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3735 if inlined != (member_inline_size <= 4) {
3736 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3737 }
3738 let inner_offset;
3739 let mut inner_depth = depth.clone();
3740 if inlined {
3741 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3742 inner_offset = next_offset;
3743 } else {
3744 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3745 inner_depth.increment()?;
3746 }
3747 let val_ref = self.pressed_buttons.get_or_insert_with(
3748 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3749 );
3750 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3751 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3752 {
3753 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3754 }
3755 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3756 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3757 }
3758 }
3759
3760 next_offset += envelope_size;
3761 _next_ordinal_to_read += 1;
3762 if next_offset >= end_offset {
3763 return Ok(());
3764 }
3765
3766 while _next_ordinal_to_read < 2 {
3768 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3769 _next_ordinal_to_read += 1;
3770 next_offset += envelope_size;
3771 }
3772
3773 let next_out_of_line = decoder.next_out_of_line();
3774 let handles_before = decoder.remaining_handles();
3775 if let Some((inlined, num_bytes, num_handles)) =
3776 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3777 {
3778 let member_inline_size =
3779 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3780 if inlined != (member_inline_size <= 4) {
3781 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3782 }
3783 let inner_offset;
3784 let mut inner_depth = depth.clone();
3785 if inlined {
3786 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3787 inner_offset = next_offset;
3788 } else {
3789 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3790 inner_depth.increment()?;
3791 }
3792 let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
3793 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3794 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3795 {
3796 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3797 }
3798 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3799 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3800 }
3801 }
3802
3803 next_offset += envelope_size;
3804 _next_ordinal_to_read += 1;
3805 if next_offset >= end_offset {
3806 return Ok(());
3807 }
3808
3809 while _next_ordinal_to_read < 3 {
3811 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3812 _next_ordinal_to_read += 1;
3813 next_offset += envelope_size;
3814 }
3815
3816 let next_out_of_line = decoder.next_out_of_line();
3817 let handles_before = decoder.remaining_handles();
3818 if let Some((inlined, num_bytes, num_handles)) =
3819 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3820 {
3821 let member_inline_size =
3822 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3823 if inlined != (member_inline_size <= 4) {
3824 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3825 }
3826 let inner_offset;
3827 let mut inner_depth = depth.clone();
3828 if inlined {
3829 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3830 inner_offset = next_offset;
3831 } else {
3832 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3833 inner_depth.increment()?;
3834 }
3835 let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
3836 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3837 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3838 {
3839 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3840 }
3841 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3842 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3843 }
3844 }
3845
3846 next_offset += envelope_size;
3847 _next_ordinal_to_read += 1;
3848 if next_offset >= end_offset {
3849 return Ok(());
3850 }
3851
3852 while _next_ordinal_to_read < 4 {
3854 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3855 _next_ordinal_to_read += 1;
3856 next_offset += envelope_size;
3857 }
3858
3859 let next_out_of_line = decoder.next_out_of_line();
3860 let handles_before = decoder.remaining_handles();
3861 if let Some((inlined, num_bytes, num_handles)) =
3862 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3863 {
3864 let member_inline_size =
3865 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3866 if inlined != (member_inline_size <= 4) {
3867 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3868 }
3869 let inner_offset;
3870 let mut inner_depth = depth.clone();
3871 if inlined {
3872 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3873 inner_offset = next_offset;
3874 } else {
3875 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3876 inner_depth.increment()?;
3877 }
3878 let val_ref = self.scroll_v_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3879 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3880 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3881 {
3882 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3883 }
3884 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3885 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3886 }
3887 }
3888
3889 next_offset += envelope_size;
3890 _next_ordinal_to_read += 1;
3891 if next_offset >= end_offset {
3892 return Ok(());
3893 }
3894
3895 while _next_ordinal_to_read < 5 {
3897 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3898 _next_ordinal_to_read += 1;
3899 next_offset += envelope_size;
3900 }
3901
3902 let next_out_of_line = decoder.next_out_of_line();
3903 let handles_before = decoder.remaining_handles();
3904 if let Some((inlined, num_bytes, num_handles)) =
3905 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3906 {
3907 let member_inline_size =
3908 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3909 if inlined != (member_inline_size <= 4) {
3910 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3911 }
3912 let inner_offset;
3913 let mut inner_depth = depth.clone();
3914 if inlined {
3915 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3916 inner_offset = next_offset;
3917 } else {
3918 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3919 inner_depth.increment()?;
3920 }
3921 let val_ref = self.scroll_h_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3922 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3923 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3924 {
3925 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3926 }
3927 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3928 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3929 }
3930 }
3931
3932 next_offset += envelope_size;
3933 _next_ordinal_to_read += 1;
3934 if next_offset >= end_offset {
3935 return Ok(());
3936 }
3937
3938 while _next_ordinal_to_read < 6 {
3940 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3941 _next_ordinal_to_read += 1;
3942 next_offset += envelope_size;
3943 }
3944
3945 let next_out_of_line = decoder.next_out_of_line();
3946 let handles_before = decoder.remaining_handles();
3947 if let Some((inlined, num_bytes, num_handles)) =
3948 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3949 {
3950 let member_inline_size =
3951 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3952 if inlined != (member_inline_size <= 4) {
3953 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3954 }
3955 let inner_offset;
3956 let mut inner_depth = depth.clone();
3957 if inlined {
3958 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3959 inner_offset = next_offset;
3960 } else {
3961 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3962 inner_depth.increment()?;
3963 }
3964 let val_ref =
3965 self.scroll_v_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3966 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3967 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3968 {
3969 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3970 }
3971 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3972 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3973 }
3974 }
3975
3976 next_offset += envelope_size;
3977 _next_ordinal_to_read += 1;
3978 if next_offset >= end_offset {
3979 return Ok(());
3980 }
3981
3982 while _next_ordinal_to_read < 7 {
3984 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3985 _next_ordinal_to_read += 1;
3986 next_offset += envelope_size;
3987 }
3988
3989 let next_out_of_line = decoder.next_out_of_line();
3990 let handles_before = decoder.remaining_handles();
3991 if let Some((inlined, num_bytes, num_handles)) =
3992 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3993 {
3994 let member_inline_size =
3995 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3996 if inlined != (member_inline_size <= 4) {
3997 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3998 }
3999 let inner_offset;
4000 let mut inner_depth = depth.clone();
4001 if inlined {
4002 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4003 inner_offset = next_offset;
4004 } else {
4005 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4006 inner_depth.increment()?;
4007 }
4008 let val_ref =
4009 self.scroll_h_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
4010 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4011 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4012 {
4013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4014 }
4015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4017 }
4018 }
4019
4020 next_offset += envelope_size;
4021
4022 while next_offset < end_offset {
4024 _next_ordinal_to_read += 1;
4025 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4026 next_offset += envelope_size;
4027 }
4028
4029 Ok(())
4030 }
4031 }
4032
4033 impl TouchInputListenerReportTouchInputRequest {
4034 #[inline(always)]
4035 fn max_ordinal_present(&self) -> u64 {
4036 if let Some(_) = self.device_id {
4037 return 8;
4038 }
4039 if let Some(_) = self.pointer_id {
4040 return 7;
4041 }
4042 if let Some(_) = self.phase {
4043 return 6;
4044 }
4045 if let Some(_) = self.component_name {
4046 return 5;
4047 }
4048 if let Some(_) = self.device_pixel_ratio {
4049 return 4;
4050 }
4051 if let Some(_) = self.time_received {
4052 return 3;
4053 }
4054 if let Some(_) = self.local_y {
4055 return 2;
4056 }
4057 if let Some(_) = self.local_x {
4058 return 1;
4059 }
4060 0
4061 }
4062 }
4063
4064 impl fidl::encoding::ValueTypeMarker for TouchInputListenerReportTouchInputRequest {
4065 type Borrowed<'a> = &'a Self;
4066 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4067 value
4068 }
4069 }
4070
4071 unsafe impl fidl::encoding::TypeMarker for TouchInputListenerReportTouchInputRequest {
4072 type Owned = Self;
4073
4074 #[inline(always)]
4075 fn inline_align(_context: fidl::encoding::Context) -> usize {
4076 8
4077 }
4078
4079 #[inline(always)]
4080 fn inline_size(_context: fidl::encoding::Context) -> usize {
4081 16
4082 }
4083 }
4084
4085 unsafe impl<D: fidl::encoding::ResourceDialect>
4086 fidl::encoding::Encode<TouchInputListenerReportTouchInputRequest, D>
4087 for &TouchInputListenerReportTouchInputRequest
4088 {
4089 unsafe fn encode(
4090 self,
4091 encoder: &mut fidl::encoding::Encoder<'_, D>,
4092 offset: usize,
4093 mut depth: fidl::encoding::Depth,
4094 ) -> fidl::Result<()> {
4095 encoder.debug_check_bounds::<TouchInputListenerReportTouchInputRequest>(offset);
4096 let max_ordinal: u64 = self.max_ordinal_present();
4098 encoder.write_num(max_ordinal, offset);
4099 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4100 if max_ordinal == 0 {
4102 return Ok(());
4103 }
4104 depth.increment()?;
4105 let envelope_size = 8;
4106 let bytes_len = max_ordinal as usize * envelope_size;
4107 #[allow(unused_variables)]
4108 let offset = encoder.out_of_line_offset(bytes_len);
4109 let mut _prev_end_offset: usize = 0;
4110 if 1 > max_ordinal {
4111 return Ok(());
4112 }
4113
4114 let cur_offset: usize = (1 - 1) * envelope_size;
4117
4118 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4120
4121 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4126 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4127 encoder,
4128 offset + cur_offset,
4129 depth,
4130 )?;
4131
4132 _prev_end_offset = cur_offset + envelope_size;
4133 if 2 > max_ordinal {
4134 return Ok(());
4135 }
4136
4137 let cur_offset: usize = (2 - 1) * envelope_size;
4140
4141 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4143
4144 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4149 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4150 encoder,
4151 offset + cur_offset,
4152 depth,
4153 )?;
4154
4155 _prev_end_offset = cur_offset + envelope_size;
4156 if 3 > max_ordinal {
4157 return Ok(());
4158 }
4159
4160 let cur_offset: usize = (3 - 1) * envelope_size;
4163
4164 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4166
4167 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4172 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4173 encoder,
4174 offset + cur_offset,
4175 depth,
4176 )?;
4177
4178 _prev_end_offset = cur_offset + envelope_size;
4179 if 4 > max_ordinal {
4180 return Ok(());
4181 }
4182
4183 let cur_offset: usize = (4 - 1) * envelope_size;
4186
4187 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4189
4190 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4195 self.device_pixel_ratio
4196 .as_ref()
4197 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4198 encoder,
4199 offset + cur_offset,
4200 depth,
4201 )?;
4202
4203 _prev_end_offset = cur_offset + envelope_size;
4204 if 5 > max_ordinal {
4205 return Ok(());
4206 }
4207
4208 let cur_offset: usize = (5 - 1) * envelope_size;
4211
4212 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4214
4215 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
4220 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
4221 encoder, offset + cur_offset, depth
4222 )?;
4223
4224 _prev_end_offset = cur_offset + envelope_size;
4225 if 6 > max_ordinal {
4226 return Ok(());
4227 }
4228
4229 let cur_offset: usize = (6 - 1) * envelope_size;
4232
4233 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4235
4236 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_pointer__common::EventPhase, D>(
4241 self.phase.as_ref().map(<fidl_fuchsia_ui_pointer__common::EventPhase as fidl::encoding::ValueTypeMarker>::borrow),
4242 encoder, offset + cur_offset, depth
4243 )?;
4244
4245 _prev_end_offset = cur_offset + envelope_size;
4246 if 7 > max_ordinal {
4247 return Ok(());
4248 }
4249
4250 let cur_offset: usize = (7 - 1) * envelope_size;
4253
4254 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4256
4257 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4262 self.pointer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4263 encoder,
4264 offset + cur_offset,
4265 depth,
4266 )?;
4267
4268 _prev_end_offset = cur_offset + envelope_size;
4269 if 8 > max_ordinal {
4270 return Ok(());
4271 }
4272
4273 let cur_offset: usize = (8 - 1) * envelope_size;
4276
4277 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4279
4280 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4285 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4286 encoder,
4287 offset + cur_offset,
4288 depth,
4289 )?;
4290
4291 _prev_end_offset = cur_offset + envelope_size;
4292
4293 Ok(())
4294 }
4295 }
4296
4297 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4298 for TouchInputListenerReportTouchInputRequest
4299 {
4300 #[inline(always)]
4301 fn new_empty() -> Self {
4302 Self::default()
4303 }
4304
4305 unsafe fn decode(
4306 &mut self,
4307 decoder: &mut fidl::encoding::Decoder<'_, D>,
4308 offset: usize,
4309 mut depth: fidl::encoding::Depth,
4310 ) -> fidl::Result<()> {
4311 decoder.debug_check_bounds::<Self>(offset);
4312 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4313 None => return Err(fidl::Error::NotNullable),
4314 Some(len) => len,
4315 };
4316 if len == 0 {
4318 return Ok(());
4319 };
4320 depth.increment()?;
4321 let envelope_size = 8;
4322 let bytes_len = len * envelope_size;
4323 let offset = decoder.out_of_line_offset(bytes_len)?;
4324 let mut _next_ordinal_to_read = 0;
4326 let mut next_offset = offset;
4327 let end_offset = offset + bytes_len;
4328 _next_ordinal_to_read += 1;
4329 if next_offset >= end_offset {
4330 return Ok(());
4331 }
4332
4333 while _next_ordinal_to_read < 1 {
4335 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4336 _next_ordinal_to_read += 1;
4337 next_offset += envelope_size;
4338 }
4339
4340 let next_out_of_line = decoder.next_out_of_line();
4341 let handles_before = decoder.remaining_handles();
4342 if let Some((inlined, num_bytes, num_handles)) =
4343 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4344 {
4345 let member_inline_size =
4346 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4347 if inlined != (member_inline_size <= 4) {
4348 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4349 }
4350 let inner_offset;
4351 let mut inner_depth = depth.clone();
4352 if inlined {
4353 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4354 inner_offset = next_offset;
4355 } else {
4356 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4357 inner_depth.increment()?;
4358 }
4359 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
4360 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4361 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4362 {
4363 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4364 }
4365 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4366 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4367 }
4368 }
4369
4370 next_offset += envelope_size;
4371 _next_ordinal_to_read += 1;
4372 if next_offset >= end_offset {
4373 return Ok(());
4374 }
4375
4376 while _next_ordinal_to_read < 2 {
4378 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4379 _next_ordinal_to_read += 1;
4380 next_offset += envelope_size;
4381 }
4382
4383 let next_out_of_line = decoder.next_out_of_line();
4384 let handles_before = decoder.remaining_handles();
4385 if let Some((inlined, num_bytes, num_handles)) =
4386 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4387 {
4388 let member_inline_size =
4389 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4390 if inlined != (member_inline_size <= 4) {
4391 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4392 }
4393 let inner_offset;
4394 let mut inner_depth = depth.clone();
4395 if inlined {
4396 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4397 inner_offset = next_offset;
4398 } else {
4399 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4400 inner_depth.increment()?;
4401 }
4402 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
4403 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4404 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4405 {
4406 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4407 }
4408 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4409 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4410 }
4411 }
4412
4413 next_offset += envelope_size;
4414 _next_ordinal_to_read += 1;
4415 if next_offset >= end_offset {
4416 return Ok(());
4417 }
4418
4419 while _next_ordinal_to_read < 3 {
4421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4422 _next_ordinal_to_read += 1;
4423 next_offset += envelope_size;
4424 }
4425
4426 let next_out_of_line = decoder.next_out_of_line();
4427 let handles_before = decoder.remaining_handles();
4428 if let Some((inlined, num_bytes, num_handles)) =
4429 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4430 {
4431 let member_inline_size =
4432 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4433 if inlined != (member_inline_size <= 4) {
4434 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4435 }
4436 let inner_offset;
4437 let mut inner_depth = depth.clone();
4438 if inlined {
4439 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4440 inner_offset = next_offset;
4441 } else {
4442 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4443 inner_depth.increment()?;
4444 }
4445 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
4446 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4447 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4448 {
4449 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4450 }
4451 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4452 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4453 }
4454 }
4455
4456 next_offset += envelope_size;
4457 _next_ordinal_to_read += 1;
4458 if next_offset >= end_offset {
4459 return Ok(());
4460 }
4461
4462 while _next_ordinal_to_read < 4 {
4464 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4465 _next_ordinal_to_read += 1;
4466 next_offset += envelope_size;
4467 }
4468
4469 let next_out_of_line = decoder.next_out_of_line();
4470 let handles_before = decoder.remaining_handles();
4471 if let Some((inlined, num_bytes, num_handles)) =
4472 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4473 {
4474 let member_inline_size =
4475 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4476 if inlined != (member_inline_size <= 4) {
4477 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4478 }
4479 let inner_offset;
4480 let mut inner_depth = depth.clone();
4481 if inlined {
4482 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4483 inner_offset = next_offset;
4484 } else {
4485 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4486 inner_depth.increment()?;
4487 }
4488 let val_ref =
4489 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
4490 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4491 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4492 {
4493 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4494 }
4495 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4496 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4497 }
4498 }
4499
4500 next_offset += envelope_size;
4501 _next_ordinal_to_read += 1;
4502 if next_offset >= end_offset {
4503 return Ok(());
4504 }
4505
4506 while _next_ordinal_to_read < 5 {
4508 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4509 _next_ordinal_to_read += 1;
4510 next_offset += envelope_size;
4511 }
4512
4513 let next_out_of_line = decoder.next_out_of_line();
4514 let handles_before = decoder.remaining_handles();
4515 if let Some((inlined, num_bytes, num_handles)) =
4516 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4517 {
4518 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4519 if inlined != (member_inline_size <= 4) {
4520 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4521 }
4522 let inner_offset;
4523 let mut inner_depth = depth.clone();
4524 if inlined {
4525 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4526 inner_offset = next_offset;
4527 } else {
4528 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4529 inner_depth.increment()?;
4530 }
4531 let val_ref = self.component_name.get_or_insert_with(|| {
4532 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
4533 });
4534 fidl::decode!(
4535 fidl::encoding::BoundedString<1024>,
4536 D,
4537 val_ref,
4538 decoder,
4539 inner_offset,
4540 inner_depth
4541 )?;
4542 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4543 {
4544 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4545 }
4546 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4547 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4548 }
4549 }
4550
4551 next_offset += envelope_size;
4552 _next_ordinal_to_read += 1;
4553 if next_offset >= end_offset {
4554 return Ok(());
4555 }
4556
4557 while _next_ordinal_to_read < 6 {
4559 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4560 _next_ordinal_to_read += 1;
4561 next_offset += envelope_size;
4562 }
4563
4564 let next_out_of_line = decoder.next_out_of_line();
4565 let handles_before = decoder.remaining_handles();
4566 if let Some((inlined, num_bytes, num_handles)) =
4567 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4568 {
4569 let member_inline_size = <fidl_fuchsia_ui_pointer__common::EventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4570 if inlined != (member_inline_size <= 4) {
4571 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4572 }
4573 let inner_offset;
4574 let mut inner_depth = depth.clone();
4575 if inlined {
4576 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4577 inner_offset = next_offset;
4578 } else {
4579 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4580 inner_depth.increment()?;
4581 }
4582 let val_ref = self.phase.get_or_insert_with(|| {
4583 fidl::new_empty!(fidl_fuchsia_ui_pointer__common::EventPhase, D)
4584 });
4585 fidl::decode!(
4586 fidl_fuchsia_ui_pointer__common::EventPhase,
4587 D,
4588 val_ref,
4589 decoder,
4590 inner_offset,
4591 inner_depth
4592 )?;
4593 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4594 {
4595 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4596 }
4597 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4598 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4599 }
4600 }
4601
4602 next_offset += envelope_size;
4603 _next_ordinal_to_read += 1;
4604 if next_offset >= end_offset {
4605 return Ok(());
4606 }
4607
4608 while _next_ordinal_to_read < 7 {
4610 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4611 _next_ordinal_to_read += 1;
4612 next_offset += envelope_size;
4613 }
4614
4615 let next_out_of_line = decoder.next_out_of_line();
4616 let handles_before = decoder.remaining_handles();
4617 if let Some((inlined, num_bytes, num_handles)) =
4618 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4619 {
4620 let member_inline_size =
4621 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4622 if inlined != (member_inline_size <= 4) {
4623 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4624 }
4625 let inner_offset;
4626 let mut inner_depth = depth.clone();
4627 if inlined {
4628 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4629 inner_offset = next_offset;
4630 } else {
4631 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4632 inner_depth.increment()?;
4633 }
4634 let val_ref = self.pointer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4635 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4636 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4637 {
4638 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4639 }
4640 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4641 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4642 }
4643 }
4644
4645 next_offset += envelope_size;
4646 _next_ordinal_to_read += 1;
4647 if next_offset >= end_offset {
4648 return Ok(());
4649 }
4650
4651 while _next_ordinal_to_read < 8 {
4653 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4654 _next_ordinal_to_read += 1;
4655 next_offset += envelope_size;
4656 }
4657
4658 let next_out_of_line = decoder.next_out_of_line();
4659 let handles_before = decoder.remaining_handles();
4660 if let Some((inlined, num_bytes, num_handles)) =
4661 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4662 {
4663 let member_inline_size =
4664 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4665 if inlined != (member_inline_size <= 4) {
4666 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4667 }
4668 let inner_offset;
4669 let mut inner_depth = depth.clone();
4670 if inlined {
4671 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4672 inner_offset = next_offset;
4673 } else {
4674 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4675 inner_depth.increment()?;
4676 }
4677 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4678 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4679 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4680 {
4681 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4682 }
4683 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4684 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4685 }
4686 }
4687
4688 next_offset += envelope_size;
4689
4690 while next_offset < end_offset {
4692 _next_ordinal_to_read += 1;
4693 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4694 next_offset += envelope_size;
4695 }
4696
4697 Ok(())
4698 }
4699 }
4700
4701 impl TouchScreenSimulateMultiFingerGestureRequest {
4702 #[inline(always)]
4703 fn max_ordinal_present(&self) -> u64 {
4704 if let Some(_) = self.finger_count {
4705 return 4;
4706 }
4707 if let Some(_) = self.move_event_count {
4708 return 3;
4709 }
4710 if let Some(_) = self.end_locations {
4711 return 2;
4712 }
4713 if let Some(_) = self.start_locations {
4714 return 1;
4715 }
4716 0
4717 }
4718 }
4719
4720 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4721 type Borrowed<'a> = &'a Self;
4722 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4723 value
4724 }
4725 }
4726
4727 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4728 type Owned = Self;
4729
4730 #[inline(always)]
4731 fn inline_align(_context: fidl::encoding::Context) -> usize {
4732 8
4733 }
4734
4735 #[inline(always)]
4736 fn inline_size(_context: fidl::encoding::Context) -> usize {
4737 16
4738 }
4739 }
4740
4741 unsafe impl<D: fidl::encoding::ResourceDialect>
4742 fidl::encoding::Encode<TouchScreenSimulateMultiFingerGestureRequest, D>
4743 for &TouchScreenSimulateMultiFingerGestureRequest
4744 {
4745 unsafe fn encode(
4746 self,
4747 encoder: &mut fidl::encoding::Encoder<'_, D>,
4748 offset: usize,
4749 mut depth: fidl::encoding::Depth,
4750 ) -> fidl::Result<()> {
4751 encoder.debug_check_bounds::<TouchScreenSimulateMultiFingerGestureRequest>(offset);
4752 let max_ordinal: u64 = self.max_ordinal_present();
4754 encoder.write_num(max_ordinal, offset);
4755 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4756 if max_ordinal == 0 {
4758 return Ok(());
4759 }
4760 depth.increment()?;
4761 let envelope_size = 8;
4762 let bytes_len = max_ordinal as usize * envelope_size;
4763 #[allow(unused_variables)]
4764 let offset = encoder.out_of_line_offset(bytes_len);
4765 let mut _prev_end_offset: usize = 0;
4766 if 1 > max_ordinal {
4767 return Ok(());
4768 }
4769
4770 let cur_offset: usize = (1 - 1) * envelope_size;
4773
4774 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4776
4777 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D>(
4782 self.start_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4783 encoder, offset + cur_offset, depth
4784 )?;
4785
4786 _prev_end_offset = cur_offset + envelope_size;
4787 if 2 > max_ordinal {
4788 return Ok(());
4789 }
4790
4791 let cur_offset: usize = (2 - 1) * envelope_size;
4794
4795 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4797
4798 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D>(
4803 self.end_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4804 encoder, offset + cur_offset, depth
4805 )?;
4806
4807 _prev_end_offset = cur_offset + envelope_size;
4808 if 3 > max_ordinal {
4809 return Ok(());
4810 }
4811
4812 let cur_offset: usize = (3 - 1) * envelope_size;
4815
4816 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4818
4819 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4824 self.move_event_count
4825 .as_ref()
4826 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4827 encoder,
4828 offset + cur_offset,
4829 depth,
4830 )?;
4831
4832 _prev_end_offset = cur_offset + envelope_size;
4833 if 4 > max_ordinal {
4834 return Ok(());
4835 }
4836
4837 let cur_offset: usize = (4 - 1) * envelope_size;
4840
4841 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4843
4844 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4849 self.finger_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4850 encoder,
4851 offset + cur_offset,
4852 depth,
4853 )?;
4854
4855 _prev_end_offset = cur_offset + envelope_size;
4856
4857 Ok(())
4858 }
4859 }
4860
4861 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4862 for TouchScreenSimulateMultiFingerGestureRequest
4863 {
4864 #[inline(always)]
4865 fn new_empty() -> Self {
4866 Self::default()
4867 }
4868
4869 unsafe fn decode(
4870 &mut self,
4871 decoder: &mut fidl::encoding::Decoder<'_, D>,
4872 offset: usize,
4873 mut depth: fidl::encoding::Depth,
4874 ) -> fidl::Result<()> {
4875 decoder.debug_check_bounds::<Self>(offset);
4876 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4877 None => return Err(fidl::Error::NotNullable),
4878 Some(len) => len,
4879 };
4880 if len == 0 {
4882 return Ok(());
4883 };
4884 depth.increment()?;
4885 let envelope_size = 8;
4886 let bytes_len = len * envelope_size;
4887 let offset = decoder.out_of_line_offset(bytes_len)?;
4888 let mut _next_ordinal_to_read = 0;
4890 let mut next_offset = offset;
4891 let end_offset = offset + bytes_len;
4892 _next_ordinal_to_read += 1;
4893 if next_offset >= end_offset {
4894 return Ok(());
4895 }
4896
4897 while _next_ordinal_to_read < 1 {
4899 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4900 _next_ordinal_to_read += 1;
4901 next_offset += envelope_size;
4902 }
4903
4904 let next_out_of_line = decoder.next_out_of_line();
4905 let handles_before = decoder.remaining_handles();
4906 if let Some((inlined, num_bytes, num_handles)) =
4907 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4908 {
4909 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4910 if inlined != (member_inline_size <= 4) {
4911 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4912 }
4913 let inner_offset;
4914 let mut inner_depth = depth.clone();
4915 if inlined {
4916 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4917 inner_offset = next_offset;
4918 } else {
4919 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4920 inner_depth.increment()?;
4921 }
4922 let val_ref =
4923 self.start_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D));
4924 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4925 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4926 {
4927 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4928 }
4929 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4930 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4931 }
4932 }
4933
4934 next_offset += envelope_size;
4935 _next_ordinal_to_read += 1;
4936 if next_offset >= end_offset {
4937 return Ok(());
4938 }
4939
4940 while _next_ordinal_to_read < 2 {
4942 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4943 _next_ordinal_to_read += 1;
4944 next_offset += envelope_size;
4945 }
4946
4947 let next_out_of_line = decoder.next_out_of_line();
4948 let handles_before = decoder.remaining_handles();
4949 if let Some((inlined, num_bytes, num_handles)) =
4950 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4951 {
4952 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4953 if inlined != (member_inline_size <= 4) {
4954 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4955 }
4956 let inner_offset;
4957 let mut inner_depth = depth.clone();
4958 if inlined {
4959 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4960 inner_offset = next_offset;
4961 } else {
4962 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4963 inner_depth.increment()?;
4964 }
4965 let val_ref =
4966 self.end_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D));
4967 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4968 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4969 {
4970 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4971 }
4972 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4973 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4974 }
4975 }
4976
4977 next_offset += envelope_size;
4978 _next_ordinal_to_read += 1;
4979 if next_offset >= end_offset {
4980 return Ok(());
4981 }
4982
4983 while _next_ordinal_to_read < 3 {
4985 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4986 _next_ordinal_to_read += 1;
4987 next_offset += envelope_size;
4988 }
4989
4990 let next_out_of_line = decoder.next_out_of_line();
4991 let handles_before = decoder.remaining_handles();
4992 if let Some((inlined, num_bytes, num_handles)) =
4993 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4994 {
4995 let member_inline_size =
4996 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4997 if inlined != (member_inline_size <= 4) {
4998 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4999 }
5000 let inner_offset;
5001 let mut inner_depth = depth.clone();
5002 if inlined {
5003 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5004 inner_offset = next_offset;
5005 } else {
5006 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5007 inner_depth.increment()?;
5008 }
5009 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5010 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5011 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5012 {
5013 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5014 }
5015 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5016 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5017 }
5018 }
5019
5020 next_offset += envelope_size;
5021 _next_ordinal_to_read += 1;
5022 if next_offset >= end_offset {
5023 return Ok(());
5024 }
5025
5026 while _next_ordinal_to_read < 4 {
5028 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5029 _next_ordinal_to_read += 1;
5030 next_offset += envelope_size;
5031 }
5032
5033 let next_out_of_line = decoder.next_out_of_line();
5034 let handles_before = decoder.remaining_handles();
5035 if let Some((inlined, num_bytes, num_handles)) =
5036 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5037 {
5038 let member_inline_size =
5039 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5040 if inlined != (member_inline_size <= 4) {
5041 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5042 }
5043 let inner_offset;
5044 let mut inner_depth = depth.clone();
5045 if inlined {
5046 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5047 inner_offset = next_offset;
5048 } else {
5049 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5050 inner_depth.increment()?;
5051 }
5052 let val_ref = self.finger_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5053 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5054 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5055 {
5056 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5057 }
5058 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5059 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5060 }
5061 }
5062
5063 next_offset += envelope_size;
5064
5065 while next_offset < end_offset {
5067 _next_ordinal_to_read += 1;
5068 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5069 next_offset += envelope_size;
5070 }
5071
5072 Ok(())
5073 }
5074 }
5075
5076 impl TouchScreenSimulateMultiTapRequest {
5077 #[inline(always)]
5078 fn max_ordinal_present(&self) -> u64 {
5079 if let Some(_) = self.tap_locations {
5080 return 1;
5081 }
5082 0
5083 }
5084 }
5085
5086 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiTapRequest {
5087 type Borrowed<'a> = &'a Self;
5088 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5089 value
5090 }
5091 }
5092
5093 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiTapRequest {
5094 type Owned = Self;
5095
5096 #[inline(always)]
5097 fn inline_align(_context: fidl::encoding::Context) -> usize {
5098 8
5099 }
5100
5101 #[inline(always)]
5102 fn inline_size(_context: fidl::encoding::Context) -> usize {
5103 16
5104 }
5105 }
5106
5107 unsafe impl<D: fidl::encoding::ResourceDialect>
5108 fidl::encoding::Encode<TouchScreenSimulateMultiTapRequest, D>
5109 for &TouchScreenSimulateMultiTapRequest
5110 {
5111 unsafe fn encode(
5112 self,
5113 encoder: &mut fidl::encoding::Encoder<'_, D>,
5114 offset: usize,
5115 mut depth: fidl::encoding::Depth,
5116 ) -> fidl::Result<()> {
5117 encoder.debug_check_bounds::<TouchScreenSimulateMultiTapRequest>(offset);
5118 let max_ordinal: u64 = self.max_ordinal_present();
5120 encoder.write_num(max_ordinal, offset);
5121 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5122 if max_ordinal == 0 {
5124 return Ok(());
5125 }
5126 depth.increment()?;
5127 let envelope_size = 8;
5128 let bytes_len = max_ordinal as usize * envelope_size;
5129 #[allow(unused_variables)]
5130 let offset = encoder.out_of_line_offset(bytes_len);
5131 let mut _prev_end_offset: usize = 0;
5132 if 1 > max_ordinal {
5133 return Ok(());
5134 }
5135
5136 let cur_offset: usize = (1 - 1) * envelope_size;
5139
5140 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5142
5143 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10>, D>(
5148 self.tap_locations.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
5149 encoder, offset + cur_offset, depth
5150 )?;
5151
5152 _prev_end_offset = cur_offset + envelope_size;
5153
5154 Ok(())
5155 }
5156 }
5157
5158 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5159 for TouchScreenSimulateMultiTapRequest
5160 {
5161 #[inline(always)]
5162 fn new_empty() -> Self {
5163 Self::default()
5164 }
5165
5166 unsafe fn decode(
5167 &mut self,
5168 decoder: &mut fidl::encoding::Decoder<'_, D>,
5169 offset: usize,
5170 mut depth: fidl::encoding::Depth,
5171 ) -> fidl::Result<()> {
5172 decoder.debug_check_bounds::<Self>(offset);
5173 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5174 None => return Err(fidl::Error::NotNullable),
5175 Some(len) => len,
5176 };
5177 if len == 0 {
5179 return Ok(());
5180 };
5181 depth.increment()?;
5182 let envelope_size = 8;
5183 let bytes_len = len * envelope_size;
5184 let offset = decoder.out_of_line_offset(bytes_len)?;
5185 let mut _next_ordinal_to_read = 0;
5187 let mut next_offset = offset;
5188 let end_offset = offset + bytes_len;
5189 _next_ordinal_to_read += 1;
5190 if next_offset >= end_offset {
5191 return Ok(());
5192 }
5193
5194 while _next_ordinal_to_read < 1 {
5196 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5197 _next_ordinal_to_read += 1;
5198 next_offset += envelope_size;
5199 }
5200
5201 let next_out_of_line = decoder.next_out_of_line();
5202 let handles_before = decoder.remaining_handles();
5203 if let Some((inlined, num_bytes, num_handles)) =
5204 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5205 {
5206 let member_inline_size = <fidl::encoding::Vector<
5207 fidl_fuchsia_math__common::Vec_,
5208 10,
5209 > as fidl::encoding::TypeMarker>::inline_size(
5210 decoder.context
5211 );
5212 if inlined != (member_inline_size <= 4) {
5213 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5214 }
5215 let inner_offset;
5216 let mut inner_depth = depth.clone();
5217 if inlined {
5218 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5219 inner_offset = next_offset;
5220 } else {
5221 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5222 inner_depth.increment()?;
5223 }
5224 let val_ref =
5225 self.tap_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10>, D));
5226 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5227 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5228 {
5229 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5230 }
5231 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5232 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5233 }
5234 }
5235
5236 next_offset += envelope_size;
5237
5238 while next_offset < end_offset {
5240 _next_ordinal_to_read += 1;
5241 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5242 next_offset += envelope_size;
5243 }
5244
5245 Ok(())
5246 }
5247 }
5248
5249 impl TouchScreenSimulateSwipeRequest {
5250 #[inline(always)]
5251 fn max_ordinal_present(&self) -> u64 {
5252 if let Some(_) = self.duration {
5253 return 4;
5254 }
5255 if let Some(_) = self.move_event_count {
5256 return 3;
5257 }
5258 if let Some(_) = self.end_location {
5259 return 2;
5260 }
5261 if let Some(_) = self.start_location {
5262 return 1;
5263 }
5264 0
5265 }
5266 }
5267
5268 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateSwipeRequest {
5269 type Borrowed<'a> = &'a Self;
5270 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5271 value
5272 }
5273 }
5274
5275 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateSwipeRequest {
5276 type Owned = Self;
5277
5278 #[inline(always)]
5279 fn inline_align(_context: fidl::encoding::Context) -> usize {
5280 8
5281 }
5282
5283 #[inline(always)]
5284 fn inline_size(_context: fidl::encoding::Context) -> usize {
5285 16
5286 }
5287 }
5288
5289 unsafe impl<D: fidl::encoding::ResourceDialect>
5290 fidl::encoding::Encode<TouchScreenSimulateSwipeRequest, D>
5291 for &TouchScreenSimulateSwipeRequest
5292 {
5293 unsafe fn encode(
5294 self,
5295 encoder: &mut fidl::encoding::Encoder<'_, D>,
5296 offset: usize,
5297 mut depth: fidl::encoding::Depth,
5298 ) -> fidl::Result<()> {
5299 encoder.debug_check_bounds::<TouchScreenSimulateSwipeRequest>(offset);
5300 let max_ordinal: u64 = self.max_ordinal_present();
5302 encoder.write_num(max_ordinal, offset);
5303 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5304 if max_ordinal == 0 {
5306 return Ok(());
5307 }
5308 depth.increment()?;
5309 let envelope_size = 8;
5310 let bytes_len = max_ordinal as usize * envelope_size;
5311 #[allow(unused_variables)]
5312 let offset = encoder.out_of_line_offset(bytes_len);
5313 let mut _prev_end_offset: usize = 0;
5314 if 1 > max_ordinal {
5315 return Ok(());
5316 }
5317
5318 let cur_offset: usize = (1 - 1) * envelope_size;
5321
5322 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5324
5325 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::Vec_, D>(
5330 self.start_location.as_ref().map(
5331 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5332 ),
5333 encoder,
5334 offset + cur_offset,
5335 depth,
5336 )?;
5337
5338 _prev_end_offset = cur_offset + envelope_size;
5339 if 2 > max_ordinal {
5340 return Ok(());
5341 }
5342
5343 let cur_offset: usize = (2 - 1) * envelope_size;
5346
5347 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5349
5350 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::Vec_, D>(
5355 self.end_location.as_ref().map(
5356 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5357 ),
5358 encoder,
5359 offset + cur_offset,
5360 depth,
5361 )?;
5362
5363 _prev_end_offset = cur_offset + envelope_size;
5364 if 3 > max_ordinal {
5365 return Ok(());
5366 }
5367
5368 let cur_offset: usize = (3 - 1) * envelope_size;
5371
5372 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5374
5375 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5380 self.move_event_count
5381 .as_ref()
5382 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5383 encoder,
5384 offset + cur_offset,
5385 depth,
5386 )?;
5387
5388 _prev_end_offset = cur_offset + envelope_size;
5389 if 4 > max_ordinal {
5390 return Ok(());
5391 }
5392
5393 let cur_offset: usize = (4 - 1) * envelope_size;
5396
5397 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5399
5400 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5405 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5406 encoder,
5407 offset + cur_offset,
5408 depth,
5409 )?;
5410
5411 _prev_end_offset = cur_offset + envelope_size;
5412
5413 Ok(())
5414 }
5415 }
5416
5417 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5418 for TouchScreenSimulateSwipeRequest
5419 {
5420 #[inline(always)]
5421 fn new_empty() -> Self {
5422 Self::default()
5423 }
5424
5425 unsafe fn decode(
5426 &mut self,
5427 decoder: &mut fidl::encoding::Decoder<'_, D>,
5428 offset: usize,
5429 mut depth: fidl::encoding::Depth,
5430 ) -> fidl::Result<()> {
5431 decoder.debug_check_bounds::<Self>(offset);
5432 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5433 None => return Err(fidl::Error::NotNullable),
5434 Some(len) => len,
5435 };
5436 if len == 0 {
5438 return Ok(());
5439 };
5440 depth.increment()?;
5441 let envelope_size = 8;
5442 let bytes_len = len * envelope_size;
5443 let offset = decoder.out_of_line_offset(bytes_len)?;
5444 let mut _next_ordinal_to_read = 0;
5446 let mut next_offset = offset;
5447 let end_offset = offset + bytes_len;
5448 _next_ordinal_to_read += 1;
5449 if next_offset >= end_offset {
5450 return Ok(());
5451 }
5452
5453 while _next_ordinal_to_read < 1 {
5455 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5456 _next_ordinal_to_read += 1;
5457 next_offset += envelope_size;
5458 }
5459
5460 let next_out_of_line = decoder.next_out_of_line();
5461 let handles_before = decoder.remaining_handles();
5462 if let Some((inlined, num_bytes, num_handles)) =
5463 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5464 {
5465 let member_inline_size =
5466 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5467 decoder.context,
5468 );
5469 if inlined != (member_inline_size <= 4) {
5470 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5471 }
5472 let inner_offset;
5473 let mut inner_depth = depth.clone();
5474 if inlined {
5475 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5476 inner_offset = next_offset;
5477 } else {
5478 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5479 inner_depth.increment()?;
5480 }
5481 let val_ref = self
5482 .start_location
5483 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::Vec_, D));
5484 fidl::decode!(
5485 fidl_fuchsia_math__common::Vec_,
5486 D,
5487 val_ref,
5488 decoder,
5489 inner_offset,
5490 inner_depth
5491 )?;
5492 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5493 {
5494 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5495 }
5496 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5497 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5498 }
5499 }
5500
5501 next_offset += envelope_size;
5502 _next_ordinal_to_read += 1;
5503 if next_offset >= end_offset {
5504 return Ok(());
5505 }
5506
5507 while _next_ordinal_to_read < 2 {
5509 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5510 _next_ordinal_to_read += 1;
5511 next_offset += envelope_size;
5512 }
5513
5514 let next_out_of_line = decoder.next_out_of_line();
5515 let handles_before = decoder.remaining_handles();
5516 if let Some((inlined, num_bytes, num_handles)) =
5517 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5518 {
5519 let member_inline_size =
5520 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5521 decoder.context,
5522 );
5523 if inlined != (member_inline_size <= 4) {
5524 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5525 }
5526 let inner_offset;
5527 let mut inner_depth = depth.clone();
5528 if inlined {
5529 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5530 inner_offset = next_offset;
5531 } else {
5532 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5533 inner_depth.increment()?;
5534 }
5535 let val_ref = self
5536 .end_location
5537 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::Vec_, D));
5538 fidl::decode!(
5539 fidl_fuchsia_math__common::Vec_,
5540 D,
5541 val_ref,
5542 decoder,
5543 inner_offset,
5544 inner_depth
5545 )?;
5546 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5547 {
5548 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5549 }
5550 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5551 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5552 }
5553 }
5554
5555 next_offset += envelope_size;
5556 _next_ordinal_to_read += 1;
5557 if next_offset >= end_offset {
5558 return Ok(());
5559 }
5560
5561 while _next_ordinal_to_read < 3 {
5563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5564 _next_ordinal_to_read += 1;
5565 next_offset += envelope_size;
5566 }
5567
5568 let next_out_of_line = decoder.next_out_of_line();
5569 let handles_before = decoder.remaining_handles();
5570 if let Some((inlined, num_bytes, num_handles)) =
5571 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5572 {
5573 let member_inline_size =
5574 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5575 if inlined != (member_inline_size <= 4) {
5576 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5577 }
5578 let inner_offset;
5579 let mut inner_depth = depth.clone();
5580 if inlined {
5581 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5582 inner_offset = next_offset;
5583 } else {
5584 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5585 inner_depth.increment()?;
5586 }
5587 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5588 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5589 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5590 {
5591 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5592 }
5593 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5594 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5595 }
5596 }
5597
5598 next_offset += envelope_size;
5599 _next_ordinal_to_read += 1;
5600 if next_offset >= end_offset {
5601 return Ok(());
5602 }
5603
5604 while _next_ordinal_to_read < 4 {
5606 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5607 _next_ordinal_to_read += 1;
5608 next_offset += envelope_size;
5609 }
5610
5611 let next_out_of_line = decoder.next_out_of_line();
5612 let handles_before = decoder.remaining_handles();
5613 if let Some((inlined, num_bytes, num_handles)) =
5614 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5615 {
5616 let member_inline_size =
5617 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5618 if inlined != (member_inline_size <= 4) {
5619 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5620 }
5621 let inner_offset;
5622 let mut inner_depth = depth.clone();
5623 if inlined {
5624 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5625 inner_offset = next_offset;
5626 } else {
5627 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5628 inner_depth.increment()?;
5629 }
5630 let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
5631 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5632 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5633 {
5634 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5635 }
5636 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5637 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5638 }
5639 }
5640
5641 next_offset += envelope_size;
5642
5643 while next_offset < end_offset {
5645 _next_ordinal_to_read += 1;
5646 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5647 next_offset += envelope_size;
5648 }
5649
5650 Ok(())
5651 }
5652 }
5653
5654 impl TouchScreenSimulateTapRequest {
5655 #[inline(always)]
5656 fn max_ordinal_present(&self) -> u64 {
5657 if let Some(_) = self.tap_location {
5658 return 1;
5659 }
5660 0
5661 }
5662 }
5663
5664 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTapRequest {
5665 type Borrowed<'a> = &'a Self;
5666 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5667 value
5668 }
5669 }
5670
5671 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTapRequest {
5672 type Owned = Self;
5673
5674 #[inline(always)]
5675 fn inline_align(_context: fidl::encoding::Context) -> usize {
5676 8
5677 }
5678
5679 #[inline(always)]
5680 fn inline_size(_context: fidl::encoding::Context) -> usize {
5681 16
5682 }
5683 }
5684
5685 unsafe impl<D: fidl::encoding::ResourceDialect>
5686 fidl::encoding::Encode<TouchScreenSimulateTapRequest, D>
5687 for &TouchScreenSimulateTapRequest
5688 {
5689 unsafe fn encode(
5690 self,
5691 encoder: &mut fidl::encoding::Encoder<'_, D>,
5692 offset: usize,
5693 mut depth: fidl::encoding::Depth,
5694 ) -> fidl::Result<()> {
5695 encoder.debug_check_bounds::<TouchScreenSimulateTapRequest>(offset);
5696 let max_ordinal: u64 = self.max_ordinal_present();
5698 encoder.write_num(max_ordinal, offset);
5699 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5700 if max_ordinal == 0 {
5702 return Ok(());
5703 }
5704 depth.increment()?;
5705 let envelope_size = 8;
5706 let bytes_len = max_ordinal as usize * envelope_size;
5707 #[allow(unused_variables)]
5708 let offset = encoder.out_of_line_offset(bytes_len);
5709 let mut _prev_end_offset: usize = 0;
5710 if 1 > max_ordinal {
5711 return Ok(());
5712 }
5713
5714 let cur_offset: usize = (1 - 1) * envelope_size;
5717
5718 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5720
5721 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::Vec_, D>(
5726 self.tap_location.as_ref().map(
5727 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5728 ),
5729 encoder,
5730 offset + cur_offset,
5731 depth,
5732 )?;
5733
5734 _prev_end_offset = cur_offset + envelope_size;
5735
5736 Ok(())
5737 }
5738 }
5739
5740 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5741 for TouchScreenSimulateTapRequest
5742 {
5743 #[inline(always)]
5744 fn new_empty() -> Self {
5745 Self::default()
5746 }
5747
5748 unsafe fn decode(
5749 &mut self,
5750 decoder: &mut fidl::encoding::Decoder<'_, D>,
5751 offset: usize,
5752 mut depth: fidl::encoding::Depth,
5753 ) -> fidl::Result<()> {
5754 decoder.debug_check_bounds::<Self>(offset);
5755 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5756 None => return Err(fidl::Error::NotNullable),
5757 Some(len) => len,
5758 };
5759 if len == 0 {
5761 return Ok(());
5762 };
5763 depth.increment()?;
5764 let envelope_size = 8;
5765 let bytes_len = len * envelope_size;
5766 let offset = decoder.out_of_line_offset(bytes_len)?;
5767 let mut _next_ordinal_to_read = 0;
5769 let mut next_offset = offset;
5770 let end_offset = offset + bytes_len;
5771 _next_ordinal_to_read += 1;
5772 if next_offset >= end_offset {
5773 return Ok(());
5774 }
5775
5776 while _next_ordinal_to_read < 1 {
5778 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5779 _next_ordinal_to_read += 1;
5780 next_offset += envelope_size;
5781 }
5782
5783 let next_out_of_line = decoder.next_out_of_line();
5784 let handles_before = decoder.remaining_handles();
5785 if let Some((inlined, num_bytes, num_handles)) =
5786 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5787 {
5788 let member_inline_size =
5789 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5790 decoder.context,
5791 );
5792 if inlined != (member_inline_size <= 4) {
5793 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5794 }
5795 let inner_offset;
5796 let mut inner_depth = depth.clone();
5797 if inlined {
5798 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5799 inner_offset = next_offset;
5800 } else {
5801 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5802 inner_depth.increment()?;
5803 }
5804 let val_ref = self
5805 .tap_location
5806 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::Vec_, D));
5807 fidl::decode!(
5808 fidl_fuchsia_math__common::Vec_,
5809 D,
5810 val_ref,
5811 decoder,
5812 inner_offset,
5813 inner_depth
5814 )?;
5815 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5816 {
5817 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5818 }
5819 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5820 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5821 }
5822 }
5823
5824 next_offset += envelope_size;
5825
5826 while next_offset < end_offset {
5828 _next_ordinal_to_read += 1;
5829 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5830 next_offset += envelope_size;
5831 }
5832
5833 Ok(())
5834 }
5835 }
5836}