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
534mod internal {
535 use super::*;
536 unsafe impl fidl::encoding::TypeMarker for CoordinateUnit {
537 type Owned = Self;
538
539 #[inline(always)]
540 fn inline_align(_context: fidl::encoding::Context) -> usize {
541 std::mem::align_of::<u32>()
542 }
543
544 #[inline(always)]
545 fn inline_size(_context: fidl::encoding::Context) -> usize {
546 std::mem::size_of::<u32>()
547 }
548
549 #[inline(always)]
550 fn encode_is_copy() -> bool {
551 false
552 }
553
554 #[inline(always)]
555 fn decode_is_copy() -> bool {
556 false
557 }
558 }
559
560 impl fidl::encoding::ValueTypeMarker for CoordinateUnit {
561 type Borrowed<'a> = Self;
562 #[inline(always)]
563 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
564 *value
565 }
566 }
567
568 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CoordinateUnit {
569 #[inline]
570 unsafe fn encode(
571 self,
572 encoder: &mut fidl::encoding::Encoder<'_, D>,
573 offset: usize,
574 _depth: fidl::encoding::Depth,
575 ) -> fidl::Result<()> {
576 encoder.debug_check_bounds::<Self>(offset);
577 encoder.write_num(self.into_primitive(), offset);
578 Ok(())
579 }
580 }
581
582 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoordinateUnit {
583 #[inline(always)]
584 fn new_empty() -> Self {
585 Self::unknown()
586 }
587
588 #[inline]
589 unsafe fn decode(
590 &mut self,
591 decoder: &mut fidl::encoding::Decoder<'_, D>,
592 offset: usize,
593 _depth: fidl::encoding::Depth,
594 ) -> fidl::Result<()> {
595 decoder.debug_check_bounds::<Self>(offset);
596 let prim = decoder.read_num::<u32>(offset);
597
598 *self = Self::from_primitive_allow_unknown(prim);
599 Ok(())
600 }
601 }
602 unsafe impl fidl::encoding::TypeMarker for MouseButton {
603 type Owned = Self;
604
605 #[inline(always)]
606 fn inline_align(_context: fidl::encoding::Context) -> usize {
607 std::mem::align_of::<u32>()
608 }
609
610 #[inline(always)]
611 fn inline_size(_context: fidl::encoding::Context) -> usize {
612 std::mem::size_of::<u32>()
613 }
614
615 #[inline(always)]
616 fn encode_is_copy() -> bool {
617 false
618 }
619
620 #[inline(always)]
621 fn decode_is_copy() -> bool {
622 false
623 }
624 }
625
626 impl fidl::encoding::ValueTypeMarker for MouseButton {
627 type Borrowed<'a> = Self;
628 #[inline(always)]
629 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
630 *value
631 }
632 }
633
634 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MouseButton {
635 #[inline]
636 unsafe fn encode(
637 self,
638 encoder: &mut fidl::encoding::Encoder<'_, D>,
639 offset: usize,
640 _depth: fidl::encoding::Depth,
641 ) -> fidl::Result<()> {
642 encoder.debug_check_bounds::<Self>(offset);
643 encoder.write_num(self.into_primitive(), offset);
644 Ok(())
645 }
646 }
647
648 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseButton {
649 #[inline(always)]
650 fn new_empty() -> Self {
651 Self::unknown()
652 }
653
654 #[inline]
655 unsafe fn decode(
656 &mut self,
657 decoder: &mut fidl::encoding::Decoder<'_, D>,
658 offset: usize,
659 _depth: fidl::encoding::Depth,
660 ) -> fidl::Result<()> {
661 decoder.debug_check_bounds::<Self>(offset);
662 let prim = decoder.read_num::<u32>(offset);
663
664 *self = Self::from_primitive_allow_unknown(prim);
665 Ok(())
666 }
667 }
668 unsafe impl fidl::encoding::TypeMarker for MouseEventPhase {
669 type Owned = Self;
670
671 #[inline(always)]
672 fn inline_align(_context: fidl::encoding::Context) -> usize {
673 std::mem::align_of::<u32>()
674 }
675
676 #[inline(always)]
677 fn inline_size(_context: fidl::encoding::Context) -> usize {
678 std::mem::size_of::<u32>()
679 }
680
681 #[inline(always)]
682 fn encode_is_copy() -> bool {
683 false
684 }
685
686 #[inline(always)]
687 fn decode_is_copy() -> bool {
688 false
689 }
690 }
691
692 impl fidl::encoding::ValueTypeMarker for MouseEventPhase {
693 type Borrowed<'a> = Self;
694 #[inline(always)]
695 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
696 *value
697 }
698 }
699
700 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
701 for MouseEventPhase
702 {
703 #[inline]
704 unsafe fn encode(
705 self,
706 encoder: &mut fidl::encoding::Encoder<'_, D>,
707 offset: usize,
708 _depth: fidl::encoding::Depth,
709 ) -> fidl::Result<()> {
710 encoder.debug_check_bounds::<Self>(offset);
711 encoder.write_num(self.into_primitive(), offset);
712 Ok(())
713 }
714 }
715
716 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseEventPhase {
717 #[inline(always)]
718 fn new_empty() -> Self {
719 Self::unknown()
720 }
721
722 #[inline]
723 unsafe fn decode(
724 &mut self,
725 decoder: &mut fidl::encoding::Decoder<'_, D>,
726 offset: usize,
727 _depth: fidl::encoding::Depth,
728 ) -> fidl::Result<()> {
729 decoder.debug_check_bounds::<Self>(offset);
730 let prim = decoder.read_num::<u32>(offset);
731
732 *self = Self::from_primitive_allow_unknown(prim);
733 Ok(())
734 }
735 }
736 unsafe impl fidl::encoding::TypeMarker for TestAppStatus {
737 type Owned = Self;
738
739 #[inline(always)]
740 fn inline_align(_context: fidl::encoding::Context) -> usize {
741 std::mem::align_of::<u16>()
742 }
743
744 #[inline(always)]
745 fn inline_size(_context: fidl::encoding::Context) -> usize {
746 std::mem::size_of::<u16>()
747 }
748
749 #[inline(always)]
750 fn encode_is_copy() -> bool {
751 false
752 }
753
754 #[inline(always)]
755 fn decode_is_copy() -> bool {
756 false
757 }
758 }
759
760 impl fidl::encoding::ValueTypeMarker for TestAppStatus {
761 type Borrowed<'a> = Self;
762 #[inline(always)]
763 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
764 *value
765 }
766 }
767
768 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TestAppStatus {
769 #[inline]
770 unsafe fn encode(
771 self,
772 encoder: &mut fidl::encoding::Encoder<'_, D>,
773 offset: usize,
774 _depth: fidl::encoding::Depth,
775 ) -> fidl::Result<()> {
776 encoder.debug_check_bounds::<Self>(offset);
777 encoder.write_num(self.into_primitive(), offset);
778 Ok(())
779 }
780 }
781
782 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestAppStatus {
783 #[inline(always)]
784 fn new_empty() -> Self {
785 Self::unknown()
786 }
787
788 #[inline]
789 unsafe fn decode(
790 &mut self,
791 decoder: &mut fidl::encoding::Decoder<'_, D>,
792 offset: usize,
793 _depth: fidl::encoding::Depth,
794 ) -> fidl::Result<()> {
795 decoder.debug_check_bounds::<Self>(offset);
796 let prim = decoder.read_num::<u16>(offset);
797
798 *self = Self::from_primitive_allow_unknown(prim);
799 Ok(())
800 }
801 }
802
803 impl fidl::encoding::ValueTypeMarker for TestAppStatusListenerReportStatusRequest {
804 type Borrowed<'a> = &'a Self;
805 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
806 value
807 }
808 }
809
810 unsafe impl fidl::encoding::TypeMarker for TestAppStatusListenerReportStatusRequest {
811 type Owned = Self;
812
813 #[inline(always)]
814 fn inline_align(_context: fidl::encoding::Context) -> usize {
815 2
816 }
817
818 #[inline(always)]
819 fn inline_size(_context: fidl::encoding::Context) -> usize {
820 2
821 }
822 }
823
824 unsafe impl<D: fidl::encoding::ResourceDialect>
825 fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D>
826 for &TestAppStatusListenerReportStatusRequest
827 {
828 #[inline]
829 unsafe fn encode(
830 self,
831 encoder: &mut fidl::encoding::Encoder<'_, D>,
832 offset: usize,
833 _depth: fidl::encoding::Depth,
834 ) -> fidl::Result<()> {
835 encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
836 fidl::encoding::Encode::<TestAppStatusListenerReportStatusRequest, D>::encode(
838 (<TestAppStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
839 encoder,
840 offset,
841 _depth,
842 )
843 }
844 }
845 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestAppStatus, D>>
846 fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D> for (T0,)
847 {
848 #[inline]
849 unsafe fn encode(
850 self,
851 encoder: &mut fidl::encoding::Encoder<'_, D>,
852 offset: usize,
853 depth: fidl::encoding::Depth,
854 ) -> fidl::Result<()> {
855 encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
856 self.0.encode(encoder, offset + 0, depth)?;
860 Ok(())
861 }
862 }
863
864 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
865 for TestAppStatusListenerReportStatusRequest
866 {
867 #[inline(always)]
868 fn new_empty() -> Self {
869 Self { status: fidl::new_empty!(TestAppStatus, D) }
870 }
871
872 #[inline]
873 unsafe fn decode(
874 &mut self,
875 decoder: &mut fidl::encoding::Decoder<'_, D>,
876 offset: usize,
877 _depth: fidl::encoding::Depth,
878 ) -> fidl::Result<()> {
879 decoder.debug_check_bounds::<Self>(offset);
880 fidl::decode!(TestAppStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
882 Ok(())
883 }
884 }
885
886 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTouchEventRequest {
887 type Borrowed<'a> = &'a Self;
888 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
889 value
890 }
891 }
892
893 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTouchEventRequest {
894 type Owned = Self;
895
896 #[inline(always)]
897 fn inline_align(_context: fidl::encoding::Context) -> usize {
898 8
899 }
900
901 #[inline(always)]
902 fn inline_size(_context: fidl::encoding::Context) -> usize {
903 16
904 }
905 }
906
907 unsafe impl<D: fidl::encoding::ResourceDialect>
908 fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D>
909 for &TouchScreenSimulateTouchEventRequest
910 {
911 #[inline]
912 unsafe fn encode(
913 self,
914 encoder: &mut fidl::encoding::Encoder<'_, D>,
915 offset: usize,
916 _depth: fidl::encoding::Depth,
917 ) -> fidl::Result<()> {
918 encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
919 fidl::encoding::Encode::<TouchScreenSimulateTouchEventRequest, D>::encode(
921 (
922 <fidl_fuchsia_input_report__common::TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),
923 ),
924 encoder, offset, _depth
925 )
926 }
927 }
928 unsafe impl<
929 D: fidl::encoding::ResourceDialect,
930 T0: fidl::encoding::Encode<fidl_fuchsia_input_report__common::TouchInputReport, D>,
931 > fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D> for (T0,)
932 {
933 #[inline]
934 unsafe fn encode(
935 self,
936 encoder: &mut fidl::encoding::Encoder<'_, D>,
937 offset: usize,
938 depth: fidl::encoding::Depth,
939 ) -> fidl::Result<()> {
940 encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
941 self.0.encode(encoder, offset + 0, depth)?;
945 Ok(())
946 }
947 }
948
949 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
950 for TouchScreenSimulateTouchEventRequest
951 {
952 #[inline(always)]
953 fn new_empty() -> Self {
954 Self {
955 report: fidl::new_empty!(fidl_fuchsia_input_report__common::TouchInputReport, D),
956 }
957 }
958
959 #[inline]
960 unsafe fn decode(
961 &mut self,
962 decoder: &mut fidl::encoding::Decoder<'_, D>,
963 offset: usize,
964 _depth: fidl::encoding::Depth,
965 ) -> fidl::Result<()> {
966 decoder.debug_check_bounds::<Self>(offset);
967 fidl::decode!(
969 fidl_fuchsia_input_report__common::TouchInputReport,
970 D,
971 &mut self.report,
972 decoder,
973 offset + 0,
974 _depth
975 )?;
976 Ok(())
977 }
978 }
979
980 impl KeyboardInputListenerReportTextInputRequest {
981 #[inline(always)]
982 fn max_ordinal_present(&self) -> u64 {
983 if let Some(_) = self.device_id {
984 return 3;
985 }
986 if let Some(_) = self.non_printable {
987 return 2;
988 }
989 if let Some(_) = self.text {
990 return 1;
991 }
992 0
993 }
994 }
995
996 impl fidl::encoding::ValueTypeMarker for KeyboardInputListenerReportTextInputRequest {
997 type Borrowed<'a> = &'a Self;
998 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
999 value
1000 }
1001 }
1002
1003 unsafe impl fidl::encoding::TypeMarker for KeyboardInputListenerReportTextInputRequest {
1004 type Owned = Self;
1005
1006 #[inline(always)]
1007 fn inline_align(_context: fidl::encoding::Context) -> usize {
1008 8
1009 }
1010
1011 #[inline(always)]
1012 fn inline_size(_context: fidl::encoding::Context) -> usize {
1013 16
1014 }
1015 }
1016
1017 unsafe impl<D: fidl::encoding::ResourceDialect>
1018 fidl::encoding::Encode<KeyboardInputListenerReportTextInputRequest, D>
1019 for &KeyboardInputListenerReportTextInputRequest
1020 {
1021 unsafe fn encode(
1022 self,
1023 encoder: &mut fidl::encoding::Encoder<'_, D>,
1024 offset: usize,
1025 mut depth: fidl::encoding::Depth,
1026 ) -> fidl::Result<()> {
1027 encoder.debug_check_bounds::<KeyboardInputListenerReportTextInputRequest>(offset);
1028 let max_ordinal: u64 = self.max_ordinal_present();
1030 encoder.write_num(max_ordinal, offset);
1031 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1032 if max_ordinal == 0 {
1034 return Ok(());
1035 }
1036 depth.increment()?;
1037 let envelope_size = 8;
1038 let bytes_len = max_ordinal as usize * envelope_size;
1039 #[allow(unused_variables)]
1040 let offset = encoder.out_of_line_offset(bytes_len);
1041 let mut _prev_end_offset: usize = 0;
1042 if 1 > max_ordinal {
1043 return Ok(());
1044 }
1045
1046 let cur_offset: usize = (1 - 1) * envelope_size;
1049
1050 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1052
1053 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1058 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1059 encoder, offset + cur_offset, depth
1060 )?;
1061
1062 _prev_end_offset = cur_offset + envelope_size;
1063 if 2 > max_ordinal {
1064 return Ok(());
1065 }
1066
1067 let cur_offset: usize = (2 - 1) * envelope_size;
1070
1071 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1073
1074 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_input3__common::NonPrintableKey, D>(
1079 self.non_printable.as_ref().map(<fidl_fuchsia_ui_input3__common::NonPrintableKey as fidl::encoding::ValueTypeMarker>::borrow),
1080 encoder, offset + cur_offset, depth
1081 )?;
1082
1083 _prev_end_offset = cur_offset + envelope_size;
1084 if 3 > max_ordinal {
1085 return Ok(());
1086 }
1087
1088 let cur_offset: usize = (3 - 1) * envelope_size;
1091
1092 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1094
1095 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1100 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1101 encoder,
1102 offset + cur_offset,
1103 depth,
1104 )?;
1105
1106 _prev_end_offset = cur_offset + envelope_size;
1107
1108 Ok(())
1109 }
1110 }
1111
1112 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1113 for KeyboardInputListenerReportTextInputRequest
1114 {
1115 #[inline(always)]
1116 fn new_empty() -> Self {
1117 Self::default()
1118 }
1119
1120 unsafe fn decode(
1121 &mut self,
1122 decoder: &mut fidl::encoding::Decoder<'_, D>,
1123 offset: usize,
1124 mut depth: fidl::encoding::Depth,
1125 ) -> fidl::Result<()> {
1126 decoder.debug_check_bounds::<Self>(offset);
1127 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1128 None => return Err(fidl::Error::NotNullable),
1129 Some(len) => len,
1130 };
1131 if len == 0 {
1133 return Ok(());
1134 };
1135 depth.increment()?;
1136 let envelope_size = 8;
1137 let bytes_len = len * envelope_size;
1138 let offset = decoder.out_of_line_offset(bytes_len)?;
1139 let mut _next_ordinal_to_read = 0;
1141 let mut next_offset = offset;
1142 let end_offset = offset + bytes_len;
1143 _next_ordinal_to_read += 1;
1144 if next_offset >= end_offset {
1145 return Ok(());
1146 }
1147
1148 while _next_ordinal_to_read < 1 {
1150 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1151 _next_ordinal_to_read += 1;
1152 next_offset += envelope_size;
1153 }
1154
1155 let next_out_of_line = decoder.next_out_of_line();
1156 let handles_before = decoder.remaining_handles();
1157 if let Some((inlined, num_bytes, num_handles)) =
1158 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1159 {
1160 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1161 if inlined != (member_inline_size <= 4) {
1162 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1163 }
1164 let inner_offset;
1165 let mut inner_depth = depth.clone();
1166 if inlined {
1167 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1168 inner_offset = next_offset;
1169 } else {
1170 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1171 inner_depth.increment()?;
1172 }
1173 let val_ref = self.text.get_or_insert_with(|| {
1174 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1175 });
1176 fidl::decode!(
1177 fidl::encoding::BoundedString<1024>,
1178 D,
1179 val_ref,
1180 decoder,
1181 inner_offset,
1182 inner_depth
1183 )?;
1184 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1185 {
1186 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1187 }
1188 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1189 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1190 }
1191 }
1192
1193 next_offset += envelope_size;
1194 _next_ordinal_to_read += 1;
1195 if next_offset >= end_offset {
1196 return Ok(());
1197 }
1198
1199 while _next_ordinal_to_read < 2 {
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_fuchsia_ui_input3__common::NonPrintableKey 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.non_printable.get_or_insert_with(|| {
1225 fidl::new_empty!(fidl_fuchsia_ui_input3__common::NonPrintableKey, D)
1226 });
1227 fidl::decode!(
1228 fidl_fuchsia_ui_input3__common::NonPrintableKey,
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 < 3 {
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 =
1263 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1264 if inlined != (member_inline_size <= 4) {
1265 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1266 }
1267 let inner_offset;
1268 let mut inner_depth = depth.clone();
1269 if inlined {
1270 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1271 inner_offset = next_offset;
1272 } else {
1273 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1274 inner_depth.increment()?;
1275 }
1276 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1277 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1278 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1279 {
1280 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1281 }
1282 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1283 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1284 }
1285 }
1286
1287 next_offset += envelope_size;
1288
1289 while next_offset < end_offset {
1291 _next_ordinal_to_read += 1;
1292 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1293 next_offset += envelope_size;
1294 }
1295
1296 Ok(())
1297 }
1298 }
1299
1300 impl KeyboardSimulateKeyEventRequest {
1301 #[inline(always)]
1302 fn max_ordinal_present(&self) -> u64 {
1303 if let Some(_) = self.report {
1304 return 1;
1305 }
1306 0
1307 }
1308 }
1309
1310 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyEventRequest {
1311 type Borrowed<'a> = &'a Self;
1312 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1313 value
1314 }
1315 }
1316
1317 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyEventRequest {
1318 type Owned = Self;
1319
1320 #[inline(always)]
1321 fn inline_align(_context: fidl::encoding::Context) -> usize {
1322 8
1323 }
1324
1325 #[inline(always)]
1326 fn inline_size(_context: fidl::encoding::Context) -> usize {
1327 16
1328 }
1329 }
1330
1331 unsafe impl<D: fidl::encoding::ResourceDialect>
1332 fidl::encoding::Encode<KeyboardSimulateKeyEventRequest, D>
1333 for &KeyboardSimulateKeyEventRequest
1334 {
1335 unsafe fn encode(
1336 self,
1337 encoder: &mut fidl::encoding::Encoder<'_, D>,
1338 offset: usize,
1339 mut depth: fidl::encoding::Depth,
1340 ) -> fidl::Result<()> {
1341 encoder.debug_check_bounds::<KeyboardSimulateKeyEventRequest>(offset);
1342 let max_ordinal: u64 = self.max_ordinal_present();
1344 encoder.write_num(max_ordinal, offset);
1345 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1346 if max_ordinal == 0 {
1348 return Ok(());
1349 }
1350 depth.increment()?;
1351 let envelope_size = 8;
1352 let bytes_len = max_ordinal as usize * envelope_size;
1353 #[allow(unused_variables)]
1354 let offset = encoder.out_of_line_offset(bytes_len);
1355 let mut _prev_end_offset: usize = 0;
1356 if 1 > max_ordinal {
1357 return Ok(());
1358 }
1359
1360 let cur_offset: usize = (1 - 1) * envelope_size;
1363
1364 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1366
1367 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report__common::KeyboardInputReport, D>(
1372 self.report.as_ref().map(<fidl_fuchsia_input_report__common::KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
1373 encoder, offset + cur_offset, depth
1374 )?;
1375
1376 _prev_end_offset = cur_offset + envelope_size;
1377
1378 Ok(())
1379 }
1380 }
1381
1382 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1383 for KeyboardSimulateKeyEventRequest
1384 {
1385 #[inline(always)]
1386 fn new_empty() -> Self {
1387 Self::default()
1388 }
1389
1390 unsafe fn decode(
1391 &mut self,
1392 decoder: &mut fidl::encoding::Decoder<'_, D>,
1393 offset: usize,
1394 mut depth: fidl::encoding::Depth,
1395 ) -> fidl::Result<()> {
1396 decoder.debug_check_bounds::<Self>(offset);
1397 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1398 None => return Err(fidl::Error::NotNullable),
1399 Some(len) => len,
1400 };
1401 if len == 0 {
1403 return Ok(());
1404 };
1405 depth.increment()?;
1406 let envelope_size = 8;
1407 let bytes_len = len * envelope_size;
1408 let offset = decoder.out_of_line_offset(bytes_len)?;
1409 let mut _next_ordinal_to_read = 0;
1411 let mut next_offset = offset;
1412 let end_offset = offset + bytes_len;
1413 _next_ordinal_to_read += 1;
1414 if next_offset >= end_offset {
1415 return Ok(());
1416 }
1417
1418 while _next_ordinal_to_read < 1 {
1420 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1421 _next_ordinal_to_read += 1;
1422 next_offset += envelope_size;
1423 }
1424
1425 let next_out_of_line = decoder.next_out_of_line();
1426 let handles_before = decoder.remaining_handles();
1427 if let Some((inlined, num_bytes, num_handles)) =
1428 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1429 {
1430 let member_inline_size = <fidl_fuchsia_input_report__common::KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1431 if inlined != (member_inline_size <= 4) {
1432 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1433 }
1434 let inner_offset;
1435 let mut inner_depth = depth.clone();
1436 if inlined {
1437 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1438 inner_offset = next_offset;
1439 } else {
1440 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1441 inner_depth.increment()?;
1442 }
1443 let val_ref = self.report.get_or_insert_with(|| {
1444 fidl::new_empty!(fidl_fuchsia_input_report__common::KeyboardInputReport, D)
1445 });
1446 fidl::decode!(
1447 fidl_fuchsia_input_report__common::KeyboardInputReport,
1448 D,
1449 val_ref,
1450 decoder,
1451 inner_offset,
1452 inner_depth
1453 )?;
1454 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1455 {
1456 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1457 }
1458 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1459 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1460 }
1461 }
1462
1463 next_offset += envelope_size;
1464
1465 while next_offset < end_offset {
1467 _next_ordinal_to_read += 1;
1468 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1469 next_offset += envelope_size;
1470 }
1471
1472 Ok(())
1473 }
1474 }
1475
1476 impl KeyboardSimulateKeyPressRequest {
1477 #[inline(always)]
1478 fn max_ordinal_present(&self) -> u64 {
1479 if let Some(_) = self.key_code {
1480 return 1;
1481 }
1482 0
1483 }
1484 }
1485
1486 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyPressRequest {
1487 type Borrowed<'a> = &'a Self;
1488 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1489 value
1490 }
1491 }
1492
1493 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyPressRequest {
1494 type Owned = Self;
1495
1496 #[inline(always)]
1497 fn inline_align(_context: fidl::encoding::Context) -> usize {
1498 8
1499 }
1500
1501 #[inline(always)]
1502 fn inline_size(_context: fidl::encoding::Context) -> usize {
1503 16
1504 }
1505 }
1506
1507 unsafe impl<D: fidl::encoding::ResourceDialect>
1508 fidl::encoding::Encode<KeyboardSimulateKeyPressRequest, D>
1509 for &KeyboardSimulateKeyPressRequest
1510 {
1511 unsafe fn encode(
1512 self,
1513 encoder: &mut fidl::encoding::Encoder<'_, D>,
1514 offset: usize,
1515 mut depth: fidl::encoding::Depth,
1516 ) -> fidl::Result<()> {
1517 encoder.debug_check_bounds::<KeyboardSimulateKeyPressRequest>(offset);
1518 let max_ordinal: u64 = self.max_ordinal_present();
1520 encoder.write_num(max_ordinal, offset);
1521 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1522 if max_ordinal == 0 {
1524 return Ok(());
1525 }
1526 depth.increment()?;
1527 let envelope_size = 8;
1528 let bytes_len = max_ordinal as usize * envelope_size;
1529 #[allow(unused_variables)]
1530 let offset = encoder.out_of_line_offset(bytes_len);
1531 let mut _prev_end_offset: usize = 0;
1532 if 1 > max_ordinal {
1533 return Ok(());
1534 }
1535
1536 let cur_offset: usize = (1 - 1) * envelope_size;
1539
1540 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1542
1543 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input__common::Key, D>(
1548 self.key_code.as_ref().map(
1549 <fidl_fuchsia_input__common::Key as fidl::encoding::ValueTypeMarker>::borrow,
1550 ),
1551 encoder,
1552 offset + cur_offset,
1553 depth,
1554 )?;
1555
1556 _prev_end_offset = cur_offset + envelope_size;
1557
1558 Ok(())
1559 }
1560 }
1561
1562 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1563 for KeyboardSimulateKeyPressRequest
1564 {
1565 #[inline(always)]
1566 fn new_empty() -> Self {
1567 Self::default()
1568 }
1569
1570 unsafe fn decode(
1571 &mut self,
1572 decoder: &mut fidl::encoding::Decoder<'_, D>,
1573 offset: usize,
1574 mut depth: fidl::encoding::Depth,
1575 ) -> fidl::Result<()> {
1576 decoder.debug_check_bounds::<Self>(offset);
1577 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1578 None => return Err(fidl::Error::NotNullable),
1579 Some(len) => len,
1580 };
1581 if len == 0 {
1583 return Ok(());
1584 };
1585 depth.increment()?;
1586 let envelope_size = 8;
1587 let bytes_len = len * envelope_size;
1588 let offset = decoder.out_of_line_offset(bytes_len)?;
1589 let mut _next_ordinal_to_read = 0;
1591 let mut next_offset = offset;
1592 let end_offset = offset + bytes_len;
1593 _next_ordinal_to_read += 1;
1594 if next_offset >= end_offset {
1595 return Ok(());
1596 }
1597
1598 while _next_ordinal_to_read < 1 {
1600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1601 _next_ordinal_to_read += 1;
1602 next_offset += envelope_size;
1603 }
1604
1605 let next_out_of_line = decoder.next_out_of_line();
1606 let handles_before = decoder.remaining_handles();
1607 if let Some((inlined, num_bytes, num_handles)) =
1608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1609 {
1610 let member_inline_size =
1611 <fidl_fuchsia_input__common::Key as fidl::encoding::TypeMarker>::inline_size(
1612 decoder.context,
1613 );
1614 if inlined != (member_inline_size <= 4) {
1615 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1616 }
1617 let inner_offset;
1618 let mut inner_depth = depth.clone();
1619 if inlined {
1620 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1621 inner_offset = next_offset;
1622 } else {
1623 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1624 inner_depth.increment()?;
1625 }
1626 let val_ref = self
1627 .key_code
1628 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input__common::Key, D));
1629 fidl::decode!(
1630 fidl_fuchsia_input__common::Key,
1631 D,
1632 val_ref,
1633 decoder,
1634 inner_offset,
1635 inner_depth
1636 )?;
1637 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1638 {
1639 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1640 }
1641 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1642 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1643 }
1644 }
1645
1646 next_offset += envelope_size;
1647
1648 while next_offset < end_offset {
1650 _next_ordinal_to_read += 1;
1651 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1652 next_offset += envelope_size;
1653 }
1654
1655 Ok(())
1656 }
1657 }
1658
1659 impl KeyboardSimulateUsAsciiTextEntryRequest {
1660 #[inline(always)]
1661 fn max_ordinal_present(&self) -> u64 {
1662 if let Some(_) = self.text {
1663 return 1;
1664 }
1665 0
1666 }
1667 }
1668
1669 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1670 type Borrowed<'a> = &'a Self;
1671 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1672 value
1673 }
1674 }
1675
1676 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
1677 type Owned = Self;
1678
1679 #[inline(always)]
1680 fn inline_align(_context: fidl::encoding::Context) -> usize {
1681 8
1682 }
1683
1684 #[inline(always)]
1685 fn inline_size(_context: fidl::encoding::Context) -> usize {
1686 16
1687 }
1688 }
1689
1690 unsafe impl<D: fidl::encoding::ResourceDialect>
1691 fidl::encoding::Encode<KeyboardSimulateUsAsciiTextEntryRequest, D>
1692 for &KeyboardSimulateUsAsciiTextEntryRequest
1693 {
1694 unsafe fn encode(
1695 self,
1696 encoder: &mut fidl::encoding::Encoder<'_, D>,
1697 offset: usize,
1698 mut depth: fidl::encoding::Depth,
1699 ) -> fidl::Result<()> {
1700 encoder.debug_check_bounds::<KeyboardSimulateUsAsciiTextEntryRequest>(offset);
1701 let max_ordinal: u64 = self.max_ordinal_present();
1703 encoder.write_num(max_ordinal, offset);
1704 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1705 if max_ordinal == 0 {
1707 return Ok(());
1708 }
1709 depth.increment()?;
1710 let envelope_size = 8;
1711 let bytes_len = max_ordinal as usize * envelope_size;
1712 #[allow(unused_variables)]
1713 let offset = encoder.out_of_line_offset(bytes_len);
1714 let mut _prev_end_offset: usize = 0;
1715 if 1 > max_ordinal {
1716 return Ok(());
1717 }
1718
1719 let cur_offset: usize = (1 - 1) * envelope_size;
1722
1723 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1725
1726 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1731 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1732 encoder, offset + cur_offset, depth
1733 )?;
1734
1735 _prev_end_offset = cur_offset + envelope_size;
1736
1737 Ok(())
1738 }
1739 }
1740
1741 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1742 for KeyboardSimulateUsAsciiTextEntryRequest
1743 {
1744 #[inline(always)]
1745 fn new_empty() -> Self {
1746 Self::default()
1747 }
1748
1749 unsafe fn decode(
1750 &mut self,
1751 decoder: &mut fidl::encoding::Decoder<'_, D>,
1752 offset: usize,
1753 mut depth: fidl::encoding::Depth,
1754 ) -> fidl::Result<()> {
1755 decoder.debug_check_bounds::<Self>(offset);
1756 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1757 None => return Err(fidl::Error::NotNullable),
1758 Some(len) => len,
1759 };
1760 if len == 0 {
1762 return Ok(());
1763 };
1764 depth.increment()?;
1765 let envelope_size = 8;
1766 let bytes_len = len * envelope_size;
1767 let offset = decoder.out_of_line_offset(bytes_len)?;
1768 let mut _next_ordinal_to_read = 0;
1770 let mut next_offset = offset;
1771 let end_offset = offset + bytes_len;
1772 _next_ordinal_to_read += 1;
1773 if next_offset >= end_offset {
1774 return Ok(());
1775 }
1776
1777 while _next_ordinal_to_read < 1 {
1779 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1780 _next_ordinal_to_read += 1;
1781 next_offset += envelope_size;
1782 }
1783
1784 let next_out_of_line = decoder.next_out_of_line();
1785 let handles_before = decoder.remaining_handles();
1786 if let Some((inlined, num_bytes, num_handles)) =
1787 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1788 {
1789 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1790 if inlined != (member_inline_size <= 4) {
1791 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1792 }
1793 let inner_offset;
1794 let mut inner_depth = depth.clone();
1795 if inlined {
1796 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1797 inner_offset = next_offset;
1798 } else {
1799 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1800 inner_depth.increment()?;
1801 }
1802 let val_ref = self.text.get_or_insert_with(|| {
1803 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1804 });
1805 fidl::decode!(
1806 fidl::encoding::BoundedString<1024>,
1807 D,
1808 val_ref,
1809 decoder,
1810 inner_offset,
1811 inner_depth
1812 )?;
1813 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1814 {
1815 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1816 }
1817 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1818 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1819 }
1820 }
1821
1822 next_offset += envelope_size;
1823
1824 while next_offset < end_offset {
1826 _next_ordinal_to_read += 1;
1827 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1828 next_offset += envelope_size;
1829 }
1830
1831 Ok(())
1832 }
1833 }
1834
1835 impl MediaButtonsDeviceSendButtonsStateRequest {
1836 #[inline(always)]
1837 fn max_ordinal_present(&self) -> u64 {
1838 if let Some(_) = self.buttons {
1839 return 1;
1840 }
1841 0
1842 }
1843 }
1844
1845 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
1846 type Borrowed<'a> = &'a Self;
1847 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1848 value
1849 }
1850 }
1851
1852 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
1853 type Owned = Self;
1854
1855 #[inline(always)]
1856 fn inline_align(_context: fidl::encoding::Context) -> usize {
1857 8
1858 }
1859
1860 #[inline(always)]
1861 fn inline_size(_context: fidl::encoding::Context) -> usize {
1862 16
1863 }
1864 }
1865
1866 unsafe impl<D: fidl::encoding::ResourceDialect>
1867 fidl::encoding::Encode<MediaButtonsDeviceSendButtonsStateRequest, D>
1868 for &MediaButtonsDeviceSendButtonsStateRequest
1869 {
1870 unsafe fn encode(
1871 self,
1872 encoder: &mut fidl::encoding::Encoder<'_, D>,
1873 offset: usize,
1874 mut depth: fidl::encoding::Depth,
1875 ) -> fidl::Result<()> {
1876 encoder.debug_check_bounds::<MediaButtonsDeviceSendButtonsStateRequest>(offset);
1877 let max_ordinal: u64 = self.max_ordinal_present();
1879 encoder.write_num(max_ordinal, offset);
1880 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1881 if max_ordinal == 0 {
1883 return Ok(());
1884 }
1885 depth.increment()?;
1886 let envelope_size = 8;
1887 let bytes_len = max_ordinal as usize * envelope_size;
1888 #[allow(unused_variables)]
1889 let offset = encoder.out_of_line_offset(bytes_len);
1890 let mut _prev_end_offset: usize = 0;
1891 if 1 > max_ordinal {
1892 return Ok(());
1893 }
1894
1895 let cur_offset: usize = (1 - 1) * envelope_size;
1898
1899 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1901
1902 fidl::encoding::encode_in_envelope_optional::<
1907 fidl::encoding::Vector<
1908 fidl_fuchsia_input_report__common::ConsumerControlButton,
1909 255,
1910 >,
1911 D,
1912 >(
1913 self.buttons.as_ref().map(
1914 <fidl::encoding::Vector<
1915 fidl_fuchsia_input_report__common::ConsumerControlButton,
1916 255,
1917 > as fidl::encoding::ValueTypeMarker>::borrow,
1918 ),
1919 encoder,
1920 offset + cur_offset,
1921 depth,
1922 )?;
1923
1924 _prev_end_offset = cur_offset + envelope_size;
1925
1926 Ok(())
1927 }
1928 }
1929
1930 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1931 for MediaButtonsDeviceSendButtonsStateRequest
1932 {
1933 #[inline(always)]
1934 fn new_empty() -> Self {
1935 Self::default()
1936 }
1937
1938 unsafe fn decode(
1939 &mut self,
1940 decoder: &mut fidl::encoding::Decoder<'_, D>,
1941 offset: usize,
1942 mut depth: fidl::encoding::Depth,
1943 ) -> fidl::Result<()> {
1944 decoder.debug_check_bounds::<Self>(offset);
1945 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1946 None => return Err(fidl::Error::NotNullable),
1947 Some(len) => len,
1948 };
1949 if len == 0 {
1951 return Ok(());
1952 };
1953 depth.increment()?;
1954 let envelope_size = 8;
1955 let bytes_len = len * envelope_size;
1956 let offset = decoder.out_of_line_offset(bytes_len)?;
1957 let mut _next_ordinal_to_read = 0;
1959 let mut next_offset = offset;
1960 let end_offset = offset + bytes_len;
1961 _next_ordinal_to_read += 1;
1962 if next_offset >= end_offset {
1963 return Ok(());
1964 }
1965
1966 while _next_ordinal_to_read < 1 {
1968 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1969 _next_ordinal_to_read += 1;
1970 next_offset += envelope_size;
1971 }
1972
1973 let next_out_of_line = decoder.next_out_of_line();
1974 let handles_before = decoder.remaining_handles();
1975 if let Some((inlined, num_bytes, num_handles)) =
1976 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1977 {
1978 let member_inline_size = <fidl::encoding::Vector<
1979 fidl_fuchsia_input_report__common::ConsumerControlButton,
1980 255,
1981 > as fidl::encoding::TypeMarker>::inline_size(
1982 decoder.context
1983 );
1984 if inlined != (member_inline_size <= 4) {
1985 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1986 }
1987 let inner_offset;
1988 let mut inner_depth = depth.clone();
1989 if inlined {
1990 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1991 inner_offset = next_offset;
1992 } else {
1993 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1994 inner_depth.increment()?;
1995 }
1996 let val_ref =
1997 self.buttons.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input_report__common::ConsumerControlButton, 255>, D));
1998 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input_report__common::ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
1999 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2000 {
2001 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2002 }
2003 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2004 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2005 }
2006 }
2007
2008 next_offset += envelope_size;
2009
2010 while next_offset < end_offset {
2012 _next_ordinal_to_read += 1;
2013 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2014 next_offset += envelope_size;
2015 }
2016
2017 Ok(())
2018 }
2019 }
2020
2021 impl MediaButtonsDeviceSimulateButtonPressRequest {
2022 #[inline(always)]
2023 fn max_ordinal_present(&self) -> u64 {
2024 if let Some(_) = self.button {
2025 return 1;
2026 }
2027 0
2028 }
2029 }
2030
2031 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2032 type Borrowed<'a> = &'a Self;
2033 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2034 value
2035 }
2036 }
2037
2038 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2039 type Owned = Self;
2040
2041 #[inline(always)]
2042 fn inline_align(_context: fidl::encoding::Context) -> usize {
2043 8
2044 }
2045
2046 #[inline(always)]
2047 fn inline_size(_context: fidl::encoding::Context) -> usize {
2048 16
2049 }
2050 }
2051
2052 unsafe impl<D: fidl::encoding::ResourceDialect>
2053 fidl::encoding::Encode<MediaButtonsDeviceSimulateButtonPressRequest, D>
2054 for &MediaButtonsDeviceSimulateButtonPressRequest
2055 {
2056 unsafe fn encode(
2057 self,
2058 encoder: &mut fidl::encoding::Encoder<'_, D>,
2059 offset: usize,
2060 mut depth: fidl::encoding::Depth,
2061 ) -> fidl::Result<()> {
2062 encoder.debug_check_bounds::<MediaButtonsDeviceSimulateButtonPressRequest>(offset);
2063 let max_ordinal: u64 = self.max_ordinal_present();
2065 encoder.write_num(max_ordinal, offset);
2066 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2067 if max_ordinal == 0 {
2069 return Ok(());
2070 }
2071 depth.increment()?;
2072 let envelope_size = 8;
2073 let bytes_len = max_ordinal as usize * envelope_size;
2074 #[allow(unused_variables)]
2075 let offset = encoder.out_of_line_offset(bytes_len);
2076 let mut _prev_end_offset: usize = 0;
2077 if 1 > max_ordinal {
2078 return Ok(());
2079 }
2080
2081 let cur_offset: usize = (1 - 1) * envelope_size;
2084
2085 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2087
2088 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report__common::ConsumerControlButton, D>(
2093 self.button.as_ref().map(<fidl_fuchsia_input_report__common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2094 encoder, offset + cur_offset, depth
2095 )?;
2096
2097 _prev_end_offset = cur_offset + envelope_size;
2098
2099 Ok(())
2100 }
2101 }
2102
2103 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2104 for MediaButtonsDeviceSimulateButtonPressRequest
2105 {
2106 #[inline(always)]
2107 fn new_empty() -> Self {
2108 Self::default()
2109 }
2110
2111 unsafe fn decode(
2112 &mut self,
2113 decoder: &mut fidl::encoding::Decoder<'_, D>,
2114 offset: usize,
2115 mut depth: fidl::encoding::Depth,
2116 ) -> fidl::Result<()> {
2117 decoder.debug_check_bounds::<Self>(offset);
2118 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2119 None => return Err(fidl::Error::NotNullable),
2120 Some(len) => len,
2121 };
2122 if len == 0 {
2124 return Ok(());
2125 };
2126 depth.increment()?;
2127 let envelope_size = 8;
2128 let bytes_len = len * envelope_size;
2129 let offset = decoder.out_of_line_offset(bytes_len)?;
2130 let mut _next_ordinal_to_read = 0;
2132 let mut next_offset = offset;
2133 let end_offset = offset + bytes_len;
2134 _next_ordinal_to_read += 1;
2135 if next_offset >= end_offset {
2136 return Ok(());
2137 }
2138
2139 while _next_ordinal_to_read < 1 {
2141 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2142 _next_ordinal_to_read += 1;
2143 next_offset += envelope_size;
2144 }
2145
2146 let next_out_of_line = decoder.next_out_of_line();
2147 let handles_before = decoder.remaining_handles();
2148 if let Some((inlined, num_bytes, num_handles)) =
2149 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2150 {
2151 let member_inline_size = <fidl_fuchsia_input_report__common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2152 if inlined != (member_inline_size <= 4) {
2153 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2154 }
2155 let inner_offset;
2156 let mut inner_depth = depth.clone();
2157 if inlined {
2158 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2159 inner_offset = next_offset;
2160 } else {
2161 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2162 inner_depth.increment()?;
2163 }
2164 let val_ref = self.button.get_or_insert_with(|| {
2165 fidl::new_empty!(fidl_fuchsia_input_report__common::ConsumerControlButton, D)
2166 });
2167 fidl::decode!(
2168 fidl_fuchsia_input_report__common::ConsumerControlButton,
2169 D,
2170 val_ref,
2171 decoder,
2172 inner_offset,
2173 inner_depth
2174 )?;
2175 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2176 {
2177 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2178 }
2179 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2180 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2181 }
2182 }
2183
2184 next_offset += envelope_size;
2185
2186 while next_offset < end_offset {
2188 _next_ordinal_to_read += 1;
2189 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2190 next_offset += envelope_size;
2191 }
2192
2193 Ok(())
2194 }
2195 }
2196
2197 impl MouseInputListenerReportMouseInputRequest {
2198 #[inline(always)]
2199 fn max_ordinal_present(&self) -> u64 {
2200 if let Some(_) = self.device_id {
2201 return 10;
2202 }
2203 if let Some(_) = self.wheel_y_physical_pixel {
2204 return 9;
2205 }
2206 if let Some(_) = self.wheel_x_physical_pixel {
2207 return 8;
2208 }
2209 if let Some(_) = self.device_pixel_ratio {
2210 return 7;
2211 }
2212 if let Some(_) = self.phase {
2213 return 6;
2214 }
2215 if let Some(_) = self.buttons {
2216 return 5;
2217 }
2218 if let Some(_) = self.component_name {
2219 return 4;
2220 }
2221 if let Some(_) = self.time_received {
2222 return 3;
2223 }
2224 if let Some(_) = self.local_y {
2225 return 2;
2226 }
2227 if let Some(_) = self.local_x {
2228 return 1;
2229 }
2230 0
2231 }
2232 }
2233
2234 impl fidl::encoding::ValueTypeMarker for MouseInputListenerReportMouseInputRequest {
2235 type Borrowed<'a> = &'a Self;
2236 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2237 value
2238 }
2239 }
2240
2241 unsafe impl fidl::encoding::TypeMarker for MouseInputListenerReportMouseInputRequest {
2242 type Owned = Self;
2243
2244 #[inline(always)]
2245 fn inline_align(_context: fidl::encoding::Context) -> usize {
2246 8
2247 }
2248
2249 #[inline(always)]
2250 fn inline_size(_context: fidl::encoding::Context) -> usize {
2251 16
2252 }
2253 }
2254
2255 unsafe impl<D: fidl::encoding::ResourceDialect>
2256 fidl::encoding::Encode<MouseInputListenerReportMouseInputRequest, D>
2257 for &MouseInputListenerReportMouseInputRequest
2258 {
2259 unsafe fn encode(
2260 self,
2261 encoder: &mut fidl::encoding::Encoder<'_, D>,
2262 offset: usize,
2263 mut depth: fidl::encoding::Depth,
2264 ) -> fidl::Result<()> {
2265 encoder.debug_check_bounds::<MouseInputListenerReportMouseInputRequest>(offset);
2266 let max_ordinal: u64 = self.max_ordinal_present();
2268 encoder.write_num(max_ordinal, offset);
2269 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2270 if max_ordinal == 0 {
2272 return Ok(());
2273 }
2274 depth.increment()?;
2275 let envelope_size = 8;
2276 let bytes_len = max_ordinal as usize * envelope_size;
2277 #[allow(unused_variables)]
2278 let offset = encoder.out_of_line_offset(bytes_len);
2279 let mut _prev_end_offset: usize = 0;
2280 if 1 > max_ordinal {
2281 return Ok(());
2282 }
2283
2284 let cur_offset: usize = (1 - 1) * envelope_size;
2287
2288 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2290
2291 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2296 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2297 encoder,
2298 offset + cur_offset,
2299 depth,
2300 )?;
2301
2302 _prev_end_offset = cur_offset + envelope_size;
2303 if 2 > max_ordinal {
2304 return Ok(());
2305 }
2306
2307 let cur_offset: usize = (2 - 1) * envelope_size;
2310
2311 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2313
2314 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2319 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2320 encoder,
2321 offset + cur_offset,
2322 depth,
2323 )?;
2324
2325 _prev_end_offset = cur_offset + envelope_size;
2326 if 3 > max_ordinal {
2327 return Ok(());
2328 }
2329
2330 let cur_offset: usize = (3 - 1) * envelope_size;
2333
2334 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2336
2337 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2342 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2343 encoder,
2344 offset + cur_offset,
2345 depth,
2346 )?;
2347
2348 _prev_end_offset = cur_offset + envelope_size;
2349 if 4 > max_ordinal {
2350 return Ok(());
2351 }
2352
2353 let cur_offset: usize = (4 - 1) * envelope_size;
2356
2357 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2359
2360 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
2365 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
2366 encoder, offset + cur_offset, depth
2367 )?;
2368
2369 _prev_end_offset = cur_offset + envelope_size;
2370 if 5 > max_ordinal {
2371 return Ok(());
2372 }
2373
2374 let cur_offset: usize = (5 - 1) * envelope_size;
2377
2378 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2380
2381 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
2386 self.buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
2387 encoder, offset + cur_offset, depth
2388 )?;
2389
2390 _prev_end_offset = cur_offset + envelope_size;
2391 if 6 > max_ordinal {
2392 return Ok(());
2393 }
2394
2395 let cur_offset: usize = (6 - 1) * envelope_size;
2398
2399 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2401
2402 fidl::encoding::encode_in_envelope_optional::<MouseEventPhase, D>(
2407 self.phase
2408 .as_ref()
2409 .map(<MouseEventPhase as fidl::encoding::ValueTypeMarker>::borrow),
2410 encoder,
2411 offset + cur_offset,
2412 depth,
2413 )?;
2414
2415 _prev_end_offset = cur_offset + envelope_size;
2416 if 7 > max_ordinal {
2417 return Ok(());
2418 }
2419
2420 let cur_offset: usize = (7 - 1) * envelope_size;
2423
2424 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2426
2427 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2432 self.device_pixel_ratio
2433 .as_ref()
2434 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2435 encoder,
2436 offset + cur_offset,
2437 depth,
2438 )?;
2439
2440 _prev_end_offset = cur_offset + envelope_size;
2441 if 8 > max_ordinal {
2442 return Ok(());
2443 }
2444
2445 let cur_offset: usize = (8 - 1) * envelope_size;
2448
2449 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2451
2452 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2457 self.wheel_x_physical_pixel
2458 .as_ref()
2459 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2460 encoder,
2461 offset + cur_offset,
2462 depth,
2463 )?;
2464
2465 _prev_end_offset = cur_offset + envelope_size;
2466 if 9 > max_ordinal {
2467 return Ok(());
2468 }
2469
2470 let cur_offset: usize = (9 - 1) * envelope_size;
2473
2474 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2476
2477 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2482 self.wheel_y_physical_pixel
2483 .as_ref()
2484 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2485 encoder,
2486 offset + cur_offset,
2487 depth,
2488 )?;
2489
2490 _prev_end_offset = cur_offset + envelope_size;
2491 if 10 > max_ordinal {
2492 return Ok(());
2493 }
2494
2495 let cur_offset: usize = (10 - 1) * envelope_size;
2498
2499 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2501
2502 fidl::encoding::encode_in_envelope_optional::<u32, D>(
2507 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2508 encoder,
2509 offset + cur_offset,
2510 depth,
2511 )?;
2512
2513 _prev_end_offset = cur_offset + envelope_size;
2514
2515 Ok(())
2516 }
2517 }
2518
2519 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2520 for MouseInputListenerReportMouseInputRequest
2521 {
2522 #[inline(always)]
2523 fn new_empty() -> Self {
2524 Self::default()
2525 }
2526
2527 unsafe fn decode(
2528 &mut self,
2529 decoder: &mut fidl::encoding::Decoder<'_, D>,
2530 offset: usize,
2531 mut depth: fidl::encoding::Depth,
2532 ) -> fidl::Result<()> {
2533 decoder.debug_check_bounds::<Self>(offset);
2534 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2535 None => return Err(fidl::Error::NotNullable),
2536 Some(len) => len,
2537 };
2538 if len == 0 {
2540 return Ok(());
2541 };
2542 depth.increment()?;
2543 let envelope_size = 8;
2544 let bytes_len = len * envelope_size;
2545 let offset = decoder.out_of_line_offset(bytes_len)?;
2546 let mut _next_ordinal_to_read = 0;
2548 let mut next_offset = offset;
2549 let end_offset = offset + bytes_len;
2550 _next_ordinal_to_read += 1;
2551 if next_offset >= end_offset {
2552 return Ok(());
2553 }
2554
2555 while _next_ordinal_to_read < 1 {
2557 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2558 _next_ordinal_to_read += 1;
2559 next_offset += envelope_size;
2560 }
2561
2562 let next_out_of_line = decoder.next_out_of_line();
2563 let handles_before = decoder.remaining_handles();
2564 if let Some((inlined, num_bytes, num_handles)) =
2565 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2566 {
2567 let member_inline_size =
2568 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2569 if inlined != (member_inline_size <= 4) {
2570 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2571 }
2572 let inner_offset;
2573 let mut inner_depth = depth.clone();
2574 if inlined {
2575 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2576 inner_offset = next_offset;
2577 } else {
2578 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2579 inner_depth.increment()?;
2580 }
2581 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
2582 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2583 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2584 {
2585 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2586 }
2587 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2588 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2589 }
2590 }
2591
2592 next_offset += envelope_size;
2593 _next_ordinal_to_read += 1;
2594 if next_offset >= end_offset {
2595 return Ok(());
2596 }
2597
2598 while _next_ordinal_to_read < 2 {
2600 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2601 _next_ordinal_to_read += 1;
2602 next_offset += envelope_size;
2603 }
2604
2605 let next_out_of_line = decoder.next_out_of_line();
2606 let handles_before = decoder.remaining_handles();
2607 if let Some((inlined, num_bytes, num_handles)) =
2608 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2609 {
2610 let member_inline_size =
2611 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2612 if inlined != (member_inline_size <= 4) {
2613 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2614 }
2615 let inner_offset;
2616 let mut inner_depth = depth.clone();
2617 if inlined {
2618 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2619 inner_offset = next_offset;
2620 } else {
2621 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2622 inner_depth.increment()?;
2623 }
2624 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
2625 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2626 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2627 {
2628 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2629 }
2630 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2631 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2632 }
2633 }
2634
2635 next_offset += envelope_size;
2636 _next_ordinal_to_read += 1;
2637 if next_offset >= end_offset {
2638 return Ok(());
2639 }
2640
2641 while _next_ordinal_to_read < 3 {
2643 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2644 _next_ordinal_to_read += 1;
2645 next_offset += envelope_size;
2646 }
2647
2648 let next_out_of_line = decoder.next_out_of_line();
2649 let handles_before = decoder.remaining_handles();
2650 if let Some((inlined, num_bytes, num_handles)) =
2651 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2652 {
2653 let member_inline_size =
2654 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2655 if inlined != (member_inline_size <= 4) {
2656 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2657 }
2658 let inner_offset;
2659 let mut inner_depth = depth.clone();
2660 if inlined {
2661 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2662 inner_offset = next_offset;
2663 } else {
2664 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2665 inner_depth.increment()?;
2666 }
2667 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
2668 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2669 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2670 {
2671 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2672 }
2673 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2674 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2675 }
2676 }
2677
2678 next_offset += envelope_size;
2679 _next_ordinal_to_read += 1;
2680 if next_offset >= end_offset {
2681 return Ok(());
2682 }
2683
2684 while _next_ordinal_to_read < 4 {
2686 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2687 _next_ordinal_to_read += 1;
2688 next_offset += envelope_size;
2689 }
2690
2691 let next_out_of_line = decoder.next_out_of_line();
2692 let handles_before = decoder.remaining_handles();
2693 if let Some((inlined, num_bytes, num_handles)) =
2694 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2695 {
2696 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2697 if inlined != (member_inline_size <= 4) {
2698 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2699 }
2700 let inner_offset;
2701 let mut inner_depth = depth.clone();
2702 if inlined {
2703 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2704 inner_offset = next_offset;
2705 } else {
2706 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2707 inner_depth.increment()?;
2708 }
2709 let val_ref = self.component_name.get_or_insert_with(|| {
2710 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
2711 });
2712 fidl::decode!(
2713 fidl::encoding::BoundedString<1024>,
2714 D,
2715 val_ref,
2716 decoder,
2717 inner_offset,
2718 inner_depth
2719 )?;
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 < 5 {
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::Vector<MouseButton, 32> 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.buttons.get_or_insert_with(
2761 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
2762 );
2763 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2764 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2765 {
2766 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2767 }
2768 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2769 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2770 }
2771 }
2772
2773 next_offset += envelope_size;
2774 _next_ordinal_to_read += 1;
2775 if next_offset >= end_offset {
2776 return Ok(());
2777 }
2778
2779 while _next_ordinal_to_read < 6 {
2781 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2782 _next_ordinal_to_read += 1;
2783 next_offset += envelope_size;
2784 }
2785
2786 let next_out_of_line = decoder.next_out_of_line();
2787 let handles_before = decoder.remaining_handles();
2788 if let Some((inlined, num_bytes, num_handles)) =
2789 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2790 {
2791 let member_inline_size =
2792 <MouseEventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2793 if inlined != (member_inline_size <= 4) {
2794 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2795 }
2796 let inner_offset;
2797 let mut inner_depth = depth.clone();
2798 if inlined {
2799 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2800 inner_offset = next_offset;
2801 } else {
2802 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2803 inner_depth.increment()?;
2804 }
2805 let val_ref =
2806 self.phase.get_or_insert_with(|| fidl::new_empty!(MouseEventPhase, D));
2807 fidl::decode!(MouseEventPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
2808 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2809 {
2810 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2811 }
2812 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2813 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2814 }
2815 }
2816
2817 next_offset += envelope_size;
2818 _next_ordinal_to_read += 1;
2819 if next_offset >= end_offset {
2820 return Ok(());
2821 }
2822
2823 while _next_ordinal_to_read < 7 {
2825 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2826 _next_ordinal_to_read += 1;
2827 next_offset += envelope_size;
2828 }
2829
2830 let next_out_of_line = decoder.next_out_of_line();
2831 let handles_before = decoder.remaining_handles();
2832 if let Some((inlined, num_bytes, num_handles)) =
2833 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2834 {
2835 let member_inline_size =
2836 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2837 if inlined != (member_inline_size <= 4) {
2838 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2839 }
2840 let inner_offset;
2841 let mut inner_depth = depth.clone();
2842 if inlined {
2843 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2844 inner_offset = next_offset;
2845 } else {
2846 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2847 inner_depth.increment()?;
2848 }
2849 let val_ref =
2850 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
2851 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2852 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2853 {
2854 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2855 }
2856 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2857 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2858 }
2859 }
2860
2861 next_offset += envelope_size;
2862 _next_ordinal_to_read += 1;
2863 if next_offset >= end_offset {
2864 return Ok(());
2865 }
2866
2867 while _next_ordinal_to_read < 8 {
2869 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2870 _next_ordinal_to_read += 1;
2871 next_offset += envelope_size;
2872 }
2873
2874 let next_out_of_line = decoder.next_out_of_line();
2875 let handles_before = decoder.remaining_handles();
2876 if let Some((inlined, num_bytes, num_handles)) =
2877 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2878 {
2879 let member_inline_size =
2880 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2881 if inlined != (member_inline_size <= 4) {
2882 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2883 }
2884 let inner_offset;
2885 let mut inner_depth = depth.clone();
2886 if inlined {
2887 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2888 inner_offset = next_offset;
2889 } else {
2890 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2891 inner_depth.increment()?;
2892 }
2893 let val_ref =
2894 self.wheel_x_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
2895 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2896 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2897 {
2898 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2899 }
2900 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2901 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2902 }
2903 }
2904
2905 next_offset += envelope_size;
2906 _next_ordinal_to_read += 1;
2907 if next_offset >= end_offset {
2908 return Ok(());
2909 }
2910
2911 while _next_ordinal_to_read < 9 {
2913 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2914 _next_ordinal_to_read += 1;
2915 next_offset += envelope_size;
2916 }
2917
2918 let next_out_of_line = decoder.next_out_of_line();
2919 let handles_before = decoder.remaining_handles();
2920 if let Some((inlined, num_bytes, num_handles)) =
2921 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2922 {
2923 let member_inline_size =
2924 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2925 if inlined != (member_inline_size <= 4) {
2926 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2927 }
2928 let inner_offset;
2929 let mut inner_depth = depth.clone();
2930 if inlined {
2931 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2932 inner_offset = next_offset;
2933 } else {
2934 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2935 inner_depth.increment()?;
2936 }
2937 let val_ref =
2938 self.wheel_y_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
2939 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
2940 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2941 {
2942 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2943 }
2944 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2945 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2946 }
2947 }
2948
2949 next_offset += envelope_size;
2950 _next_ordinal_to_read += 1;
2951 if next_offset >= end_offset {
2952 return Ok(());
2953 }
2954
2955 while _next_ordinal_to_read < 10 {
2957 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2958 _next_ordinal_to_read += 1;
2959 next_offset += envelope_size;
2960 }
2961
2962 let next_out_of_line = decoder.next_out_of_line();
2963 let handles_before = decoder.remaining_handles();
2964 if let Some((inlined, num_bytes, num_handles)) =
2965 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2966 {
2967 let member_inline_size =
2968 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2969 if inlined != (member_inline_size <= 4) {
2970 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2971 }
2972 let inner_offset;
2973 let mut inner_depth = depth.clone();
2974 if inlined {
2975 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2976 inner_offset = next_offset;
2977 } else {
2978 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2979 inner_depth.increment()?;
2980 }
2981 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
2982 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2983 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2984 {
2985 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2986 }
2987 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2988 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2989 }
2990 }
2991
2992 next_offset += envelope_size;
2993
2994 while next_offset < end_offset {
2996 _next_ordinal_to_read += 1;
2997 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2998 next_offset += envelope_size;
2999 }
3000
3001 Ok(())
3002 }
3003 }
3004
3005 impl MouseSimulateMouseEventRequest {
3006 #[inline(always)]
3007 fn max_ordinal_present(&self) -> u64 {
3008 if let Some(_) = self.scroll_h_physical_pixel {
3009 return 7;
3010 }
3011 if let Some(_) = self.scroll_v_physical_pixel {
3012 return 6;
3013 }
3014 if let Some(_) = self.scroll_h_detent {
3015 return 5;
3016 }
3017 if let Some(_) = self.scroll_v_detent {
3018 return 4;
3019 }
3020 if let Some(_) = self.movement_y {
3021 return 3;
3022 }
3023 if let Some(_) = self.movement_x {
3024 return 2;
3025 }
3026 if let Some(_) = self.pressed_buttons {
3027 return 1;
3028 }
3029 0
3030 }
3031 }
3032
3033 impl fidl::encoding::ValueTypeMarker for MouseSimulateMouseEventRequest {
3034 type Borrowed<'a> = &'a Self;
3035 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3036 value
3037 }
3038 }
3039
3040 unsafe impl fidl::encoding::TypeMarker for MouseSimulateMouseEventRequest {
3041 type Owned = Self;
3042
3043 #[inline(always)]
3044 fn inline_align(_context: fidl::encoding::Context) -> usize {
3045 8
3046 }
3047
3048 #[inline(always)]
3049 fn inline_size(_context: fidl::encoding::Context) -> usize {
3050 16
3051 }
3052 }
3053
3054 unsafe impl<D: fidl::encoding::ResourceDialect>
3055 fidl::encoding::Encode<MouseSimulateMouseEventRequest, D>
3056 for &MouseSimulateMouseEventRequest
3057 {
3058 unsafe fn encode(
3059 self,
3060 encoder: &mut fidl::encoding::Encoder<'_, D>,
3061 offset: usize,
3062 mut depth: fidl::encoding::Depth,
3063 ) -> fidl::Result<()> {
3064 encoder.debug_check_bounds::<MouseSimulateMouseEventRequest>(offset);
3065 let max_ordinal: u64 = self.max_ordinal_present();
3067 encoder.write_num(max_ordinal, offset);
3068 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3069 if max_ordinal == 0 {
3071 return Ok(());
3072 }
3073 depth.increment()?;
3074 let envelope_size = 8;
3075 let bytes_len = max_ordinal as usize * envelope_size;
3076 #[allow(unused_variables)]
3077 let offset = encoder.out_of_line_offset(bytes_len);
3078 let mut _prev_end_offset: usize = 0;
3079 if 1 > max_ordinal {
3080 return Ok(());
3081 }
3082
3083 let cur_offset: usize = (1 - 1) * envelope_size;
3086
3087 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3089
3090 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
3095 self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
3096 encoder, offset + cur_offset, depth
3097 )?;
3098
3099 _prev_end_offset = cur_offset + envelope_size;
3100 if 2 > max_ordinal {
3101 return Ok(());
3102 }
3103
3104 let cur_offset: usize = (2 - 1) * envelope_size;
3107
3108 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3110
3111 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3116 self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3117 encoder,
3118 offset + cur_offset,
3119 depth,
3120 )?;
3121
3122 _prev_end_offset = cur_offset + envelope_size;
3123 if 3 > max_ordinal {
3124 return Ok(());
3125 }
3126
3127 let cur_offset: usize = (3 - 1) * envelope_size;
3130
3131 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3133
3134 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3139 self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3140 encoder,
3141 offset + cur_offset,
3142 depth,
3143 )?;
3144
3145 _prev_end_offset = cur_offset + envelope_size;
3146 if 4 > max_ordinal {
3147 return Ok(());
3148 }
3149
3150 let cur_offset: usize = (4 - 1) * envelope_size;
3153
3154 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3156
3157 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3162 self.scroll_v_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3163 encoder,
3164 offset + cur_offset,
3165 depth,
3166 )?;
3167
3168 _prev_end_offset = cur_offset + envelope_size;
3169 if 5 > max_ordinal {
3170 return Ok(());
3171 }
3172
3173 let cur_offset: usize = (5 - 1) * envelope_size;
3176
3177 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3179
3180 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3185 self.scroll_h_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3186 encoder,
3187 offset + cur_offset,
3188 depth,
3189 )?;
3190
3191 _prev_end_offset = cur_offset + envelope_size;
3192 if 6 > max_ordinal {
3193 return Ok(());
3194 }
3195
3196 let cur_offset: usize = (6 - 1) * envelope_size;
3199
3200 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3202
3203 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3208 self.scroll_v_physical_pixel
3209 .as_ref()
3210 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3211 encoder,
3212 offset + cur_offset,
3213 depth,
3214 )?;
3215
3216 _prev_end_offset = cur_offset + envelope_size;
3217 if 7 > max_ordinal {
3218 return Ok(());
3219 }
3220
3221 let cur_offset: usize = (7 - 1) * envelope_size;
3224
3225 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3227
3228 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3233 self.scroll_h_physical_pixel
3234 .as_ref()
3235 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3236 encoder,
3237 offset + cur_offset,
3238 depth,
3239 )?;
3240
3241 _prev_end_offset = cur_offset + envelope_size;
3242
3243 Ok(())
3244 }
3245 }
3246
3247 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3248 for MouseSimulateMouseEventRequest
3249 {
3250 #[inline(always)]
3251 fn new_empty() -> Self {
3252 Self::default()
3253 }
3254
3255 unsafe fn decode(
3256 &mut self,
3257 decoder: &mut fidl::encoding::Decoder<'_, D>,
3258 offset: usize,
3259 mut depth: fidl::encoding::Depth,
3260 ) -> fidl::Result<()> {
3261 decoder.debug_check_bounds::<Self>(offset);
3262 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3263 None => return Err(fidl::Error::NotNullable),
3264 Some(len) => len,
3265 };
3266 if len == 0 {
3268 return Ok(());
3269 };
3270 depth.increment()?;
3271 let envelope_size = 8;
3272 let bytes_len = len * envelope_size;
3273 let offset = decoder.out_of_line_offset(bytes_len)?;
3274 let mut _next_ordinal_to_read = 0;
3276 let mut next_offset = offset;
3277 let end_offset = offset + bytes_len;
3278 _next_ordinal_to_read += 1;
3279 if next_offset >= end_offset {
3280 return Ok(());
3281 }
3282
3283 while _next_ordinal_to_read < 1 {
3285 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3286 _next_ordinal_to_read += 1;
3287 next_offset += envelope_size;
3288 }
3289
3290 let next_out_of_line = decoder.next_out_of_line();
3291 let handles_before = decoder.remaining_handles();
3292 if let Some((inlined, num_bytes, num_handles)) =
3293 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3294 {
3295 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3296 if inlined != (member_inline_size <= 4) {
3297 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3298 }
3299 let inner_offset;
3300 let mut inner_depth = depth.clone();
3301 if inlined {
3302 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3303 inner_offset = next_offset;
3304 } else {
3305 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3306 inner_depth.increment()?;
3307 }
3308 let val_ref = self.pressed_buttons.get_or_insert_with(
3309 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3310 );
3311 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3312 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3313 {
3314 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3315 }
3316 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3317 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3318 }
3319 }
3320
3321 next_offset += envelope_size;
3322 _next_ordinal_to_read += 1;
3323 if next_offset >= end_offset {
3324 return Ok(());
3325 }
3326
3327 while _next_ordinal_to_read < 2 {
3329 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3330 _next_ordinal_to_read += 1;
3331 next_offset += envelope_size;
3332 }
3333
3334 let next_out_of_line = decoder.next_out_of_line();
3335 let handles_before = decoder.remaining_handles();
3336 if let Some((inlined, num_bytes, num_handles)) =
3337 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3338 {
3339 let member_inline_size =
3340 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3341 if inlined != (member_inline_size <= 4) {
3342 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3343 }
3344 let inner_offset;
3345 let mut inner_depth = depth.clone();
3346 if inlined {
3347 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3348 inner_offset = next_offset;
3349 } else {
3350 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3351 inner_depth.increment()?;
3352 }
3353 let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
3354 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3355 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3356 {
3357 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3358 }
3359 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3360 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3361 }
3362 }
3363
3364 next_offset += envelope_size;
3365 _next_ordinal_to_read += 1;
3366 if next_offset >= end_offset {
3367 return Ok(());
3368 }
3369
3370 while _next_ordinal_to_read < 3 {
3372 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3373 _next_ordinal_to_read += 1;
3374 next_offset += envelope_size;
3375 }
3376
3377 let next_out_of_line = decoder.next_out_of_line();
3378 let handles_before = decoder.remaining_handles();
3379 if let Some((inlined, num_bytes, num_handles)) =
3380 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3381 {
3382 let member_inline_size =
3383 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3384 if inlined != (member_inline_size <= 4) {
3385 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3386 }
3387 let inner_offset;
3388 let mut inner_depth = depth.clone();
3389 if inlined {
3390 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3391 inner_offset = next_offset;
3392 } else {
3393 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3394 inner_depth.increment()?;
3395 }
3396 let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
3397 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3398 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3399 {
3400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3401 }
3402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3404 }
3405 }
3406
3407 next_offset += envelope_size;
3408 _next_ordinal_to_read += 1;
3409 if next_offset >= end_offset {
3410 return Ok(());
3411 }
3412
3413 while _next_ordinal_to_read < 4 {
3415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3416 _next_ordinal_to_read += 1;
3417 next_offset += envelope_size;
3418 }
3419
3420 let next_out_of_line = decoder.next_out_of_line();
3421 let handles_before = decoder.remaining_handles();
3422 if let Some((inlined, num_bytes, num_handles)) =
3423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3424 {
3425 let member_inline_size =
3426 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3427 if inlined != (member_inline_size <= 4) {
3428 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3429 }
3430 let inner_offset;
3431 let mut inner_depth = depth.clone();
3432 if inlined {
3433 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3434 inner_offset = next_offset;
3435 } else {
3436 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3437 inner_depth.increment()?;
3438 }
3439 let val_ref = self.scroll_v_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3440 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3441 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3442 {
3443 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3444 }
3445 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3446 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3447 }
3448 }
3449
3450 next_offset += envelope_size;
3451 _next_ordinal_to_read += 1;
3452 if next_offset >= end_offset {
3453 return Ok(());
3454 }
3455
3456 while _next_ordinal_to_read < 5 {
3458 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3459 _next_ordinal_to_read += 1;
3460 next_offset += envelope_size;
3461 }
3462
3463 let next_out_of_line = decoder.next_out_of_line();
3464 let handles_before = decoder.remaining_handles();
3465 if let Some((inlined, num_bytes, num_handles)) =
3466 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3467 {
3468 let member_inline_size =
3469 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3470 if inlined != (member_inline_size <= 4) {
3471 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3472 }
3473 let inner_offset;
3474 let mut inner_depth = depth.clone();
3475 if inlined {
3476 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3477 inner_offset = next_offset;
3478 } else {
3479 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3480 inner_depth.increment()?;
3481 }
3482 let val_ref = self.scroll_h_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
3483 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3484 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3485 {
3486 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3487 }
3488 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3489 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3490 }
3491 }
3492
3493 next_offset += envelope_size;
3494 _next_ordinal_to_read += 1;
3495 if next_offset >= end_offset {
3496 return Ok(());
3497 }
3498
3499 while _next_ordinal_to_read < 6 {
3501 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3502 _next_ordinal_to_read += 1;
3503 next_offset += envelope_size;
3504 }
3505
3506 let next_out_of_line = decoder.next_out_of_line();
3507 let handles_before = decoder.remaining_handles();
3508 if let Some((inlined, num_bytes, num_handles)) =
3509 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3510 {
3511 let member_inline_size =
3512 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3513 if inlined != (member_inline_size <= 4) {
3514 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3515 }
3516 let inner_offset;
3517 let mut inner_depth = depth.clone();
3518 if inlined {
3519 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3520 inner_offset = next_offset;
3521 } else {
3522 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3523 inner_depth.increment()?;
3524 }
3525 let val_ref =
3526 self.scroll_v_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3527 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3528 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3529 {
3530 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3531 }
3532 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3533 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3534 }
3535 }
3536
3537 next_offset += envelope_size;
3538 _next_ordinal_to_read += 1;
3539 if next_offset >= end_offset {
3540 return Ok(());
3541 }
3542
3543 while _next_ordinal_to_read < 7 {
3545 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3546 _next_ordinal_to_read += 1;
3547 next_offset += envelope_size;
3548 }
3549
3550 let next_out_of_line = decoder.next_out_of_line();
3551 let handles_before = decoder.remaining_handles();
3552 if let Some((inlined, num_bytes, num_handles)) =
3553 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3554 {
3555 let member_inline_size =
3556 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3557 if inlined != (member_inline_size <= 4) {
3558 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3559 }
3560 let inner_offset;
3561 let mut inner_depth = depth.clone();
3562 if inlined {
3563 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3564 inner_offset = next_offset;
3565 } else {
3566 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3567 inner_depth.increment()?;
3568 }
3569 let val_ref =
3570 self.scroll_h_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3571 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3572 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3573 {
3574 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3575 }
3576 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3577 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3578 }
3579 }
3580
3581 next_offset += envelope_size;
3582
3583 while next_offset < end_offset {
3585 _next_ordinal_to_read += 1;
3586 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3587 next_offset += envelope_size;
3588 }
3589
3590 Ok(())
3591 }
3592 }
3593
3594 impl TouchInputListenerReportTouchInputRequest {
3595 #[inline(always)]
3596 fn max_ordinal_present(&self) -> u64 {
3597 if let Some(_) = self.device_id {
3598 return 8;
3599 }
3600 if let Some(_) = self.pointer_id {
3601 return 7;
3602 }
3603 if let Some(_) = self.phase {
3604 return 6;
3605 }
3606 if let Some(_) = self.component_name {
3607 return 5;
3608 }
3609 if let Some(_) = self.device_pixel_ratio {
3610 return 4;
3611 }
3612 if let Some(_) = self.time_received {
3613 return 3;
3614 }
3615 if let Some(_) = self.local_y {
3616 return 2;
3617 }
3618 if let Some(_) = self.local_x {
3619 return 1;
3620 }
3621 0
3622 }
3623 }
3624
3625 impl fidl::encoding::ValueTypeMarker for TouchInputListenerReportTouchInputRequest {
3626 type Borrowed<'a> = &'a Self;
3627 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3628 value
3629 }
3630 }
3631
3632 unsafe impl fidl::encoding::TypeMarker for TouchInputListenerReportTouchInputRequest {
3633 type Owned = Self;
3634
3635 #[inline(always)]
3636 fn inline_align(_context: fidl::encoding::Context) -> usize {
3637 8
3638 }
3639
3640 #[inline(always)]
3641 fn inline_size(_context: fidl::encoding::Context) -> usize {
3642 16
3643 }
3644 }
3645
3646 unsafe impl<D: fidl::encoding::ResourceDialect>
3647 fidl::encoding::Encode<TouchInputListenerReportTouchInputRequest, D>
3648 for &TouchInputListenerReportTouchInputRequest
3649 {
3650 unsafe fn encode(
3651 self,
3652 encoder: &mut fidl::encoding::Encoder<'_, D>,
3653 offset: usize,
3654 mut depth: fidl::encoding::Depth,
3655 ) -> fidl::Result<()> {
3656 encoder.debug_check_bounds::<TouchInputListenerReportTouchInputRequest>(offset);
3657 let max_ordinal: u64 = self.max_ordinal_present();
3659 encoder.write_num(max_ordinal, offset);
3660 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3661 if max_ordinal == 0 {
3663 return Ok(());
3664 }
3665 depth.increment()?;
3666 let envelope_size = 8;
3667 let bytes_len = max_ordinal as usize * envelope_size;
3668 #[allow(unused_variables)]
3669 let offset = encoder.out_of_line_offset(bytes_len);
3670 let mut _prev_end_offset: usize = 0;
3671 if 1 > max_ordinal {
3672 return Ok(());
3673 }
3674
3675 let cur_offset: usize = (1 - 1) * envelope_size;
3678
3679 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3681
3682 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3687 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3688 encoder,
3689 offset + cur_offset,
3690 depth,
3691 )?;
3692
3693 _prev_end_offset = cur_offset + envelope_size;
3694 if 2 > max_ordinal {
3695 return Ok(());
3696 }
3697
3698 let cur_offset: usize = (2 - 1) * envelope_size;
3701
3702 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3704
3705 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3710 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3711 encoder,
3712 offset + cur_offset,
3713 depth,
3714 )?;
3715
3716 _prev_end_offset = cur_offset + envelope_size;
3717 if 3 > max_ordinal {
3718 return Ok(());
3719 }
3720
3721 let cur_offset: usize = (3 - 1) * envelope_size;
3724
3725 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3727
3728 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3733 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3734 encoder,
3735 offset + cur_offset,
3736 depth,
3737 )?;
3738
3739 _prev_end_offset = cur_offset + envelope_size;
3740 if 4 > max_ordinal {
3741 return Ok(());
3742 }
3743
3744 let cur_offset: usize = (4 - 1) * envelope_size;
3747
3748 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3750
3751 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3756 self.device_pixel_ratio
3757 .as_ref()
3758 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3759 encoder,
3760 offset + cur_offset,
3761 depth,
3762 )?;
3763
3764 _prev_end_offset = cur_offset + envelope_size;
3765 if 5 > max_ordinal {
3766 return Ok(());
3767 }
3768
3769 let cur_offset: usize = (5 - 1) * envelope_size;
3772
3773 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3775
3776 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
3781 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
3782 encoder, offset + cur_offset, depth
3783 )?;
3784
3785 _prev_end_offset = cur_offset + envelope_size;
3786 if 6 > max_ordinal {
3787 return Ok(());
3788 }
3789
3790 let cur_offset: usize = (6 - 1) * envelope_size;
3793
3794 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3796
3797 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_pointer__common::EventPhase, D>(
3802 self.phase.as_ref().map(<fidl_fuchsia_ui_pointer__common::EventPhase as fidl::encoding::ValueTypeMarker>::borrow),
3803 encoder, offset + cur_offset, depth
3804 )?;
3805
3806 _prev_end_offset = cur_offset + envelope_size;
3807 if 7 > max_ordinal {
3808 return Ok(());
3809 }
3810
3811 let cur_offset: usize = (7 - 1) * envelope_size;
3814
3815 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3817
3818 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3823 self.pointer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3824 encoder,
3825 offset + cur_offset,
3826 depth,
3827 )?;
3828
3829 _prev_end_offset = cur_offset + envelope_size;
3830 if 8 > max_ordinal {
3831 return Ok(());
3832 }
3833
3834 let cur_offset: usize = (8 - 1) * envelope_size;
3837
3838 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3840
3841 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3846 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3847 encoder,
3848 offset + cur_offset,
3849 depth,
3850 )?;
3851
3852 _prev_end_offset = cur_offset + envelope_size;
3853
3854 Ok(())
3855 }
3856 }
3857
3858 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3859 for TouchInputListenerReportTouchInputRequest
3860 {
3861 #[inline(always)]
3862 fn new_empty() -> Self {
3863 Self::default()
3864 }
3865
3866 unsafe fn decode(
3867 &mut self,
3868 decoder: &mut fidl::encoding::Decoder<'_, D>,
3869 offset: usize,
3870 mut depth: fidl::encoding::Depth,
3871 ) -> fidl::Result<()> {
3872 decoder.debug_check_bounds::<Self>(offset);
3873 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3874 None => return Err(fidl::Error::NotNullable),
3875 Some(len) => len,
3876 };
3877 if len == 0 {
3879 return Ok(());
3880 };
3881 depth.increment()?;
3882 let envelope_size = 8;
3883 let bytes_len = len * envelope_size;
3884 let offset = decoder.out_of_line_offset(bytes_len)?;
3885 let mut _next_ordinal_to_read = 0;
3887 let mut next_offset = offset;
3888 let end_offset = offset + bytes_len;
3889 _next_ordinal_to_read += 1;
3890 if next_offset >= end_offset {
3891 return Ok(());
3892 }
3893
3894 while _next_ordinal_to_read < 1 {
3896 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3897 _next_ordinal_to_read += 1;
3898 next_offset += envelope_size;
3899 }
3900
3901 let next_out_of_line = decoder.next_out_of_line();
3902 let handles_before = decoder.remaining_handles();
3903 if let Some((inlined, num_bytes, num_handles)) =
3904 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3905 {
3906 let member_inline_size =
3907 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3908 if inlined != (member_inline_size <= 4) {
3909 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3910 }
3911 let inner_offset;
3912 let mut inner_depth = depth.clone();
3913 if inlined {
3914 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3915 inner_offset = next_offset;
3916 } else {
3917 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3918 inner_depth.increment()?;
3919 }
3920 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
3921 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3922 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3923 {
3924 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3925 }
3926 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3927 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3928 }
3929 }
3930
3931 next_offset += envelope_size;
3932 _next_ordinal_to_read += 1;
3933 if next_offset >= end_offset {
3934 return Ok(());
3935 }
3936
3937 while _next_ordinal_to_read < 2 {
3939 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3940 _next_ordinal_to_read += 1;
3941 next_offset += envelope_size;
3942 }
3943
3944 let next_out_of_line = decoder.next_out_of_line();
3945 let handles_before = decoder.remaining_handles();
3946 if let Some((inlined, num_bytes, num_handles)) =
3947 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3948 {
3949 let member_inline_size =
3950 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3951 if inlined != (member_inline_size <= 4) {
3952 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3953 }
3954 let inner_offset;
3955 let mut inner_depth = depth.clone();
3956 if inlined {
3957 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3958 inner_offset = next_offset;
3959 } else {
3960 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3961 inner_depth.increment()?;
3962 }
3963 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
3964 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3965 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3966 {
3967 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3968 }
3969 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3970 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3971 }
3972 }
3973
3974 next_offset += envelope_size;
3975 _next_ordinal_to_read += 1;
3976 if next_offset >= end_offset {
3977 return Ok(());
3978 }
3979
3980 while _next_ordinal_to_read < 3 {
3982 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3983 _next_ordinal_to_read += 1;
3984 next_offset += envelope_size;
3985 }
3986
3987 let next_out_of_line = decoder.next_out_of_line();
3988 let handles_before = decoder.remaining_handles();
3989 if let Some((inlined, num_bytes, num_handles)) =
3990 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3991 {
3992 let member_inline_size =
3993 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3994 if inlined != (member_inline_size <= 4) {
3995 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3996 }
3997 let inner_offset;
3998 let mut inner_depth = depth.clone();
3999 if inlined {
4000 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4001 inner_offset = next_offset;
4002 } else {
4003 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4004 inner_depth.increment()?;
4005 }
4006 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
4007 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4008 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4009 {
4010 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4011 }
4012 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4013 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4014 }
4015 }
4016
4017 next_offset += envelope_size;
4018 _next_ordinal_to_read += 1;
4019 if next_offset >= end_offset {
4020 return Ok(());
4021 }
4022
4023 while _next_ordinal_to_read < 4 {
4025 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4026 _next_ordinal_to_read += 1;
4027 next_offset += envelope_size;
4028 }
4029
4030 let next_out_of_line = decoder.next_out_of_line();
4031 let handles_before = decoder.remaining_handles();
4032 if let Some((inlined, num_bytes, num_handles)) =
4033 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4034 {
4035 let member_inline_size =
4036 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4037 if inlined != (member_inline_size <= 4) {
4038 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4039 }
4040 let inner_offset;
4041 let mut inner_depth = depth.clone();
4042 if inlined {
4043 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4044 inner_offset = next_offset;
4045 } else {
4046 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4047 inner_depth.increment()?;
4048 }
4049 let val_ref =
4050 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
4051 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4052 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4053 {
4054 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4055 }
4056 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4057 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4058 }
4059 }
4060
4061 next_offset += envelope_size;
4062 _next_ordinal_to_read += 1;
4063 if next_offset >= end_offset {
4064 return Ok(());
4065 }
4066
4067 while _next_ordinal_to_read < 5 {
4069 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4070 _next_ordinal_to_read += 1;
4071 next_offset += envelope_size;
4072 }
4073
4074 let next_out_of_line = decoder.next_out_of_line();
4075 let handles_before = decoder.remaining_handles();
4076 if let Some((inlined, num_bytes, num_handles)) =
4077 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4078 {
4079 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4080 if inlined != (member_inline_size <= 4) {
4081 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4082 }
4083 let inner_offset;
4084 let mut inner_depth = depth.clone();
4085 if inlined {
4086 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4087 inner_offset = next_offset;
4088 } else {
4089 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4090 inner_depth.increment()?;
4091 }
4092 let val_ref = self.component_name.get_or_insert_with(|| {
4093 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
4094 });
4095 fidl::decode!(
4096 fidl::encoding::BoundedString<1024>,
4097 D,
4098 val_ref,
4099 decoder,
4100 inner_offset,
4101 inner_depth
4102 )?;
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 < 6 {
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_fuchsia_ui_pointer__common::EventPhase 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.phase.get_or_insert_with(|| {
4144 fidl::new_empty!(fidl_fuchsia_ui_pointer__common::EventPhase, D)
4145 });
4146 fidl::decode!(
4147 fidl_fuchsia_ui_pointer__common::EventPhase,
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 < 7 {
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 =
4182 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4183 if inlined != (member_inline_size <= 4) {
4184 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4185 }
4186 let inner_offset;
4187 let mut inner_depth = depth.clone();
4188 if inlined {
4189 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4190 inner_offset = next_offset;
4191 } else {
4192 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4193 inner_depth.increment()?;
4194 }
4195 let val_ref = self.pointer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4196 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4197 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4198 {
4199 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4200 }
4201 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4202 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4203 }
4204 }
4205
4206 next_offset += envelope_size;
4207 _next_ordinal_to_read += 1;
4208 if next_offset >= end_offset {
4209 return Ok(());
4210 }
4211
4212 while _next_ordinal_to_read < 8 {
4214 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4215 _next_ordinal_to_read += 1;
4216 next_offset += envelope_size;
4217 }
4218
4219 let next_out_of_line = decoder.next_out_of_line();
4220 let handles_before = decoder.remaining_handles();
4221 if let Some((inlined, num_bytes, num_handles)) =
4222 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4223 {
4224 let member_inline_size =
4225 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4226 if inlined != (member_inline_size <= 4) {
4227 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4228 }
4229 let inner_offset;
4230 let mut inner_depth = depth.clone();
4231 if inlined {
4232 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4233 inner_offset = next_offset;
4234 } else {
4235 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4236 inner_depth.increment()?;
4237 }
4238 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4239 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4240 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4241 {
4242 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4243 }
4244 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4245 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4246 }
4247 }
4248
4249 next_offset += envelope_size;
4250
4251 while next_offset < end_offset {
4253 _next_ordinal_to_read += 1;
4254 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4255 next_offset += envelope_size;
4256 }
4257
4258 Ok(())
4259 }
4260 }
4261
4262 impl TouchScreenSimulateMultiFingerGestureRequest {
4263 #[inline(always)]
4264 fn max_ordinal_present(&self) -> u64 {
4265 if let Some(_) = self.finger_count {
4266 return 4;
4267 }
4268 if let Some(_) = self.move_event_count {
4269 return 3;
4270 }
4271 if let Some(_) = self.end_locations {
4272 return 2;
4273 }
4274 if let Some(_) = self.start_locations {
4275 return 1;
4276 }
4277 0
4278 }
4279 }
4280
4281 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4282 type Borrowed<'a> = &'a Self;
4283 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4284 value
4285 }
4286 }
4287
4288 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
4289 type Owned = Self;
4290
4291 #[inline(always)]
4292 fn inline_align(_context: fidl::encoding::Context) -> usize {
4293 8
4294 }
4295
4296 #[inline(always)]
4297 fn inline_size(_context: fidl::encoding::Context) -> usize {
4298 16
4299 }
4300 }
4301
4302 unsafe impl<D: fidl::encoding::ResourceDialect>
4303 fidl::encoding::Encode<TouchScreenSimulateMultiFingerGestureRequest, D>
4304 for &TouchScreenSimulateMultiFingerGestureRequest
4305 {
4306 unsafe fn encode(
4307 self,
4308 encoder: &mut fidl::encoding::Encoder<'_, D>,
4309 offset: usize,
4310 mut depth: fidl::encoding::Depth,
4311 ) -> fidl::Result<()> {
4312 encoder.debug_check_bounds::<TouchScreenSimulateMultiFingerGestureRequest>(offset);
4313 let max_ordinal: u64 = self.max_ordinal_present();
4315 encoder.write_num(max_ordinal, offset);
4316 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4317 if max_ordinal == 0 {
4319 return Ok(());
4320 }
4321 depth.increment()?;
4322 let envelope_size = 8;
4323 let bytes_len = max_ordinal as usize * envelope_size;
4324 #[allow(unused_variables)]
4325 let offset = encoder.out_of_line_offset(bytes_len);
4326 let mut _prev_end_offset: usize = 0;
4327 if 1 > max_ordinal {
4328 return Ok(());
4329 }
4330
4331 let cur_offset: usize = (1 - 1) * envelope_size;
4334
4335 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4337
4338 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D>(
4343 self.start_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4344 encoder, offset + cur_offset, depth
4345 )?;
4346
4347 _prev_end_offset = cur_offset + envelope_size;
4348 if 2 > max_ordinal {
4349 return Ok(());
4350 }
4351
4352 let cur_offset: usize = (2 - 1) * envelope_size;
4355
4356 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4358
4359 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D>(
4364 self.end_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4365 encoder, offset + cur_offset, depth
4366 )?;
4367
4368 _prev_end_offset = cur_offset + envelope_size;
4369 if 3 > max_ordinal {
4370 return Ok(());
4371 }
4372
4373 let cur_offset: usize = (3 - 1) * envelope_size;
4376
4377 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4379
4380 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4385 self.move_event_count
4386 .as_ref()
4387 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4388 encoder,
4389 offset + cur_offset,
4390 depth,
4391 )?;
4392
4393 _prev_end_offset = cur_offset + envelope_size;
4394 if 4 > max_ordinal {
4395 return Ok(());
4396 }
4397
4398 let cur_offset: usize = (4 - 1) * envelope_size;
4401
4402 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4404
4405 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4410 self.finger_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4411 encoder,
4412 offset + cur_offset,
4413 depth,
4414 )?;
4415
4416 _prev_end_offset = cur_offset + envelope_size;
4417
4418 Ok(())
4419 }
4420 }
4421
4422 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4423 for TouchScreenSimulateMultiFingerGestureRequest
4424 {
4425 #[inline(always)]
4426 fn new_empty() -> Self {
4427 Self::default()
4428 }
4429
4430 unsafe fn decode(
4431 &mut self,
4432 decoder: &mut fidl::encoding::Decoder<'_, D>,
4433 offset: usize,
4434 mut depth: fidl::encoding::Depth,
4435 ) -> fidl::Result<()> {
4436 decoder.debug_check_bounds::<Self>(offset);
4437 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4438 None => return Err(fidl::Error::NotNullable),
4439 Some(len) => len,
4440 };
4441 if len == 0 {
4443 return Ok(());
4444 };
4445 depth.increment()?;
4446 let envelope_size = 8;
4447 let bytes_len = len * envelope_size;
4448 let offset = decoder.out_of_line_offset(bytes_len)?;
4449 let mut _next_ordinal_to_read = 0;
4451 let mut next_offset = offset;
4452 let end_offset = offset + bytes_len;
4453 _next_ordinal_to_read += 1;
4454 if next_offset >= end_offset {
4455 return Ok(());
4456 }
4457
4458 while _next_ordinal_to_read < 1 {
4460 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4461 _next_ordinal_to_read += 1;
4462 next_offset += envelope_size;
4463 }
4464
4465 let next_out_of_line = decoder.next_out_of_line();
4466 let handles_before = decoder.remaining_handles();
4467 if let Some((inlined, num_bytes, num_handles)) =
4468 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4469 {
4470 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4471 if inlined != (member_inline_size <= 4) {
4472 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4473 }
4474 let inner_offset;
4475 let mut inner_depth = depth.clone();
4476 if inlined {
4477 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4478 inner_offset = next_offset;
4479 } else {
4480 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4481 inner_depth.increment()?;
4482 }
4483 let val_ref =
4484 self.start_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D));
4485 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4486 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4487 {
4488 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4489 }
4490 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4491 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4492 }
4493 }
4494
4495 next_offset += envelope_size;
4496 _next_ordinal_to_read += 1;
4497 if next_offset >= end_offset {
4498 return Ok(());
4499 }
4500
4501 while _next_ordinal_to_read < 2 {
4503 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4504 _next_ordinal_to_read += 1;
4505 next_offset += envelope_size;
4506 }
4507
4508 let next_out_of_line = decoder.next_out_of_line();
4509 let handles_before = decoder.remaining_handles();
4510 if let Some((inlined, num_bytes, num_handles)) =
4511 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4512 {
4513 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4514 if inlined != (member_inline_size <= 4) {
4515 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4516 }
4517 let inner_offset;
4518 let mut inner_depth = depth.clone();
4519 if inlined {
4520 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4521 inner_offset = next_offset;
4522 } else {
4523 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4524 inner_depth.increment()?;
4525 }
4526 let val_ref =
4527 self.end_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D));
4528 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math__common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4529 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4530 {
4531 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4532 }
4533 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4534 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4535 }
4536 }
4537
4538 next_offset += envelope_size;
4539 _next_ordinal_to_read += 1;
4540 if next_offset >= end_offset {
4541 return Ok(());
4542 }
4543
4544 while _next_ordinal_to_read < 3 {
4546 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4547 _next_ordinal_to_read += 1;
4548 next_offset += envelope_size;
4549 }
4550
4551 let next_out_of_line = decoder.next_out_of_line();
4552 let handles_before = decoder.remaining_handles();
4553 if let Some((inlined, num_bytes, num_handles)) =
4554 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4555 {
4556 let member_inline_size =
4557 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4558 if inlined != (member_inline_size <= 4) {
4559 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4560 }
4561 let inner_offset;
4562 let mut inner_depth = depth.clone();
4563 if inlined {
4564 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4565 inner_offset = next_offset;
4566 } else {
4567 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4568 inner_depth.increment()?;
4569 }
4570 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
4571 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4572 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4573 {
4574 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4575 }
4576 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4577 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4578 }
4579 }
4580
4581 next_offset += envelope_size;
4582 _next_ordinal_to_read += 1;
4583 if next_offset >= end_offset {
4584 return Ok(());
4585 }
4586
4587 while _next_ordinal_to_read < 4 {
4589 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4590 _next_ordinal_to_read += 1;
4591 next_offset += envelope_size;
4592 }
4593
4594 let next_out_of_line = decoder.next_out_of_line();
4595 let handles_before = decoder.remaining_handles();
4596 if let Some((inlined, num_bytes, num_handles)) =
4597 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4598 {
4599 let member_inline_size =
4600 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4601 if inlined != (member_inline_size <= 4) {
4602 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4603 }
4604 let inner_offset;
4605 let mut inner_depth = depth.clone();
4606 if inlined {
4607 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4608 inner_offset = next_offset;
4609 } else {
4610 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4611 inner_depth.increment()?;
4612 }
4613 let val_ref = self.finger_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
4614 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4615 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4616 {
4617 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4618 }
4619 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4620 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4621 }
4622 }
4623
4624 next_offset += envelope_size;
4625
4626 while next_offset < end_offset {
4628 _next_ordinal_to_read += 1;
4629 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4630 next_offset += envelope_size;
4631 }
4632
4633 Ok(())
4634 }
4635 }
4636
4637 impl TouchScreenSimulateMultiTapRequest {
4638 #[inline(always)]
4639 fn max_ordinal_present(&self) -> u64 {
4640 if let Some(_) = self.tap_locations {
4641 return 1;
4642 }
4643 0
4644 }
4645 }
4646
4647 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiTapRequest {
4648 type Borrowed<'a> = &'a Self;
4649 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4650 value
4651 }
4652 }
4653
4654 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiTapRequest {
4655 type Owned = Self;
4656
4657 #[inline(always)]
4658 fn inline_align(_context: fidl::encoding::Context) -> usize {
4659 8
4660 }
4661
4662 #[inline(always)]
4663 fn inline_size(_context: fidl::encoding::Context) -> usize {
4664 16
4665 }
4666 }
4667
4668 unsafe impl<D: fidl::encoding::ResourceDialect>
4669 fidl::encoding::Encode<TouchScreenSimulateMultiTapRequest, D>
4670 for &TouchScreenSimulateMultiTapRequest
4671 {
4672 unsafe fn encode(
4673 self,
4674 encoder: &mut fidl::encoding::Encoder<'_, D>,
4675 offset: usize,
4676 mut depth: fidl::encoding::Depth,
4677 ) -> fidl::Result<()> {
4678 encoder.debug_check_bounds::<TouchScreenSimulateMultiTapRequest>(offset);
4679 let max_ordinal: u64 = self.max_ordinal_present();
4681 encoder.write_num(max_ordinal, offset);
4682 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4683 if max_ordinal == 0 {
4685 return Ok(());
4686 }
4687 depth.increment()?;
4688 let envelope_size = 8;
4689 let bytes_len = max_ordinal as usize * envelope_size;
4690 #[allow(unused_variables)]
4691 let offset = encoder.out_of_line_offset(bytes_len);
4692 let mut _prev_end_offset: usize = 0;
4693 if 1 > max_ordinal {
4694 return Ok(());
4695 }
4696
4697 let cur_offset: usize = (1 - 1) * envelope_size;
4700
4701 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4703
4704 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10>, D>(
4709 self.tap_locations.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
4710 encoder, offset + cur_offset, depth
4711 )?;
4712
4713 _prev_end_offset = cur_offset + envelope_size;
4714
4715 Ok(())
4716 }
4717 }
4718
4719 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4720 for TouchScreenSimulateMultiTapRequest
4721 {
4722 #[inline(always)]
4723 fn new_empty() -> Self {
4724 Self::default()
4725 }
4726
4727 unsafe fn decode(
4728 &mut self,
4729 decoder: &mut fidl::encoding::Decoder<'_, D>,
4730 offset: usize,
4731 mut depth: fidl::encoding::Depth,
4732 ) -> fidl::Result<()> {
4733 decoder.debug_check_bounds::<Self>(offset);
4734 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4735 None => return Err(fidl::Error::NotNullable),
4736 Some(len) => len,
4737 };
4738 if len == 0 {
4740 return Ok(());
4741 };
4742 depth.increment()?;
4743 let envelope_size = 8;
4744 let bytes_len = len * envelope_size;
4745 let offset = decoder.out_of_line_offset(bytes_len)?;
4746 let mut _next_ordinal_to_read = 0;
4748 let mut next_offset = offset;
4749 let end_offset = offset + bytes_len;
4750 _next_ordinal_to_read += 1;
4751 if next_offset >= end_offset {
4752 return Ok(());
4753 }
4754
4755 while _next_ordinal_to_read < 1 {
4757 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4758 _next_ordinal_to_read += 1;
4759 next_offset += envelope_size;
4760 }
4761
4762 let next_out_of_line = decoder.next_out_of_line();
4763 let handles_before = decoder.remaining_handles();
4764 if let Some((inlined, num_bytes, num_handles)) =
4765 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4766 {
4767 let member_inline_size = <fidl::encoding::Vector<
4768 fidl_fuchsia_math__common::Vec_,
4769 10,
4770 > as fidl::encoding::TypeMarker>::inline_size(
4771 decoder.context
4772 );
4773 if inlined != (member_inline_size <= 4) {
4774 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4775 }
4776 let inner_offset;
4777 let mut inner_depth = depth.clone();
4778 if inlined {
4779 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4780 inner_offset = next_offset;
4781 } else {
4782 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4783 inner_depth.increment()?;
4784 }
4785 let val_ref =
4786 self.tap_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10>, D));
4787 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math__common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
4788 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4789 {
4790 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4791 }
4792 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4793 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4794 }
4795 }
4796
4797 next_offset += envelope_size;
4798
4799 while next_offset < end_offset {
4801 _next_ordinal_to_read += 1;
4802 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4803 next_offset += envelope_size;
4804 }
4805
4806 Ok(())
4807 }
4808 }
4809
4810 impl TouchScreenSimulateSwipeRequest {
4811 #[inline(always)]
4812 fn max_ordinal_present(&self) -> u64 {
4813 if let Some(_) = self.duration {
4814 return 4;
4815 }
4816 if let Some(_) = self.move_event_count {
4817 return 3;
4818 }
4819 if let Some(_) = self.end_location {
4820 return 2;
4821 }
4822 if let Some(_) = self.start_location {
4823 return 1;
4824 }
4825 0
4826 }
4827 }
4828
4829 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateSwipeRequest {
4830 type Borrowed<'a> = &'a Self;
4831 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4832 value
4833 }
4834 }
4835
4836 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateSwipeRequest {
4837 type Owned = Self;
4838
4839 #[inline(always)]
4840 fn inline_align(_context: fidl::encoding::Context) -> usize {
4841 8
4842 }
4843
4844 #[inline(always)]
4845 fn inline_size(_context: fidl::encoding::Context) -> usize {
4846 16
4847 }
4848 }
4849
4850 unsafe impl<D: fidl::encoding::ResourceDialect>
4851 fidl::encoding::Encode<TouchScreenSimulateSwipeRequest, D>
4852 for &TouchScreenSimulateSwipeRequest
4853 {
4854 unsafe fn encode(
4855 self,
4856 encoder: &mut fidl::encoding::Encoder<'_, D>,
4857 offset: usize,
4858 mut depth: fidl::encoding::Depth,
4859 ) -> fidl::Result<()> {
4860 encoder.debug_check_bounds::<TouchScreenSimulateSwipeRequest>(offset);
4861 let max_ordinal: u64 = self.max_ordinal_present();
4863 encoder.write_num(max_ordinal, offset);
4864 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4865 if max_ordinal == 0 {
4867 return Ok(());
4868 }
4869 depth.increment()?;
4870 let envelope_size = 8;
4871 let bytes_len = max_ordinal as usize * envelope_size;
4872 #[allow(unused_variables)]
4873 let offset = encoder.out_of_line_offset(bytes_len);
4874 let mut _prev_end_offset: usize = 0;
4875 if 1 > max_ordinal {
4876 return Ok(());
4877 }
4878
4879 let cur_offset: usize = (1 - 1) * envelope_size;
4882
4883 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4885
4886 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::Vec_, D>(
4891 self.start_location.as_ref().map(
4892 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
4893 ),
4894 encoder,
4895 offset + cur_offset,
4896 depth,
4897 )?;
4898
4899 _prev_end_offset = cur_offset + envelope_size;
4900 if 2 > max_ordinal {
4901 return Ok(());
4902 }
4903
4904 let cur_offset: usize = (2 - 1) * envelope_size;
4907
4908 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4910
4911 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::Vec_, D>(
4916 self.end_location.as_ref().map(
4917 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
4918 ),
4919 encoder,
4920 offset + cur_offset,
4921 depth,
4922 )?;
4923
4924 _prev_end_offset = cur_offset + envelope_size;
4925 if 3 > max_ordinal {
4926 return Ok(());
4927 }
4928
4929 let cur_offset: usize = (3 - 1) * envelope_size;
4932
4933 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4935
4936 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4941 self.move_event_count
4942 .as_ref()
4943 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4944 encoder,
4945 offset + cur_offset,
4946 depth,
4947 )?;
4948
4949 _prev_end_offset = cur_offset + envelope_size;
4950 if 4 > max_ordinal {
4951 return Ok(());
4952 }
4953
4954 let cur_offset: usize = (4 - 1) * envelope_size;
4957
4958 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4960
4961 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4966 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4967 encoder,
4968 offset + cur_offset,
4969 depth,
4970 )?;
4971
4972 _prev_end_offset = cur_offset + envelope_size;
4973
4974 Ok(())
4975 }
4976 }
4977
4978 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4979 for TouchScreenSimulateSwipeRequest
4980 {
4981 #[inline(always)]
4982 fn new_empty() -> Self {
4983 Self::default()
4984 }
4985
4986 unsafe fn decode(
4987 &mut self,
4988 decoder: &mut fidl::encoding::Decoder<'_, D>,
4989 offset: usize,
4990 mut depth: fidl::encoding::Depth,
4991 ) -> fidl::Result<()> {
4992 decoder.debug_check_bounds::<Self>(offset);
4993 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4994 None => return Err(fidl::Error::NotNullable),
4995 Some(len) => len,
4996 };
4997 if len == 0 {
4999 return Ok(());
5000 };
5001 depth.increment()?;
5002 let envelope_size = 8;
5003 let bytes_len = len * envelope_size;
5004 let offset = decoder.out_of_line_offset(bytes_len)?;
5005 let mut _next_ordinal_to_read = 0;
5007 let mut next_offset = offset;
5008 let end_offset = offset + bytes_len;
5009 _next_ordinal_to_read += 1;
5010 if next_offset >= end_offset {
5011 return Ok(());
5012 }
5013
5014 while _next_ordinal_to_read < 1 {
5016 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5017 _next_ordinal_to_read += 1;
5018 next_offset += envelope_size;
5019 }
5020
5021 let next_out_of_line = decoder.next_out_of_line();
5022 let handles_before = decoder.remaining_handles();
5023 if let Some((inlined, num_bytes, num_handles)) =
5024 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5025 {
5026 let member_inline_size =
5027 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5028 decoder.context,
5029 );
5030 if inlined != (member_inline_size <= 4) {
5031 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5032 }
5033 let inner_offset;
5034 let mut inner_depth = depth.clone();
5035 if inlined {
5036 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5037 inner_offset = next_offset;
5038 } else {
5039 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5040 inner_depth.increment()?;
5041 }
5042 let val_ref = self
5043 .start_location
5044 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::Vec_, D));
5045 fidl::decode!(
5046 fidl_fuchsia_math__common::Vec_,
5047 D,
5048 val_ref,
5049 decoder,
5050 inner_offset,
5051 inner_depth
5052 )?;
5053 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5054 {
5055 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5056 }
5057 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5058 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5059 }
5060 }
5061
5062 next_offset += envelope_size;
5063 _next_ordinal_to_read += 1;
5064 if next_offset >= end_offset {
5065 return Ok(());
5066 }
5067
5068 while _next_ordinal_to_read < 2 {
5070 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5071 _next_ordinal_to_read += 1;
5072 next_offset += envelope_size;
5073 }
5074
5075 let next_out_of_line = decoder.next_out_of_line();
5076 let handles_before = decoder.remaining_handles();
5077 if let Some((inlined, num_bytes, num_handles)) =
5078 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5079 {
5080 let member_inline_size =
5081 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5082 decoder.context,
5083 );
5084 if inlined != (member_inline_size <= 4) {
5085 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5086 }
5087 let inner_offset;
5088 let mut inner_depth = depth.clone();
5089 if inlined {
5090 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5091 inner_offset = next_offset;
5092 } else {
5093 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5094 inner_depth.increment()?;
5095 }
5096 let val_ref = self
5097 .end_location
5098 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::Vec_, D));
5099 fidl::decode!(
5100 fidl_fuchsia_math__common::Vec_,
5101 D,
5102 val_ref,
5103 decoder,
5104 inner_offset,
5105 inner_depth
5106 )?;
5107 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5108 {
5109 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5110 }
5111 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5112 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5113 }
5114 }
5115
5116 next_offset += envelope_size;
5117 _next_ordinal_to_read += 1;
5118 if next_offset >= end_offset {
5119 return Ok(());
5120 }
5121
5122 while _next_ordinal_to_read < 3 {
5124 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5125 _next_ordinal_to_read += 1;
5126 next_offset += envelope_size;
5127 }
5128
5129 let next_out_of_line = decoder.next_out_of_line();
5130 let handles_before = decoder.remaining_handles();
5131 if let Some((inlined, num_bytes, num_handles)) =
5132 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5133 {
5134 let member_inline_size =
5135 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5136 if inlined != (member_inline_size <= 4) {
5137 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5138 }
5139 let inner_offset;
5140 let mut inner_depth = depth.clone();
5141 if inlined {
5142 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5143 inner_offset = next_offset;
5144 } else {
5145 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5146 inner_depth.increment()?;
5147 }
5148 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5149 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5150 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5151 {
5152 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5153 }
5154 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5155 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5156 }
5157 }
5158
5159 next_offset += envelope_size;
5160 _next_ordinal_to_read += 1;
5161 if next_offset >= end_offset {
5162 return Ok(());
5163 }
5164
5165 while _next_ordinal_to_read < 4 {
5167 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5168 _next_ordinal_to_read += 1;
5169 next_offset += envelope_size;
5170 }
5171
5172 let next_out_of_line = decoder.next_out_of_line();
5173 let handles_before = decoder.remaining_handles();
5174 if let Some((inlined, num_bytes, num_handles)) =
5175 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5176 {
5177 let member_inline_size =
5178 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5179 if inlined != (member_inline_size <= 4) {
5180 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5181 }
5182 let inner_offset;
5183 let mut inner_depth = depth.clone();
5184 if inlined {
5185 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5186 inner_offset = next_offset;
5187 } else {
5188 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5189 inner_depth.increment()?;
5190 }
5191 let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
5192 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5193 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5194 {
5195 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5196 }
5197 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5198 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5199 }
5200 }
5201
5202 next_offset += envelope_size;
5203
5204 while next_offset < end_offset {
5206 _next_ordinal_to_read += 1;
5207 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5208 next_offset += envelope_size;
5209 }
5210
5211 Ok(())
5212 }
5213 }
5214
5215 impl TouchScreenSimulateTapRequest {
5216 #[inline(always)]
5217 fn max_ordinal_present(&self) -> u64 {
5218 if let Some(_) = self.tap_location {
5219 return 1;
5220 }
5221 0
5222 }
5223 }
5224
5225 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTapRequest {
5226 type Borrowed<'a> = &'a Self;
5227 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5228 value
5229 }
5230 }
5231
5232 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTapRequest {
5233 type Owned = Self;
5234
5235 #[inline(always)]
5236 fn inline_align(_context: fidl::encoding::Context) -> usize {
5237 8
5238 }
5239
5240 #[inline(always)]
5241 fn inline_size(_context: fidl::encoding::Context) -> usize {
5242 16
5243 }
5244 }
5245
5246 unsafe impl<D: fidl::encoding::ResourceDialect>
5247 fidl::encoding::Encode<TouchScreenSimulateTapRequest, D>
5248 for &TouchScreenSimulateTapRequest
5249 {
5250 unsafe fn encode(
5251 self,
5252 encoder: &mut fidl::encoding::Encoder<'_, D>,
5253 offset: usize,
5254 mut depth: fidl::encoding::Depth,
5255 ) -> fidl::Result<()> {
5256 encoder.debug_check_bounds::<TouchScreenSimulateTapRequest>(offset);
5257 let max_ordinal: u64 = self.max_ordinal_present();
5259 encoder.write_num(max_ordinal, offset);
5260 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5261 if max_ordinal == 0 {
5263 return Ok(());
5264 }
5265 depth.increment()?;
5266 let envelope_size = 8;
5267 let bytes_len = max_ordinal as usize * envelope_size;
5268 #[allow(unused_variables)]
5269 let offset = encoder.out_of_line_offset(bytes_len);
5270 let mut _prev_end_offset: usize = 0;
5271 if 1 > max_ordinal {
5272 return Ok(());
5273 }
5274
5275 let cur_offset: usize = (1 - 1) * envelope_size;
5278
5279 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5281
5282 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math__common::Vec_, D>(
5287 self.tap_location.as_ref().map(
5288 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5289 ),
5290 encoder,
5291 offset + cur_offset,
5292 depth,
5293 )?;
5294
5295 _prev_end_offset = cur_offset + envelope_size;
5296
5297 Ok(())
5298 }
5299 }
5300
5301 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5302 for TouchScreenSimulateTapRequest
5303 {
5304 #[inline(always)]
5305 fn new_empty() -> Self {
5306 Self::default()
5307 }
5308
5309 unsafe fn decode(
5310 &mut self,
5311 decoder: &mut fidl::encoding::Decoder<'_, D>,
5312 offset: usize,
5313 mut depth: fidl::encoding::Depth,
5314 ) -> fidl::Result<()> {
5315 decoder.debug_check_bounds::<Self>(offset);
5316 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5317 None => return Err(fidl::Error::NotNullable),
5318 Some(len) => len,
5319 };
5320 if len == 0 {
5322 return Ok(());
5323 };
5324 depth.increment()?;
5325 let envelope_size = 8;
5326 let bytes_len = len * envelope_size;
5327 let offset = decoder.out_of_line_offset(bytes_len)?;
5328 let mut _next_ordinal_to_read = 0;
5330 let mut next_offset = offset;
5331 let end_offset = offset + bytes_len;
5332 _next_ordinal_to_read += 1;
5333 if next_offset >= end_offset {
5334 return Ok(());
5335 }
5336
5337 while _next_ordinal_to_read < 1 {
5339 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5340 _next_ordinal_to_read += 1;
5341 next_offset += envelope_size;
5342 }
5343
5344 let next_out_of_line = decoder.next_out_of_line();
5345 let handles_before = decoder.remaining_handles();
5346 if let Some((inlined, num_bytes, num_handles)) =
5347 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5348 {
5349 let member_inline_size =
5350 <fidl_fuchsia_math__common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5351 decoder.context,
5352 );
5353 if inlined != (member_inline_size <= 4) {
5354 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5355 }
5356 let inner_offset;
5357 let mut inner_depth = depth.clone();
5358 if inlined {
5359 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5360 inner_offset = next_offset;
5361 } else {
5362 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5363 inner_depth.increment()?;
5364 }
5365 let val_ref = self
5366 .tap_location
5367 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math__common::Vec_, D));
5368 fidl::decode!(
5369 fidl_fuchsia_math__common::Vec_,
5370 D,
5371 val_ref,
5372 decoder,
5373 inner_offset,
5374 inner_depth
5375 )?;
5376 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5377 {
5378 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5379 }
5380 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5381 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5382 }
5383 }
5384
5385 next_offset += envelope_size;
5386
5387 while next_offset < end_offset {
5389 _next_ordinal_to_read += 1;
5390 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5391 next_offset += envelope_size;
5392 }
5393
5394 Ok(())
5395 }
5396 }
5397}