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 type Mat3 = [f32; 9];
14
15pub type Point2 = [f32; 2];
18
19pub type RelativeMotion = [f32; 2];
23
24pub type RelativeMotionRange = [fidl_fuchsia_input_report::Axis; 2];
27
28pub const MOUSE_MAX_EVENT: u32 = 128;
29
30pub const TOUCH_MAX_EVENT: u32 = 128;
31
32#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
59#[repr(u32)]
60pub enum EventPhase {
61 Add = 1,
63 Change = 2,
65 Remove = 3,
67 Cancel = 4,
69}
70
71impl EventPhase {
72 #[inline]
73 pub fn from_primitive(prim: u32) -> Option<Self> {
74 match prim {
75 1 => Some(Self::Add),
76 2 => Some(Self::Change),
77 3 => Some(Self::Remove),
78 4 => Some(Self::Cancel),
79 _ => None,
80 }
81 }
82
83 #[inline]
84 pub const fn into_primitive(self) -> u32 {
85 self as u32
86 }
87
88 #[deprecated = "Strict enums should not use `is_unknown`"]
89 #[inline]
90 pub fn is_unknown(&self) -> bool {
91 false
92 }
93}
94
95#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
97#[repr(u32)]
98pub enum MouseViewStatus {
99 Entered = 1,
101 Exited = 2,
103}
104
105impl MouseViewStatus {
106 #[inline]
107 pub fn from_primitive(prim: u32) -> Option<Self> {
108 match prim {
109 1 => Some(Self::Entered),
110 2 => Some(Self::Exited),
111 _ => None,
112 }
113 }
114
115 #[inline]
116 pub const fn into_primitive(self) -> u32 {
117 self as u32
118 }
119
120 #[deprecated = "Strict enums should not use `is_unknown`"]
121 #[inline]
122 pub fn is_unknown(&self) -> bool {
123 false
124 }
125}
126
127#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
129#[repr(u32)]
130pub enum TouchInteractionStatus {
131 Denied = 1,
133 Granted = 2,
135}
136
137impl TouchInteractionStatus {
138 #[inline]
139 pub fn from_primitive(prim: u32) -> Option<Self> {
140 match prim {
141 1 => Some(Self::Denied),
142 2 => Some(Self::Granted),
143 _ => None,
144 }
145 }
146
147 #[inline]
148 pub const fn into_primitive(self) -> u32 {
149 self as u32
150 }
151
152 #[deprecated = "Strict enums should not use `is_unknown`"]
153 #[inline]
154 pub fn is_unknown(&self) -> bool {
155 false
156 }
157}
158
159#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
166#[repr(u32)]
167pub enum TouchResponseType {
168 No = 1,
172 Maybe = 2,
176 MaybePrioritize = 3,
181 MaybeSuppress = 4,
186 MaybePrioritizeSuppress = 5,
193 Hold = 6,
198 HoldSuppress = 7,
204 Yes = 8,
209 YesPrioritize = 9,
214}
215
216impl TouchResponseType {
217 #[inline]
218 pub fn from_primitive(prim: u32) -> Option<Self> {
219 match prim {
220 1 => Some(Self::No),
221 2 => Some(Self::Maybe),
222 3 => Some(Self::MaybePrioritize),
223 4 => Some(Self::MaybeSuppress),
224 5 => Some(Self::MaybePrioritizeSuppress),
225 6 => Some(Self::Hold),
226 7 => Some(Self::HoldSuppress),
227 8 => Some(Self::Yes),
228 9 => Some(Self::YesPrioritize),
229 _ => None,
230 }
231 }
232
233 #[inline]
234 pub const fn into_primitive(self) -> u32 {
235 self as u32
236 }
237
238 #[deprecated = "Strict enums should not use `is_unknown`"]
239 #[inline]
240 pub fn is_unknown(&self) -> bool {
241 false
242 }
243}
244
245#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
250pub struct MouseEventStreamInfo {
251 pub device_id: u32,
253 pub status: MouseViewStatus,
255}
256
257impl fidl::Persistable for MouseEventStreamInfo {}
258
259#[derive(Clone, Debug, PartialEq)]
260pub struct MouseSourceWatchResponse {
261 pub events: Vec<MouseEvent>,
262}
263
264impl fidl::Persistable for MouseSourceWatchResponse {}
265
266#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
269pub struct Rectangle {
270 pub min: [f32; 2],
274 pub max: [f32; 2],
278}
279
280impl fidl::Persistable for Rectangle {}
281
282#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
303#[repr(C)]
304pub struct TouchInteractionId {
305 pub device_id: u32,
308 pub pointer_id: u32,
312 pub interaction_id: u32,
315}
316
317impl fidl::Persistable for TouchInteractionId {}
318
319#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
322pub struct TouchInteractionResult {
323 pub interaction: TouchInteractionId,
325 pub status: TouchInteractionStatus,
327}
328
329impl fidl::Persistable for TouchInteractionResult {}
330
331#[derive(Clone, Debug, PartialEq)]
332pub struct TouchSourceUpdateResponseRequest {
333 pub interaction: TouchInteractionId,
334 pub response: TouchResponse,
335}
336
337impl fidl::Persistable for TouchSourceUpdateResponseRequest {}
338
339#[derive(Clone, Debug, PartialEq)]
340pub struct TouchSourceWatchRequest {
341 pub responses: Vec<TouchResponse>,
342}
343
344impl fidl::Persistable for TouchSourceWatchRequest {}
345
346#[derive(Clone, Debug, PartialEq)]
347pub struct TouchSourceWatchResponse {
348 pub events: Vec<TouchEvent>,
349}
350
351impl fidl::Persistable for TouchSourceWatchResponse {}
352
353#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
366pub struct ViewParameters {
367 pub view: Rectangle,
372 pub viewport: Rectangle,
381 pub viewport_to_view_transform: [f32; 9],
384}
385
386impl fidl::Persistable for ViewParameters {}
387
388#[derive(Clone, Debug, Default, PartialEq)]
390pub struct MouseDeviceInfo {
391 pub id: Option<u32>,
394 pub scroll_v_range: Option<fidl_fuchsia_input_report::Axis>,
396 pub scroll_h_range: Option<fidl_fuchsia_input_report::Axis>,
398 pub buttons: Option<Vec<u8>>,
400 pub relative_motion_range: Option<[fidl_fuchsia_input_report::Axis; 2]>,
402 #[doc(hidden)]
403 pub __source_breaking: fidl::marker::SourceBreaking,
404}
405
406impl fidl::Persistable for MouseDeviceInfo {}
407
408#[derive(Clone, Debug, Default, PartialEq)]
411pub struct MouseEvent {
412 pub timestamp: Option<i64>,
415 pub view_parameters: Option<ViewParameters>,
420 pub device_info: Option<MouseDeviceInfo>,
424 pub pointer_sample: Option<MousePointerSample>,
433 pub stream_info: Option<MouseEventStreamInfo>,
436 pub trace_flow_id: Option<u64>,
439 #[doc(hidden)]
440 pub __source_breaking: fidl::marker::SourceBreaking,
441}
442
443impl fidl::Persistable for MouseEvent {}
444
445#[derive(Clone, Debug, Default, PartialEq)]
453pub struct MousePointerSample {
454 pub device_id: Option<u32>,
457 pub position_in_viewport: Option<[f32; 2]>,
460 pub scroll_v: Option<i64>,
462 pub scroll_h: Option<i64>,
464 pub pressed_buttons: Option<Vec<u8>>,
466 pub relative_motion: Option<[f32; 2]>,
469 pub scroll_v_physical_pixel: Option<f64>,
472 pub scroll_h_physical_pixel: Option<f64>,
475 pub is_precision_scroll: Option<bool>,
479 #[doc(hidden)]
480 pub __source_breaking: fidl::marker::SourceBreaking,
481}
482
483impl fidl::Persistable for MousePointerSample {}
484
485#[derive(Clone, Debug, Default, PartialEq)]
487pub struct TouchDeviceInfo {
488 pub id: Option<u32>,
493 #[doc(hidden)]
494 pub __source_breaking: fidl::marker::SourceBreaking,
495}
496
497impl fidl::Persistable for TouchDeviceInfo {}
498
499#[derive(Clone, Debug, Default, PartialEq)]
502pub struct TouchEvent {
503 pub timestamp: Option<i64>,
506 pub view_parameters: Option<ViewParameters>,
511 pub device_info: Option<TouchDeviceInfo>,
515 pub pointer_sample: Option<TouchPointerSample>,
519 pub interaction_result: Option<TouchInteractionResult>,
522 pub trace_flow_id: Option<u64>,
525 #[doc(hidden)]
526 pub __source_breaking: fidl::marker::SourceBreaking,
527}
528
529impl fidl::Persistable for TouchEvent {}
530
531#[derive(Clone, Debug, Default, PartialEq)]
534pub struct TouchPointerSample {
535 pub interaction: Option<TouchInteractionId>,
537 pub phase: Option<EventPhase>,
539 pub position_in_viewport: Option<[f32; 2]>,
541 #[doc(hidden)]
542 pub __source_breaking: fidl::marker::SourceBreaking,
543}
544
545impl fidl::Persistable for TouchPointerSample {}
546
547#[derive(Clone, Debug, Default, PartialEq)]
552pub struct TouchResponse {
553 pub response_type: Option<TouchResponseType>,
556 pub trace_flow_id: Option<u64>,
559 #[doc(hidden)]
560 pub __source_breaking: fidl::marker::SourceBreaking,
561}
562
563impl fidl::Persistable for TouchResponse {}
564
565mod internal {
566 use super::*;
567 unsafe impl fidl::encoding::TypeMarker for EventPhase {
568 type Owned = Self;
569
570 #[inline(always)]
571 fn inline_align(_context: fidl::encoding::Context) -> usize {
572 std::mem::align_of::<u32>()
573 }
574
575 #[inline(always)]
576 fn inline_size(_context: fidl::encoding::Context) -> usize {
577 std::mem::size_of::<u32>()
578 }
579
580 #[inline(always)]
581 fn encode_is_copy() -> bool {
582 true
583 }
584
585 #[inline(always)]
586 fn decode_is_copy() -> bool {
587 false
588 }
589 }
590
591 impl fidl::encoding::ValueTypeMarker for EventPhase {
592 type Borrowed<'a> = Self;
593 #[inline(always)]
594 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
595 *value
596 }
597 }
598
599 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EventPhase {
600 #[inline]
601 unsafe fn encode(
602 self,
603 encoder: &mut fidl::encoding::Encoder<'_, D>,
604 offset: usize,
605 _depth: fidl::encoding::Depth,
606 ) -> fidl::Result<()> {
607 encoder.debug_check_bounds::<Self>(offset);
608 encoder.write_num(self.into_primitive(), offset);
609 Ok(())
610 }
611 }
612
613 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EventPhase {
614 #[inline(always)]
615 fn new_empty() -> Self {
616 Self::Add
617 }
618
619 #[inline]
620 unsafe fn decode(
621 &mut self,
622 decoder: &mut fidl::encoding::Decoder<'_, D>,
623 offset: usize,
624 _depth: fidl::encoding::Depth,
625 ) -> fidl::Result<()> {
626 decoder.debug_check_bounds::<Self>(offset);
627 let prim = decoder.read_num::<u32>(offset);
628
629 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
630 Ok(())
631 }
632 }
633 unsafe impl fidl::encoding::TypeMarker for MouseViewStatus {
634 type Owned = Self;
635
636 #[inline(always)]
637 fn inline_align(_context: fidl::encoding::Context) -> usize {
638 std::mem::align_of::<u32>()
639 }
640
641 #[inline(always)]
642 fn inline_size(_context: fidl::encoding::Context) -> usize {
643 std::mem::size_of::<u32>()
644 }
645
646 #[inline(always)]
647 fn encode_is_copy() -> bool {
648 true
649 }
650
651 #[inline(always)]
652 fn decode_is_copy() -> bool {
653 false
654 }
655 }
656
657 impl fidl::encoding::ValueTypeMarker for MouseViewStatus {
658 type Borrowed<'a> = Self;
659 #[inline(always)]
660 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
661 *value
662 }
663 }
664
665 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
666 for MouseViewStatus
667 {
668 #[inline]
669 unsafe fn encode(
670 self,
671 encoder: &mut fidl::encoding::Encoder<'_, D>,
672 offset: usize,
673 _depth: fidl::encoding::Depth,
674 ) -> fidl::Result<()> {
675 encoder.debug_check_bounds::<Self>(offset);
676 encoder.write_num(self.into_primitive(), offset);
677 Ok(())
678 }
679 }
680
681 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseViewStatus {
682 #[inline(always)]
683 fn new_empty() -> Self {
684 Self::Entered
685 }
686
687 #[inline]
688 unsafe fn decode(
689 &mut self,
690 decoder: &mut fidl::encoding::Decoder<'_, D>,
691 offset: usize,
692 _depth: fidl::encoding::Depth,
693 ) -> fidl::Result<()> {
694 decoder.debug_check_bounds::<Self>(offset);
695 let prim = decoder.read_num::<u32>(offset);
696
697 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
698 Ok(())
699 }
700 }
701 unsafe impl fidl::encoding::TypeMarker for TouchInteractionStatus {
702 type Owned = Self;
703
704 #[inline(always)]
705 fn inline_align(_context: fidl::encoding::Context) -> usize {
706 std::mem::align_of::<u32>()
707 }
708
709 #[inline(always)]
710 fn inline_size(_context: fidl::encoding::Context) -> usize {
711 std::mem::size_of::<u32>()
712 }
713
714 #[inline(always)]
715 fn encode_is_copy() -> bool {
716 true
717 }
718
719 #[inline(always)]
720 fn decode_is_copy() -> bool {
721 false
722 }
723 }
724
725 impl fidl::encoding::ValueTypeMarker for TouchInteractionStatus {
726 type Borrowed<'a> = Self;
727 #[inline(always)]
728 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
729 *value
730 }
731 }
732
733 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
734 for TouchInteractionStatus
735 {
736 #[inline]
737 unsafe fn encode(
738 self,
739 encoder: &mut fidl::encoding::Encoder<'_, D>,
740 offset: usize,
741 _depth: fidl::encoding::Depth,
742 ) -> fidl::Result<()> {
743 encoder.debug_check_bounds::<Self>(offset);
744 encoder.write_num(self.into_primitive(), offset);
745 Ok(())
746 }
747 }
748
749 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
750 for TouchInteractionStatus
751 {
752 #[inline(always)]
753 fn new_empty() -> Self {
754 Self::Denied
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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
768 Ok(())
769 }
770 }
771 unsafe impl fidl::encoding::TypeMarker for TouchResponseType {
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 true
787 }
788
789 #[inline(always)]
790 fn decode_is_copy() -> bool {
791 false
792 }
793 }
794
795 impl fidl::encoding::ValueTypeMarker for TouchResponseType {
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 TouchResponseType
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 TouchResponseType {
820 #[inline(always)]
821 fn new_empty() -> Self {
822 Self::No
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(prim).ok_or(fidl::Error::InvalidEnumValue)?;
836 Ok(())
837 }
838 }
839
840 impl fidl::encoding::ValueTypeMarker for MouseEventStreamInfo {
841 type Borrowed<'a> = &'a Self;
842 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
843 value
844 }
845 }
846
847 unsafe impl fidl::encoding::TypeMarker for MouseEventStreamInfo {
848 type Owned = Self;
849
850 #[inline(always)]
851 fn inline_align(_context: fidl::encoding::Context) -> usize {
852 4
853 }
854
855 #[inline(always)]
856 fn inline_size(_context: fidl::encoding::Context) -> usize {
857 8
858 }
859 }
860
861 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseEventStreamInfo, D>
862 for &MouseEventStreamInfo
863 {
864 #[inline]
865 unsafe fn encode(
866 self,
867 encoder: &mut fidl::encoding::Encoder<'_, D>,
868 offset: usize,
869 _depth: fidl::encoding::Depth,
870 ) -> fidl::Result<()> {
871 encoder.debug_check_bounds::<MouseEventStreamInfo>(offset);
872 fidl::encoding::Encode::<MouseEventStreamInfo, D>::encode(
874 (
875 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
876 <MouseViewStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.status),
877 ),
878 encoder,
879 offset,
880 _depth,
881 )
882 }
883 }
884 unsafe impl<
885 D: fidl::encoding::ResourceDialect,
886 T0: fidl::encoding::Encode<u32, D>,
887 T1: fidl::encoding::Encode<MouseViewStatus, D>,
888 > fidl::encoding::Encode<MouseEventStreamInfo, D> for (T0, T1)
889 {
890 #[inline]
891 unsafe fn encode(
892 self,
893 encoder: &mut fidl::encoding::Encoder<'_, D>,
894 offset: usize,
895 depth: fidl::encoding::Depth,
896 ) -> fidl::Result<()> {
897 encoder.debug_check_bounds::<MouseEventStreamInfo>(offset);
898 self.0.encode(encoder, offset + 0, depth)?;
902 self.1.encode(encoder, offset + 4, depth)?;
903 Ok(())
904 }
905 }
906
907 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseEventStreamInfo {
908 #[inline(always)]
909 fn new_empty() -> Self {
910 Self {
911 device_id: fidl::new_empty!(u32, D),
912 status: fidl::new_empty!(MouseViewStatus, D),
913 }
914 }
915
916 #[inline]
917 unsafe fn decode(
918 &mut self,
919 decoder: &mut fidl::encoding::Decoder<'_, D>,
920 offset: usize,
921 _depth: fidl::encoding::Depth,
922 ) -> fidl::Result<()> {
923 decoder.debug_check_bounds::<Self>(offset);
924 fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 0, _depth)?;
926 fidl::decode!(MouseViewStatus, D, &mut self.status, decoder, offset + 4, _depth)?;
927 Ok(())
928 }
929 }
930
931 impl fidl::encoding::ValueTypeMarker for MouseSourceWatchResponse {
932 type Borrowed<'a> = &'a Self;
933 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
934 value
935 }
936 }
937
938 unsafe impl fidl::encoding::TypeMarker for MouseSourceWatchResponse {
939 type Owned = Self;
940
941 #[inline(always)]
942 fn inline_align(_context: fidl::encoding::Context) -> usize {
943 8
944 }
945
946 #[inline(always)]
947 fn inline_size(_context: fidl::encoding::Context) -> usize {
948 16
949 }
950 }
951
952 unsafe impl<D: fidl::encoding::ResourceDialect>
953 fidl::encoding::Encode<MouseSourceWatchResponse, D> for &MouseSourceWatchResponse
954 {
955 #[inline]
956 unsafe fn encode(
957 self,
958 encoder: &mut fidl::encoding::Encoder<'_, D>,
959 offset: usize,
960 _depth: fidl::encoding::Depth,
961 ) -> fidl::Result<()> {
962 encoder.debug_check_bounds::<MouseSourceWatchResponse>(offset);
963 fidl::encoding::Encode::<MouseSourceWatchResponse, D>::encode(
965 (
966 <fidl::encoding::Vector<MouseEvent, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
967 ),
968 encoder, offset, _depth
969 )
970 }
971 }
972 unsafe impl<
973 D: fidl::encoding::ResourceDialect,
974 T0: fidl::encoding::Encode<fidl::encoding::Vector<MouseEvent, 128>, D>,
975 > fidl::encoding::Encode<MouseSourceWatchResponse, D> for (T0,)
976 {
977 #[inline]
978 unsafe fn encode(
979 self,
980 encoder: &mut fidl::encoding::Encoder<'_, D>,
981 offset: usize,
982 depth: fidl::encoding::Depth,
983 ) -> fidl::Result<()> {
984 encoder.debug_check_bounds::<MouseSourceWatchResponse>(offset);
985 self.0.encode(encoder, offset + 0, depth)?;
989 Ok(())
990 }
991 }
992
993 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
994 for MouseSourceWatchResponse
995 {
996 #[inline(always)]
997 fn new_empty() -> Self {
998 Self { events: fidl::new_empty!(fidl::encoding::Vector<MouseEvent, 128>, D) }
999 }
1000
1001 #[inline]
1002 unsafe fn decode(
1003 &mut self,
1004 decoder: &mut fidl::encoding::Decoder<'_, D>,
1005 offset: usize,
1006 _depth: fidl::encoding::Depth,
1007 ) -> fidl::Result<()> {
1008 decoder.debug_check_bounds::<Self>(offset);
1009 fidl::decode!(fidl::encoding::Vector<MouseEvent, 128>, D, &mut self.events, decoder, offset + 0, _depth)?;
1011 Ok(())
1012 }
1013 }
1014
1015 impl fidl::encoding::ValueTypeMarker for Rectangle {
1016 type Borrowed<'a> = &'a Self;
1017 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1018 value
1019 }
1020 }
1021
1022 unsafe impl fidl::encoding::TypeMarker for Rectangle {
1023 type Owned = Self;
1024
1025 #[inline(always)]
1026 fn inline_align(_context: fidl::encoding::Context) -> usize {
1027 4
1028 }
1029
1030 #[inline(always)]
1031 fn inline_size(_context: fidl::encoding::Context) -> usize {
1032 16
1033 }
1034 }
1035
1036 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Rectangle, D>
1037 for &Rectangle
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::<Rectangle>(offset);
1047 fidl::encoding::Encode::<Rectangle, D>::encode(
1049 (
1050 <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow(
1051 &self.min,
1052 ),
1053 <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow(
1054 &self.max,
1055 ),
1056 ),
1057 encoder,
1058 offset,
1059 _depth,
1060 )
1061 }
1062 }
1063 unsafe impl<
1064 D: fidl::encoding::ResourceDialect,
1065 T0: fidl::encoding::Encode<fidl::encoding::Array<f32, 2>, D>,
1066 T1: fidl::encoding::Encode<fidl::encoding::Array<f32, 2>, D>,
1067 > fidl::encoding::Encode<Rectangle, D> for (T0, T1)
1068 {
1069 #[inline]
1070 unsafe fn encode(
1071 self,
1072 encoder: &mut fidl::encoding::Encoder<'_, D>,
1073 offset: usize,
1074 depth: fidl::encoding::Depth,
1075 ) -> fidl::Result<()> {
1076 encoder.debug_check_bounds::<Rectangle>(offset);
1077 self.0.encode(encoder, offset + 0, depth)?;
1081 self.1.encode(encoder, offset + 8, depth)?;
1082 Ok(())
1083 }
1084 }
1085
1086 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Rectangle {
1087 #[inline(always)]
1088 fn new_empty() -> Self {
1089 Self {
1090 min: fidl::new_empty!(fidl::encoding::Array<f32, 2>, D),
1091 max: fidl::new_empty!(fidl::encoding::Array<f32, 2>, D),
1092 }
1093 }
1094
1095 #[inline]
1096 unsafe fn decode(
1097 &mut self,
1098 decoder: &mut fidl::encoding::Decoder<'_, D>,
1099 offset: usize,
1100 _depth: fidl::encoding::Depth,
1101 ) -> fidl::Result<()> {
1102 decoder.debug_check_bounds::<Self>(offset);
1103 fidl::decode!(fidl::encoding::Array<f32, 2>, D, &mut self.min, decoder, offset + 0, _depth)?;
1105 fidl::decode!(fidl::encoding::Array<f32, 2>, D, &mut self.max, decoder, offset + 8, _depth)?;
1106 Ok(())
1107 }
1108 }
1109
1110 impl fidl::encoding::ValueTypeMarker for TouchInteractionId {
1111 type Borrowed<'a> = &'a Self;
1112 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1113 value
1114 }
1115 }
1116
1117 unsafe impl fidl::encoding::TypeMarker for TouchInteractionId {
1118 type Owned = Self;
1119
1120 #[inline(always)]
1121 fn inline_align(_context: fidl::encoding::Context) -> usize {
1122 4
1123 }
1124
1125 #[inline(always)]
1126 fn inline_size(_context: fidl::encoding::Context) -> usize {
1127 12
1128 }
1129 #[inline(always)]
1130 fn encode_is_copy() -> bool {
1131 true
1132 }
1133
1134 #[inline(always)]
1135 fn decode_is_copy() -> bool {
1136 true
1137 }
1138 }
1139
1140 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInteractionId, D>
1141 for &TouchInteractionId
1142 {
1143 #[inline]
1144 unsafe fn encode(
1145 self,
1146 encoder: &mut fidl::encoding::Encoder<'_, D>,
1147 offset: usize,
1148 _depth: fidl::encoding::Depth,
1149 ) -> fidl::Result<()> {
1150 encoder.debug_check_bounds::<TouchInteractionId>(offset);
1151 unsafe {
1152 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1154 (buf_ptr as *mut TouchInteractionId)
1155 .write_unaligned((self as *const TouchInteractionId).read());
1156 }
1159 Ok(())
1160 }
1161 }
1162 unsafe impl<
1163 D: fidl::encoding::ResourceDialect,
1164 T0: fidl::encoding::Encode<u32, D>,
1165 T1: fidl::encoding::Encode<u32, D>,
1166 T2: fidl::encoding::Encode<u32, D>,
1167 > fidl::encoding::Encode<TouchInteractionId, D> for (T0, T1, T2)
1168 {
1169 #[inline]
1170 unsafe fn encode(
1171 self,
1172 encoder: &mut fidl::encoding::Encoder<'_, D>,
1173 offset: usize,
1174 depth: fidl::encoding::Depth,
1175 ) -> fidl::Result<()> {
1176 encoder.debug_check_bounds::<TouchInteractionId>(offset);
1177 self.0.encode(encoder, offset + 0, depth)?;
1181 self.1.encode(encoder, offset + 4, depth)?;
1182 self.2.encode(encoder, offset + 8, depth)?;
1183 Ok(())
1184 }
1185 }
1186
1187 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInteractionId {
1188 #[inline(always)]
1189 fn new_empty() -> Self {
1190 Self {
1191 device_id: fidl::new_empty!(u32, D),
1192 pointer_id: fidl::new_empty!(u32, D),
1193 interaction_id: fidl::new_empty!(u32, D),
1194 }
1195 }
1196
1197 #[inline]
1198 unsafe fn decode(
1199 &mut self,
1200 decoder: &mut fidl::encoding::Decoder<'_, D>,
1201 offset: usize,
1202 _depth: fidl::encoding::Depth,
1203 ) -> fidl::Result<()> {
1204 decoder.debug_check_bounds::<Self>(offset);
1205 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1206 unsafe {
1209 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
1210 }
1211 Ok(())
1212 }
1213 }
1214
1215 impl fidl::encoding::ValueTypeMarker for TouchInteractionResult {
1216 type Borrowed<'a> = &'a Self;
1217 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1218 value
1219 }
1220 }
1221
1222 unsafe impl fidl::encoding::TypeMarker for TouchInteractionResult {
1223 type Owned = Self;
1224
1225 #[inline(always)]
1226 fn inline_align(_context: fidl::encoding::Context) -> usize {
1227 4
1228 }
1229
1230 #[inline(always)]
1231 fn inline_size(_context: fidl::encoding::Context) -> usize {
1232 16
1233 }
1234 }
1235
1236 unsafe impl<D: fidl::encoding::ResourceDialect>
1237 fidl::encoding::Encode<TouchInteractionResult, D> for &TouchInteractionResult
1238 {
1239 #[inline]
1240 unsafe fn encode(
1241 self,
1242 encoder: &mut fidl::encoding::Encoder<'_, D>,
1243 offset: usize,
1244 _depth: fidl::encoding::Depth,
1245 ) -> fidl::Result<()> {
1246 encoder.debug_check_bounds::<TouchInteractionResult>(offset);
1247 fidl::encoding::Encode::<TouchInteractionResult, D>::encode(
1249 (
1250 <TouchInteractionId as fidl::encoding::ValueTypeMarker>::borrow(
1251 &self.interaction,
1252 ),
1253 <TouchInteractionStatus as fidl::encoding::ValueTypeMarker>::borrow(
1254 &self.status,
1255 ),
1256 ),
1257 encoder,
1258 offset,
1259 _depth,
1260 )
1261 }
1262 }
1263 unsafe impl<
1264 D: fidl::encoding::ResourceDialect,
1265 T0: fidl::encoding::Encode<TouchInteractionId, D>,
1266 T1: fidl::encoding::Encode<TouchInteractionStatus, D>,
1267 > fidl::encoding::Encode<TouchInteractionResult, D> for (T0, T1)
1268 {
1269 #[inline]
1270 unsafe fn encode(
1271 self,
1272 encoder: &mut fidl::encoding::Encoder<'_, D>,
1273 offset: usize,
1274 depth: fidl::encoding::Depth,
1275 ) -> fidl::Result<()> {
1276 encoder.debug_check_bounds::<TouchInteractionResult>(offset);
1277 self.0.encode(encoder, offset + 0, depth)?;
1281 self.1.encode(encoder, offset + 12, depth)?;
1282 Ok(())
1283 }
1284 }
1285
1286 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1287 for TouchInteractionResult
1288 {
1289 #[inline(always)]
1290 fn new_empty() -> Self {
1291 Self {
1292 interaction: fidl::new_empty!(TouchInteractionId, D),
1293 status: fidl::new_empty!(TouchInteractionStatus, D),
1294 }
1295 }
1296
1297 #[inline]
1298 unsafe fn decode(
1299 &mut self,
1300 decoder: &mut fidl::encoding::Decoder<'_, D>,
1301 offset: usize,
1302 _depth: fidl::encoding::Depth,
1303 ) -> fidl::Result<()> {
1304 decoder.debug_check_bounds::<Self>(offset);
1305 fidl::decode!(
1307 TouchInteractionId,
1308 D,
1309 &mut self.interaction,
1310 decoder,
1311 offset + 0,
1312 _depth
1313 )?;
1314 fidl::decode!(
1315 TouchInteractionStatus,
1316 D,
1317 &mut self.status,
1318 decoder,
1319 offset + 12,
1320 _depth
1321 )?;
1322 Ok(())
1323 }
1324 }
1325
1326 impl fidl::encoding::ValueTypeMarker for TouchSourceUpdateResponseRequest {
1327 type Borrowed<'a> = &'a Self;
1328 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1329 value
1330 }
1331 }
1332
1333 unsafe impl fidl::encoding::TypeMarker for TouchSourceUpdateResponseRequest {
1334 type Owned = Self;
1335
1336 #[inline(always)]
1337 fn inline_align(_context: fidl::encoding::Context) -> usize {
1338 8
1339 }
1340
1341 #[inline(always)]
1342 fn inline_size(_context: fidl::encoding::Context) -> usize {
1343 32
1344 }
1345 }
1346
1347 unsafe impl<D: fidl::encoding::ResourceDialect>
1348 fidl::encoding::Encode<TouchSourceUpdateResponseRequest, D>
1349 for &TouchSourceUpdateResponseRequest
1350 {
1351 #[inline]
1352 unsafe fn encode(
1353 self,
1354 encoder: &mut fidl::encoding::Encoder<'_, D>,
1355 offset: usize,
1356 _depth: fidl::encoding::Depth,
1357 ) -> fidl::Result<()> {
1358 encoder.debug_check_bounds::<TouchSourceUpdateResponseRequest>(offset);
1359 fidl::encoding::Encode::<TouchSourceUpdateResponseRequest, D>::encode(
1361 (
1362 <TouchInteractionId as fidl::encoding::ValueTypeMarker>::borrow(
1363 &self.interaction,
1364 ),
1365 <TouchResponse as fidl::encoding::ValueTypeMarker>::borrow(&self.response),
1366 ),
1367 encoder,
1368 offset,
1369 _depth,
1370 )
1371 }
1372 }
1373 unsafe impl<
1374 D: fidl::encoding::ResourceDialect,
1375 T0: fidl::encoding::Encode<TouchInteractionId, D>,
1376 T1: fidl::encoding::Encode<TouchResponse, D>,
1377 > fidl::encoding::Encode<TouchSourceUpdateResponseRequest, D> for (T0, T1)
1378 {
1379 #[inline]
1380 unsafe fn encode(
1381 self,
1382 encoder: &mut fidl::encoding::Encoder<'_, D>,
1383 offset: usize,
1384 depth: fidl::encoding::Depth,
1385 ) -> fidl::Result<()> {
1386 encoder.debug_check_bounds::<TouchSourceUpdateResponseRequest>(offset);
1387 unsafe {
1390 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1391 (ptr as *mut u64).write_unaligned(0);
1392 }
1393 self.0.encode(encoder, offset + 0, depth)?;
1395 self.1.encode(encoder, offset + 16, depth)?;
1396 Ok(())
1397 }
1398 }
1399
1400 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1401 for TouchSourceUpdateResponseRequest
1402 {
1403 #[inline(always)]
1404 fn new_empty() -> Self {
1405 Self {
1406 interaction: fidl::new_empty!(TouchInteractionId, D),
1407 response: fidl::new_empty!(TouchResponse, D),
1408 }
1409 }
1410
1411 #[inline]
1412 unsafe fn decode(
1413 &mut self,
1414 decoder: &mut fidl::encoding::Decoder<'_, D>,
1415 offset: usize,
1416 _depth: fidl::encoding::Depth,
1417 ) -> fidl::Result<()> {
1418 decoder.debug_check_bounds::<Self>(offset);
1419 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1421 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1422 let mask = 0xffffffff00000000u64;
1423 let maskedval = padval & mask;
1424 if maskedval != 0 {
1425 return Err(fidl::Error::NonZeroPadding {
1426 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1427 });
1428 }
1429 fidl::decode!(
1430 TouchInteractionId,
1431 D,
1432 &mut self.interaction,
1433 decoder,
1434 offset + 0,
1435 _depth
1436 )?;
1437 fidl::decode!(TouchResponse, D, &mut self.response, decoder, offset + 16, _depth)?;
1438 Ok(())
1439 }
1440 }
1441
1442 impl fidl::encoding::ValueTypeMarker for TouchSourceWatchRequest {
1443 type Borrowed<'a> = &'a Self;
1444 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1445 value
1446 }
1447 }
1448
1449 unsafe impl fidl::encoding::TypeMarker for TouchSourceWatchRequest {
1450 type Owned = Self;
1451
1452 #[inline(always)]
1453 fn inline_align(_context: fidl::encoding::Context) -> usize {
1454 8
1455 }
1456
1457 #[inline(always)]
1458 fn inline_size(_context: fidl::encoding::Context) -> usize {
1459 16
1460 }
1461 }
1462
1463 unsafe impl<D: fidl::encoding::ResourceDialect>
1464 fidl::encoding::Encode<TouchSourceWatchRequest, D> for &TouchSourceWatchRequest
1465 {
1466 #[inline]
1467 unsafe fn encode(
1468 self,
1469 encoder: &mut fidl::encoding::Encoder<'_, D>,
1470 offset: usize,
1471 _depth: fidl::encoding::Depth,
1472 ) -> fidl::Result<()> {
1473 encoder.debug_check_bounds::<TouchSourceWatchRequest>(offset);
1474 fidl::encoding::Encode::<TouchSourceWatchRequest, D>::encode(
1476 (
1477 <fidl::encoding::Vector<TouchResponse, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.responses),
1478 ),
1479 encoder, offset, _depth
1480 )
1481 }
1482 }
1483 unsafe impl<
1484 D: fidl::encoding::ResourceDialect,
1485 T0: fidl::encoding::Encode<fidl::encoding::Vector<TouchResponse, 128>, D>,
1486 > fidl::encoding::Encode<TouchSourceWatchRequest, D> for (T0,)
1487 {
1488 #[inline]
1489 unsafe fn encode(
1490 self,
1491 encoder: &mut fidl::encoding::Encoder<'_, D>,
1492 offset: usize,
1493 depth: fidl::encoding::Depth,
1494 ) -> fidl::Result<()> {
1495 encoder.debug_check_bounds::<TouchSourceWatchRequest>(offset);
1496 self.0.encode(encoder, offset + 0, depth)?;
1500 Ok(())
1501 }
1502 }
1503
1504 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1505 for TouchSourceWatchRequest
1506 {
1507 #[inline(always)]
1508 fn new_empty() -> Self {
1509 Self { responses: fidl::new_empty!(fidl::encoding::Vector<TouchResponse, 128>, D) }
1510 }
1511
1512 #[inline]
1513 unsafe fn decode(
1514 &mut self,
1515 decoder: &mut fidl::encoding::Decoder<'_, D>,
1516 offset: usize,
1517 _depth: fidl::encoding::Depth,
1518 ) -> fidl::Result<()> {
1519 decoder.debug_check_bounds::<Self>(offset);
1520 fidl::decode!(fidl::encoding::Vector<TouchResponse, 128>, D, &mut self.responses, decoder, offset + 0, _depth)?;
1522 Ok(())
1523 }
1524 }
1525
1526 impl fidl::encoding::ValueTypeMarker for TouchSourceWatchResponse {
1527 type Borrowed<'a> = &'a Self;
1528 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1529 value
1530 }
1531 }
1532
1533 unsafe impl fidl::encoding::TypeMarker for TouchSourceWatchResponse {
1534 type Owned = Self;
1535
1536 #[inline(always)]
1537 fn inline_align(_context: fidl::encoding::Context) -> usize {
1538 8
1539 }
1540
1541 #[inline(always)]
1542 fn inline_size(_context: fidl::encoding::Context) -> usize {
1543 16
1544 }
1545 }
1546
1547 unsafe impl<D: fidl::encoding::ResourceDialect>
1548 fidl::encoding::Encode<TouchSourceWatchResponse, D> for &TouchSourceWatchResponse
1549 {
1550 #[inline]
1551 unsafe fn encode(
1552 self,
1553 encoder: &mut fidl::encoding::Encoder<'_, D>,
1554 offset: usize,
1555 _depth: fidl::encoding::Depth,
1556 ) -> fidl::Result<()> {
1557 encoder.debug_check_bounds::<TouchSourceWatchResponse>(offset);
1558 fidl::encoding::Encode::<TouchSourceWatchResponse, D>::encode(
1560 (
1561 <fidl::encoding::Vector<TouchEvent, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
1562 ),
1563 encoder, offset, _depth
1564 )
1565 }
1566 }
1567 unsafe impl<
1568 D: fidl::encoding::ResourceDialect,
1569 T0: fidl::encoding::Encode<fidl::encoding::Vector<TouchEvent, 128>, D>,
1570 > fidl::encoding::Encode<TouchSourceWatchResponse, D> for (T0,)
1571 {
1572 #[inline]
1573 unsafe fn encode(
1574 self,
1575 encoder: &mut fidl::encoding::Encoder<'_, D>,
1576 offset: usize,
1577 depth: fidl::encoding::Depth,
1578 ) -> fidl::Result<()> {
1579 encoder.debug_check_bounds::<TouchSourceWatchResponse>(offset);
1580 self.0.encode(encoder, offset + 0, depth)?;
1584 Ok(())
1585 }
1586 }
1587
1588 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1589 for TouchSourceWatchResponse
1590 {
1591 #[inline(always)]
1592 fn new_empty() -> Self {
1593 Self { events: fidl::new_empty!(fidl::encoding::Vector<TouchEvent, 128>, D) }
1594 }
1595
1596 #[inline]
1597 unsafe fn decode(
1598 &mut self,
1599 decoder: &mut fidl::encoding::Decoder<'_, D>,
1600 offset: usize,
1601 _depth: fidl::encoding::Depth,
1602 ) -> fidl::Result<()> {
1603 decoder.debug_check_bounds::<Self>(offset);
1604 fidl::decode!(fidl::encoding::Vector<TouchEvent, 128>, D, &mut self.events, decoder, offset + 0, _depth)?;
1606 Ok(())
1607 }
1608 }
1609
1610 impl fidl::encoding::ValueTypeMarker for ViewParameters {
1611 type Borrowed<'a> = &'a Self;
1612 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1613 value
1614 }
1615 }
1616
1617 unsafe impl fidl::encoding::TypeMarker for ViewParameters {
1618 type Owned = Self;
1619
1620 #[inline(always)]
1621 fn inline_align(_context: fidl::encoding::Context) -> usize {
1622 4
1623 }
1624
1625 #[inline(always)]
1626 fn inline_size(_context: fidl::encoding::Context) -> usize {
1627 68
1628 }
1629 }
1630
1631 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ViewParameters, D>
1632 for &ViewParameters
1633 {
1634 #[inline]
1635 unsafe fn encode(
1636 self,
1637 encoder: &mut fidl::encoding::Encoder<'_, D>,
1638 offset: usize,
1639 _depth: fidl::encoding::Depth,
1640 ) -> fidl::Result<()> {
1641 encoder.debug_check_bounds::<ViewParameters>(offset);
1642 fidl::encoding::Encode::<ViewParameters, D>::encode(
1644 (
1645 <Rectangle as fidl::encoding::ValueTypeMarker>::borrow(&self.view),
1646 <Rectangle as fidl::encoding::ValueTypeMarker>::borrow(&self.viewport),
1647 <fidl::encoding::Array<f32, 9> as fidl::encoding::ValueTypeMarker>::borrow(
1648 &self.viewport_to_view_transform,
1649 ),
1650 ),
1651 encoder,
1652 offset,
1653 _depth,
1654 )
1655 }
1656 }
1657 unsafe impl<
1658 D: fidl::encoding::ResourceDialect,
1659 T0: fidl::encoding::Encode<Rectangle, D>,
1660 T1: fidl::encoding::Encode<Rectangle, D>,
1661 T2: fidl::encoding::Encode<fidl::encoding::Array<f32, 9>, D>,
1662 > fidl::encoding::Encode<ViewParameters, D> for (T0, T1, T2)
1663 {
1664 #[inline]
1665 unsafe fn encode(
1666 self,
1667 encoder: &mut fidl::encoding::Encoder<'_, D>,
1668 offset: usize,
1669 depth: fidl::encoding::Depth,
1670 ) -> fidl::Result<()> {
1671 encoder.debug_check_bounds::<ViewParameters>(offset);
1672 self.0.encode(encoder, offset + 0, depth)?;
1676 self.1.encode(encoder, offset + 16, depth)?;
1677 self.2.encode(encoder, offset + 32, depth)?;
1678 Ok(())
1679 }
1680 }
1681
1682 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ViewParameters {
1683 #[inline(always)]
1684 fn new_empty() -> Self {
1685 Self {
1686 view: fidl::new_empty!(Rectangle, D),
1687 viewport: fidl::new_empty!(Rectangle, D),
1688 viewport_to_view_transform: fidl::new_empty!(fidl::encoding::Array<f32, 9>, D),
1689 }
1690 }
1691
1692 #[inline]
1693 unsafe fn decode(
1694 &mut self,
1695 decoder: &mut fidl::encoding::Decoder<'_, D>,
1696 offset: usize,
1697 _depth: fidl::encoding::Depth,
1698 ) -> fidl::Result<()> {
1699 decoder.debug_check_bounds::<Self>(offset);
1700 fidl::decode!(Rectangle, D, &mut self.view, decoder, offset + 0, _depth)?;
1702 fidl::decode!(Rectangle, D, &mut self.viewport, decoder, offset + 16, _depth)?;
1703 fidl::decode!(fidl::encoding::Array<f32, 9>, D, &mut self.viewport_to_view_transform, decoder, offset + 32, _depth)?;
1704 Ok(())
1705 }
1706 }
1707
1708 impl MouseDeviceInfo {
1709 #[inline(always)]
1710 fn max_ordinal_present(&self) -> u64 {
1711 if let Some(_) = self.relative_motion_range {
1712 return 5;
1713 }
1714 if let Some(_) = self.buttons {
1715 return 4;
1716 }
1717 if let Some(_) = self.scroll_h_range {
1718 return 3;
1719 }
1720 if let Some(_) = self.scroll_v_range {
1721 return 2;
1722 }
1723 if let Some(_) = self.id {
1724 return 1;
1725 }
1726 0
1727 }
1728 }
1729
1730 impl fidl::encoding::ValueTypeMarker for MouseDeviceInfo {
1731 type Borrowed<'a> = &'a Self;
1732 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1733 value
1734 }
1735 }
1736
1737 unsafe impl fidl::encoding::TypeMarker for MouseDeviceInfo {
1738 type Owned = Self;
1739
1740 #[inline(always)]
1741 fn inline_align(_context: fidl::encoding::Context) -> usize {
1742 8
1743 }
1744
1745 #[inline(always)]
1746 fn inline_size(_context: fidl::encoding::Context) -> usize {
1747 16
1748 }
1749 }
1750
1751 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDeviceInfo, D>
1752 for &MouseDeviceInfo
1753 {
1754 unsafe fn encode(
1755 self,
1756 encoder: &mut fidl::encoding::Encoder<'_, D>,
1757 offset: usize,
1758 mut depth: fidl::encoding::Depth,
1759 ) -> fidl::Result<()> {
1760 encoder.debug_check_bounds::<MouseDeviceInfo>(offset);
1761 let max_ordinal: u64 = self.max_ordinal_present();
1763 encoder.write_num(max_ordinal, offset);
1764 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1765 if max_ordinal == 0 {
1767 return Ok(());
1768 }
1769 depth.increment()?;
1770 let envelope_size = 8;
1771 let bytes_len = max_ordinal as usize * envelope_size;
1772 #[allow(unused_variables)]
1773 let offset = encoder.out_of_line_offset(bytes_len);
1774 let mut _prev_end_offset: usize = 0;
1775 if 1 > max_ordinal {
1776 return Ok(());
1777 }
1778
1779 let cur_offset: usize = (1 - 1) * envelope_size;
1782
1783 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1785
1786 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1791 self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1792 encoder,
1793 offset + cur_offset,
1794 depth,
1795 )?;
1796
1797 _prev_end_offset = cur_offset + envelope_size;
1798 if 2 > max_ordinal {
1799 return Ok(());
1800 }
1801
1802 let cur_offset: usize = (2 - 1) * envelope_size;
1805
1806 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1808
1809 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report::Axis, D>(
1814 self.scroll_v_range.as_ref().map(
1815 <fidl_fuchsia_input_report::Axis as fidl::encoding::ValueTypeMarker>::borrow,
1816 ),
1817 encoder,
1818 offset + cur_offset,
1819 depth,
1820 )?;
1821
1822 _prev_end_offset = cur_offset + envelope_size;
1823 if 3 > max_ordinal {
1824 return Ok(());
1825 }
1826
1827 let cur_offset: usize = (3 - 1) * envelope_size;
1830
1831 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1833
1834 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_input_report::Axis, D>(
1839 self.scroll_h_range.as_ref().map(
1840 <fidl_fuchsia_input_report::Axis as fidl::encoding::ValueTypeMarker>::borrow,
1841 ),
1842 encoder,
1843 offset + cur_offset,
1844 depth,
1845 )?;
1846
1847 _prev_end_offset = cur_offset + envelope_size;
1848 if 4 > max_ordinal {
1849 return Ok(());
1850 }
1851
1852 let cur_offset: usize = (4 - 1) * envelope_size;
1855
1856 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1858
1859 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
1864 self.buttons.as_ref().map(
1865 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
1866 ),
1867 encoder,
1868 offset + cur_offset,
1869 depth,
1870 )?;
1871
1872 _prev_end_offset = cur_offset + envelope_size;
1873 if 5 > max_ordinal {
1874 return Ok(());
1875 }
1876
1877 let cur_offset: usize = (5 - 1) * envelope_size;
1880
1881 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1883
1884 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<fidl_fuchsia_input_report::Axis, 2>, D>(
1889 self.relative_motion_range.as_ref().map(<fidl::encoding::Array<fidl_fuchsia_input_report::Axis, 2> as fidl::encoding::ValueTypeMarker>::borrow),
1890 encoder, offset + cur_offset, depth
1891 )?;
1892
1893 _prev_end_offset = cur_offset + envelope_size;
1894
1895 Ok(())
1896 }
1897 }
1898
1899 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDeviceInfo {
1900 #[inline(always)]
1901 fn new_empty() -> Self {
1902 Self::default()
1903 }
1904
1905 unsafe fn decode(
1906 &mut self,
1907 decoder: &mut fidl::encoding::Decoder<'_, D>,
1908 offset: usize,
1909 mut depth: fidl::encoding::Depth,
1910 ) -> fidl::Result<()> {
1911 decoder.debug_check_bounds::<Self>(offset);
1912 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1913 None => return Err(fidl::Error::NotNullable),
1914 Some(len) => len,
1915 };
1916 if len == 0 {
1918 return Ok(());
1919 };
1920 depth.increment()?;
1921 let envelope_size = 8;
1922 let bytes_len = len * envelope_size;
1923 let offset = decoder.out_of_line_offset(bytes_len)?;
1924 let mut _next_ordinal_to_read = 0;
1926 let mut next_offset = offset;
1927 let end_offset = offset + bytes_len;
1928 _next_ordinal_to_read += 1;
1929 if next_offset >= end_offset {
1930 return Ok(());
1931 }
1932
1933 while _next_ordinal_to_read < 1 {
1935 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1936 _next_ordinal_to_read += 1;
1937 next_offset += envelope_size;
1938 }
1939
1940 let next_out_of_line = decoder.next_out_of_line();
1941 let handles_before = decoder.remaining_handles();
1942 if let Some((inlined, num_bytes, num_handles)) =
1943 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1944 {
1945 let member_inline_size =
1946 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1947 if inlined != (member_inline_size <= 4) {
1948 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1949 }
1950 let inner_offset;
1951 let mut inner_depth = depth.clone();
1952 if inlined {
1953 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1954 inner_offset = next_offset;
1955 } else {
1956 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1957 inner_depth.increment()?;
1958 }
1959 let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1960 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1961 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1962 {
1963 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1964 }
1965 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1966 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1967 }
1968 }
1969
1970 next_offset += envelope_size;
1971 _next_ordinal_to_read += 1;
1972 if next_offset >= end_offset {
1973 return Ok(());
1974 }
1975
1976 while _next_ordinal_to_read < 2 {
1978 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1979 _next_ordinal_to_read += 1;
1980 next_offset += envelope_size;
1981 }
1982
1983 let next_out_of_line = decoder.next_out_of_line();
1984 let handles_before = decoder.remaining_handles();
1985 if let Some((inlined, num_bytes, num_handles)) =
1986 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1987 {
1988 let member_inline_size =
1989 <fidl_fuchsia_input_report::Axis as fidl::encoding::TypeMarker>::inline_size(
1990 decoder.context,
1991 );
1992 if inlined != (member_inline_size <= 4) {
1993 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1994 }
1995 let inner_offset;
1996 let mut inner_depth = depth.clone();
1997 if inlined {
1998 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1999 inner_offset = next_offset;
2000 } else {
2001 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2002 inner_depth.increment()?;
2003 }
2004 let val_ref = self
2005 .scroll_v_range
2006 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input_report::Axis, D));
2007 fidl::decode!(
2008 fidl_fuchsia_input_report::Axis,
2009 D,
2010 val_ref,
2011 decoder,
2012 inner_offset,
2013 inner_depth
2014 )?;
2015 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2016 {
2017 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2018 }
2019 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2020 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2021 }
2022 }
2023
2024 next_offset += envelope_size;
2025 _next_ordinal_to_read += 1;
2026 if next_offset >= end_offset {
2027 return Ok(());
2028 }
2029
2030 while _next_ordinal_to_read < 3 {
2032 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2033 _next_ordinal_to_read += 1;
2034 next_offset += envelope_size;
2035 }
2036
2037 let next_out_of_line = decoder.next_out_of_line();
2038 let handles_before = decoder.remaining_handles();
2039 if let Some((inlined, num_bytes, num_handles)) =
2040 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2041 {
2042 let member_inline_size =
2043 <fidl_fuchsia_input_report::Axis as fidl::encoding::TypeMarker>::inline_size(
2044 decoder.context,
2045 );
2046 if inlined != (member_inline_size <= 4) {
2047 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2048 }
2049 let inner_offset;
2050 let mut inner_depth = depth.clone();
2051 if inlined {
2052 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2053 inner_offset = next_offset;
2054 } else {
2055 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2056 inner_depth.increment()?;
2057 }
2058 let val_ref = self
2059 .scroll_h_range
2060 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_input_report::Axis, D));
2061 fidl::decode!(
2062 fidl_fuchsia_input_report::Axis,
2063 D,
2064 val_ref,
2065 decoder,
2066 inner_offset,
2067 inner_depth
2068 )?;
2069 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2070 {
2071 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2072 }
2073 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2074 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2075 }
2076 }
2077
2078 next_offset += envelope_size;
2079 _next_ordinal_to_read += 1;
2080 if next_offset >= end_offset {
2081 return Ok(());
2082 }
2083
2084 while _next_ordinal_to_read < 4 {
2086 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2087 _next_ordinal_to_read += 1;
2088 next_offset += envelope_size;
2089 }
2090
2091 let next_out_of_line = decoder.next_out_of_line();
2092 let handles_before = decoder.remaining_handles();
2093 if let Some((inlined, num_bytes, num_handles)) =
2094 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2095 {
2096 let member_inline_size =
2097 <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
2098 decoder.context,
2099 );
2100 if inlined != (member_inline_size <= 4) {
2101 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2102 }
2103 let inner_offset;
2104 let mut inner_depth = depth.clone();
2105 if inlined {
2106 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2107 inner_offset = next_offset;
2108 } else {
2109 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2110 inner_depth.increment()?;
2111 }
2112 let val_ref = self
2113 .buttons
2114 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
2115 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2116 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2117 {
2118 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2119 }
2120 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2121 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2122 }
2123 }
2124
2125 next_offset += envelope_size;
2126 _next_ordinal_to_read += 1;
2127 if next_offset >= end_offset {
2128 return Ok(());
2129 }
2130
2131 while _next_ordinal_to_read < 5 {
2133 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2134 _next_ordinal_to_read += 1;
2135 next_offset += envelope_size;
2136 }
2137
2138 let next_out_of_line = decoder.next_out_of_line();
2139 let handles_before = decoder.remaining_handles();
2140 if let Some((inlined, num_bytes, num_handles)) =
2141 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2142 {
2143 let member_inline_size = <fidl::encoding::Array<fidl_fuchsia_input_report::Axis, 2> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2144 if inlined != (member_inline_size <= 4) {
2145 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2146 }
2147 let inner_offset;
2148 let mut inner_depth = depth.clone();
2149 if inlined {
2150 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2151 inner_offset = next_offset;
2152 } else {
2153 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2154 inner_depth.increment()?;
2155 }
2156 let val_ref =
2157 self.relative_motion_range.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<fidl_fuchsia_input_report::Axis, 2>, D));
2158 fidl::decode!(fidl::encoding::Array<fidl_fuchsia_input_report::Axis, 2>, D, val_ref, decoder, inner_offset, inner_depth)?;
2159 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2160 {
2161 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2162 }
2163 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2164 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2165 }
2166 }
2167
2168 next_offset += envelope_size;
2169
2170 while next_offset < end_offset {
2172 _next_ordinal_to_read += 1;
2173 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2174 next_offset += envelope_size;
2175 }
2176
2177 Ok(())
2178 }
2179 }
2180
2181 impl MouseEvent {
2182 #[inline(always)]
2183 fn max_ordinal_present(&self) -> u64 {
2184 if let Some(_) = self.trace_flow_id {
2185 return 6;
2186 }
2187 if let Some(_) = self.stream_info {
2188 return 5;
2189 }
2190 if let Some(_) = self.pointer_sample {
2191 return 4;
2192 }
2193 if let Some(_) = self.device_info {
2194 return 3;
2195 }
2196 if let Some(_) = self.view_parameters {
2197 return 2;
2198 }
2199 if let Some(_) = self.timestamp {
2200 return 1;
2201 }
2202 0
2203 }
2204 }
2205
2206 impl fidl::encoding::ValueTypeMarker for MouseEvent {
2207 type Borrowed<'a> = &'a Self;
2208 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2209 value
2210 }
2211 }
2212
2213 unsafe impl fidl::encoding::TypeMarker for MouseEvent {
2214 type Owned = Self;
2215
2216 #[inline(always)]
2217 fn inline_align(_context: fidl::encoding::Context) -> usize {
2218 8
2219 }
2220
2221 #[inline(always)]
2222 fn inline_size(_context: fidl::encoding::Context) -> usize {
2223 16
2224 }
2225 }
2226
2227 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseEvent, D>
2228 for &MouseEvent
2229 {
2230 unsafe fn encode(
2231 self,
2232 encoder: &mut fidl::encoding::Encoder<'_, D>,
2233 offset: usize,
2234 mut depth: fidl::encoding::Depth,
2235 ) -> fidl::Result<()> {
2236 encoder.debug_check_bounds::<MouseEvent>(offset);
2237 let max_ordinal: u64 = self.max_ordinal_present();
2239 encoder.write_num(max_ordinal, offset);
2240 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2241 if max_ordinal == 0 {
2243 return Ok(());
2244 }
2245 depth.increment()?;
2246 let envelope_size = 8;
2247 let bytes_len = max_ordinal as usize * envelope_size;
2248 #[allow(unused_variables)]
2249 let offset = encoder.out_of_line_offset(bytes_len);
2250 let mut _prev_end_offset: usize = 0;
2251 if 1 > max_ordinal {
2252 return Ok(());
2253 }
2254
2255 let cur_offset: usize = (1 - 1) * envelope_size;
2258
2259 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2261
2262 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2267 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2268 encoder,
2269 offset + cur_offset,
2270 depth,
2271 )?;
2272
2273 _prev_end_offset = cur_offset + envelope_size;
2274 if 2 > max_ordinal {
2275 return Ok(());
2276 }
2277
2278 let cur_offset: usize = (2 - 1) * envelope_size;
2281
2282 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2284
2285 fidl::encoding::encode_in_envelope_optional::<ViewParameters, D>(
2290 self.view_parameters
2291 .as_ref()
2292 .map(<ViewParameters as fidl::encoding::ValueTypeMarker>::borrow),
2293 encoder,
2294 offset + cur_offset,
2295 depth,
2296 )?;
2297
2298 _prev_end_offset = cur_offset + envelope_size;
2299 if 3 > max_ordinal {
2300 return Ok(());
2301 }
2302
2303 let cur_offset: usize = (3 - 1) * envelope_size;
2306
2307 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2309
2310 fidl::encoding::encode_in_envelope_optional::<MouseDeviceInfo, D>(
2315 self.device_info
2316 .as_ref()
2317 .map(<MouseDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
2318 encoder,
2319 offset + cur_offset,
2320 depth,
2321 )?;
2322
2323 _prev_end_offset = cur_offset + envelope_size;
2324 if 4 > max_ordinal {
2325 return Ok(());
2326 }
2327
2328 let cur_offset: usize = (4 - 1) * envelope_size;
2331
2332 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2334
2335 fidl::encoding::encode_in_envelope_optional::<MousePointerSample, D>(
2340 self.pointer_sample
2341 .as_ref()
2342 .map(<MousePointerSample as fidl::encoding::ValueTypeMarker>::borrow),
2343 encoder,
2344 offset + cur_offset,
2345 depth,
2346 )?;
2347
2348 _prev_end_offset = cur_offset + envelope_size;
2349 if 5 > max_ordinal {
2350 return Ok(());
2351 }
2352
2353 let cur_offset: usize = (5 - 1) * envelope_size;
2356
2357 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2359
2360 fidl::encoding::encode_in_envelope_optional::<MouseEventStreamInfo, D>(
2365 self.stream_info
2366 .as_ref()
2367 .map(<MouseEventStreamInfo as fidl::encoding::ValueTypeMarker>::borrow),
2368 encoder,
2369 offset + cur_offset,
2370 depth,
2371 )?;
2372
2373 _prev_end_offset = cur_offset + envelope_size;
2374 if 6 > max_ordinal {
2375 return Ok(());
2376 }
2377
2378 let cur_offset: usize = (6 - 1) * envelope_size;
2381
2382 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2384
2385 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2390 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2391 encoder,
2392 offset + cur_offset,
2393 depth,
2394 )?;
2395
2396 _prev_end_offset = cur_offset + envelope_size;
2397
2398 Ok(())
2399 }
2400 }
2401
2402 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseEvent {
2403 #[inline(always)]
2404 fn new_empty() -> Self {
2405 Self::default()
2406 }
2407
2408 unsafe fn decode(
2409 &mut self,
2410 decoder: &mut fidl::encoding::Decoder<'_, D>,
2411 offset: usize,
2412 mut depth: fidl::encoding::Depth,
2413 ) -> fidl::Result<()> {
2414 decoder.debug_check_bounds::<Self>(offset);
2415 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2416 None => return Err(fidl::Error::NotNullable),
2417 Some(len) => len,
2418 };
2419 if len == 0 {
2421 return Ok(());
2422 };
2423 depth.increment()?;
2424 let envelope_size = 8;
2425 let bytes_len = len * envelope_size;
2426 let offset = decoder.out_of_line_offset(bytes_len)?;
2427 let mut _next_ordinal_to_read = 0;
2429 let mut next_offset = offset;
2430 let end_offset = offset + bytes_len;
2431 _next_ordinal_to_read += 1;
2432 if next_offset >= end_offset {
2433 return Ok(());
2434 }
2435
2436 while _next_ordinal_to_read < 1 {
2438 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2439 _next_ordinal_to_read += 1;
2440 next_offset += envelope_size;
2441 }
2442
2443 let next_out_of_line = decoder.next_out_of_line();
2444 let handles_before = decoder.remaining_handles();
2445 if let Some((inlined, num_bytes, num_handles)) =
2446 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2447 {
2448 let member_inline_size =
2449 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2450 if inlined != (member_inline_size <= 4) {
2451 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2452 }
2453 let inner_offset;
2454 let mut inner_depth = depth.clone();
2455 if inlined {
2456 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2457 inner_offset = next_offset;
2458 } else {
2459 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2460 inner_depth.increment()?;
2461 }
2462 let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
2463 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2464 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2465 {
2466 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2467 }
2468 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2469 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2470 }
2471 }
2472
2473 next_offset += envelope_size;
2474 _next_ordinal_to_read += 1;
2475 if next_offset >= end_offset {
2476 return Ok(());
2477 }
2478
2479 while _next_ordinal_to_read < 2 {
2481 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2482 _next_ordinal_to_read += 1;
2483 next_offset += envelope_size;
2484 }
2485
2486 let next_out_of_line = decoder.next_out_of_line();
2487 let handles_before = decoder.remaining_handles();
2488 if let Some((inlined, num_bytes, num_handles)) =
2489 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2490 {
2491 let member_inline_size =
2492 <ViewParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2493 if inlined != (member_inline_size <= 4) {
2494 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2495 }
2496 let inner_offset;
2497 let mut inner_depth = depth.clone();
2498 if inlined {
2499 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2500 inner_offset = next_offset;
2501 } else {
2502 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2503 inner_depth.increment()?;
2504 }
2505 let val_ref =
2506 self.view_parameters.get_or_insert_with(|| fidl::new_empty!(ViewParameters, D));
2507 fidl::decode!(ViewParameters, D, val_ref, decoder, inner_offset, inner_depth)?;
2508 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2509 {
2510 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2511 }
2512 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2513 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2514 }
2515 }
2516
2517 next_offset += envelope_size;
2518 _next_ordinal_to_read += 1;
2519 if next_offset >= end_offset {
2520 return Ok(());
2521 }
2522
2523 while _next_ordinal_to_read < 3 {
2525 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2526 _next_ordinal_to_read += 1;
2527 next_offset += envelope_size;
2528 }
2529
2530 let next_out_of_line = decoder.next_out_of_line();
2531 let handles_before = decoder.remaining_handles();
2532 if let Some((inlined, num_bytes, num_handles)) =
2533 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2534 {
2535 let member_inline_size =
2536 <MouseDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2537 if inlined != (member_inline_size <= 4) {
2538 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2539 }
2540 let inner_offset;
2541 let mut inner_depth = depth.clone();
2542 if inlined {
2543 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2544 inner_offset = next_offset;
2545 } else {
2546 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2547 inner_depth.increment()?;
2548 }
2549 let val_ref =
2550 self.device_info.get_or_insert_with(|| fidl::new_empty!(MouseDeviceInfo, D));
2551 fidl::decode!(MouseDeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
2552 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2553 {
2554 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2555 }
2556 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2557 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2558 }
2559 }
2560
2561 next_offset += envelope_size;
2562 _next_ordinal_to_read += 1;
2563 if next_offset >= end_offset {
2564 return Ok(());
2565 }
2566
2567 while _next_ordinal_to_read < 4 {
2569 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2570 _next_ordinal_to_read += 1;
2571 next_offset += envelope_size;
2572 }
2573
2574 let next_out_of_line = decoder.next_out_of_line();
2575 let handles_before = decoder.remaining_handles();
2576 if let Some((inlined, num_bytes, num_handles)) =
2577 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2578 {
2579 let member_inline_size =
2580 <MousePointerSample as fidl::encoding::TypeMarker>::inline_size(
2581 decoder.context,
2582 );
2583 if inlined != (member_inline_size <= 4) {
2584 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2585 }
2586 let inner_offset;
2587 let mut inner_depth = depth.clone();
2588 if inlined {
2589 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2590 inner_offset = next_offset;
2591 } else {
2592 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2593 inner_depth.increment()?;
2594 }
2595 let val_ref = self
2596 .pointer_sample
2597 .get_or_insert_with(|| fidl::new_empty!(MousePointerSample, D));
2598 fidl::decode!(MousePointerSample, D, val_ref, decoder, inner_offset, inner_depth)?;
2599 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2600 {
2601 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2602 }
2603 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2604 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2605 }
2606 }
2607
2608 next_offset += envelope_size;
2609 _next_ordinal_to_read += 1;
2610 if next_offset >= end_offset {
2611 return Ok(());
2612 }
2613
2614 while _next_ordinal_to_read < 5 {
2616 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2617 _next_ordinal_to_read += 1;
2618 next_offset += envelope_size;
2619 }
2620
2621 let next_out_of_line = decoder.next_out_of_line();
2622 let handles_before = decoder.remaining_handles();
2623 if let Some((inlined, num_bytes, num_handles)) =
2624 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2625 {
2626 let member_inline_size =
2627 <MouseEventStreamInfo as fidl::encoding::TypeMarker>::inline_size(
2628 decoder.context,
2629 );
2630 if inlined != (member_inline_size <= 4) {
2631 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2632 }
2633 let inner_offset;
2634 let mut inner_depth = depth.clone();
2635 if inlined {
2636 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2637 inner_offset = next_offset;
2638 } else {
2639 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2640 inner_depth.increment()?;
2641 }
2642 let val_ref = self
2643 .stream_info
2644 .get_or_insert_with(|| fidl::new_empty!(MouseEventStreamInfo, D));
2645 fidl::decode!(
2646 MouseEventStreamInfo,
2647 D,
2648 val_ref,
2649 decoder,
2650 inner_offset,
2651 inner_depth
2652 )?;
2653 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2654 {
2655 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2656 }
2657 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2658 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2659 }
2660 }
2661
2662 next_offset += envelope_size;
2663 _next_ordinal_to_read += 1;
2664 if next_offset >= end_offset {
2665 return Ok(());
2666 }
2667
2668 while _next_ordinal_to_read < 6 {
2670 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2671 _next_ordinal_to_read += 1;
2672 next_offset += envelope_size;
2673 }
2674
2675 let next_out_of_line = decoder.next_out_of_line();
2676 let handles_before = decoder.remaining_handles();
2677 if let Some((inlined, num_bytes, num_handles)) =
2678 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2679 {
2680 let member_inline_size =
2681 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2682 if inlined != (member_inline_size <= 4) {
2683 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2684 }
2685 let inner_offset;
2686 let mut inner_depth = depth.clone();
2687 if inlined {
2688 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2689 inner_offset = next_offset;
2690 } else {
2691 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2692 inner_depth.increment()?;
2693 }
2694 let val_ref = self.trace_flow_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
2695 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2696 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2697 {
2698 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2699 }
2700 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2701 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2702 }
2703 }
2704
2705 next_offset += envelope_size;
2706
2707 while next_offset < end_offset {
2709 _next_ordinal_to_read += 1;
2710 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2711 next_offset += envelope_size;
2712 }
2713
2714 Ok(())
2715 }
2716 }
2717
2718 impl MousePointerSample {
2719 #[inline(always)]
2720 fn max_ordinal_present(&self) -> u64 {
2721 if let Some(_) = self.is_precision_scroll {
2722 return 9;
2723 }
2724 if let Some(_) = self.scroll_h_physical_pixel {
2725 return 8;
2726 }
2727 if let Some(_) = self.scroll_v_physical_pixel {
2728 return 7;
2729 }
2730 if let Some(_) = self.relative_motion {
2731 return 6;
2732 }
2733 if let Some(_) = self.pressed_buttons {
2734 return 5;
2735 }
2736 if let Some(_) = self.scroll_h {
2737 return 4;
2738 }
2739 if let Some(_) = self.scroll_v {
2740 return 3;
2741 }
2742 if let Some(_) = self.position_in_viewport {
2743 return 2;
2744 }
2745 if let Some(_) = self.device_id {
2746 return 1;
2747 }
2748 0
2749 }
2750 }
2751
2752 impl fidl::encoding::ValueTypeMarker for MousePointerSample {
2753 type Borrowed<'a> = &'a Self;
2754 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2755 value
2756 }
2757 }
2758
2759 unsafe impl fidl::encoding::TypeMarker for MousePointerSample {
2760 type Owned = Self;
2761
2762 #[inline(always)]
2763 fn inline_align(_context: fidl::encoding::Context) -> usize {
2764 8
2765 }
2766
2767 #[inline(always)]
2768 fn inline_size(_context: fidl::encoding::Context) -> usize {
2769 16
2770 }
2771 }
2772
2773 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MousePointerSample, D>
2774 for &MousePointerSample
2775 {
2776 unsafe fn encode(
2777 self,
2778 encoder: &mut fidl::encoding::Encoder<'_, D>,
2779 offset: usize,
2780 mut depth: fidl::encoding::Depth,
2781 ) -> fidl::Result<()> {
2782 encoder.debug_check_bounds::<MousePointerSample>(offset);
2783 let max_ordinal: u64 = self.max_ordinal_present();
2785 encoder.write_num(max_ordinal, offset);
2786 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2787 if max_ordinal == 0 {
2789 return Ok(());
2790 }
2791 depth.increment()?;
2792 let envelope_size = 8;
2793 let bytes_len = max_ordinal as usize * envelope_size;
2794 #[allow(unused_variables)]
2795 let offset = encoder.out_of_line_offset(bytes_len);
2796 let mut _prev_end_offset: usize = 0;
2797 if 1 > max_ordinal {
2798 return Ok(());
2799 }
2800
2801 let cur_offset: usize = (1 - 1) * envelope_size;
2804
2805 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2807
2808 fidl::encoding::encode_in_envelope_optional::<u32, D>(
2813 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2814 encoder,
2815 offset + cur_offset,
2816 depth,
2817 )?;
2818
2819 _prev_end_offset = cur_offset + envelope_size;
2820 if 2 > max_ordinal {
2821 return Ok(());
2822 }
2823
2824 let cur_offset: usize = (2 - 1) * envelope_size;
2827
2828 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2830
2831 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 2>, D>(
2836 self.position_in_viewport.as_ref().map(
2837 <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow,
2838 ),
2839 encoder,
2840 offset + cur_offset,
2841 depth,
2842 )?;
2843
2844 _prev_end_offset = cur_offset + envelope_size;
2845 if 3 > max_ordinal {
2846 return Ok(());
2847 }
2848
2849 let cur_offset: usize = (3 - 1) * envelope_size;
2852
2853 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2855
2856 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2861 self.scroll_v.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2862 encoder,
2863 offset + cur_offset,
2864 depth,
2865 )?;
2866
2867 _prev_end_offset = cur_offset + envelope_size;
2868 if 4 > max_ordinal {
2869 return Ok(());
2870 }
2871
2872 let cur_offset: usize = (4 - 1) * envelope_size;
2875
2876 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2878
2879 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2884 self.scroll_h.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2885 encoder,
2886 offset + cur_offset,
2887 depth,
2888 )?;
2889
2890 _prev_end_offset = cur_offset + envelope_size;
2891 if 5 > max_ordinal {
2892 return Ok(());
2893 }
2894
2895 let cur_offset: usize = (5 - 1) * envelope_size;
2898
2899 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2901
2902 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
2907 self.pressed_buttons.as_ref().map(
2908 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
2909 ),
2910 encoder,
2911 offset + cur_offset,
2912 depth,
2913 )?;
2914
2915 _prev_end_offset = cur_offset + envelope_size;
2916 if 6 > max_ordinal {
2917 return Ok(());
2918 }
2919
2920 let cur_offset: usize = (6 - 1) * envelope_size;
2923
2924 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2926
2927 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 2>, D>(
2932 self.relative_motion.as_ref().map(
2933 <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow,
2934 ),
2935 encoder,
2936 offset + cur_offset,
2937 depth,
2938 )?;
2939
2940 _prev_end_offset = cur_offset + envelope_size;
2941 if 7 > max_ordinal {
2942 return Ok(());
2943 }
2944
2945 let cur_offset: usize = (7 - 1) * envelope_size;
2948
2949 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2951
2952 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2957 self.scroll_v_physical_pixel
2958 .as_ref()
2959 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2960 encoder,
2961 offset + cur_offset,
2962 depth,
2963 )?;
2964
2965 _prev_end_offset = cur_offset + envelope_size;
2966 if 8 > max_ordinal {
2967 return Ok(());
2968 }
2969
2970 let cur_offset: usize = (8 - 1) * envelope_size;
2973
2974 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2976
2977 fidl::encoding::encode_in_envelope_optional::<f64, D>(
2982 self.scroll_h_physical_pixel
2983 .as_ref()
2984 .map(<f64 as fidl::encoding::ValueTypeMarker>::borrow),
2985 encoder,
2986 offset + cur_offset,
2987 depth,
2988 )?;
2989
2990 _prev_end_offset = cur_offset + envelope_size;
2991 if 9 > max_ordinal {
2992 return Ok(());
2993 }
2994
2995 let cur_offset: usize = (9 - 1) * envelope_size;
2998
2999 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3001
3002 fidl::encoding::encode_in_envelope_optional::<bool, D>(
3007 self.is_precision_scroll
3008 .as_ref()
3009 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
3010 encoder,
3011 offset + cur_offset,
3012 depth,
3013 )?;
3014
3015 _prev_end_offset = cur_offset + envelope_size;
3016
3017 Ok(())
3018 }
3019 }
3020
3021 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MousePointerSample {
3022 #[inline(always)]
3023 fn new_empty() -> Self {
3024 Self::default()
3025 }
3026
3027 unsafe fn decode(
3028 &mut self,
3029 decoder: &mut fidl::encoding::Decoder<'_, D>,
3030 offset: usize,
3031 mut depth: fidl::encoding::Depth,
3032 ) -> fidl::Result<()> {
3033 decoder.debug_check_bounds::<Self>(offset);
3034 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3035 None => return Err(fidl::Error::NotNullable),
3036 Some(len) => len,
3037 };
3038 if len == 0 {
3040 return Ok(());
3041 };
3042 depth.increment()?;
3043 let envelope_size = 8;
3044 let bytes_len = len * envelope_size;
3045 let offset = decoder.out_of_line_offset(bytes_len)?;
3046 let mut _next_ordinal_to_read = 0;
3048 let mut next_offset = offset;
3049 let end_offset = offset + bytes_len;
3050 _next_ordinal_to_read += 1;
3051 if next_offset >= end_offset {
3052 return Ok(());
3053 }
3054
3055 while _next_ordinal_to_read < 1 {
3057 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3058 _next_ordinal_to_read += 1;
3059 next_offset += envelope_size;
3060 }
3061
3062 let next_out_of_line = decoder.next_out_of_line();
3063 let handles_before = decoder.remaining_handles();
3064 if let Some((inlined, num_bytes, num_handles)) =
3065 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3066 {
3067 let member_inline_size =
3068 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3069 if inlined != (member_inline_size <= 4) {
3070 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3071 }
3072 let inner_offset;
3073 let mut inner_depth = depth.clone();
3074 if inlined {
3075 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3076 inner_offset = next_offset;
3077 } else {
3078 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3079 inner_depth.increment()?;
3080 }
3081 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
3082 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3083 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3084 {
3085 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3086 }
3087 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3088 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3089 }
3090 }
3091
3092 next_offset += envelope_size;
3093 _next_ordinal_to_read += 1;
3094 if next_offset >= end_offset {
3095 return Ok(());
3096 }
3097
3098 while _next_ordinal_to_read < 2 {
3100 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3101 _next_ordinal_to_read += 1;
3102 next_offset += envelope_size;
3103 }
3104
3105 let next_out_of_line = decoder.next_out_of_line();
3106 let handles_before = decoder.remaining_handles();
3107 if let Some((inlined, num_bytes, num_handles)) =
3108 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3109 {
3110 let member_inline_size =
3111 <fidl::encoding::Array<f32, 2> as fidl::encoding::TypeMarker>::inline_size(
3112 decoder.context,
3113 );
3114 if inlined != (member_inline_size <= 4) {
3115 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3116 }
3117 let inner_offset;
3118 let mut inner_depth = depth.clone();
3119 if inlined {
3120 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3121 inner_offset = next_offset;
3122 } else {
3123 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3124 inner_depth.increment()?;
3125 }
3126 let val_ref = self
3127 .position_in_viewport
3128 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 2>, D));
3129 fidl::decode!(fidl::encoding::Array<f32, 2>, D, val_ref, decoder, inner_offset, inner_depth)?;
3130 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3131 {
3132 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3133 }
3134 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3135 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3136 }
3137 }
3138
3139 next_offset += envelope_size;
3140 _next_ordinal_to_read += 1;
3141 if next_offset >= end_offset {
3142 return Ok(());
3143 }
3144
3145 while _next_ordinal_to_read < 3 {
3147 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3148 _next_ordinal_to_read += 1;
3149 next_offset += envelope_size;
3150 }
3151
3152 let next_out_of_line = decoder.next_out_of_line();
3153 let handles_before = decoder.remaining_handles();
3154 if let Some((inlined, num_bytes, num_handles)) =
3155 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3156 {
3157 let member_inline_size =
3158 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3159 if inlined != (member_inline_size <= 4) {
3160 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3161 }
3162 let inner_offset;
3163 let mut inner_depth = depth.clone();
3164 if inlined {
3165 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3166 inner_offset = next_offset;
3167 } else {
3168 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3169 inner_depth.increment()?;
3170 }
3171 let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(i64, D));
3172 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3173 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3174 {
3175 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3176 }
3177 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3178 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3179 }
3180 }
3181
3182 next_offset += envelope_size;
3183 _next_ordinal_to_read += 1;
3184 if next_offset >= end_offset {
3185 return Ok(());
3186 }
3187
3188 while _next_ordinal_to_read < 4 {
3190 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3191 _next_ordinal_to_read += 1;
3192 next_offset += envelope_size;
3193 }
3194
3195 let next_out_of_line = decoder.next_out_of_line();
3196 let handles_before = decoder.remaining_handles();
3197 if let Some((inlined, num_bytes, num_handles)) =
3198 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3199 {
3200 let member_inline_size =
3201 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3202 if inlined != (member_inline_size <= 4) {
3203 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3204 }
3205 let inner_offset;
3206 let mut inner_depth = depth.clone();
3207 if inlined {
3208 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3209 inner_offset = next_offset;
3210 } else {
3211 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3212 inner_depth.increment()?;
3213 }
3214 let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(i64, D));
3215 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3216 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3217 {
3218 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3219 }
3220 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3221 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3222 }
3223 }
3224
3225 next_offset += envelope_size;
3226 _next_ordinal_to_read += 1;
3227 if next_offset >= end_offset {
3228 return Ok(());
3229 }
3230
3231 while _next_ordinal_to_read < 5 {
3233 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3234 _next_ordinal_to_read += 1;
3235 next_offset += envelope_size;
3236 }
3237
3238 let next_out_of_line = decoder.next_out_of_line();
3239 let handles_before = decoder.remaining_handles();
3240 if let Some((inlined, num_bytes, num_handles)) =
3241 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3242 {
3243 let member_inline_size =
3244 <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
3245 decoder.context,
3246 );
3247 if inlined != (member_inline_size <= 4) {
3248 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3249 }
3250 let inner_offset;
3251 let mut inner_depth = depth.clone();
3252 if inlined {
3253 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3254 inner_offset = next_offset;
3255 } else {
3256 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3257 inner_depth.increment()?;
3258 }
3259 let val_ref = self
3260 .pressed_buttons
3261 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
3262 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3263 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3264 {
3265 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3266 }
3267 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3268 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3269 }
3270 }
3271
3272 next_offset += envelope_size;
3273 _next_ordinal_to_read += 1;
3274 if next_offset >= end_offset {
3275 return Ok(());
3276 }
3277
3278 while _next_ordinal_to_read < 6 {
3280 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3281 _next_ordinal_to_read += 1;
3282 next_offset += envelope_size;
3283 }
3284
3285 let next_out_of_line = decoder.next_out_of_line();
3286 let handles_before = decoder.remaining_handles();
3287 if let Some((inlined, num_bytes, num_handles)) =
3288 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3289 {
3290 let member_inline_size =
3291 <fidl::encoding::Array<f32, 2> as fidl::encoding::TypeMarker>::inline_size(
3292 decoder.context,
3293 );
3294 if inlined != (member_inline_size <= 4) {
3295 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3296 }
3297 let inner_offset;
3298 let mut inner_depth = depth.clone();
3299 if inlined {
3300 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3301 inner_offset = next_offset;
3302 } else {
3303 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3304 inner_depth.increment()?;
3305 }
3306 let val_ref = self
3307 .relative_motion
3308 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 2>, D));
3309 fidl::decode!(fidl::encoding::Array<f32, 2>, D, val_ref, decoder, inner_offset, inner_depth)?;
3310 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3311 {
3312 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3313 }
3314 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3315 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3316 }
3317 }
3318
3319 next_offset += envelope_size;
3320 _next_ordinal_to_read += 1;
3321 if next_offset >= end_offset {
3322 return Ok(());
3323 }
3324
3325 while _next_ordinal_to_read < 7 {
3327 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3328 _next_ordinal_to_read += 1;
3329 next_offset += envelope_size;
3330 }
3331
3332 let next_out_of_line = decoder.next_out_of_line();
3333 let handles_before = decoder.remaining_handles();
3334 if let Some((inlined, num_bytes, num_handles)) =
3335 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3336 {
3337 let member_inline_size =
3338 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3339 if inlined != (member_inline_size <= 4) {
3340 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3341 }
3342 let inner_offset;
3343 let mut inner_depth = depth.clone();
3344 if inlined {
3345 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3346 inner_offset = next_offset;
3347 } else {
3348 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3349 inner_depth.increment()?;
3350 }
3351 let val_ref =
3352 self.scroll_v_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3353 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3354 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3355 {
3356 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3357 }
3358 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3359 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3360 }
3361 }
3362
3363 next_offset += envelope_size;
3364 _next_ordinal_to_read += 1;
3365 if next_offset >= end_offset {
3366 return Ok(());
3367 }
3368
3369 while _next_ordinal_to_read < 8 {
3371 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3372 _next_ordinal_to_read += 1;
3373 next_offset += envelope_size;
3374 }
3375
3376 let next_out_of_line = decoder.next_out_of_line();
3377 let handles_before = decoder.remaining_handles();
3378 if let Some((inlined, num_bytes, num_handles)) =
3379 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3380 {
3381 let member_inline_size =
3382 <f64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3383 if inlined != (member_inline_size <= 4) {
3384 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3385 }
3386 let inner_offset;
3387 let mut inner_depth = depth.clone();
3388 if inlined {
3389 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3390 inner_offset = next_offset;
3391 } else {
3392 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3393 inner_depth.increment()?;
3394 }
3395 let val_ref =
3396 self.scroll_h_physical_pixel.get_or_insert_with(|| fidl::new_empty!(f64, D));
3397 fidl::decode!(f64, D, val_ref, decoder, inner_offset, inner_depth)?;
3398 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3399 {
3400 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3401 }
3402 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3403 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3404 }
3405 }
3406
3407 next_offset += envelope_size;
3408 _next_ordinal_to_read += 1;
3409 if next_offset >= end_offset {
3410 return Ok(());
3411 }
3412
3413 while _next_ordinal_to_read < 9 {
3415 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3416 _next_ordinal_to_read += 1;
3417 next_offset += envelope_size;
3418 }
3419
3420 let next_out_of_line = decoder.next_out_of_line();
3421 let handles_before = decoder.remaining_handles();
3422 if let Some((inlined, num_bytes, num_handles)) =
3423 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3424 {
3425 let member_inline_size =
3426 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3427 if inlined != (member_inline_size <= 4) {
3428 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3429 }
3430 let inner_offset;
3431 let mut inner_depth = depth.clone();
3432 if inlined {
3433 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3434 inner_offset = next_offset;
3435 } else {
3436 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3437 inner_depth.increment()?;
3438 }
3439 let val_ref =
3440 self.is_precision_scroll.get_or_insert_with(|| fidl::new_empty!(bool, D));
3441 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
3442 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3443 {
3444 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3445 }
3446 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3447 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3448 }
3449 }
3450
3451 next_offset += envelope_size;
3452
3453 while next_offset < end_offset {
3455 _next_ordinal_to_read += 1;
3456 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3457 next_offset += envelope_size;
3458 }
3459
3460 Ok(())
3461 }
3462 }
3463
3464 impl TouchDeviceInfo {
3465 #[inline(always)]
3466 fn max_ordinal_present(&self) -> u64 {
3467 if let Some(_) = self.id {
3468 return 1;
3469 }
3470 0
3471 }
3472 }
3473
3474 impl fidl::encoding::ValueTypeMarker for TouchDeviceInfo {
3475 type Borrowed<'a> = &'a Self;
3476 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3477 value
3478 }
3479 }
3480
3481 unsafe impl fidl::encoding::TypeMarker for TouchDeviceInfo {
3482 type Owned = Self;
3483
3484 #[inline(always)]
3485 fn inline_align(_context: fidl::encoding::Context) -> usize {
3486 8
3487 }
3488
3489 #[inline(always)]
3490 fn inline_size(_context: fidl::encoding::Context) -> usize {
3491 16
3492 }
3493 }
3494
3495 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDeviceInfo, D>
3496 for &TouchDeviceInfo
3497 {
3498 unsafe fn encode(
3499 self,
3500 encoder: &mut fidl::encoding::Encoder<'_, D>,
3501 offset: usize,
3502 mut depth: fidl::encoding::Depth,
3503 ) -> fidl::Result<()> {
3504 encoder.debug_check_bounds::<TouchDeviceInfo>(offset);
3505 let max_ordinal: u64 = self.max_ordinal_present();
3507 encoder.write_num(max_ordinal, offset);
3508 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3509 if max_ordinal == 0 {
3511 return Ok(());
3512 }
3513 depth.increment()?;
3514 let envelope_size = 8;
3515 let bytes_len = max_ordinal as usize * envelope_size;
3516 #[allow(unused_variables)]
3517 let offset = encoder.out_of_line_offset(bytes_len);
3518 let mut _prev_end_offset: usize = 0;
3519 if 1 > max_ordinal {
3520 return Ok(());
3521 }
3522
3523 let cur_offset: usize = (1 - 1) * envelope_size;
3526
3527 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3529
3530 fidl::encoding::encode_in_envelope_optional::<u32, D>(
3535 self.id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3536 encoder,
3537 offset + cur_offset,
3538 depth,
3539 )?;
3540
3541 _prev_end_offset = cur_offset + envelope_size;
3542
3543 Ok(())
3544 }
3545 }
3546
3547 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDeviceInfo {
3548 #[inline(always)]
3549 fn new_empty() -> Self {
3550 Self::default()
3551 }
3552
3553 unsafe fn decode(
3554 &mut self,
3555 decoder: &mut fidl::encoding::Decoder<'_, D>,
3556 offset: usize,
3557 mut depth: fidl::encoding::Depth,
3558 ) -> fidl::Result<()> {
3559 decoder.debug_check_bounds::<Self>(offset);
3560 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3561 None => return Err(fidl::Error::NotNullable),
3562 Some(len) => len,
3563 };
3564 if len == 0 {
3566 return Ok(());
3567 };
3568 depth.increment()?;
3569 let envelope_size = 8;
3570 let bytes_len = len * envelope_size;
3571 let offset = decoder.out_of_line_offset(bytes_len)?;
3572 let mut _next_ordinal_to_read = 0;
3574 let mut next_offset = offset;
3575 let end_offset = offset + bytes_len;
3576 _next_ordinal_to_read += 1;
3577 if next_offset >= end_offset {
3578 return Ok(());
3579 }
3580
3581 while _next_ordinal_to_read < 1 {
3583 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3584 _next_ordinal_to_read += 1;
3585 next_offset += envelope_size;
3586 }
3587
3588 let next_out_of_line = decoder.next_out_of_line();
3589 let handles_before = decoder.remaining_handles();
3590 if let Some((inlined, num_bytes, num_handles)) =
3591 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3592 {
3593 let member_inline_size =
3594 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3595 if inlined != (member_inline_size <= 4) {
3596 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3597 }
3598 let inner_offset;
3599 let mut inner_depth = depth.clone();
3600 if inlined {
3601 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3602 inner_offset = next_offset;
3603 } else {
3604 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3605 inner_depth.increment()?;
3606 }
3607 let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(u32, D));
3608 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
3609 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3610 {
3611 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3612 }
3613 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3614 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3615 }
3616 }
3617
3618 next_offset += envelope_size;
3619
3620 while next_offset < end_offset {
3622 _next_ordinal_to_read += 1;
3623 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3624 next_offset += envelope_size;
3625 }
3626
3627 Ok(())
3628 }
3629 }
3630
3631 impl TouchEvent {
3632 #[inline(always)]
3633 fn max_ordinal_present(&self) -> u64 {
3634 if let Some(_) = self.trace_flow_id {
3635 return 6;
3636 }
3637 if let Some(_) = self.interaction_result {
3638 return 5;
3639 }
3640 if let Some(_) = self.pointer_sample {
3641 return 4;
3642 }
3643 if let Some(_) = self.device_info {
3644 return 3;
3645 }
3646 if let Some(_) = self.view_parameters {
3647 return 2;
3648 }
3649 if let Some(_) = self.timestamp {
3650 return 1;
3651 }
3652 0
3653 }
3654 }
3655
3656 impl fidl::encoding::ValueTypeMarker for TouchEvent {
3657 type Borrowed<'a> = &'a Self;
3658 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3659 value
3660 }
3661 }
3662
3663 unsafe impl fidl::encoding::TypeMarker for TouchEvent {
3664 type Owned = Self;
3665
3666 #[inline(always)]
3667 fn inline_align(_context: fidl::encoding::Context) -> usize {
3668 8
3669 }
3670
3671 #[inline(always)]
3672 fn inline_size(_context: fidl::encoding::Context) -> usize {
3673 16
3674 }
3675 }
3676
3677 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchEvent, D>
3678 for &TouchEvent
3679 {
3680 unsafe fn encode(
3681 self,
3682 encoder: &mut fidl::encoding::Encoder<'_, D>,
3683 offset: usize,
3684 mut depth: fidl::encoding::Depth,
3685 ) -> fidl::Result<()> {
3686 encoder.debug_check_bounds::<TouchEvent>(offset);
3687 let max_ordinal: u64 = self.max_ordinal_present();
3689 encoder.write_num(max_ordinal, offset);
3690 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3691 if max_ordinal == 0 {
3693 return Ok(());
3694 }
3695 depth.increment()?;
3696 let envelope_size = 8;
3697 let bytes_len = max_ordinal as usize * envelope_size;
3698 #[allow(unused_variables)]
3699 let offset = encoder.out_of_line_offset(bytes_len);
3700 let mut _prev_end_offset: usize = 0;
3701 if 1 > max_ordinal {
3702 return Ok(());
3703 }
3704
3705 let cur_offset: usize = (1 - 1) * envelope_size;
3708
3709 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3711
3712 fidl::encoding::encode_in_envelope_optional::<i64, D>(
3717 self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3718 encoder,
3719 offset + cur_offset,
3720 depth,
3721 )?;
3722
3723 _prev_end_offset = cur_offset + envelope_size;
3724 if 2 > max_ordinal {
3725 return Ok(());
3726 }
3727
3728 let cur_offset: usize = (2 - 1) * envelope_size;
3731
3732 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3734
3735 fidl::encoding::encode_in_envelope_optional::<ViewParameters, D>(
3740 self.view_parameters
3741 .as_ref()
3742 .map(<ViewParameters as fidl::encoding::ValueTypeMarker>::borrow),
3743 encoder,
3744 offset + cur_offset,
3745 depth,
3746 )?;
3747
3748 _prev_end_offset = cur_offset + envelope_size;
3749 if 3 > max_ordinal {
3750 return Ok(());
3751 }
3752
3753 let cur_offset: usize = (3 - 1) * envelope_size;
3756
3757 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3759
3760 fidl::encoding::encode_in_envelope_optional::<TouchDeviceInfo, D>(
3765 self.device_info
3766 .as_ref()
3767 .map(<TouchDeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
3768 encoder,
3769 offset + cur_offset,
3770 depth,
3771 )?;
3772
3773 _prev_end_offset = cur_offset + envelope_size;
3774 if 4 > max_ordinal {
3775 return Ok(());
3776 }
3777
3778 let cur_offset: usize = (4 - 1) * envelope_size;
3781
3782 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3784
3785 fidl::encoding::encode_in_envelope_optional::<TouchPointerSample, D>(
3790 self.pointer_sample
3791 .as_ref()
3792 .map(<TouchPointerSample as fidl::encoding::ValueTypeMarker>::borrow),
3793 encoder,
3794 offset + cur_offset,
3795 depth,
3796 )?;
3797
3798 _prev_end_offset = cur_offset + envelope_size;
3799 if 5 > max_ordinal {
3800 return Ok(());
3801 }
3802
3803 let cur_offset: usize = (5 - 1) * envelope_size;
3806
3807 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3809
3810 fidl::encoding::encode_in_envelope_optional::<TouchInteractionResult, D>(
3815 self.interaction_result
3816 .as_ref()
3817 .map(<TouchInteractionResult as fidl::encoding::ValueTypeMarker>::borrow),
3818 encoder,
3819 offset + cur_offset,
3820 depth,
3821 )?;
3822
3823 _prev_end_offset = cur_offset + envelope_size;
3824 if 6 > max_ordinal {
3825 return Ok(());
3826 }
3827
3828 let cur_offset: usize = (6 - 1) * envelope_size;
3831
3832 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3834
3835 fidl::encoding::encode_in_envelope_optional::<u64, D>(
3840 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3841 encoder,
3842 offset + cur_offset,
3843 depth,
3844 )?;
3845
3846 _prev_end_offset = cur_offset + envelope_size;
3847
3848 Ok(())
3849 }
3850 }
3851
3852 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchEvent {
3853 #[inline(always)]
3854 fn new_empty() -> Self {
3855 Self::default()
3856 }
3857
3858 unsafe fn decode(
3859 &mut self,
3860 decoder: &mut fidl::encoding::Decoder<'_, D>,
3861 offset: usize,
3862 mut depth: fidl::encoding::Depth,
3863 ) -> fidl::Result<()> {
3864 decoder.debug_check_bounds::<Self>(offset);
3865 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3866 None => return Err(fidl::Error::NotNullable),
3867 Some(len) => len,
3868 };
3869 if len == 0 {
3871 return Ok(());
3872 };
3873 depth.increment()?;
3874 let envelope_size = 8;
3875 let bytes_len = len * envelope_size;
3876 let offset = decoder.out_of_line_offset(bytes_len)?;
3877 let mut _next_ordinal_to_read = 0;
3879 let mut next_offset = offset;
3880 let end_offset = offset + bytes_len;
3881 _next_ordinal_to_read += 1;
3882 if next_offset >= end_offset {
3883 return Ok(());
3884 }
3885
3886 while _next_ordinal_to_read < 1 {
3888 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3889 _next_ordinal_to_read += 1;
3890 next_offset += envelope_size;
3891 }
3892
3893 let next_out_of_line = decoder.next_out_of_line();
3894 let handles_before = decoder.remaining_handles();
3895 if let Some((inlined, num_bytes, num_handles)) =
3896 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3897 {
3898 let member_inline_size =
3899 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3900 if inlined != (member_inline_size <= 4) {
3901 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3902 }
3903 let inner_offset;
3904 let mut inner_depth = depth.clone();
3905 if inlined {
3906 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3907 inner_offset = next_offset;
3908 } else {
3909 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3910 inner_depth.increment()?;
3911 }
3912 let val_ref = self.timestamp.get_or_insert_with(|| fidl::new_empty!(i64, D));
3913 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
3914 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3915 {
3916 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3917 }
3918 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3919 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3920 }
3921 }
3922
3923 next_offset += envelope_size;
3924 _next_ordinal_to_read += 1;
3925 if next_offset >= end_offset {
3926 return Ok(());
3927 }
3928
3929 while _next_ordinal_to_read < 2 {
3931 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3932 _next_ordinal_to_read += 1;
3933 next_offset += envelope_size;
3934 }
3935
3936 let next_out_of_line = decoder.next_out_of_line();
3937 let handles_before = decoder.remaining_handles();
3938 if let Some((inlined, num_bytes, num_handles)) =
3939 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3940 {
3941 let member_inline_size =
3942 <ViewParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3943 if inlined != (member_inline_size <= 4) {
3944 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3945 }
3946 let inner_offset;
3947 let mut inner_depth = depth.clone();
3948 if inlined {
3949 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3950 inner_offset = next_offset;
3951 } else {
3952 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3953 inner_depth.increment()?;
3954 }
3955 let val_ref =
3956 self.view_parameters.get_or_insert_with(|| fidl::new_empty!(ViewParameters, D));
3957 fidl::decode!(ViewParameters, D, val_ref, decoder, inner_offset, inner_depth)?;
3958 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3959 {
3960 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3961 }
3962 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3963 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3964 }
3965 }
3966
3967 next_offset += envelope_size;
3968 _next_ordinal_to_read += 1;
3969 if next_offset >= end_offset {
3970 return Ok(());
3971 }
3972
3973 while _next_ordinal_to_read < 3 {
3975 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3976 _next_ordinal_to_read += 1;
3977 next_offset += envelope_size;
3978 }
3979
3980 let next_out_of_line = decoder.next_out_of_line();
3981 let handles_before = decoder.remaining_handles();
3982 if let Some((inlined, num_bytes, num_handles)) =
3983 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3984 {
3985 let member_inline_size =
3986 <TouchDeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3987 if inlined != (member_inline_size <= 4) {
3988 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3989 }
3990 let inner_offset;
3991 let mut inner_depth = depth.clone();
3992 if inlined {
3993 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3994 inner_offset = next_offset;
3995 } else {
3996 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3997 inner_depth.increment()?;
3998 }
3999 let val_ref =
4000 self.device_info.get_or_insert_with(|| fidl::new_empty!(TouchDeviceInfo, D));
4001 fidl::decode!(TouchDeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
4002 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4003 {
4004 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4005 }
4006 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4007 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4008 }
4009 }
4010
4011 next_offset += envelope_size;
4012 _next_ordinal_to_read += 1;
4013 if next_offset >= end_offset {
4014 return Ok(());
4015 }
4016
4017 while _next_ordinal_to_read < 4 {
4019 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4020 _next_ordinal_to_read += 1;
4021 next_offset += envelope_size;
4022 }
4023
4024 let next_out_of_line = decoder.next_out_of_line();
4025 let handles_before = decoder.remaining_handles();
4026 if let Some((inlined, num_bytes, num_handles)) =
4027 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4028 {
4029 let member_inline_size =
4030 <TouchPointerSample as fidl::encoding::TypeMarker>::inline_size(
4031 decoder.context,
4032 );
4033 if inlined != (member_inline_size <= 4) {
4034 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4035 }
4036 let inner_offset;
4037 let mut inner_depth = depth.clone();
4038 if inlined {
4039 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4040 inner_offset = next_offset;
4041 } else {
4042 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4043 inner_depth.increment()?;
4044 }
4045 let val_ref = self
4046 .pointer_sample
4047 .get_or_insert_with(|| fidl::new_empty!(TouchPointerSample, D));
4048 fidl::decode!(TouchPointerSample, D, val_ref, decoder, inner_offset, inner_depth)?;
4049 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4050 {
4051 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4052 }
4053 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4054 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4055 }
4056 }
4057
4058 next_offset += envelope_size;
4059 _next_ordinal_to_read += 1;
4060 if next_offset >= end_offset {
4061 return Ok(());
4062 }
4063
4064 while _next_ordinal_to_read < 5 {
4066 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4067 _next_ordinal_to_read += 1;
4068 next_offset += envelope_size;
4069 }
4070
4071 let next_out_of_line = decoder.next_out_of_line();
4072 let handles_before = decoder.remaining_handles();
4073 if let Some((inlined, num_bytes, num_handles)) =
4074 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4075 {
4076 let member_inline_size =
4077 <TouchInteractionResult as fidl::encoding::TypeMarker>::inline_size(
4078 decoder.context,
4079 );
4080 if inlined != (member_inline_size <= 4) {
4081 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4082 }
4083 let inner_offset;
4084 let mut inner_depth = depth.clone();
4085 if inlined {
4086 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4087 inner_offset = next_offset;
4088 } else {
4089 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4090 inner_depth.increment()?;
4091 }
4092 let val_ref = self
4093 .interaction_result
4094 .get_or_insert_with(|| fidl::new_empty!(TouchInteractionResult, D));
4095 fidl::decode!(
4096 TouchInteractionResult,
4097 D,
4098 val_ref,
4099 decoder,
4100 inner_offset,
4101 inner_depth
4102 )?;
4103 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4104 {
4105 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4106 }
4107 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4108 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4109 }
4110 }
4111
4112 next_offset += envelope_size;
4113 _next_ordinal_to_read += 1;
4114 if next_offset >= end_offset {
4115 return Ok(());
4116 }
4117
4118 while _next_ordinal_to_read < 6 {
4120 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4121 _next_ordinal_to_read += 1;
4122 next_offset += envelope_size;
4123 }
4124
4125 let next_out_of_line = decoder.next_out_of_line();
4126 let handles_before = decoder.remaining_handles();
4127 if let Some((inlined, num_bytes, num_handles)) =
4128 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4129 {
4130 let member_inline_size =
4131 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4132 if inlined != (member_inline_size <= 4) {
4133 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4134 }
4135 let inner_offset;
4136 let mut inner_depth = depth.clone();
4137 if inlined {
4138 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4139 inner_offset = next_offset;
4140 } else {
4141 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4142 inner_depth.increment()?;
4143 }
4144 let val_ref = self.trace_flow_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
4145 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4146 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4147 {
4148 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4149 }
4150 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4151 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4152 }
4153 }
4154
4155 next_offset += envelope_size;
4156
4157 while next_offset < end_offset {
4159 _next_ordinal_to_read += 1;
4160 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4161 next_offset += envelope_size;
4162 }
4163
4164 Ok(())
4165 }
4166 }
4167
4168 impl TouchPointerSample {
4169 #[inline(always)]
4170 fn max_ordinal_present(&self) -> u64 {
4171 if let Some(_) = self.position_in_viewport {
4172 return 3;
4173 }
4174 if let Some(_) = self.phase {
4175 return 2;
4176 }
4177 if let Some(_) = self.interaction {
4178 return 1;
4179 }
4180 0
4181 }
4182 }
4183
4184 impl fidl::encoding::ValueTypeMarker for TouchPointerSample {
4185 type Borrowed<'a> = &'a Self;
4186 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4187 value
4188 }
4189 }
4190
4191 unsafe impl fidl::encoding::TypeMarker for TouchPointerSample {
4192 type Owned = Self;
4193
4194 #[inline(always)]
4195 fn inline_align(_context: fidl::encoding::Context) -> usize {
4196 8
4197 }
4198
4199 #[inline(always)]
4200 fn inline_size(_context: fidl::encoding::Context) -> usize {
4201 16
4202 }
4203 }
4204
4205 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchPointerSample, D>
4206 for &TouchPointerSample
4207 {
4208 unsafe fn encode(
4209 self,
4210 encoder: &mut fidl::encoding::Encoder<'_, D>,
4211 offset: usize,
4212 mut depth: fidl::encoding::Depth,
4213 ) -> fidl::Result<()> {
4214 encoder.debug_check_bounds::<TouchPointerSample>(offset);
4215 let max_ordinal: u64 = self.max_ordinal_present();
4217 encoder.write_num(max_ordinal, offset);
4218 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4219 if max_ordinal == 0 {
4221 return Ok(());
4222 }
4223 depth.increment()?;
4224 let envelope_size = 8;
4225 let bytes_len = max_ordinal as usize * envelope_size;
4226 #[allow(unused_variables)]
4227 let offset = encoder.out_of_line_offset(bytes_len);
4228 let mut _prev_end_offset: usize = 0;
4229 if 1 > max_ordinal {
4230 return Ok(());
4231 }
4232
4233 let cur_offset: usize = (1 - 1) * envelope_size;
4236
4237 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4239
4240 fidl::encoding::encode_in_envelope_optional::<TouchInteractionId, D>(
4245 self.interaction
4246 .as_ref()
4247 .map(<TouchInteractionId as fidl::encoding::ValueTypeMarker>::borrow),
4248 encoder,
4249 offset + cur_offset,
4250 depth,
4251 )?;
4252
4253 _prev_end_offset = cur_offset + envelope_size;
4254 if 2 > max_ordinal {
4255 return Ok(());
4256 }
4257
4258 let cur_offset: usize = (2 - 1) * envelope_size;
4261
4262 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4264
4265 fidl::encoding::encode_in_envelope_optional::<EventPhase, D>(
4270 self.phase.as_ref().map(<EventPhase as fidl::encoding::ValueTypeMarker>::borrow),
4271 encoder,
4272 offset + cur_offset,
4273 depth,
4274 )?;
4275
4276 _prev_end_offset = cur_offset + envelope_size;
4277 if 3 > max_ordinal {
4278 return Ok(());
4279 }
4280
4281 let cur_offset: usize = (3 - 1) * envelope_size;
4284
4285 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4287
4288 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<f32, 2>, D>(
4293 self.position_in_viewport.as_ref().map(
4294 <fidl::encoding::Array<f32, 2> as fidl::encoding::ValueTypeMarker>::borrow,
4295 ),
4296 encoder,
4297 offset + cur_offset,
4298 depth,
4299 )?;
4300
4301 _prev_end_offset = cur_offset + envelope_size;
4302
4303 Ok(())
4304 }
4305 }
4306
4307 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchPointerSample {
4308 #[inline(always)]
4309 fn new_empty() -> Self {
4310 Self::default()
4311 }
4312
4313 unsafe fn decode(
4314 &mut self,
4315 decoder: &mut fidl::encoding::Decoder<'_, D>,
4316 offset: usize,
4317 mut depth: fidl::encoding::Depth,
4318 ) -> fidl::Result<()> {
4319 decoder.debug_check_bounds::<Self>(offset);
4320 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4321 None => return Err(fidl::Error::NotNullable),
4322 Some(len) => len,
4323 };
4324 if len == 0 {
4326 return Ok(());
4327 };
4328 depth.increment()?;
4329 let envelope_size = 8;
4330 let bytes_len = len * envelope_size;
4331 let offset = decoder.out_of_line_offset(bytes_len)?;
4332 let mut _next_ordinal_to_read = 0;
4334 let mut next_offset = offset;
4335 let end_offset = offset + bytes_len;
4336 _next_ordinal_to_read += 1;
4337 if next_offset >= end_offset {
4338 return Ok(());
4339 }
4340
4341 while _next_ordinal_to_read < 1 {
4343 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4344 _next_ordinal_to_read += 1;
4345 next_offset += envelope_size;
4346 }
4347
4348 let next_out_of_line = decoder.next_out_of_line();
4349 let handles_before = decoder.remaining_handles();
4350 if let Some((inlined, num_bytes, num_handles)) =
4351 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4352 {
4353 let member_inline_size =
4354 <TouchInteractionId as fidl::encoding::TypeMarker>::inline_size(
4355 decoder.context,
4356 );
4357 if inlined != (member_inline_size <= 4) {
4358 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4359 }
4360 let inner_offset;
4361 let mut inner_depth = depth.clone();
4362 if inlined {
4363 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4364 inner_offset = next_offset;
4365 } else {
4366 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4367 inner_depth.increment()?;
4368 }
4369 let val_ref =
4370 self.interaction.get_or_insert_with(|| fidl::new_empty!(TouchInteractionId, D));
4371 fidl::decode!(TouchInteractionId, D, val_ref, decoder, inner_offset, inner_depth)?;
4372 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4373 {
4374 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4375 }
4376 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4377 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4378 }
4379 }
4380
4381 next_offset += envelope_size;
4382 _next_ordinal_to_read += 1;
4383 if next_offset >= end_offset {
4384 return Ok(());
4385 }
4386
4387 while _next_ordinal_to_read < 2 {
4389 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4390 _next_ordinal_to_read += 1;
4391 next_offset += envelope_size;
4392 }
4393
4394 let next_out_of_line = decoder.next_out_of_line();
4395 let handles_before = decoder.remaining_handles();
4396 if let Some((inlined, num_bytes, num_handles)) =
4397 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4398 {
4399 let member_inline_size =
4400 <EventPhase as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4401 if inlined != (member_inline_size <= 4) {
4402 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4403 }
4404 let inner_offset;
4405 let mut inner_depth = depth.clone();
4406 if inlined {
4407 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4408 inner_offset = next_offset;
4409 } else {
4410 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4411 inner_depth.increment()?;
4412 }
4413 let val_ref = self.phase.get_or_insert_with(|| fidl::new_empty!(EventPhase, D));
4414 fidl::decode!(EventPhase, D, val_ref, decoder, inner_offset, inner_depth)?;
4415 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4416 {
4417 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4418 }
4419 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4420 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4421 }
4422 }
4423
4424 next_offset += envelope_size;
4425 _next_ordinal_to_read += 1;
4426 if next_offset >= end_offset {
4427 return Ok(());
4428 }
4429
4430 while _next_ordinal_to_read < 3 {
4432 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4433 _next_ordinal_to_read += 1;
4434 next_offset += envelope_size;
4435 }
4436
4437 let next_out_of_line = decoder.next_out_of_line();
4438 let handles_before = decoder.remaining_handles();
4439 if let Some((inlined, num_bytes, num_handles)) =
4440 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4441 {
4442 let member_inline_size =
4443 <fidl::encoding::Array<f32, 2> as fidl::encoding::TypeMarker>::inline_size(
4444 decoder.context,
4445 );
4446 if inlined != (member_inline_size <= 4) {
4447 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4448 }
4449 let inner_offset;
4450 let mut inner_depth = depth.clone();
4451 if inlined {
4452 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4453 inner_offset = next_offset;
4454 } else {
4455 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4456 inner_depth.increment()?;
4457 }
4458 let val_ref = self
4459 .position_in_viewport
4460 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<f32, 2>, D));
4461 fidl::decode!(fidl::encoding::Array<f32, 2>, D, val_ref, decoder, inner_offset, inner_depth)?;
4462 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4463 {
4464 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4465 }
4466 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4467 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4468 }
4469 }
4470
4471 next_offset += envelope_size;
4472
4473 while next_offset < end_offset {
4475 _next_ordinal_to_read += 1;
4476 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4477 next_offset += envelope_size;
4478 }
4479
4480 Ok(())
4481 }
4482 }
4483
4484 impl TouchResponse {
4485 #[inline(always)]
4486 fn max_ordinal_present(&self) -> u64 {
4487 if let Some(_) = self.trace_flow_id {
4488 return 2;
4489 }
4490 if let Some(_) = self.response_type {
4491 return 1;
4492 }
4493 0
4494 }
4495 }
4496
4497 impl fidl::encoding::ValueTypeMarker for TouchResponse {
4498 type Borrowed<'a> = &'a Self;
4499 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4500 value
4501 }
4502 }
4503
4504 unsafe impl fidl::encoding::TypeMarker for TouchResponse {
4505 type Owned = Self;
4506
4507 #[inline(always)]
4508 fn inline_align(_context: fidl::encoding::Context) -> usize {
4509 8
4510 }
4511
4512 #[inline(always)]
4513 fn inline_size(_context: fidl::encoding::Context) -> usize {
4514 16
4515 }
4516 }
4517
4518 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchResponse, D>
4519 for &TouchResponse
4520 {
4521 unsafe fn encode(
4522 self,
4523 encoder: &mut fidl::encoding::Encoder<'_, D>,
4524 offset: usize,
4525 mut depth: fidl::encoding::Depth,
4526 ) -> fidl::Result<()> {
4527 encoder.debug_check_bounds::<TouchResponse>(offset);
4528 let max_ordinal: u64 = self.max_ordinal_present();
4530 encoder.write_num(max_ordinal, offset);
4531 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4532 if max_ordinal == 0 {
4534 return Ok(());
4535 }
4536 depth.increment()?;
4537 let envelope_size = 8;
4538 let bytes_len = max_ordinal as usize * envelope_size;
4539 #[allow(unused_variables)]
4540 let offset = encoder.out_of_line_offset(bytes_len);
4541 let mut _prev_end_offset: usize = 0;
4542 if 1 > max_ordinal {
4543 return Ok(());
4544 }
4545
4546 let cur_offset: usize = (1 - 1) * envelope_size;
4549
4550 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4552
4553 fidl::encoding::encode_in_envelope_optional::<TouchResponseType, D>(
4558 self.response_type
4559 .as_ref()
4560 .map(<TouchResponseType as fidl::encoding::ValueTypeMarker>::borrow),
4561 encoder,
4562 offset + cur_offset,
4563 depth,
4564 )?;
4565
4566 _prev_end_offset = cur_offset + envelope_size;
4567 if 2 > max_ordinal {
4568 return Ok(());
4569 }
4570
4571 let cur_offset: usize = (2 - 1) * envelope_size;
4574
4575 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4577
4578 fidl::encoding::encode_in_envelope_optional::<u64, D>(
4583 self.trace_flow_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4584 encoder,
4585 offset + cur_offset,
4586 depth,
4587 )?;
4588
4589 _prev_end_offset = cur_offset + envelope_size;
4590
4591 Ok(())
4592 }
4593 }
4594
4595 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchResponse {
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 <TouchResponseType 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
4656 .response_type
4657 .get_or_insert_with(|| fidl::new_empty!(TouchResponseType, D));
4658 fidl::decode!(TouchResponseType, D, val_ref, decoder, inner_offset, inner_depth)?;
4659 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4660 {
4661 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4662 }
4663 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4664 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4665 }
4666 }
4667
4668 next_offset += envelope_size;
4669 _next_ordinal_to_read += 1;
4670 if next_offset >= end_offset {
4671 return Ok(());
4672 }
4673
4674 while _next_ordinal_to_read < 2 {
4676 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4677 _next_ordinal_to_read += 1;
4678 next_offset += envelope_size;
4679 }
4680
4681 let next_out_of_line = decoder.next_out_of_line();
4682 let handles_before = decoder.remaining_handles();
4683 if let Some((inlined, num_bytes, num_handles)) =
4684 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4685 {
4686 let member_inline_size =
4687 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4688 if inlined != (member_inline_size <= 4) {
4689 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4690 }
4691 let inner_offset;
4692 let mut inner_depth = depth.clone();
4693 if inlined {
4694 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4695 inner_offset = next_offset;
4696 } else {
4697 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4698 inner_depth.increment()?;
4699 }
4700 let val_ref = self.trace_flow_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
4701 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4702 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4703 {
4704 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4705 }
4706 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4707 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4708 }
4709 }
4710
4711 next_offset += envelope_size;
4712
4713 while next_offset < end_offset {
4715 _next_ordinal_to_read += 1;
4716 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4717 next_offset += envelope_size;
4718 }
4719
4720 Ok(())
4721 }
4722 }
4723}