1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_FINGERS: u8 = 10;
12
13pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
16
17#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
20pub enum CoordinateUnit {
21 Default,
28 PhysicalPixels,
41 RegisteredDimensions,
44 #[doc(hidden)]
45 __SourceBreaking { unknown_ordinal: u32 },
46}
47
48#[macro_export]
50macro_rules! CoordinateUnitUnknown {
51 () => {
52 _
53 };
54}
55
56impl CoordinateUnit {
57 #[inline]
58 pub fn from_primitive(prim: u32) -> Option<Self> {
59 match prim {
60 0 => Some(Self::Default),
61 1 => Some(Self::PhysicalPixels),
62 2 => Some(Self::RegisteredDimensions),
63 _ => None,
64 }
65 }
66
67 #[inline]
68 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
69 match prim {
70 0 => Self::Default,
71 1 => Self::PhysicalPixels,
72 2 => Self::RegisteredDimensions,
73 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
74 }
75 }
76
77 #[inline]
78 pub fn unknown() -> Self {
79 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
80 }
81
82 #[inline]
83 pub const fn into_primitive(self) -> u32 {
84 match self {
85 Self::Default => 0,
86 Self::PhysicalPixels => 1,
87 Self::RegisteredDimensions => 2,
88 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
89 }
90 }
91
92 #[inline]
93 pub fn is_unknown(&self) -> bool {
94 match self {
95 Self::__SourceBreaking { unknown_ordinal: _ } => true,
96 _ => false,
97 }
98 }
99}
100
101#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
103pub enum MouseButton {
104 First,
106 Second,
108 Third,
110 #[doc(hidden)]
111 __SourceBreaking { unknown_ordinal: u32 },
112}
113
114#[macro_export]
116macro_rules! MouseButtonUnknown {
117 () => {
118 _
119 };
120}
121
122impl MouseButton {
123 #[inline]
124 pub fn from_primitive(prim: u32) -> Option<Self> {
125 match prim {
126 0 => Some(Self::First),
127 1 => Some(Self::Second),
128 2 => Some(Self::Third),
129 _ => None,
130 }
131 }
132
133 #[inline]
134 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
135 match prim {
136 0 => Self::First,
137 1 => Self::Second,
138 2 => Self::Third,
139 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
140 }
141 }
142
143 #[inline]
144 pub fn unknown() -> Self {
145 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
146 }
147
148 #[inline]
149 pub const fn into_primitive(self) -> u32 {
150 match self {
151 Self::First => 0,
152 Self::Second => 1,
153 Self::Third => 2,
154 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
155 }
156 }
157
158 #[inline]
159 pub fn is_unknown(&self) -> bool {
160 match self {
161 Self::__SourceBreaking { unknown_ordinal: _ } => true,
162 _ => false,
163 }
164 }
165}
166
167#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
169pub enum MouseEventPhase {
170 Add,
172 Hover,
175 Down,
177 Move,
179 Up,
181 Wheel,
183 #[doc(hidden)]
184 __SourceBreaking { unknown_ordinal: u32 },
185}
186
187#[macro_export]
189macro_rules! MouseEventPhaseUnknown {
190 () => {
191 _
192 };
193}
194
195impl MouseEventPhase {
196 #[inline]
197 pub fn from_primitive(prim: u32) -> Option<Self> {
198 match prim {
199 0 => Some(Self::Add),
200 1 => Some(Self::Hover),
201 2 => Some(Self::Down),
202 3 => Some(Self::Move),
203 4 => Some(Self::Up),
204 5 => Some(Self::Wheel),
205 _ => None,
206 }
207 }
208
209 #[inline]
210 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
211 match prim {
212 0 => Self::Add,
213 1 => Self::Hover,
214 2 => Self::Down,
215 3 => Self::Move,
216 4 => Self::Up,
217 5 => Self::Wheel,
218 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
219 }
220 }
221
222 #[inline]
223 pub fn unknown() -> Self {
224 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
225 }
226
227 #[inline]
228 pub const fn into_primitive(self) -> u32 {
229 match self {
230 Self::Add => 0,
231 Self::Hover => 1,
232 Self::Down => 2,
233 Self::Move => 3,
234 Self::Up => 4,
235 Self::Wheel => 5,
236 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
237 }
238 }
239
240 #[inline]
241 pub fn is_unknown(&self) -> bool {
242 match self {
243 Self::__SourceBreaking { unknown_ordinal: _ } => true,
244 _ => false,
245 }
246 }
247}
248
249#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
250pub enum TestAppStatus {
251 HandlersRegistered,
255 ElementFocused,
260 #[doc(hidden)]
261 __SourceBreaking { unknown_ordinal: u16 },
262}
263
264#[macro_export]
266macro_rules! TestAppStatusUnknown {
267 () => {
268 _
269 };
270}
271
272impl TestAppStatus {
273 #[inline]
274 pub fn from_primitive(prim: u16) -> Option<Self> {
275 match prim {
276 1 => Some(Self::HandlersRegistered),
277 2 => Some(Self::ElementFocused),
278 _ => None,
279 }
280 }
281
282 #[inline]
283 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
284 match prim {
285 1 => Self::HandlersRegistered,
286 2 => Self::ElementFocused,
287 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
288 }
289 }
290
291 #[inline]
292 pub fn unknown() -> Self {
293 Self::__SourceBreaking { unknown_ordinal: 0xffff }
294 }
295
296 #[inline]
297 pub const fn into_primitive(self) -> u16 {
298 match self {
299 Self::HandlersRegistered => 1,
300 Self::ElementFocused => 2,
301 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
302 }
303 }
304
305 #[inline]
306 pub fn is_unknown(&self) -> bool {
307 match self {
308 Self::__SourceBreaking { unknown_ordinal: _ } => true,
309 _ => false,
310 }
311 }
312}
313
314#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
315#[repr(C)]
316pub struct DisplayDimensions {
317 pub min_x: i64,
319 pub min_y: i64,
321 pub max_x: i64,
323 pub max_y: i64,
325}
326
327impl fidl::Persistable for DisplayDimensions {}
328
329#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
330pub struct TestAppStatusListenerReportStatusRequest {
331 pub status: TestAppStatus,
332}
333
334impl fidl::Persistable for TestAppStatusListenerReportStatusRequest {}
335
336#[derive(Clone, Debug, PartialEq)]
337pub struct TouchScreenSimulateTouchEventRequest {
338 pub report: TouchInputReport,
339}
340
341impl fidl::Persistable for TouchScreenSimulateTouchEventRequest {}
342
343#[derive(Clone, Debug, Default, PartialEq)]
344pub struct ContactInputReport {
345 pub contact_id: Option<u32>,
346 pub position_x: Option<i64>,
347 pub position_y: Option<i64>,
348 #[doc(hidden)]
349 pub __source_breaking: fidl::marker::SourceBreaking,
350}
351
352impl fidl::Persistable for ContactInputReport {}
353
354#[derive(Clone, Debug, Default, PartialEq)]
355pub struct KeyboardInputListenerReportTextInputRequest {
356 pub text: Option<String>,
358 pub non_printable: Option<fidl_fuchsia_ui_input3_common::NonPrintableKey>,
360 pub device_id: Option<u32>,
361 #[doc(hidden)]
362 pub __source_breaking: fidl::marker::SourceBreaking,
363}
364
365impl fidl::Persistable for KeyboardInputListenerReportTextInputRequest {}
366
367#[derive(Clone, Debug, Default, PartialEq)]
368pub struct KeyboardSimulateKeyEventRequest {
369 pub pressed_keys: Option<Vec<fidl_fuchsia_input_common::Key>>,
370 #[doc(hidden)]
371 pub __source_breaking: fidl::marker::SourceBreaking,
372}
373
374impl fidl::Persistable for KeyboardSimulateKeyEventRequest {}
375
376#[derive(Clone, Debug, Default, PartialEq)]
377pub struct KeyboardSimulateKeyPressRequest {
378 pub key_code: Option<fidl_fuchsia_input_common::Key>,
379 #[doc(hidden)]
380 pub __source_breaking: fidl::marker::SourceBreaking,
381}
382
383impl fidl::Persistable for KeyboardSimulateKeyPressRequest {}
384
385#[derive(Clone, Debug, Default, PartialEq)]
386pub struct KeyboardSimulateUsAsciiTextEntryRequest {
387 pub text: Option<String>,
388 #[doc(hidden)]
389 pub __source_breaking: fidl::marker::SourceBreaking,
390}
391
392impl fidl::Persistable for KeyboardSimulateUsAsciiTextEntryRequest {}
393
394#[derive(Clone, Debug, Default, PartialEq)]
395pub struct MediaButtonsDeviceScheduleSimulateButtonPressRequest {
396 pub button: Option<fidl_fuchsia_input_common::ConsumerControlButton>,
397 pub delay: Option<i64>,
399 #[doc(hidden)]
400 pub __source_breaking: fidl::marker::SourceBreaking,
401}
402
403impl fidl::Persistable for MediaButtonsDeviceScheduleSimulateButtonPressRequest {}
404
405#[derive(Clone, Debug, Default, PartialEq)]
406pub struct MediaButtonsDeviceSendButtonsStateRequest {
407 pub buttons: Option<Vec<fidl_fuchsia_input_common::ConsumerControlButton>>,
408 #[doc(hidden)]
409 pub __source_breaking: fidl::marker::SourceBreaking,
410}
411
412impl fidl::Persistable for MediaButtonsDeviceSendButtonsStateRequest {}
413
414#[derive(Clone, Debug, Default, PartialEq)]
415pub struct MediaButtonsDeviceSimulateButtonPressRequest {
416 pub button: Option<fidl_fuchsia_input_common::ConsumerControlButton>,
417 #[doc(hidden)]
418 pub __source_breaking: fidl::marker::SourceBreaking,
419}
420
421impl fidl::Persistable for MediaButtonsDeviceSimulateButtonPressRequest {}
422
423#[derive(Clone, Debug, Default, PartialEq)]
424pub struct MouseInputListenerReportMouseInputRequest {
425 pub local_x: Option<f64>,
427 pub local_y: Option<f64>,
429 pub time_received: Option<i64>,
433 pub component_name: Option<String>,
438 pub buttons: Option<Vec<MouseButton>>,
440 pub phase: Option<MouseEventPhase>,
442 pub device_pixel_ratio: Option<f64>,
447 pub wheel_x_physical_pixel: Option<f64>,
449 pub wheel_y_physical_pixel: Option<f64>,
451 pub device_id: Option<u32>,
452 #[doc(hidden)]
453 pub __source_breaking: fidl::marker::SourceBreaking,
454}
455
456impl fidl::Persistable for MouseInputListenerReportMouseInputRequest {}
457
458#[derive(Clone, Debug, Default, PartialEq)]
459pub struct MouseSimulateMouseEventRequest {
460 pub pressed_buttons: Option<Vec<MouseButton>>,
463 pub movement_x: Option<i64>,
465 pub movement_y: Option<i64>,
467 pub scroll_v_detent: Option<i64>,
469 pub scroll_h_detent: Option<i64>,
471 pub scroll_v_physical_pixel: Option<f64>,
474 pub scroll_h_physical_pixel: Option<f64>,
477 #[doc(hidden)]
478 pub __source_breaking: fidl::marker::SourceBreaking,
479}
480
481impl fidl::Persistable for MouseSimulateMouseEventRequest {}
482
483#[derive(Clone, Debug, Default, PartialEq)]
484pub struct TouchInputListenerReportTouchInputRequest {
485 pub local_x: Option<f64>,
487 pub local_y: Option<f64>,
489 pub time_received: Option<i64>,
493 pub device_pixel_ratio: Option<f64>,
495 pub component_name: Option<String>,
500 pub phase: Option<fidl_fuchsia_ui_pointer_common::EventPhase>,
502 pub pointer_id: Option<u32>,
506 pub device_id: Option<u32>,
507 #[doc(hidden)]
508 pub __source_breaking: fidl::marker::SourceBreaking,
509}
510
511impl fidl::Persistable for TouchInputListenerReportTouchInputRequest {}
512
513#[derive(Clone, Debug, Default, PartialEq)]
514pub struct TouchInputReport {
515 pub contacts: Option<Vec<ContactInputReport>>,
516 pub pressed_buttons: Option<Vec<u8>>,
517 #[doc(hidden)]
518 pub __source_breaking: fidl::marker::SourceBreaking,
519}
520
521impl fidl::Persistable for TouchInputReport {}
522
523#[derive(Clone, Debug, Default, PartialEq)]
524pub struct TouchScreenSimulateMultiFingerGestureRequest {
525 pub start_locations: Option<[fidl_fuchsia_math_common::Vec_; 10]>,
528 pub end_locations: Option<[fidl_fuchsia_math_common::Vec_; 10]>,
531 pub move_event_count: Option<u32>,
533 pub finger_count: Option<u32>,
536 #[doc(hidden)]
537 pub __source_breaking: fidl::marker::SourceBreaking,
538}
539
540impl fidl::Persistable for TouchScreenSimulateMultiFingerGestureRequest {}
541
542#[derive(Clone, Debug, Default, PartialEq)]
543pub struct TouchScreenSimulateMultiTapRequest {
544 pub tap_locations: Option<Vec<fidl_fuchsia_math_common::Vec_>>,
547 #[doc(hidden)]
548 pub __source_breaking: fidl::marker::SourceBreaking,
549}
550
551impl fidl::Persistable for TouchScreenSimulateMultiTapRequest {}
552
553#[derive(Clone, Debug, Default, PartialEq)]
554pub struct TouchScreenSimulateSwipeRequest {
555 pub start_location: Option<fidl_fuchsia_math_common::Vec_>,
558 pub end_location: Option<fidl_fuchsia_math_common::Vec_>,
561 pub move_event_count: Option<u32>,
563 pub duration: Option<i64>,
568 #[doc(hidden)]
569 pub __source_breaking: fidl::marker::SourceBreaking,
570}
571
572impl fidl::Persistable for TouchScreenSimulateSwipeRequest {}
573
574#[derive(Clone, Debug, Default, PartialEq)]
575pub struct TouchScreenSimulateTapRequest {
576 pub tap_location: Option<fidl_fuchsia_math_common::Vec_>,
579 #[doc(hidden)]
580 pub __source_breaking: fidl::marker::SourceBreaking,
581}
582
583impl fidl::Persistable for TouchScreenSimulateTapRequest {}
584
585pub mod keyboard_ordinals {
586 pub const SIMULATE_US_ASCII_TEXT_ENTRY: u64 = 0x7111724d25453cfb;
587 pub const SIMULATE_KEY_EVENT: u64 = 0x23e0ae9874a68211;
588 pub const SIMULATE_KEY_PRESS: u64 = 0xb3ba0ef4996ebaf;
589}
590
591pub mod keyboard_input_listener_ordinals {
592 pub const REPORT_READY: u64 = 0x4b7f18cd3570971b;
593 pub const REPORT_TEXT_INPUT: u64 = 0x4d53b1fe481185d1;
594}
595
596pub mod media_buttons_device_ordinals {
597 pub const SIMULATE_BUTTON_PRESS: u64 = 0x256d8b895296c5b2;
598 pub const SEND_BUTTONS_STATE: u64 = 0x254fc23643cdef6b;
599 pub const SCHEDULE_SIMULATE_BUTTON_PRESS: u64 = 0x6ea3a2530301eca;
600}
601
602pub mod mouse_ordinals {
603 pub const SIMULATE_MOUSE_EVENT: u64 = 0x55c55dcd35c8768f;
604}
605
606pub mod mouse_input_listener_ordinals {
607 pub const REPORT_MOUSE_INPUT: u64 = 0x78182130ca3aff13;
608}
609
610pub mod registry_ordinals {
611 pub const REGISTER_TOUCH_SCREEN: u64 = 0x406fb450685ecb73;
612 pub const REGISTER_TOUCH_SCREEN_AND_GET_DEVICE_INFO: u64 = 0x2e8df048a411ed2b;
613 pub const REGISTER_MEDIA_BUTTONS_DEVICE: u64 = 0x3a0b22e6d40e9629;
614 pub const REGISTER_MEDIA_BUTTONS_DEVICE_AND_GET_DEVICE_INFO: u64 = 0x15fb627d190ebd73;
615 pub const REGISTER_KEYBOARD: u64 = 0x291c697601404b38;
616 pub const REGISTER_KEYBOARD_AND_GET_DEVICE_INFO: u64 = 0x1e4edc6c56d2ac7e;
617 pub const REGISTER_MOUSE: u64 = 0xf330169355a1add;
618 pub const REGISTER_MOUSE_AND_GET_DEVICE_INFO: u64 = 0x34aa807670bbae29;
619}
620
621pub mod test_app_status_listener_ordinals {
622 pub const REPORT_STATUS: u64 = 0x6bde93eb7bb3da54;
623}
624
625pub mod touch_input_listener_ordinals {
626 pub const REPORT_TOUCH_INPUT: u64 = 0x371dcd048ac842aa;
627}
628
629pub mod touch_screen_ordinals {
630 pub const SIMULATE_TAP: u64 = 0x2301a93caf2527fd;
631 pub const SIMULATE_MULTI_TAP: u64 = 0x101f5014bda76352;
632 pub const SIMULATE_SWIPE: u64 = 0xcebf566f3f489e4;
633 pub const SIMULATE_MULTI_FINGER_GESTURE: u64 = 0x426074401c1f212b;
634 pub const SIMULATE_TOUCH_EVENT: u64 = 0x557ab909d22a837d;
635}
636
637mod internal {
638 use super::*;
639 unsafe impl fidl::encoding::TypeMarker for CoordinateUnit {
640 type Owned = Self;
641
642 #[inline(always)]
643 fn inline_align(_context: fidl::encoding::Context) -> usize {
644 std::mem::align_of::<u32>()
645 }
646
647 #[inline(always)]
648 fn inline_size(_context: fidl::encoding::Context) -> usize {
649 std::mem::size_of::<u32>()
650 }
651
652 #[inline(always)]
653 fn encode_is_copy() -> bool {
654 false
655 }
656
657 #[inline(always)]
658 fn decode_is_copy() -> bool {
659 false
660 }
661 }
662
663 impl fidl::encoding::ValueTypeMarker for CoordinateUnit {
664 type Borrowed<'a> = Self;
665 #[inline(always)]
666 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
667 *value
668 }
669 }
670
671 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CoordinateUnit {
672 #[inline]
673 unsafe fn encode(
674 self,
675 encoder: &mut fidl::encoding::Encoder<'_, D>,
676 offset: usize,
677 _depth: fidl::encoding::Depth,
678 ) -> fidl::Result<()> {
679 encoder.debug_check_bounds::<Self>(offset);
680 encoder.write_num(self.into_primitive(), offset);
681 Ok(())
682 }
683 }
684
685 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CoordinateUnit {
686 #[inline(always)]
687 fn new_empty() -> Self {
688 Self::unknown()
689 }
690
691 #[inline]
692 unsafe fn decode(
693 &mut self,
694 decoder: &mut fidl::encoding::Decoder<'_, D>,
695 offset: usize,
696 _depth: fidl::encoding::Depth,
697 ) -> fidl::Result<()> {
698 decoder.debug_check_bounds::<Self>(offset);
699 let prim = decoder.read_num::<u32>(offset);
700
701 *self = Self::from_primitive_allow_unknown(prim);
702 Ok(())
703 }
704 }
705 unsafe impl fidl::encoding::TypeMarker for MouseButton {
706 type Owned = Self;
707
708 #[inline(always)]
709 fn inline_align(_context: fidl::encoding::Context) -> usize {
710 std::mem::align_of::<u32>()
711 }
712
713 #[inline(always)]
714 fn inline_size(_context: fidl::encoding::Context) -> usize {
715 std::mem::size_of::<u32>()
716 }
717
718 #[inline(always)]
719 fn encode_is_copy() -> bool {
720 false
721 }
722
723 #[inline(always)]
724 fn decode_is_copy() -> bool {
725 false
726 }
727 }
728
729 impl fidl::encoding::ValueTypeMarker for MouseButton {
730 type Borrowed<'a> = Self;
731 #[inline(always)]
732 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
733 *value
734 }
735 }
736
737 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for MouseButton {
738 #[inline]
739 unsafe fn encode(
740 self,
741 encoder: &mut fidl::encoding::Encoder<'_, D>,
742 offset: usize,
743 _depth: fidl::encoding::Depth,
744 ) -> fidl::Result<()> {
745 encoder.debug_check_bounds::<Self>(offset);
746 encoder.write_num(self.into_primitive(), offset);
747 Ok(())
748 }
749 }
750
751 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseButton {
752 #[inline(always)]
753 fn new_empty() -> Self {
754 Self::unknown()
755 }
756
757 #[inline]
758 unsafe fn decode(
759 &mut self,
760 decoder: &mut fidl::encoding::Decoder<'_, D>,
761 offset: usize,
762 _depth: fidl::encoding::Depth,
763 ) -> fidl::Result<()> {
764 decoder.debug_check_bounds::<Self>(offset);
765 let prim = decoder.read_num::<u32>(offset);
766
767 *self = Self::from_primitive_allow_unknown(prim);
768 Ok(())
769 }
770 }
771 unsafe impl fidl::encoding::TypeMarker for MouseEventPhase {
772 type Owned = Self;
773
774 #[inline(always)]
775 fn inline_align(_context: fidl::encoding::Context) -> usize {
776 std::mem::align_of::<u32>()
777 }
778
779 #[inline(always)]
780 fn inline_size(_context: fidl::encoding::Context) -> usize {
781 std::mem::size_of::<u32>()
782 }
783
784 #[inline(always)]
785 fn encode_is_copy() -> bool {
786 false
787 }
788
789 #[inline(always)]
790 fn decode_is_copy() -> bool {
791 false
792 }
793 }
794
795 impl fidl::encoding::ValueTypeMarker for MouseEventPhase {
796 type Borrowed<'a> = Self;
797 #[inline(always)]
798 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
799 *value
800 }
801 }
802
803 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
804 for MouseEventPhase
805 {
806 #[inline]
807 unsafe fn encode(
808 self,
809 encoder: &mut fidl::encoding::Encoder<'_, D>,
810 offset: usize,
811 _depth: fidl::encoding::Depth,
812 ) -> fidl::Result<()> {
813 encoder.debug_check_bounds::<Self>(offset);
814 encoder.write_num(self.into_primitive(), offset);
815 Ok(())
816 }
817 }
818
819 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseEventPhase {
820 #[inline(always)]
821 fn new_empty() -> Self {
822 Self::unknown()
823 }
824
825 #[inline]
826 unsafe fn decode(
827 &mut self,
828 decoder: &mut fidl::encoding::Decoder<'_, D>,
829 offset: usize,
830 _depth: fidl::encoding::Depth,
831 ) -> fidl::Result<()> {
832 decoder.debug_check_bounds::<Self>(offset);
833 let prim = decoder.read_num::<u32>(offset);
834
835 *self = Self::from_primitive_allow_unknown(prim);
836 Ok(())
837 }
838 }
839 unsafe impl fidl::encoding::TypeMarker for TestAppStatus {
840 type Owned = Self;
841
842 #[inline(always)]
843 fn inline_align(_context: fidl::encoding::Context) -> usize {
844 std::mem::align_of::<u16>()
845 }
846
847 #[inline(always)]
848 fn inline_size(_context: fidl::encoding::Context) -> usize {
849 std::mem::size_of::<u16>()
850 }
851
852 #[inline(always)]
853 fn encode_is_copy() -> bool {
854 false
855 }
856
857 #[inline(always)]
858 fn decode_is_copy() -> bool {
859 false
860 }
861 }
862
863 impl fidl::encoding::ValueTypeMarker for TestAppStatus {
864 type Borrowed<'a> = Self;
865 #[inline(always)]
866 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
867 *value
868 }
869 }
870
871 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TestAppStatus {
872 #[inline]
873 unsafe fn encode(
874 self,
875 encoder: &mut fidl::encoding::Encoder<'_, D>,
876 offset: usize,
877 _depth: fidl::encoding::Depth,
878 ) -> fidl::Result<()> {
879 encoder.debug_check_bounds::<Self>(offset);
880 encoder.write_num(self.into_primitive(), offset);
881 Ok(())
882 }
883 }
884
885 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TestAppStatus {
886 #[inline(always)]
887 fn new_empty() -> Self {
888 Self::unknown()
889 }
890
891 #[inline]
892 unsafe fn decode(
893 &mut self,
894 decoder: &mut fidl::encoding::Decoder<'_, D>,
895 offset: usize,
896 _depth: fidl::encoding::Depth,
897 ) -> fidl::Result<()> {
898 decoder.debug_check_bounds::<Self>(offset);
899 let prim = decoder.read_num::<u16>(offset);
900
901 *self = Self::from_primitive_allow_unknown(prim);
902 Ok(())
903 }
904 }
905
906 impl fidl::encoding::ValueTypeMarker for DisplayDimensions {
907 type Borrowed<'a> = &'a Self;
908 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
909 value
910 }
911 }
912
913 unsafe impl fidl::encoding::TypeMarker for DisplayDimensions {
914 type Owned = Self;
915
916 #[inline(always)]
917 fn inline_align(_context: fidl::encoding::Context) -> usize {
918 8
919 }
920
921 #[inline(always)]
922 fn inline_size(_context: fidl::encoding::Context) -> usize {
923 32
924 }
925 #[inline(always)]
926 fn encode_is_copy() -> bool {
927 true
928 }
929
930 #[inline(always)]
931 fn decode_is_copy() -> bool {
932 true
933 }
934 }
935
936 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisplayDimensions, D>
937 for &DisplayDimensions
938 {
939 #[inline]
940 unsafe fn encode(
941 self,
942 encoder: &mut fidl::encoding::Encoder<'_, D>,
943 offset: usize,
944 _depth: fidl::encoding::Depth,
945 ) -> fidl::Result<()> {
946 encoder.debug_check_bounds::<DisplayDimensions>(offset);
947 unsafe {
948 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
950 (buf_ptr as *mut DisplayDimensions)
951 .write_unaligned((self as *const DisplayDimensions).read());
952 }
955 Ok(())
956 }
957 }
958 unsafe impl<
959 D: fidl::encoding::ResourceDialect,
960 T0: fidl::encoding::Encode<i64, D>,
961 T1: fidl::encoding::Encode<i64, D>,
962 T2: fidl::encoding::Encode<i64, D>,
963 T3: fidl::encoding::Encode<i64, D>,
964 > fidl::encoding::Encode<DisplayDimensions, D> for (T0, T1, T2, T3)
965 {
966 #[inline]
967 unsafe fn encode(
968 self,
969 encoder: &mut fidl::encoding::Encoder<'_, D>,
970 offset: usize,
971 depth: fidl::encoding::Depth,
972 ) -> fidl::Result<()> {
973 encoder.debug_check_bounds::<DisplayDimensions>(offset);
974 self.0.encode(encoder, offset + 0, depth)?;
978 self.1.encode(encoder, offset + 8, depth)?;
979 self.2.encode(encoder, offset + 16, depth)?;
980 self.3.encode(encoder, offset + 24, depth)?;
981 Ok(())
982 }
983 }
984
985 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisplayDimensions {
986 #[inline(always)]
987 fn new_empty() -> Self {
988 Self {
989 min_x: fidl::new_empty!(i64, D),
990 min_y: fidl::new_empty!(i64, D),
991 max_x: fidl::new_empty!(i64, D),
992 max_y: fidl::new_empty!(i64, D),
993 }
994 }
995
996 #[inline]
997 unsafe fn decode(
998 &mut self,
999 decoder: &mut fidl::encoding::Decoder<'_, D>,
1000 offset: usize,
1001 _depth: fidl::encoding::Depth,
1002 ) -> fidl::Result<()> {
1003 decoder.debug_check_bounds::<Self>(offset);
1004 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1005 unsafe {
1008 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 32);
1009 }
1010 Ok(())
1011 }
1012 }
1013
1014 impl fidl::encoding::ValueTypeMarker for TestAppStatusListenerReportStatusRequest {
1015 type Borrowed<'a> = &'a Self;
1016 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1017 value
1018 }
1019 }
1020
1021 unsafe impl fidl::encoding::TypeMarker for TestAppStatusListenerReportStatusRequest {
1022 type Owned = Self;
1023
1024 #[inline(always)]
1025 fn inline_align(_context: fidl::encoding::Context) -> usize {
1026 2
1027 }
1028
1029 #[inline(always)]
1030 fn inline_size(_context: fidl::encoding::Context) -> usize {
1031 2
1032 }
1033 }
1034
1035 unsafe impl<D: fidl::encoding::ResourceDialect>
1036 fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D>
1037 for &TestAppStatusListenerReportStatusRequest
1038 {
1039 #[inline]
1040 unsafe fn encode(
1041 self,
1042 encoder: &mut fidl::encoding::Encoder<'_, D>,
1043 offset: usize,
1044 _depth: fidl::encoding::Depth,
1045 ) -> fidl::Result<()> {
1046 encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
1047 fidl::encoding::Encode::<TestAppStatusListenerReportStatusRequest, D>::encode(
1049 (<TestAppStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),),
1050 encoder,
1051 offset,
1052 _depth,
1053 )
1054 }
1055 }
1056 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TestAppStatus, D>>
1057 fidl::encoding::Encode<TestAppStatusListenerReportStatusRequest, D> for (T0,)
1058 {
1059 #[inline]
1060 unsafe fn encode(
1061 self,
1062 encoder: &mut fidl::encoding::Encoder<'_, D>,
1063 offset: usize,
1064 depth: fidl::encoding::Depth,
1065 ) -> fidl::Result<()> {
1066 encoder.debug_check_bounds::<TestAppStatusListenerReportStatusRequest>(offset);
1067 self.0.encode(encoder, offset + 0, depth)?;
1071 Ok(())
1072 }
1073 }
1074
1075 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1076 for TestAppStatusListenerReportStatusRequest
1077 {
1078 #[inline(always)]
1079 fn new_empty() -> Self {
1080 Self { status: fidl::new_empty!(TestAppStatus, D) }
1081 }
1082
1083 #[inline]
1084 unsafe fn decode(
1085 &mut self,
1086 decoder: &mut fidl::encoding::Decoder<'_, D>,
1087 offset: usize,
1088 _depth: fidl::encoding::Depth,
1089 ) -> fidl::Result<()> {
1090 decoder.debug_check_bounds::<Self>(offset);
1091 fidl::decode!(TestAppStatus, D, &mut self.status, decoder, offset + 0, _depth)?;
1093 Ok(())
1094 }
1095 }
1096
1097 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTouchEventRequest {
1098 type Borrowed<'a> = &'a Self;
1099 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1100 value
1101 }
1102 }
1103
1104 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTouchEventRequest {
1105 type Owned = Self;
1106
1107 #[inline(always)]
1108 fn inline_align(_context: fidl::encoding::Context) -> usize {
1109 8
1110 }
1111
1112 #[inline(always)]
1113 fn inline_size(_context: fidl::encoding::Context) -> usize {
1114 16
1115 }
1116 }
1117
1118 unsafe impl<D: fidl::encoding::ResourceDialect>
1119 fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D>
1120 for &TouchScreenSimulateTouchEventRequest
1121 {
1122 #[inline]
1123 unsafe fn encode(
1124 self,
1125 encoder: &mut fidl::encoding::Encoder<'_, D>,
1126 offset: usize,
1127 _depth: fidl::encoding::Depth,
1128 ) -> fidl::Result<()> {
1129 encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
1130 fidl::encoding::Encode::<TouchScreenSimulateTouchEventRequest, D>::encode(
1132 (<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
1133 encoder,
1134 offset,
1135 _depth,
1136 )
1137 }
1138 }
1139 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TouchInputReport, D>>
1140 fidl::encoding::Encode<TouchScreenSimulateTouchEventRequest, D> for (T0,)
1141 {
1142 #[inline]
1143 unsafe fn encode(
1144 self,
1145 encoder: &mut fidl::encoding::Encoder<'_, D>,
1146 offset: usize,
1147 depth: fidl::encoding::Depth,
1148 ) -> fidl::Result<()> {
1149 encoder.debug_check_bounds::<TouchScreenSimulateTouchEventRequest>(offset);
1150 self.0.encode(encoder, offset + 0, depth)?;
1154 Ok(())
1155 }
1156 }
1157
1158 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1159 for TouchScreenSimulateTouchEventRequest
1160 {
1161 #[inline(always)]
1162 fn new_empty() -> Self {
1163 Self { report: fidl::new_empty!(TouchInputReport, D) }
1164 }
1165
1166 #[inline]
1167 unsafe fn decode(
1168 &mut self,
1169 decoder: &mut fidl::encoding::Decoder<'_, D>,
1170 offset: usize,
1171 _depth: fidl::encoding::Depth,
1172 ) -> fidl::Result<()> {
1173 decoder.debug_check_bounds::<Self>(offset);
1174 fidl::decode!(TouchInputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
1176 Ok(())
1177 }
1178 }
1179
1180 impl ContactInputReport {
1181 #[inline(always)]
1182 fn max_ordinal_present(&self) -> u64 {
1183 if let Some(_) = self.position_y {
1184 return 3;
1185 }
1186 if let Some(_) = self.position_x {
1187 return 2;
1188 }
1189 if let Some(_) = self.contact_id {
1190 return 1;
1191 }
1192 0
1193 }
1194 }
1195
1196 impl fidl::encoding::ValueTypeMarker for ContactInputReport {
1197 type Borrowed<'a> = &'a Self;
1198 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1199 value
1200 }
1201 }
1202
1203 unsafe impl fidl::encoding::TypeMarker for ContactInputReport {
1204 type Owned = Self;
1205
1206 #[inline(always)]
1207 fn inline_align(_context: fidl::encoding::Context) -> usize {
1208 8
1209 }
1210
1211 #[inline(always)]
1212 fn inline_size(_context: fidl::encoding::Context) -> usize {
1213 16
1214 }
1215 }
1216
1217 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContactInputReport, D>
1218 for &ContactInputReport
1219 {
1220 unsafe fn encode(
1221 self,
1222 encoder: &mut fidl::encoding::Encoder<'_, D>,
1223 offset: usize,
1224 mut depth: fidl::encoding::Depth,
1225 ) -> fidl::Result<()> {
1226 encoder.debug_check_bounds::<ContactInputReport>(offset);
1227 let max_ordinal: u64 = self.max_ordinal_present();
1229 encoder.write_num(max_ordinal, offset);
1230 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1231 if max_ordinal == 0 {
1233 return Ok(());
1234 }
1235 depth.increment()?;
1236 let envelope_size = 8;
1237 let bytes_len = max_ordinal as usize * envelope_size;
1238 #[allow(unused_variables)]
1239 let offset = encoder.out_of_line_offset(bytes_len);
1240 let mut _prev_end_offset: usize = 0;
1241 if 1 > max_ordinal {
1242 return Ok(());
1243 }
1244
1245 let cur_offset: usize = (1 - 1) * envelope_size;
1248
1249 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1251
1252 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1257 self.contact_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1258 encoder,
1259 offset + cur_offset,
1260 depth,
1261 )?;
1262
1263 _prev_end_offset = cur_offset + envelope_size;
1264 if 2 > max_ordinal {
1265 return Ok(());
1266 }
1267
1268 let cur_offset: usize = (2 - 1) * envelope_size;
1271
1272 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1274
1275 fidl::encoding::encode_in_envelope_optional::<i64, D>(
1280 self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1281 encoder,
1282 offset + cur_offset,
1283 depth,
1284 )?;
1285
1286 _prev_end_offset = cur_offset + envelope_size;
1287 if 3 > max_ordinal {
1288 return Ok(());
1289 }
1290
1291 let cur_offset: usize = (3 - 1) * envelope_size;
1294
1295 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1297
1298 fidl::encoding::encode_in_envelope_optional::<i64, D>(
1303 self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1304 encoder,
1305 offset + cur_offset,
1306 depth,
1307 )?;
1308
1309 _prev_end_offset = cur_offset + envelope_size;
1310
1311 Ok(())
1312 }
1313 }
1314
1315 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContactInputReport {
1316 #[inline(always)]
1317 fn new_empty() -> Self {
1318 Self::default()
1319 }
1320
1321 unsafe fn decode(
1322 &mut self,
1323 decoder: &mut fidl::encoding::Decoder<'_, D>,
1324 offset: usize,
1325 mut depth: fidl::encoding::Depth,
1326 ) -> fidl::Result<()> {
1327 decoder.debug_check_bounds::<Self>(offset);
1328 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1329 None => return Err(fidl::Error::NotNullable),
1330 Some(len) => len,
1331 };
1332 if len == 0 {
1334 return Ok(());
1335 };
1336 depth.increment()?;
1337 let envelope_size = 8;
1338 let bytes_len = len * envelope_size;
1339 let offset = decoder.out_of_line_offset(bytes_len)?;
1340 let mut _next_ordinal_to_read = 0;
1342 let mut next_offset = offset;
1343 let end_offset = offset + bytes_len;
1344 _next_ordinal_to_read += 1;
1345 if next_offset >= end_offset {
1346 return Ok(());
1347 }
1348
1349 while _next_ordinal_to_read < 1 {
1351 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1352 _next_ordinal_to_read += 1;
1353 next_offset += envelope_size;
1354 }
1355
1356 let next_out_of_line = decoder.next_out_of_line();
1357 let handles_before = decoder.remaining_handles();
1358 if let Some((inlined, num_bytes, num_handles)) =
1359 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1360 {
1361 let member_inline_size =
1362 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1363 if inlined != (member_inline_size <= 4) {
1364 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1365 }
1366 let inner_offset;
1367 let mut inner_depth = depth.clone();
1368 if inlined {
1369 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1370 inner_offset = next_offset;
1371 } else {
1372 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1373 inner_depth.increment()?;
1374 }
1375 let val_ref = self.contact_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1376 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1377 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1378 {
1379 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1380 }
1381 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1382 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1383 }
1384 }
1385
1386 next_offset += envelope_size;
1387 _next_ordinal_to_read += 1;
1388 if next_offset >= end_offset {
1389 return Ok(());
1390 }
1391
1392 while _next_ordinal_to_read < 2 {
1394 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1395 _next_ordinal_to_read += 1;
1396 next_offset += envelope_size;
1397 }
1398
1399 let next_out_of_line = decoder.next_out_of_line();
1400 let handles_before = decoder.remaining_handles();
1401 if let Some((inlined, num_bytes, num_handles)) =
1402 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1403 {
1404 let member_inline_size =
1405 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1406 if inlined != (member_inline_size <= 4) {
1407 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1408 }
1409 let inner_offset;
1410 let mut inner_depth = depth.clone();
1411 if inlined {
1412 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1413 inner_offset = next_offset;
1414 } else {
1415 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1416 inner_depth.increment()?;
1417 }
1418 let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
1419 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1420 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1421 {
1422 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1423 }
1424 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1425 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1426 }
1427 }
1428
1429 next_offset += envelope_size;
1430 _next_ordinal_to_read += 1;
1431 if next_offset >= end_offset {
1432 return Ok(());
1433 }
1434
1435 while _next_ordinal_to_read < 3 {
1437 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1438 _next_ordinal_to_read += 1;
1439 next_offset += envelope_size;
1440 }
1441
1442 let next_out_of_line = decoder.next_out_of_line();
1443 let handles_before = decoder.remaining_handles();
1444 if let Some((inlined, num_bytes, num_handles)) =
1445 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1446 {
1447 let member_inline_size =
1448 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1449 if inlined != (member_inline_size <= 4) {
1450 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1451 }
1452 let inner_offset;
1453 let mut inner_depth = depth.clone();
1454 if inlined {
1455 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1456 inner_offset = next_offset;
1457 } else {
1458 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1459 inner_depth.increment()?;
1460 }
1461 let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
1462 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1463 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1464 {
1465 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1466 }
1467 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1468 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1469 }
1470 }
1471
1472 next_offset += envelope_size;
1473
1474 while next_offset < end_offset {
1476 _next_ordinal_to_read += 1;
1477 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1478 next_offset += envelope_size;
1479 }
1480
1481 Ok(())
1482 }
1483 }
1484
1485 impl KeyboardInputListenerReportTextInputRequest {
1486 #[inline(always)]
1487 fn max_ordinal_present(&self) -> u64 {
1488 if let Some(_) = self.device_id {
1489 return 3;
1490 }
1491 if let Some(_) = self.non_printable {
1492 return 2;
1493 }
1494 if let Some(_) = self.text {
1495 return 1;
1496 }
1497 0
1498 }
1499 }
1500
1501 impl fidl::encoding::ValueTypeMarker for KeyboardInputListenerReportTextInputRequest {
1502 type Borrowed<'a> = &'a Self;
1503 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1504 value
1505 }
1506 }
1507
1508 unsafe impl fidl::encoding::TypeMarker for KeyboardInputListenerReportTextInputRequest {
1509 type Owned = Self;
1510
1511 #[inline(always)]
1512 fn inline_align(_context: fidl::encoding::Context) -> usize {
1513 8
1514 }
1515
1516 #[inline(always)]
1517 fn inline_size(_context: fidl::encoding::Context) -> usize {
1518 16
1519 }
1520 }
1521
1522 unsafe impl<D: fidl::encoding::ResourceDialect>
1523 fidl::encoding::Encode<KeyboardInputListenerReportTextInputRequest, D>
1524 for &KeyboardInputListenerReportTextInputRequest
1525 {
1526 unsafe fn encode(
1527 self,
1528 encoder: &mut fidl::encoding::Encoder<'_, D>,
1529 offset: usize,
1530 mut depth: fidl::encoding::Depth,
1531 ) -> fidl::Result<()> {
1532 encoder.debug_check_bounds::<KeyboardInputListenerReportTextInputRequest>(offset);
1533 let max_ordinal: u64 = self.max_ordinal_present();
1535 encoder.write_num(max_ordinal, offset);
1536 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1537 if max_ordinal == 0 {
1539 return Ok(());
1540 }
1541 depth.increment()?;
1542 let envelope_size = 8;
1543 let bytes_len = max_ordinal as usize * envelope_size;
1544 #[allow(unused_variables)]
1545 let offset = encoder.out_of_line_offset(bytes_len);
1546 let mut _prev_end_offset: usize = 0;
1547 if 1 > max_ordinal {
1548 return Ok(());
1549 }
1550
1551 let cur_offset: usize = (1 - 1) * envelope_size;
1554
1555 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1557
1558 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
1563 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
1564 encoder, offset + cur_offset, depth
1565 )?;
1566
1567 _prev_end_offset = cur_offset + envelope_size;
1568 if 2 > max_ordinal {
1569 return Ok(());
1570 }
1571
1572 let cur_offset: usize = (2 - 1) * envelope_size;
1575
1576 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1578
1579 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_input3_common::NonPrintableKey, D>(
1584 self.non_printable.as_ref().map(<fidl_fuchsia_ui_input3_common::NonPrintableKey as fidl::encoding::ValueTypeMarker>::borrow),
1585 encoder, offset + cur_offset, depth
1586 )?;
1587
1588 _prev_end_offset = cur_offset + envelope_size;
1589 if 3 > max_ordinal {
1590 return Ok(());
1591 }
1592
1593 let cur_offset: usize = (3 - 1) * envelope_size;
1596
1597 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1599
1600 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1605 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1606 encoder,
1607 offset + cur_offset,
1608 depth,
1609 )?;
1610
1611 _prev_end_offset = cur_offset + envelope_size;
1612
1613 Ok(())
1614 }
1615 }
1616
1617 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1618 for KeyboardInputListenerReportTextInputRequest
1619 {
1620 #[inline(always)]
1621 fn new_empty() -> Self {
1622 Self::default()
1623 }
1624
1625 unsafe fn decode(
1626 &mut self,
1627 decoder: &mut fidl::encoding::Decoder<'_, D>,
1628 offset: usize,
1629 mut depth: fidl::encoding::Depth,
1630 ) -> fidl::Result<()> {
1631 decoder.debug_check_bounds::<Self>(offset);
1632 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1633 None => return Err(fidl::Error::NotNullable),
1634 Some(len) => len,
1635 };
1636 if len == 0 {
1638 return Ok(());
1639 };
1640 depth.increment()?;
1641 let envelope_size = 8;
1642 let bytes_len = len * envelope_size;
1643 let offset = decoder.out_of_line_offset(bytes_len)?;
1644 let mut _next_ordinal_to_read = 0;
1646 let mut next_offset = offset;
1647 let end_offset = offset + bytes_len;
1648 _next_ordinal_to_read += 1;
1649 if next_offset >= end_offset {
1650 return Ok(());
1651 }
1652
1653 while _next_ordinal_to_read < 1 {
1655 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1656 _next_ordinal_to_read += 1;
1657 next_offset += envelope_size;
1658 }
1659
1660 let next_out_of_line = decoder.next_out_of_line();
1661 let handles_before = decoder.remaining_handles();
1662 if let Some((inlined, num_bytes, num_handles)) =
1663 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1664 {
1665 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1666 if inlined != (member_inline_size <= 4) {
1667 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1668 }
1669 let inner_offset;
1670 let mut inner_depth = depth.clone();
1671 if inlined {
1672 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1673 inner_offset = next_offset;
1674 } else {
1675 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1676 inner_depth.increment()?;
1677 }
1678 let val_ref = self.text.get_or_insert_with(|| {
1679 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
1680 });
1681 fidl::decode!(
1682 fidl::encoding::BoundedString<1024>,
1683 D,
1684 val_ref,
1685 decoder,
1686 inner_offset,
1687 inner_depth
1688 )?;
1689 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1690 {
1691 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1692 }
1693 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1694 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1695 }
1696 }
1697
1698 next_offset += envelope_size;
1699 _next_ordinal_to_read += 1;
1700 if next_offset >= end_offset {
1701 return Ok(());
1702 }
1703
1704 while _next_ordinal_to_read < 2 {
1706 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1707 _next_ordinal_to_read += 1;
1708 next_offset += envelope_size;
1709 }
1710
1711 let next_out_of_line = decoder.next_out_of_line();
1712 let handles_before = decoder.remaining_handles();
1713 if let Some((inlined, num_bytes, num_handles)) =
1714 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1715 {
1716 let member_inline_size = <fidl_fuchsia_ui_input3_common::NonPrintableKey as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1717 if inlined != (member_inline_size <= 4) {
1718 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1719 }
1720 let inner_offset;
1721 let mut inner_depth = depth.clone();
1722 if inlined {
1723 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1724 inner_offset = next_offset;
1725 } else {
1726 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1727 inner_depth.increment()?;
1728 }
1729 let val_ref = self.non_printable.get_or_insert_with(|| {
1730 fidl::new_empty!(fidl_fuchsia_ui_input3_common::NonPrintableKey, D)
1731 });
1732 fidl::decode!(
1733 fidl_fuchsia_ui_input3_common::NonPrintableKey,
1734 D,
1735 val_ref,
1736 decoder,
1737 inner_offset,
1738 inner_depth
1739 )?;
1740 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1741 {
1742 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1743 }
1744 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1745 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1746 }
1747 }
1748
1749 next_offset += envelope_size;
1750 _next_ordinal_to_read += 1;
1751 if next_offset >= end_offset {
1752 return Ok(());
1753 }
1754
1755 while _next_ordinal_to_read < 3 {
1757 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1758 _next_ordinal_to_read += 1;
1759 next_offset += envelope_size;
1760 }
1761
1762 let next_out_of_line = decoder.next_out_of_line();
1763 let handles_before = decoder.remaining_handles();
1764 if let Some((inlined, num_bytes, num_handles)) =
1765 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1766 {
1767 let member_inline_size =
1768 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1769 if inlined != (member_inline_size <= 4) {
1770 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1771 }
1772 let inner_offset;
1773 let mut inner_depth = depth.clone();
1774 if inlined {
1775 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1776 inner_offset = next_offset;
1777 } else {
1778 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1779 inner_depth.increment()?;
1780 }
1781 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1782 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1783 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1784 {
1785 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1786 }
1787 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1788 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1789 }
1790 }
1791
1792 next_offset += envelope_size;
1793
1794 while next_offset < end_offset {
1796 _next_ordinal_to_read += 1;
1797 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1798 next_offset += envelope_size;
1799 }
1800
1801 Ok(())
1802 }
1803 }
1804
1805 impl KeyboardSimulateKeyEventRequest {
1806 #[inline(always)]
1807 fn max_ordinal_present(&self) -> u64 {
1808 if let Some(_) = self.pressed_keys {
1809 return 1;
1810 }
1811 0
1812 }
1813 }
1814
1815 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyEventRequest {
1816 type Borrowed<'a> = &'a Self;
1817 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1818 value
1819 }
1820 }
1821
1822 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyEventRequest {
1823 type Owned = Self;
1824
1825 #[inline(always)]
1826 fn inline_align(_context: fidl::encoding::Context) -> usize {
1827 8
1828 }
1829
1830 #[inline(always)]
1831 fn inline_size(_context: fidl::encoding::Context) -> usize {
1832 16
1833 }
1834 }
1835
1836 unsafe impl<D: fidl::encoding::ResourceDialect>
1837 fidl::encoding::Encode<KeyboardSimulateKeyEventRequest, D>
1838 for &KeyboardSimulateKeyEventRequest
1839 {
1840 unsafe fn encode(
1841 self,
1842 encoder: &mut fidl::encoding::Encoder<'_, D>,
1843 offset: usize,
1844 mut depth: fidl::encoding::Depth,
1845 ) -> fidl::Result<()> {
1846 encoder.debug_check_bounds::<KeyboardSimulateKeyEventRequest>(offset);
1847 let max_ordinal: u64 = self.max_ordinal_present();
1849 encoder.write_num(max_ordinal, offset);
1850 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1851 if max_ordinal == 0 {
1853 return Ok(());
1854 }
1855 depth.increment()?;
1856 let envelope_size = 8;
1857 let bytes_len = max_ordinal as usize * envelope_size;
1858 #[allow(unused_variables)]
1859 let offset = encoder.out_of_line_offset(bytes_len);
1860 let mut _prev_end_offset: usize = 0;
1861 if 1 > max_ordinal {
1862 return Ok(());
1863 }
1864
1865 let cur_offset: usize = (1 - 1) * envelope_size;
1868
1869 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1871
1872 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input_common::Key, 256>, D>(
1877 self.pressed_keys.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input_common::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
1878 encoder, offset + cur_offset, depth
1879 )?;
1880
1881 _prev_end_offset = cur_offset + envelope_size;
1882
1883 Ok(())
1884 }
1885 }
1886
1887 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1888 for KeyboardSimulateKeyEventRequest
1889 {
1890 #[inline(always)]
1891 fn new_empty() -> Self {
1892 Self::default()
1893 }
1894
1895 unsafe fn decode(
1896 &mut self,
1897 decoder: &mut fidl::encoding::Decoder<'_, D>,
1898 offset: usize,
1899 mut depth: fidl::encoding::Depth,
1900 ) -> fidl::Result<()> {
1901 decoder.debug_check_bounds::<Self>(offset);
1902 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1903 None => return Err(fidl::Error::NotNullable),
1904 Some(len) => len,
1905 };
1906 if len == 0 {
1908 return Ok(());
1909 };
1910 depth.increment()?;
1911 let envelope_size = 8;
1912 let bytes_len = len * envelope_size;
1913 let offset = decoder.out_of_line_offset(bytes_len)?;
1914 let mut _next_ordinal_to_read = 0;
1916 let mut next_offset = offset;
1917 let end_offset = offset + bytes_len;
1918 _next_ordinal_to_read += 1;
1919 if next_offset >= end_offset {
1920 return Ok(());
1921 }
1922
1923 while _next_ordinal_to_read < 1 {
1925 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1926 _next_ordinal_to_read += 1;
1927 next_offset += envelope_size;
1928 }
1929
1930 let next_out_of_line = decoder.next_out_of_line();
1931 let handles_before = decoder.remaining_handles();
1932 if let Some((inlined, num_bytes, num_handles)) =
1933 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1934 {
1935 let member_inline_size = <fidl::encoding::Vector<
1936 fidl_fuchsia_input_common::Key,
1937 256,
1938 > as fidl::encoding::TypeMarker>::inline_size(
1939 decoder.context
1940 );
1941 if inlined != (member_inline_size <= 4) {
1942 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1943 }
1944 let inner_offset;
1945 let mut inner_depth = depth.clone();
1946 if inlined {
1947 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1948 inner_offset = next_offset;
1949 } else {
1950 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1951 inner_depth.increment()?;
1952 }
1953 let val_ref =
1954 self.pressed_keys.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input_common::Key, 256>, D));
1955 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input_common::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
1956 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1957 {
1958 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1959 }
1960 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1961 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1962 }
1963 }
1964
1965 next_offset += envelope_size;
1966
1967 while next_offset < end_offset {
1969 _next_ordinal_to_read += 1;
1970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1971 next_offset += envelope_size;
1972 }
1973
1974 Ok(())
1975 }
1976 }
1977
1978 impl KeyboardSimulateKeyPressRequest {
1979 #[inline(always)]
1980 fn max_ordinal_present(&self) -> u64 {
1981 if let Some(_) = self.key_code {
1982 return 1;
1983 }
1984 0
1985 }
1986 }
1987
1988 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateKeyPressRequest {
1989 type Borrowed<'a> = &'a Self;
1990 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1991 value
1992 }
1993 }
1994
1995 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateKeyPressRequest {
1996 type Owned = Self;
1997
1998 #[inline(always)]
1999 fn inline_align(_context: fidl::encoding::Context) -> usize {
2000 8
2001 }
2002
2003 #[inline(always)]
2004 fn inline_size(_context: fidl::encoding::Context) -> usize {
2005 16
2006 }
2007 }
2008
2009 unsafe impl<D: fidl::encoding::ResourceDialect>
2010 fidl::encoding::Encode<KeyboardSimulateKeyPressRequest, D>
2011 for &KeyboardSimulateKeyPressRequest
2012 {
2013 unsafe fn encode(
2014 self,
2015 encoder: &mut fidl::encoding::Encoder<'_, D>,
2016 offset: usize,
2017 mut depth: fidl::encoding::Depth,
2018 ) -> fidl::Result<()> {
2019 encoder.debug_check_bounds::<KeyboardSimulateKeyPressRequest>(offset);
2020 let max_ordinal: u64 = self.max_ordinal_present();
2022 encoder.write_num(max_ordinal, offset);
2023 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2024 if max_ordinal == 0 {
2026 return Ok(());
2027 }
2028 depth.increment()?;
2029 let envelope_size = 8;
2030 let bytes_len = max_ordinal as usize * envelope_size;
2031 #[allow(unused_variables)]
2032 let offset = encoder.out_of_line_offset(bytes_len);
2033 let mut _prev_end_offset: usize = 0;
2034 if 1 > max_ordinal {
2035 return Ok(());
2036 }
2037
2038 let cur_offset: usize = (1 - 1) * envelope_size;
2041
2042 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2044
2045 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_common::Key, D>(
2050 self.key_code.as_ref().map(
2051 <fidl_fuchsia_input_common::Key as fidl::encoding::ValueTypeMarker>::borrow,
2052 ),
2053 encoder,
2054 offset + cur_offset,
2055 depth,
2056 )?;
2057
2058 _prev_end_offset = cur_offset + envelope_size;
2059
2060 Ok(())
2061 }
2062 }
2063
2064 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2065 for KeyboardSimulateKeyPressRequest
2066 {
2067 #[inline(always)]
2068 fn new_empty() -> Self {
2069 Self::default()
2070 }
2071
2072 unsafe fn decode(
2073 &mut self,
2074 decoder: &mut fidl::encoding::Decoder<'_, D>,
2075 offset: usize,
2076 mut depth: fidl::encoding::Depth,
2077 ) -> fidl::Result<()> {
2078 decoder.debug_check_bounds::<Self>(offset);
2079 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2080 None => return Err(fidl::Error::NotNullable),
2081 Some(len) => len,
2082 };
2083 if len == 0 {
2085 return Ok(());
2086 };
2087 depth.increment()?;
2088 let envelope_size = 8;
2089 let bytes_len = len * envelope_size;
2090 let offset = decoder.out_of_line_offset(bytes_len)?;
2091 let mut _next_ordinal_to_read = 0;
2093 let mut next_offset = offset;
2094 let end_offset = offset + bytes_len;
2095 _next_ordinal_to_read += 1;
2096 if next_offset >= end_offset {
2097 return Ok(());
2098 }
2099
2100 while _next_ordinal_to_read < 1 {
2102 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2103 _next_ordinal_to_read += 1;
2104 next_offset += envelope_size;
2105 }
2106
2107 let next_out_of_line = decoder.next_out_of_line();
2108 let handles_before = decoder.remaining_handles();
2109 if let Some((inlined, num_bytes, num_handles)) =
2110 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2111 {
2112 let member_inline_size =
2113 <fidl_fuchsia_input_common::Key as fidl::encoding::TypeMarker>::inline_size(
2114 decoder.context,
2115 );
2116 if inlined != (member_inline_size <= 4) {
2117 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2118 }
2119 let inner_offset;
2120 let mut inner_depth = depth.clone();
2121 if inlined {
2122 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2123 inner_offset = next_offset;
2124 } else {
2125 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2126 inner_depth.increment()?;
2127 }
2128 let val_ref = self
2129 .key_code
2130 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input_common::Key, D));
2131 fidl::decode!(
2132 fidl_fuchsia_input_common::Key,
2133 D,
2134 val_ref,
2135 decoder,
2136 inner_offset,
2137 inner_depth
2138 )?;
2139 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2140 {
2141 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2142 }
2143 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2144 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2145 }
2146 }
2147
2148 next_offset += envelope_size;
2149
2150 while next_offset < end_offset {
2152 _next_ordinal_to_read += 1;
2153 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2154 next_offset += envelope_size;
2155 }
2156
2157 Ok(())
2158 }
2159 }
2160
2161 impl KeyboardSimulateUsAsciiTextEntryRequest {
2162 #[inline(always)]
2163 fn max_ordinal_present(&self) -> u64 {
2164 if let Some(_) = self.text {
2165 return 1;
2166 }
2167 0
2168 }
2169 }
2170
2171 impl fidl::encoding::ValueTypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
2172 type Borrowed<'a> = &'a Self;
2173 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2174 value
2175 }
2176 }
2177
2178 unsafe impl fidl::encoding::TypeMarker for KeyboardSimulateUsAsciiTextEntryRequest {
2179 type Owned = Self;
2180
2181 #[inline(always)]
2182 fn inline_align(_context: fidl::encoding::Context) -> usize {
2183 8
2184 }
2185
2186 #[inline(always)]
2187 fn inline_size(_context: fidl::encoding::Context) -> usize {
2188 16
2189 }
2190 }
2191
2192 unsafe impl<D: fidl::encoding::ResourceDialect>
2193 fidl::encoding::Encode<KeyboardSimulateUsAsciiTextEntryRequest, D>
2194 for &KeyboardSimulateUsAsciiTextEntryRequest
2195 {
2196 unsafe fn encode(
2197 self,
2198 encoder: &mut fidl::encoding::Encoder<'_, D>,
2199 offset: usize,
2200 mut depth: fidl::encoding::Depth,
2201 ) -> fidl::Result<()> {
2202 encoder.debug_check_bounds::<KeyboardSimulateUsAsciiTextEntryRequest>(offset);
2203 let max_ordinal: u64 = self.max_ordinal_present();
2205 encoder.write_num(max_ordinal, offset);
2206 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2207 if max_ordinal == 0 {
2209 return Ok(());
2210 }
2211 depth.increment()?;
2212 let envelope_size = 8;
2213 let bytes_len = max_ordinal as usize * envelope_size;
2214 #[allow(unused_variables)]
2215 let offset = encoder.out_of_line_offset(bytes_len);
2216 let mut _prev_end_offset: usize = 0;
2217 if 1 > max_ordinal {
2218 return Ok(());
2219 }
2220
2221 let cur_offset: usize = (1 - 1) * envelope_size;
2224
2225 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2227
2228 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
2233 self.text.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
2234 encoder, offset + cur_offset, depth
2235 )?;
2236
2237 _prev_end_offset = cur_offset + envelope_size;
2238
2239 Ok(())
2240 }
2241 }
2242
2243 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2244 for KeyboardSimulateUsAsciiTextEntryRequest
2245 {
2246 #[inline(always)]
2247 fn new_empty() -> Self {
2248 Self::default()
2249 }
2250
2251 unsafe fn decode(
2252 &mut self,
2253 decoder: &mut fidl::encoding::Decoder<'_, D>,
2254 offset: usize,
2255 mut depth: fidl::encoding::Depth,
2256 ) -> fidl::Result<()> {
2257 decoder.debug_check_bounds::<Self>(offset);
2258 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2259 None => return Err(fidl::Error::NotNullable),
2260 Some(len) => len,
2261 };
2262 if len == 0 {
2264 return Ok(());
2265 };
2266 depth.increment()?;
2267 let envelope_size = 8;
2268 let bytes_len = len * envelope_size;
2269 let offset = decoder.out_of_line_offset(bytes_len)?;
2270 let mut _next_ordinal_to_read = 0;
2272 let mut next_offset = offset;
2273 let end_offset = offset + bytes_len;
2274 _next_ordinal_to_read += 1;
2275 if next_offset >= end_offset {
2276 return Ok(());
2277 }
2278
2279 while _next_ordinal_to_read < 1 {
2281 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2282 _next_ordinal_to_read += 1;
2283 next_offset += envelope_size;
2284 }
2285
2286 let next_out_of_line = decoder.next_out_of_line();
2287 let handles_before = decoder.remaining_handles();
2288 if let Some((inlined, num_bytes, num_handles)) =
2289 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2290 {
2291 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2292 if inlined != (member_inline_size <= 4) {
2293 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2294 }
2295 let inner_offset;
2296 let mut inner_depth = depth.clone();
2297 if inlined {
2298 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2299 inner_offset = next_offset;
2300 } else {
2301 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2302 inner_depth.increment()?;
2303 }
2304 let val_ref = self.text.get_or_insert_with(|| {
2305 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
2306 });
2307 fidl::decode!(
2308 fidl::encoding::BoundedString<1024>,
2309 D,
2310 val_ref,
2311 decoder,
2312 inner_offset,
2313 inner_depth
2314 )?;
2315 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2316 {
2317 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2318 }
2319 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2320 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2321 }
2322 }
2323
2324 next_offset += envelope_size;
2325
2326 while next_offset < end_offset {
2328 _next_ordinal_to_read += 1;
2329 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2330 next_offset += envelope_size;
2331 }
2332
2333 Ok(())
2334 }
2335 }
2336
2337 impl MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2338 #[inline(always)]
2339 fn max_ordinal_present(&self) -> u64 {
2340 if let Some(_) = self.delay {
2341 return 2;
2342 }
2343 if let Some(_) = self.button {
2344 return 1;
2345 }
2346 0
2347 }
2348 }
2349
2350 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2351 type Borrowed<'a> = &'a Self;
2352 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2353 value
2354 }
2355 }
2356
2357 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceScheduleSimulateButtonPressRequest {
2358 type Owned = Self;
2359
2360 #[inline(always)]
2361 fn inline_align(_context: fidl::encoding::Context) -> usize {
2362 8
2363 }
2364
2365 #[inline(always)]
2366 fn inline_size(_context: fidl::encoding::Context) -> usize {
2367 16
2368 }
2369 }
2370
2371 unsafe impl<D: fidl::encoding::ResourceDialect>
2372 fidl::encoding::Encode<MediaButtonsDeviceScheduleSimulateButtonPressRequest, D>
2373 for &MediaButtonsDeviceScheduleSimulateButtonPressRequest
2374 {
2375 unsafe fn encode(
2376 self,
2377 encoder: &mut fidl::encoding::Encoder<'_, D>,
2378 offset: usize,
2379 mut depth: fidl::encoding::Depth,
2380 ) -> fidl::Result<()> {
2381 encoder
2382 .debug_check_bounds::<MediaButtonsDeviceScheduleSimulateButtonPressRequest>(offset);
2383 let max_ordinal: u64 = self.max_ordinal_present();
2385 encoder.write_num(max_ordinal, offset);
2386 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2387 if max_ordinal == 0 {
2389 return Ok(());
2390 }
2391 depth.increment()?;
2392 let envelope_size = 8;
2393 let bytes_len = max_ordinal as usize * envelope_size;
2394 #[allow(unused_variables)]
2395 let offset = encoder.out_of_line_offset(bytes_len);
2396 let mut _prev_end_offset: usize = 0;
2397 if 1 > max_ordinal {
2398 return Ok(());
2399 }
2400
2401 let cur_offset: usize = (1 - 1) * envelope_size;
2404
2405 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2407
2408 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_common::ConsumerControlButton, D>(
2413 self.button.as_ref().map(<fidl_fuchsia_input_common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2414 encoder, offset + cur_offset, depth
2415 )?;
2416
2417 _prev_end_offset = cur_offset + envelope_size;
2418 if 2 > max_ordinal {
2419 return Ok(());
2420 }
2421
2422 let cur_offset: usize = (2 - 1) * envelope_size;
2425
2426 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2428
2429 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2434 self.delay.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2435 encoder,
2436 offset + cur_offset,
2437 depth,
2438 )?;
2439
2440 _prev_end_offset = cur_offset + envelope_size;
2441
2442 Ok(())
2443 }
2444 }
2445
2446 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2447 for MediaButtonsDeviceScheduleSimulateButtonPressRequest
2448 {
2449 #[inline(always)]
2450 fn new_empty() -> Self {
2451 Self::default()
2452 }
2453
2454 unsafe fn decode(
2455 &mut self,
2456 decoder: &mut fidl::encoding::Decoder<'_, D>,
2457 offset: usize,
2458 mut depth: fidl::encoding::Depth,
2459 ) -> fidl::Result<()> {
2460 decoder.debug_check_bounds::<Self>(offset);
2461 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2462 None => return Err(fidl::Error::NotNullable),
2463 Some(len) => len,
2464 };
2465 if len == 0 {
2467 return Ok(());
2468 };
2469 depth.increment()?;
2470 let envelope_size = 8;
2471 let bytes_len = len * envelope_size;
2472 let offset = decoder.out_of_line_offset(bytes_len)?;
2473 let mut _next_ordinal_to_read = 0;
2475 let mut next_offset = offset;
2476 let end_offset = offset + bytes_len;
2477 _next_ordinal_to_read += 1;
2478 if next_offset >= end_offset {
2479 return Ok(());
2480 }
2481
2482 while _next_ordinal_to_read < 1 {
2484 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2485 _next_ordinal_to_read += 1;
2486 next_offset += envelope_size;
2487 }
2488
2489 let next_out_of_line = decoder.next_out_of_line();
2490 let handles_before = decoder.remaining_handles();
2491 if let Some((inlined, num_bytes, num_handles)) =
2492 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2493 {
2494 let member_inline_size = <fidl_fuchsia_input_common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2495 if inlined != (member_inline_size <= 4) {
2496 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2497 }
2498 let inner_offset;
2499 let mut inner_depth = depth.clone();
2500 if inlined {
2501 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2502 inner_offset = next_offset;
2503 } else {
2504 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2505 inner_depth.increment()?;
2506 }
2507 let val_ref = self.button.get_or_insert_with(|| {
2508 fidl::new_empty!(fidl_fuchsia_input_common::ConsumerControlButton, D)
2509 });
2510 fidl::decode!(
2511 fidl_fuchsia_input_common::ConsumerControlButton,
2512 D,
2513 val_ref,
2514 decoder,
2515 inner_offset,
2516 inner_depth
2517 )?;
2518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2519 {
2520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2521 }
2522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2524 }
2525 }
2526
2527 next_offset += envelope_size;
2528 _next_ordinal_to_read += 1;
2529 if next_offset >= end_offset {
2530 return Ok(());
2531 }
2532
2533 while _next_ordinal_to_read < 2 {
2535 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2536 _next_ordinal_to_read += 1;
2537 next_offset += envelope_size;
2538 }
2539
2540 let next_out_of_line = decoder.next_out_of_line();
2541 let handles_before = decoder.remaining_handles();
2542 if let Some((inlined, num_bytes, num_handles)) =
2543 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2544 {
2545 let member_inline_size =
2546 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2547 if inlined != (member_inline_size <= 4) {
2548 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2549 }
2550 let inner_offset;
2551 let mut inner_depth = depth.clone();
2552 if inlined {
2553 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2554 inner_offset = next_offset;
2555 } else {
2556 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2557 inner_depth.increment()?;
2558 }
2559 let val_ref = self.delay.get_or_insert_with(|| fidl::new_empty!(i64, D));
2560 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2561 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2562 {
2563 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2564 }
2565 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2566 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2567 }
2568 }
2569
2570 next_offset += envelope_size;
2571
2572 while next_offset < end_offset {
2574 _next_ordinal_to_read += 1;
2575 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2576 next_offset += envelope_size;
2577 }
2578
2579 Ok(())
2580 }
2581 }
2582
2583 impl MediaButtonsDeviceSendButtonsStateRequest {
2584 #[inline(always)]
2585 fn max_ordinal_present(&self) -> u64 {
2586 if let Some(_) = self.buttons {
2587 return 1;
2588 }
2589 0
2590 }
2591 }
2592
2593 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
2594 type Borrowed<'a> = &'a Self;
2595 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2596 value
2597 }
2598 }
2599
2600 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSendButtonsStateRequest {
2601 type Owned = Self;
2602
2603 #[inline(always)]
2604 fn inline_align(_context: fidl::encoding::Context) -> usize {
2605 8
2606 }
2607
2608 #[inline(always)]
2609 fn inline_size(_context: fidl::encoding::Context) -> usize {
2610 16
2611 }
2612 }
2613
2614 unsafe impl<D: fidl::encoding::ResourceDialect>
2615 fidl::encoding::Encode<MediaButtonsDeviceSendButtonsStateRequest, D>
2616 for &MediaButtonsDeviceSendButtonsStateRequest
2617 {
2618 unsafe fn encode(
2619 self,
2620 encoder: &mut fidl::encoding::Encoder<'_, D>,
2621 offset: usize,
2622 mut depth: fidl::encoding::Depth,
2623 ) -> fidl::Result<()> {
2624 encoder.debug_check_bounds::<MediaButtonsDeviceSendButtonsStateRequest>(offset);
2625 let max_ordinal: u64 = self.max_ordinal_present();
2627 encoder.write_num(max_ordinal, offset);
2628 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2629 if max_ordinal == 0 {
2631 return Ok(());
2632 }
2633 depth.increment()?;
2634 let envelope_size = 8;
2635 let bytes_len = max_ordinal as usize * envelope_size;
2636 #[allow(unused_variables)]
2637 let offset = encoder.out_of_line_offset(bytes_len);
2638 let mut _prev_end_offset: usize = 0;
2639 if 1 > max_ordinal {
2640 return Ok(());
2641 }
2642
2643 let cur_offset: usize = (1 - 1) * envelope_size;
2646
2647 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2649
2650 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input_common::ConsumerControlButton, 255>, D>(
2655 self.buttons.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input_common::ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
2656 encoder, offset + cur_offset, depth
2657 )?;
2658
2659 _prev_end_offset = cur_offset + envelope_size;
2660
2661 Ok(())
2662 }
2663 }
2664
2665 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2666 for MediaButtonsDeviceSendButtonsStateRequest
2667 {
2668 #[inline(always)]
2669 fn new_empty() -> Self {
2670 Self::default()
2671 }
2672
2673 unsafe fn decode(
2674 &mut self,
2675 decoder: &mut fidl::encoding::Decoder<'_, D>,
2676 offset: usize,
2677 mut depth: fidl::encoding::Depth,
2678 ) -> fidl::Result<()> {
2679 decoder.debug_check_bounds::<Self>(offset);
2680 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2681 None => return Err(fidl::Error::NotNullable),
2682 Some(len) => len,
2683 };
2684 if len == 0 {
2686 return Ok(());
2687 };
2688 depth.increment()?;
2689 let envelope_size = 8;
2690 let bytes_len = len * envelope_size;
2691 let offset = decoder.out_of_line_offset(bytes_len)?;
2692 let mut _next_ordinal_to_read = 0;
2694 let mut next_offset = offset;
2695 let end_offset = offset + bytes_len;
2696 _next_ordinal_to_read += 1;
2697 if next_offset >= end_offset {
2698 return Ok(());
2699 }
2700
2701 while _next_ordinal_to_read < 1 {
2703 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2704 _next_ordinal_to_read += 1;
2705 next_offset += envelope_size;
2706 }
2707
2708 let next_out_of_line = decoder.next_out_of_line();
2709 let handles_before = decoder.remaining_handles();
2710 if let Some((inlined, num_bytes, num_handles)) =
2711 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2712 {
2713 let member_inline_size = <fidl::encoding::Vector<
2714 fidl_fuchsia_input_common::ConsumerControlButton,
2715 255,
2716 > as fidl::encoding::TypeMarker>::inline_size(
2717 decoder.context
2718 );
2719 if inlined != (member_inline_size <= 4) {
2720 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2721 }
2722 let inner_offset;
2723 let mut inner_depth = depth.clone();
2724 if inlined {
2725 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2726 inner_offset = next_offset;
2727 } else {
2728 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2729 inner_depth.increment()?;
2730 }
2731 let val_ref =
2732 self.buttons.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input_common::ConsumerControlButton, 255>, D));
2733 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input_common::ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
2734 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2735 {
2736 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2737 }
2738 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2739 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2740 }
2741 }
2742
2743 next_offset += envelope_size;
2744
2745 while next_offset < end_offset {
2747 _next_ordinal_to_read += 1;
2748 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2749 next_offset += envelope_size;
2750 }
2751
2752 Ok(())
2753 }
2754 }
2755
2756 impl MediaButtonsDeviceSimulateButtonPressRequest {
2757 #[inline(always)]
2758 fn max_ordinal_present(&self) -> u64 {
2759 if let Some(_) = self.button {
2760 return 1;
2761 }
2762 0
2763 }
2764 }
2765
2766 impl fidl::encoding::ValueTypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2767 type Borrowed<'a> = &'a Self;
2768 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2769 value
2770 }
2771 }
2772
2773 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDeviceSimulateButtonPressRequest {
2774 type Owned = Self;
2775
2776 #[inline(always)]
2777 fn inline_align(_context: fidl::encoding::Context) -> usize {
2778 8
2779 }
2780
2781 #[inline(always)]
2782 fn inline_size(_context: fidl::encoding::Context) -> usize {
2783 16
2784 }
2785 }
2786
2787 unsafe impl<D: fidl::encoding::ResourceDialect>
2788 fidl::encoding::Encode<MediaButtonsDeviceSimulateButtonPressRequest, D>
2789 for &MediaButtonsDeviceSimulateButtonPressRequest
2790 {
2791 unsafe fn encode(
2792 self,
2793 encoder: &mut fidl::encoding::Encoder<'_, D>,
2794 offset: usize,
2795 mut depth: fidl::encoding::Depth,
2796 ) -> fidl::Result<()> {
2797 encoder.debug_check_bounds::<MediaButtonsDeviceSimulateButtonPressRequest>(offset);
2798 let max_ordinal: u64 = self.max_ordinal_present();
2800 encoder.write_num(max_ordinal, offset);
2801 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2802 if max_ordinal == 0 {
2804 return Ok(());
2805 }
2806 depth.increment()?;
2807 let envelope_size = 8;
2808 let bytes_len = max_ordinal as usize * envelope_size;
2809 #[allow(unused_variables)]
2810 let offset = encoder.out_of_line_offset(bytes_len);
2811 let mut _prev_end_offset: usize = 0;
2812 if 1 > max_ordinal {
2813 return Ok(());
2814 }
2815
2816 let cur_offset: usize = (1 - 1) * envelope_size;
2819
2820 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2822
2823 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_common::ConsumerControlButton, D>(
2828 self.button.as_ref().map(<fidl_fuchsia_input_common::ConsumerControlButton as fidl::encoding::ValueTypeMarker>::borrow),
2829 encoder, offset + cur_offset, depth
2830 )?;
2831
2832 _prev_end_offset = cur_offset + envelope_size;
2833
2834 Ok(())
2835 }
2836 }
2837
2838 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2839 for MediaButtonsDeviceSimulateButtonPressRequest
2840 {
2841 #[inline(always)]
2842 fn new_empty() -> Self {
2843 Self::default()
2844 }
2845
2846 unsafe fn decode(
2847 &mut self,
2848 decoder: &mut fidl::encoding::Decoder<'_, D>,
2849 offset: usize,
2850 mut depth: fidl::encoding::Depth,
2851 ) -> fidl::Result<()> {
2852 decoder.debug_check_bounds::<Self>(offset);
2853 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2854 None => return Err(fidl::Error::NotNullable),
2855 Some(len) => len,
2856 };
2857 if len == 0 {
2859 return Ok(());
2860 };
2861 depth.increment()?;
2862 let envelope_size = 8;
2863 let bytes_len = len * envelope_size;
2864 let offset = decoder.out_of_line_offset(bytes_len)?;
2865 let mut _next_ordinal_to_read = 0;
2867 let mut next_offset = offset;
2868 let end_offset = offset + bytes_len;
2869 _next_ordinal_to_read += 1;
2870 if next_offset >= end_offset {
2871 return Ok(());
2872 }
2873
2874 while _next_ordinal_to_read < 1 {
2876 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2877 _next_ordinal_to_read += 1;
2878 next_offset += envelope_size;
2879 }
2880
2881 let next_out_of_line = decoder.next_out_of_line();
2882 let handles_before = decoder.remaining_handles();
2883 if let Some((inlined, num_bytes, num_handles)) =
2884 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2885 {
2886 let member_inline_size = <fidl_fuchsia_input_common::ConsumerControlButton as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2887 if inlined != (member_inline_size <= 4) {
2888 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2889 }
2890 let inner_offset;
2891 let mut inner_depth = depth.clone();
2892 if inlined {
2893 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2894 inner_offset = next_offset;
2895 } else {
2896 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2897 inner_depth.increment()?;
2898 }
2899 let val_ref = self.button.get_or_insert_with(|| {
2900 fidl::new_empty!(fidl_fuchsia_input_common::ConsumerControlButton, D)
2901 });
2902 fidl::decode!(
2903 fidl_fuchsia_input_common::ConsumerControlButton,
2904 D,
2905 val_ref,
2906 decoder,
2907 inner_offset,
2908 inner_depth
2909 )?;
2910 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2911 {
2912 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2913 }
2914 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2915 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2916 }
2917 }
2918
2919 next_offset += envelope_size;
2920
2921 while next_offset < end_offset {
2923 _next_ordinal_to_read += 1;
2924 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2925 next_offset += envelope_size;
2926 }
2927
2928 Ok(())
2929 }
2930 }
2931
2932 impl MouseInputListenerReportMouseInputRequest {
2933 #[inline(always)]
2934 fn max_ordinal_present(&self) -> u64 {
2935 if let Some(_) = self.device_id {
2936 return 10;
2937 }
2938 if let Some(_) = self.wheel_y_physical_pixel {
2939 return 9;
2940 }
2941 if let Some(_) = self.wheel_x_physical_pixel {
2942 return 8;
2943 }
2944 if let Some(_) = self.device_pixel_ratio {
2945 return 7;
2946 }
2947 if let Some(_) = self.phase {
2948 return 6;
2949 }
2950 if let Some(_) = self.buttons {
2951 return 5;
2952 }
2953 if let Some(_) = self.component_name {
2954 return 4;
2955 }
2956 if let Some(_) = self.time_received {
2957 return 3;
2958 }
2959 if let Some(_) = self.local_y {
2960 return 2;
2961 }
2962 if let Some(_) = self.local_x {
2963 return 1;
2964 }
2965 0
2966 }
2967 }
2968
2969 impl fidl::encoding::ValueTypeMarker for MouseInputListenerReportMouseInputRequest {
2970 type Borrowed<'a> = &'a Self;
2971 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2972 value
2973 }
2974 }
2975
2976 unsafe impl fidl::encoding::TypeMarker for MouseInputListenerReportMouseInputRequest {
2977 type Owned = Self;
2978
2979 #[inline(always)]
2980 fn inline_align(_context: fidl::encoding::Context) -> usize {
2981 8
2982 }
2983
2984 #[inline(always)]
2985 fn inline_size(_context: fidl::encoding::Context) -> usize {
2986 16
2987 }
2988 }
2989
2990 unsafe impl<D: fidl::encoding::ResourceDialect>
2991 fidl::encoding::Encode<MouseInputListenerReportMouseInputRequest, D>
2992 for &MouseInputListenerReportMouseInputRequest
2993 {
2994 unsafe fn encode(
2995 self,
2996 encoder: &mut fidl::encoding::Encoder<'_, D>,
2997 offset: usize,
2998 mut depth: fidl::encoding::Depth,
2999 ) -> fidl::Result<()> {
3000 encoder.debug_check_bounds::<MouseInputListenerReportMouseInputRequest>(offset);
3001 let max_ordinal: u64 = self.max_ordinal_present();
3003 encoder.write_num(max_ordinal, offset);
3004 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3005 if max_ordinal == 0 {
3007 return Ok(());
3008 }
3009 depth.increment()?;
3010 let envelope_size = 8;
3011 let bytes_len = max_ordinal as usize * envelope_size;
3012 #[allow(unused_variables)]
3013 let offset = encoder.out_of_line_offset(bytes_len);
3014 let mut _prev_end_offset: usize = 0;
3015 if 1 > max_ordinal {
3016 return Ok(());
3017 }
3018
3019 let cur_offset: usize = (1 - 1) * envelope_size;
3022
3023 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3025
3026 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3031 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3032 encoder,
3033 offset + cur_offset,
3034 depth,
3035 )?;
3036
3037 _prev_end_offset = cur_offset + envelope_size;
3038 if 2 > max_ordinal {
3039 return Ok(());
3040 }
3041
3042 let cur_offset: usize = (2 - 1) * envelope_size;
3045
3046 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3048
3049 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3054 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3055 encoder,
3056 offset + cur_offset,
3057 depth,
3058 )?;
3059
3060 _prev_end_offset = cur_offset + envelope_size;
3061 if 3 > max_ordinal {
3062 return Ok(());
3063 }
3064
3065 let cur_offset: usize = (3 - 1) * envelope_size;
3068
3069 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3071
3072 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3077 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3078 encoder,
3079 offset + cur_offset,
3080 depth,
3081 )?;
3082
3083 _prev_end_offset = cur_offset + envelope_size;
3084 if 4 > max_ordinal {
3085 return Ok(());
3086 }
3087
3088 let cur_offset: usize = (4 - 1) * envelope_size;
3091
3092 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3094
3095 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
3100 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
3101 encoder, offset + cur_offset, depth
3102 )?;
3103
3104 _prev_end_offset = cur_offset + envelope_size;
3105 if 5 > max_ordinal {
3106 return Ok(());
3107 }
3108
3109 let cur_offset: usize = (5 - 1) * envelope_size;
3112
3113 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3115
3116 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
3121 self.buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
3122 encoder, offset + cur_offset, depth
3123 )?;
3124
3125 _prev_end_offset = cur_offset + envelope_size;
3126 if 6 > max_ordinal {
3127 return Ok(());
3128 }
3129
3130 let cur_offset: usize = (6 - 1) * envelope_size;
3133
3134 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3136
3137 fidl::encoding::encode_in_envelope_optional::<MouseEventPhase, D>(
3142 self.phase
3143 .as_ref()
3144 .map(<MouseEventPhase as fidl::encoding::ValueTypeMarker>::borrow),
3145 encoder,
3146 offset + cur_offset,
3147 depth,
3148 )?;
3149
3150 _prev_end_offset = cur_offset + envelope_size;
3151 if 7 > max_ordinal {
3152 return Ok(());
3153 }
3154
3155 let cur_offset: usize = (7 - 1) * envelope_size;
3158
3159 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3161
3162 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3167 self.device_pixel_ratio
3168 .as_ref()
3169 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3170 encoder,
3171 offset + cur_offset,
3172 depth,
3173 )?;
3174
3175 _prev_end_offset = cur_offset + envelope_size;
3176 if 8 > max_ordinal {
3177 return Ok(());
3178 }
3179
3180 let cur_offset: usize = (8 - 1) * envelope_size;
3183
3184 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3186
3187 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3192 self.wheel_x_physical_pixel
3193 .as_ref()
3194 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3195 encoder,
3196 offset + cur_offset,
3197 depth,
3198 )?;
3199
3200 _prev_end_offset = cur_offset + envelope_size;
3201 if 9 > max_ordinal {
3202 return Ok(());
3203 }
3204
3205 let cur_offset: usize = (9 - 1) * envelope_size;
3208
3209 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3211
3212 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3217 self.wheel_y_physical_pixel
3218 .as_ref()
3219 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3220 encoder,
3221 offset + cur_offset,
3222 depth,
3223 )?;
3224
3225 _prev_end_offset = cur_offset + envelope_size;
3226 if 10 > max_ordinal {
3227 return Ok(());
3228 }
3229
3230 let cur_offset: usize = (10 - 1) * envelope_size;
3233
3234 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3236
3237 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3242 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3243 encoder,
3244 offset + cur_offset,
3245 depth,
3246 )?;
3247
3248 _prev_end_offset = cur_offset + envelope_size;
3249
3250 Ok(())
3251 }
3252 }
3253
3254 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3255 for MouseInputListenerReportMouseInputRequest
3256 {
3257 #[inline(always)]
3258 fn new_empty() -> Self {
3259 Self::default()
3260 }
3261
3262 unsafe fn decode(
3263 &mut self,
3264 decoder: &mut fidl::encoding::Decoder<'_, D>,
3265 offset: usize,
3266 mut depth: fidl::encoding::Depth,
3267 ) -> fidl::Result<()> {
3268 decoder.debug_check_bounds::<Self>(offset);
3269 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3270 None => return Err(fidl::Error::NotNullable),
3271 Some(len) => len,
3272 };
3273 if len == 0 {
3275 return Ok(());
3276 };
3277 depth.increment()?;
3278 let envelope_size = 8;
3279 let bytes_len = len * envelope_size;
3280 let offset = decoder.out_of_line_offset(bytes_len)?;
3281 let mut _next_ordinal_to_read = 0;
3283 let mut next_offset = offset;
3284 let end_offset = offset + bytes_len;
3285 _next_ordinal_to_read += 1;
3286 if next_offset >= end_offset {
3287 return Ok(());
3288 }
3289
3290 while _next_ordinal_to_read < 1 {
3292 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3293 _next_ordinal_to_read += 1;
3294 next_offset += envelope_size;
3295 }
3296
3297 let next_out_of_line = decoder.next_out_of_line();
3298 let handles_before = decoder.remaining_handles();
3299 if let Some((inlined, num_bytes, num_handles)) =
3300 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3301 {
3302 let member_inline_size =
3303 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3304 if inlined != (member_inline_size <= 4) {
3305 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3306 }
3307 let inner_offset;
3308 let mut inner_depth = depth.clone();
3309 if inlined {
3310 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3311 inner_offset = next_offset;
3312 } else {
3313 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3314 inner_depth.increment()?;
3315 }
3316 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
3317 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3318 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3319 {
3320 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3321 }
3322 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3323 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3324 }
3325 }
3326
3327 next_offset += envelope_size;
3328 _next_ordinal_to_read += 1;
3329 if next_offset >= end_offset {
3330 return Ok(());
3331 }
3332
3333 while _next_ordinal_to_read < 2 {
3335 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3336 _next_ordinal_to_read += 1;
3337 next_offset += envelope_size;
3338 }
3339
3340 let next_out_of_line = decoder.next_out_of_line();
3341 let handles_before = decoder.remaining_handles();
3342 if let Some((inlined, num_bytes, num_handles)) =
3343 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3344 {
3345 let member_inline_size =
3346 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3347 if inlined != (member_inline_size <= 4) {
3348 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3349 }
3350 let inner_offset;
3351 let mut inner_depth = depth.clone();
3352 if inlined {
3353 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3354 inner_offset = next_offset;
3355 } else {
3356 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3357 inner_depth.increment()?;
3358 }
3359 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
3360 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3361 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3362 {
3363 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3364 }
3365 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3366 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3367 }
3368 }
3369
3370 next_offset += envelope_size;
3371 _next_ordinal_to_read += 1;
3372 if next_offset >= end_offset {
3373 return Ok(());
3374 }
3375
3376 while _next_ordinal_to_read < 3 {
3378 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3379 _next_ordinal_to_read += 1;
3380 next_offset += envelope_size;
3381 }
3382
3383 let next_out_of_line = decoder.next_out_of_line();
3384 let handles_before = decoder.remaining_handles();
3385 if let Some((inlined, num_bytes, num_handles)) =
3386 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3387 {
3388 let member_inline_size =
3389 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3390 if inlined != (member_inline_size <= 4) {
3391 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3392 }
3393 let inner_offset;
3394 let mut inner_depth = depth.clone();
3395 if inlined {
3396 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3397 inner_offset = next_offset;
3398 } else {
3399 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3400 inner_depth.increment()?;
3401 }
3402 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
3403 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3404 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3405 {
3406 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3407 }
3408 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3409 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3410 }
3411 }
3412
3413 next_offset += envelope_size;
3414 _next_ordinal_to_read += 1;
3415 if next_offset >= end_offset {
3416 return Ok(());
3417 }
3418
3419 while _next_ordinal_to_read < 4 {
3421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3422 _next_ordinal_to_read += 1;
3423 next_offset += envelope_size;
3424 }
3425
3426 let next_out_of_line = decoder.next_out_of_line();
3427 let handles_before = decoder.remaining_handles();
3428 if let Some((inlined, num_bytes, num_handles)) =
3429 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3430 {
3431 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3432 if inlined != (member_inline_size <= 4) {
3433 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3434 }
3435 let inner_offset;
3436 let mut inner_depth = depth.clone();
3437 if inlined {
3438 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3439 inner_offset = next_offset;
3440 } else {
3441 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3442 inner_depth.increment()?;
3443 }
3444 let val_ref = self.component_name.get_or_insert_with(|| {
3445 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
3446 });
3447 fidl::decode!(
3448 fidl::encoding::BoundedString<1024>,
3449 D,
3450 val_ref,
3451 decoder,
3452 inner_offset,
3453 inner_depth
3454 )?;
3455 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3456 {
3457 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3458 }
3459 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3460 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3461 }
3462 }
3463
3464 next_offset += envelope_size;
3465 _next_ordinal_to_read += 1;
3466 if next_offset >= end_offset {
3467 return Ok(());
3468 }
3469
3470 while _next_ordinal_to_read < 5 {
3472 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3473 _next_ordinal_to_read += 1;
3474 next_offset += envelope_size;
3475 }
3476
3477 let next_out_of_line = decoder.next_out_of_line();
3478 let handles_before = decoder.remaining_handles();
3479 if let Some((inlined, num_bytes, num_handles)) =
3480 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3481 {
3482 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3483 if inlined != (member_inline_size <= 4) {
3484 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3485 }
3486 let inner_offset;
3487 let mut inner_depth = depth.clone();
3488 if inlined {
3489 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3490 inner_offset = next_offset;
3491 } else {
3492 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3493 inner_depth.increment()?;
3494 }
3495 let val_ref = self.buttons.get_or_insert_with(
3496 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
3497 );
3498 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3499 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3500 {
3501 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3502 }
3503 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3504 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3505 }
3506 }
3507
3508 next_offset += envelope_size;
3509 _next_ordinal_to_read += 1;
3510 if next_offset >= end_offset {
3511 return Ok(());
3512 }
3513
3514 while _next_ordinal_to_read < 6 {
3516 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3517 _next_ordinal_to_read += 1;
3518 next_offset += envelope_size;
3519 }
3520
3521 let next_out_of_line = decoder.next_out_of_line();
3522 let handles_before = decoder.remaining_handles();
3523 if let Some((inlined, num_bytes, num_handles)) =
3524 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3525 {
3526 let member_inline_size =
3527 <MouseEventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3528 if inlined != (member_inline_size <= 4) {
3529 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3530 }
3531 let inner_offset;
3532 let mut inner_depth = depth.clone();
3533 if inlined {
3534 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3535 inner_offset = next_offset;
3536 } else {
3537 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3538 inner_depth.increment()?;
3539 }
3540 let val_ref =
3541 self.phase.get_or_insert_with(|| fidl::new_empty!(MouseEventPhase, D));
3542 fidl::decode!(MouseEventPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
3543 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3544 {
3545 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3546 }
3547 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3548 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3549 }
3550 }
3551
3552 next_offset += envelope_size;
3553 _next_ordinal_to_read += 1;
3554 if next_offset >= end_offset {
3555 return Ok(());
3556 }
3557
3558 while _next_ordinal_to_read < 7 {
3560 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3561 _next_ordinal_to_read += 1;
3562 next_offset += envelope_size;
3563 }
3564
3565 let next_out_of_line = decoder.next_out_of_line();
3566 let handles_before = decoder.remaining_handles();
3567 if let Some((inlined, num_bytes, num_handles)) =
3568 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3569 {
3570 let member_inline_size =
3571 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3572 if inlined != (member_inline_size <= 4) {
3573 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3574 }
3575 let inner_offset;
3576 let mut inner_depth = depth.clone();
3577 if inlined {
3578 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3579 inner_offset = next_offset;
3580 } else {
3581 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3582 inner_depth.increment()?;
3583 }
3584 let val_ref =
3585 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
3586 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3587 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3588 {
3589 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3590 }
3591 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3592 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3593 }
3594 }
3595
3596 next_offset += envelope_size;
3597 _next_ordinal_to_read += 1;
3598 if next_offset >= end_offset {
3599 return Ok(());
3600 }
3601
3602 while _next_ordinal_to_read < 8 {
3604 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3605 _next_ordinal_to_read += 1;
3606 next_offset += envelope_size;
3607 }
3608
3609 let next_out_of_line = decoder.next_out_of_line();
3610 let handles_before = decoder.remaining_handles();
3611 if let Some((inlined, num_bytes, num_handles)) =
3612 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3613 {
3614 let member_inline_size =
3615 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3616 if inlined != (member_inline_size <= 4) {
3617 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3618 }
3619 let inner_offset;
3620 let mut inner_depth = depth.clone();
3621 if inlined {
3622 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3623 inner_offset = next_offset;
3624 } else {
3625 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3626 inner_depth.increment()?;
3627 }
3628 let val_ref =
3629 self.wheel_x_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3630 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3631 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3632 {
3633 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3634 }
3635 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3636 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3637 }
3638 }
3639
3640 next_offset += envelope_size;
3641 _next_ordinal_to_read += 1;
3642 if next_offset >= end_offset {
3643 return Ok(());
3644 }
3645
3646 while _next_ordinal_to_read < 9 {
3648 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3649 _next_ordinal_to_read += 1;
3650 next_offset += envelope_size;
3651 }
3652
3653 let next_out_of_line = decoder.next_out_of_line();
3654 let handles_before = decoder.remaining_handles();
3655 if let Some((inlined, num_bytes, num_handles)) =
3656 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3657 {
3658 let member_inline_size =
3659 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3660 if inlined != (member_inline_size <= 4) {
3661 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3662 }
3663 let inner_offset;
3664 let mut inner_depth = depth.clone();
3665 if inlined {
3666 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3667 inner_offset = next_offset;
3668 } else {
3669 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3670 inner_depth.increment()?;
3671 }
3672 let val_ref =
3673 self.wheel_y_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3674 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3675 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3676 {
3677 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3678 }
3679 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3680 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3681 }
3682 }
3683
3684 next_offset += envelope_size;
3685 _next_ordinal_to_read += 1;
3686 if next_offset >= end_offset {
3687 return Ok(());
3688 }
3689
3690 while _next_ordinal_to_read < 10 {
3692 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3693 _next_ordinal_to_read += 1;
3694 next_offset += envelope_size;
3695 }
3696
3697 let next_out_of_line = decoder.next_out_of_line();
3698 let handles_before = decoder.remaining_handles();
3699 if let Some((inlined, num_bytes, num_handles)) =
3700 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3701 {
3702 let member_inline_size =
3703 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3704 if inlined != (member_inline_size <= 4) {
3705 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3706 }
3707 let inner_offset;
3708 let mut inner_depth = depth.clone();
3709 if inlined {
3710 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3711 inner_offset = next_offset;
3712 } else {
3713 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3714 inner_depth.increment()?;
3715 }
3716 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
3717 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3718 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3719 {
3720 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3721 }
3722 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3723 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3724 }
3725 }
3726
3727 next_offset += envelope_size;
3728
3729 while next_offset < end_offset {
3731 _next_ordinal_to_read += 1;
3732 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3733 next_offset += envelope_size;
3734 }
3735
3736 Ok(())
3737 }
3738 }
3739
3740 impl MouseSimulateMouseEventRequest {
3741 #[inline(always)]
3742 fn max_ordinal_present(&self) -> u64 {
3743 if let Some(_) = self.scroll_h_physical_pixel {
3744 return 7;
3745 }
3746 if let Some(_) = self.scroll_v_physical_pixel {
3747 return 6;
3748 }
3749 if let Some(_) = self.scroll_h_detent {
3750 return 5;
3751 }
3752 if let Some(_) = self.scroll_v_detent {
3753 return 4;
3754 }
3755 if let Some(_) = self.movement_y {
3756 return 3;
3757 }
3758 if let Some(_) = self.movement_x {
3759 return 2;
3760 }
3761 if let Some(_) = self.pressed_buttons {
3762 return 1;
3763 }
3764 0
3765 }
3766 }
3767
3768 impl fidl::encoding::ValueTypeMarker for MouseSimulateMouseEventRequest {
3769 type Borrowed<'a> = &'a Self;
3770 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3771 value
3772 }
3773 }
3774
3775 unsafe impl fidl::encoding::TypeMarker for MouseSimulateMouseEventRequest {
3776 type Owned = Self;
3777
3778 #[inline(always)]
3779 fn inline_align(_context: fidl::encoding::Context) -> usize {
3780 8
3781 }
3782
3783 #[inline(always)]
3784 fn inline_size(_context: fidl::encoding::Context) -> usize {
3785 16
3786 }
3787 }
3788
3789 unsafe impl<D: fidl::encoding::ResourceDialect>
3790 fidl::encoding::Encode<MouseSimulateMouseEventRequest, D>
3791 for &MouseSimulateMouseEventRequest
3792 {
3793 unsafe fn encode(
3794 self,
3795 encoder: &mut fidl::encoding::Encoder<'_, D>,
3796 offset: usize,
3797 mut depth: fidl::encoding::Depth,
3798 ) -> fidl::Result<()> {
3799 encoder.debug_check_bounds::<MouseSimulateMouseEventRequest>(offset);
3800 let max_ordinal: u64 = self.max_ordinal_present();
3802 encoder.write_num(max_ordinal, offset);
3803 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3804 if max_ordinal == 0 {
3806 return Ok(());
3807 }
3808 depth.increment()?;
3809 let envelope_size = 8;
3810 let bytes_len = max_ordinal as usize * envelope_size;
3811 #[allow(unused_variables)]
3812 let offset = encoder.out_of_line_offset(bytes_len);
3813 let mut _prev_end_offset: usize = 0;
3814 if 1 > max_ordinal {
3815 return Ok(());
3816 }
3817
3818 let cur_offset: usize = (1 - 1) * envelope_size;
3821
3822 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3824
3825 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<MouseButton, 32>, D>(
3830 self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::ValueTypeMarker>::borrow),
3831 encoder, offset + cur_offset, depth
3832 )?;
3833
3834 _prev_end_offset = cur_offset + envelope_size;
3835 if 2 > max_ordinal {
3836 return Ok(());
3837 }
3838
3839 let cur_offset: usize = (2 - 1) * envelope_size;
3842
3843 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3845
3846 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3851 self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3852 encoder,
3853 offset + cur_offset,
3854 depth,
3855 )?;
3856
3857 _prev_end_offset = cur_offset + envelope_size;
3858 if 3 > max_ordinal {
3859 return Ok(());
3860 }
3861
3862 let cur_offset: usize = (3 - 1) * envelope_size;
3865
3866 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3868
3869 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3874 self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3875 encoder,
3876 offset + cur_offset,
3877 depth,
3878 )?;
3879
3880 _prev_end_offset = cur_offset + envelope_size;
3881 if 4 > max_ordinal {
3882 return Ok(());
3883 }
3884
3885 let cur_offset: usize = (4 - 1) * envelope_size;
3888
3889 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3891
3892 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3897 self.scroll_v_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3898 encoder,
3899 offset + cur_offset,
3900 depth,
3901 )?;
3902
3903 _prev_end_offset = cur_offset + envelope_size;
3904 if 5 > max_ordinal {
3905 return Ok(());
3906 }
3907
3908 let cur_offset: usize = (5 - 1) * envelope_size;
3911
3912 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3914
3915 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3920 self.scroll_h_detent.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3921 encoder,
3922 offset + cur_offset,
3923 depth,
3924 )?;
3925
3926 _prev_end_offset = cur_offset + envelope_size;
3927 if 6 > max_ordinal {
3928 return Ok(());
3929 }
3930
3931 let cur_offset: usize = (6 - 1) * envelope_size;
3934
3935 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3937
3938 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3943 self.scroll_v_physical_pixel
3944 .as_ref()
3945 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3946 encoder,
3947 offset + cur_offset,
3948 depth,
3949 )?;
3950
3951 _prev_end_offset = cur_offset + envelope_size;
3952 if 7 > max_ordinal {
3953 return Ok(());
3954 }
3955
3956 let cur_offset: usize = (7 - 1) * envelope_size;
3959
3960 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3962
3963 fidl::encoding::encode_in_envelope_optional::<f64, D>(
3968 self.scroll_h_physical_pixel
3969 .as_ref()
3970 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
3971 encoder,
3972 offset + cur_offset,
3973 depth,
3974 )?;
3975
3976 _prev_end_offset = cur_offset + envelope_size;
3977
3978 Ok(())
3979 }
3980 }
3981
3982 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3983 for MouseSimulateMouseEventRequest
3984 {
3985 #[inline(always)]
3986 fn new_empty() -> Self {
3987 Self::default()
3988 }
3989
3990 unsafe fn decode(
3991 &mut self,
3992 decoder: &mut fidl::encoding::Decoder<'_, D>,
3993 offset: usize,
3994 mut depth: fidl::encoding::Depth,
3995 ) -> fidl::Result<()> {
3996 decoder.debug_check_bounds::<Self>(offset);
3997 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3998 None => return Err(fidl::Error::NotNullable),
3999 Some(len) => len,
4000 };
4001 if len == 0 {
4003 return Ok(());
4004 };
4005 depth.increment()?;
4006 let envelope_size = 8;
4007 let bytes_len = len * envelope_size;
4008 let offset = decoder.out_of_line_offset(bytes_len)?;
4009 let mut _next_ordinal_to_read = 0;
4011 let mut next_offset = offset;
4012 let end_offset = offset + bytes_len;
4013 _next_ordinal_to_read += 1;
4014 if next_offset >= end_offset {
4015 return Ok(());
4016 }
4017
4018 while _next_ordinal_to_read < 1 {
4020 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4021 _next_ordinal_to_read += 1;
4022 next_offset += envelope_size;
4023 }
4024
4025 let next_out_of_line = decoder.next_out_of_line();
4026 let handles_before = decoder.remaining_handles();
4027 if let Some((inlined, num_bytes, num_handles)) =
4028 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4029 {
4030 let member_inline_size = <fidl::encoding::Vector<MouseButton, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4031 if inlined != (member_inline_size <= 4) {
4032 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4033 }
4034 let inner_offset;
4035 let mut inner_depth = depth.clone();
4036 if inlined {
4037 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4038 inner_offset = next_offset;
4039 } else {
4040 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4041 inner_depth.increment()?;
4042 }
4043 let val_ref = self.pressed_buttons.get_or_insert_with(
4044 || fidl::new_empty!(fidl::encoding::Vector<MouseButton, 32>, D),
4045 );
4046 fidl::decode!(fidl::encoding::Vector<MouseButton, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
4047 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4048 {
4049 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4050 }
4051 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4052 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4053 }
4054 }
4055
4056 next_offset += envelope_size;
4057 _next_ordinal_to_read += 1;
4058 if next_offset >= end_offset {
4059 return Ok(());
4060 }
4061
4062 while _next_ordinal_to_read < 2 {
4064 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4065 _next_ordinal_to_read += 1;
4066 next_offset += envelope_size;
4067 }
4068
4069 let next_out_of_line = decoder.next_out_of_line();
4070 let handles_before = decoder.remaining_handles();
4071 if let Some((inlined, num_bytes, num_handles)) =
4072 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4073 {
4074 let member_inline_size =
4075 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4076 if inlined != (member_inline_size <= 4) {
4077 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4078 }
4079 let inner_offset;
4080 let mut inner_depth = depth.clone();
4081 if inlined {
4082 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4083 inner_offset = next_offset;
4084 } else {
4085 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4086 inner_depth.increment()?;
4087 }
4088 let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
4089 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4090 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4091 {
4092 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4093 }
4094 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4095 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4096 }
4097 }
4098
4099 next_offset += envelope_size;
4100 _next_ordinal_to_read += 1;
4101 if next_offset >= end_offset {
4102 return Ok(());
4103 }
4104
4105 while _next_ordinal_to_read < 3 {
4107 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4108 _next_ordinal_to_read += 1;
4109 next_offset += envelope_size;
4110 }
4111
4112 let next_out_of_line = decoder.next_out_of_line();
4113 let handles_before = decoder.remaining_handles();
4114 if let Some((inlined, num_bytes, num_handles)) =
4115 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4116 {
4117 let member_inline_size =
4118 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4119 if inlined != (member_inline_size <= 4) {
4120 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4121 }
4122 let inner_offset;
4123 let mut inner_depth = depth.clone();
4124 if inlined {
4125 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4126 inner_offset = next_offset;
4127 } else {
4128 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4129 inner_depth.increment()?;
4130 }
4131 let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
4132 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4133 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4134 {
4135 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4136 }
4137 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4138 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4139 }
4140 }
4141
4142 next_offset += envelope_size;
4143 _next_ordinal_to_read += 1;
4144 if next_offset >= end_offset {
4145 return Ok(());
4146 }
4147
4148 while _next_ordinal_to_read < 4 {
4150 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4151 _next_ordinal_to_read += 1;
4152 next_offset += envelope_size;
4153 }
4154
4155 let next_out_of_line = decoder.next_out_of_line();
4156 let handles_before = decoder.remaining_handles();
4157 if let Some((inlined, num_bytes, num_handles)) =
4158 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4159 {
4160 let member_inline_size =
4161 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4162 if inlined != (member_inline_size <= 4) {
4163 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4164 }
4165 let inner_offset;
4166 let mut inner_depth = depth.clone();
4167 if inlined {
4168 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4169 inner_offset = next_offset;
4170 } else {
4171 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4172 inner_depth.increment()?;
4173 }
4174 let val_ref = self.scroll_v_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
4175 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4176 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4177 {
4178 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4179 }
4180 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4181 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4182 }
4183 }
4184
4185 next_offset += envelope_size;
4186 _next_ordinal_to_read += 1;
4187 if next_offset >= end_offset {
4188 return Ok(());
4189 }
4190
4191 while _next_ordinal_to_read < 5 {
4193 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4194 _next_ordinal_to_read += 1;
4195 next_offset += envelope_size;
4196 }
4197
4198 let next_out_of_line = decoder.next_out_of_line();
4199 let handles_before = decoder.remaining_handles();
4200 if let Some((inlined, num_bytes, num_handles)) =
4201 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4202 {
4203 let member_inline_size =
4204 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4205 if inlined != (member_inline_size <= 4) {
4206 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4207 }
4208 let inner_offset;
4209 let mut inner_depth = depth.clone();
4210 if inlined {
4211 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4212 inner_offset = next_offset;
4213 } else {
4214 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4215 inner_depth.increment()?;
4216 }
4217 let val_ref = self.scroll_h_detent.get_or_insert_with(|| fidl::new_empty!(i64, D));
4218 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4219 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4220 {
4221 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4222 }
4223 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4224 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4225 }
4226 }
4227
4228 next_offset += envelope_size;
4229 _next_ordinal_to_read += 1;
4230 if next_offset >= end_offset {
4231 return Ok(());
4232 }
4233
4234 while _next_ordinal_to_read < 6 {
4236 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4237 _next_ordinal_to_read += 1;
4238 next_offset += envelope_size;
4239 }
4240
4241 let next_out_of_line = decoder.next_out_of_line();
4242 let handles_before = decoder.remaining_handles();
4243 if let Some((inlined, num_bytes, num_handles)) =
4244 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4245 {
4246 let member_inline_size =
4247 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4248 if inlined != (member_inline_size <= 4) {
4249 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4250 }
4251 let inner_offset;
4252 let mut inner_depth = depth.clone();
4253 if inlined {
4254 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4255 inner_offset = next_offset;
4256 } else {
4257 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4258 inner_depth.increment()?;
4259 }
4260 let val_ref =
4261 self.scroll_v_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
4262 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4263 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4264 {
4265 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4266 }
4267 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4268 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4269 }
4270 }
4271
4272 next_offset += envelope_size;
4273 _next_ordinal_to_read += 1;
4274 if next_offset >= end_offset {
4275 return Ok(());
4276 }
4277
4278 while _next_ordinal_to_read < 7 {
4280 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4281 _next_ordinal_to_read += 1;
4282 next_offset += envelope_size;
4283 }
4284
4285 let next_out_of_line = decoder.next_out_of_line();
4286 let handles_before = decoder.remaining_handles();
4287 if let Some((inlined, num_bytes, num_handles)) =
4288 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4289 {
4290 let member_inline_size =
4291 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4292 if inlined != (member_inline_size <= 4) {
4293 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4294 }
4295 let inner_offset;
4296 let mut inner_depth = depth.clone();
4297 if inlined {
4298 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4299 inner_offset = next_offset;
4300 } else {
4301 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4302 inner_depth.increment()?;
4303 }
4304 let val_ref =
4305 self.scroll_h_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
4306 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4307 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4308 {
4309 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4310 }
4311 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4312 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4313 }
4314 }
4315
4316 next_offset += envelope_size;
4317
4318 while next_offset < end_offset {
4320 _next_ordinal_to_read += 1;
4321 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4322 next_offset += envelope_size;
4323 }
4324
4325 Ok(())
4326 }
4327 }
4328
4329 impl TouchInputListenerReportTouchInputRequest {
4330 #[inline(always)]
4331 fn max_ordinal_present(&self) -> u64 {
4332 if let Some(_) = self.device_id {
4333 return 8;
4334 }
4335 if let Some(_) = self.pointer_id {
4336 return 7;
4337 }
4338 if let Some(_) = self.phase {
4339 return 6;
4340 }
4341 if let Some(_) = self.component_name {
4342 return 5;
4343 }
4344 if let Some(_) = self.device_pixel_ratio {
4345 return 4;
4346 }
4347 if let Some(_) = self.time_received {
4348 return 3;
4349 }
4350 if let Some(_) = self.local_y {
4351 return 2;
4352 }
4353 if let Some(_) = self.local_x {
4354 return 1;
4355 }
4356 0
4357 }
4358 }
4359
4360 impl fidl::encoding::ValueTypeMarker for TouchInputListenerReportTouchInputRequest {
4361 type Borrowed<'a> = &'a Self;
4362 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4363 value
4364 }
4365 }
4366
4367 unsafe impl fidl::encoding::TypeMarker for TouchInputListenerReportTouchInputRequest {
4368 type Owned = Self;
4369
4370 #[inline(always)]
4371 fn inline_align(_context: fidl::encoding::Context) -> usize {
4372 8
4373 }
4374
4375 #[inline(always)]
4376 fn inline_size(_context: fidl::encoding::Context) -> usize {
4377 16
4378 }
4379 }
4380
4381 unsafe impl<D: fidl::encoding::ResourceDialect>
4382 fidl::encoding::Encode<TouchInputListenerReportTouchInputRequest, D>
4383 for &TouchInputListenerReportTouchInputRequest
4384 {
4385 unsafe fn encode(
4386 self,
4387 encoder: &mut fidl::encoding::Encoder<'_, D>,
4388 offset: usize,
4389 mut depth: fidl::encoding::Depth,
4390 ) -> fidl::Result<()> {
4391 encoder.debug_check_bounds::<TouchInputListenerReportTouchInputRequest>(offset);
4392 let max_ordinal: u64 = self.max_ordinal_present();
4394 encoder.write_num(max_ordinal, offset);
4395 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4396 if max_ordinal == 0 {
4398 return Ok(());
4399 }
4400 depth.increment()?;
4401 let envelope_size = 8;
4402 let bytes_len = max_ordinal as usize * envelope_size;
4403 #[allow(unused_variables)]
4404 let offset = encoder.out_of_line_offset(bytes_len);
4405 let mut _prev_end_offset: usize = 0;
4406 if 1 > max_ordinal {
4407 return Ok(());
4408 }
4409
4410 let cur_offset: usize = (1 - 1) * envelope_size;
4413
4414 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4416
4417 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4422 self.local_x.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4423 encoder,
4424 offset + cur_offset,
4425 depth,
4426 )?;
4427
4428 _prev_end_offset = cur_offset + envelope_size;
4429 if 2 > max_ordinal {
4430 return Ok(());
4431 }
4432
4433 let cur_offset: usize = (2 - 1) * envelope_size;
4436
4437 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4439
4440 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4445 self.local_y.as_ref().map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4446 encoder,
4447 offset + cur_offset,
4448 depth,
4449 )?;
4450
4451 _prev_end_offset = cur_offset + envelope_size;
4452 if 3 > max_ordinal {
4453 return Ok(());
4454 }
4455
4456 let cur_offset: usize = (3 - 1) * envelope_size;
4459
4460 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4462
4463 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4468 self.time_received.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4469 encoder,
4470 offset + cur_offset,
4471 depth,
4472 )?;
4473
4474 _prev_end_offset = cur_offset + envelope_size;
4475 if 4 > max_ordinal {
4476 return Ok(());
4477 }
4478
4479 let cur_offset: usize = (4 - 1) * envelope_size;
4482
4483 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4485
4486 fidl::encoding::encode_in_envelope_optional::<f64, D>(
4491 self.device_pixel_ratio
4492 .as_ref()
4493 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
4494 encoder,
4495 offset + cur_offset,
4496 depth,
4497 )?;
4498
4499 _prev_end_offset = cur_offset + envelope_size;
4500 if 5 > max_ordinal {
4501 return Ok(());
4502 }
4503
4504 let cur_offset: usize = (5 - 1) * envelope_size;
4507
4508 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4510
4511 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<1024>, D>(
4516 self.component_name.as_ref().map(<fidl::encoding::BoundedString<1024> as fidl::encoding::ValueTypeMarker>::borrow),
4517 encoder, offset + cur_offset, depth
4518 )?;
4519
4520 _prev_end_offset = cur_offset + envelope_size;
4521 if 6 > max_ordinal {
4522 return Ok(());
4523 }
4524
4525 let cur_offset: usize = (6 - 1) * envelope_size;
4528
4529 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4531
4532 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ui_pointer_common::EventPhase, D>(
4537 self.phase.as_ref().map(<fidl_fuchsia_ui_pointer_common::EventPhase as fidl::encoding::ValueTypeMarker>::borrow),
4538 encoder, offset + cur_offset, depth
4539 )?;
4540
4541 _prev_end_offset = cur_offset + envelope_size;
4542 if 7 > max_ordinal {
4543 return Ok(());
4544 }
4545
4546 let cur_offset: usize = (7 - 1) * envelope_size;
4549
4550 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4552
4553 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4558 self.pointer_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4559 encoder,
4560 offset + cur_offset,
4561 depth,
4562 )?;
4563
4564 _prev_end_offset = cur_offset + envelope_size;
4565 if 8 > max_ordinal {
4566 return Ok(());
4567 }
4568
4569 let cur_offset: usize = (8 - 1) * envelope_size;
4572
4573 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4575
4576 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4581 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4582 encoder,
4583 offset + cur_offset,
4584 depth,
4585 )?;
4586
4587 _prev_end_offset = cur_offset + envelope_size;
4588
4589 Ok(())
4590 }
4591 }
4592
4593 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4594 for TouchInputListenerReportTouchInputRequest
4595 {
4596 #[inline(always)]
4597 fn new_empty() -> Self {
4598 Self::default()
4599 }
4600
4601 unsafe fn decode(
4602 &mut self,
4603 decoder: &mut fidl::encoding::Decoder<'_, D>,
4604 offset: usize,
4605 mut depth: fidl::encoding::Depth,
4606 ) -> fidl::Result<()> {
4607 decoder.debug_check_bounds::<Self>(offset);
4608 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4609 None => return Err(fidl::Error::NotNullable),
4610 Some(len) => len,
4611 };
4612 if len == 0 {
4614 return Ok(());
4615 };
4616 depth.increment()?;
4617 let envelope_size = 8;
4618 let bytes_len = len * envelope_size;
4619 let offset = decoder.out_of_line_offset(bytes_len)?;
4620 let mut _next_ordinal_to_read = 0;
4622 let mut next_offset = offset;
4623 let end_offset = offset + bytes_len;
4624 _next_ordinal_to_read += 1;
4625 if next_offset >= end_offset {
4626 return Ok(());
4627 }
4628
4629 while _next_ordinal_to_read < 1 {
4631 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4632 _next_ordinal_to_read += 1;
4633 next_offset += envelope_size;
4634 }
4635
4636 let next_out_of_line = decoder.next_out_of_line();
4637 let handles_before = decoder.remaining_handles();
4638 if let Some((inlined, num_bytes, num_handles)) =
4639 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4640 {
4641 let member_inline_size =
4642 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4643 if inlined != (member_inline_size <= 4) {
4644 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4645 }
4646 let inner_offset;
4647 let mut inner_depth = depth.clone();
4648 if inlined {
4649 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4650 inner_offset = next_offset;
4651 } else {
4652 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4653 inner_depth.increment()?;
4654 }
4655 let val_ref = self.local_x.get_or_insert_with(|| fidl::new_empty!(f64, D));
4656 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4657 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4658 {
4659 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4660 }
4661 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4662 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4663 }
4664 }
4665
4666 next_offset += envelope_size;
4667 _next_ordinal_to_read += 1;
4668 if next_offset >= end_offset {
4669 return Ok(());
4670 }
4671
4672 while _next_ordinal_to_read < 2 {
4674 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4675 _next_ordinal_to_read += 1;
4676 next_offset += envelope_size;
4677 }
4678
4679 let next_out_of_line = decoder.next_out_of_line();
4680 let handles_before = decoder.remaining_handles();
4681 if let Some((inlined, num_bytes, num_handles)) =
4682 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4683 {
4684 let member_inline_size =
4685 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4686 if inlined != (member_inline_size <= 4) {
4687 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4688 }
4689 let inner_offset;
4690 let mut inner_depth = depth.clone();
4691 if inlined {
4692 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4693 inner_offset = next_offset;
4694 } else {
4695 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4696 inner_depth.increment()?;
4697 }
4698 let val_ref = self.local_y.get_or_insert_with(|| fidl::new_empty!(f64, D));
4699 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4700 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4701 {
4702 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4703 }
4704 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4705 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4706 }
4707 }
4708
4709 next_offset += envelope_size;
4710 _next_ordinal_to_read += 1;
4711 if next_offset >= end_offset {
4712 return Ok(());
4713 }
4714
4715 while _next_ordinal_to_read < 3 {
4717 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4718 _next_ordinal_to_read += 1;
4719 next_offset += envelope_size;
4720 }
4721
4722 let next_out_of_line = decoder.next_out_of_line();
4723 let handles_before = decoder.remaining_handles();
4724 if let Some((inlined, num_bytes, num_handles)) =
4725 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4726 {
4727 let member_inline_size =
4728 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4729 if inlined != (member_inline_size <= 4) {
4730 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4731 }
4732 let inner_offset;
4733 let mut inner_depth = depth.clone();
4734 if inlined {
4735 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4736 inner_offset = next_offset;
4737 } else {
4738 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4739 inner_depth.increment()?;
4740 }
4741 let val_ref = self.time_received.get_or_insert_with(|| fidl::new_empty!(i64, D));
4742 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4743 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4744 {
4745 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4746 }
4747 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4748 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4749 }
4750 }
4751
4752 next_offset += envelope_size;
4753 _next_ordinal_to_read += 1;
4754 if next_offset >= end_offset {
4755 return Ok(());
4756 }
4757
4758 while _next_ordinal_to_read < 4 {
4760 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4761 _next_ordinal_to_read += 1;
4762 next_offset += envelope_size;
4763 }
4764
4765 let next_out_of_line = decoder.next_out_of_line();
4766 let handles_before = decoder.remaining_handles();
4767 if let Some((inlined, num_bytes, num_handles)) =
4768 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4769 {
4770 let member_inline_size =
4771 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4772 if inlined != (member_inline_size <= 4) {
4773 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4774 }
4775 let inner_offset;
4776 let mut inner_depth = depth.clone();
4777 if inlined {
4778 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4779 inner_offset = next_offset;
4780 } else {
4781 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4782 inner_depth.increment()?;
4783 }
4784 let val_ref =
4785 self.device_pixel_ratio.get_or_insert_with(|| fidl::new_empty!(f64, D));
4786 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
4787 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4788 {
4789 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4790 }
4791 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4792 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4793 }
4794 }
4795
4796 next_offset += envelope_size;
4797 _next_ordinal_to_read += 1;
4798 if next_offset >= end_offset {
4799 return Ok(());
4800 }
4801
4802 while _next_ordinal_to_read < 5 {
4804 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4805 _next_ordinal_to_read += 1;
4806 next_offset += envelope_size;
4807 }
4808
4809 let next_out_of_line = decoder.next_out_of_line();
4810 let handles_before = decoder.remaining_handles();
4811 if let Some((inlined, num_bytes, num_handles)) =
4812 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4813 {
4814 let member_inline_size = <fidl::encoding::BoundedString<1024> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4815 if inlined != (member_inline_size <= 4) {
4816 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4817 }
4818 let inner_offset;
4819 let mut inner_depth = depth.clone();
4820 if inlined {
4821 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4822 inner_offset = next_offset;
4823 } else {
4824 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4825 inner_depth.increment()?;
4826 }
4827 let val_ref = self.component_name.get_or_insert_with(|| {
4828 fidl::new_empty!(fidl::encoding::BoundedString<1024>, D)
4829 });
4830 fidl::decode!(
4831 fidl::encoding::BoundedString<1024>,
4832 D,
4833 val_ref,
4834 decoder,
4835 inner_offset,
4836 inner_depth
4837 )?;
4838 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4839 {
4840 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4841 }
4842 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4843 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4844 }
4845 }
4846
4847 next_offset += envelope_size;
4848 _next_ordinal_to_read += 1;
4849 if next_offset >= end_offset {
4850 return Ok(());
4851 }
4852
4853 while _next_ordinal_to_read < 6 {
4855 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4856 _next_ordinal_to_read += 1;
4857 next_offset += envelope_size;
4858 }
4859
4860 let next_out_of_line = decoder.next_out_of_line();
4861 let handles_before = decoder.remaining_handles();
4862 if let Some((inlined, num_bytes, num_handles)) =
4863 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4864 {
4865 let member_inline_size = <fidl_fuchsia_ui_pointer_common::EventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4866 if inlined != (member_inline_size <= 4) {
4867 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4868 }
4869 let inner_offset;
4870 let mut inner_depth = depth.clone();
4871 if inlined {
4872 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4873 inner_offset = next_offset;
4874 } else {
4875 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4876 inner_depth.increment()?;
4877 }
4878 let val_ref = self.phase.get_or_insert_with(|| {
4879 fidl::new_empty!(fidl_fuchsia_ui_pointer_common::EventPhase, D)
4880 });
4881 fidl::decode!(
4882 fidl_fuchsia_ui_pointer_common::EventPhase,
4883 D,
4884 val_ref,
4885 decoder,
4886 inner_offset,
4887 inner_depth
4888 )?;
4889 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4890 {
4891 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4892 }
4893 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4894 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4895 }
4896 }
4897
4898 next_offset += envelope_size;
4899 _next_ordinal_to_read += 1;
4900 if next_offset >= end_offset {
4901 return Ok(());
4902 }
4903
4904 while _next_ordinal_to_read < 7 {
4906 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4907 _next_ordinal_to_read += 1;
4908 next_offset += envelope_size;
4909 }
4910
4911 let next_out_of_line = decoder.next_out_of_line();
4912 let handles_before = decoder.remaining_handles();
4913 if let Some((inlined, num_bytes, num_handles)) =
4914 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4915 {
4916 let member_inline_size =
4917 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4918 if inlined != (member_inline_size <= 4) {
4919 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4920 }
4921 let inner_offset;
4922 let mut inner_depth = depth.clone();
4923 if inlined {
4924 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4925 inner_offset = next_offset;
4926 } else {
4927 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4928 inner_depth.increment()?;
4929 }
4930 let val_ref = self.pointer_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4931 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4932 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4933 {
4934 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4935 }
4936 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4937 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4938 }
4939 }
4940
4941 next_offset += envelope_size;
4942 _next_ordinal_to_read += 1;
4943 if next_offset >= end_offset {
4944 return Ok(());
4945 }
4946
4947 while _next_ordinal_to_read < 8 {
4949 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4950 _next_ordinal_to_read += 1;
4951 next_offset += envelope_size;
4952 }
4953
4954 let next_out_of_line = decoder.next_out_of_line();
4955 let handles_before = decoder.remaining_handles();
4956 if let Some((inlined, num_bytes, num_handles)) =
4957 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4958 {
4959 let member_inline_size =
4960 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4961 if inlined != (member_inline_size <= 4) {
4962 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4963 }
4964 let inner_offset;
4965 let mut inner_depth = depth.clone();
4966 if inlined {
4967 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4968 inner_offset = next_offset;
4969 } else {
4970 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4971 inner_depth.increment()?;
4972 }
4973 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4974 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4975 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4976 {
4977 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4978 }
4979 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4980 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4981 }
4982 }
4983
4984 next_offset += envelope_size;
4985
4986 while next_offset < end_offset {
4988 _next_ordinal_to_read += 1;
4989 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4990 next_offset += envelope_size;
4991 }
4992
4993 Ok(())
4994 }
4995 }
4996
4997 impl TouchInputReport {
4998 #[inline(always)]
4999 fn max_ordinal_present(&self) -> u64 {
5000 if let Some(_) = self.pressed_buttons {
5001 return 2;
5002 }
5003 if let Some(_) = self.contacts {
5004 return 1;
5005 }
5006 0
5007 }
5008 }
5009
5010 impl fidl::encoding::ValueTypeMarker for TouchInputReport {
5011 type Borrowed<'a> = &'a Self;
5012 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5013 value
5014 }
5015 }
5016
5017 unsafe impl fidl::encoding::TypeMarker for TouchInputReport {
5018 type Owned = Self;
5019
5020 #[inline(always)]
5021 fn inline_align(_context: fidl::encoding::Context) -> usize {
5022 8
5023 }
5024
5025 #[inline(always)]
5026 fn inline_size(_context: fidl::encoding::Context) -> usize {
5027 16
5028 }
5029 }
5030
5031 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputReport, D>
5032 for &TouchInputReport
5033 {
5034 unsafe fn encode(
5035 self,
5036 encoder: &mut fidl::encoding::Encoder<'_, D>,
5037 offset: usize,
5038 mut depth: fidl::encoding::Depth,
5039 ) -> fidl::Result<()> {
5040 encoder.debug_check_bounds::<TouchInputReport>(offset);
5041 let max_ordinal: u64 = self.max_ordinal_present();
5043 encoder.write_num(max_ordinal, offset);
5044 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5045 if max_ordinal == 0 {
5047 return Ok(());
5048 }
5049 depth.increment()?;
5050 let envelope_size = 8;
5051 let bytes_len = max_ordinal as usize * envelope_size;
5052 #[allow(unused_variables)]
5053 let offset = encoder.out_of_line_offset(bytes_len);
5054 let mut _prev_end_offset: usize = 0;
5055 if 1 > max_ordinal {
5056 return Ok(());
5057 }
5058
5059 let cur_offset: usize = (1 - 1) * envelope_size;
5062
5063 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5065
5066 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputReport, 10>, D>(
5071 self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::ValueTypeMarker>::borrow),
5072 encoder, offset + cur_offset, depth
5073 )?;
5074
5075 _prev_end_offset = cur_offset + envelope_size;
5076 if 2 > max_ordinal {
5077 return Ok(());
5078 }
5079
5080 let cur_offset: usize = (2 - 1) * envelope_size;
5083
5084 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5086
5087 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
5092 self.pressed_buttons.as_ref().map(
5093 <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
5094 ),
5095 encoder,
5096 offset + cur_offset,
5097 depth,
5098 )?;
5099
5100 _prev_end_offset = cur_offset + envelope_size;
5101
5102 Ok(())
5103 }
5104 }
5105
5106 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputReport {
5107 #[inline(always)]
5108 fn new_empty() -> Self {
5109 Self::default()
5110 }
5111
5112 unsafe fn decode(
5113 &mut self,
5114 decoder: &mut fidl::encoding::Decoder<'_, D>,
5115 offset: usize,
5116 mut depth: fidl::encoding::Depth,
5117 ) -> fidl::Result<()> {
5118 decoder.debug_check_bounds::<Self>(offset);
5119 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5120 None => return Err(fidl::Error::NotNullable),
5121 Some(len) => len,
5122 };
5123 if len == 0 {
5125 return Ok(());
5126 };
5127 depth.increment()?;
5128 let envelope_size = 8;
5129 let bytes_len = len * envelope_size;
5130 let offset = decoder.out_of_line_offset(bytes_len)?;
5131 let mut _next_ordinal_to_read = 0;
5133 let mut next_offset = offset;
5134 let end_offset = offset + bytes_len;
5135 _next_ordinal_to_read += 1;
5136 if next_offset >= end_offset {
5137 return Ok(());
5138 }
5139
5140 while _next_ordinal_to_read < 1 {
5142 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5143 _next_ordinal_to_read += 1;
5144 next_offset += envelope_size;
5145 }
5146
5147 let next_out_of_line = decoder.next_out_of_line();
5148 let handles_before = decoder.remaining_handles();
5149 if let Some((inlined, num_bytes, num_handles)) =
5150 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5151 {
5152 let member_inline_size = <fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5153 if inlined != (member_inline_size <= 4) {
5154 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5155 }
5156 let inner_offset;
5157 let mut inner_depth = depth.clone();
5158 if inlined {
5159 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5160 inner_offset = next_offset;
5161 } else {
5162 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5163 inner_depth.increment()?;
5164 }
5165 let val_ref = self.contacts.get_or_insert_with(
5166 || fidl::new_empty!(fidl::encoding::Vector<ContactInputReport, 10>, D),
5167 );
5168 fidl::decode!(fidl::encoding::Vector<ContactInputReport, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5169 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5170 {
5171 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5172 }
5173 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5174 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5175 }
5176 }
5177
5178 next_offset += envelope_size;
5179 _next_ordinal_to_read += 1;
5180 if next_offset >= end_offset {
5181 return Ok(());
5182 }
5183
5184 while _next_ordinal_to_read < 2 {
5186 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5187 _next_ordinal_to_read += 1;
5188 next_offset += envelope_size;
5189 }
5190
5191 let next_out_of_line = decoder.next_out_of_line();
5192 let handles_before = decoder.remaining_handles();
5193 if let Some((inlined, num_bytes, num_handles)) =
5194 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5195 {
5196 let member_inline_size =
5197 <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
5198 decoder.context,
5199 );
5200 if inlined != (member_inline_size <= 4) {
5201 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5202 }
5203 let inner_offset;
5204 let mut inner_depth = depth.clone();
5205 if inlined {
5206 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5207 inner_offset = next_offset;
5208 } else {
5209 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5210 inner_depth.increment()?;
5211 }
5212 let val_ref = self
5213 .pressed_buttons
5214 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
5215 fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5216 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5217 {
5218 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5219 }
5220 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5221 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5222 }
5223 }
5224
5225 next_offset += envelope_size;
5226
5227 while next_offset < end_offset {
5229 _next_ordinal_to_read += 1;
5230 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5231 next_offset += envelope_size;
5232 }
5233
5234 Ok(())
5235 }
5236 }
5237
5238 impl TouchScreenSimulateMultiFingerGestureRequest {
5239 #[inline(always)]
5240 fn max_ordinal_present(&self) -> u64 {
5241 if let Some(_) = self.finger_count {
5242 return 4;
5243 }
5244 if let Some(_) = self.move_event_count {
5245 return 3;
5246 }
5247 if let Some(_) = self.end_locations {
5248 return 2;
5249 }
5250 if let Some(_) = self.start_locations {
5251 return 1;
5252 }
5253 0
5254 }
5255 }
5256
5257 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
5258 type Borrowed<'a> = &'a Self;
5259 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5260 value
5261 }
5262 }
5263
5264 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiFingerGestureRequest {
5265 type Owned = Self;
5266
5267 #[inline(always)]
5268 fn inline_align(_context: fidl::encoding::Context) -> usize {
5269 8
5270 }
5271
5272 #[inline(always)]
5273 fn inline_size(_context: fidl::encoding::Context) -> usize {
5274 16
5275 }
5276 }
5277
5278 unsafe impl<D: fidl::encoding::ResourceDialect>
5279 fidl::encoding::Encode<TouchScreenSimulateMultiFingerGestureRequest, D>
5280 for &TouchScreenSimulateMultiFingerGestureRequest
5281 {
5282 unsafe fn encode(
5283 self,
5284 encoder: &mut fidl::encoding::Encoder<'_, D>,
5285 offset: usize,
5286 mut depth: fidl::encoding::Depth,
5287 ) -> fidl::Result<()> {
5288 encoder.debug_check_bounds::<TouchScreenSimulateMultiFingerGestureRequest>(offset);
5289 let max_ordinal: u64 = self.max_ordinal_present();
5291 encoder.write_num(max_ordinal, offset);
5292 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5293 if max_ordinal == 0 {
5295 return Ok(());
5296 }
5297 depth.increment()?;
5298 let envelope_size = 8;
5299 let bytes_len = max_ordinal as usize * envelope_size;
5300 #[allow(unused_variables)]
5301 let offset = encoder.out_of_line_offset(bytes_len);
5302 let mut _prev_end_offset: usize = 0;
5303 if 1 > max_ordinal {
5304 return Ok(());
5305 }
5306
5307 let cur_offset: usize = (1 - 1) * envelope_size;
5310
5311 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5313
5314 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D>(
5319 self.start_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
5320 encoder, offset + cur_offset, depth
5321 )?;
5322
5323 _prev_end_offset = cur_offset + envelope_size;
5324 if 2 > max_ordinal {
5325 return Ok(());
5326 }
5327
5328 let cur_offset: usize = (2 - 1) * envelope_size;
5331
5332 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5334
5335 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D>(
5340 self.end_locations.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
5341 encoder, offset + cur_offset, depth
5342 )?;
5343
5344 _prev_end_offset = cur_offset + envelope_size;
5345 if 3 > max_ordinal {
5346 return Ok(());
5347 }
5348
5349 let cur_offset: usize = (3 - 1) * envelope_size;
5352
5353 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5355
5356 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5361 self.move_event_count
5362 .as_ref()
5363 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5364 encoder,
5365 offset + cur_offset,
5366 depth,
5367 )?;
5368
5369 _prev_end_offset = cur_offset + envelope_size;
5370 if 4 > max_ordinal {
5371 return Ok(());
5372 }
5373
5374 let cur_offset: usize = (4 - 1) * envelope_size;
5377
5378 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5380
5381 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5386 self.finger_count.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5387 encoder,
5388 offset + cur_offset,
5389 depth,
5390 )?;
5391
5392 _prev_end_offset = cur_offset + envelope_size;
5393
5394 Ok(())
5395 }
5396 }
5397
5398 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5399 for TouchScreenSimulateMultiFingerGestureRequest
5400 {
5401 #[inline(always)]
5402 fn new_empty() -> Self {
5403 Self::default()
5404 }
5405
5406 unsafe fn decode(
5407 &mut self,
5408 decoder: &mut fidl::encoding::Decoder<'_, D>,
5409 offset: usize,
5410 mut depth: fidl::encoding::Depth,
5411 ) -> fidl::Result<()> {
5412 decoder.debug_check_bounds::<Self>(offset);
5413 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5414 None => return Err(fidl::Error::NotNullable),
5415 Some(len) => len,
5416 };
5417 if len == 0 {
5419 return Ok(());
5420 };
5421 depth.increment()?;
5422 let envelope_size = 8;
5423 let bytes_len = len * envelope_size;
5424 let offset = decoder.out_of_line_offset(bytes_len)?;
5425 let mut _next_ordinal_to_read = 0;
5427 let mut next_offset = offset;
5428 let end_offset = offset + bytes_len;
5429 _next_ordinal_to_read += 1;
5430 if next_offset >= end_offset {
5431 return Ok(());
5432 }
5433
5434 while _next_ordinal_to_read < 1 {
5436 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5437 _next_ordinal_to_read += 1;
5438 next_offset += envelope_size;
5439 }
5440
5441 let next_out_of_line = decoder.next_out_of_line();
5442 let handles_before = decoder.remaining_handles();
5443 if let Some((inlined, num_bytes, num_handles)) =
5444 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5445 {
5446 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5447 if inlined != (member_inline_size <= 4) {
5448 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5449 }
5450 let inner_offset;
5451 let mut inner_depth = depth.clone();
5452 if inlined {
5453 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5454 inner_offset = next_offset;
5455 } else {
5456 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5457 inner_depth.increment()?;
5458 }
5459 let val_ref =
5460 self.start_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D));
5461 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5462 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5463 {
5464 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5465 }
5466 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5467 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5468 }
5469 }
5470
5471 next_offset += envelope_size;
5472 _next_ordinal_to_read += 1;
5473 if next_offset >= end_offset {
5474 return Ok(());
5475 }
5476
5477 while _next_ordinal_to_read < 2 {
5479 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5480 _next_ordinal_to_read += 1;
5481 next_offset += envelope_size;
5482 }
5483
5484 let next_out_of_line = decoder.next_out_of_line();
5485 let handles_before = decoder.remaining_handles();
5486 if let Some((inlined, num_bytes, num_handles)) =
5487 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5488 {
5489 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5490 if inlined != (member_inline_size <= 4) {
5491 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5492 }
5493 let inner_offset;
5494 let mut inner_depth = depth.clone();
5495 if inlined {
5496 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5497 inner_offset = next_offset;
5498 } else {
5499 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5500 inner_depth.increment()?;
5501 }
5502 let val_ref =
5503 self.end_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D));
5504 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_math_common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5505 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5506 {
5507 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5508 }
5509 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5510 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5511 }
5512 }
5513
5514 next_offset += envelope_size;
5515 _next_ordinal_to_read += 1;
5516 if next_offset >= end_offset {
5517 return Ok(());
5518 }
5519
5520 while _next_ordinal_to_read < 3 {
5522 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5523 _next_ordinal_to_read += 1;
5524 next_offset += envelope_size;
5525 }
5526
5527 let next_out_of_line = decoder.next_out_of_line();
5528 let handles_before = decoder.remaining_handles();
5529 if let Some((inlined, num_bytes, num_handles)) =
5530 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5531 {
5532 let member_inline_size =
5533 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5534 if inlined != (member_inline_size <= 4) {
5535 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5536 }
5537 let inner_offset;
5538 let mut inner_depth = depth.clone();
5539 if inlined {
5540 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5541 inner_offset = next_offset;
5542 } else {
5543 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5544 inner_depth.increment()?;
5545 }
5546 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5547 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5548 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5549 {
5550 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5551 }
5552 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5553 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5554 }
5555 }
5556
5557 next_offset += envelope_size;
5558 _next_ordinal_to_read += 1;
5559 if next_offset >= end_offset {
5560 return Ok(());
5561 }
5562
5563 while _next_ordinal_to_read < 4 {
5565 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5566 _next_ordinal_to_read += 1;
5567 next_offset += envelope_size;
5568 }
5569
5570 let next_out_of_line = decoder.next_out_of_line();
5571 let handles_before = decoder.remaining_handles();
5572 if let Some((inlined, num_bytes, num_handles)) =
5573 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5574 {
5575 let member_inline_size =
5576 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5577 if inlined != (member_inline_size <= 4) {
5578 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5579 }
5580 let inner_offset;
5581 let mut inner_depth = depth.clone();
5582 if inlined {
5583 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5584 inner_offset = next_offset;
5585 } else {
5586 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5587 inner_depth.increment()?;
5588 }
5589 let val_ref = self.finger_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
5590 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5591 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5592 {
5593 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5594 }
5595 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5596 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5597 }
5598 }
5599
5600 next_offset += envelope_size;
5601
5602 while next_offset < end_offset {
5604 _next_ordinal_to_read += 1;
5605 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5606 next_offset += envelope_size;
5607 }
5608
5609 Ok(())
5610 }
5611 }
5612
5613 impl TouchScreenSimulateMultiTapRequest {
5614 #[inline(always)]
5615 fn max_ordinal_present(&self) -> u64 {
5616 if let Some(_) = self.tap_locations {
5617 return 1;
5618 }
5619 0
5620 }
5621 }
5622
5623 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateMultiTapRequest {
5624 type Borrowed<'a> = &'a Self;
5625 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5626 value
5627 }
5628 }
5629
5630 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateMultiTapRequest {
5631 type Owned = Self;
5632
5633 #[inline(always)]
5634 fn inline_align(_context: fidl::encoding::Context) -> usize {
5635 8
5636 }
5637
5638 #[inline(always)]
5639 fn inline_size(_context: fidl::encoding::Context) -> usize {
5640 16
5641 }
5642 }
5643
5644 unsafe impl<D: fidl::encoding::ResourceDialect>
5645 fidl::encoding::Encode<TouchScreenSimulateMultiTapRequest, D>
5646 for &TouchScreenSimulateMultiTapRequest
5647 {
5648 unsafe fn encode(
5649 self,
5650 encoder: &mut fidl::encoding::Encoder<'_, D>,
5651 offset: usize,
5652 mut depth: fidl::encoding::Depth,
5653 ) -> fidl::Result<()> {
5654 encoder.debug_check_bounds::<TouchScreenSimulateMultiTapRequest>(offset);
5655 let max_ordinal: u64 = self.max_ordinal_present();
5657 encoder.write_num(max_ordinal, offset);
5658 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5659 if max_ordinal == 0 {
5661 return Ok(());
5662 }
5663 depth.increment()?;
5664 let envelope_size = 8;
5665 let bytes_len = max_ordinal as usize * envelope_size;
5666 #[allow(unused_variables)]
5667 let offset = encoder.out_of_line_offset(bytes_len);
5668 let mut _prev_end_offset: usize = 0;
5669 if 1 > max_ordinal {
5670 return Ok(());
5671 }
5672
5673 let cur_offset: usize = (1 - 1) * envelope_size;
5676
5677 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5679
5680 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10>, D>(
5685 self.tap_locations.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::ValueTypeMarker>::borrow),
5686 encoder, offset + cur_offset, depth
5687 )?;
5688
5689 _prev_end_offset = cur_offset + envelope_size;
5690
5691 Ok(())
5692 }
5693 }
5694
5695 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5696 for TouchScreenSimulateMultiTapRequest
5697 {
5698 #[inline(always)]
5699 fn new_empty() -> Self {
5700 Self::default()
5701 }
5702
5703 unsafe fn decode(
5704 &mut self,
5705 decoder: &mut fidl::encoding::Decoder<'_, D>,
5706 offset: usize,
5707 mut depth: fidl::encoding::Depth,
5708 ) -> fidl::Result<()> {
5709 decoder.debug_check_bounds::<Self>(offset);
5710 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5711 None => return Err(fidl::Error::NotNullable),
5712 Some(len) => len,
5713 };
5714 if len == 0 {
5716 return Ok(());
5717 };
5718 depth.increment()?;
5719 let envelope_size = 8;
5720 let bytes_len = len * envelope_size;
5721 let offset = decoder.out_of_line_offset(bytes_len)?;
5722 let mut _next_ordinal_to_read = 0;
5724 let mut next_offset = offset;
5725 let end_offset = offset + bytes_len;
5726 _next_ordinal_to_read += 1;
5727 if next_offset >= end_offset {
5728 return Ok(());
5729 }
5730
5731 while _next_ordinal_to_read < 1 {
5733 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5734 _next_ordinal_to_read += 1;
5735 next_offset += envelope_size;
5736 }
5737
5738 let next_out_of_line = decoder.next_out_of_line();
5739 let handles_before = decoder.remaining_handles();
5740 if let Some((inlined, num_bytes, num_handles)) =
5741 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5742 {
5743 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5744 if inlined != (member_inline_size <= 4) {
5745 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5746 }
5747 let inner_offset;
5748 let mut inner_depth = depth.clone();
5749 if inlined {
5750 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5751 inner_offset = next_offset;
5752 } else {
5753 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5754 inner_depth.increment()?;
5755 }
5756 let val_ref =
5757 self.tap_locations.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10>, D));
5758 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_math_common::Vec_, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
5759 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5760 {
5761 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5762 }
5763 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5764 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5765 }
5766 }
5767
5768 next_offset += envelope_size;
5769
5770 while next_offset < end_offset {
5772 _next_ordinal_to_read += 1;
5773 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5774 next_offset += envelope_size;
5775 }
5776
5777 Ok(())
5778 }
5779 }
5780
5781 impl TouchScreenSimulateSwipeRequest {
5782 #[inline(always)]
5783 fn max_ordinal_present(&self) -> u64 {
5784 if let Some(_) = self.duration {
5785 return 4;
5786 }
5787 if let Some(_) = self.move_event_count {
5788 return 3;
5789 }
5790 if let Some(_) = self.end_location {
5791 return 2;
5792 }
5793 if let Some(_) = self.start_location {
5794 return 1;
5795 }
5796 0
5797 }
5798 }
5799
5800 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateSwipeRequest {
5801 type Borrowed<'a> = &'a Self;
5802 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5803 value
5804 }
5805 }
5806
5807 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateSwipeRequest {
5808 type Owned = Self;
5809
5810 #[inline(always)]
5811 fn inline_align(_context: fidl::encoding::Context) -> usize {
5812 8
5813 }
5814
5815 #[inline(always)]
5816 fn inline_size(_context: fidl::encoding::Context) -> usize {
5817 16
5818 }
5819 }
5820
5821 unsafe impl<D: fidl::encoding::ResourceDialect>
5822 fidl::encoding::Encode<TouchScreenSimulateSwipeRequest, D>
5823 for &TouchScreenSimulateSwipeRequest
5824 {
5825 unsafe fn encode(
5826 self,
5827 encoder: &mut fidl::encoding::Encoder<'_, D>,
5828 offset: usize,
5829 mut depth: fidl::encoding::Depth,
5830 ) -> fidl::Result<()> {
5831 encoder.debug_check_bounds::<TouchScreenSimulateSwipeRequest>(offset);
5832 let max_ordinal: u64 = self.max_ordinal_present();
5834 encoder.write_num(max_ordinal, offset);
5835 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5836 if max_ordinal == 0 {
5838 return Ok(());
5839 }
5840 depth.increment()?;
5841 let envelope_size = 8;
5842 let bytes_len = max_ordinal as usize * envelope_size;
5843 #[allow(unused_variables)]
5844 let offset = encoder.out_of_line_offset(bytes_len);
5845 let mut _prev_end_offset: usize = 0;
5846 if 1 > max_ordinal {
5847 return Ok(());
5848 }
5849
5850 let cur_offset: usize = (1 - 1) * envelope_size;
5853
5854 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5856
5857 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::Vec_, D>(
5862 self.start_location.as_ref().map(
5863 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5864 ),
5865 encoder,
5866 offset + cur_offset,
5867 depth,
5868 )?;
5869
5870 _prev_end_offset = cur_offset + envelope_size;
5871 if 2 > max_ordinal {
5872 return Ok(());
5873 }
5874
5875 let cur_offset: usize = (2 - 1) * envelope_size;
5878
5879 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5881
5882 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::Vec_, D>(
5887 self.end_location.as_ref().map(
5888 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
5889 ),
5890 encoder,
5891 offset + cur_offset,
5892 depth,
5893 )?;
5894
5895 _prev_end_offset = cur_offset + envelope_size;
5896 if 3 > max_ordinal {
5897 return Ok(());
5898 }
5899
5900 let cur_offset: usize = (3 - 1) * envelope_size;
5903
5904 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5906
5907 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5912 self.move_event_count
5913 .as_ref()
5914 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5915 encoder,
5916 offset + cur_offset,
5917 depth,
5918 )?;
5919
5920 _prev_end_offset = cur_offset + envelope_size;
5921 if 4 > max_ordinal {
5922 return Ok(());
5923 }
5924
5925 let cur_offset: usize = (4 - 1) * envelope_size;
5928
5929 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5931
5932 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5937 self.duration.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5938 encoder,
5939 offset + cur_offset,
5940 depth,
5941 )?;
5942
5943 _prev_end_offset = cur_offset + envelope_size;
5944
5945 Ok(())
5946 }
5947 }
5948
5949 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
5950 for TouchScreenSimulateSwipeRequest
5951 {
5952 #[inline(always)]
5953 fn new_empty() -> Self {
5954 Self::default()
5955 }
5956
5957 unsafe fn decode(
5958 &mut self,
5959 decoder: &mut fidl::encoding::Decoder<'_, D>,
5960 offset: usize,
5961 mut depth: fidl::encoding::Depth,
5962 ) -> fidl::Result<()> {
5963 decoder.debug_check_bounds::<Self>(offset);
5964 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5965 None => return Err(fidl::Error::NotNullable),
5966 Some(len) => len,
5967 };
5968 if len == 0 {
5970 return Ok(());
5971 };
5972 depth.increment()?;
5973 let envelope_size = 8;
5974 let bytes_len = len * envelope_size;
5975 let offset = decoder.out_of_line_offset(bytes_len)?;
5976 let mut _next_ordinal_to_read = 0;
5978 let mut next_offset = offset;
5979 let end_offset = offset + bytes_len;
5980 _next_ordinal_to_read += 1;
5981 if next_offset >= end_offset {
5982 return Ok(());
5983 }
5984
5985 while _next_ordinal_to_read < 1 {
5987 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5988 _next_ordinal_to_read += 1;
5989 next_offset += envelope_size;
5990 }
5991
5992 let next_out_of_line = decoder.next_out_of_line();
5993 let handles_before = decoder.remaining_handles();
5994 if let Some((inlined, num_bytes, num_handles)) =
5995 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5996 {
5997 let member_inline_size =
5998 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
5999 decoder.context,
6000 );
6001 if inlined != (member_inline_size <= 4) {
6002 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6003 }
6004 let inner_offset;
6005 let mut inner_depth = depth.clone();
6006 if inlined {
6007 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6008 inner_offset = next_offset;
6009 } else {
6010 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6011 inner_depth.increment()?;
6012 }
6013 let val_ref = self
6014 .start_location
6015 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::Vec_, D));
6016 fidl::decode!(
6017 fidl_fuchsia_math_common::Vec_,
6018 D,
6019 val_ref,
6020 decoder,
6021 inner_offset,
6022 inner_depth
6023 )?;
6024 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6025 {
6026 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6027 }
6028 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6029 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6030 }
6031 }
6032
6033 next_offset += envelope_size;
6034 _next_ordinal_to_read += 1;
6035 if next_offset >= end_offset {
6036 return Ok(());
6037 }
6038
6039 while _next_ordinal_to_read < 2 {
6041 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6042 _next_ordinal_to_read += 1;
6043 next_offset += envelope_size;
6044 }
6045
6046 let next_out_of_line = decoder.next_out_of_line();
6047 let handles_before = decoder.remaining_handles();
6048 if let Some((inlined, num_bytes, num_handles)) =
6049 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6050 {
6051 let member_inline_size =
6052 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
6053 decoder.context,
6054 );
6055 if inlined != (member_inline_size <= 4) {
6056 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6057 }
6058 let inner_offset;
6059 let mut inner_depth = depth.clone();
6060 if inlined {
6061 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6062 inner_offset = next_offset;
6063 } else {
6064 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6065 inner_depth.increment()?;
6066 }
6067 let val_ref = self
6068 .end_location
6069 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::Vec_, D));
6070 fidl::decode!(
6071 fidl_fuchsia_math_common::Vec_,
6072 D,
6073 val_ref,
6074 decoder,
6075 inner_offset,
6076 inner_depth
6077 )?;
6078 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6079 {
6080 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6081 }
6082 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6083 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6084 }
6085 }
6086
6087 next_offset += envelope_size;
6088 _next_ordinal_to_read += 1;
6089 if next_offset >= end_offset {
6090 return Ok(());
6091 }
6092
6093 while _next_ordinal_to_read < 3 {
6095 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6096 _next_ordinal_to_read += 1;
6097 next_offset += envelope_size;
6098 }
6099
6100 let next_out_of_line = decoder.next_out_of_line();
6101 let handles_before = decoder.remaining_handles();
6102 if let Some((inlined, num_bytes, num_handles)) =
6103 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6104 {
6105 let member_inline_size =
6106 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6107 if inlined != (member_inline_size <= 4) {
6108 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6109 }
6110 let inner_offset;
6111 let mut inner_depth = depth.clone();
6112 if inlined {
6113 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6114 inner_offset = next_offset;
6115 } else {
6116 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6117 inner_depth.increment()?;
6118 }
6119 let val_ref = self.move_event_count.get_or_insert_with(|| fidl::new_empty!(u32, D));
6120 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6121 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6122 {
6123 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6124 }
6125 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6126 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6127 }
6128 }
6129
6130 next_offset += envelope_size;
6131 _next_ordinal_to_read += 1;
6132 if next_offset >= end_offset {
6133 return Ok(());
6134 }
6135
6136 while _next_ordinal_to_read < 4 {
6138 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6139 _next_ordinal_to_read += 1;
6140 next_offset += envelope_size;
6141 }
6142
6143 let next_out_of_line = decoder.next_out_of_line();
6144 let handles_before = decoder.remaining_handles();
6145 if let Some((inlined, num_bytes, num_handles)) =
6146 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6147 {
6148 let member_inline_size =
6149 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6150 if inlined != (member_inline_size <= 4) {
6151 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6152 }
6153 let inner_offset;
6154 let mut inner_depth = depth.clone();
6155 if inlined {
6156 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6157 inner_offset = next_offset;
6158 } else {
6159 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6160 inner_depth.increment()?;
6161 }
6162 let val_ref = self.duration.get_or_insert_with(|| fidl::new_empty!(i64, D));
6163 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6164 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6165 {
6166 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6167 }
6168 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6169 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6170 }
6171 }
6172
6173 next_offset += envelope_size;
6174
6175 while next_offset < end_offset {
6177 _next_ordinal_to_read += 1;
6178 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6179 next_offset += envelope_size;
6180 }
6181
6182 Ok(())
6183 }
6184 }
6185
6186 impl TouchScreenSimulateTapRequest {
6187 #[inline(always)]
6188 fn max_ordinal_present(&self) -> u64 {
6189 if let Some(_) = self.tap_location {
6190 return 1;
6191 }
6192 0
6193 }
6194 }
6195
6196 impl fidl::encoding::ValueTypeMarker for TouchScreenSimulateTapRequest {
6197 type Borrowed<'a> = &'a Self;
6198 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6199 value
6200 }
6201 }
6202
6203 unsafe impl fidl::encoding::TypeMarker for TouchScreenSimulateTapRequest {
6204 type Owned = Self;
6205
6206 #[inline(always)]
6207 fn inline_align(_context: fidl::encoding::Context) -> usize {
6208 8
6209 }
6210
6211 #[inline(always)]
6212 fn inline_size(_context: fidl::encoding::Context) -> usize {
6213 16
6214 }
6215 }
6216
6217 unsafe impl<D: fidl::encoding::ResourceDialect>
6218 fidl::encoding::Encode<TouchScreenSimulateTapRequest, D>
6219 for &TouchScreenSimulateTapRequest
6220 {
6221 unsafe fn encode(
6222 self,
6223 encoder: &mut fidl::encoding::Encoder<'_, D>,
6224 offset: usize,
6225 mut depth: fidl::encoding::Depth,
6226 ) -> fidl::Result<()> {
6227 encoder.debug_check_bounds::<TouchScreenSimulateTapRequest>(offset);
6228 let max_ordinal: u64 = self.max_ordinal_present();
6230 encoder.write_num(max_ordinal, offset);
6231 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6232 if max_ordinal == 0 {
6234 return Ok(());
6235 }
6236 depth.increment()?;
6237 let envelope_size = 8;
6238 let bytes_len = max_ordinal as usize * envelope_size;
6239 #[allow(unused_variables)]
6240 let offset = encoder.out_of_line_offset(bytes_len);
6241 let mut _prev_end_offset: usize = 0;
6242 if 1 > max_ordinal {
6243 return Ok(());
6244 }
6245
6246 let cur_offset: usize = (1 - 1) * envelope_size;
6249
6250 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6252
6253 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_math_common::Vec_, D>(
6258 self.tap_location.as_ref().map(
6259 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::ValueTypeMarker>::borrow,
6260 ),
6261 encoder,
6262 offset + cur_offset,
6263 depth,
6264 )?;
6265
6266 _prev_end_offset = cur_offset + envelope_size;
6267
6268 Ok(())
6269 }
6270 }
6271
6272 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
6273 for TouchScreenSimulateTapRequest
6274 {
6275 #[inline(always)]
6276 fn new_empty() -> Self {
6277 Self::default()
6278 }
6279
6280 unsafe fn decode(
6281 &mut self,
6282 decoder: &mut fidl::encoding::Decoder<'_, D>,
6283 offset: usize,
6284 mut depth: fidl::encoding::Depth,
6285 ) -> fidl::Result<()> {
6286 decoder.debug_check_bounds::<Self>(offset);
6287 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6288 None => return Err(fidl::Error::NotNullable),
6289 Some(len) => len,
6290 };
6291 if len == 0 {
6293 return Ok(());
6294 };
6295 depth.increment()?;
6296 let envelope_size = 8;
6297 let bytes_len = len * envelope_size;
6298 let offset = decoder.out_of_line_offset(bytes_len)?;
6299 let mut _next_ordinal_to_read = 0;
6301 let mut next_offset = offset;
6302 let end_offset = offset + bytes_len;
6303 _next_ordinal_to_read += 1;
6304 if next_offset >= end_offset {
6305 return Ok(());
6306 }
6307
6308 while _next_ordinal_to_read < 1 {
6310 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6311 _next_ordinal_to_read += 1;
6312 next_offset += envelope_size;
6313 }
6314
6315 let next_out_of_line = decoder.next_out_of_line();
6316 let handles_before = decoder.remaining_handles();
6317 if let Some((inlined, num_bytes, num_handles)) =
6318 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6319 {
6320 let member_inline_size =
6321 <fidl_fuchsia_math_common::Vec_ as fidl::encoding::TypeMarker>::inline_size(
6322 decoder.context,
6323 );
6324 if inlined != (member_inline_size <= 4) {
6325 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6326 }
6327 let inner_offset;
6328 let mut inner_depth = depth.clone();
6329 if inlined {
6330 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6331 inner_offset = next_offset;
6332 } else {
6333 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6334 inner_depth.increment()?;
6335 }
6336 let val_ref = self
6337 .tap_location
6338 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_math_common::Vec_, D));
6339 fidl::decode!(
6340 fidl_fuchsia_math_common::Vec_,
6341 D,
6342 val_ref,
6343 decoder,
6344 inner_offset,
6345 inner_depth
6346 )?;
6347 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6348 {
6349 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6350 }
6351 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6352 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6353 }
6354 }
6355
6356 next_offset += envelope_size;
6357
6358 while next_offset < end_offset {
6360 _next_ordinal_to_read += 1;
6361 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6362 next_offset += envelope_size;
6363 }
6364
6365 Ok(())
6366 }
6367 }
6368}