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