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 { report: fidl::new_empty!(fidl_fuchsia_input_report_common::TouchInputReport, D) }
1148 }
1149
1150 #[inline]
1151 unsafe fn decode(
1152 &mut self,
1153 decoder: &mut fidl::encoding::Decoder<'_, D>,
1154 offset: usize,
1155 _depth: fidl::encoding::Depth,
1156 ) -> fidl::Result<()> {
1157 decoder.debug_check_bounds::<Self>(offset);
1158 fidl::decode!(
1160 fidl_fuchsia_input_report_common::TouchInputReport,
1161 D,
1162 &mut self.report,
1163 decoder,
1164 offset + 0,
1165 _depth
1166 )?;
1167 Ok(())
1168 }
1169 }
1170
1171 impl KeyboardInputListenerReportTextInputRequest {
1172 #[inline(always)]
1173 fn max_ordinal_present(&self) -> u64 {
1174 if let Some(_) = self.device_id {
1175 return 3;
1176 }
1177 if let Some(_) = self.non_printable {
1178 return 2;
1179 }
1180 if let Some(_) = self.text {
1181 return 1;
1182 }
1183 0
1184 }
1185 }
1186
1187 impl fidl::encoding::ValueTypeMarker for KeyboardInputListenerReportTextInputRequest {
1188 type Borrowed<'a> = &'a Self;
1189 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1190 value
1191 }
1192 }
1193
1194 unsafe impl fidl::encoding::TypeMarker for KeyboardInputListenerReportTextInputRequest {
1195 type Owned = Self;
1196
1197 #[inline(always)]
1198 fn inline_align(_context: fidl::encoding::Context) -> usize {
1199 8
1200 }
1201
1202 #[inline(always)]
1203 fn inline_size(_context: fidl::encoding::Context) -> usize {
1204 16
1205 }
1206 }
1207
1208 unsafe impl<D: fidl::encoding::ResourceDialect>
1209 fidl::encoding::Encode<KeyboardInputListenerReportTextInputRequest, D>
1210 for &KeyboardInputListenerReportTextInputRequest
1211 {
1212 unsafe fn encode(
1213 self,
1214 encoder: &mut fidl::encoding::Encoder<'_, D>,
1215 offset: usize,
1216 mut depth: fidl::encoding::Depth,
1217 ) -> fidl::Result<()> {
1218 encoder.debug_check_bounds::<KeyboardInputListenerReportTextInputRequest>(offset);
1219 let max_ordinal: u64 = self.max_ordinal_present();
1221 encoder.write_num(max_ordinal, offset);
1222 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1223 if max_ordinal == 0 {
1225 return Ok(());
1226 }
1227 depth.increment()?;
1228 let envelope_size = 8;
1229 let bytes_len = max_ordinal as usize * envelope_size;
1230 #[allow(unused_variables)]
1231 let offset = encoder.out_of_line_offset(bytes_len);
1232 let mut _prev_end_offset: usize = 0;
1233 if 1 > max_ordinal {
1234 return Ok(());
1235 }
1236
1237 let cur_offset: usize = (1 - 1) * envelope_size;
1240
1241 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1243
1244 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1249 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1250 encoder, offset + cur_offset, depth
1251 )?;
1252
1253 _prev_end_offset = cur_offset + envelope_size;
1254 if 2 > max_ordinal {
1255 return Ok(());
1256 }
1257
1258 let cur_offset: usize = (2 - 1) * envelope_size;
1261
1262 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1264
1265 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_input3_common::NonPrintableKey, D>(
1270 self.non_printable.as_ref().map(<fidl_fuchsia_ui_input3_common::NonPrintableKey as fidl::encoding::ValueTypeMarker>::borrow),
1271 encoder, offset + cur_offset, depth
1272 )?;
1273
1274 _prev_end_offset = cur_offset + envelope_size;
1275 if 3 > max_ordinal {
1276 return Ok(());
1277 }
1278
1279 let cur_offset: usize = (3 - 1) * envelope_size;
1282
1283 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1285
1286 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1291 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1292 encoder,
1293 offset + cur_offset,
1294 depth,
1295 )?;
1296
1297 _prev_end_offset = cur_offset + envelope_size;
1298
1299 Ok(())
1300 }
1301 }
1302
1303 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1304 for KeyboardInputListenerReportTextInputRequest
1305 {
1306 #[inline(always)]
1307 fn new_empty() -> Self {
1308 Self::default()
1309 }
1310
1311 unsafe fn decode(
1312 &mut self,
1313 decoder: &mut fidl::encoding::Decoder<'_, D>,
1314 offset: usize,
1315 mut depth: fidl::encoding::Depth,
1316 ) -> fidl::Result<()> {
1317 decoder.debug_check_bounds::<Self>(offset);
1318 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1319 None => return Err(fidl::Error::NotNullable),
1320 Some(len) => len,
1321 };
1322 if len == 0 {
1324 return Ok(());
1325 };
1326 depth.increment()?;
1327 let envelope_size = 8;
1328 let bytes_len = len * envelope_size;
1329 let offset = decoder.out_of_line_offset(bytes_len)?;
1330 let mut _next_ordinal_to_read = 0;
1332 let mut next_offset = offset;
1333 let end_offset = offset + bytes_len;
1334 _next_ordinal_to_read += 1;
1335 if next_offset >= end_offset {
1336 return Ok(());
1337 }
1338
1339 while _next_ordinal_to_read < 1 {
1341 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1342 _next_ordinal_to_read += 1;
1343 next_offset += envelope_size;
1344 }
1345
1346 let next_out_of_line = decoder.next_out_of_line();
1347 let handles_before = decoder.remaining_handles();
1348 if let Some((inlined, num_bytes, num_handles)) =
1349 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1350 {
1351 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1352 if inlined != (member_inline_size <= 4) {
1353 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1354 }
1355 let inner_offset;
1356 let mut inner_depth = depth.clone();
1357 if inlined {
1358 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1359 inner_offset = next_offset;
1360 } else {
1361 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1362 inner_depth.increment()?;
1363 }
1364 let val_ref = self.text.get_or_insert_with(|| {
1365 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1366 });
1367 fidl::decode!(
1368 fidl::encoding::BoundedString<1024>,
1369 D,
1370 val_ref,
1371 decoder,
1372 inner_offset,
1373 inner_depth
1374 )?;
1375 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1376 {
1377 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1378 }
1379 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1380 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1381 }
1382 }
1383
1384 next_offset += envelope_size;
1385 _next_ordinal_to_read += 1;
1386 if next_offset >= end_offset {
1387 return Ok(());
1388 }
1389
1390 while _next_ordinal_to_read < 2 {
1392 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1393 _next_ordinal_to_read += 1;
1394 next_offset += envelope_size;
1395 }
1396
1397 let next_out_of_line = decoder.next_out_of_line();
1398 let handles_before = decoder.remaining_handles();
1399 if let Some((inlined, num_bytes, num_handles)) =
1400 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1401 {
1402 let member_inline_size = <fidl_fuchsia_ui_input3_common::NonPrintableKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1403 if inlined != (member_inline_size <= 4) {
1404 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1405 }
1406 let inner_offset;
1407 let mut inner_depth = depth.clone();
1408 if inlined {
1409 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1410 inner_offset = next_offset;
1411 } else {
1412 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1413 inner_depth.increment()?;
1414 }
1415 let val_ref = self.non_printable.get_or_insert_with(|| {
1416 fidl::new_empty!(fidl_fuchsia_ui_input3_common::NonPrintableKey, D)
1417 });
1418 fidl::decode!(
1419 fidl_fuchsia_ui_input3_common::NonPrintableKey,
1420 D,
1421 val_ref,
1422 decoder,
1423 inner_offset,
1424 inner_depth
1425 )?;
1426 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1427 {
1428 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1429 }
1430 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1431 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1432 }
1433 }
1434
1435 next_offset += envelope_size;
1436 _next_ordinal_to_read += 1;
1437 if next_offset >= end_offset {
1438 return Ok(());
1439 }
1440
1441 while _next_ordinal_to_read < 3 {
1443 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1444 _next_ordinal_to_read += 1;
1445 next_offset += envelope_size;
1446 }
1447
1448 let next_out_of_line = decoder.next_out_of_line();
1449 let handles_before = decoder.remaining_handles();
1450 if let Some((inlined, num_bytes, num_handles)) =
1451 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1452 {
1453 let member_inline_size =
1454 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1455 if inlined != (member_inline_size <= 4) {
1456 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1457 }
1458 let inner_offset;
1459 let mut inner_depth = depth.clone();
1460 if inlined {
1461 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1462 inner_offset = next_offset;
1463 } else {
1464 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1465 inner_depth.increment()?;
1466 }
1467 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1468 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1469 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1470 {
1471 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1472 }
1473 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1474 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1475 }
1476 }
1477
1478 next_offset += envelope_size;
1479
1480 while next_offset < end_offset {
1482 _next_ordinal_to_read += 1;
1483 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1484 next_offset += envelope_size;
1485 }
1486
1487 Ok(())
1488 }
1489 }
1490
1491 impl KeyboardSimulateKeyEventRequest {
1492 #[inline(always)]
1493 fn max_ordinal_present(&self) -> u64 {
1494 if let Some(_) = self.report {
1495 return 1;
1496 }
1497 0
1498 }
1499 }
1500
1501 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyEventRequest {
1502 type Borrowed<'a> = &'a Self;
1503 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1504 value
1505 }
1506 }
1507
1508 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyEventRequest {
1509 type Owned = Self;
1510
1511 #[inline(always)]
1512 fn inline_align(_context: fidl::encoding::Context) -> usize {
1513 8
1514 }
1515
1516 #[inline(always)]
1517 fn inline_size(_context: fidl::encoding::Context) -> usize {
1518 16
1519 }
1520 }
1521
1522 unsafe impl<D: fidl::encoding::ResourceDialect>
1523 fidl::encoding::Encode<KeyboardSimulateKeyEventRequest, D>
1524 for &KeyboardSimulateKeyEventRequest
1525 {
1526 unsafe fn encode(
1527 self,
1528 encoder: &mut fidl::encoding::Encoder<'_, D>,
1529 offset: usize,
1530 mut depth: fidl::encoding::Depth,
1531 ) -> fidl::Result<()> {
1532 encoder.debug_check_bounds::<KeyboardSimulateKeyEventRequest>(offset);
1533 let max_ordinal: u64 = self.max_ordinal_present();
1535 encoder.write_num(max_ordinal, offset);
1536 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1537 if max_ordinal == 0 {
1539 return Ok(());
1540 }
1541 depth.increment()?;
1542 let envelope_size = 8;
1543 let bytes_len = max_ordinal as usize * envelope_size;
1544 #[allow(unused_variables)]
1545 let offset = encoder.out_of_line_offset(bytes_len);
1546 let mut _prev_end_offset: usize = 0;
1547 if 1 > max_ordinal {
1548 return Ok(());
1549 }
1550
1551 let cur_offset: usize = (1 - 1) * envelope_size;
1554
1555 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1557
1558 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report_common::KeyboardInputReport, D>(
1563 self.report.as_ref().map(<fidl_fuchsia_input_report_common::KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
1564 encoder, offset + cur_offset, depth
1565 )?;
1566
1567 _prev_end_offset = cur_offset + envelope_size;
1568
1569 Ok(())
1570 }
1571 }
1572
1573 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1574 for KeyboardSimulateKeyEventRequest
1575 {
1576 #[inline(always)]
1577 fn new_empty() -> Self {
1578 Self::default()
1579 }
1580
1581 unsafe fn decode(
1582 &mut self,
1583 decoder: &mut fidl::encoding::Decoder<'_, D>,
1584 offset: usize,
1585 mut depth: fidl::encoding::Depth,
1586 ) -> fidl::Result<()> {
1587 decoder.debug_check_bounds::<Self>(offset);
1588 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1589 None => return Err(fidl::Error::NotNullable),
1590 Some(len) => len,
1591 };
1592 if len == 0 {
1594 return Ok(());
1595 };
1596 depth.increment()?;
1597 let envelope_size = 8;
1598 let bytes_len = len * envelope_size;
1599 let offset = decoder.out_of_line_offset(bytes_len)?;
1600 let mut _next_ordinal_to_read = 0;
1602 let mut next_offset = offset;
1603 let end_offset = offset + bytes_len;
1604 _next_ordinal_to_read += 1;
1605 if next_offset >= end_offset {
1606 return Ok(());
1607 }
1608
1609 while _next_ordinal_to_read < 1 {
1611 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1612 _next_ordinal_to_read += 1;
1613 next_offset += envelope_size;
1614 }
1615
1616 let next_out_of_line = decoder.next_out_of_line();
1617 let handles_before = decoder.remaining_handles();
1618 if let Some((inlined, num_bytes, num_handles)) =
1619 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1620 {
1621 let member_inline_size = <fidl_fuchsia_input_report_common::KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1622 if inlined != (member_inline_size <= 4) {
1623 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1624 }
1625 let inner_offset;
1626 let mut inner_depth = depth.clone();
1627 if inlined {
1628 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1629 inner_offset = next_offset;
1630 } else {
1631 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1632 inner_depth.increment()?;
1633 }
1634 let val_ref = self.report.get_or_insert_with(|| {
1635 fidl::new_empty!(fidl_fuchsia_input_report_common::KeyboardInputReport, D)
1636 });
1637 fidl::decode!(
1638 fidl_fuchsia_input_report_common::KeyboardInputReport,
1639 D,
1640 val_ref,
1641 decoder,
1642 inner_offset,
1643 inner_depth
1644 )?;
1645 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1646 {
1647 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1648 }
1649 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1650 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1651 }
1652 }
1653
1654 next_offset += envelope_size;
1655
1656 while next_offset < end_offset {
1658 _next_ordinal_to_read += 1;
1659 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1660 next_offset += envelope_size;
1661 }
1662
1663 Ok(())
1664 }
1665 }
1666
1667 impl KeyboardSimulateKeyPressRequest {
1668 #[inline(always)]
1669 fn max_ordinal_present(&self) -> u64 {
1670 if let Some(_) = self.key_code {
1671 return 1;
1672 }
1673 0
1674 }
1675 }
1676
1677 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyPressRequest {
1678 type Borrowed<'a> = &'a Self;
1679 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1680 value
1681 }
1682 }
1683
1684 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyPressRequest {
1685 type Owned = Self;
1686
1687 #[inline(always)]
1688 fn inline_align(_context: fidl::encoding::Context) -> usize {
1689 8
1690 }
1691
1692 #[inline(always)]
1693 fn inline_size(_context: fidl::encoding::Context) -> usize {
1694 16
1695 }
1696 }
1697
1698 unsafe impl<D: fidl::encoding::ResourceDialect>
1699 fidl::encoding::Encode<KeyboardSimulateKeyPressRequest, D>
1700 for &KeyboardSimulateKeyPressRequest
1701 {
1702 unsafe fn encode(
1703 self,
1704 encoder: &mut fidl::encoding::Encoder<'_, D>,
1705 offset: usize,
1706 mut depth: fidl::encoding::Depth,
1707 ) -> fidl::Result<()> {
1708 encoder.debug_check_bounds::<KeyboardSimulateKeyPressRequest>(offset);
1709 let max_ordinal: u64 = self.max_ordinal_present();
1711 encoder.write_num(max_ordinal, offset);
1712 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1713 if max_ordinal == 0 {
1715 return Ok(());
1716 }
1717 depth.increment()?;
1718 let envelope_size = 8;
1719 let bytes_len = max_ordinal as usize * envelope_size;
1720 #[allow(unused_variables)]
1721 let offset = encoder.out_of_line_offset(bytes_len);
1722 let mut _prev_end_offset: usize = 0;
1723 if 1 > max_ordinal {
1724 return Ok(());
1725 }
1726
1727 let cur_offset: usize = (1 - 1) * envelope_size;
1730
1731 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1733
1734 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_common::Key, D>(
1739 self.key_code.as_ref().map(
1740 <fidl_fuchsia_input_common::Key as fidl::encoding::ValueTypeMarker>::borrow,
1741 ),
1742 encoder,
1743 offset + cur_offset,
1744 depth,
1745 )?;
1746
1747 _prev_end_offset = cur_offset + envelope_size;
1748
1749 Ok(())
1750 }
1751 }
1752
1753 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1754 for KeyboardSimulateKeyPressRequest
1755 {
1756 #[inline(always)]
1757 fn new_empty() -> Self {
1758 Self::default()
1759 }
1760
1761 unsafe fn decode(
1762 &mut self,
1763 decoder: &mut fidl::encoding::Decoder<'_, D>,
1764 offset: usize,
1765 mut depth: fidl::encoding::Depth,
1766 ) -> fidl::Result<()> {
1767 decoder.debug_check_bounds::<Self>(offset);
1768 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1769 None => return Err(fidl::Error::NotNullable),
1770 Some(len) => len,
1771 };
1772 if len == 0 {
1774 return Ok(());
1775 };
1776 depth.increment()?;
1777 let envelope_size = 8;
1778 let bytes_len = len * envelope_size;
1779 let offset = decoder.out_of_line_offset(bytes_len)?;
1780 let mut _next_ordinal_to_read = 0;
1782 let mut next_offset = offset;
1783 let end_offset = offset + bytes_len;
1784 _next_ordinal_to_read += 1;
1785 if next_offset >= end_offset {
1786 return Ok(());
1787 }
1788
1789 while _next_ordinal_to_read < 1 {
1791 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1792 _next_ordinal_to_read += 1;
1793 next_offset += envelope_size;
1794 }
1795
1796 let next_out_of_line = decoder.next_out_of_line();
1797 let handles_before = decoder.remaining_handles();
1798 if let Some((inlined, num_bytes, num_handles)) =
1799 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1800 {
1801 let member_inline_size =
1802 <fidl_fuchsia_input_common::Key as fidl::encoding::TypeMarker>::inline_size(
1803 decoder.context,
1804 );
1805 if inlined != (member_inline_size <= 4) {
1806 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1807 }
1808 let inner_offset;
1809 let mut inner_depth = depth.clone();
1810 if inlined {
1811 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1812 inner_offset = next_offset;
1813 } else {
1814 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1815 inner_depth.increment()?;
1816 }
1817 let val_ref = self
1818 .key_code
1819 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input_common::Key, D));
1820 fidl::decode!(
1821 fidl_fuchsia_input_common::Key,
1822 D,
1823 val_ref,
1824 decoder,
1825 inner_offset,
1826 inner_depth
1827 )?;
1828 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1829 {
1830 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1831 }
1832 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1833 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1834 }
1835 }
1836
1837 next_offset += envelope_size;
1838
1839 while next_offset < end_offset {
1841 _next_ordinal_to_read += 1;
1842 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1843 next_offset += envelope_size;
1844 }
1845
1846 Ok(())
1847 }
1848 }
1849
1850 impl KeyboardSimulateUsAsciiTextEntryRequest {
1851 #[inline(always)]
1852 fn max_ordinal_present(&self) -> u64 {
1853 if let Some(_) = self.text {
1854 return 1;
1855 }
1856 0
1857 }
1858 }
1859
1860 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1861 type Borrowed<'a> = &'a Self;
1862 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1863 value
1864 }
1865 }
1866
1867 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1868 type Owned = Self;
1869
1870 #[inline(always)]
1871 fn inline_align(_context: fidl::encoding::Context) -> usize {
1872 8
1873 }
1874
1875 #[inline(always)]
1876 fn inline_size(_context: fidl::encoding::Context) -> usize {
1877 16
1878 }
1879 }
1880
1881 unsafe impl<D: fidl::encoding::ResourceDialect>
1882 fidl::encoding::Encode<KeyboardSimulateUsAsciiTextEntryRequest, D>
1883 for &KeyboardSimulateUsAsciiTextEntryRequest
1884 {
1885 unsafe fn encode(
1886 self,
1887 encoder: &mut fidl::encoding::Encoder<'_, D>,
1888 offset: usize,
1889 mut depth: fidl::encoding::Depth,
1890 ) -> fidl::Result<()> {
1891 encoder.debug_check_bounds::<KeyboardSimulateUsAsciiTextEntryRequest>(offset);
1892 let max_ordinal: u64 = self.max_ordinal_present();
1894 encoder.write_num(max_ordinal, offset);
1895 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1896 if max_ordinal == 0 {
1898 return Ok(());
1899 }
1900 depth.increment()?;
1901 let envelope_size = 8;
1902 let bytes_len = max_ordinal as usize * envelope_size;
1903 #[allow(unused_variables)]
1904 let offset = encoder.out_of_line_offset(bytes_len);
1905 let mut _prev_end_offset: usize = 0;
1906 if 1 > max_ordinal {
1907 return Ok(());
1908 }
1909
1910 let cur_offset: usize = (1 - 1) * envelope_size;
1913
1914 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1916
1917 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1922 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1923 encoder, offset + cur_offset, depth
1924 )?;
1925
1926 _prev_end_offset = cur_offset + envelope_size;
1927
1928 Ok(())
1929 }
1930 }
1931
1932 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1933 for KeyboardSimulateUsAsciiTextEntryRequest
1934 {
1935 #[inline(always)]
1936 fn new_empty() -> Self {
1937 Self::default()
1938 }
1939
1940 unsafe fn decode(
1941 &mut self,
1942 decoder: &mut fidl::encoding::Decoder<'_, D>,
1943 offset: usize,
1944 mut depth: fidl::encoding::Depth,
1945 ) -> fidl::Result<()> {
1946 decoder.debug_check_bounds::<Self>(offset);
1947 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1948 None => return Err(fidl::Error::NotNullable),
1949 Some(len) => len,
1950 };
1951 if len == 0 {
1953 return Ok(());
1954 };
1955 depth.increment()?;
1956 let envelope_size = 8;
1957 let bytes_len = len * envelope_size;
1958 let offset = decoder.out_of_line_offset(bytes_len)?;
1959 let mut _next_ordinal_to_read = 0;
1961 let mut next_offset = offset;
1962 let end_offset = offset + bytes_len;
1963 _next_ordinal_to_read += 1;
1964 if next_offset >= end_offset {
1965 return Ok(());
1966 }
1967
1968 while _next_ordinal_to_read < 1 {
1970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1971 _next_ordinal_to_read += 1;
1972 next_offset += envelope_size;
1973 }
1974
1975 let next_out_of_line = decoder.next_out_of_line();
1976 let handles_before = decoder.remaining_handles();
1977 if let Some((inlined, num_bytes, num_handles)) =
1978 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1979 {
1980 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1981 if inlined != (member_inline_size <= 4) {
1982 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1983 }
1984 let inner_offset;
1985 let mut inner_depth = depth.clone();
1986 if inlined {
1987 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1988 inner_offset = next_offset;
1989 } else {
1990 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1991 inner_depth.increment()?;
1992 }
1993 let val_ref = self.text.get_or_insert_with(|| {
1994 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1995 });
1996 fidl::decode!(
1997 fidl::encoding::BoundedString<1024>,
1998 D,
1999 val_ref,
2000 decoder,
2001 inner_offset,
2002 inner_depth
2003 )?;
2004 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2005 {
2006 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2007 }
2008 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2009 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2010 }
2011 }
2012
2013 next_offset += envelope_size;
2014
2015 while next_offset < end_offset {
2017 _next_ordinal_to_read += 1;
2018 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2019 next_offset += envelope_size;
2020 }
2021
2022 Ok(())
2023 }
2024 }
2025
2026 impl MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2027 #[inline(always)]
2028 fn max_ordinal_present(&self) -> u64 {
2029 if let Some(_) = self.delay {
2030 return 2;
2031 }
2032 if let Some(_) = self.button {
2033 return 1;
2034 }
2035 0
2036 }
2037 }
2038
2039 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2040 type Borrowed<'a> = &'a Self;
2041 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2042 value
2043 }
2044 }
2045
2046 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2047 type Owned = Self;
2048
2049 #[inline(always)]
2050 fn inline_align(_context: fidl::encoding::Context) -> usize {
2051 8
2052 }
2053
2054 #[inline(always)]
2055 fn inline_size(_context: fidl::encoding::Context) -> usize {
2056 16
2057 }
2058 }
2059
2060 unsafe impl<D: fidl::encoding::ResourceDialect>
2061 fidl::encoding::Encode<MediaButtonsDeviceScheduleSimulateButtonPressRequest, D>
2062 for &MediaButtonsDeviceScheduleSimulateButtonPressRequest
2063 {
2064 unsafe fn encode(
2065 self,
2066 encoder: &mut fidl::encoding::Encoder<'_, D>,
2067 offset: usize,
2068 mut depth: fidl::encoding::Depth,
2069 ) -> fidl::Result<()> {
2070 encoder
2071 .debug_check_bounds::<MediaButtonsDeviceScheduleSimulateButtonPressRequest>(offset);
2072 let max_ordinal: u64 = self.max_ordinal_present();
2074 encoder.write_num(max_ordinal, offset);
2075 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2076 if max_ordinal == 0 {
2078 return Ok(());
2079 }
2080 depth.increment()?;
2081 let envelope_size = 8;
2082 let bytes_len = max_ordinal as usize * envelope_size;
2083 #[allow(unused_variables)]
2084 let offset = encoder.out_of_line_offset(bytes_len);
2085 let mut _prev_end_offset: usize = 0;
2086 if 1 > max_ordinal {
2087 return Ok(());
2088 }
2089
2090 let cur_offset: usize = (1 - 1) * envelope_size;
2093
2094 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2096
2097 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report_common::ConsumerControlButton, D>(
2102 self.button.as_ref().map(<fidl_fuchsia_input_report_common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2103 encoder, offset + cur_offset, depth
2104 )?;
2105
2106 _prev_end_offset = cur_offset + envelope_size;
2107 if 2 > max_ordinal {
2108 return Ok(());
2109 }
2110
2111 let cur_offset: usize = (2 - 1) * envelope_size;
2114
2115 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2117
2118 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2123 self.delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2124 encoder,
2125 offset + cur_offset,
2126 depth,
2127 )?;
2128
2129 _prev_end_offset = cur_offset + envelope_size;
2130
2131 Ok(())
2132 }
2133 }
2134
2135 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2136 for MediaButtonsDeviceScheduleSimulateButtonPressRequest
2137 {
2138 #[inline(always)]
2139 fn new_empty() -> Self {
2140 Self::default()
2141 }
2142
2143 unsafe fn decode(
2144 &mut self,
2145 decoder: &mut fidl::encoding::Decoder<'_, D>,
2146 offset: usize,
2147 mut depth: fidl::encoding::Depth,
2148 ) -> fidl::Result<()> {
2149 decoder.debug_check_bounds::<Self>(offset);
2150 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2151 None => return Err(fidl::Error::NotNullable),
2152 Some(len) => len,
2153 };
2154 if len == 0 {
2156 return Ok(());
2157 };
2158 depth.increment()?;
2159 let envelope_size = 8;
2160 let bytes_len = len * envelope_size;
2161 let offset = decoder.out_of_line_offset(bytes_len)?;
2162 let mut _next_ordinal_to_read = 0;
2164 let mut next_offset = offset;
2165 let end_offset = offset + bytes_len;
2166 _next_ordinal_to_read += 1;
2167 if next_offset >= end_offset {
2168 return Ok(());
2169 }
2170
2171 while _next_ordinal_to_read < 1 {
2173 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2174 _next_ordinal_to_read += 1;
2175 next_offset += envelope_size;
2176 }
2177
2178 let next_out_of_line = decoder.next_out_of_line();
2179 let handles_before = decoder.remaining_handles();
2180 if let Some((inlined, num_bytes, num_handles)) =
2181 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2182 {
2183 let member_inline_size = <fidl_fuchsia_input_report_common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2184 if inlined != (member_inline_size <= 4) {
2185 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2186 }
2187 let inner_offset;
2188 let mut inner_depth = depth.clone();
2189 if inlined {
2190 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2191 inner_offset = next_offset;
2192 } else {
2193 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2194 inner_depth.increment()?;
2195 }
2196 let val_ref = self.button.get_or_insert_with(|| {
2197 fidl::new_empty!(fidl_fuchsia_input_report_common::ConsumerControlButton, D)
2198 });
2199 fidl::decode!(
2200 fidl_fuchsia_input_report_common::ConsumerControlButton,
2201 D,
2202 val_ref,
2203 decoder,
2204 inner_offset,
2205 inner_depth
2206 )?;
2207 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2208 {
2209 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2210 }
2211 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2212 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2213 }
2214 }
2215
2216 next_offset += envelope_size;
2217 _next_ordinal_to_read += 1;
2218 if next_offset >= end_offset {
2219 return Ok(());
2220 }
2221
2222 while _next_ordinal_to_read < 2 {
2224 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2225 _next_ordinal_to_read += 1;
2226 next_offset += envelope_size;
2227 }
2228
2229 let next_out_of_line = decoder.next_out_of_line();
2230 let handles_before = decoder.remaining_handles();
2231 if let Some((inlined, num_bytes, num_handles)) =
2232 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2233 {
2234 let member_inline_size =
2235 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2236 if inlined != (member_inline_size <= 4) {
2237 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2238 }
2239 let inner_offset;
2240 let mut inner_depth = depth.clone();
2241 if inlined {
2242 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2243 inner_offset = next_offset;
2244 } else {
2245 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2246 inner_depth.increment()?;
2247 }
2248 let val_ref = self.delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
2249 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2250 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2251 {
2252 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2253 }
2254 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2255 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2256 }
2257 }
2258
2259 next_offset += envelope_size;
2260
2261 while next_offset < end_offset {
2263 _next_ordinal_to_read += 1;
2264 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2265 next_offset += envelope_size;
2266 }
2267
2268 Ok(())
2269 }
2270 }
2271
2272 impl MediaButtonsDeviceSendButtonsStateRequest {
2273 #[inline(always)]
2274 fn max_ordinal_present(&self) -> u64 {
2275 if let Some(_) = self.buttons {
2276 return 1;
2277 }
2278 0
2279 }
2280 }
2281
2282 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
2283 type Borrowed<'a> = &'a Self;
2284 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2285 value
2286 }
2287 }
2288
2289 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
2290 type Owned = Self;
2291
2292 #[inline(always)]
2293 fn inline_align(_context: fidl::encoding::Context) -> usize {
2294 8
2295 }
2296
2297 #[inline(always)]
2298 fn inline_size(_context: fidl::encoding::Context) -> usize {
2299 16
2300 }
2301 }
2302
2303 unsafe impl<D: fidl::encoding::ResourceDialect>
2304 fidl::encoding::Encode<MediaButtonsDeviceSendButtonsStateRequest, D>
2305 for &MediaButtonsDeviceSendButtonsStateRequest
2306 {
2307 unsafe fn encode(
2308 self,
2309 encoder: &mut fidl::encoding::Encoder<'_, D>,
2310 offset: usize,
2311 mut depth: fidl::encoding::Depth,
2312 ) -> fidl::Result<()> {
2313 encoder.debug_check_bounds::<MediaButtonsDeviceSendButtonsStateRequest>(offset);
2314 let max_ordinal: u64 = self.max_ordinal_present();
2316 encoder.write_num(max_ordinal, offset);
2317 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2318 if max_ordinal == 0 {
2320 return Ok(());
2321 }
2322 depth.increment()?;
2323 let envelope_size = 8;
2324 let bytes_len = max_ordinal as usize * envelope_size;
2325 #[allow(unused_variables)]
2326 let offset = encoder.out_of_line_offset(bytes_len);
2327 let mut _prev_end_offset: usize = 0;
2328 if 1 > max_ordinal {
2329 return Ok(());
2330 }
2331
2332 let cur_offset: usize = (1 - 1) * envelope_size;
2335
2336 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2338
2339 fidl::encoding::encode_in_envelope_optional::<
2344 fidl::encoding::Vector<
2345 fidl_fuchsia_input_report_common::ConsumerControlButton,
2346 255,
2347 >,
2348 D,
2349 >(
2350 self.buttons.as_ref().map(
2351 <fidl::encoding::Vector<
2352 fidl_fuchsia_input_report_common::ConsumerControlButton,
2353 255,
2354 > as fidl::encoding::ValueTypeMarker>::borrow,
2355 ),
2356 encoder,
2357 offset + cur_offset,
2358 depth,
2359 )?;
2360
2361 _prev_end_offset = cur_offset + envelope_size;
2362
2363 Ok(())
2364 }
2365 }
2366
2367 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2368 for MediaButtonsDeviceSendButtonsStateRequest
2369 {
2370 #[inline(always)]
2371 fn new_empty() -> Self {
2372 Self::default()
2373 }
2374
2375 unsafe fn decode(
2376 &mut self,
2377 decoder: &mut fidl::encoding::Decoder<'_, D>,
2378 offset: usize,
2379 mut depth: fidl::encoding::Depth,
2380 ) -> fidl::Result<()> {
2381 decoder.debug_check_bounds::<Self>(offset);
2382 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2383 None => return Err(fidl::Error::NotNullable),
2384 Some(len) => len,
2385 };
2386 if len == 0 {
2388 return Ok(());
2389 };
2390 depth.increment()?;
2391 let envelope_size = 8;
2392 let bytes_len = len * envelope_size;
2393 let offset = decoder.out_of_line_offset(bytes_len)?;
2394 let mut _next_ordinal_to_read = 0;
2396 let mut next_offset = offset;
2397 let end_offset = offset + bytes_len;
2398 _next_ordinal_to_read += 1;
2399 if next_offset >= end_offset {
2400 return Ok(());
2401 }
2402
2403 while _next_ordinal_to_read < 1 {
2405 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2406 _next_ordinal_to_read += 1;
2407 next_offset += envelope_size;
2408 }
2409
2410 let next_out_of_line = decoder.next_out_of_line();
2411 let handles_before = decoder.remaining_handles();
2412 if let Some((inlined, num_bytes, num_handles)) =
2413 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2414 {
2415 let member_inline_size = <fidl::encoding::Vector<
2416 fidl_fuchsia_input_report_common::ConsumerControlButton,
2417 255,
2418 > as fidl::encoding::TypeMarker>::inline_size(
2419 decoder.context
2420 );
2421 if inlined != (member_inline_size <= 4) {
2422 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2423 }
2424 let inner_offset;
2425 let mut inner_depth = depth.clone();
2426 if inlined {
2427 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2428 inner_offset = next_offset;
2429 } else {
2430 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2431 inner_depth.increment()?;
2432 }
2433 let val_ref =
2434 self.buttons.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input_report_common::ConsumerControlButton, 255>, D));
2435 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input_report_common::ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
2436 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2437 {
2438 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2439 }
2440 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2441 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2442 }
2443 }
2444
2445 next_offset += envelope_size;
2446
2447 while next_offset < end_offset {
2449 _next_ordinal_to_read += 1;
2450 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2451 next_offset += envelope_size;
2452 }
2453
2454 Ok(())
2455 }
2456 }
2457
2458 impl MediaButtonsDeviceSimulateButtonPressRequest {
2459 #[inline(always)]
2460 fn max_ordinal_present(&self) -> u64 {
2461 if let Some(_) = self.button {
2462 return 1;
2463 }
2464 0
2465 }
2466 }
2467
2468 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2469 type Borrowed<'a> = &'a Self;
2470 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2471 value
2472 }
2473 }
2474
2475 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2476 type Owned = Self;
2477
2478 #[inline(always)]
2479 fn inline_align(_context: fidl::encoding::Context) -> usize {
2480 8
2481 }
2482
2483 #[inline(always)]
2484 fn inline_size(_context: fidl::encoding::Context) -> usize {
2485 16
2486 }
2487 }
2488
2489 unsafe impl<D: fidl::encoding::ResourceDialect>
2490 fidl::encoding::Encode<MediaButtonsDeviceSimulateButtonPressRequest, D>
2491 for &MediaButtonsDeviceSimulateButtonPressRequest
2492 {
2493 unsafe fn encode(
2494 self,
2495 encoder: &mut fidl::encoding::Encoder<'_, D>,
2496 offset: usize,
2497 mut depth: fidl::encoding::Depth,
2498 ) -> fidl::Result<()> {
2499 encoder.debug_check_bounds::<MediaButtonsDeviceSimulateButtonPressRequest>(offset);
2500 let max_ordinal: u64 = self.max_ordinal_present();
2502 encoder.write_num(max_ordinal, offset);
2503 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2504 if max_ordinal == 0 {
2506 return Ok(());
2507 }
2508 depth.increment()?;
2509 let envelope_size = 8;
2510 let bytes_len = max_ordinal as usize * envelope_size;
2511 #[allow(unused_variables)]
2512 let offset = encoder.out_of_line_offset(bytes_len);
2513 let mut _prev_end_offset: usize = 0;
2514 if 1 > max_ordinal {
2515 return Ok(());
2516 }
2517
2518 let cur_offset: usize = (1 - 1) * envelope_size;
2521
2522 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2524
2525 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report_common::ConsumerControlButton, D>(
2530 self.button.as_ref().map(<fidl_fuchsia_input_report_common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2531 encoder, offset + cur_offset, depth
2532 )?;
2533
2534 _prev_end_offset = cur_offset + envelope_size;
2535
2536 Ok(())
2537 }
2538 }
2539
2540 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2541 for MediaButtonsDeviceSimulateButtonPressRequest
2542 {
2543 #[inline(always)]
2544 fn new_empty() -> Self {
2545 Self::default()
2546 }
2547
2548 unsafe fn decode(
2549 &mut self,
2550 decoder: &mut fidl::encoding::Decoder<'_, D>,
2551 offset: usize,
2552 mut depth: fidl::encoding::Depth,
2553 ) -> fidl::Result<()> {
2554 decoder.debug_check_bounds::<Self>(offset);
2555 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2556 None => return Err(fidl::Error::NotNullable),
2557 Some(len) => len,
2558 };
2559 if len == 0 {
2561 return Ok(());
2562 };
2563 depth.increment()?;
2564 let envelope_size = 8;
2565 let bytes_len = len * envelope_size;
2566 let offset = decoder.out_of_line_offset(bytes_len)?;
2567 let mut _next_ordinal_to_read = 0;
2569 let mut next_offset = offset;
2570 let end_offset = offset + bytes_len;
2571 _next_ordinal_to_read += 1;
2572 if next_offset >= end_offset {
2573 return Ok(());
2574 }
2575
2576 while _next_ordinal_to_read < 1 {
2578 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2579 _next_ordinal_to_read += 1;
2580 next_offset += envelope_size;
2581 }
2582
2583 let next_out_of_line = decoder.next_out_of_line();
2584 let handles_before = decoder.remaining_handles();
2585 if let Some((inlined, num_bytes, num_handles)) =
2586 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2587 {
2588 let member_inline_size = <fidl_fuchsia_input_report_common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2589 if inlined != (member_inline_size <= 4) {
2590 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2591 }
2592 let inner_offset;
2593 let mut inner_depth = depth.clone();
2594 if inlined {
2595 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2596 inner_offset = next_offset;
2597 } else {
2598 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2599 inner_depth.increment()?;
2600 }
2601 let val_ref = self.button.get_or_insert_with(|| {
2602 fidl::new_empty!(fidl_fuchsia_input_report_common::ConsumerControlButton, D)
2603 });
2604 fidl::decode!(
2605 fidl_fuchsia_input_report_common::ConsumerControlButton,
2606 D,
2607 val_ref,
2608 decoder,
2609 inner_offset,
2610 inner_depth
2611 )?;
2612 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2613 {
2614 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2615 }
2616 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2617 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2618 }
2619 }
2620
2621 next_offset += envelope_size;
2622
2623 while next_offset < end_offset {
2625 _next_ordinal_to_read += 1;
2626 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2627 next_offset += envelope_size;
2628 }
2629
2630 Ok(())
2631 }
2632 }
2633
2634 impl MouseInputListenerReportMouseInputRequest {
2635 #[inline(always)]
2636 fn max_ordinal_present(&self) -> u64 {
2637 if let Some(_) = self.device_id {
2638 return 10;
2639 }
2640 if let Some(_) = self.wheel_y_physical_pixel {
2641 return 9;
2642 }
2643 if let Some(_) = self.wheel_x_physical_pixel {
2644 return 8;
2645 }
2646 if let Some(_) = self.device_pixel_ratio {
2647 return 7;
2648 }
2649 if let Some(_) = self.phase {
2650 return 6;
2651 }
2652 if let Some(_) = self.buttons {
2653 return 5;
2654 }
2655 if let Some(_) = self.component_name {
2656 return 4;
2657 }
2658 if let Some(_) = self.time_received {
2659 return 3;
2660 }
2661 if let Some(_) = self.local_y {
2662 return 2;
2663 }
2664 if let Some(_) = self.local_x {
2665 return 1;
2666 }
2667 0
2668 }
2669 }
2670
2671 impl fidl::encoding::ValueTypeMarker for MouseInputListenerReportMouseInputRequest {
2672 type Borrowed<'a> = &'a Self;
2673 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2674 value
2675 }
2676 }
2677
2678 unsafe impl fidl::encoding::TypeMarker for MouseInputListenerReportMouseInputRequest {
2679 type Owned = Self;
2680
2681 #[inline(always)]
2682 fn inline_align(_context: fidl::encoding::Context) -> usize {
2683 8
2684 }
2685
2686 #[inline(always)]
2687 fn inline_size(_context: fidl::encoding::Context) -> usize {
2688 16
2689 }
2690 }
2691
2692 unsafe impl<D: fidl::encoding::ResourceDialect>
2693 fidl::encoding::Encode<MouseInputListenerReportMouseInputRequest, D>
2694 for &MouseInputListenerReportMouseInputRequest
2695 {
2696 unsafe fn encode(
2697 self,
2698 encoder: &mut fidl::encoding::Encoder<'_, D>,
2699 offset: usize,
2700 mut depth: fidl::encoding::Depth,
2701 ) -> fidl::Result<()> {
2702 encoder.debug_check_bounds::<MouseInputListenerReportMouseInputRequest>(offset);
2703 let max_ordinal: u64 = self.max_ordinal_present();
2705 encoder.write_num(max_ordinal, offset);
2706 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2707 if max_ordinal == 0 {
2709 return Ok(());
2710 }
2711 depth.increment()?;
2712 let envelope_size = 8;
2713 let bytes_len = max_ordinal as usize * envelope_size;
2714 #[allow(unused_variables)]
2715 let offset = encoder.out_of_line_offset(bytes_len);
2716 let mut _prev_end_offset: usize = 0;
2717 if 1 > max_ordinal {
2718 return Ok(());
2719 }
2720
2721 let cur_offset: usize = (1 - 1) * envelope_size;
2724
2725 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2727
2728 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2733 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2734 encoder,
2735 offset + cur_offset,
2736 depth,
2737 )?;
2738
2739 _prev_end_offset = cur_offset + envelope_size;
2740 if 2 > max_ordinal {
2741 return Ok(());
2742 }
2743
2744 let cur_offset: usize = (2 - 1) * envelope_size;
2747
2748 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2750
2751 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2756 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2757 encoder,
2758 offset + cur_offset,
2759 depth,
2760 )?;
2761
2762 _prev_end_offset = cur_offset + envelope_size;
2763 if 3 > max_ordinal {
2764 return Ok(());
2765 }
2766
2767 let cur_offset: usize = (3 - 1) * envelope_size;
2770
2771 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2773
2774 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2779 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2780 encoder,
2781 offset + cur_offset,
2782 depth,
2783 )?;
2784
2785 _prev_end_offset = cur_offset + envelope_size;
2786 if 4 > max_ordinal {
2787 return Ok(());
2788 }
2789
2790 let cur_offset: usize = (4 - 1) * envelope_size;
2793
2794 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2796
2797 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
2802 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
2803 encoder, offset + cur_offset, depth
2804 )?;
2805
2806 _prev_end_offset = cur_offset + envelope_size;
2807 if 5 > max_ordinal {
2808 return Ok(());
2809 }
2810
2811 let cur_offset: usize = (5 - 1) * envelope_size;
2814
2815 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2817
2818 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
2823 self.buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
2824 encoder, offset + cur_offset, depth
2825 )?;
2826
2827 _prev_end_offset = cur_offset + envelope_size;
2828 if 6 > max_ordinal {
2829 return Ok(());
2830 }
2831
2832 let cur_offset: usize = (6 - 1) * envelope_size;
2835
2836 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2838
2839 fidl::encoding::encode_in_envelope_optional::<MouseEventPhase, D>(
2844 self.phase
2845 .as_ref()
2846 .map(<MouseEventPhase as fidl::encoding::ValueTypeMarker>::borrow),
2847 encoder,
2848 offset + cur_offset,
2849 depth,
2850 )?;
2851
2852 _prev_end_offset = cur_offset + envelope_size;
2853 if 7 > max_ordinal {
2854 return Ok(());
2855 }
2856
2857 let cur_offset: usize = (7 - 1) * envelope_size;
2860
2861 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2863
2864 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2869 self.device_pixel_ratio
2870 .as_ref()
2871 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2872 encoder,
2873 offset + cur_offset,
2874 depth,
2875 )?;
2876
2877 _prev_end_offset = cur_offset + envelope_size;
2878 if 8 > max_ordinal {
2879 return Ok(());
2880 }
2881
2882 let cur_offset: usize = (8 - 1) * envelope_size;
2885
2886 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2888
2889 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2894 self.wheel_x_physical_pixel
2895 .as_ref()
2896 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2897 encoder,
2898 offset + cur_offset,
2899 depth,
2900 )?;
2901
2902 _prev_end_offset = cur_offset + envelope_size;
2903 if 9 > max_ordinal {
2904 return Ok(());
2905 }
2906
2907 let cur_offset: usize = (9 - 1) * envelope_size;
2910
2911 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2913
2914 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2919 self.wheel_y_physical_pixel
2920 .as_ref()
2921 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2922 encoder,
2923 offset + cur_offset,
2924 depth,
2925 )?;
2926
2927 _prev_end_offset = cur_offset + envelope_size;
2928 if 10 > max_ordinal {
2929 return Ok(());
2930 }
2931
2932 let cur_offset: usize = (10 - 1) * envelope_size;
2935
2936 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2938
2939 fidl::encoding::encode_in_envelope_optional::<u32, D>(
2944 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2945 encoder,
2946 offset + cur_offset,
2947 depth,
2948 )?;
2949
2950 _prev_end_offset = cur_offset + envelope_size;
2951
2952 Ok(())
2953 }
2954 }
2955
2956 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2957 for MouseInputListenerReportMouseInputRequest
2958 {
2959 #[inline(always)]
2960 fn new_empty() -> Self {
2961 Self::default()
2962 }
2963
2964 unsafe fn decode(
2965 &mut self,
2966 decoder: &mut fidl::encoding::Decoder<'_, D>,
2967 offset: usize,
2968 mut depth: fidl::encoding::Depth,
2969 ) -> fidl::Result<()> {
2970 decoder.debug_check_bounds::<Self>(offset);
2971 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2972 None => return Err(fidl::Error::NotNullable),
2973 Some(len) => len,
2974 };
2975 if len == 0 {
2977 return Ok(());
2978 };
2979 depth.increment()?;
2980 let envelope_size = 8;
2981 let bytes_len = len * envelope_size;
2982 let offset = decoder.out_of_line_offset(bytes_len)?;
2983 let mut _next_ordinal_to_read = 0;
2985 let mut next_offset = offset;
2986 let end_offset = offset + bytes_len;
2987 _next_ordinal_to_read += 1;
2988 if next_offset >= end_offset {
2989 return Ok(());
2990 }
2991
2992 while _next_ordinal_to_read < 1 {
2994 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2995 _next_ordinal_to_read += 1;
2996 next_offset += envelope_size;
2997 }
2998
2999 let next_out_of_line = decoder.next_out_of_line();
3000 let handles_before = decoder.remaining_handles();
3001 if let Some((inlined, num_bytes, num_handles)) =
3002 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3003 {
3004 let member_inline_size =
3005 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3006 if inlined != (member_inline_size <= 4) {
3007 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3008 }
3009 let inner_offset;
3010 let mut inner_depth = depth.clone();
3011 if inlined {
3012 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3013 inner_offset = next_offset;
3014 } else {
3015 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3016 inner_depth.increment()?;
3017 }
3018 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
3019 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3020 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3021 {
3022 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3023 }
3024 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3025 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3026 }
3027 }
3028
3029 next_offset += envelope_size;
3030 _next_ordinal_to_read += 1;
3031 if next_offset >= end_offset {
3032 return Ok(());
3033 }
3034
3035 while _next_ordinal_to_read < 2 {
3037 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3038 _next_ordinal_to_read += 1;
3039 next_offset += envelope_size;
3040 }
3041
3042 let next_out_of_line = decoder.next_out_of_line();
3043 let handles_before = decoder.remaining_handles();
3044 if let Some((inlined, num_bytes, num_handles)) =
3045 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3046 {
3047 let member_inline_size =
3048 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3049 if inlined != (member_inline_size <= 4) {
3050 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3051 }
3052 let inner_offset;
3053 let mut inner_depth = depth.clone();
3054 if inlined {
3055 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3056 inner_offset = next_offset;
3057 } else {
3058 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3059 inner_depth.increment()?;
3060 }
3061 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
3062 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3063 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3064 {
3065 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3066 }
3067 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3068 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3069 }
3070 }
3071
3072 next_offset += envelope_size;
3073 _next_ordinal_to_read += 1;
3074 if next_offset >= end_offset {
3075 return Ok(());
3076 }
3077
3078 while _next_ordinal_to_read < 3 {
3080 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3081 _next_ordinal_to_read += 1;
3082 next_offset += envelope_size;
3083 }
3084
3085 let next_out_of_line = decoder.next_out_of_line();
3086 let handles_before = decoder.remaining_handles();
3087 if let Some((inlined, num_bytes, num_handles)) =
3088 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3089 {
3090 let member_inline_size =
3091 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3092 if inlined != (member_inline_size <= 4) {
3093 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3094 }
3095 let inner_offset;
3096 let mut inner_depth = depth.clone();
3097 if inlined {
3098 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3099 inner_offset = next_offset;
3100 } else {
3101 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3102 inner_depth.increment()?;
3103 }
3104 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
3105 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3106 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3107 {
3108 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3109 }
3110 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3111 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3112 }
3113 }
3114
3115 next_offset += envelope_size;
3116 _next_ordinal_to_read += 1;
3117 if next_offset >= end_offset {
3118 return Ok(());
3119 }
3120
3121 while _next_ordinal_to_read < 4 {
3123 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3124 _next_ordinal_to_read += 1;
3125 next_offset += envelope_size;
3126 }
3127
3128 let next_out_of_line = decoder.next_out_of_line();
3129 let handles_before = decoder.remaining_handles();
3130 if let Some((inlined, num_bytes, num_handles)) =
3131 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3132 {
3133 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3134 if inlined != (member_inline_size <= 4) {
3135 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3136 }
3137 let inner_offset;
3138 let mut inner_depth = depth.clone();
3139 if inlined {
3140 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3141 inner_offset = next_offset;
3142 } else {
3143 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3144 inner_depth.increment()?;
3145 }
3146 let val_ref = self.component_name.get_or_insert_with(|| {
3147 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
3148 });
3149 fidl::decode!(
3150 fidl::encoding::BoundedString<1024>,
3151 D,
3152 val_ref,
3153 decoder,
3154 inner_offset,
3155 inner_depth
3156 )?;
3157 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3158 {
3159 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3160 }
3161 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3162 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3163 }
3164 }
3165
3166 next_offset += envelope_size;
3167 _next_ordinal_to_read += 1;
3168 if next_offset >= end_offset {
3169 return Ok(());
3170 }
3171
3172 while _next_ordinal_to_read < 5 {
3174 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3175 _next_ordinal_to_read += 1;
3176 next_offset += envelope_size;
3177 }
3178
3179 let next_out_of_line = decoder.next_out_of_line();
3180 let handles_before = decoder.remaining_handles();
3181 if let Some((inlined, num_bytes, num_handles)) =
3182 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3183 {
3184 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3185 if inlined != (member_inline_size <= 4) {
3186 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3187 }
3188 let inner_offset;
3189 let mut inner_depth = depth.clone();
3190 if inlined {
3191 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3192 inner_offset = next_offset;
3193 } else {
3194 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3195 inner_depth.increment()?;
3196 }
3197 let val_ref = self.buttons.get_or_insert_with(
3198 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3199 );
3200 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3201 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3202 {
3203 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3204 }
3205 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3206 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3207 }
3208 }
3209
3210 next_offset += envelope_size;
3211 _next_ordinal_to_read += 1;
3212 if next_offset >= end_offset {
3213 return Ok(());
3214 }
3215
3216 while _next_ordinal_to_read < 6 {
3218 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3219 _next_ordinal_to_read += 1;
3220 next_offset += envelope_size;
3221 }
3222
3223 let next_out_of_line = decoder.next_out_of_line();
3224 let handles_before = decoder.remaining_handles();
3225 if let Some((inlined, num_bytes, num_handles)) =
3226 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3227 {
3228 let member_inline_size =
3229 <MouseEventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3230 if inlined != (member_inline_size <= 4) {
3231 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3232 }
3233 let inner_offset;
3234 let mut inner_depth = depth.clone();
3235 if inlined {
3236 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3237 inner_offset = next_offset;
3238 } else {
3239 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3240 inner_depth.increment()?;
3241 }
3242 let val_ref =
3243 self.phase.get_or_insert_with(|| fidl::new_empty!(MouseEventPhase, D));
3244 fidl::decode!(MouseEventPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
3245 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3246 {
3247 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3248 }
3249 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3250 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3251 }
3252 }
3253
3254 next_offset += envelope_size;
3255 _next_ordinal_to_read += 1;
3256 if next_offset >= end_offset {
3257 return Ok(());
3258 }
3259
3260 while _next_ordinal_to_read < 7 {
3262 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3263 _next_ordinal_to_read += 1;
3264 next_offset += envelope_size;
3265 }
3266
3267 let next_out_of_line = decoder.next_out_of_line();
3268 let handles_before = decoder.remaining_handles();
3269 if let Some((inlined, num_bytes, num_handles)) =
3270 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3271 {
3272 let member_inline_size =
3273 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3274 if inlined != (member_inline_size <= 4) {
3275 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3276 }
3277 let inner_offset;
3278 let mut inner_depth = depth.clone();
3279 if inlined {
3280 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3281 inner_offset = next_offset;
3282 } else {
3283 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3284 inner_depth.increment()?;
3285 }
3286 let val_ref =
3287 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
3288 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3289 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3290 {
3291 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3292 }
3293 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3294 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3295 }
3296 }
3297
3298 next_offset += envelope_size;
3299 _next_ordinal_to_read += 1;
3300 if next_offset >= end_offset {
3301 return Ok(());
3302 }
3303
3304 while _next_ordinal_to_read < 8 {
3306 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3307 _next_ordinal_to_read += 1;
3308 next_offset += envelope_size;
3309 }
3310
3311 let next_out_of_line = decoder.next_out_of_line();
3312 let handles_before = decoder.remaining_handles();
3313 if let Some((inlined, num_bytes, num_handles)) =
3314 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3315 {
3316 let member_inline_size =
3317 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3318 if inlined != (member_inline_size <= 4) {
3319 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3320 }
3321 let inner_offset;
3322 let mut inner_depth = depth.clone();
3323 if inlined {
3324 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3325 inner_offset = next_offset;
3326 } else {
3327 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3328 inner_depth.increment()?;
3329 }
3330 let val_ref =
3331 self.wheel_x_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3332 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3333 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3334 {
3335 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3336 }
3337 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3338 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3339 }
3340 }
3341
3342 next_offset += envelope_size;
3343 _next_ordinal_to_read += 1;
3344 if next_offset >= end_offset {
3345 return Ok(());
3346 }
3347
3348 while _next_ordinal_to_read < 9 {
3350 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3351 _next_ordinal_to_read += 1;
3352 next_offset += envelope_size;
3353 }
3354
3355 let next_out_of_line = decoder.next_out_of_line();
3356 let handles_before = decoder.remaining_handles();
3357 if let Some((inlined, num_bytes, num_handles)) =
3358 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3359 {
3360 let member_inline_size =
3361 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3362 if inlined != (member_inline_size <= 4) {
3363 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3364 }
3365 let inner_offset;
3366 let mut inner_depth = depth.clone();
3367 if inlined {
3368 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3369 inner_offset = next_offset;
3370 } else {
3371 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3372 inner_depth.increment()?;
3373 }
3374 let val_ref =
3375 self.wheel_y_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3376 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3377 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3378 {
3379 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3380 }
3381 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3382 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3383 }
3384 }
3385
3386 next_offset += envelope_size;
3387 _next_ordinal_to_read += 1;
3388 if next_offset >= end_offset {
3389 return Ok(());
3390 }
3391
3392 while _next_ordinal_to_read < 10 {
3394 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3395 _next_ordinal_to_read += 1;
3396 next_offset += envelope_size;
3397 }
3398
3399 let next_out_of_line = decoder.next_out_of_line();
3400 let handles_before = decoder.remaining_handles();
3401 if let Some((inlined, num_bytes, num_handles)) =
3402 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3403 {
3404 let member_inline_size =
3405 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3406 if inlined != (member_inline_size <= 4) {
3407 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3408 }
3409 let inner_offset;
3410 let mut inner_depth = depth.clone();
3411 if inlined {
3412 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3413 inner_offset = next_offset;
3414 } else {
3415 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3416 inner_depth.increment()?;
3417 }
3418 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
3419 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3420 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3421 {
3422 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3423 }
3424 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3425 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3426 }
3427 }
3428
3429 next_offset += envelope_size;
3430
3431 while next_offset < end_offset {
3433 _next_ordinal_to_read += 1;
3434 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3435 next_offset += envelope_size;
3436 }
3437
3438 Ok(())
3439 }
3440 }
3441
3442 impl MouseSimulateMouseEventRequest {
3443 #[inline(always)]
3444 fn max_ordinal_present(&self) -> u64 {
3445 if let Some(_) = self.scroll_h_physical_pixel {
3446 return 7;
3447 }
3448 if let Some(_) = self.scroll_v_physical_pixel {
3449 return 6;
3450 }
3451 if let Some(_) = self.scroll_h_detent {
3452 return 5;
3453 }
3454 if let Some(_) = self.scroll_v_detent {
3455 return 4;
3456 }
3457 if let Some(_) = self.movement_y {
3458 return 3;
3459 }
3460 if let Some(_) = self.movement_x {
3461 return 2;
3462 }
3463 if let Some(_) = self.pressed_buttons {
3464 return 1;
3465 }
3466 0
3467 }
3468 }
3469
3470 impl fidl::encoding::ValueTypeMarker for MouseSimulateMouseEventRequest {
3471 type Borrowed<'a> = &'a Self;
3472 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3473 value
3474 }
3475 }
3476
3477 unsafe impl fidl::encoding::TypeMarker for MouseSimulateMouseEventRequest {
3478 type Owned = Self;
3479
3480 #[inline(always)]
3481 fn inline_align(_context: fidl::encoding::Context) -> usize {
3482 8
3483 }
3484
3485 #[inline(always)]
3486 fn inline_size(_context: fidl::encoding::Context) -> usize {
3487 16
3488 }
3489 }
3490
3491 unsafe impl<D: fidl::encoding::ResourceDialect>
3492 fidl::encoding::Encode<MouseSimulateMouseEventRequest, D>
3493 for &MouseSimulateMouseEventRequest
3494 {
3495 unsafe fn encode(
3496 self,
3497 encoder: &mut fidl::encoding::Encoder<'_, D>,
3498 offset: usize,
3499 mut depth: fidl::encoding::Depth,
3500 ) -> fidl::Result<()> {
3501 encoder.debug_check_bounds::<MouseSimulateMouseEventRequest>(offset);
3502 let max_ordinal: u64 = self.max_ordinal_present();
3504 encoder.write_num(max_ordinal, offset);
3505 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3506 if max_ordinal == 0 {
3508 return Ok(());
3509 }
3510 depth.increment()?;
3511 let envelope_size = 8;
3512 let bytes_len = max_ordinal as usize * envelope_size;
3513 #[allow(unused_variables)]
3514 let offset = encoder.out_of_line_offset(bytes_len);
3515 let mut _prev_end_offset: usize = 0;
3516 if 1 > max_ordinal {
3517 return Ok(());
3518 }
3519
3520 let cur_offset: usize = (1 - 1) * envelope_size;
3523
3524 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3526
3527 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
3532 self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
3533 encoder, offset + cur_offset, depth
3534 )?;
3535
3536 _prev_end_offset = cur_offset + envelope_size;
3537 if 2 > max_ordinal {
3538 return Ok(());
3539 }
3540
3541 let cur_offset: usize = (2 - 1) * envelope_size;
3544
3545 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3547
3548 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3553 self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3554 encoder,
3555 offset + cur_offset,
3556 depth,
3557 )?;
3558
3559 _prev_end_offset = cur_offset + envelope_size;
3560 if 3 > max_ordinal {
3561 return Ok(());
3562 }
3563
3564 let cur_offset: usize = (3 - 1) * envelope_size;
3567
3568 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3570
3571 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3576 self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3577 encoder,
3578 offset + cur_offset,
3579 depth,
3580 )?;
3581
3582 _prev_end_offset = cur_offset + envelope_size;
3583 if 4 > max_ordinal {
3584 return Ok(());
3585 }
3586
3587 let cur_offset: usize = (4 - 1) * envelope_size;
3590
3591 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3593
3594 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3599 self.scroll_v_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3600 encoder,
3601 offset + cur_offset,
3602 depth,
3603 )?;
3604
3605 _prev_end_offset = cur_offset + envelope_size;
3606 if 5 > max_ordinal {
3607 return Ok(());
3608 }
3609
3610 let cur_offset: usize = (5 - 1) * envelope_size;
3613
3614 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3616
3617 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3622 self.scroll_h_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3623 encoder,
3624 offset + cur_offset,
3625 depth,
3626 )?;
3627
3628 _prev_end_offset = cur_offset + envelope_size;
3629 if 6 > max_ordinal {
3630 return Ok(());
3631 }
3632
3633 let cur_offset: usize = (6 - 1) * envelope_size;
3636
3637 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3639
3640 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3645 self.scroll_v_physical_pixel
3646 .as_ref()
3647 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3648 encoder,
3649 offset + cur_offset,
3650 depth,
3651 )?;
3652
3653 _prev_end_offset = cur_offset + envelope_size;
3654 if 7 > max_ordinal {
3655 return Ok(());
3656 }
3657
3658 let cur_offset: usize = (7 - 1) * envelope_size;
3661
3662 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3664
3665 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3670 self.scroll_h_physical_pixel
3671 .as_ref()
3672 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3673 encoder,
3674 offset + cur_offset,
3675 depth,
3676 )?;
3677
3678 _prev_end_offset = cur_offset + envelope_size;
3679
3680 Ok(())
3681 }
3682 }
3683
3684 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3685 for MouseSimulateMouseEventRequest
3686 {
3687 #[inline(always)]
3688 fn new_empty() -> Self {
3689 Self::default()
3690 }
3691
3692 unsafe fn decode(
3693 &mut self,
3694 decoder: &mut fidl::encoding::Decoder<'_, D>,
3695 offset: usize,
3696 mut depth: fidl::encoding::Depth,
3697 ) -> fidl::Result<()> {
3698 decoder.debug_check_bounds::<Self>(offset);
3699 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3700 None => return Err(fidl::Error::NotNullable),
3701 Some(len) => len,
3702 };
3703 if len == 0 {
3705 return Ok(());
3706 };
3707 depth.increment()?;
3708 let envelope_size = 8;
3709 let bytes_len = len * envelope_size;
3710 let offset = decoder.out_of_line_offset(bytes_len)?;
3711 let mut _next_ordinal_to_read = 0;
3713 let mut next_offset = offset;
3714 let end_offset = offset + bytes_len;
3715 _next_ordinal_to_read += 1;
3716 if next_offset >= end_offset {
3717 return Ok(());
3718 }
3719
3720 while _next_ordinal_to_read < 1 {
3722 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3723 _next_ordinal_to_read += 1;
3724 next_offset += envelope_size;
3725 }
3726
3727 let next_out_of_line = decoder.next_out_of_line();
3728 let handles_before = decoder.remaining_handles();
3729 if let Some((inlined, num_bytes, num_handles)) =
3730 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3731 {
3732 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3733 if inlined != (member_inline_size <= 4) {
3734 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3735 }
3736 let inner_offset;
3737 let mut inner_depth = depth.clone();
3738 if inlined {
3739 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3740 inner_offset = next_offset;
3741 } else {
3742 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3743 inner_depth.increment()?;
3744 }
3745 let val_ref = self.pressed_buttons.get_or_insert_with(
3746 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3747 );
3748 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3749 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3750 {
3751 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3752 }
3753 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3754 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3755 }
3756 }
3757
3758 next_offset += envelope_size;
3759 _next_ordinal_to_read += 1;
3760 if next_offset >= end_offset {
3761 return Ok(());
3762 }
3763
3764 while _next_ordinal_to_read < 2 {
3766 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3767 _next_ordinal_to_read += 1;
3768 next_offset += envelope_size;
3769 }
3770
3771 let next_out_of_line = decoder.next_out_of_line();
3772 let handles_before = decoder.remaining_handles();
3773 if let Some((inlined, num_bytes, num_handles)) =
3774 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3775 {
3776 let member_inline_size =
3777 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3778 if inlined != (member_inline_size <= 4) {
3779 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3780 }
3781 let inner_offset;
3782 let mut inner_depth = depth.clone();
3783 if inlined {
3784 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3785 inner_offset = next_offset;
3786 } else {
3787 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3788 inner_depth.increment()?;
3789 }
3790 let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
3791 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3792 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3793 {
3794 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3795 }
3796 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3797 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3798 }
3799 }
3800
3801 next_offset += envelope_size;
3802 _next_ordinal_to_read += 1;
3803 if next_offset >= end_offset {
3804 return Ok(());
3805 }
3806
3807 while _next_ordinal_to_read < 3 {
3809 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3810 _next_ordinal_to_read += 1;
3811 next_offset += envelope_size;
3812 }
3813
3814 let next_out_of_line = decoder.next_out_of_line();
3815 let handles_before = decoder.remaining_handles();
3816 if let Some((inlined, num_bytes, num_handles)) =
3817 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3818 {
3819 let member_inline_size =
3820 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3821 if inlined != (member_inline_size <= 4) {
3822 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3823 }
3824 let inner_offset;
3825 let mut inner_depth = depth.clone();
3826 if inlined {
3827 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3828 inner_offset = next_offset;
3829 } else {
3830 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3831 inner_depth.increment()?;
3832 }
3833 let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
3834 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3835 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3836 {
3837 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3838 }
3839 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3840 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3841 }
3842 }
3843
3844 next_offset += envelope_size;
3845 _next_ordinal_to_read += 1;
3846 if next_offset >= end_offset {
3847 return Ok(());
3848 }
3849
3850 while _next_ordinal_to_read < 4 {
3852 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3853 _next_ordinal_to_read += 1;
3854 next_offset += envelope_size;
3855 }
3856
3857 let next_out_of_line = decoder.next_out_of_line();
3858 let handles_before = decoder.remaining_handles();
3859 if let Some((inlined, num_bytes, num_handles)) =
3860 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3861 {
3862 let member_inline_size =
3863 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3864 if inlined != (member_inline_size <= 4) {
3865 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3866 }
3867 let inner_offset;
3868 let mut inner_depth = depth.clone();
3869 if inlined {
3870 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3871 inner_offset = next_offset;
3872 } else {
3873 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3874 inner_depth.increment()?;
3875 }
3876 let val_ref = self.scroll_v_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3877 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3878 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3879 {
3880 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3881 }
3882 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3883 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3884 }
3885 }
3886
3887 next_offset += envelope_size;
3888 _next_ordinal_to_read += 1;
3889 if next_offset >= end_offset {
3890 return Ok(());
3891 }
3892
3893 while _next_ordinal_to_read < 5 {
3895 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3896 _next_ordinal_to_read += 1;
3897 next_offset += envelope_size;
3898 }
3899
3900 let next_out_of_line = decoder.next_out_of_line();
3901 let handles_before = decoder.remaining_handles();
3902 if let Some((inlined, num_bytes, num_handles)) =
3903 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3904 {
3905 let member_inline_size =
3906 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3907 if inlined != (member_inline_size <= 4) {
3908 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3909 }
3910 let inner_offset;
3911 let mut inner_depth = depth.clone();
3912 if inlined {
3913 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3914 inner_offset = next_offset;
3915 } else {
3916 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3917 inner_depth.increment()?;
3918 }
3919 let val_ref = self.scroll_h_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3920 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3921 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3922 {
3923 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3924 }
3925 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3926 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3927 }
3928 }
3929
3930 next_offset += envelope_size;
3931 _next_ordinal_to_read += 1;
3932 if next_offset >= end_offset {
3933 return Ok(());
3934 }
3935
3936 while _next_ordinal_to_read < 6 {
3938 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3939 _next_ordinal_to_read += 1;
3940 next_offset += envelope_size;
3941 }
3942
3943 let next_out_of_line = decoder.next_out_of_line();
3944 let handles_before = decoder.remaining_handles();
3945 if let Some((inlined, num_bytes, num_handles)) =
3946 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3947 {
3948 let member_inline_size =
3949 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3950 if inlined != (member_inline_size <= 4) {
3951 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3952 }
3953 let inner_offset;
3954 let mut inner_depth = depth.clone();
3955 if inlined {
3956 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3957 inner_offset = next_offset;
3958 } else {
3959 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3960 inner_depth.increment()?;
3961 }
3962 let val_ref =
3963 self.scroll_v_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3964 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3965 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3966 {
3967 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3968 }
3969 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3970 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3971 }
3972 }
3973
3974 next_offset += envelope_size;
3975 _next_ordinal_to_read += 1;
3976 if next_offset >= end_offset {
3977 return Ok(());
3978 }
3979
3980 while _next_ordinal_to_read < 7 {
3982 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3983 _next_ordinal_to_read += 1;
3984 next_offset += envelope_size;
3985 }
3986
3987 let next_out_of_line = decoder.next_out_of_line();
3988 let handles_before = decoder.remaining_handles();
3989 if let Some((inlined, num_bytes, num_handles)) =
3990 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3991 {
3992 let member_inline_size =
3993 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3994 if inlined != (member_inline_size <= 4) {
3995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3996 }
3997 let inner_offset;
3998 let mut inner_depth = depth.clone();
3999 if inlined {
4000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4001 inner_offset = next_offset;
4002 } else {
4003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4004 inner_depth.increment()?;
4005 }
4006 let val_ref =
4007 self.scroll_h_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
4008 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4009 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4010 {
4011 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4012 }
4013 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4014 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4015 }
4016 }
4017
4018 next_offset += envelope_size;
4019
4020 while next_offset < end_offset {
4022 _next_ordinal_to_read += 1;
4023 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4024 next_offset += envelope_size;
4025 }
4026
4027 Ok(())
4028 }
4029 }
4030
4031 impl TouchInputListenerReportTouchInputRequest {
4032 #[inline(always)]
4033 fn max_ordinal_present(&self) -> u64 {
4034 if let Some(_) = self.device_id {
4035 return 8;
4036 }
4037 if let Some(_) = self.pointer_id {
4038 return 7;
4039 }
4040 if let Some(_) = self.phase {
4041 return 6;
4042 }
4043 if let Some(_) = self.component_name {
4044 return 5;
4045 }
4046 if let Some(_) = self.device_pixel_ratio {
4047 return 4;
4048 }
4049 if let Some(_) = self.time_received {
4050 return 3;
4051 }
4052 if let Some(_) = self.local_y {
4053 return 2;
4054 }
4055 if let Some(_) = self.local_x {
4056 return 1;
4057 }
4058 0
4059 }
4060 }
4061
4062 impl fidl::encoding::ValueTypeMarker for TouchInputListenerReportTouchInputRequest {
4063 type Borrowed<'a> = &'a Self;
4064 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4065 value
4066 }
4067 }
4068
4069 unsafe impl fidl::encoding::TypeMarker for TouchInputListenerReportTouchInputRequest {
4070 type Owned = Self;
4071
4072 #[inline(always)]
4073 fn inline_align(_context: fidl::encoding::Context) -> usize {
4074 8
4075 }
4076
4077 #[inline(always)]
4078 fn inline_size(_context: fidl::encoding::Context) -> usize {
4079 16
4080 }
4081 }
4082
4083 unsafe impl<D: fidl::encoding::ResourceDialect>
4084 fidl::encoding::Encode<TouchInputListenerReportTouchInputRequest, D>
4085 for &TouchInputListenerReportTouchInputRequest
4086 {
4087 unsafe fn encode(
4088 self,
4089 encoder: &mut fidl::encoding::Encoder<'_, D>,
4090 offset: usize,
4091 mut depth: fidl::encoding::Depth,
4092 ) -> fidl::Result<()> {
4093 encoder.debug_check_bounds::<TouchInputListenerReportTouchInputRequest>(offset);
4094 let max_ordinal: u64 = self.max_ordinal_present();
4096 encoder.write_num(max_ordinal, offset);
4097 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4098 if max_ordinal == 0 {
4100 return Ok(());
4101 }
4102 depth.increment()?;
4103 let envelope_size = 8;
4104 let bytes_len = max_ordinal as usize * envelope_size;
4105 #[allow(unused_variables)]
4106 let offset = encoder.out_of_line_offset(bytes_len);
4107 let mut _prev_end_offset: usize = 0;
4108 if 1 > max_ordinal {
4109 return Ok(());
4110 }
4111
4112 let cur_offset: usize = (1 - 1) * envelope_size;
4115
4116 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4118
4119 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4124 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4125 encoder,
4126 offset + cur_offset,
4127 depth,
4128 )?;
4129
4130 _prev_end_offset = cur_offset + envelope_size;
4131 if 2 > max_ordinal {
4132 return Ok(());
4133 }
4134
4135 let cur_offset: usize = (2 - 1) * envelope_size;
4138
4139 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4141
4142 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4147 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4148 encoder,
4149 offset + cur_offset,
4150 depth,
4151 )?;
4152
4153 _prev_end_offset = cur_offset + envelope_size;
4154 if 3 > max_ordinal {
4155 return Ok(());
4156 }
4157
4158 let cur_offset: usize = (3 - 1) * envelope_size;
4161
4162 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4164
4165 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4170 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4171 encoder,
4172 offset + cur_offset,
4173 depth,
4174 )?;
4175
4176 _prev_end_offset = cur_offset + envelope_size;
4177 if 4 > max_ordinal {
4178 return Ok(());
4179 }
4180
4181 let cur_offset: usize = (4 - 1) * envelope_size;
4184
4185 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4187
4188 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4193 self.device_pixel_ratio
4194 .as_ref()
4195 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4196 encoder,
4197 offset + cur_offset,
4198 depth,
4199 )?;
4200
4201 _prev_end_offset = cur_offset + envelope_size;
4202 if 5 > max_ordinal {
4203 return Ok(());
4204 }
4205
4206 let cur_offset: usize = (5 - 1) * envelope_size;
4209
4210 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4212
4213 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
4218 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
4219 encoder, offset + cur_offset, depth
4220 )?;
4221
4222 _prev_end_offset = cur_offset + envelope_size;
4223 if 6 > max_ordinal {
4224 return Ok(());
4225 }
4226
4227 let cur_offset: usize = (6 - 1) * envelope_size;
4230
4231 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4233
4234 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_pointer_common::EventPhase, D>(
4239 self.phase.as_ref().map(<fidl_fuchsia_ui_pointer_common::EventPhase as fidl::encoding::ValueTypeMarker>::borrow),
4240 encoder, offset + cur_offset, depth
4241 )?;
4242
4243 _prev_end_offset = cur_offset + envelope_size;
4244 if 7 > max_ordinal {
4245 return Ok(());
4246 }
4247
4248 let cur_offset: usize = (7 - 1) * envelope_size;
4251
4252 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4254
4255 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4260 self.pointer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4261 encoder,
4262 offset + cur_offset,
4263 depth,
4264 )?;
4265
4266 _prev_end_offset = cur_offset + envelope_size;
4267 if 8 > max_ordinal {
4268 return Ok(());
4269 }
4270
4271 let cur_offset: usize = (8 - 1) * envelope_size;
4274
4275 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4277
4278 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4283 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4284 encoder,
4285 offset + cur_offset,
4286 depth,
4287 )?;
4288
4289 _prev_end_offset = cur_offset + envelope_size;
4290
4291 Ok(())
4292 }
4293 }
4294
4295 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4296 for TouchInputListenerReportTouchInputRequest
4297 {
4298 #[inline(always)]
4299 fn new_empty() -> Self {
4300 Self::default()
4301 }
4302
4303 unsafe fn decode(
4304 &mut self,
4305 decoder: &mut fidl::encoding::Decoder<'_, D>,
4306 offset: usize,
4307 mut depth: fidl::encoding::Depth,
4308 ) -> fidl::Result<()> {
4309 decoder.debug_check_bounds::<Self>(offset);
4310 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4311 None => return Err(fidl::Error::NotNullable),
4312 Some(len) => len,
4313 };
4314 if len == 0 {
4316 return Ok(());
4317 };
4318 depth.increment()?;
4319 let envelope_size = 8;
4320 let bytes_len = len * envelope_size;
4321 let offset = decoder.out_of_line_offset(bytes_len)?;
4322 let mut _next_ordinal_to_read = 0;
4324 let mut next_offset = offset;
4325 let end_offset = offset + bytes_len;
4326 _next_ordinal_to_read += 1;
4327 if next_offset >= end_offset {
4328 return Ok(());
4329 }
4330
4331 while _next_ordinal_to_read < 1 {
4333 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4334 _next_ordinal_to_read += 1;
4335 next_offset += envelope_size;
4336 }
4337
4338 let next_out_of_line = decoder.next_out_of_line();
4339 let handles_before = decoder.remaining_handles();
4340 if let Some((inlined, num_bytes, num_handles)) =
4341 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4342 {
4343 let member_inline_size =
4344 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4345 if inlined != (member_inline_size <= 4) {
4346 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4347 }
4348 let inner_offset;
4349 let mut inner_depth = depth.clone();
4350 if inlined {
4351 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4352 inner_offset = next_offset;
4353 } else {
4354 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4355 inner_depth.increment()?;
4356 }
4357 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
4358 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4359 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4360 {
4361 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4362 }
4363 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4364 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4365 }
4366 }
4367
4368 next_offset += envelope_size;
4369 _next_ordinal_to_read += 1;
4370 if next_offset >= end_offset {
4371 return Ok(());
4372 }
4373
4374 while _next_ordinal_to_read < 2 {
4376 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4377 _next_ordinal_to_read += 1;
4378 next_offset += envelope_size;
4379 }
4380
4381 let next_out_of_line = decoder.next_out_of_line();
4382 let handles_before = decoder.remaining_handles();
4383 if let Some((inlined, num_bytes, num_handles)) =
4384 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4385 {
4386 let member_inline_size =
4387 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4388 if inlined != (member_inline_size <= 4) {
4389 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4390 }
4391 let inner_offset;
4392 let mut inner_depth = depth.clone();
4393 if inlined {
4394 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4395 inner_offset = next_offset;
4396 } else {
4397 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4398 inner_depth.increment()?;
4399 }
4400 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
4401 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4402 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4403 {
4404 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4405 }
4406 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4407 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4408 }
4409 }
4410
4411 next_offset += envelope_size;
4412 _next_ordinal_to_read += 1;
4413 if next_offset >= end_offset {
4414 return Ok(());
4415 }
4416
4417 while _next_ordinal_to_read < 3 {
4419 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4420 _next_ordinal_to_read += 1;
4421 next_offset += envelope_size;
4422 }
4423
4424 let next_out_of_line = decoder.next_out_of_line();
4425 let handles_before = decoder.remaining_handles();
4426 if let Some((inlined, num_bytes, num_handles)) =
4427 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4428 {
4429 let member_inline_size =
4430 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4431 if inlined != (member_inline_size <= 4) {
4432 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4433 }
4434 let inner_offset;
4435 let mut inner_depth = depth.clone();
4436 if inlined {
4437 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4438 inner_offset = next_offset;
4439 } else {
4440 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4441 inner_depth.increment()?;
4442 }
4443 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
4444 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4445 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4446 {
4447 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4448 }
4449 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4450 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4451 }
4452 }
4453
4454 next_offset += envelope_size;
4455 _next_ordinal_to_read += 1;
4456 if next_offset >= end_offset {
4457 return Ok(());
4458 }
4459
4460 while _next_ordinal_to_read < 4 {
4462 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4463 _next_ordinal_to_read += 1;
4464 next_offset += envelope_size;
4465 }
4466
4467 let next_out_of_line = decoder.next_out_of_line();
4468 let handles_before = decoder.remaining_handles();
4469 if let Some((inlined, num_bytes, num_handles)) =
4470 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4471 {
4472 let member_inline_size =
4473 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4474 if inlined != (member_inline_size <= 4) {
4475 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4476 }
4477 let inner_offset;
4478 let mut inner_depth = depth.clone();
4479 if inlined {
4480 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4481 inner_offset = next_offset;
4482 } else {
4483 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4484 inner_depth.increment()?;
4485 }
4486 let val_ref =
4487 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
4488 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4489 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4490 {
4491 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4492 }
4493 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4494 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4495 }
4496 }
4497
4498 next_offset += envelope_size;
4499 _next_ordinal_to_read += 1;
4500 if next_offset >= end_offset {
4501 return Ok(());
4502 }
4503
4504 while _next_ordinal_to_read < 5 {
4506 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4507 _next_ordinal_to_read += 1;
4508 next_offset += envelope_size;
4509 }
4510
4511 let next_out_of_line = decoder.next_out_of_line();
4512 let handles_before = decoder.remaining_handles();
4513 if let Some((inlined, num_bytes, num_handles)) =
4514 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4515 {
4516 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4517 if inlined != (member_inline_size <= 4) {
4518 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4519 }
4520 let inner_offset;
4521 let mut inner_depth = depth.clone();
4522 if inlined {
4523 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4524 inner_offset = next_offset;
4525 } else {
4526 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4527 inner_depth.increment()?;
4528 }
4529 let val_ref = self.component_name.get_or_insert_with(|| {
4530 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
4531 });
4532 fidl::decode!(
4533 fidl::encoding::BoundedString<1024>,
4534 D,
4535 val_ref,
4536 decoder,
4537 inner_offset,
4538 inner_depth
4539 )?;
4540 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4541 {
4542 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4543 }
4544 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4545 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4546 }
4547 }
4548
4549 next_offset += envelope_size;
4550 _next_ordinal_to_read += 1;
4551 if next_offset >= end_offset {
4552 return Ok(());
4553 }
4554
4555 while _next_ordinal_to_read < 6 {
4557 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4558 _next_ordinal_to_read += 1;
4559 next_offset += envelope_size;
4560 }
4561
4562 let next_out_of_line = decoder.next_out_of_line();
4563 let handles_before = decoder.remaining_handles();
4564 if let Some((inlined, num_bytes, num_handles)) =
4565 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4566 {
4567 let member_inline_size = <fidl_fuchsia_ui_pointer_common::EventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4568 if inlined != (member_inline_size <= 4) {
4569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4570 }
4571 let inner_offset;
4572 let mut inner_depth = depth.clone();
4573 if inlined {
4574 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4575 inner_offset = next_offset;
4576 } else {
4577 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4578 inner_depth.increment()?;
4579 }
4580 let val_ref = self.phase.get_or_insert_with(|| {
4581 fidl::new_empty!(fidl_fuchsia_ui_pointer_common::EventPhase, D)
4582 });
4583 fidl::decode!(
4584 fidl_fuchsia_ui_pointer_common::EventPhase,
4585 D,
4586 val_ref,
4587 decoder,
4588 inner_offset,
4589 inner_depth
4590 )?;
4591 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4592 {
4593 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4594 }
4595 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4596 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4597 }
4598 }
4599
4600 next_offset += envelope_size;
4601 _next_ordinal_to_read += 1;
4602 if next_offset >= end_offset {
4603 return Ok(());
4604 }
4605
4606 while _next_ordinal_to_read < 7 {
4608 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4609 _next_ordinal_to_read += 1;
4610 next_offset += envelope_size;
4611 }
4612
4613 let next_out_of_line = decoder.next_out_of_line();
4614 let handles_before = decoder.remaining_handles();
4615 if let Some((inlined, num_bytes, num_handles)) =
4616 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4617 {
4618 let member_inline_size =
4619 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4620 if inlined != (member_inline_size <= 4) {
4621 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4622 }
4623 let inner_offset;
4624 let mut inner_depth = depth.clone();
4625 if inlined {
4626 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4627 inner_offset = next_offset;
4628 } else {
4629 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4630 inner_depth.increment()?;
4631 }
4632 let val_ref = self.pointer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4633 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4634 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4635 {
4636 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4637 }
4638 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4639 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4640 }
4641 }
4642
4643 next_offset += envelope_size;
4644 _next_ordinal_to_read += 1;
4645 if next_offset >= end_offset {
4646 return Ok(());
4647 }
4648
4649 while _next_ordinal_to_read < 8 {
4651 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4652 _next_ordinal_to_read += 1;
4653 next_offset += envelope_size;
4654 }
4655
4656 let next_out_of_line = decoder.next_out_of_line();
4657 let handles_before = decoder.remaining_handles();
4658 if let Some((inlined, num_bytes, num_handles)) =
4659 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4660 {
4661 let member_inline_size =
4662 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4663 if inlined != (member_inline_size <= 4) {
4664 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4665 }
4666 let inner_offset;
4667 let mut inner_depth = depth.clone();
4668 if inlined {
4669 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4670 inner_offset = next_offset;
4671 } else {
4672 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4673 inner_depth.increment()?;
4674 }
4675 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4676 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4677 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4678 {
4679 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4680 }
4681 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4682 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4683 }
4684 }
4685
4686 next_offset += envelope_size;
4687
4688 while next_offset < end_offset {
4690 _next_ordinal_to_read += 1;
4691 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4692 next_offset += envelope_size;
4693 }
4694
4695 Ok(())
4696 }
4697 }
4698
4699 impl TouchScreenSimulateMultiFingerGestureRequest {
4700 #[inline(always)]
4701 fn max_ordinal_present(&self) -> u64 {
4702 if let Some(_) = self.finger_count {
4703 return 4;
4704 }
4705 if let Some(_) = self.move_event_count {
4706 return 3;
4707 }
4708 if let Some(_) = self.end_locations {
4709 return 2;
4710 }
4711 if let Some(_) = self.start_locations {
4712 return 1;
4713 }
4714 0
4715 }
4716 }
4717
4718 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4719 type Borrowed<'a> = &'a Self;
4720 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4721 value
4722 }
4723 }
4724
4725 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4726 type Owned = Self;
4727
4728 #[inline(always)]
4729 fn inline_align(_context: fidl::encoding::Context) -> usize {
4730 8
4731 }
4732
4733 #[inline(always)]
4734 fn inline_size(_context: fidl::encoding::Context) -> usize {
4735 16
4736 }
4737 }
4738
4739 unsafe impl<D: fidl::encoding::ResourceDialect>
4740 fidl::encoding::Encode<TouchScreenSimulateMultiFingerGestureRequest, D>
4741 for &TouchScreenSimulateMultiFingerGestureRequest
4742 {
4743 unsafe fn encode(
4744 self,
4745 encoder: &mut fidl::encoding::Encoder<'_, D>,
4746 offset: usize,
4747 mut depth: fidl::encoding::Depth,
4748 ) -> fidl::Result<()> {
4749 encoder.debug_check_bounds::<TouchScreenSimulateMultiFingerGestureRequest>(offset);
4750 let max_ordinal: u64 = self.max_ordinal_present();
4752 encoder.write_num(max_ordinal, offset);
4753 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4754 if max_ordinal == 0 {
4756 return Ok(());
4757 }
4758 depth.increment()?;
4759 let envelope_size = 8;
4760 let bytes_len = max_ordinal as usize * envelope_size;
4761 #[allow(unused_variables)]
4762 let offset = encoder.out_of_line_offset(bytes_len);
4763 let mut _prev_end_offset: usize = 0;
4764 if 1 > max_ordinal {
4765 return Ok(());
4766 }
4767
4768 let cur_offset: usize = (1 - 1) * envelope_size;
4771
4772 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4774
4775 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D>(
4780 self.start_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4781 encoder, offset + cur_offset, depth
4782 )?;
4783
4784 _prev_end_offset = cur_offset + envelope_size;
4785 if 2 > max_ordinal {
4786 return Ok(());
4787 }
4788
4789 let cur_offset: usize = (2 - 1) * envelope_size;
4792
4793 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4795
4796 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D>(
4801 self.end_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4802 encoder, offset + cur_offset, depth
4803 )?;
4804
4805 _prev_end_offset = cur_offset + envelope_size;
4806 if 3 > max_ordinal {
4807 return Ok(());
4808 }
4809
4810 let cur_offset: usize = (3 - 1) * envelope_size;
4813
4814 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4816
4817 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4822 self.move_event_count
4823 .as_ref()
4824 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4825 encoder,
4826 offset + cur_offset,
4827 depth,
4828 )?;
4829
4830 _prev_end_offset = cur_offset + envelope_size;
4831 if 4 > max_ordinal {
4832 return Ok(());
4833 }
4834
4835 let cur_offset: usize = (4 - 1) * envelope_size;
4838
4839 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4841
4842 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4847 self.finger_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4848 encoder,
4849 offset + cur_offset,
4850 depth,
4851 )?;
4852
4853 _prev_end_offset = cur_offset + envelope_size;
4854
4855 Ok(())
4856 }
4857 }
4858
4859 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4860 for TouchScreenSimulateMultiFingerGestureRequest
4861 {
4862 #[inline(always)]
4863 fn new_empty() -> Self {
4864 Self::default()
4865 }
4866
4867 unsafe fn decode(
4868 &mut self,
4869 decoder: &mut fidl::encoding::Decoder<'_, D>,
4870 offset: usize,
4871 mut depth: fidl::encoding::Depth,
4872 ) -> fidl::Result<()> {
4873 decoder.debug_check_bounds::<Self>(offset);
4874 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4875 None => return Err(fidl::Error::NotNullable),
4876 Some(len) => len,
4877 };
4878 if len == 0 {
4880 return Ok(());
4881 };
4882 depth.increment()?;
4883 let envelope_size = 8;
4884 let bytes_len = len * envelope_size;
4885 let offset = decoder.out_of_line_offset(bytes_len)?;
4886 let mut _next_ordinal_to_read = 0;
4888 let mut next_offset = offset;
4889 let end_offset = offset + bytes_len;
4890 _next_ordinal_to_read += 1;
4891 if next_offset >= end_offset {
4892 return Ok(());
4893 }
4894
4895 while _next_ordinal_to_read < 1 {
4897 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4898 _next_ordinal_to_read += 1;
4899 next_offset += envelope_size;
4900 }
4901
4902 let next_out_of_line = decoder.next_out_of_line();
4903 let handles_before = decoder.remaining_handles();
4904 if let Some((inlined, num_bytes, num_handles)) =
4905 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4906 {
4907 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4908 if inlined != (member_inline_size <= 4) {
4909 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4910 }
4911 let inner_offset;
4912 let mut inner_depth = depth.clone();
4913 if inlined {
4914 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4915 inner_offset = next_offset;
4916 } else {
4917 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4918 inner_depth.increment()?;
4919 }
4920 let val_ref =
4921 self.start_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D));
4922 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4923 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4924 {
4925 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4926 }
4927 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4928 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4929 }
4930 }
4931
4932 next_offset += envelope_size;
4933 _next_ordinal_to_read += 1;
4934 if next_offset >= end_offset {
4935 return Ok(());
4936 }
4937
4938 while _next_ordinal_to_read < 2 {
4940 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4941 _next_ordinal_to_read += 1;
4942 next_offset += envelope_size;
4943 }
4944
4945 let next_out_of_line = decoder.next_out_of_line();
4946 let handles_before = decoder.remaining_handles();
4947 if let Some((inlined, num_bytes, num_handles)) =
4948 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4949 {
4950 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4951 if inlined != (member_inline_size <= 4) {
4952 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4953 }
4954 let inner_offset;
4955 let mut inner_depth = depth.clone();
4956 if inlined {
4957 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4958 inner_offset = next_offset;
4959 } else {
4960 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4961 inner_depth.increment()?;
4962 }
4963 let val_ref =
4964 self.end_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D));
4965 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4966 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4967 {
4968 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4969 }
4970 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4971 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4972 }
4973 }
4974
4975 next_offset += envelope_size;
4976 _next_ordinal_to_read += 1;
4977 if next_offset >= end_offset {
4978 return Ok(());
4979 }
4980
4981 while _next_ordinal_to_read < 3 {
4983 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4984 _next_ordinal_to_read += 1;
4985 next_offset += envelope_size;
4986 }
4987
4988 let next_out_of_line = decoder.next_out_of_line();
4989 let handles_before = decoder.remaining_handles();
4990 if let Some((inlined, num_bytes, num_handles)) =
4991 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4992 {
4993 let member_inline_size =
4994 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4995 if inlined != (member_inline_size <= 4) {
4996 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4997 }
4998 let inner_offset;
4999 let mut inner_depth = depth.clone();
5000 if inlined {
5001 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5002 inner_offset = next_offset;
5003 } else {
5004 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5005 inner_depth.increment()?;
5006 }
5007 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5008 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5009 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5010 {
5011 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5012 }
5013 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5014 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5015 }
5016 }
5017
5018 next_offset += envelope_size;
5019 _next_ordinal_to_read += 1;
5020 if next_offset >= end_offset {
5021 return Ok(());
5022 }
5023
5024 while _next_ordinal_to_read < 4 {
5026 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5027 _next_ordinal_to_read += 1;
5028 next_offset += envelope_size;
5029 }
5030
5031 let next_out_of_line = decoder.next_out_of_line();
5032 let handles_before = decoder.remaining_handles();
5033 if let Some((inlined, num_bytes, num_handles)) =
5034 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5035 {
5036 let member_inline_size =
5037 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5038 if inlined != (member_inline_size <= 4) {
5039 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5040 }
5041 let inner_offset;
5042 let mut inner_depth = depth.clone();
5043 if inlined {
5044 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5045 inner_offset = next_offset;
5046 } else {
5047 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5048 inner_depth.increment()?;
5049 }
5050 let val_ref = self.finger_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5051 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5052 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5053 {
5054 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5055 }
5056 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5057 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5058 }
5059 }
5060
5061 next_offset += envelope_size;
5062
5063 while next_offset < end_offset {
5065 _next_ordinal_to_read += 1;
5066 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5067 next_offset += envelope_size;
5068 }
5069
5070 Ok(())
5071 }
5072 }
5073
5074 impl TouchScreenSimulateMultiTapRequest {
5075 #[inline(always)]
5076 fn max_ordinal_present(&self) -> u64 {
5077 if let Some(_) = self.tap_locations {
5078 return 1;
5079 }
5080 0
5081 }
5082 }
5083
5084 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiTapRequest {
5085 type Borrowed<'a> = &'a Self;
5086 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5087 value
5088 }
5089 }
5090
5091 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiTapRequest {
5092 type Owned = Self;
5093
5094 #[inline(always)]
5095 fn inline_align(_context: fidl::encoding::Context) -> usize {
5096 8
5097 }
5098
5099 #[inline(always)]
5100 fn inline_size(_context: fidl::encoding::Context) -> usize {
5101 16
5102 }
5103 }
5104
5105 unsafe impl<D: fidl::encoding::ResourceDialect>
5106 fidl::encoding::Encode<TouchScreenSimulateMultiTapRequest, D>
5107 for &TouchScreenSimulateMultiTapRequest
5108 {
5109 unsafe fn encode(
5110 self,
5111 encoder: &mut fidl::encoding::Encoder<'_, D>,
5112 offset: usize,
5113 mut depth: fidl::encoding::Depth,
5114 ) -> fidl::Result<()> {
5115 encoder.debug_check_bounds::<TouchScreenSimulateMultiTapRequest>(offset);
5116 let max_ordinal: u64 = self.max_ordinal_present();
5118 encoder.write_num(max_ordinal, offset);
5119 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5120 if max_ordinal == 0 {
5122 return Ok(());
5123 }
5124 depth.increment()?;
5125 let envelope_size = 8;
5126 let bytes_len = max_ordinal as usize * envelope_size;
5127 #[allow(unused_variables)]
5128 let offset = encoder.out_of_line_offset(bytes_len);
5129 let mut _prev_end_offset: usize = 0;
5130 if 1 > max_ordinal {
5131 return Ok(());
5132 }
5133
5134 let cur_offset: usize = (1 - 1) * envelope_size;
5137
5138 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5140
5141 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10>, D>(
5146 self.tap_locations.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
5147 encoder, offset + cur_offset, depth
5148 )?;
5149
5150 _prev_end_offset = cur_offset + envelope_size;
5151
5152 Ok(())
5153 }
5154 }
5155
5156 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5157 for TouchScreenSimulateMultiTapRequest
5158 {
5159 #[inline(always)]
5160 fn new_empty() -> Self {
5161 Self::default()
5162 }
5163
5164 unsafe fn decode(
5165 &mut self,
5166 decoder: &mut fidl::encoding::Decoder<'_, D>,
5167 offset: usize,
5168 mut depth: fidl::encoding::Depth,
5169 ) -> fidl::Result<()> {
5170 decoder.debug_check_bounds::<Self>(offset);
5171 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5172 None => return Err(fidl::Error::NotNullable),
5173 Some(len) => len,
5174 };
5175 if len == 0 {
5177 return Ok(());
5178 };
5179 depth.increment()?;
5180 let envelope_size = 8;
5181 let bytes_len = len * envelope_size;
5182 let offset = decoder.out_of_line_offset(bytes_len)?;
5183 let mut _next_ordinal_to_read = 0;
5185 let mut next_offset = offset;
5186 let end_offset = offset + bytes_len;
5187 _next_ordinal_to_read += 1;
5188 if next_offset >= end_offset {
5189 return Ok(());
5190 }
5191
5192 while _next_ordinal_to_read < 1 {
5194 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5195 _next_ordinal_to_read += 1;
5196 next_offset += envelope_size;
5197 }
5198
5199 let next_out_of_line = decoder.next_out_of_line();
5200 let handles_before = decoder.remaining_handles();
5201 if let Some((inlined, num_bytes, num_handles)) =
5202 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5203 {
5204 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5205 if inlined != (member_inline_size <= 4) {
5206 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5207 }
5208 let inner_offset;
5209 let mut inner_depth = depth.clone();
5210 if inlined {
5211 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5212 inner_offset = next_offset;
5213 } else {
5214 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5215 inner_depth.increment()?;
5216 }
5217 let val_ref =
5218 self.tap_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10>, D));
5219 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5220 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5221 {
5222 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5223 }
5224 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5225 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5226 }
5227 }
5228
5229 next_offset += envelope_size;
5230
5231 while next_offset < end_offset {
5233 _next_ordinal_to_read += 1;
5234 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5235 next_offset += envelope_size;
5236 }
5237
5238 Ok(())
5239 }
5240 }
5241
5242 impl TouchScreenSimulateSwipeRequest {
5243 #[inline(always)]
5244 fn max_ordinal_present(&self) -> u64 {
5245 if let Some(_) = self.duration {
5246 return 4;
5247 }
5248 if let Some(_) = self.move_event_count {
5249 return 3;
5250 }
5251 if let Some(_) = self.end_location {
5252 return 2;
5253 }
5254 if let Some(_) = self.start_location {
5255 return 1;
5256 }
5257 0
5258 }
5259 }
5260
5261 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateSwipeRequest {
5262 type Borrowed<'a> = &'a Self;
5263 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5264 value
5265 }
5266 }
5267
5268 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateSwipeRequest {
5269 type Owned = Self;
5270
5271 #[inline(always)]
5272 fn inline_align(_context: fidl::encoding::Context) -> usize {
5273 8
5274 }
5275
5276 #[inline(always)]
5277 fn inline_size(_context: fidl::encoding::Context) -> usize {
5278 16
5279 }
5280 }
5281
5282 unsafe impl<D: fidl::encoding::ResourceDialect>
5283 fidl::encoding::Encode<TouchScreenSimulateSwipeRequest, D>
5284 for &TouchScreenSimulateSwipeRequest
5285 {
5286 unsafe fn encode(
5287 self,
5288 encoder: &mut fidl::encoding::Encoder<'_, D>,
5289 offset: usize,
5290 mut depth: fidl::encoding::Depth,
5291 ) -> fidl::Result<()> {
5292 encoder.debug_check_bounds::<TouchScreenSimulateSwipeRequest>(offset);
5293 let max_ordinal: u64 = self.max_ordinal_present();
5295 encoder.write_num(max_ordinal, offset);
5296 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5297 if max_ordinal == 0 {
5299 return Ok(());
5300 }
5301 depth.increment()?;
5302 let envelope_size = 8;
5303 let bytes_len = max_ordinal as usize * envelope_size;
5304 #[allow(unused_variables)]
5305 let offset = encoder.out_of_line_offset(bytes_len);
5306 let mut _prev_end_offset: usize = 0;
5307 if 1 > max_ordinal {
5308 return Ok(());
5309 }
5310
5311 let cur_offset: usize = (1 - 1) * envelope_size;
5314
5315 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5317
5318 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::Vec_, D>(
5323 self.start_location.as_ref().map(
5324 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5325 ),
5326 encoder,
5327 offset + cur_offset,
5328 depth,
5329 )?;
5330
5331 _prev_end_offset = cur_offset + envelope_size;
5332 if 2 > max_ordinal {
5333 return Ok(());
5334 }
5335
5336 let cur_offset: usize = (2 - 1) * envelope_size;
5339
5340 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5342
5343 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::Vec_, D>(
5348 self.end_location.as_ref().map(
5349 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5350 ),
5351 encoder,
5352 offset + cur_offset,
5353 depth,
5354 )?;
5355
5356 _prev_end_offset = cur_offset + envelope_size;
5357 if 3 > max_ordinal {
5358 return Ok(());
5359 }
5360
5361 let cur_offset: usize = (3 - 1) * envelope_size;
5364
5365 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5367
5368 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5373 self.move_event_count
5374 .as_ref()
5375 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5376 encoder,
5377 offset + cur_offset,
5378 depth,
5379 )?;
5380
5381 _prev_end_offset = cur_offset + envelope_size;
5382 if 4 > max_ordinal {
5383 return Ok(());
5384 }
5385
5386 let cur_offset: usize = (4 - 1) * envelope_size;
5389
5390 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5392
5393 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5398 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5399 encoder,
5400 offset + cur_offset,
5401 depth,
5402 )?;
5403
5404 _prev_end_offset = cur_offset + envelope_size;
5405
5406 Ok(())
5407 }
5408 }
5409
5410 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5411 for TouchScreenSimulateSwipeRequest
5412 {
5413 #[inline(always)]
5414 fn new_empty() -> Self {
5415 Self::default()
5416 }
5417
5418 unsafe fn decode(
5419 &mut self,
5420 decoder: &mut fidl::encoding::Decoder<'_, D>,
5421 offset: usize,
5422 mut depth: fidl::encoding::Depth,
5423 ) -> fidl::Result<()> {
5424 decoder.debug_check_bounds::<Self>(offset);
5425 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5426 None => return Err(fidl::Error::NotNullable),
5427 Some(len) => len,
5428 };
5429 if len == 0 {
5431 return Ok(());
5432 };
5433 depth.increment()?;
5434 let envelope_size = 8;
5435 let bytes_len = len * envelope_size;
5436 let offset = decoder.out_of_line_offset(bytes_len)?;
5437 let mut _next_ordinal_to_read = 0;
5439 let mut next_offset = offset;
5440 let end_offset = offset + bytes_len;
5441 _next_ordinal_to_read += 1;
5442 if next_offset >= end_offset {
5443 return Ok(());
5444 }
5445
5446 while _next_ordinal_to_read < 1 {
5448 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5449 _next_ordinal_to_read += 1;
5450 next_offset += envelope_size;
5451 }
5452
5453 let next_out_of_line = decoder.next_out_of_line();
5454 let handles_before = decoder.remaining_handles();
5455 if let Some((inlined, num_bytes, num_handles)) =
5456 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5457 {
5458 let member_inline_size =
5459 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5460 decoder.context,
5461 );
5462 if inlined != (member_inline_size <= 4) {
5463 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5464 }
5465 let inner_offset;
5466 let mut inner_depth = depth.clone();
5467 if inlined {
5468 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5469 inner_offset = next_offset;
5470 } else {
5471 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5472 inner_depth.increment()?;
5473 }
5474 let val_ref = self
5475 .start_location
5476 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::Vec_, D));
5477 fidl::decode!(
5478 fidl_fuchsia_math_common::Vec_,
5479 D,
5480 val_ref,
5481 decoder,
5482 inner_offset,
5483 inner_depth
5484 )?;
5485 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5486 {
5487 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5488 }
5489 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5490 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5491 }
5492 }
5493
5494 next_offset += envelope_size;
5495 _next_ordinal_to_read += 1;
5496 if next_offset >= end_offset {
5497 return Ok(());
5498 }
5499
5500 while _next_ordinal_to_read < 2 {
5502 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5503 _next_ordinal_to_read += 1;
5504 next_offset += envelope_size;
5505 }
5506
5507 let next_out_of_line = decoder.next_out_of_line();
5508 let handles_before = decoder.remaining_handles();
5509 if let Some((inlined, num_bytes, num_handles)) =
5510 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5511 {
5512 let member_inline_size =
5513 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5514 decoder.context,
5515 );
5516 if inlined != (member_inline_size <= 4) {
5517 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5518 }
5519 let inner_offset;
5520 let mut inner_depth = depth.clone();
5521 if inlined {
5522 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5523 inner_offset = next_offset;
5524 } else {
5525 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5526 inner_depth.increment()?;
5527 }
5528 let val_ref = self
5529 .end_location
5530 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::Vec_, D));
5531 fidl::decode!(
5532 fidl_fuchsia_math_common::Vec_,
5533 D,
5534 val_ref,
5535 decoder,
5536 inner_offset,
5537 inner_depth
5538 )?;
5539 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5540 {
5541 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5542 }
5543 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5544 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5545 }
5546 }
5547
5548 next_offset += envelope_size;
5549 _next_ordinal_to_read += 1;
5550 if next_offset >= end_offset {
5551 return Ok(());
5552 }
5553
5554 while _next_ordinal_to_read < 3 {
5556 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5557 _next_ordinal_to_read += 1;
5558 next_offset += envelope_size;
5559 }
5560
5561 let next_out_of_line = decoder.next_out_of_line();
5562 let handles_before = decoder.remaining_handles();
5563 if let Some((inlined, num_bytes, num_handles)) =
5564 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5565 {
5566 let member_inline_size =
5567 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5568 if inlined != (member_inline_size <= 4) {
5569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5570 }
5571 let inner_offset;
5572 let mut inner_depth = depth.clone();
5573 if inlined {
5574 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5575 inner_offset = next_offset;
5576 } else {
5577 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5578 inner_depth.increment()?;
5579 }
5580 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5581 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5582 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5583 {
5584 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5585 }
5586 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5587 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5588 }
5589 }
5590
5591 next_offset += envelope_size;
5592 _next_ordinal_to_read += 1;
5593 if next_offset >= end_offset {
5594 return Ok(());
5595 }
5596
5597 while _next_ordinal_to_read < 4 {
5599 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5600 _next_ordinal_to_read += 1;
5601 next_offset += envelope_size;
5602 }
5603
5604 let next_out_of_line = decoder.next_out_of_line();
5605 let handles_before = decoder.remaining_handles();
5606 if let Some((inlined, num_bytes, num_handles)) =
5607 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5608 {
5609 let member_inline_size =
5610 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5611 if inlined != (member_inline_size <= 4) {
5612 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5613 }
5614 let inner_offset;
5615 let mut inner_depth = depth.clone();
5616 if inlined {
5617 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5618 inner_offset = next_offset;
5619 } else {
5620 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5621 inner_depth.increment()?;
5622 }
5623 let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
5624 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5625 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5626 {
5627 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5628 }
5629 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5630 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5631 }
5632 }
5633
5634 next_offset += envelope_size;
5635
5636 while next_offset < end_offset {
5638 _next_ordinal_to_read += 1;
5639 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5640 next_offset += envelope_size;
5641 }
5642
5643 Ok(())
5644 }
5645 }
5646
5647 impl TouchScreenSimulateTapRequest {
5648 #[inline(always)]
5649 fn max_ordinal_present(&self) -> u64 {
5650 if let Some(_) = self.tap_location {
5651 return 1;
5652 }
5653 0
5654 }
5655 }
5656
5657 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTapRequest {
5658 type Borrowed<'a> = &'a Self;
5659 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5660 value
5661 }
5662 }
5663
5664 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTapRequest {
5665 type Owned = Self;
5666
5667 #[inline(always)]
5668 fn inline_align(_context: fidl::encoding::Context) -> usize {
5669 8
5670 }
5671
5672 #[inline(always)]
5673 fn inline_size(_context: fidl::encoding::Context) -> usize {
5674 16
5675 }
5676 }
5677
5678 unsafe impl<D: fidl::encoding::ResourceDialect>
5679 fidl::encoding::Encode<TouchScreenSimulateTapRequest, D>
5680 for &TouchScreenSimulateTapRequest
5681 {
5682 unsafe fn encode(
5683 self,
5684 encoder: &mut fidl::encoding::Encoder<'_, D>,
5685 offset: usize,
5686 mut depth: fidl::encoding::Depth,
5687 ) -> fidl::Result<()> {
5688 encoder.debug_check_bounds::<TouchScreenSimulateTapRequest>(offset);
5689 let max_ordinal: u64 = self.max_ordinal_present();
5691 encoder.write_num(max_ordinal, offset);
5692 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5693 if max_ordinal == 0 {
5695 return Ok(());
5696 }
5697 depth.increment()?;
5698 let envelope_size = 8;
5699 let bytes_len = max_ordinal as usize * envelope_size;
5700 #[allow(unused_variables)]
5701 let offset = encoder.out_of_line_offset(bytes_len);
5702 let mut _prev_end_offset: usize = 0;
5703 if 1 > max_ordinal {
5704 return Ok(());
5705 }
5706
5707 let cur_offset: usize = (1 - 1) * envelope_size;
5710
5711 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5713
5714 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::Vec_, D>(
5719 self.tap_location.as_ref().map(
5720 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5721 ),
5722 encoder,
5723 offset + cur_offset,
5724 depth,
5725 )?;
5726
5727 _prev_end_offset = cur_offset + envelope_size;
5728
5729 Ok(())
5730 }
5731 }
5732
5733 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5734 for TouchScreenSimulateTapRequest
5735 {
5736 #[inline(always)]
5737 fn new_empty() -> Self {
5738 Self::default()
5739 }
5740
5741 unsafe fn decode(
5742 &mut self,
5743 decoder: &mut fidl::encoding::Decoder<'_, D>,
5744 offset: usize,
5745 mut depth: fidl::encoding::Depth,
5746 ) -> fidl::Result<()> {
5747 decoder.debug_check_bounds::<Self>(offset);
5748 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5749 None => return Err(fidl::Error::NotNullable),
5750 Some(len) => len,
5751 };
5752 if len == 0 {
5754 return Ok(());
5755 };
5756 depth.increment()?;
5757 let envelope_size = 8;
5758 let bytes_len = len * envelope_size;
5759 let offset = decoder.out_of_line_offset(bytes_len)?;
5760 let mut _next_ordinal_to_read = 0;
5762 let mut next_offset = offset;
5763 let end_offset = offset + bytes_len;
5764 _next_ordinal_to_read += 1;
5765 if next_offset >= end_offset {
5766 return Ok(());
5767 }
5768
5769 while _next_ordinal_to_read < 1 {
5771 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5772 _next_ordinal_to_read += 1;
5773 next_offset += envelope_size;
5774 }
5775
5776 let next_out_of_line = decoder.next_out_of_line();
5777 let handles_before = decoder.remaining_handles();
5778 if let Some((inlined, num_bytes, num_handles)) =
5779 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5780 {
5781 let member_inline_size =
5782 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5783 decoder.context,
5784 );
5785 if inlined != (member_inline_size <= 4) {
5786 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5787 }
5788 let inner_offset;
5789 let mut inner_depth = depth.clone();
5790 if inlined {
5791 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5792 inner_offset = next_offset;
5793 } else {
5794 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5795 inner_depth.increment()?;
5796 }
5797 let val_ref = self
5798 .tap_location
5799 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::Vec_, D));
5800 fidl::decode!(
5801 fidl_fuchsia_math_common::Vec_,
5802 D,
5803 val_ref,
5804 decoder,
5805 inner_offset,
5806 inner_depth
5807 )?;
5808 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5809 {
5810 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5811 }
5812 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5813 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5814 }
5815 }
5816
5817 next_offset += envelope_size;
5818
5819 while next_offset < end_offset {
5821 _next_ordinal_to_read += 1;
5822 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5823 next_offset += envelope_size;
5824 }
5825
5826 Ok(())
5827 }
5828 }
5829}