1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const CONSUMER_CONTROL_MAX_NUM_BUTTONS: u32 = 255;
14
15pub const KEYBOARD_MAX_NUM_KEYS: u32 = 256;
18
19pub const KEYBOARD_MAX_NUM_LEDS: u32 = 256;
20
21pub const KEYBOARD_MAX_PRESSED_KEYS: u32 = 256;
22
23pub const MAX_DEVICE_REPORT_COUNT: u32 = 50;
24
25pub const MAX_REPORT_COUNT: u32 = 255;
28
29pub const MOUSE_MAX_NUM_BUTTONS: u32 = 32;
32
33pub const SENSOR_MAX_VALUES: u32 = 100;
36
37pub const TOUCH_MAX_CONTACTS: u32 = 10;
40
41pub const TOUCH_MAX_NUM_BUTTONS: u32 = 10;
42
43#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46pub enum ConsumerControlButton {
47 VolumeUp,
49 VolumeDown,
51 Pause,
53 FactoryReset,
55 MicMute,
57 Reboot,
59 CameraDisable,
61 Function,
63 Power,
65 #[doc(hidden)]
66 __SourceBreaking { unknown_ordinal: u32 },
67}
68
69#[macro_export]
71macro_rules! ConsumerControlButtonUnknown {
72 () => {
73 _
74 };
75}
76
77impl ConsumerControlButton {
78 #[inline]
79 pub fn from_primitive(prim: u32) -> Option<Self> {
80 match prim {
81 1 => Some(Self::VolumeUp),
82 2 => Some(Self::VolumeDown),
83 3 => Some(Self::Pause),
84 4 => Some(Self::FactoryReset),
85 5 => Some(Self::MicMute),
86 6 => Some(Self::Reboot),
87 7 => Some(Self::CameraDisable),
88 8 => Some(Self::Function),
89 9 => Some(Self::Power),
90 _ => None,
91 }
92 }
93
94 #[inline]
95 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96 match prim {
97 1 => Self::VolumeUp,
98 2 => Self::VolumeDown,
99 3 => Self::Pause,
100 4 => Self::FactoryReset,
101 5 => Self::MicMute,
102 6 => Self::Reboot,
103 7 => Self::CameraDisable,
104 8 => Self::Function,
105 9 => Self::Power,
106 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107 }
108 }
109
110 #[inline]
111 pub fn unknown() -> Self {
112 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113 }
114
115 #[inline]
116 pub const fn into_primitive(self) -> u32 {
117 match self {
118 Self::VolumeUp => 1,
119 Self::VolumeDown => 2,
120 Self::Pause => 3,
121 Self::FactoryReset => 4,
122 Self::MicMute => 5,
123 Self::Reboot => 6,
124 Self::CameraDisable => 7,
125 Self::Function => 8,
126 Self::Power => 9,
127 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128 }
129 }
130
131 #[inline]
132 pub fn is_unknown(&self) -> bool {
133 match self {
134 Self::__SourceBreaking { unknown_ordinal: _ } => true,
135 _ => false,
136 }
137 }
138}
139
140#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
142pub enum DeviceType {
143 Mouse,
144 Sensor,
145 Touch,
146 Keyboard,
147 ConsumerControl,
148 #[doc(hidden)]
149 __SourceBreaking {
150 unknown_ordinal: u32,
151 },
152}
153
154#[macro_export]
156macro_rules! DeviceTypeUnknown {
157 () => {
158 _
159 };
160}
161
162impl DeviceType {
163 #[inline]
164 pub fn from_primitive(prim: u32) -> Option<Self> {
165 match prim {
166 0 => Some(Self::Mouse),
167 1 => Some(Self::Sensor),
168 2 => Some(Self::Touch),
169 3 => Some(Self::Keyboard),
170 4 => Some(Self::ConsumerControl),
171 _ => None,
172 }
173 }
174
175 #[inline]
176 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
177 match prim {
178 0 => Self::Mouse,
179 1 => Self::Sensor,
180 2 => Self::Touch,
181 3 => Self::Keyboard,
182 4 => Self::ConsumerControl,
183 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
184 }
185 }
186
187 #[inline]
188 pub fn unknown() -> Self {
189 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
190 }
191
192 #[inline]
193 pub const fn into_primitive(self) -> u32 {
194 match self {
195 Self::Mouse => 0,
196 Self::Sensor => 1,
197 Self::Touch => 2,
198 Self::Keyboard => 3,
199 Self::ConsumerControl => 4,
200 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
201 }
202 }
203
204 #[inline]
205 pub fn is_unknown(&self) -> bool {
206 match self {
207 Self::__SourceBreaking { unknown_ordinal: _ } => true,
208 _ => false,
209 }
210 }
211}
212
213#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
218pub enum LedType {
219 NumLock,
222 CapsLock,
225 ScrollLock,
228 Compose,
231 Kana,
234 #[doc(hidden)]
235 __SourceBreaking { unknown_ordinal: u32 },
236}
237
238#[macro_export]
240macro_rules! LedTypeUnknown {
241 () => {
242 _
243 };
244}
245
246impl LedType {
247 #[inline]
248 pub fn from_primitive(prim: u32) -> Option<Self> {
249 match prim {
250 1 => Some(Self::NumLock),
251 2 => Some(Self::CapsLock),
252 3 => Some(Self::ScrollLock),
253 4 => Some(Self::Compose),
254 5 => Some(Self::Kana),
255 _ => None,
256 }
257 }
258
259 #[inline]
260 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
261 match prim {
262 1 => Self::NumLock,
263 2 => Self::CapsLock,
264 3 => Self::ScrollLock,
265 4 => Self::Compose,
266 5 => Self::Kana,
267 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
268 }
269 }
270
271 #[inline]
272 pub fn unknown() -> Self {
273 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
274 }
275
276 #[inline]
277 pub const fn into_primitive(self) -> u32 {
278 match self {
279 Self::NumLock => 1,
280 Self::CapsLock => 2,
281 Self::ScrollLock => 3,
282 Self::Compose => 4,
283 Self::Kana => 5,
284 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
285 }
286 }
287
288 #[inline]
289 pub fn is_unknown(&self) -> bool {
290 match self {
291 Self::__SourceBreaking { unknown_ordinal: _ } => true,
292 _ => false,
293 }
294 }
295}
296
297#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
299pub enum SensorReportingState {
300 ReportNoEvents,
302 ReportAllEvents,
305 ReportThresholdEvents,
307 #[doc(hidden)]
308 __SourceBreaking { unknown_ordinal: u32 },
309}
310
311#[macro_export]
313macro_rules! SensorReportingStateUnknown {
314 () => {
315 _
316 };
317}
318
319impl SensorReportingState {
320 #[inline]
321 pub fn from_primitive(prim: u32) -> Option<Self> {
322 match prim {
323 1 => Some(Self::ReportNoEvents),
324 2 => Some(Self::ReportAllEvents),
325 3 => Some(Self::ReportThresholdEvents),
326 _ => None,
327 }
328 }
329
330 #[inline]
331 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
332 match prim {
333 1 => Self::ReportNoEvents,
334 2 => Self::ReportAllEvents,
335 3 => Self::ReportThresholdEvents,
336 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
337 }
338 }
339
340 #[inline]
341 pub fn unknown() -> Self {
342 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
343 }
344
345 #[inline]
346 pub const fn into_primitive(self) -> u32 {
347 match self {
348 Self::ReportNoEvents => 1,
349 Self::ReportAllEvents => 2,
350 Self::ReportThresholdEvents => 3,
351 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
352 }
353 }
354
355 #[inline]
356 pub fn is_unknown(&self) -> bool {
357 match self {
358 Self::__SourceBreaking { unknown_ordinal: _ } => true,
359 _ => false,
360 }
361 }
362}
363
364#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
367pub enum SensorType {
368 AccelerometerX,
370 AccelerometerY,
372 AccelerometerZ,
374 MagnetometerX,
376 MagnetometerY,
378 MagnetometerZ,
380 GyroscopeX,
382 GyroscopeY,
384 GyroscopeZ,
386 LightIlluminance,
388 LightRed,
390 LightGreen,
392 LightBlue,
394 #[doc(hidden)]
395 __SourceBreaking { unknown_ordinal: u32 },
396}
397
398#[macro_export]
400macro_rules! SensorTypeUnknown {
401 () => {
402 _
403 };
404}
405
406impl SensorType {
407 #[inline]
408 pub fn from_primitive(prim: u32) -> Option<Self> {
409 match prim {
410 1 => Some(Self::AccelerometerX),
411 2 => Some(Self::AccelerometerY),
412 3 => Some(Self::AccelerometerZ),
413 4 => Some(Self::MagnetometerX),
414 5 => Some(Self::MagnetometerY),
415 6 => Some(Self::MagnetometerZ),
416 7 => Some(Self::GyroscopeX),
417 8 => Some(Self::GyroscopeY),
418 9 => Some(Self::GyroscopeZ),
419 10 => Some(Self::LightIlluminance),
420 11 => Some(Self::LightRed),
421 12 => Some(Self::LightGreen),
422 13 => Some(Self::LightBlue),
423 _ => None,
424 }
425 }
426
427 #[inline]
428 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
429 match prim {
430 1 => Self::AccelerometerX,
431 2 => Self::AccelerometerY,
432 3 => Self::AccelerometerZ,
433 4 => Self::MagnetometerX,
434 5 => Self::MagnetometerY,
435 6 => Self::MagnetometerZ,
436 7 => Self::GyroscopeX,
437 8 => Self::GyroscopeY,
438 9 => Self::GyroscopeZ,
439 10 => Self::LightIlluminance,
440 11 => Self::LightRed,
441 12 => Self::LightGreen,
442 13 => Self::LightBlue,
443 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
444 }
445 }
446
447 #[inline]
448 pub fn unknown() -> Self {
449 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
450 }
451
452 #[inline]
453 pub const fn into_primitive(self) -> u32 {
454 match self {
455 Self::AccelerometerX => 1,
456 Self::AccelerometerY => 2,
457 Self::AccelerometerZ => 3,
458 Self::MagnetometerX => 4,
459 Self::MagnetometerY => 5,
460 Self::MagnetometerZ => 6,
461 Self::GyroscopeX => 7,
462 Self::GyroscopeY => 8,
463 Self::GyroscopeZ => 9,
464 Self::LightIlluminance => 10,
465 Self::LightRed => 11,
466 Self::LightGreen => 12,
467 Self::LightBlue => 13,
468 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
469 }
470 }
471
472 #[inline]
473 pub fn is_unknown(&self) -> bool {
474 match self {
475 Self::__SourceBreaking { unknown_ordinal: _ } => true,
476 _ => false,
477 }
478 }
479}
480
481#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
485pub enum TouchConfigurationInputMode {
486 MouseCollection,
488 WindowsPrecisionTouchpadCollection,
493 #[doc(hidden)]
494 __SourceBreaking { unknown_ordinal: u32 },
495}
496
497#[macro_export]
499macro_rules! TouchConfigurationInputModeUnknown {
500 () => {
501 _
502 };
503}
504
505impl TouchConfigurationInputMode {
506 #[inline]
507 pub fn from_primitive(prim: u32) -> Option<Self> {
508 match prim {
509 0 => Some(Self::MouseCollection),
510 3 => Some(Self::WindowsPrecisionTouchpadCollection),
511 _ => None,
512 }
513 }
514
515 #[inline]
516 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
517 match prim {
518 0 => Self::MouseCollection,
519 3 => Self::WindowsPrecisionTouchpadCollection,
520 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
521 }
522 }
523
524 #[inline]
525 pub fn unknown() -> Self {
526 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
527 }
528
529 #[inline]
530 pub const fn into_primitive(self) -> u32 {
531 match self {
532 Self::MouseCollection => 0,
533 Self::WindowsPrecisionTouchpadCollection => 3,
534 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
535 }
536 }
537
538 #[inline]
539 pub fn is_unknown(&self) -> bool {
540 match self {
541 Self::__SourceBreaking { unknown_ordinal: _ } => true,
542 _ => false,
543 }
544 }
545}
546
547#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
549pub enum TouchType {
550 Touchscreen,
552 Touchpad,
554 #[doc(hidden)]
555 __SourceBreaking { unknown_ordinal: u32 },
556}
557
558#[macro_export]
560macro_rules! TouchTypeUnknown {
561 () => {
562 _
563 };
564}
565
566impl TouchType {
567 #[inline]
568 pub fn from_primitive(prim: u32) -> Option<Self> {
569 match prim {
570 1 => Some(Self::Touchscreen),
571 2 => Some(Self::Touchpad),
572 _ => None,
573 }
574 }
575
576 #[inline]
577 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
578 match prim {
579 1 => Self::Touchscreen,
580 2 => Self::Touchpad,
581 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
582 }
583 }
584
585 #[inline]
586 pub fn unknown() -> Self {
587 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
588 }
589
590 #[inline]
591 pub const fn into_primitive(self) -> u32 {
592 match self {
593 Self::Touchscreen => 1,
594 Self::Touchpad => 2,
595 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
596 }
597 }
598
599 #[inline]
600 pub fn is_unknown(&self) -> bool {
601 match self {
602 Self::__SourceBreaking { unknown_ordinal: _ } => true,
603 _ => false,
604 }
605 }
606}
607
608#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
615pub enum UnitType {
616 None,
618 Other,
620 Meters,
622 Grams,
624 Degrees,
626 EnglishAngularVelocity,
628 SiLinearVelocity,
630 SiLinearAcceleration,
632 Webers,
634 Candelas,
636 Pascals,
638 Lux,
639 Seconds,
640 #[doc(hidden)]
641 __SourceBreaking {
642 unknown_ordinal: u32,
643 },
644}
645
646#[macro_export]
648macro_rules! UnitTypeUnknown {
649 () => {
650 _
651 };
652}
653
654impl UnitType {
655 #[inline]
656 pub fn from_primitive(prim: u32) -> Option<Self> {
657 match prim {
658 0 => Some(Self::None),
659 1 => Some(Self::Other),
660 2 => Some(Self::Meters),
661 3 => Some(Self::Grams),
662 4 => Some(Self::Degrees),
663 5 => Some(Self::EnglishAngularVelocity),
664 6 => Some(Self::SiLinearVelocity),
665 7 => Some(Self::SiLinearAcceleration),
666 8 => Some(Self::Webers),
667 9 => Some(Self::Candelas),
668 10 => Some(Self::Pascals),
669 11 => Some(Self::Lux),
670 12 => Some(Self::Seconds),
671 _ => None,
672 }
673 }
674
675 #[inline]
676 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
677 match prim {
678 0 => Self::None,
679 1 => Self::Other,
680 2 => Self::Meters,
681 3 => Self::Grams,
682 4 => Self::Degrees,
683 5 => Self::EnglishAngularVelocity,
684 6 => Self::SiLinearVelocity,
685 7 => Self::SiLinearAcceleration,
686 8 => Self::Webers,
687 9 => Self::Candelas,
688 10 => Self::Pascals,
689 11 => Self::Lux,
690 12 => Self::Seconds,
691 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
692 }
693 }
694
695 #[inline]
696 pub fn unknown() -> Self {
697 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
698 }
699
700 #[inline]
701 pub const fn into_primitive(self) -> u32 {
702 match self {
703 Self::None => 0,
704 Self::Other => 1,
705 Self::Meters => 2,
706 Self::Grams => 3,
707 Self::Degrees => 4,
708 Self::EnglishAngularVelocity => 5,
709 Self::SiLinearVelocity => 6,
710 Self::SiLinearAcceleration => 7,
711 Self::Webers => 8,
712 Self::Candelas => 9,
713 Self::Pascals => 10,
714 Self::Lux => 11,
715 Self::Seconds => 12,
716 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
717 }
718 }
719
720 #[inline]
721 pub fn is_unknown(&self) -> bool {
722 match self {
723 Self::__SourceBreaking { unknown_ordinal: _ } => true,
724 _ => false,
725 }
726 }
727}
728
729#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
734pub enum VendorGoogleProductId {
735 FocaltechTouchscreen,
737 AmsLightSensor,
738 PcPs2Keyboard,
739 PcPs2Mouse,
740 AdcButtons,
741 GoodixTouchscreen,
742 HidButtons,
743 VirtioMouse,
744 VirtioKeyboard,
745 VirtioTouchscreen,
746 GoldfishAccelerationSensor,
747 GoldfishGyroscopeSensor,
748 GoldfishRgbcLightSensor,
749 #[doc(hidden)]
750 __SourceBreaking {
751 unknown_ordinal: u32,
752 },
753}
754
755#[macro_export]
757macro_rules! VendorGoogleProductIdUnknown {
758 () => {
759 _
760 };
761}
762
763impl VendorGoogleProductId {
764 #[inline]
765 pub fn from_primitive(prim: u32) -> Option<Self> {
766 match prim {
767 65537 => Some(Self::FocaltechTouchscreen),
768 65538 => Some(Self::AmsLightSensor),
769 65539 => Some(Self::PcPs2Keyboard),
770 65540 => Some(Self::PcPs2Mouse),
771 65541 => Some(Self::AdcButtons),
772 65542 => Some(Self::GoodixTouchscreen),
773 65543 => Some(Self::HidButtons),
774 65544 => Some(Self::VirtioMouse),
775 65545 => Some(Self::VirtioKeyboard),
776 65546 => Some(Self::VirtioTouchscreen),
777 2417819649 => Some(Self::GoldfishAccelerationSensor),
778 2417819650 => Some(Self::GoldfishGyroscopeSensor),
779 2417819651 => Some(Self::GoldfishRgbcLightSensor),
780 _ => None,
781 }
782 }
783
784 #[inline]
785 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
786 match prim {
787 65537 => Self::FocaltechTouchscreen,
788 65538 => Self::AmsLightSensor,
789 65539 => Self::PcPs2Keyboard,
790 65540 => Self::PcPs2Mouse,
791 65541 => Self::AdcButtons,
792 65542 => Self::GoodixTouchscreen,
793 65543 => Self::HidButtons,
794 65544 => Self::VirtioMouse,
795 65545 => Self::VirtioKeyboard,
796 65546 => Self::VirtioTouchscreen,
797 2417819649 => Self::GoldfishAccelerationSensor,
798 2417819650 => Self::GoldfishGyroscopeSensor,
799 2417819651 => Self::GoldfishRgbcLightSensor,
800 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
801 }
802 }
803
804 #[inline]
805 pub fn unknown() -> Self {
806 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
807 }
808
809 #[inline]
810 pub const fn into_primitive(self) -> u32 {
811 match self {
812 Self::FocaltechTouchscreen => 65537,
813 Self::AmsLightSensor => 65538,
814 Self::PcPs2Keyboard => 65539,
815 Self::PcPs2Mouse => 65540,
816 Self::AdcButtons => 65541,
817 Self::GoodixTouchscreen => 65542,
818 Self::HidButtons => 65543,
819 Self::VirtioMouse => 65544,
820 Self::VirtioKeyboard => 65545,
821 Self::VirtioTouchscreen => 65546,
822 Self::GoldfishAccelerationSensor => 2417819649,
823 Self::GoldfishGyroscopeSensor => 2417819650,
824 Self::GoldfishRgbcLightSensor => 2417819651,
825 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
826 }
827 }
828
829 #[inline]
830 pub fn is_unknown(&self) -> bool {
831 match self {
832 Self::__SourceBreaking { unknown_ordinal: _ } => true,
833 _ => false,
834 }
835 }
836}
837
838#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
843pub enum VendorId {
844 Google,
846 #[doc(hidden)]
847 __SourceBreaking { unknown_ordinal: u32 },
848}
849
850#[macro_export]
852macro_rules! VendorIdUnknown {
853 () => {
854 _
855 };
856}
857
858impl VendorId {
859 #[inline]
860 pub fn from_primitive(prim: u32) -> Option<Self> {
861 match prim {
862 6353 => Some(Self::Google),
863 _ => None,
864 }
865 }
866
867 #[inline]
868 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
869 match prim {
870 6353 => Self::Google,
871 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
872 }
873 }
874
875 #[inline]
876 pub fn unknown() -> Self {
877 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
878 }
879
880 #[inline]
881 pub const fn into_primitive(self) -> u32 {
882 match self {
883 Self::Google => 6353,
884 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
885 }
886 }
887
888 #[inline]
889 pub fn is_unknown(&self) -> bool {
890 match self {
891 Self::__SourceBreaking { unknown_ordinal: _ } => true,
892 _ => false,
893 }
894 }
895}
896
897#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
899pub struct Axis {
900 pub range: Range,
901 pub unit: Unit,
902}
903
904impl fidl::Persistable for Axis {}
905
906#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
913#[repr(C)]
914pub struct DeviceInfo {
915 pub vendor_id: u32,
916 pub product_id: u32,
917 pub version: u32,
918}
919
920impl fidl::Persistable for DeviceInfo {}
921
922#[derive(Clone, Debug, PartialEq)]
923pub struct InputDeviceGetDescriptorResponse {
924 pub descriptor: DeviceDescriptor,
925}
926
927impl fidl::Persistable for InputDeviceGetDescriptorResponse {}
928
929#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
930pub struct InputDeviceGetInputReportRequest {
931 pub device_type: DeviceType,
932}
933
934impl fidl::Persistable for InputDeviceGetInputReportRequest {}
935
936#[derive(Clone, Debug, PartialEq)]
937pub struct InputDeviceSendOutputReportRequest {
938 pub report: OutputReport,
939}
940
941impl fidl::Persistable for InputDeviceSendOutputReportRequest {}
942
943#[derive(Clone, Debug, PartialEq)]
944pub struct InputDeviceSetFeatureReportRequest {
945 pub report: FeatureReport,
946}
947
948impl fidl::Persistable for InputDeviceSetFeatureReportRequest {}
949
950#[derive(Clone, Debug, PartialEq)]
951pub struct InputDeviceGetFeatureReportResponse {
952 pub report: FeatureReport,
953}
954
955impl fidl::Persistable for InputDeviceGetFeatureReportResponse {}
956
957#[derive(Clone, Debug, PartialEq)]
958pub struct InputDeviceGetInputReportResponse {
959 pub report: InputReport,
960}
961
962impl fidl::Persistable for InputDeviceGetInputReportResponse {}
963
964#[derive(Clone, Debug, PartialEq)]
965pub struct InputReportsReaderReadInputReportsResponse {
966 pub reports: Vec<InputReport>,
967}
968
969impl fidl::Persistable for InputReportsReaderReadInputReportsResponse {}
970
971#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
973#[repr(C)]
974pub struct Range {
975 pub min: i64,
976 pub max: i64,
977}
978
979impl fidl::Persistable for Range {}
980
981#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
984pub struct SensorAxis {
985 pub axis: Axis,
986 pub type_: SensorType,
987}
988
989impl fidl::Persistable for SensorAxis {}
990
991#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
994pub struct Unit {
995 pub type_: UnitType,
996 pub exponent: i32,
997}
998
999impl fidl::Persistable for Unit {}
1000
1001#[derive(Clone, Debug, Default, PartialEq)]
1005pub struct ConsumerControlDescriptor {
1006 pub input: Option<ConsumerControlInputDescriptor>,
1007 #[doc(hidden)]
1008 pub __source_breaking: fidl::marker::SourceBreaking,
1009}
1010
1011impl fidl::Persistable for ConsumerControlDescriptor {}
1012
1013#[derive(Clone, Debug, Default, PartialEq)]
1016pub struct ConsumerControlInputDescriptor {
1017 pub buttons: Option<Vec<ConsumerControlButton>>,
1019 #[doc(hidden)]
1020 pub __source_breaking: fidl::marker::SourceBreaking,
1021}
1022
1023impl fidl::Persistable for ConsumerControlInputDescriptor {}
1024
1025#[derive(Clone, Debug, Default, PartialEq)]
1027pub struct ConsumerControlInputReport {
1028 pub pressed_buttons: Option<Vec<ConsumerControlButton>>,
1030 #[doc(hidden)]
1031 pub __source_breaking: fidl::marker::SourceBreaking,
1032}
1033
1034impl fidl::Persistable for ConsumerControlInputReport {}
1035
1036#[derive(Clone, Debug, Default, PartialEq)]
1038pub struct ContactInputDescriptor {
1039 pub position_x: Option<Axis>,
1041 pub position_y: Option<Axis>,
1043 pub pressure: Option<Axis>,
1045 pub contact_width: Option<Axis>,
1047 pub contact_height: Option<Axis>,
1049 #[doc(hidden)]
1050 pub __source_breaking: fidl::marker::SourceBreaking,
1051}
1052
1053impl fidl::Persistable for ContactInputDescriptor {}
1054
1055#[derive(Clone, Debug, Default, PartialEq)]
1057pub struct ContactInputReport {
1058 pub contact_id: Option<u32>,
1060 pub position_x: Option<i64>,
1062 pub position_y: Option<i64>,
1064 pub pressure: Option<i64>,
1066 pub contact_width: Option<i64>,
1071 pub contact_height: Option<i64>,
1076 pub confidence: Option<bool>,
1081 #[doc(hidden)]
1082 pub __source_breaking: fidl::marker::SourceBreaking,
1083}
1084
1085impl fidl::Persistable for ContactInputReport {}
1086
1087#[derive(Clone, Debug, Default, PartialEq)]
1091pub struct DeviceDescriptor {
1092 pub device_info: Option<DeviceInfo>,
1094 pub mouse: Option<MouseDescriptor>,
1096 pub sensor: Option<SensorDescriptor>,
1098 pub touch: Option<TouchDescriptor>,
1101 pub keyboard: Option<KeyboardDescriptor>,
1103 pub consumer_control: Option<ConsumerControlDescriptor>,
1106 pub device_information: Option<DeviceInformation>,
1109 #[doc(hidden)]
1110 pub __source_breaking: fidl::marker::SourceBreaking,
1111}
1112
1113impl fidl::Persistable for DeviceDescriptor {}
1114
1115#[derive(Clone, Debug, Default, PartialEq)]
1122pub struct DeviceInformation {
1123 pub vendor_id: Option<u32>,
1124 pub product_id: Option<u32>,
1125 pub version: Option<u32>,
1126 pub polling_rate: Option<i64>,
1127 #[doc(hidden)]
1128 pub __source_breaking: fidl::marker::SourceBreaking,
1129}
1130
1131impl fidl::Persistable for DeviceInformation {}
1132
1133#[derive(Clone, Debug, Default, PartialEq)]
1138pub struct FeatureReport {
1139 pub sensor: Option<SensorFeatureReport>,
1140 pub touch: Option<TouchFeatureReport>,
1141 #[doc(hidden)]
1142 pub __source_breaking: fidl::marker::SourceBreaking,
1143}
1144
1145impl fidl::Persistable for FeatureReport {}
1146
1147#[derive(Clone, Debug, Default, PartialEq)]
1149pub struct InputReport {
1150 pub event_time: Option<i64>,
1152 pub mouse: Option<MouseInputReport>,
1154 pub trace_id: Option<u64>,
1156 pub sensor: Option<SensorInputReport>,
1158 pub touch: Option<TouchInputReport>,
1160 pub keyboard: Option<KeyboardInputReport>,
1162 pub consumer_control: Option<ConsumerControlInputReport>,
1165 pub report_id: Option<u8>,
1168 #[doc(hidden)]
1169 pub __source_breaking: fidl::marker::SourceBreaking,
1170}
1171
1172impl fidl::Persistable for InputReport {}
1173
1174#[derive(Clone, Debug, Default, PartialEq)]
1176pub struct KeyboardDescriptor {
1177 pub input: Option<KeyboardInputDescriptor>,
1178 pub output: Option<KeyboardOutputDescriptor>,
1179 #[doc(hidden)]
1180 pub __source_breaking: fidl::marker::SourceBreaking,
1181}
1182
1183impl fidl::Persistable for KeyboardDescriptor {}
1184
1185#[derive(Clone, Debug, Default, PartialEq)]
1188pub struct KeyboardInputDescriptor {
1189 pub keys3: Option<Vec<fidl_fuchsia_input::Key>>,
1191 #[doc(hidden)]
1192 pub __source_breaking: fidl::marker::SourceBreaking,
1193}
1194
1195impl fidl::Persistable for KeyboardInputDescriptor {}
1196
1197#[derive(Clone, Debug, Default, PartialEq)]
1199pub struct KeyboardInputReport {
1200 pub pressed_keys3: Option<Vec<fidl_fuchsia_input::Key>>,
1202 #[doc(hidden)]
1203 pub __source_breaking: fidl::marker::SourceBreaking,
1204}
1205
1206impl fidl::Persistable for KeyboardInputReport {}
1207
1208#[derive(Clone, Debug, Default, PartialEq)]
1210pub struct KeyboardOutputDescriptor {
1211 pub leds: Option<Vec<LedType>>,
1213 #[doc(hidden)]
1214 pub __source_breaking: fidl::marker::SourceBreaking,
1215}
1216
1217impl fidl::Persistable for KeyboardOutputDescriptor {}
1218
1219#[derive(Clone, Debug, Default, PartialEq)]
1221pub struct KeyboardOutputReport {
1222 pub enabled_leds: Option<Vec<LedType>>,
1225 #[doc(hidden)]
1226 pub __source_breaking: fidl::marker::SourceBreaking,
1227}
1228
1229impl fidl::Persistable for KeyboardOutputReport {}
1230
1231#[derive(Clone, Debug, Default, PartialEq)]
1233pub struct MouseDescriptor {
1234 pub input: Option<MouseInputDescriptor>,
1235 #[doc(hidden)]
1236 pub __source_breaking: fidl::marker::SourceBreaking,
1237}
1238
1239impl fidl::Persistable for MouseDescriptor {}
1240
1241#[derive(Clone, Debug, Default, PartialEq)]
1244pub struct MouseInputDescriptor {
1245 pub movement_x: Option<Axis>,
1247 pub movement_y: Option<Axis>,
1249 pub scroll_v: Option<Axis>,
1251 pub scroll_h: Option<Axis>,
1253 pub buttons: Option<Vec<u8>>,
1255 pub position_x: Option<Axis>,
1258 pub position_y: Option<Axis>,
1261 #[doc(hidden)]
1262 pub __source_breaking: fidl::marker::SourceBreaking,
1263}
1264
1265impl fidl::Persistable for MouseInputDescriptor {}
1266
1267#[derive(Clone, Debug, Default, PartialEq)]
1272pub struct MouseInputReport {
1273 pub movement_x: Option<i64>,
1275 pub movement_y: Option<i64>,
1277 pub scroll_v: Option<i64>,
1279 pub scroll_h: Option<i64>,
1281 pub pressed_buttons: Option<Vec<u8>>,
1283 pub position_x: Option<i64>,
1286 pub position_y: Option<i64>,
1289 #[doc(hidden)]
1290 pub __source_breaking: fidl::marker::SourceBreaking,
1291}
1292
1293impl fidl::Persistable for MouseInputReport {}
1294
1295#[derive(Clone, Debug, Default, PartialEq)]
1299pub struct OutputDescriptor {
1300 pub keyboard: Option<KeyboardOutputDescriptor>,
1301 #[doc(hidden)]
1302 pub __source_breaking: fidl::marker::SourceBreaking,
1303}
1304
1305impl fidl::Persistable for OutputDescriptor {}
1306
1307#[derive(Clone, Debug, Default, PartialEq)]
1311pub struct OutputReport {
1312 pub keyboard: Option<KeyboardOutputReport>,
1313 #[doc(hidden)]
1314 pub __source_breaking: fidl::marker::SourceBreaking,
1315}
1316
1317impl fidl::Persistable for OutputReport {}
1318
1319#[derive(Clone, Debug, Default, PartialEq)]
1321pub struct SelectiveReportingFeatureReport {
1322 pub surface_switch: Option<bool>,
1324 pub button_switch: Option<bool>,
1326 #[doc(hidden)]
1327 pub __source_breaking: fidl::marker::SourceBreaking,
1328}
1329
1330impl fidl::Persistable for SelectiveReportingFeatureReport {}
1331
1332#[derive(Clone, Debug, Default, PartialEq)]
1334pub struct SensorDescriptor {
1335 pub input: Option<Vec<SensorInputDescriptor>>,
1336 pub feature: Option<Vec<SensorFeatureDescriptor>>,
1337 #[doc(hidden)]
1338 pub __source_breaking: fidl::marker::SourceBreaking,
1339}
1340
1341impl fidl::Persistable for SensorDescriptor {}
1342
1343#[derive(Clone, Debug, Default, PartialEq)]
1346pub struct SensorFeatureDescriptor {
1347 pub report_interval: Option<Axis>,
1350 pub sensitivity: Option<Vec<SensorAxis>>,
1352 pub supports_reporting_state: Option<bool>,
1355 pub threshold_high: Option<Vec<SensorAxis>>,
1357 pub threshold_low: Option<Vec<SensorAxis>>,
1359 pub sampling_rate: Option<Axis>,
1361 pub report_id: Option<u8>,
1364 #[doc(hidden)]
1365 pub __source_breaking: fidl::marker::SourceBreaking,
1366}
1367
1368impl fidl::Persistable for SensorFeatureDescriptor {}
1369
1370#[derive(Clone, Debug, Default, PartialEq)]
1375pub struct SensorFeatureReport {
1376 pub report_interval: Option<i64>,
1378 pub sensitivity: Option<Vec<i64>>,
1381 pub reporting_state: Option<SensorReportingState>,
1383 pub threshold_high: Option<Vec<i64>>,
1386 pub threshold_low: Option<Vec<i64>>,
1389 pub sampling_rate: Option<i64>,
1391 #[doc(hidden)]
1392 pub __source_breaking: fidl::marker::SourceBreaking,
1393}
1394
1395impl fidl::Persistable for SensorFeatureReport {}
1396
1397#[derive(Clone, Debug, Default, PartialEq)]
1400pub struct SensorInputDescriptor {
1401 pub values: Option<Vec<SensorAxis>>,
1404 pub report_id: Option<u8>,
1407 #[doc(hidden)]
1408 pub __source_breaking: fidl::marker::SourceBreaking,
1409}
1410
1411impl fidl::Persistable for SensorInputDescriptor {}
1412
1413#[derive(Clone, Debug, Default, PartialEq)]
1415pub struct SensorInputReport {
1416 pub values: Option<Vec<i64>>,
1419 #[doc(hidden)]
1420 pub __source_breaking: fidl::marker::SourceBreaking,
1421}
1422
1423impl fidl::Persistable for SensorInputReport {}
1424
1425#[derive(Clone, Debug, Default, PartialEq)]
1427pub struct TouchDescriptor {
1428 pub input: Option<TouchInputDescriptor>,
1429 pub feature: Option<TouchFeatureDescriptor>,
1430 #[doc(hidden)]
1431 pub __source_breaking: fidl::marker::SourceBreaking,
1432}
1433
1434impl fidl::Persistable for TouchDescriptor {}
1435
1436#[derive(Clone, Debug, Default, PartialEq)]
1439pub struct TouchFeatureDescriptor {
1440 pub supports_input_mode: Option<bool>,
1442 pub supports_selective_reporting: Option<bool>,
1444 #[doc(hidden)]
1445 pub __source_breaking: fidl::marker::SourceBreaking,
1446}
1447
1448impl fidl::Persistable for TouchFeatureDescriptor {}
1449
1450#[derive(Clone, Debug, Default, PartialEq)]
1455pub struct TouchFeatureReport {
1456 pub input_mode: Option<TouchConfigurationInputMode>,
1458 pub selective_reporting: Option<SelectiveReportingFeatureReport>,
1460 #[doc(hidden)]
1461 pub __source_breaking: fidl::marker::SourceBreaking,
1462}
1463
1464impl fidl::Persistable for TouchFeatureReport {}
1465
1466#[derive(Clone, Debug, Default, PartialEq)]
1469pub struct TouchInputDescriptor {
1470 pub contacts: Option<Vec<ContactInputDescriptor>>,
1472 pub max_contacts: Option<u32>,
1474 pub touch_type: Option<TouchType>,
1476 pub buttons: Option<Vec<u8>>,
1478 #[doc(hidden)]
1479 pub __source_breaking: fidl::marker::SourceBreaking,
1480}
1481
1482impl fidl::Persistable for TouchInputDescriptor {}
1483
1484#[derive(Clone, Debug, Default, PartialEq)]
1486pub struct TouchInputReport {
1487 pub contacts: Option<Vec<ContactInputReport>>,
1489 pub pressed_buttons: Option<Vec<u8>>,
1491 #[doc(hidden)]
1492 pub __source_breaking: fidl::marker::SourceBreaking,
1493}
1494
1495impl fidl::Persistable for TouchInputReport {}
1496
1497mod internal {
1498 use super::*;
1499 unsafe impl fidl::encoding::TypeMarker for ConsumerControlButton {
1500 type Owned = Self;
1501
1502 #[inline(always)]
1503 fn inline_align(_context: fidl::encoding::Context) -> usize {
1504 std::mem::align_of::<u32>()
1505 }
1506
1507 #[inline(always)]
1508 fn inline_size(_context: fidl::encoding::Context) -> usize {
1509 std::mem::size_of::<u32>()
1510 }
1511
1512 #[inline(always)]
1513 fn encode_is_copy() -> bool {
1514 false
1515 }
1516
1517 #[inline(always)]
1518 fn decode_is_copy() -> bool {
1519 false
1520 }
1521 }
1522
1523 impl fidl::encoding::ValueTypeMarker for ConsumerControlButton {
1524 type Borrowed<'a> = Self;
1525 #[inline(always)]
1526 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1527 *value
1528 }
1529 }
1530
1531 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1532 for ConsumerControlButton
1533 {
1534 #[inline]
1535 unsafe fn encode(
1536 self,
1537 encoder: &mut fidl::encoding::Encoder<'_, D>,
1538 offset: usize,
1539 _depth: fidl::encoding::Depth,
1540 ) -> fidl::Result<()> {
1541 encoder.debug_check_bounds::<Self>(offset);
1542 encoder.write_num(self.into_primitive(), offset);
1543 Ok(())
1544 }
1545 }
1546
1547 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsumerControlButton {
1548 #[inline(always)]
1549 fn new_empty() -> Self {
1550 Self::unknown()
1551 }
1552
1553 #[inline]
1554 unsafe fn decode(
1555 &mut self,
1556 decoder: &mut fidl::encoding::Decoder<'_, D>,
1557 offset: usize,
1558 _depth: fidl::encoding::Depth,
1559 ) -> fidl::Result<()> {
1560 decoder.debug_check_bounds::<Self>(offset);
1561 let prim = decoder.read_num::<u32>(offset);
1562
1563 *self = Self::from_primitive_allow_unknown(prim);
1564 Ok(())
1565 }
1566 }
1567 unsafe impl fidl::encoding::TypeMarker for DeviceType {
1568 type Owned = Self;
1569
1570 #[inline(always)]
1571 fn inline_align(_context: fidl::encoding::Context) -> usize {
1572 std::mem::align_of::<u32>()
1573 }
1574
1575 #[inline(always)]
1576 fn inline_size(_context: fidl::encoding::Context) -> usize {
1577 std::mem::size_of::<u32>()
1578 }
1579
1580 #[inline(always)]
1581 fn encode_is_copy() -> bool {
1582 false
1583 }
1584
1585 #[inline(always)]
1586 fn decode_is_copy() -> bool {
1587 false
1588 }
1589 }
1590
1591 impl fidl::encoding::ValueTypeMarker for DeviceType {
1592 type Borrowed<'a> = Self;
1593 #[inline(always)]
1594 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1595 *value
1596 }
1597 }
1598
1599 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for DeviceType {
1600 #[inline]
1601 unsafe fn encode(
1602 self,
1603 encoder: &mut fidl::encoding::Encoder<'_, D>,
1604 offset: usize,
1605 _depth: fidl::encoding::Depth,
1606 ) -> fidl::Result<()> {
1607 encoder.debug_check_bounds::<Self>(offset);
1608 encoder.write_num(self.into_primitive(), offset);
1609 Ok(())
1610 }
1611 }
1612
1613 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceType {
1614 #[inline(always)]
1615 fn new_empty() -> Self {
1616 Self::unknown()
1617 }
1618
1619 #[inline]
1620 unsafe fn decode(
1621 &mut self,
1622 decoder: &mut fidl::encoding::Decoder<'_, D>,
1623 offset: usize,
1624 _depth: fidl::encoding::Depth,
1625 ) -> fidl::Result<()> {
1626 decoder.debug_check_bounds::<Self>(offset);
1627 let prim = decoder.read_num::<u32>(offset);
1628
1629 *self = Self::from_primitive_allow_unknown(prim);
1630 Ok(())
1631 }
1632 }
1633 unsafe impl fidl::encoding::TypeMarker for LedType {
1634 type Owned = Self;
1635
1636 #[inline(always)]
1637 fn inline_align(_context: fidl::encoding::Context) -> usize {
1638 std::mem::align_of::<u32>()
1639 }
1640
1641 #[inline(always)]
1642 fn inline_size(_context: fidl::encoding::Context) -> usize {
1643 std::mem::size_of::<u32>()
1644 }
1645
1646 #[inline(always)]
1647 fn encode_is_copy() -> bool {
1648 false
1649 }
1650
1651 #[inline(always)]
1652 fn decode_is_copy() -> bool {
1653 false
1654 }
1655 }
1656
1657 impl fidl::encoding::ValueTypeMarker for LedType {
1658 type Borrowed<'a> = Self;
1659 #[inline(always)]
1660 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1661 *value
1662 }
1663 }
1664
1665 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LedType {
1666 #[inline]
1667 unsafe fn encode(
1668 self,
1669 encoder: &mut fidl::encoding::Encoder<'_, D>,
1670 offset: usize,
1671 _depth: fidl::encoding::Depth,
1672 ) -> fidl::Result<()> {
1673 encoder.debug_check_bounds::<Self>(offset);
1674 encoder.write_num(self.into_primitive(), offset);
1675 Ok(())
1676 }
1677 }
1678
1679 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LedType {
1680 #[inline(always)]
1681 fn new_empty() -> Self {
1682 Self::unknown()
1683 }
1684
1685 #[inline]
1686 unsafe fn decode(
1687 &mut self,
1688 decoder: &mut fidl::encoding::Decoder<'_, D>,
1689 offset: usize,
1690 _depth: fidl::encoding::Depth,
1691 ) -> fidl::Result<()> {
1692 decoder.debug_check_bounds::<Self>(offset);
1693 let prim = decoder.read_num::<u32>(offset);
1694
1695 *self = Self::from_primitive_allow_unknown(prim);
1696 Ok(())
1697 }
1698 }
1699 unsafe impl fidl::encoding::TypeMarker for SensorReportingState {
1700 type Owned = Self;
1701
1702 #[inline(always)]
1703 fn inline_align(_context: fidl::encoding::Context) -> usize {
1704 std::mem::align_of::<u32>()
1705 }
1706
1707 #[inline(always)]
1708 fn inline_size(_context: fidl::encoding::Context) -> usize {
1709 std::mem::size_of::<u32>()
1710 }
1711
1712 #[inline(always)]
1713 fn encode_is_copy() -> bool {
1714 false
1715 }
1716
1717 #[inline(always)]
1718 fn decode_is_copy() -> bool {
1719 false
1720 }
1721 }
1722
1723 impl fidl::encoding::ValueTypeMarker for SensorReportingState {
1724 type Borrowed<'a> = Self;
1725 #[inline(always)]
1726 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1727 *value
1728 }
1729 }
1730
1731 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1732 for SensorReportingState
1733 {
1734 #[inline]
1735 unsafe fn encode(
1736 self,
1737 encoder: &mut fidl::encoding::Encoder<'_, D>,
1738 offset: usize,
1739 _depth: fidl::encoding::Depth,
1740 ) -> fidl::Result<()> {
1741 encoder.debug_check_bounds::<Self>(offset);
1742 encoder.write_num(self.into_primitive(), offset);
1743 Ok(())
1744 }
1745 }
1746
1747 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReportingState {
1748 #[inline(always)]
1749 fn new_empty() -> Self {
1750 Self::unknown()
1751 }
1752
1753 #[inline]
1754 unsafe fn decode(
1755 &mut self,
1756 decoder: &mut fidl::encoding::Decoder<'_, D>,
1757 offset: usize,
1758 _depth: fidl::encoding::Depth,
1759 ) -> fidl::Result<()> {
1760 decoder.debug_check_bounds::<Self>(offset);
1761 let prim = decoder.read_num::<u32>(offset);
1762
1763 *self = Self::from_primitive_allow_unknown(prim);
1764 Ok(())
1765 }
1766 }
1767 unsafe impl fidl::encoding::TypeMarker for SensorType {
1768 type Owned = Self;
1769
1770 #[inline(always)]
1771 fn inline_align(_context: fidl::encoding::Context) -> usize {
1772 std::mem::align_of::<u32>()
1773 }
1774
1775 #[inline(always)]
1776 fn inline_size(_context: fidl::encoding::Context) -> usize {
1777 std::mem::size_of::<u32>()
1778 }
1779
1780 #[inline(always)]
1781 fn encode_is_copy() -> bool {
1782 false
1783 }
1784
1785 #[inline(always)]
1786 fn decode_is_copy() -> bool {
1787 false
1788 }
1789 }
1790
1791 impl fidl::encoding::ValueTypeMarker for SensorType {
1792 type Borrowed<'a> = Self;
1793 #[inline(always)]
1794 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1795 *value
1796 }
1797 }
1798
1799 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1800 #[inline]
1801 unsafe fn encode(
1802 self,
1803 encoder: &mut fidl::encoding::Encoder<'_, D>,
1804 offset: usize,
1805 _depth: fidl::encoding::Depth,
1806 ) -> fidl::Result<()> {
1807 encoder.debug_check_bounds::<Self>(offset);
1808 encoder.write_num(self.into_primitive(), offset);
1809 Ok(())
1810 }
1811 }
1812
1813 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1814 #[inline(always)]
1815 fn new_empty() -> Self {
1816 Self::unknown()
1817 }
1818
1819 #[inline]
1820 unsafe fn decode(
1821 &mut self,
1822 decoder: &mut fidl::encoding::Decoder<'_, D>,
1823 offset: usize,
1824 _depth: fidl::encoding::Depth,
1825 ) -> fidl::Result<()> {
1826 decoder.debug_check_bounds::<Self>(offset);
1827 let prim = decoder.read_num::<u32>(offset);
1828
1829 *self = Self::from_primitive_allow_unknown(prim);
1830 Ok(())
1831 }
1832 }
1833 unsafe impl fidl::encoding::TypeMarker for TouchConfigurationInputMode {
1834 type Owned = Self;
1835
1836 #[inline(always)]
1837 fn inline_align(_context: fidl::encoding::Context) -> usize {
1838 std::mem::align_of::<u32>()
1839 }
1840
1841 #[inline(always)]
1842 fn inline_size(_context: fidl::encoding::Context) -> usize {
1843 std::mem::size_of::<u32>()
1844 }
1845
1846 #[inline(always)]
1847 fn encode_is_copy() -> bool {
1848 false
1849 }
1850
1851 #[inline(always)]
1852 fn decode_is_copy() -> bool {
1853 false
1854 }
1855 }
1856
1857 impl fidl::encoding::ValueTypeMarker for TouchConfigurationInputMode {
1858 type Borrowed<'a> = Self;
1859 #[inline(always)]
1860 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1861 *value
1862 }
1863 }
1864
1865 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1866 for TouchConfigurationInputMode
1867 {
1868 #[inline]
1869 unsafe fn encode(
1870 self,
1871 encoder: &mut fidl::encoding::Encoder<'_, D>,
1872 offset: usize,
1873 _depth: fidl::encoding::Depth,
1874 ) -> fidl::Result<()> {
1875 encoder.debug_check_bounds::<Self>(offset);
1876 encoder.write_num(self.into_primitive(), offset);
1877 Ok(())
1878 }
1879 }
1880
1881 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1882 for TouchConfigurationInputMode
1883 {
1884 #[inline(always)]
1885 fn new_empty() -> Self {
1886 Self::unknown()
1887 }
1888
1889 #[inline]
1890 unsafe fn decode(
1891 &mut self,
1892 decoder: &mut fidl::encoding::Decoder<'_, D>,
1893 offset: usize,
1894 _depth: fidl::encoding::Depth,
1895 ) -> fidl::Result<()> {
1896 decoder.debug_check_bounds::<Self>(offset);
1897 let prim = decoder.read_num::<u32>(offset);
1898
1899 *self = Self::from_primitive_allow_unknown(prim);
1900 Ok(())
1901 }
1902 }
1903 unsafe impl fidl::encoding::TypeMarker for TouchType {
1904 type Owned = Self;
1905
1906 #[inline(always)]
1907 fn inline_align(_context: fidl::encoding::Context) -> usize {
1908 std::mem::align_of::<u32>()
1909 }
1910
1911 #[inline(always)]
1912 fn inline_size(_context: fidl::encoding::Context) -> usize {
1913 std::mem::size_of::<u32>()
1914 }
1915
1916 #[inline(always)]
1917 fn encode_is_copy() -> bool {
1918 false
1919 }
1920
1921 #[inline(always)]
1922 fn decode_is_copy() -> bool {
1923 false
1924 }
1925 }
1926
1927 impl fidl::encoding::ValueTypeMarker for TouchType {
1928 type Borrowed<'a> = Self;
1929 #[inline(always)]
1930 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1931 *value
1932 }
1933 }
1934
1935 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TouchType {
1936 #[inline]
1937 unsafe fn encode(
1938 self,
1939 encoder: &mut fidl::encoding::Encoder<'_, D>,
1940 offset: usize,
1941 _depth: fidl::encoding::Depth,
1942 ) -> fidl::Result<()> {
1943 encoder.debug_check_bounds::<Self>(offset);
1944 encoder.write_num(self.into_primitive(), offset);
1945 Ok(())
1946 }
1947 }
1948
1949 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchType {
1950 #[inline(always)]
1951 fn new_empty() -> Self {
1952 Self::unknown()
1953 }
1954
1955 #[inline]
1956 unsafe fn decode(
1957 &mut self,
1958 decoder: &mut fidl::encoding::Decoder<'_, D>,
1959 offset: usize,
1960 _depth: fidl::encoding::Depth,
1961 ) -> fidl::Result<()> {
1962 decoder.debug_check_bounds::<Self>(offset);
1963 let prim = decoder.read_num::<u32>(offset);
1964
1965 *self = Self::from_primitive_allow_unknown(prim);
1966 Ok(())
1967 }
1968 }
1969 unsafe impl fidl::encoding::TypeMarker for UnitType {
1970 type Owned = Self;
1971
1972 #[inline(always)]
1973 fn inline_align(_context: fidl::encoding::Context) -> usize {
1974 std::mem::align_of::<u32>()
1975 }
1976
1977 #[inline(always)]
1978 fn inline_size(_context: fidl::encoding::Context) -> usize {
1979 std::mem::size_of::<u32>()
1980 }
1981
1982 #[inline(always)]
1983 fn encode_is_copy() -> bool {
1984 false
1985 }
1986
1987 #[inline(always)]
1988 fn decode_is_copy() -> bool {
1989 false
1990 }
1991 }
1992
1993 impl fidl::encoding::ValueTypeMarker for UnitType {
1994 type Borrowed<'a> = Self;
1995 #[inline(always)]
1996 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1997 *value
1998 }
1999 }
2000
2001 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UnitType {
2002 #[inline]
2003 unsafe fn encode(
2004 self,
2005 encoder: &mut fidl::encoding::Encoder<'_, D>,
2006 offset: usize,
2007 _depth: fidl::encoding::Depth,
2008 ) -> fidl::Result<()> {
2009 encoder.debug_check_bounds::<Self>(offset);
2010 encoder.write_num(self.into_primitive(), offset);
2011 Ok(())
2012 }
2013 }
2014
2015 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnitType {
2016 #[inline(always)]
2017 fn new_empty() -> Self {
2018 Self::unknown()
2019 }
2020
2021 #[inline]
2022 unsafe fn decode(
2023 &mut self,
2024 decoder: &mut fidl::encoding::Decoder<'_, D>,
2025 offset: usize,
2026 _depth: fidl::encoding::Depth,
2027 ) -> fidl::Result<()> {
2028 decoder.debug_check_bounds::<Self>(offset);
2029 let prim = decoder.read_num::<u32>(offset);
2030
2031 *self = Self::from_primitive_allow_unknown(prim);
2032 Ok(())
2033 }
2034 }
2035 unsafe impl fidl::encoding::TypeMarker for VendorGoogleProductId {
2036 type Owned = Self;
2037
2038 #[inline(always)]
2039 fn inline_align(_context: fidl::encoding::Context) -> usize {
2040 std::mem::align_of::<u32>()
2041 }
2042
2043 #[inline(always)]
2044 fn inline_size(_context: fidl::encoding::Context) -> usize {
2045 std::mem::size_of::<u32>()
2046 }
2047
2048 #[inline(always)]
2049 fn encode_is_copy() -> bool {
2050 false
2051 }
2052
2053 #[inline(always)]
2054 fn decode_is_copy() -> bool {
2055 false
2056 }
2057 }
2058
2059 impl fidl::encoding::ValueTypeMarker for VendorGoogleProductId {
2060 type Borrowed<'a> = Self;
2061 #[inline(always)]
2062 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2063 *value
2064 }
2065 }
2066
2067 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2068 for VendorGoogleProductId
2069 {
2070 #[inline]
2071 unsafe fn encode(
2072 self,
2073 encoder: &mut fidl::encoding::Encoder<'_, D>,
2074 offset: usize,
2075 _depth: fidl::encoding::Depth,
2076 ) -> fidl::Result<()> {
2077 encoder.debug_check_bounds::<Self>(offset);
2078 encoder.write_num(self.into_primitive(), offset);
2079 Ok(())
2080 }
2081 }
2082
2083 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorGoogleProductId {
2084 #[inline(always)]
2085 fn new_empty() -> Self {
2086 Self::unknown()
2087 }
2088
2089 #[inline]
2090 unsafe fn decode(
2091 &mut self,
2092 decoder: &mut fidl::encoding::Decoder<'_, D>,
2093 offset: usize,
2094 _depth: fidl::encoding::Depth,
2095 ) -> fidl::Result<()> {
2096 decoder.debug_check_bounds::<Self>(offset);
2097 let prim = decoder.read_num::<u32>(offset);
2098
2099 *self = Self::from_primitive_allow_unknown(prim);
2100 Ok(())
2101 }
2102 }
2103 unsafe impl fidl::encoding::TypeMarker for VendorId {
2104 type Owned = Self;
2105
2106 #[inline(always)]
2107 fn inline_align(_context: fidl::encoding::Context) -> usize {
2108 std::mem::align_of::<u32>()
2109 }
2110
2111 #[inline(always)]
2112 fn inline_size(_context: fidl::encoding::Context) -> usize {
2113 std::mem::size_of::<u32>()
2114 }
2115
2116 #[inline(always)]
2117 fn encode_is_copy() -> bool {
2118 false
2119 }
2120
2121 #[inline(always)]
2122 fn decode_is_copy() -> bool {
2123 false
2124 }
2125 }
2126
2127 impl fidl::encoding::ValueTypeMarker for VendorId {
2128 type Borrowed<'a> = Self;
2129 #[inline(always)]
2130 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2131 *value
2132 }
2133 }
2134
2135 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for VendorId {
2136 #[inline]
2137 unsafe fn encode(
2138 self,
2139 encoder: &mut fidl::encoding::Encoder<'_, D>,
2140 offset: usize,
2141 _depth: fidl::encoding::Depth,
2142 ) -> fidl::Result<()> {
2143 encoder.debug_check_bounds::<Self>(offset);
2144 encoder.write_num(self.into_primitive(), offset);
2145 Ok(())
2146 }
2147 }
2148
2149 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VendorId {
2150 #[inline(always)]
2151 fn new_empty() -> Self {
2152 Self::unknown()
2153 }
2154
2155 #[inline]
2156 unsafe fn decode(
2157 &mut self,
2158 decoder: &mut fidl::encoding::Decoder<'_, D>,
2159 offset: usize,
2160 _depth: fidl::encoding::Depth,
2161 ) -> fidl::Result<()> {
2162 decoder.debug_check_bounds::<Self>(offset);
2163 let prim = decoder.read_num::<u32>(offset);
2164
2165 *self = Self::from_primitive_allow_unknown(prim);
2166 Ok(())
2167 }
2168 }
2169
2170 impl fidl::encoding::ValueTypeMarker for Axis {
2171 type Borrowed<'a> = &'a Self;
2172 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2173 value
2174 }
2175 }
2176
2177 unsafe impl fidl::encoding::TypeMarker for Axis {
2178 type Owned = Self;
2179
2180 #[inline(always)]
2181 fn inline_align(_context: fidl::encoding::Context) -> usize {
2182 8
2183 }
2184
2185 #[inline(always)]
2186 fn inline_size(_context: fidl::encoding::Context) -> usize {
2187 24
2188 }
2189 }
2190
2191 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
2192 #[inline]
2193 unsafe fn encode(
2194 self,
2195 encoder: &mut fidl::encoding::Encoder<'_, D>,
2196 offset: usize,
2197 _depth: fidl::encoding::Depth,
2198 ) -> fidl::Result<()> {
2199 encoder.debug_check_bounds::<Axis>(offset);
2200 fidl::encoding::Encode::<Axis, D>::encode(
2202 (
2203 <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
2204 <Unit as fidl::encoding::ValueTypeMarker>::borrow(&self.unit),
2205 ),
2206 encoder,
2207 offset,
2208 _depth,
2209 )
2210 }
2211 }
2212 unsafe impl<
2213 D: fidl::encoding::ResourceDialect,
2214 T0: fidl::encoding::Encode<Range, D>,
2215 T1: fidl::encoding::Encode<Unit, D>,
2216 > fidl::encoding::Encode<Axis, D> for (T0, T1)
2217 {
2218 #[inline]
2219 unsafe fn encode(
2220 self,
2221 encoder: &mut fidl::encoding::Encoder<'_, D>,
2222 offset: usize,
2223 depth: fidl::encoding::Depth,
2224 ) -> fidl::Result<()> {
2225 encoder.debug_check_bounds::<Axis>(offset);
2226 self.0.encode(encoder, offset + 0, depth)?;
2230 self.1.encode(encoder, offset + 16, depth)?;
2231 Ok(())
2232 }
2233 }
2234
2235 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
2236 #[inline(always)]
2237 fn new_empty() -> Self {
2238 Self { range: fidl::new_empty!(Range, D), unit: fidl::new_empty!(Unit, D) }
2239 }
2240
2241 #[inline]
2242 unsafe fn decode(
2243 &mut self,
2244 decoder: &mut fidl::encoding::Decoder<'_, D>,
2245 offset: usize,
2246 _depth: fidl::encoding::Depth,
2247 ) -> fidl::Result<()> {
2248 decoder.debug_check_bounds::<Self>(offset);
2249 fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
2251 fidl::decode!(Unit, D, &mut self.unit, decoder, offset + 16, _depth)?;
2252 Ok(())
2253 }
2254 }
2255
2256 impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2257 type Borrowed<'a> = &'a Self;
2258 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2259 value
2260 }
2261 }
2262
2263 unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2264 type Owned = Self;
2265
2266 #[inline(always)]
2267 fn inline_align(_context: fidl::encoding::Context) -> usize {
2268 4
2269 }
2270
2271 #[inline(always)]
2272 fn inline_size(_context: fidl::encoding::Context) -> usize {
2273 12
2274 }
2275 #[inline(always)]
2276 fn encode_is_copy() -> bool {
2277 true
2278 }
2279
2280 #[inline(always)]
2281 fn decode_is_copy() -> bool {
2282 true
2283 }
2284 }
2285
2286 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2287 for &DeviceInfo
2288 {
2289 #[inline]
2290 unsafe fn encode(
2291 self,
2292 encoder: &mut fidl::encoding::Encoder<'_, D>,
2293 offset: usize,
2294 _depth: fidl::encoding::Depth,
2295 ) -> fidl::Result<()> {
2296 encoder.debug_check_bounds::<DeviceInfo>(offset);
2297 unsafe {
2298 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2300 (buf_ptr as *mut DeviceInfo).write_unaligned((self as *const DeviceInfo).read());
2301 }
2304 Ok(())
2305 }
2306 }
2307 unsafe impl<
2308 D: fidl::encoding::ResourceDialect,
2309 T0: fidl::encoding::Encode<u32, D>,
2310 T1: fidl::encoding::Encode<u32, D>,
2311 T2: fidl::encoding::Encode<u32, D>,
2312 > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2)
2313 {
2314 #[inline]
2315 unsafe fn encode(
2316 self,
2317 encoder: &mut fidl::encoding::Encoder<'_, D>,
2318 offset: usize,
2319 depth: fidl::encoding::Depth,
2320 ) -> fidl::Result<()> {
2321 encoder.debug_check_bounds::<DeviceInfo>(offset);
2322 self.0.encode(encoder, offset + 0, depth)?;
2326 self.1.encode(encoder, offset + 4, depth)?;
2327 self.2.encode(encoder, offset + 8, depth)?;
2328 Ok(())
2329 }
2330 }
2331
2332 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2333 #[inline(always)]
2334 fn new_empty() -> Self {
2335 Self {
2336 vendor_id: fidl::new_empty!(u32, D),
2337 product_id: fidl::new_empty!(u32, D),
2338 version: fidl::new_empty!(u32, D),
2339 }
2340 }
2341
2342 #[inline]
2343 unsafe fn decode(
2344 &mut self,
2345 decoder: &mut fidl::encoding::Decoder<'_, D>,
2346 offset: usize,
2347 _depth: fidl::encoding::Depth,
2348 ) -> fidl::Result<()> {
2349 decoder.debug_check_bounds::<Self>(offset);
2350 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2351 unsafe {
2354 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2355 }
2356 Ok(())
2357 }
2358 }
2359
2360 impl fidl::encoding::ValueTypeMarker for InputDeviceGetDescriptorResponse {
2361 type Borrowed<'a> = &'a Self;
2362 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2363 value
2364 }
2365 }
2366
2367 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetDescriptorResponse {
2368 type Owned = Self;
2369
2370 #[inline(always)]
2371 fn inline_align(_context: fidl::encoding::Context) -> usize {
2372 8
2373 }
2374
2375 #[inline(always)]
2376 fn inline_size(_context: fidl::encoding::Context) -> usize {
2377 16
2378 }
2379 }
2380
2381 unsafe impl<D: fidl::encoding::ResourceDialect>
2382 fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D>
2383 for &InputDeviceGetDescriptorResponse
2384 {
2385 #[inline]
2386 unsafe fn encode(
2387 self,
2388 encoder: &mut fidl::encoding::Encoder<'_, D>,
2389 offset: usize,
2390 _depth: fidl::encoding::Depth,
2391 ) -> fidl::Result<()> {
2392 encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2393 fidl::encoding::Encode::<InputDeviceGetDescriptorResponse, D>::encode(
2395 (<DeviceDescriptor as fidl::encoding::ValueTypeMarker>::borrow(&self.descriptor),),
2396 encoder,
2397 offset,
2398 _depth,
2399 )
2400 }
2401 }
2402 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceDescriptor, D>>
2403 fidl::encoding::Encode<InputDeviceGetDescriptorResponse, D> for (T0,)
2404 {
2405 #[inline]
2406 unsafe fn encode(
2407 self,
2408 encoder: &mut fidl::encoding::Encoder<'_, D>,
2409 offset: usize,
2410 depth: fidl::encoding::Depth,
2411 ) -> fidl::Result<()> {
2412 encoder.debug_check_bounds::<InputDeviceGetDescriptorResponse>(offset);
2413 self.0.encode(encoder, offset + 0, depth)?;
2417 Ok(())
2418 }
2419 }
2420
2421 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2422 for InputDeviceGetDescriptorResponse
2423 {
2424 #[inline(always)]
2425 fn new_empty() -> Self {
2426 Self { descriptor: fidl::new_empty!(DeviceDescriptor, D) }
2427 }
2428
2429 #[inline]
2430 unsafe fn decode(
2431 &mut self,
2432 decoder: &mut fidl::encoding::Decoder<'_, D>,
2433 offset: usize,
2434 _depth: fidl::encoding::Depth,
2435 ) -> fidl::Result<()> {
2436 decoder.debug_check_bounds::<Self>(offset);
2437 fidl::decode!(DeviceDescriptor, D, &mut self.descriptor, decoder, offset + 0, _depth)?;
2439 Ok(())
2440 }
2441 }
2442
2443 impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportRequest {
2444 type Borrowed<'a> = &'a Self;
2445 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2446 value
2447 }
2448 }
2449
2450 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportRequest {
2451 type Owned = Self;
2452
2453 #[inline(always)]
2454 fn inline_align(_context: fidl::encoding::Context) -> usize {
2455 4
2456 }
2457
2458 #[inline(always)]
2459 fn inline_size(_context: fidl::encoding::Context) -> usize {
2460 4
2461 }
2462 }
2463
2464 unsafe impl<D: fidl::encoding::ResourceDialect>
2465 fidl::encoding::Encode<InputDeviceGetInputReportRequest, D>
2466 for &InputDeviceGetInputReportRequest
2467 {
2468 #[inline]
2469 unsafe fn encode(
2470 self,
2471 encoder: &mut fidl::encoding::Encoder<'_, D>,
2472 offset: usize,
2473 _depth: fidl::encoding::Depth,
2474 ) -> fidl::Result<()> {
2475 encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2476 fidl::encoding::Encode::<InputDeviceGetInputReportRequest, D>::encode(
2478 (<DeviceType as fidl::encoding::ValueTypeMarker>::borrow(&self.device_type),),
2479 encoder,
2480 offset,
2481 _depth,
2482 )
2483 }
2484 }
2485 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<DeviceType, D>>
2486 fidl::encoding::Encode<InputDeviceGetInputReportRequest, D> for (T0,)
2487 {
2488 #[inline]
2489 unsafe fn encode(
2490 self,
2491 encoder: &mut fidl::encoding::Encoder<'_, D>,
2492 offset: usize,
2493 depth: fidl::encoding::Depth,
2494 ) -> fidl::Result<()> {
2495 encoder.debug_check_bounds::<InputDeviceGetInputReportRequest>(offset);
2496 self.0.encode(encoder, offset + 0, depth)?;
2500 Ok(())
2501 }
2502 }
2503
2504 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2505 for InputDeviceGetInputReportRequest
2506 {
2507 #[inline(always)]
2508 fn new_empty() -> Self {
2509 Self { device_type: fidl::new_empty!(DeviceType, D) }
2510 }
2511
2512 #[inline]
2513 unsafe fn decode(
2514 &mut self,
2515 decoder: &mut fidl::encoding::Decoder<'_, D>,
2516 offset: usize,
2517 _depth: fidl::encoding::Depth,
2518 ) -> fidl::Result<()> {
2519 decoder.debug_check_bounds::<Self>(offset);
2520 fidl::decode!(DeviceType, D, &mut self.device_type, decoder, offset + 0, _depth)?;
2522 Ok(())
2523 }
2524 }
2525
2526 impl fidl::encoding::ValueTypeMarker for InputDeviceSendOutputReportRequest {
2527 type Borrowed<'a> = &'a Self;
2528 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2529 value
2530 }
2531 }
2532
2533 unsafe impl fidl::encoding::TypeMarker for InputDeviceSendOutputReportRequest {
2534 type Owned = Self;
2535
2536 #[inline(always)]
2537 fn inline_align(_context: fidl::encoding::Context) -> usize {
2538 8
2539 }
2540
2541 #[inline(always)]
2542 fn inline_size(_context: fidl::encoding::Context) -> usize {
2543 16
2544 }
2545 }
2546
2547 unsafe impl<D: fidl::encoding::ResourceDialect>
2548 fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D>
2549 for &InputDeviceSendOutputReportRequest
2550 {
2551 #[inline]
2552 unsafe fn encode(
2553 self,
2554 encoder: &mut fidl::encoding::Encoder<'_, D>,
2555 offset: usize,
2556 _depth: fidl::encoding::Depth,
2557 ) -> fidl::Result<()> {
2558 encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2559 fidl::encoding::Encode::<InputDeviceSendOutputReportRequest, D>::encode(
2561 (<OutputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2562 encoder,
2563 offset,
2564 _depth,
2565 )
2566 }
2567 }
2568 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OutputReport, D>>
2569 fidl::encoding::Encode<InputDeviceSendOutputReportRequest, D> for (T0,)
2570 {
2571 #[inline]
2572 unsafe fn encode(
2573 self,
2574 encoder: &mut fidl::encoding::Encoder<'_, D>,
2575 offset: usize,
2576 depth: fidl::encoding::Depth,
2577 ) -> fidl::Result<()> {
2578 encoder.debug_check_bounds::<InputDeviceSendOutputReportRequest>(offset);
2579 self.0.encode(encoder, offset + 0, depth)?;
2583 Ok(())
2584 }
2585 }
2586
2587 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2588 for InputDeviceSendOutputReportRequest
2589 {
2590 #[inline(always)]
2591 fn new_empty() -> Self {
2592 Self { report: fidl::new_empty!(OutputReport, D) }
2593 }
2594
2595 #[inline]
2596 unsafe fn decode(
2597 &mut self,
2598 decoder: &mut fidl::encoding::Decoder<'_, D>,
2599 offset: usize,
2600 _depth: fidl::encoding::Depth,
2601 ) -> fidl::Result<()> {
2602 decoder.debug_check_bounds::<Self>(offset);
2603 fidl::decode!(OutputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2605 Ok(())
2606 }
2607 }
2608
2609 impl fidl::encoding::ValueTypeMarker for InputDeviceSetFeatureReportRequest {
2610 type Borrowed<'a> = &'a Self;
2611 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2612 value
2613 }
2614 }
2615
2616 unsafe impl fidl::encoding::TypeMarker for InputDeviceSetFeatureReportRequest {
2617 type Owned = Self;
2618
2619 #[inline(always)]
2620 fn inline_align(_context: fidl::encoding::Context) -> usize {
2621 8
2622 }
2623
2624 #[inline(always)]
2625 fn inline_size(_context: fidl::encoding::Context) -> usize {
2626 16
2627 }
2628 }
2629
2630 unsafe impl<D: fidl::encoding::ResourceDialect>
2631 fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D>
2632 for &InputDeviceSetFeatureReportRequest
2633 {
2634 #[inline]
2635 unsafe fn encode(
2636 self,
2637 encoder: &mut fidl::encoding::Encoder<'_, D>,
2638 offset: usize,
2639 _depth: fidl::encoding::Depth,
2640 ) -> fidl::Result<()> {
2641 encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2642 fidl::encoding::Encode::<InputDeviceSetFeatureReportRequest, D>::encode(
2644 (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2645 encoder,
2646 offset,
2647 _depth,
2648 )
2649 }
2650 }
2651 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2652 fidl::encoding::Encode<InputDeviceSetFeatureReportRequest, D> for (T0,)
2653 {
2654 #[inline]
2655 unsafe fn encode(
2656 self,
2657 encoder: &mut fidl::encoding::Encoder<'_, D>,
2658 offset: usize,
2659 depth: fidl::encoding::Depth,
2660 ) -> fidl::Result<()> {
2661 encoder.debug_check_bounds::<InputDeviceSetFeatureReportRequest>(offset);
2662 self.0.encode(encoder, offset + 0, depth)?;
2666 Ok(())
2667 }
2668 }
2669
2670 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2671 for InputDeviceSetFeatureReportRequest
2672 {
2673 #[inline(always)]
2674 fn new_empty() -> Self {
2675 Self { report: fidl::new_empty!(FeatureReport, D) }
2676 }
2677
2678 #[inline]
2679 unsafe fn decode(
2680 &mut self,
2681 decoder: &mut fidl::encoding::Decoder<'_, D>,
2682 offset: usize,
2683 _depth: fidl::encoding::Depth,
2684 ) -> fidl::Result<()> {
2685 decoder.debug_check_bounds::<Self>(offset);
2686 fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2688 Ok(())
2689 }
2690 }
2691
2692 impl fidl::encoding::ValueTypeMarker for InputDeviceGetFeatureReportResponse {
2693 type Borrowed<'a> = &'a Self;
2694 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2695 value
2696 }
2697 }
2698
2699 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetFeatureReportResponse {
2700 type Owned = Self;
2701
2702 #[inline(always)]
2703 fn inline_align(_context: fidl::encoding::Context) -> usize {
2704 8
2705 }
2706
2707 #[inline(always)]
2708 fn inline_size(_context: fidl::encoding::Context) -> usize {
2709 16
2710 }
2711 }
2712
2713 unsafe impl<D: fidl::encoding::ResourceDialect>
2714 fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D>
2715 for &InputDeviceGetFeatureReportResponse
2716 {
2717 #[inline]
2718 unsafe fn encode(
2719 self,
2720 encoder: &mut fidl::encoding::Encoder<'_, D>,
2721 offset: usize,
2722 _depth: fidl::encoding::Depth,
2723 ) -> fidl::Result<()> {
2724 encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2725 fidl::encoding::Encode::<InputDeviceGetFeatureReportResponse, D>::encode(
2727 (<FeatureReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2728 encoder,
2729 offset,
2730 _depth,
2731 )
2732 }
2733 }
2734 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<FeatureReport, D>>
2735 fidl::encoding::Encode<InputDeviceGetFeatureReportResponse, D> for (T0,)
2736 {
2737 #[inline]
2738 unsafe fn encode(
2739 self,
2740 encoder: &mut fidl::encoding::Encoder<'_, D>,
2741 offset: usize,
2742 depth: fidl::encoding::Depth,
2743 ) -> fidl::Result<()> {
2744 encoder.debug_check_bounds::<InputDeviceGetFeatureReportResponse>(offset);
2745 self.0.encode(encoder, offset + 0, depth)?;
2749 Ok(())
2750 }
2751 }
2752
2753 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2754 for InputDeviceGetFeatureReportResponse
2755 {
2756 #[inline(always)]
2757 fn new_empty() -> Self {
2758 Self { report: fidl::new_empty!(FeatureReport, D) }
2759 }
2760
2761 #[inline]
2762 unsafe fn decode(
2763 &mut self,
2764 decoder: &mut fidl::encoding::Decoder<'_, D>,
2765 offset: usize,
2766 _depth: fidl::encoding::Depth,
2767 ) -> fidl::Result<()> {
2768 decoder.debug_check_bounds::<Self>(offset);
2769 fidl::decode!(FeatureReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2771 Ok(())
2772 }
2773 }
2774
2775 impl fidl::encoding::ValueTypeMarker for InputDeviceGetInputReportResponse {
2776 type Borrowed<'a> = &'a Self;
2777 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2778 value
2779 }
2780 }
2781
2782 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2783 type Owned = Self;
2784
2785 #[inline(always)]
2786 fn inline_align(_context: fidl::encoding::Context) -> usize {
2787 8
2788 }
2789
2790 #[inline(always)]
2791 fn inline_size(_context: fidl::encoding::Context) -> usize {
2792 16
2793 }
2794 }
2795
2796 unsafe impl<D: fidl::encoding::ResourceDialect>
2797 fidl::encoding::Encode<InputDeviceGetInputReportResponse, D>
2798 for &InputDeviceGetInputReportResponse
2799 {
2800 #[inline]
2801 unsafe fn encode(
2802 self,
2803 encoder: &mut fidl::encoding::Encoder<'_, D>,
2804 offset: usize,
2805 _depth: fidl::encoding::Depth,
2806 ) -> fidl::Result<()> {
2807 encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2808 fidl::encoding::Encode::<InputDeviceGetInputReportResponse, D>::encode(
2810 (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2811 encoder,
2812 offset,
2813 _depth,
2814 )
2815 }
2816 }
2817 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2818 fidl::encoding::Encode<InputDeviceGetInputReportResponse, D> for (T0,)
2819 {
2820 #[inline]
2821 unsafe fn encode(
2822 self,
2823 encoder: &mut fidl::encoding::Encoder<'_, D>,
2824 offset: usize,
2825 depth: fidl::encoding::Depth,
2826 ) -> fidl::Result<()> {
2827 encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2828 self.0.encode(encoder, offset + 0, depth)?;
2832 Ok(())
2833 }
2834 }
2835
2836 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2837 for InputDeviceGetInputReportResponse
2838 {
2839 #[inline(always)]
2840 fn new_empty() -> Self {
2841 Self { report: fidl::new_empty!(InputReport, D) }
2842 }
2843
2844 #[inline]
2845 unsafe fn decode(
2846 &mut self,
2847 decoder: &mut fidl::encoding::Decoder<'_, D>,
2848 offset: usize,
2849 _depth: fidl::encoding::Depth,
2850 ) -> fidl::Result<()> {
2851 decoder.debug_check_bounds::<Self>(offset);
2852 fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2854 Ok(())
2855 }
2856 }
2857
2858 impl fidl::encoding::ValueTypeMarker for InputReportsReaderReadInputReportsResponse {
2859 type Borrowed<'a> = &'a Self;
2860 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2861 value
2862 }
2863 }
2864
2865 unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2866 type Owned = Self;
2867
2868 #[inline(always)]
2869 fn inline_align(_context: fidl::encoding::Context) -> usize {
2870 8
2871 }
2872
2873 #[inline(always)]
2874 fn inline_size(_context: fidl::encoding::Context) -> usize {
2875 16
2876 }
2877 }
2878
2879 unsafe impl<D: fidl::encoding::ResourceDialect>
2880 fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D>
2881 for &InputReportsReaderReadInputReportsResponse
2882 {
2883 #[inline]
2884 unsafe fn encode(
2885 self,
2886 encoder: &mut fidl::encoding::Encoder<'_, D>,
2887 offset: usize,
2888 _depth: fidl::encoding::Depth,
2889 ) -> fidl::Result<()> {
2890 encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2891 fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, D>::encode(
2893 (
2894 <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ValueTypeMarker>::borrow(&self.reports),
2895 ),
2896 encoder, offset, _depth
2897 )
2898 }
2899 }
2900 unsafe impl<
2901 D: fidl::encoding::ResourceDialect,
2902 T0: fidl::encoding::Encode<fidl::encoding::Vector<InputReport, 50>, D>,
2903 > fidl::encoding::Encode<InputReportsReaderReadInputReportsResponse, D> for (T0,)
2904 {
2905 #[inline]
2906 unsafe fn encode(
2907 self,
2908 encoder: &mut fidl::encoding::Encoder<'_, D>,
2909 offset: usize,
2910 depth: fidl::encoding::Depth,
2911 ) -> fidl::Result<()> {
2912 encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2913 self.0.encode(encoder, offset + 0, depth)?;
2917 Ok(())
2918 }
2919 }
2920
2921 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2922 for InputReportsReaderReadInputReportsResponse
2923 {
2924 #[inline(always)]
2925 fn new_empty() -> Self {
2926 Self { reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, D) }
2927 }
2928
2929 #[inline]
2930 unsafe fn decode(
2931 &mut self,
2932 decoder: &mut fidl::encoding::Decoder<'_, D>,
2933 offset: usize,
2934 _depth: fidl::encoding::Depth,
2935 ) -> fidl::Result<()> {
2936 decoder.debug_check_bounds::<Self>(offset);
2937 fidl::decode!(fidl::encoding::Vector<InputReport, 50>, D, &mut self.reports, decoder, offset + 0, _depth)?;
2939 Ok(())
2940 }
2941 }
2942
2943 impl fidl::encoding::ValueTypeMarker for Range {
2944 type Borrowed<'a> = &'a Self;
2945 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2946 value
2947 }
2948 }
2949
2950 unsafe impl fidl::encoding::TypeMarker for Range {
2951 type Owned = Self;
2952
2953 #[inline(always)]
2954 fn inline_align(_context: fidl::encoding::Context) -> usize {
2955 8
2956 }
2957
2958 #[inline(always)]
2959 fn inline_size(_context: fidl::encoding::Context) -> usize {
2960 16
2961 }
2962 #[inline(always)]
2963 fn encode_is_copy() -> bool {
2964 true
2965 }
2966
2967 #[inline(always)]
2968 fn decode_is_copy() -> bool {
2969 true
2970 }
2971 }
2972
2973 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
2974 #[inline]
2975 unsafe fn encode(
2976 self,
2977 encoder: &mut fidl::encoding::Encoder<'_, D>,
2978 offset: usize,
2979 _depth: fidl::encoding::Depth,
2980 ) -> fidl::Result<()> {
2981 encoder.debug_check_bounds::<Range>(offset);
2982 unsafe {
2983 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2985 (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
2986 }
2989 Ok(())
2990 }
2991 }
2992 unsafe impl<
2993 D: fidl::encoding::ResourceDialect,
2994 T0: fidl::encoding::Encode<i64, D>,
2995 T1: fidl::encoding::Encode<i64, D>,
2996 > fidl::encoding::Encode<Range, D> for (T0, T1)
2997 {
2998 #[inline]
2999 unsafe fn encode(
3000 self,
3001 encoder: &mut fidl::encoding::Encoder<'_, D>,
3002 offset: usize,
3003 depth: fidl::encoding::Depth,
3004 ) -> fidl::Result<()> {
3005 encoder.debug_check_bounds::<Range>(offset);
3006 self.0.encode(encoder, offset + 0, depth)?;
3010 self.1.encode(encoder, offset + 8, depth)?;
3011 Ok(())
3012 }
3013 }
3014
3015 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
3016 #[inline(always)]
3017 fn new_empty() -> Self {
3018 Self { min: fidl::new_empty!(i64, D), max: fidl::new_empty!(i64, D) }
3019 }
3020
3021 #[inline]
3022 unsafe fn decode(
3023 &mut self,
3024 decoder: &mut fidl::encoding::Decoder<'_, D>,
3025 offset: usize,
3026 _depth: fidl::encoding::Depth,
3027 ) -> fidl::Result<()> {
3028 decoder.debug_check_bounds::<Self>(offset);
3029 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3030 unsafe {
3033 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3034 }
3035 Ok(())
3036 }
3037 }
3038
3039 impl fidl::encoding::ValueTypeMarker for SensorAxis {
3040 type Borrowed<'a> = &'a Self;
3041 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3042 value
3043 }
3044 }
3045
3046 unsafe impl fidl::encoding::TypeMarker for SensorAxis {
3047 type Owned = Self;
3048
3049 #[inline(always)]
3050 fn inline_align(_context: fidl::encoding::Context) -> usize {
3051 8
3052 }
3053
3054 #[inline(always)]
3055 fn inline_size(_context: fidl::encoding::Context) -> usize {
3056 32
3057 }
3058 }
3059
3060 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorAxis, D>
3061 for &SensorAxis
3062 {
3063 #[inline]
3064 unsafe fn encode(
3065 self,
3066 encoder: &mut fidl::encoding::Encoder<'_, D>,
3067 offset: usize,
3068 _depth: fidl::encoding::Depth,
3069 ) -> fidl::Result<()> {
3070 encoder.debug_check_bounds::<SensorAxis>(offset);
3071 fidl::encoding::Encode::<SensorAxis, D>::encode(
3073 (
3074 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.axis),
3075 <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3076 ),
3077 encoder,
3078 offset,
3079 _depth,
3080 )
3081 }
3082 }
3083 unsafe impl<
3084 D: fidl::encoding::ResourceDialect,
3085 T0: fidl::encoding::Encode<Axis, D>,
3086 T1: fidl::encoding::Encode<SensorType, D>,
3087 > fidl::encoding::Encode<SensorAxis, D> for (T0, T1)
3088 {
3089 #[inline]
3090 unsafe fn encode(
3091 self,
3092 encoder: &mut fidl::encoding::Encoder<'_, D>,
3093 offset: usize,
3094 depth: fidl::encoding::Depth,
3095 ) -> fidl::Result<()> {
3096 encoder.debug_check_bounds::<SensorAxis>(offset);
3097 unsafe {
3100 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3101 (ptr as *mut u64).write_unaligned(0);
3102 }
3103 self.0.encode(encoder, offset + 0, depth)?;
3105 self.1.encode(encoder, offset + 24, depth)?;
3106 Ok(())
3107 }
3108 }
3109
3110 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorAxis {
3111 #[inline(always)]
3112 fn new_empty() -> Self {
3113 Self { axis: fidl::new_empty!(Axis, D), type_: fidl::new_empty!(SensorType, D) }
3114 }
3115
3116 #[inline]
3117 unsafe fn decode(
3118 &mut self,
3119 decoder: &mut fidl::encoding::Decoder<'_, D>,
3120 offset: usize,
3121 _depth: fidl::encoding::Depth,
3122 ) -> fidl::Result<()> {
3123 decoder.debug_check_bounds::<Self>(offset);
3124 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3126 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3127 let mask = 0xffffffff00000000u64;
3128 let maskedval = padval & mask;
3129 if maskedval != 0 {
3130 return Err(fidl::Error::NonZeroPadding {
3131 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3132 });
3133 }
3134 fidl::decode!(Axis, D, &mut self.axis, decoder, offset + 0, _depth)?;
3135 fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 24, _depth)?;
3136 Ok(())
3137 }
3138 }
3139
3140 impl fidl::encoding::ValueTypeMarker for Unit {
3141 type Borrowed<'a> = &'a Self;
3142 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3143 value
3144 }
3145 }
3146
3147 unsafe impl fidl::encoding::TypeMarker for Unit {
3148 type Owned = Self;
3149
3150 #[inline(always)]
3151 fn inline_align(_context: fidl::encoding::Context) -> usize {
3152 4
3153 }
3154
3155 #[inline(always)]
3156 fn inline_size(_context: fidl::encoding::Context) -> usize {
3157 8
3158 }
3159 }
3160
3161 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
3162 #[inline]
3163 unsafe fn encode(
3164 self,
3165 encoder: &mut fidl::encoding::Encoder<'_, D>,
3166 offset: usize,
3167 _depth: fidl::encoding::Depth,
3168 ) -> fidl::Result<()> {
3169 encoder.debug_check_bounds::<Unit>(offset);
3170 fidl::encoding::Encode::<Unit, D>::encode(
3172 (
3173 <UnitType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3174 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
3175 ),
3176 encoder,
3177 offset,
3178 _depth,
3179 )
3180 }
3181 }
3182 unsafe impl<
3183 D: fidl::encoding::ResourceDialect,
3184 T0: fidl::encoding::Encode<UnitType, D>,
3185 T1: fidl::encoding::Encode<i32, D>,
3186 > fidl::encoding::Encode<Unit, D> for (T0, T1)
3187 {
3188 #[inline]
3189 unsafe fn encode(
3190 self,
3191 encoder: &mut fidl::encoding::Encoder<'_, D>,
3192 offset: usize,
3193 depth: fidl::encoding::Depth,
3194 ) -> fidl::Result<()> {
3195 encoder.debug_check_bounds::<Unit>(offset);
3196 self.0.encode(encoder, offset + 0, depth)?;
3200 self.1.encode(encoder, offset + 4, depth)?;
3201 Ok(())
3202 }
3203 }
3204
3205 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
3206 #[inline(always)]
3207 fn new_empty() -> Self {
3208 Self { type_: fidl::new_empty!(UnitType, D), exponent: fidl::new_empty!(i32, D) }
3209 }
3210
3211 #[inline]
3212 unsafe fn decode(
3213 &mut self,
3214 decoder: &mut fidl::encoding::Decoder<'_, D>,
3215 offset: usize,
3216 _depth: fidl::encoding::Depth,
3217 ) -> fidl::Result<()> {
3218 decoder.debug_check_bounds::<Self>(offset);
3219 fidl::decode!(UnitType, D, &mut self.type_, decoder, offset + 0, _depth)?;
3221 fidl::decode!(i32, D, &mut self.exponent, decoder, offset + 4, _depth)?;
3222 Ok(())
3223 }
3224 }
3225
3226 impl ConsumerControlDescriptor {
3227 #[inline(always)]
3228 fn max_ordinal_present(&self) -> u64 {
3229 if let Some(_) = self.input {
3230 return 1;
3231 }
3232 0
3233 }
3234 }
3235
3236 impl fidl::encoding::ValueTypeMarker for ConsumerControlDescriptor {
3237 type Borrowed<'a> = &'a Self;
3238 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3239 value
3240 }
3241 }
3242
3243 unsafe impl fidl::encoding::TypeMarker for ConsumerControlDescriptor {
3244 type Owned = Self;
3245
3246 #[inline(always)]
3247 fn inline_align(_context: fidl::encoding::Context) -> usize {
3248 8
3249 }
3250
3251 #[inline(always)]
3252 fn inline_size(_context: fidl::encoding::Context) -> usize {
3253 16
3254 }
3255 }
3256
3257 unsafe impl<D: fidl::encoding::ResourceDialect>
3258 fidl::encoding::Encode<ConsumerControlDescriptor, D> for &ConsumerControlDescriptor
3259 {
3260 unsafe fn encode(
3261 self,
3262 encoder: &mut fidl::encoding::Encoder<'_, D>,
3263 offset: usize,
3264 mut depth: fidl::encoding::Depth,
3265 ) -> fidl::Result<()> {
3266 encoder.debug_check_bounds::<ConsumerControlDescriptor>(offset);
3267 let max_ordinal: u64 = self.max_ordinal_present();
3269 encoder.write_num(max_ordinal, offset);
3270 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3271 if max_ordinal == 0 {
3273 return Ok(());
3274 }
3275 depth.increment()?;
3276 let envelope_size = 8;
3277 let bytes_len = max_ordinal as usize * envelope_size;
3278 #[allow(unused_variables)]
3279 let offset = encoder.out_of_line_offset(bytes_len);
3280 let mut _prev_end_offset: usize = 0;
3281 if 1 > max_ordinal {
3282 return Ok(());
3283 }
3284
3285 let cur_offset: usize = (1 - 1) * envelope_size;
3288
3289 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3291
3292 fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputDescriptor, D>(
3297 self.input.as_ref().map(
3298 <ConsumerControlInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow,
3299 ),
3300 encoder,
3301 offset + cur_offset,
3302 depth,
3303 )?;
3304
3305 _prev_end_offset = cur_offset + envelope_size;
3306
3307 Ok(())
3308 }
3309 }
3310
3311 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3312 for ConsumerControlDescriptor
3313 {
3314 #[inline(always)]
3315 fn new_empty() -> Self {
3316 Self::default()
3317 }
3318
3319 unsafe fn decode(
3320 &mut self,
3321 decoder: &mut fidl::encoding::Decoder<'_, D>,
3322 offset: usize,
3323 mut depth: fidl::encoding::Depth,
3324 ) -> fidl::Result<()> {
3325 decoder.debug_check_bounds::<Self>(offset);
3326 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3327 None => return Err(fidl::Error::NotNullable),
3328 Some(len) => len,
3329 };
3330 if len == 0 {
3332 return Ok(());
3333 };
3334 depth.increment()?;
3335 let envelope_size = 8;
3336 let bytes_len = len * envelope_size;
3337 let offset = decoder.out_of_line_offset(bytes_len)?;
3338 let mut _next_ordinal_to_read = 0;
3340 let mut next_offset = offset;
3341 let end_offset = offset + bytes_len;
3342 _next_ordinal_to_read += 1;
3343 if next_offset >= end_offset {
3344 return Ok(());
3345 }
3346
3347 while _next_ordinal_to_read < 1 {
3349 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3350 _next_ordinal_to_read += 1;
3351 next_offset += envelope_size;
3352 }
3353
3354 let next_out_of_line = decoder.next_out_of_line();
3355 let handles_before = decoder.remaining_handles();
3356 if let Some((inlined, num_bytes, num_handles)) =
3357 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3358 {
3359 let member_inline_size =
3360 <ConsumerControlInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
3361 decoder.context,
3362 );
3363 if inlined != (member_inline_size <= 4) {
3364 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3365 }
3366 let inner_offset;
3367 let mut inner_depth = depth.clone();
3368 if inlined {
3369 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3370 inner_offset = next_offset;
3371 } else {
3372 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3373 inner_depth.increment()?;
3374 }
3375 let val_ref = self
3376 .input
3377 .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputDescriptor, D));
3378 fidl::decode!(
3379 ConsumerControlInputDescriptor,
3380 D,
3381 val_ref,
3382 decoder,
3383 inner_offset,
3384 inner_depth
3385 )?;
3386 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3387 {
3388 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3389 }
3390 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3391 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3392 }
3393 }
3394
3395 next_offset += envelope_size;
3396
3397 while next_offset < end_offset {
3399 _next_ordinal_to_read += 1;
3400 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3401 next_offset += envelope_size;
3402 }
3403
3404 Ok(())
3405 }
3406 }
3407
3408 impl ConsumerControlInputDescriptor {
3409 #[inline(always)]
3410 fn max_ordinal_present(&self) -> u64 {
3411 if let Some(_) = self.buttons {
3412 return 1;
3413 }
3414 0
3415 }
3416 }
3417
3418 impl fidl::encoding::ValueTypeMarker for ConsumerControlInputDescriptor {
3419 type Borrowed<'a> = &'a Self;
3420 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3421 value
3422 }
3423 }
3424
3425 unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputDescriptor {
3426 type Owned = Self;
3427
3428 #[inline(always)]
3429 fn inline_align(_context: fidl::encoding::Context) -> usize {
3430 8
3431 }
3432
3433 #[inline(always)]
3434 fn inline_size(_context: fidl::encoding::Context) -> usize {
3435 16
3436 }
3437 }
3438
3439 unsafe impl<D: fidl::encoding::ResourceDialect>
3440 fidl::encoding::Encode<ConsumerControlInputDescriptor, D>
3441 for &ConsumerControlInputDescriptor
3442 {
3443 unsafe fn encode(
3444 self,
3445 encoder: &mut fidl::encoding::Encoder<'_, D>,
3446 offset: usize,
3447 mut depth: fidl::encoding::Depth,
3448 ) -> fidl::Result<()> {
3449 encoder.debug_check_bounds::<ConsumerControlInputDescriptor>(offset);
3450 let max_ordinal: u64 = self.max_ordinal_present();
3452 encoder.write_num(max_ordinal, offset);
3453 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3454 if max_ordinal == 0 {
3456 return Ok(());
3457 }
3458 depth.increment()?;
3459 let envelope_size = 8;
3460 let bytes_len = max_ordinal as usize * envelope_size;
3461 #[allow(unused_variables)]
3462 let offset = encoder.out_of_line_offset(bytes_len);
3463 let mut _prev_end_offset: usize = 0;
3464 if 1 > max_ordinal {
3465 return Ok(());
3466 }
3467
3468 let cur_offset: usize = (1 - 1) * envelope_size;
3471
3472 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3474
3475 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3480 self.buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3481 encoder, offset + cur_offset, depth
3482 )?;
3483
3484 _prev_end_offset = cur_offset + envelope_size;
3485
3486 Ok(())
3487 }
3488 }
3489
3490 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3491 for ConsumerControlInputDescriptor
3492 {
3493 #[inline(always)]
3494 fn new_empty() -> Self {
3495 Self::default()
3496 }
3497
3498 unsafe fn decode(
3499 &mut self,
3500 decoder: &mut fidl::encoding::Decoder<'_, D>,
3501 offset: usize,
3502 mut depth: fidl::encoding::Depth,
3503 ) -> fidl::Result<()> {
3504 decoder.debug_check_bounds::<Self>(offset);
3505 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3506 None => return Err(fidl::Error::NotNullable),
3507 Some(len) => len,
3508 };
3509 if len == 0 {
3511 return Ok(());
3512 };
3513 depth.increment()?;
3514 let envelope_size = 8;
3515 let bytes_len = len * envelope_size;
3516 let offset = decoder.out_of_line_offset(bytes_len)?;
3517 let mut _next_ordinal_to_read = 0;
3519 let mut next_offset = offset;
3520 let end_offset = offset + bytes_len;
3521 _next_ordinal_to_read += 1;
3522 if next_offset >= end_offset {
3523 return Ok(());
3524 }
3525
3526 while _next_ordinal_to_read < 1 {
3528 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3529 _next_ordinal_to_read += 1;
3530 next_offset += envelope_size;
3531 }
3532
3533 let next_out_of_line = decoder.next_out_of_line();
3534 let handles_before = decoder.remaining_handles();
3535 if let Some((inlined, num_bytes, num_handles)) =
3536 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3537 {
3538 let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3539 if inlined != (member_inline_size <= 4) {
3540 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3541 }
3542 let inner_offset;
3543 let mut inner_depth = depth.clone();
3544 if inlined {
3545 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3546 inner_offset = next_offset;
3547 } else {
3548 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3549 inner_depth.increment()?;
3550 }
3551 let val_ref = self.buttons.get_or_insert_with(
3552 || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3553 );
3554 fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3555 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3556 {
3557 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3558 }
3559 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3560 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3561 }
3562 }
3563
3564 next_offset += envelope_size;
3565
3566 while next_offset < end_offset {
3568 _next_ordinal_to_read += 1;
3569 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3570 next_offset += envelope_size;
3571 }
3572
3573 Ok(())
3574 }
3575 }
3576
3577 impl ConsumerControlInputReport {
3578 #[inline(always)]
3579 fn max_ordinal_present(&self) -> u64 {
3580 if let Some(_) = self.pressed_buttons {
3581 return 1;
3582 }
3583 0
3584 }
3585 }
3586
3587 impl fidl::encoding::ValueTypeMarker for ConsumerControlInputReport {
3588 type Borrowed<'a> = &'a Self;
3589 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3590 value
3591 }
3592 }
3593
3594 unsafe impl fidl::encoding::TypeMarker for ConsumerControlInputReport {
3595 type Owned = Self;
3596
3597 #[inline(always)]
3598 fn inline_align(_context: fidl::encoding::Context) -> usize {
3599 8
3600 }
3601
3602 #[inline(always)]
3603 fn inline_size(_context: fidl::encoding::Context) -> usize {
3604 16
3605 }
3606 }
3607
3608 unsafe impl<D: fidl::encoding::ResourceDialect>
3609 fidl::encoding::Encode<ConsumerControlInputReport, D> for &ConsumerControlInputReport
3610 {
3611 unsafe fn encode(
3612 self,
3613 encoder: &mut fidl::encoding::Encoder<'_, D>,
3614 offset: usize,
3615 mut depth: fidl::encoding::Depth,
3616 ) -> fidl::Result<()> {
3617 encoder.debug_check_bounds::<ConsumerControlInputReport>(offset);
3618 let max_ordinal: u64 = self.max_ordinal_present();
3620 encoder.write_num(max_ordinal, offset);
3621 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3622 if max_ordinal == 0 {
3624 return Ok(());
3625 }
3626 depth.increment()?;
3627 let envelope_size = 8;
3628 let bytes_len = max_ordinal as usize * envelope_size;
3629 #[allow(unused_variables)]
3630 let offset = encoder.out_of_line_offset(bytes_len);
3631 let mut _prev_end_offset: usize = 0;
3632 if 1 > max_ordinal {
3633 return Ok(());
3634 }
3635
3636 let cur_offset: usize = (1 - 1) * envelope_size;
3639
3640 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3642
3643 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ConsumerControlButton, 255>, D>(
3648 self.pressed_buttons.as_ref().map(<fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::ValueTypeMarker>::borrow),
3649 encoder, offset + cur_offset, depth
3650 )?;
3651
3652 _prev_end_offset = cur_offset + envelope_size;
3653
3654 Ok(())
3655 }
3656 }
3657
3658 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3659 for ConsumerControlInputReport
3660 {
3661 #[inline(always)]
3662 fn new_empty() -> Self {
3663 Self::default()
3664 }
3665
3666 unsafe fn decode(
3667 &mut self,
3668 decoder: &mut fidl::encoding::Decoder<'_, D>,
3669 offset: usize,
3670 mut depth: fidl::encoding::Depth,
3671 ) -> fidl::Result<()> {
3672 decoder.debug_check_bounds::<Self>(offset);
3673 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3674 None => return Err(fidl::Error::NotNullable),
3675 Some(len) => len,
3676 };
3677 if len == 0 {
3679 return Ok(());
3680 };
3681 depth.increment()?;
3682 let envelope_size = 8;
3683 let bytes_len = len * envelope_size;
3684 let offset = decoder.out_of_line_offset(bytes_len)?;
3685 let mut _next_ordinal_to_read = 0;
3687 let mut next_offset = offset;
3688 let end_offset = offset + bytes_len;
3689 _next_ordinal_to_read += 1;
3690 if next_offset >= end_offset {
3691 return Ok(());
3692 }
3693
3694 while _next_ordinal_to_read < 1 {
3696 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3697 _next_ordinal_to_read += 1;
3698 next_offset += envelope_size;
3699 }
3700
3701 let next_out_of_line = decoder.next_out_of_line();
3702 let handles_before = decoder.remaining_handles();
3703 if let Some((inlined, num_bytes, num_handles)) =
3704 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3705 {
3706 let member_inline_size = <fidl::encoding::Vector<ConsumerControlButton, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3707 if inlined != (member_inline_size <= 4) {
3708 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3709 }
3710 let inner_offset;
3711 let mut inner_depth = depth.clone();
3712 if inlined {
3713 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3714 inner_offset = next_offset;
3715 } else {
3716 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3717 inner_depth.increment()?;
3718 }
3719 let val_ref = self.pressed_buttons.get_or_insert_with(
3720 || fidl::new_empty!(fidl::encoding::Vector<ConsumerControlButton, 255>, D),
3721 );
3722 fidl::decode!(fidl::encoding::Vector<ConsumerControlButton, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
3723 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3724 {
3725 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3726 }
3727 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3728 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3729 }
3730 }
3731
3732 next_offset += envelope_size;
3733
3734 while next_offset < end_offset {
3736 _next_ordinal_to_read += 1;
3737 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3738 next_offset += envelope_size;
3739 }
3740
3741 Ok(())
3742 }
3743 }
3744
3745 impl ContactInputDescriptor {
3746 #[inline(always)]
3747 fn max_ordinal_present(&self) -> u64 {
3748 if let Some(_) = self.contact_height {
3749 return 5;
3750 }
3751 if let Some(_) = self.contact_width {
3752 return 4;
3753 }
3754 if let Some(_) = self.pressure {
3755 return 3;
3756 }
3757 if let Some(_) = self.position_y {
3758 return 2;
3759 }
3760 if let Some(_) = self.position_x {
3761 return 1;
3762 }
3763 0
3764 }
3765 }
3766
3767 impl fidl::encoding::ValueTypeMarker for ContactInputDescriptor {
3768 type Borrowed<'a> = &'a Self;
3769 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3770 value
3771 }
3772 }
3773
3774 unsafe impl fidl::encoding::TypeMarker for ContactInputDescriptor {
3775 type Owned = Self;
3776
3777 #[inline(always)]
3778 fn inline_align(_context: fidl::encoding::Context) -> usize {
3779 8
3780 }
3781
3782 #[inline(always)]
3783 fn inline_size(_context: fidl::encoding::Context) -> usize {
3784 16
3785 }
3786 }
3787
3788 unsafe impl<D: fidl::encoding::ResourceDialect>
3789 fidl::encoding::Encode<ContactInputDescriptor, D> for &ContactInputDescriptor
3790 {
3791 unsafe fn encode(
3792 self,
3793 encoder: &mut fidl::encoding::Encoder<'_, D>,
3794 offset: usize,
3795 mut depth: fidl::encoding::Depth,
3796 ) -> fidl::Result<()> {
3797 encoder.debug_check_bounds::<ContactInputDescriptor>(offset);
3798 let max_ordinal: u64 = self.max_ordinal_present();
3800 encoder.write_num(max_ordinal, offset);
3801 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3802 if max_ordinal == 0 {
3804 return Ok(());
3805 }
3806 depth.increment()?;
3807 let envelope_size = 8;
3808 let bytes_len = max_ordinal as usize * envelope_size;
3809 #[allow(unused_variables)]
3810 let offset = encoder.out_of_line_offset(bytes_len);
3811 let mut _prev_end_offset: usize = 0;
3812 if 1 > max_ordinal {
3813 return Ok(());
3814 }
3815
3816 let cur_offset: usize = (1 - 1) * envelope_size;
3819
3820 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3822
3823 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3828 self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3829 encoder,
3830 offset + cur_offset,
3831 depth,
3832 )?;
3833
3834 _prev_end_offset = cur_offset + envelope_size;
3835 if 2 > max_ordinal {
3836 return Ok(());
3837 }
3838
3839 let cur_offset: usize = (2 - 1) * envelope_size;
3842
3843 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3845
3846 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3851 self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3852 encoder,
3853 offset + cur_offset,
3854 depth,
3855 )?;
3856
3857 _prev_end_offset = cur_offset + envelope_size;
3858 if 3 > max_ordinal {
3859 return Ok(());
3860 }
3861
3862 let cur_offset: usize = (3 - 1) * envelope_size;
3865
3866 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3868
3869 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3874 self.pressure.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3875 encoder,
3876 offset + cur_offset,
3877 depth,
3878 )?;
3879
3880 _prev_end_offset = cur_offset + envelope_size;
3881 if 4 > max_ordinal {
3882 return Ok(());
3883 }
3884
3885 let cur_offset: usize = (4 - 1) * envelope_size;
3888
3889 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3891
3892 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3897 self.contact_width.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3898 encoder,
3899 offset + cur_offset,
3900 depth,
3901 )?;
3902
3903 _prev_end_offset = cur_offset + envelope_size;
3904 if 5 > max_ordinal {
3905 return Ok(());
3906 }
3907
3908 let cur_offset: usize = (5 - 1) * envelope_size;
3911
3912 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3914
3915 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
3920 self.contact_height.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
3921 encoder,
3922 offset + cur_offset,
3923 depth,
3924 )?;
3925
3926 _prev_end_offset = cur_offset + envelope_size;
3927
3928 Ok(())
3929 }
3930 }
3931
3932 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3933 for ContactInputDescriptor
3934 {
3935 #[inline(always)]
3936 fn new_empty() -> Self {
3937 Self::default()
3938 }
3939
3940 unsafe fn decode(
3941 &mut self,
3942 decoder: &mut fidl::encoding::Decoder<'_, D>,
3943 offset: usize,
3944 mut depth: fidl::encoding::Depth,
3945 ) -> fidl::Result<()> {
3946 decoder.debug_check_bounds::<Self>(offset);
3947 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3948 None => return Err(fidl::Error::NotNullable),
3949 Some(len) => len,
3950 };
3951 if len == 0 {
3953 return Ok(());
3954 };
3955 depth.increment()?;
3956 let envelope_size = 8;
3957 let bytes_len = len * envelope_size;
3958 let offset = decoder.out_of_line_offset(bytes_len)?;
3959 let mut _next_ordinal_to_read = 0;
3961 let mut next_offset = offset;
3962 let end_offset = offset + bytes_len;
3963 _next_ordinal_to_read += 1;
3964 if next_offset >= end_offset {
3965 return Ok(());
3966 }
3967
3968 while _next_ordinal_to_read < 1 {
3970 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3971 _next_ordinal_to_read += 1;
3972 next_offset += envelope_size;
3973 }
3974
3975 let next_out_of_line = decoder.next_out_of_line();
3976 let handles_before = decoder.remaining_handles();
3977 if let Some((inlined, num_bytes, num_handles)) =
3978 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3979 {
3980 let member_inline_size =
3981 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3982 if inlined != (member_inline_size <= 4) {
3983 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3984 }
3985 let inner_offset;
3986 let mut inner_depth = depth.clone();
3987 if inlined {
3988 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3989 inner_offset = next_offset;
3990 } else {
3991 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3992 inner_depth.increment()?;
3993 }
3994 let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
3995 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
3996 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3997 {
3998 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3999 }
4000 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4001 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4002 }
4003 }
4004
4005 next_offset += envelope_size;
4006 _next_ordinal_to_read += 1;
4007 if next_offset >= end_offset {
4008 return Ok(());
4009 }
4010
4011 while _next_ordinal_to_read < 2 {
4013 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4014 _next_ordinal_to_read += 1;
4015 next_offset += envelope_size;
4016 }
4017
4018 let next_out_of_line = decoder.next_out_of_line();
4019 let handles_before = decoder.remaining_handles();
4020 if let Some((inlined, num_bytes, num_handles)) =
4021 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4022 {
4023 let member_inline_size =
4024 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4025 if inlined != (member_inline_size <= 4) {
4026 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4027 }
4028 let inner_offset;
4029 let mut inner_depth = depth.clone();
4030 if inlined {
4031 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4032 inner_offset = next_offset;
4033 } else {
4034 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4035 inner_depth.increment()?;
4036 }
4037 let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4038 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4039 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4040 {
4041 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4042 }
4043 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4044 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4045 }
4046 }
4047
4048 next_offset += envelope_size;
4049 _next_ordinal_to_read += 1;
4050 if next_offset >= end_offset {
4051 return Ok(());
4052 }
4053
4054 while _next_ordinal_to_read < 3 {
4056 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4057 _next_ordinal_to_read += 1;
4058 next_offset += envelope_size;
4059 }
4060
4061 let next_out_of_line = decoder.next_out_of_line();
4062 let handles_before = decoder.remaining_handles();
4063 if let Some((inlined, num_bytes, num_handles)) =
4064 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4065 {
4066 let member_inline_size =
4067 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4068 if inlined != (member_inline_size <= 4) {
4069 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4070 }
4071 let inner_offset;
4072 let mut inner_depth = depth.clone();
4073 if inlined {
4074 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4075 inner_offset = next_offset;
4076 } else {
4077 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4078 inner_depth.increment()?;
4079 }
4080 let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4081 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4082 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4083 {
4084 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4085 }
4086 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4087 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4088 }
4089 }
4090
4091 next_offset += envelope_size;
4092 _next_ordinal_to_read += 1;
4093 if next_offset >= end_offset {
4094 return Ok(());
4095 }
4096
4097 while _next_ordinal_to_read < 4 {
4099 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4100 _next_ordinal_to_read += 1;
4101 next_offset += envelope_size;
4102 }
4103
4104 let next_out_of_line = decoder.next_out_of_line();
4105 let handles_before = decoder.remaining_handles();
4106 if let Some((inlined, num_bytes, num_handles)) =
4107 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4108 {
4109 let member_inline_size =
4110 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4111 if inlined != (member_inline_size <= 4) {
4112 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4113 }
4114 let inner_offset;
4115 let mut inner_depth = depth.clone();
4116 if inlined {
4117 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4118 inner_offset = next_offset;
4119 } else {
4120 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4121 inner_depth.increment()?;
4122 }
4123 let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4124 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4125 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4126 {
4127 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4128 }
4129 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4130 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4131 }
4132 }
4133
4134 next_offset += envelope_size;
4135 _next_ordinal_to_read += 1;
4136 if next_offset >= end_offset {
4137 return Ok(());
4138 }
4139
4140 while _next_ordinal_to_read < 5 {
4142 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4143 _next_ordinal_to_read += 1;
4144 next_offset += envelope_size;
4145 }
4146
4147 let next_out_of_line = decoder.next_out_of_line();
4148 let handles_before = decoder.remaining_handles();
4149 if let Some((inlined, num_bytes, num_handles)) =
4150 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4151 {
4152 let member_inline_size =
4153 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4154 if inlined != (member_inline_size <= 4) {
4155 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4156 }
4157 let inner_offset;
4158 let mut inner_depth = depth.clone();
4159 if inlined {
4160 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4161 inner_offset = next_offset;
4162 } else {
4163 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4164 inner_depth.increment()?;
4165 }
4166 let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(Axis, D));
4167 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
4168 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4169 {
4170 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4171 }
4172 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4173 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4174 }
4175 }
4176
4177 next_offset += envelope_size;
4178
4179 while next_offset < end_offset {
4181 _next_ordinal_to_read += 1;
4182 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4183 next_offset += envelope_size;
4184 }
4185
4186 Ok(())
4187 }
4188 }
4189
4190 impl ContactInputReport {
4191 #[inline(always)]
4192 fn max_ordinal_present(&self) -> u64 {
4193 if let Some(_) = self.confidence {
4194 return 7;
4195 }
4196 if let Some(_) = self.contact_height {
4197 return 6;
4198 }
4199 if let Some(_) = self.contact_width {
4200 return 5;
4201 }
4202 if let Some(_) = self.pressure {
4203 return 4;
4204 }
4205 if let Some(_) = self.position_y {
4206 return 3;
4207 }
4208 if let Some(_) = self.position_x {
4209 return 2;
4210 }
4211 if let Some(_) = self.contact_id {
4212 return 1;
4213 }
4214 0
4215 }
4216 }
4217
4218 impl fidl::encoding::ValueTypeMarker for ContactInputReport {
4219 type Borrowed<'a> = &'a Self;
4220 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4221 value
4222 }
4223 }
4224
4225 unsafe impl fidl::encoding::TypeMarker for ContactInputReport {
4226 type Owned = Self;
4227
4228 #[inline(always)]
4229 fn inline_align(_context: fidl::encoding::Context) -> usize {
4230 8
4231 }
4232
4233 #[inline(always)]
4234 fn inline_size(_context: fidl::encoding::Context) -> usize {
4235 16
4236 }
4237 }
4238
4239 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ContactInputReport, D>
4240 for &ContactInputReport
4241 {
4242 unsafe fn encode(
4243 self,
4244 encoder: &mut fidl::encoding::Encoder<'_, D>,
4245 offset: usize,
4246 mut depth: fidl::encoding::Depth,
4247 ) -> fidl::Result<()> {
4248 encoder.debug_check_bounds::<ContactInputReport>(offset);
4249 let max_ordinal: u64 = self.max_ordinal_present();
4251 encoder.write_num(max_ordinal, offset);
4252 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4253 if max_ordinal == 0 {
4255 return Ok(());
4256 }
4257 depth.increment()?;
4258 let envelope_size = 8;
4259 let bytes_len = max_ordinal as usize * envelope_size;
4260 #[allow(unused_variables)]
4261 let offset = encoder.out_of_line_offset(bytes_len);
4262 let mut _prev_end_offset: usize = 0;
4263 if 1 > max_ordinal {
4264 return Ok(());
4265 }
4266
4267 let cur_offset: usize = (1 - 1) * envelope_size;
4270
4271 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4273
4274 fidl::encoding::encode_in_envelope_optional::<u32, D>(
4279 self.contact_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
4280 encoder,
4281 offset + cur_offset,
4282 depth,
4283 )?;
4284
4285 _prev_end_offset = cur_offset + envelope_size;
4286 if 2 > max_ordinal {
4287 return Ok(());
4288 }
4289
4290 let cur_offset: usize = (2 - 1) * envelope_size;
4293
4294 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4296
4297 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4302 self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4303 encoder,
4304 offset + cur_offset,
4305 depth,
4306 )?;
4307
4308 _prev_end_offset = cur_offset + envelope_size;
4309 if 3 > max_ordinal {
4310 return Ok(());
4311 }
4312
4313 let cur_offset: usize = (3 - 1) * envelope_size;
4316
4317 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4319
4320 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4325 self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4326 encoder,
4327 offset + cur_offset,
4328 depth,
4329 )?;
4330
4331 _prev_end_offset = cur_offset + envelope_size;
4332 if 4 > max_ordinal {
4333 return Ok(());
4334 }
4335
4336 let cur_offset: usize = (4 - 1) * envelope_size;
4339
4340 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4342
4343 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4348 self.pressure.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4349 encoder,
4350 offset + cur_offset,
4351 depth,
4352 )?;
4353
4354 _prev_end_offset = cur_offset + envelope_size;
4355 if 5 > max_ordinal {
4356 return Ok(());
4357 }
4358
4359 let cur_offset: usize = (5 - 1) * envelope_size;
4362
4363 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4365
4366 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4371 self.contact_width.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4372 encoder,
4373 offset + cur_offset,
4374 depth,
4375 )?;
4376
4377 _prev_end_offset = cur_offset + envelope_size;
4378 if 6 > max_ordinal {
4379 return Ok(());
4380 }
4381
4382 let cur_offset: usize = (6 - 1) * envelope_size;
4385
4386 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4388
4389 fidl::encoding::encode_in_envelope_optional::<i64, D>(
4394 self.contact_height.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
4395 encoder,
4396 offset + cur_offset,
4397 depth,
4398 )?;
4399
4400 _prev_end_offset = cur_offset + envelope_size;
4401 if 7 > max_ordinal {
4402 return Ok(());
4403 }
4404
4405 let cur_offset: usize = (7 - 1) * envelope_size;
4408
4409 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4411
4412 fidl::encoding::encode_in_envelope_optional::<bool, D>(
4417 self.confidence.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
4418 encoder,
4419 offset + cur_offset,
4420 depth,
4421 )?;
4422
4423 _prev_end_offset = cur_offset + envelope_size;
4424
4425 Ok(())
4426 }
4427 }
4428
4429 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ContactInputReport {
4430 #[inline(always)]
4431 fn new_empty() -> Self {
4432 Self::default()
4433 }
4434
4435 unsafe fn decode(
4436 &mut self,
4437 decoder: &mut fidl::encoding::Decoder<'_, D>,
4438 offset: usize,
4439 mut depth: fidl::encoding::Depth,
4440 ) -> fidl::Result<()> {
4441 decoder.debug_check_bounds::<Self>(offset);
4442 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4443 None => return Err(fidl::Error::NotNullable),
4444 Some(len) => len,
4445 };
4446 if len == 0 {
4448 return Ok(());
4449 };
4450 depth.increment()?;
4451 let envelope_size = 8;
4452 let bytes_len = len * envelope_size;
4453 let offset = decoder.out_of_line_offset(bytes_len)?;
4454 let mut _next_ordinal_to_read = 0;
4456 let mut next_offset = offset;
4457 let end_offset = offset + bytes_len;
4458 _next_ordinal_to_read += 1;
4459 if next_offset >= end_offset {
4460 return Ok(());
4461 }
4462
4463 while _next_ordinal_to_read < 1 {
4465 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4466 _next_ordinal_to_read += 1;
4467 next_offset += envelope_size;
4468 }
4469
4470 let next_out_of_line = decoder.next_out_of_line();
4471 let handles_before = decoder.remaining_handles();
4472 if let Some((inlined, num_bytes, num_handles)) =
4473 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4474 {
4475 let member_inline_size =
4476 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4477 if inlined != (member_inline_size <= 4) {
4478 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4479 }
4480 let inner_offset;
4481 let mut inner_depth = depth.clone();
4482 if inlined {
4483 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4484 inner_offset = next_offset;
4485 } else {
4486 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4487 inner_depth.increment()?;
4488 }
4489 let val_ref = self.contact_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
4490 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4491 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4492 {
4493 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4494 }
4495 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4496 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4497 }
4498 }
4499
4500 next_offset += envelope_size;
4501 _next_ordinal_to_read += 1;
4502 if next_offset >= end_offset {
4503 return Ok(());
4504 }
4505
4506 while _next_ordinal_to_read < 2 {
4508 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4509 _next_ordinal_to_read += 1;
4510 next_offset += envelope_size;
4511 }
4512
4513 let next_out_of_line = decoder.next_out_of_line();
4514 let handles_before = decoder.remaining_handles();
4515 if let Some((inlined, num_bytes, num_handles)) =
4516 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4517 {
4518 let member_inline_size =
4519 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4520 if inlined != (member_inline_size <= 4) {
4521 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4522 }
4523 let inner_offset;
4524 let mut inner_depth = depth.clone();
4525 if inlined {
4526 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4527 inner_offset = next_offset;
4528 } else {
4529 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4530 inner_depth.increment()?;
4531 }
4532 let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
4533 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4534 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4535 {
4536 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4537 }
4538 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4539 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4540 }
4541 }
4542
4543 next_offset += envelope_size;
4544 _next_ordinal_to_read += 1;
4545 if next_offset >= end_offset {
4546 return Ok(());
4547 }
4548
4549 while _next_ordinal_to_read < 3 {
4551 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4552 _next_ordinal_to_read += 1;
4553 next_offset += envelope_size;
4554 }
4555
4556 let next_out_of_line = decoder.next_out_of_line();
4557 let handles_before = decoder.remaining_handles();
4558 if let Some((inlined, num_bytes, num_handles)) =
4559 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4560 {
4561 let member_inline_size =
4562 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4563 if inlined != (member_inline_size <= 4) {
4564 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4565 }
4566 let inner_offset;
4567 let mut inner_depth = depth.clone();
4568 if inlined {
4569 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4570 inner_offset = next_offset;
4571 } else {
4572 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4573 inner_depth.increment()?;
4574 }
4575 let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
4576 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4577 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4578 {
4579 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4580 }
4581 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4582 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4583 }
4584 }
4585
4586 next_offset += envelope_size;
4587 _next_ordinal_to_read += 1;
4588 if next_offset >= end_offset {
4589 return Ok(());
4590 }
4591
4592 while _next_ordinal_to_read < 4 {
4594 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4595 _next_ordinal_to_read += 1;
4596 next_offset += envelope_size;
4597 }
4598
4599 let next_out_of_line = decoder.next_out_of_line();
4600 let handles_before = decoder.remaining_handles();
4601 if let Some((inlined, num_bytes, num_handles)) =
4602 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4603 {
4604 let member_inline_size =
4605 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4606 if inlined != (member_inline_size <= 4) {
4607 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4608 }
4609 let inner_offset;
4610 let mut inner_depth = depth.clone();
4611 if inlined {
4612 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4613 inner_offset = next_offset;
4614 } else {
4615 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4616 inner_depth.increment()?;
4617 }
4618 let val_ref = self.pressure.get_or_insert_with(|| fidl::new_empty!(i64, D));
4619 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4620 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4621 {
4622 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4623 }
4624 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4625 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4626 }
4627 }
4628
4629 next_offset += envelope_size;
4630 _next_ordinal_to_read += 1;
4631 if next_offset >= end_offset {
4632 return Ok(());
4633 }
4634
4635 while _next_ordinal_to_read < 5 {
4637 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4638 _next_ordinal_to_read += 1;
4639 next_offset += envelope_size;
4640 }
4641
4642 let next_out_of_line = decoder.next_out_of_line();
4643 let handles_before = decoder.remaining_handles();
4644 if let Some((inlined, num_bytes, num_handles)) =
4645 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4646 {
4647 let member_inline_size =
4648 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4649 if inlined != (member_inline_size <= 4) {
4650 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4651 }
4652 let inner_offset;
4653 let mut inner_depth = depth.clone();
4654 if inlined {
4655 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4656 inner_offset = next_offset;
4657 } else {
4658 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4659 inner_depth.increment()?;
4660 }
4661 let val_ref = self.contact_width.get_or_insert_with(|| fidl::new_empty!(i64, D));
4662 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4663 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4664 {
4665 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4666 }
4667 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4668 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4669 }
4670 }
4671
4672 next_offset += envelope_size;
4673 _next_ordinal_to_read += 1;
4674 if next_offset >= end_offset {
4675 return Ok(());
4676 }
4677
4678 while _next_ordinal_to_read < 6 {
4680 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4681 _next_ordinal_to_read += 1;
4682 next_offset += envelope_size;
4683 }
4684
4685 let next_out_of_line = decoder.next_out_of_line();
4686 let handles_before = decoder.remaining_handles();
4687 if let Some((inlined, num_bytes, num_handles)) =
4688 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4689 {
4690 let member_inline_size =
4691 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4692 if inlined != (member_inline_size <= 4) {
4693 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4694 }
4695 let inner_offset;
4696 let mut inner_depth = depth.clone();
4697 if inlined {
4698 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4699 inner_offset = next_offset;
4700 } else {
4701 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4702 inner_depth.increment()?;
4703 }
4704 let val_ref = self.contact_height.get_or_insert_with(|| fidl::new_empty!(i64, D));
4705 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
4706 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4707 {
4708 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4709 }
4710 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4711 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4712 }
4713 }
4714
4715 next_offset += envelope_size;
4716 _next_ordinal_to_read += 1;
4717 if next_offset >= end_offset {
4718 return Ok(());
4719 }
4720
4721 while _next_ordinal_to_read < 7 {
4723 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4724 _next_ordinal_to_read += 1;
4725 next_offset += envelope_size;
4726 }
4727
4728 let next_out_of_line = decoder.next_out_of_line();
4729 let handles_before = decoder.remaining_handles();
4730 if let Some((inlined, num_bytes, num_handles)) =
4731 fidl::encoding::decode_envelope_header(decoder, next_offset)?
4732 {
4733 let member_inline_size =
4734 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4735 if inlined != (member_inline_size <= 4) {
4736 return Err(fidl::Error::InvalidInlineBitInEnvelope);
4737 }
4738 let inner_offset;
4739 let mut inner_depth = depth.clone();
4740 if inlined {
4741 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4742 inner_offset = next_offset;
4743 } else {
4744 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4745 inner_depth.increment()?;
4746 }
4747 let val_ref = self.confidence.get_or_insert_with(|| fidl::new_empty!(bool, D));
4748 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
4749 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4750 {
4751 return Err(fidl::Error::InvalidNumBytesInEnvelope);
4752 }
4753 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4754 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4755 }
4756 }
4757
4758 next_offset += envelope_size;
4759
4760 while next_offset < end_offset {
4762 _next_ordinal_to_read += 1;
4763 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4764 next_offset += envelope_size;
4765 }
4766
4767 Ok(())
4768 }
4769 }
4770
4771 impl DeviceDescriptor {
4772 #[inline(always)]
4773 fn max_ordinal_present(&self) -> u64 {
4774 if let Some(_) = self.device_information {
4775 return 7;
4776 }
4777 if let Some(_) = self.consumer_control {
4778 return 6;
4779 }
4780 if let Some(_) = self.keyboard {
4781 return 5;
4782 }
4783 if let Some(_) = self.touch {
4784 return 4;
4785 }
4786 if let Some(_) = self.sensor {
4787 return 3;
4788 }
4789 if let Some(_) = self.mouse {
4790 return 2;
4791 }
4792 if let Some(_) = self.device_info {
4793 return 1;
4794 }
4795 0
4796 }
4797 }
4798
4799 impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
4800 type Borrowed<'a> = &'a Self;
4801 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4802 value
4803 }
4804 }
4805
4806 unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
4807 type Owned = Self;
4808
4809 #[inline(always)]
4810 fn inline_align(_context: fidl::encoding::Context) -> usize {
4811 8
4812 }
4813
4814 #[inline(always)]
4815 fn inline_size(_context: fidl::encoding::Context) -> usize {
4816 16
4817 }
4818 }
4819
4820 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
4821 for &DeviceDescriptor
4822 {
4823 unsafe fn encode(
4824 self,
4825 encoder: &mut fidl::encoding::Encoder<'_, D>,
4826 offset: usize,
4827 mut depth: fidl::encoding::Depth,
4828 ) -> fidl::Result<()> {
4829 encoder.debug_check_bounds::<DeviceDescriptor>(offset);
4830 let max_ordinal: u64 = self.max_ordinal_present();
4832 encoder.write_num(max_ordinal, offset);
4833 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4834 if max_ordinal == 0 {
4836 return Ok(());
4837 }
4838 depth.increment()?;
4839 let envelope_size = 8;
4840 let bytes_len = max_ordinal as usize * envelope_size;
4841 #[allow(unused_variables)]
4842 let offset = encoder.out_of_line_offset(bytes_len);
4843 let mut _prev_end_offset: usize = 0;
4844 if 1 > max_ordinal {
4845 return Ok(());
4846 }
4847
4848 let cur_offset: usize = (1 - 1) * envelope_size;
4851
4852 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4854
4855 fidl::encoding::encode_in_envelope_optional::<DeviceInfo, D>(
4860 self.device_info
4861 .as_ref()
4862 .map(<DeviceInfo as fidl::encoding::ValueTypeMarker>::borrow),
4863 encoder,
4864 offset + cur_offset,
4865 depth,
4866 )?;
4867
4868 _prev_end_offset = cur_offset + envelope_size;
4869 if 2 > max_ordinal {
4870 return Ok(());
4871 }
4872
4873 let cur_offset: usize = (2 - 1) * envelope_size;
4876
4877 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4879
4880 fidl::encoding::encode_in_envelope_optional::<MouseDescriptor, D>(
4885 self.mouse
4886 .as_ref()
4887 .map(<MouseDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4888 encoder,
4889 offset + cur_offset,
4890 depth,
4891 )?;
4892
4893 _prev_end_offset = cur_offset + envelope_size;
4894 if 3 > max_ordinal {
4895 return Ok(());
4896 }
4897
4898 let cur_offset: usize = (3 - 1) * envelope_size;
4901
4902 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4904
4905 fidl::encoding::encode_in_envelope_optional::<SensorDescriptor, D>(
4910 self.sensor
4911 .as_ref()
4912 .map(<SensorDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4913 encoder,
4914 offset + cur_offset,
4915 depth,
4916 )?;
4917
4918 _prev_end_offset = cur_offset + envelope_size;
4919 if 4 > max_ordinal {
4920 return Ok(());
4921 }
4922
4923 let cur_offset: usize = (4 - 1) * envelope_size;
4926
4927 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4929
4930 fidl::encoding::encode_in_envelope_optional::<TouchDescriptor, D>(
4935 self.touch
4936 .as_ref()
4937 .map(<TouchDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4938 encoder,
4939 offset + cur_offset,
4940 depth,
4941 )?;
4942
4943 _prev_end_offset = cur_offset + envelope_size;
4944 if 5 > max_ordinal {
4945 return Ok(());
4946 }
4947
4948 let cur_offset: usize = (5 - 1) * envelope_size;
4951
4952 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4954
4955 fidl::encoding::encode_in_envelope_optional::<KeyboardDescriptor, D>(
4960 self.keyboard
4961 .as_ref()
4962 .map(<KeyboardDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4963 encoder,
4964 offset + cur_offset,
4965 depth,
4966 )?;
4967
4968 _prev_end_offset = cur_offset + envelope_size;
4969 if 6 > max_ordinal {
4970 return Ok(());
4971 }
4972
4973 let cur_offset: usize = (6 - 1) * envelope_size;
4976
4977 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4979
4980 fidl::encoding::encode_in_envelope_optional::<ConsumerControlDescriptor, D>(
4985 self.consumer_control
4986 .as_ref()
4987 .map(<ConsumerControlDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
4988 encoder,
4989 offset + cur_offset,
4990 depth,
4991 )?;
4992
4993 _prev_end_offset = cur_offset + envelope_size;
4994 if 7 > max_ordinal {
4995 return Ok(());
4996 }
4997
4998 let cur_offset: usize = (7 - 1) * envelope_size;
5001
5002 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5004
5005 fidl::encoding::encode_in_envelope_optional::<DeviceInformation, D>(
5010 self.device_information
5011 .as_ref()
5012 .map(<DeviceInformation as fidl::encoding::ValueTypeMarker>::borrow),
5013 encoder,
5014 offset + cur_offset,
5015 depth,
5016 )?;
5017
5018 _prev_end_offset = cur_offset + envelope_size;
5019
5020 Ok(())
5021 }
5022 }
5023
5024 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
5025 #[inline(always)]
5026 fn new_empty() -> Self {
5027 Self::default()
5028 }
5029
5030 unsafe fn decode(
5031 &mut self,
5032 decoder: &mut fidl::encoding::Decoder<'_, D>,
5033 offset: usize,
5034 mut depth: fidl::encoding::Depth,
5035 ) -> fidl::Result<()> {
5036 decoder.debug_check_bounds::<Self>(offset);
5037 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5038 None => return Err(fidl::Error::NotNullable),
5039 Some(len) => len,
5040 };
5041 if len == 0 {
5043 return Ok(());
5044 };
5045 depth.increment()?;
5046 let envelope_size = 8;
5047 let bytes_len = len * envelope_size;
5048 let offset = decoder.out_of_line_offset(bytes_len)?;
5049 let mut _next_ordinal_to_read = 0;
5051 let mut next_offset = offset;
5052 let end_offset = offset + bytes_len;
5053 _next_ordinal_to_read += 1;
5054 if next_offset >= end_offset {
5055 return Ok(());
5056 }
5057
5058 while _next_ordinal_to_read < 1 {
5060 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5061 _next_ordinal_to_read += 1;
5062 next_offset += envelope_size;
5063 }
5064
5065 let next_out_of_line = decoder.next_out_of_line();
5066 let handles_before = decoder.remaining_handles();
5067 if let Some((inlined, num_bytes, num_handles)) =
5068 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5069 {
5070 let member_inline_size =
5071 <DeviceInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5072 if inlined != (member_inline_size <= 4) {
5073 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5074 }
5075 let inner_offset;
5076 let mut inner_depth = depth.clone();
5077 if inlined {
5078 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5079 inner_offset = next_offset;
5080 } else {
5081 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5082 inner_depth.increment()?;
5083 }
5084 let val_ref =
5085 self.device_info.get_or_insert_with(|| fidl::new_empty!(DeviceInfo, D));
5086 fidl::decode!(DeviceInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
5087 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5088 {
5089 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5090 }
5091 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5092 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5093 }
5094 }
5095
5096 next_offset += envelope_size;
5097 _next_ordinal_to_read += 1;
5098 if next_offset >= end_offset {
5099 return Ok(());
5100 }
5101
5102 while _next_ordinal_to_read < 2 {
5104 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5105 _next_ordinal_to_read += 1;
5106 next_offset += envelope_size;
5107 }
5108
5109 let next_out_of_line = decoder.next_out_of_line();
5110 let handles_before = decoder.remaining_handles();
5111 if let Some((inlined, num_bytes, num_handles)) =
5112 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5113 {
5114 let member_inline_size =
5115 <MouseDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5116 if inlined != (member_inline_size <= 4) {
5117 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5118 }
5119 let inner_offset;
5120 let mut inner_depth = depth.clone();
5121 if inlined {
5122 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5123 inner_offset = next_offset;
5124 } else {
5125 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5126 inner_depth.increment()?;
5127 }
5128 let val_ref =
5129 self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseDescriptor, D));
5130 fidl::decode!(MouseDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5131 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5132 {
5133 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5134 }
5135 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5136 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5137 }
5138 }
5139
5140 next_offset += envelope_size;
5141 _next_ordinal_to_read += 1;
5142 if next_offset >= end_offset {
5143 return Ok(());
5144 }
5145
5146 while _next_ordinal_to_read < 3 {
5148 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5149 _next_ordinal_to_read += 1;
5150 next_offset += envelope_size;
5151 }
5152
5153 let next_out_of_line = decoder.next_out_of_line();
5154 let handles_before = decoder.remaining_handles();
5155 if let Some((inlined, num_bytes, num_handles)) =
5156 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5157 {
5158 let member_inline_size =
5159 <SensorDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5160 if inlined != (member_inline_size <= 4) {
5161 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5162 }
5163 let inner_offset;
5164 let mut inner_depth = depth.clone();
5165 if inlined {
5166 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5167 inner_offset = next_offset;
5168 } else {
5169 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5170 inner_depth.increment()?;
5171 }
5172 let val_ref =
5173 self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorDescriptor, D));
5174 fidl::decode!(SensorDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5175 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5176 {
5177 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5178 }
5179 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5180 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5181 }
5182 }
5183
5184 next_offset += envelope_size;
5185 _next_ordinal_to_read += 1;
5186 if next_offset >= end_offset {
5187 return Ok(());
5188 }
5189
5190 while _next_ordinal_to_read < 4 {
5192 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5193 _next_ordinal_to_read += 1;
5194 next_offset += envelope_size;
5195 }
5196
5197 let next_out_of_line = decoder.next_out_of_line();
5198 let handles_before = decoder.remaining_handles();
5199 if let Some((inlined, num_bytes, num_handles)) =
5200 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5201 {
5202 let member_inline_size =
5203 <TouchDescriptor as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5204 if inlined != (member_inline_size <= 4) {
5205 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5206 }
5207 let inner_offset;
5208 let mut inner_depth = depth.clone();
5209 if inlined {
5210 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5211 inner_offset = next_offset;
5212 } else {
5213 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5214 inner_depth.increment()?;
5215 }
5216 let val_ref =
5217 self.touch.get_or_insert_with(|| fidl::new_empty!(TouchDescriptor, D));
5218 fidl::decode!(TouchDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5219 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5220 {
5221 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5222 }
5223 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5224 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5225 }
5226 }
5227
5228 next_offset += envelope_size;
5229 _next_ordinal_to_read += 1;
5230 if next_offset >= end_offset {
5231 return Ok(());
5232 }
5233
5234 while _next_ordinal_to_read < 5 {
5236 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5237 _next_ordinal_to_read += 1;
5238 next_offset += envelope_size;
5239 }
5240
5241 let next_out_of_line = decoder.next_out_of_line();
5242 let handles_before = decoder.remaining_handles();
5243 if let Some((inlined, num_bytes, num_handles)) =
5244 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5245 {
5246 let member_inline_size =
5247 <KeyboardDescriptor as fidl::encoding::TypeMarker>::inline_size(
5248 decoder.context,
5249 );
5250 if inlined != (member_inline_size <= 4) {
5251 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5252 }
5253 let inner_offset;
5254 let mut inner_depth = depth.clone();
5255 if inlined {
5256 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5257 inner_offset = next_offset;
5258 } else {
5259 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5260 inner_depth.increment()?;
5261 }
5262 let val_ref =
5263 self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardDescriptor, D));
5264 fidl::decode!(KeyboardDescriptor, D, val_ref, decoder, inner_offset, inner_depth)?;
5265 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5266 {
5267 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5268 }
5269 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5270 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5271 }
5272 }
5273
5274 next_offset += envelope_size;
5275 _next_ordinal_to_read += 1;
5276 if next_offset >= end_offset {
5277 return Ok(());
5278 }
5279
5280 while _next_ordinal_to_read < 6 {
5282 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5283 _next_ordinal_to_read += 1;
5284 next_offset += envelope_size;
5285 }
5286
5287 let next_out_of_line = decoder.next_out_of_line();
5288 let handles_before = decoder.remaining_handles();
5289 if let Some((inlined, num_bytes, num_handles)) =
5290 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5291 {
5292 let member_inline_size =
5293 <ConsumerControlDescriptor as fidl::encoding::TypeMarker>::inline_size(
5294 decoder.context,
5295 );
5296 if inlined != (member_inline_size <= 4) {
5297 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5298 }
5299 let inner_offset;
5300 let mut inner_depth = depth.clone();
5301 if inlined {
5302 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5303 inner_offset = next_offset;
5304 } else {
5305 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5306 inner_depth.increment()?;
5307 }
5308 let val_ref = self
5309 .consumer_control
5310 .get_or_insert_with(|| fidl::new_empty!(ConsumerControlDescriptor, D));
5311 fidl::decode!(
5312 ConsumerControlDescriptor,
5313 D,
5314 val_ref,
5315 decoder,
5316 inner_offset,
5317 inner_depth
5318 )?;
5319 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5320 {
5321 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5322 }
5323 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5324 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5325 }
5326 }
5327
5328 next_offset += envelope_size;
5329 _next_ordinal_to_read += 1;
5330 if next_offset >= end_offset {
5331 return Ok(());
5332 }
5333
5334 while _next_ordinal_to_read < 7 {
5336 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5337 _next_ordinal_to_read += 1;
5338 next_offset += envelope_size;
5339 }
5340
5341 let next_out_of_line = decoder.next_out_of_line();
5342 let handles_before = decoder.remaining_handles();
5343 if let Some((inlined, num_bytes, num_handles)) =
5344 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5345 {
5346 let member_inline_size =
5347 <DeviceInformation as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5348 if inlined != (member_inline_size <= 4) {
5349 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5350 }
5351 let inner_offset;
5352 let mut inner_depth = depth.clone();
5353 if inlined {
5354 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5355 inner_offset = next_offset;
5356 } else {
5357 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5358 inner_depth.increment()?;
5359 }
5360 let val_ref = self
5361 .device_information
5362 .get_or_insert_with(|| fidl::new_empty!(DeviceInformation, D));
5363 fidl::decode!(DeviceInformation, D, val_ref, decoder, inner_offset, inner_depth)?;
5364 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5365 {
5366 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5367 }
5368 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5369 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5370 }
5371 }
5372
5373 next_offset += envelope_size;
5374
5375 while next_offset < end_offset {
5377 _next_ordinal_to_read += 1;
5378 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5379 next_offset += envelope_size;
5380 }
5381
5382 Ok(())
5383 }
5384 }
5385
5386 impl DeviceInformation {
5387 #[inline(always)]
5388 fn max_ordinal_present(&self) -> u64 {
5389 if let Some(_) = self.polling_rate {
5390 return 4;
5391 }
5392 if let Some(_) = self.version {
5393 return 3;
5394 }
5395 if let Some(_) = self.product_id {
5396 return 2;
5397 }
5398 if let Some(_) = self.vendor_id {
5399 return 1;
5400 }
5401 0
5402 }
5403 }
5404
5405 impl fidl::encoding::ValueTypeMarker for DeviceInformation {
5406 type Borrowed<'a> = &'a Self;
5407 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5408 value
5409 }
5410 }
5411
5412 unsafe impl fidl::encoding::TypeMarker for DeviceInformation {
5413 type Owned = Self;
5414
5415 #[inline(always)]
5416 fn inline_align(_context: fidl::encoding::Context) -> usize {
5417 8
5418 }
5419
5420 #[inline(always)]
5421 fn inline_size(_context: fidl::encoding::Context) -> usize {
5422 16
5423 }
5424 }
5425
5426 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInformation, D>
5427 for &DeviceInformation
5428 {
5429 unsafe fn encode(
5430 self,
5431 encoder: &mut fidl::encoding::Encoder<'_, D>,
5432 offset: usize,
5433 mut depth: fidl::encoding::Depth,
5434 ) -> fidl::Result<()> {
5435 encoder.debug_check_bounds::<DeviceInformation>(offset);
5436 let max_ordinal: u64 = self.max_ordinal_present();
5438 encoder.write_num(max_ordinal, offset);
5439 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5440 if max_ordinal == 0 {
5442 return Ok(());
5443 }
5444 depth.increment()?;
5445 let envelope_size = 8;
5446 let bytes_len = max_ordinal as usize * envelope_size;
5447 #[allow(unused_variables)]
5448 let offset = encoder.out_of_line_offset(bytes_len);
5449 let mut _prev_end_offset: usize = 0;
5450 if 1 > max_ordinal {
5451 return Ok(());
5452 }
5453
5454 let cur_offset: usize = (1 - 1) * envelope_size;
5457
5458 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5460
5461 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5466 self.vendor_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5467 encoder,
5468 offset + cur_offset,
5469 depth,
5470 )?;
5471
5472 _prev_end_offset = cur_offset + envelope_size;
5473 if 2 > max_ordinal {
5474 return Ok(());
5475 }
5476
5477 let cur_offset: usize = (2 - 1) * envelope_size;
5480
5481 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5483
5484 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5489 self.product_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5490 encoder,
5491 offset + cur_offset,
5492 depth,
5493 )?;
5494
5495 _prev_end_offset = cur_offset + envelope_size;
5496 if 3 > max_ordinal {
5497 return Ok(());
5498 }
5499
5500 let cur_offset: usize = (3 - 1) * envelope_size;
5503
5504 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5506
5507 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5512 self.version.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5513 encoder,
5514 offset + cur_offset,
5515 depth,
5516 )?;
5517
5518 _prev_end_offset = cur_offset + envelope_size;
5519 if 4 > max_ordinal {
5520 return Ok(());
5521 }
5522
5523 let cur_offset: usize = (4 - 1) * envelope_size;
5526
5527 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5529
5530 fidl::encoding::encode_in_envelope_optional::<i64, D>(
5535 self.polling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5536 encoder,
5537 offset + cur_offset,
5538 depth,
5539 )?;
5540
5541 _prev_end_offset = cur_offset + envelope_size;
5542
5543 Ok(())
5544 }
5545 }
5546
5547 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInformation {
5548 #[inline(always)]
5549 fn new_empty() -> Self {
5550 Self::default()
5551 }
5552
5553 unsafe fn decode(
5554 &mut self,
5555 decoder: &mut fidl::encoding::Decoder<'_, D>,
5556 offset: usize,
5557 mut depth: fidl::encoding::Depth,
5558 ) -> fidl::Result<()> {
5559 decoder.debug_check_bounds::<Self>(offset);
5560 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5561 None => return Err(fidl::Error::NotNullable),
5562 Some(len) => len,
5563 };
5564 if len == 0 {
5566 return Ok(());
5567 };
5568 depth.increment()?;
5569 let envelope_size = 8;
5570 let bytes_len = len * envelope_size;
5571 let offset = decoder.out_of_line_offset(bytes_len)?;
5572 let mut _next_ordinal_to_read = 0;
5574 let mut next_offset = offset;
5575 let end_offset = offset + bytes_len;
5576 _next_ordinal_to_read += 1;
5577 if next_offset >= end_offset {
5578 return Ok(());
5579 }
5580
5581 while _next_ordinal_to_read < 1 {
5583 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5584 _next_ordinal_to_read += 1;
5585 next_offset += envelope_size;
5586 }
5587
5588 let next_out_of_line = decoder.next_out_of_line();
5589 let handles_before = decoder.remaining_handles();
5590 if let Some((inlined, num_bytes, num_handles)) =
5591 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5592 {
5593 let member_inline_size =
5594 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5595 if inlined != (member_inline_size <= 4) {
5596 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5597 }
5598 let inner_offset;
5599 let mut inner_depth = depth.clone();
5600 if inlined {
5601 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5602 inner_offset = next_offset;
5603 } else {
5604 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5605 inner_depth.increment()?;
5606 }
5607 let val_ref = self.vendor_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5608 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5609 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5610 {
5611 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5612 }
5613 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5614 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5615 }
5616 }
5617
5618 next_offset += envelope_size;
5619 _next_ordinal_to_read += 1;
5620 if next_offset >= end_offset {
5621 return Ok(());
5622 }
5623
5624 while _next_ordinal_to_read < 2 {
5626 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5627 _next_ordinal_to_read += 1;
5628 next_offset += envelope_size;
5629 }
5630
5631 let next_out_of_line = decoder.next_out_of_line();
5632 let handles_before = decoder.remaining_handles();
5633 if let Some((inlined, num_bytes, num_handles)) =
5634 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5635 {
5636 let member_inline_size =
5637 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5638 if inlined != (member_inline_size <= 4) {
5639 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5640 }
5641 let inner_offset;
5642 let mut inner_depth = depth.clone();
5643 if inlined {
5644 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5645 inner_offset = next_offset;
5646 } else {
5647 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5648 inner_depth.increment()?;
5649 }
5650 let val_ref = self.product_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
5651 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5652 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5653 {
5654 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5655 }
5656 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5657 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5658 }
5659 }
5660
5661 next_offset += envelope_size;
5662 _next_ordinal_to_read += 1;
5663 if next_offset >= end_offset {
5664 return Ok(());
5665 }
5666
5667 while _next_ordinal_to_read < 3 {
5669 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5670 _next_ordinal_to_read += 1;
5671 next_offset += envelope_size;
5672 }
5673
5674 let next_out_of_line = decoder.next_out_of_line();
5675 let handles_before = decoder.remaining_handles();
5676 if let Some((inlined, num_bytes, num_handles)) =
5677 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5678 {
5679 let member_inline_size =
5680 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5681 if inlined != (member_inline_size <= 4) {
5682 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5683 }
5684 let inner_offset;
5685 let mut inner_depth = depth.clone();
5686 if inlined {
5687 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5688 inner_offset = next_offset;
5689 } else {
5690 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5691 inner_depth.increment()?;
5692 }
5693 let val_ref = self.version.get_or_insert_with(|| fidl::new_empty!(u32, D));
5694 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
5695 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5696 {
5697 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5698 }
5699 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5700 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5701 }
5702 }
5703
5704 next_offset += envelope_size;
5705 _next_ordinal_to_read += 1;
5706 if next_offset >= end_offset {
5707 return Ok(());
5708 }
5709
5710 while _next_ordinal_to_read < 4 {
5712 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5713 _next_ordinal_to_read += 1;
5714 next_offset += envelope_size;
5715 }
5716
5717 let next_out_of_line = decoder.next_out_of_line();
5718 let handles_before = decoder.remaining_handles();
5719 if let Some((inlined, num_bytes, num_handles)) =
5720 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5721 {
5722 let member_inline_size =
5723 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5724 if inlined != (member_inline_size <= 4) {
5725 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5726 }
5727 let inner_offset;
5728 let mut inner_depth = depth.clone();
5729 if inlined {
5730 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5731 inner_offset = next_offset;
5732 } else {
5733 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5734 inner_depth.increment()?;
5735 }
5736 let val_ref = self.polling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
5737 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5738 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5739 {
5740 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5741 }
5742 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5743 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5744 }
5745 }
5746
5747 next_offset += envelope_size;
5748
5749 while next_offset < end_offset {
5751 _next_ordinal_to_read += 1;
5752 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5753 next_offset += envelope_size;
5754 }
5755
5756 Ok(())
5757 }
5758 }
5759
5760 impl FeatureReport {
5761 #[inline(always)]
5762 fn max_ordinal_present(&self) -> u64 {
5763 if let Some(_) = self.touch {
5764 return 2;
5765 }
5766 if let Some(_) = self.sensor {
5767 return 1;
5768 }
5769 0
5770 }
5771 }
5772
5773 impl fidl::encoding::ValueTypeMarker for FeatureReport {
5774 type Borrowed<'a> = &'a Self;
5775 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5776 value
5777 }
5778 }
5779
5780 unsafe impl fidl::encoding::TypeMarker for FeatureReport {
5781 type Owned = Self;
5782
5783 #[inline(always)]
5784 fn inline_align(_context: fidl::encoding::Context) -> usize {
5785 8
5786 }
5787
5788 #[inline(always)]
5789 fn inline_size(_context: fidl::encoding::Context) -> usize {
5790 16
5791 }
5792 }
5793
5794 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FeatureReport, D>
5795 for &FeatureReport
5796 {
5797 unsafe fn encode(
5798 self,
5799 encoder: &mut fidl::encoding::Encoder<'_, D>,
5800 offset: usize,
5801 mut depth: fidl::encoding::Depth,
5802 ) -> fidl::Result<()> {
5803 encoder.debug_check_bounds::<FeatureReport>(offset);
5804 let max_ordinal: u64 = self.max_ordinal_present();
5806 encoder.write_num(max_ordinal, offset);
5807 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5808 if max_ordinal == 0 {
5810 return Ok(());
5811 }
5812 depth.increment()?;
5813 let envelope_size = 8;
5814 let bytes_len = max_ordinal as usize * envelope_size;
5815 #[allow(unused_variables)]
5816 let offset = encoder.out_of_line_offset(bytes_len);
5817 let mut _prev_end_offset: usize = 0;
5818 if 1 > max_ordinal {
5819 return Ok(());
5820 }
5821
5822 let cur_offset: usize = (1 - 1) * envelope_size;
5825
5826 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5828
5829 fidl::encoding::encode_in_envelope_optional::<SensorFeatureReport, D>(
5834 self.sensor
5835 .as_ref()
5836 .map(<SensorFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5837 encoder,
5838 offset + cur_offset,
5839 depth,
5840 )?;
5841
5842 _prev_end_offset = cur_offset + envelope_size;
5843 if 2 > max_ordinal {
5844 return Ok(());
5845 }
5846
5847 let cur_offset: usize = (2 - 1) * envelope_size;
5850
5851 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5853
5854 fidl::encoding::encode_in_envelope_optional::<TouchFeatureReport, D>(
5859 self.touch
5860 .as_ref()
5861 .map(<TouchFeatureReport as fidl::encoding::ValueTypeMarker>::borrow),
5862 encoder,
5863 offset + cur_offset,
5864 depth,
5865 )?;
5866
5867 _prev_end_offset = cur_offset + envelope_size;
5868
5869 Ok(())
5870 }
5871 }
5872
5873 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FeatureReport {
5874 #[inline(always)]
5875 fn new_empty() -> Self {
5876 Self::default()
5877 }
5878
5879 unsafe fn decode(
5880 &mut self,
5881 decoder: &mut fidl::encoding::Decoder<'_, D>,
5882 offset: usize,
5883 mut depth: fidl::encoding::Depth,
5884 ) -> fidl::Result<()> {
5885 decoder.debug_check_bounds::<Self>(offset);
5886 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5887 None => return Err(fidl::Error::NotNullable),
5888 Some(len) => len,
5889 };
5890 if len == 0 {
5892 return Ok(());
5893 };
5894 depth.increment()?;
5895 let envelope_size = 8;
5896 let bytes_len = len * envelope_size;
5897 let offset = decoder.out_of_line_offset(bytes_len)?;
5898 let mut _next_ordinal_to_read = 0;
5900 let mut next_offset = offset;
5901 let end_offset = offset + bytes_len;
5902 _next_ordinal_to_read += 1;
5903 if next_offset >= end_offset {
5904 return Ok(());
5905 }
5906
5907 while _next_ordinal_to_read < 1 {
5909 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5910 _next_ordinal_to_read += 1;
5911 next_offset += envelope_size;
5912 }
5913
5914 let next_out_of_line = decoder.next_out_of_line();
5915 let handles_before = decoder.remaining_handles();
5916 if let Some((inlined, num_bytes, num_handles)) =
5917 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5918 {
5919 let member_inline_size =
5920 <SensorFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5921 decoder.context,
5922 );
5923 if inlined != (member_inline_size <= 4) {
5924 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5925 }
5926 let inner_offset;
5927 let mut inner_depth = depth.clone();
5928 if inlined {
5929 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5930 inner_offset = next_offset;
5931 } else {
5932 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5933 inner_depth.increment()?;
5934 }
5935 let val_ref =
5936 self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorFeatureReport, D));
5937 fidl::decode!(SensorFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5938 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5939 {
5940 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5941 }
5942 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5943 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5944 }
5945 }
5946
5947 next_offset += envelope_size;
5948 _next_ordinal_to_read += 1;
5949 if next_offset >= end_offset {
5950 return Ok(());
5951 }
5952
5953 while _next_ordinal_to_read < 2 {
5955 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5956 _next_ordinal_to_read += 1;
5957 next_offset += envelope_size;
5958 }
5959
5960 let next_out_of_line = decoder.next_out_of_line();
5961 let handles_before = decoder.remaining_handles();
5962 if let Some((inlined, num_bytes, num_handles)) =
5963 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5964 {
5965 let member_inline_size =
5966 <TouchFeatureReport as fidl::encoding::TypeMarker>::inline_size(
5967 decoder.context,
5968 );
5969 if inlined != (member_inline_size <= 4) {
5970 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5971 }
5972 let inner_offset;
5973 let mut inner_depth = depth.clone();
5974 if inlined {
5975 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5976 inner_offset = next_offset;
5977 } else {
5978 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5979 inner_depth.increment()?;
5980 }
5981 let val_ref =
5982 self.touch.get_or_insert_with(|| fidl::new_empty!(TouchFeatureReport, D));
5983 fidl::decode!(TouchFeatureReport, D, val_ref, decoder, inner_offset, inner_depth)?;
5984 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5985 {
5986 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5987 }
5988 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5989 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5990 }
5991 }
5992
5993 next_offset += envelope_size;
5994
5995 while next_offset < end_offset {
5997 _next_ordinal_to_read += 1;
5998 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5999 next_offset += envelope_size;
6000 }
6001
6002 Ok(())
6003 }
6004 }
6005
6006 impl InputReport {
6007 #[inline(always)]
6008 fn max_ordinal_present(&self) -> u64 {
6009 if let Some(_) = self.report_id {
6010 return 8;
6011 }
6012 if let Some(_) = self.consumer_control {
6013 return 7;
6014 }
6015 if let Some(_) = self.keyboard {
6016 return 6;
6017 }
6018 if let Some(_) = self.touch {
6019 return 5;
6020 }
6021 if let Some(_) = self.sensor {
6022 return 4;
6023 }
6024 if let Some(_) = self.trace_id {
6025 return 3;
6026 }
6027 if let Some(_) = self.mouse {
6028 return 2;
6029 }
6030 if let Some(_) = self.event_time {
6031 return 1;
6032 }
6033 0
6034 }
6035 }
6036
6037 impl fidl::encoding::ValueTypeMarker for InputReport {
6038 type Borrowed<'a> = &'a Self;
6039 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6040 value
6041 }
6042 }
6043
6044 unsafe impl fidl::encoding::TypeMarker for InputReport {
6045 type Owned = Self;
6046
6047 #[inline(always)]
6048 fn inline_align(_context: fidl::encoding::Context) -> usize {
6049 8
6050 }
6051
6052 #[inline(always)]
6053 fn inline_size(_context: fidl::encoding::Context) -> usize {
6054 16
6055 }
6056 }
6057
6058 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
6059 for &InputReport
6060 {
6061 unsafe fn encode(
6062 self,
6063 encoder: &mut fidl::encoding::Encoder<'_, D>,
6064 offset: usize,
6065 mut depth: fidl::encoding::Depth,
6066 ) -> fidl::Result<()> {
6067 encoder.debug_check_bounds::<InputReport>(offset);
6068 let max_ordinal: u64 = self.max_ordinal_present();
6070 encoder.write_num(max_ordinal, offset);
6071 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6072 if max_ordinal == 0 {
6074 return Ok(());
6075 }
6076 depth.increment()?;
6077 let envelope_size = 8;
6078 let bytes_len = max_ordinal as usize * envelope_size;
6079 #[allow(unused_variables)]
6080 let offset = encoder.out_of_line_offset(bytes_len);
6081 let mut _prev_end_offset: usize = 0;
6082 if 1 > max_ordinal {
6083 return Ok(());
6084 }
6085
6086 let cur_offset: usize = (1 - 1) * envelope_size;
6089
6090 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6092
6093 fidl::encoding::encode_in_envelope_optional::<i64, D>(
6098 self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
6099 encoder,
6100 offset + cur_offset,
6101 depth,
6102 )?;
6103
6104 _prev_end_offset = cur_offset + envelope_size;
6105 if 2 > max_ordinal {
6106 return Ok(());
6107 }
6108
6109 let cur_offset: usize = (2 - 1) * envelope_size;
6112
6113 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6115
6116 fidl::encoding::encode_in_envelope_optional::<MouseInputReport, D>(
6121 self.mouse
6122 .as_ref()
6123 .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6124 encoder,
6125 offset + cur_offset,
6126 depth,
6127 )?;
6128
6129 _prev_end_offset = cur_offset + envelope_size;
6130 if 3 > max_ordinal {
6131 return Ok(());
6132 }
6133
6134 let cur_offset: usize = (3 - 1) * envelope_size;
6137
6138 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6140
6141 fidl::encoding::encode_in_envelope_optional::<u64, D>(
6146 self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
6147 encoder,
6148 offset + cur_offset,
6149 depth,
6150 )?;
6151
6152 _prev_end_offset = cur_offset + envelope_size;
6153 if 4 > max_ordinal {
6154 return Ok(());
6155 }
6156
6157 let cur_offset: usize = (4 - 1) * envelope_size;
6160
6161 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6163
6164 fidl::encoding::encode_in_envelope_optional::<SensorInputReport, D>(
6169 self.sensor
6170 .as_ref()
6171 .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6172 encoder,
6173 offset + cur_offset,
6174 depth,
6175 )?;
6176
6177 _prev_end_offset = cur_offset + envelope_size;
6178 if 5 > max_ordinal {
6179 return Ok(());
6180 }
6181
6182 let cur_offset: usize = (5 - 1) * envelope_size;
6185
6186 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6188
6189 fidl::encoding::encode_in_envelope_optional::<TouchInputReport, D>(
6194 self.touch
6195 .as_ref()
6196 .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6197 encoder,
6198 offset + cur_offset,
6199 depth,
6200 )?;
6201
6202 _prev_end_offset = cur_offset + envelope_size;
6203 if 6 > max_ordinal {
6204 return Ok(());
6205 }
6206
6207 let cur_offset: usize = (6 - 1) * envelope_size;
6210
6211 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6213
6214 fidl::encoding::encode_in_envelope_optional::<KeyboardInputReport, D>(
6219 self.keyboard
6220 .as_ref()
6221 .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6222 encoder,
6223 offset + cur_offset,
6224 depth,
6225 )?;
6226
6227 _prev_end_offset = cur_offset + envelope_size;
6228 if 7 > max_ordinal {
6229 return Ok(());
6230 }
6231
6232 let cur_offset: usize = (7 - 1) * envelope_size;
6235
6236 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6238
6239 fidl::encoding::encode_in_envelope_optional::<ConsumerControlInputReport, D>(
6244 self.consumer_control
6245 .as_ref()
6246 .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
6247 encoder,
6248 offset + cur_offset,
6249 depth,
6250 )?;
6251
6252 _prev_end_offset = cur_offset + envelope_size;
6253 if 8 > max_ordinal {
6254 return Ok(());
6255 }
6256
6257 let cur_offset: usize = (8 - 1) * envelope_size;
6260
6261 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6263
6264 fidl::encoding::encode_in_envelope_optional::<u8, D>(
6269 self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
6270 encoder,
6271 offset + cur_offset,
6272 depth,
6273 )?;
6274
6275 _prev_end_offset = cur_offset + envelope_size;
6276
6277 Ok(())
6278 }
6279 }
6280
6281 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
6282 #[inline(always)]
6283 fn new_empty() -> Self {
6284 Self::default()
6285 }
6286
6287 unsafe fn decode(
6288 &mut self,
6289 decoder: &mut fidl::encoding::Decoder<'_, D>,
6290 offset: usize,
6291 mut depth: fidl::encoding::Depth,
6292 ) -> fidl::Result<()> {
6293 decoder.debug_check_bounds::<Self>(offset);
6294 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6295 None => return Err(fidl::Error::NotNullable),
6296 Some(len) => len,
6297 };
6298 if len == 0 {
6300 return Ok(());
6301 };
6302 depth.increment()?;
6303 let envelope_size = 8;
6304 let bytes_len = len * envelope_size;
6305 let offset = decoder.out_of_line_offset(bytes_len)?;
6306 let mut _next_ordinal_to_read = 0;
6308 let mut next_offset = offset;
6309 let end_offset = offset + bytes_len;
6310 _next_ordinal_to_read += 1;
6311 if next_offset >= end_offset {
6312 return Ok(());
6313 }
6314
6315 while _next_ordinal_to_read < 1 {
6317 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6318 _next_ordinal_to_read += 1;
6319 next_offset += envelope_size;
6320 }
6321
6322 let next_out_of_line = decoder.next_out_of_line();
6323 let handles_before = decoder.remaining_handles();
6324 if let Some((inlined, num_bytes, num_handles)) =
6325 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6326 {
6327 let member_inline_size =
6328 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6329 if inlined != (member_inline_size <= 4) {
6330 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6331 }
6332 let inner_offset;
6333 let mut inner_depth = depth.clone();
6334 if inlined {
6335 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6336 inner_offset = next_offset;
6337 } else {
6338 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6339 inner_depth.increment()?;
6340 }
6341 let val_ref = self.event_time.get_or_insert_with(|| fidl::new_empty!(i64, D));
6342 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
6343 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6344 {
6345 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6346 }
6347 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6348 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6349 }
6350 }
6351
6352 next_offset += envelope_size;
6353 _next_ordinal_to_read += 1;
6354 if next_offset >= end_offset {
6355 return Ok(());
6356 }
6357
6358 while _next_ordinal_to_read < 2 {
6360 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6361 _next_ordinal_to_read += 1;
6362 next_offset += envelope_size;
6363 }
6364
6365 let next_out_of_line = decoder.next_out_of_line();
6366 let handles_before = decoder.remaining_handles();
6367 if let Some((inlined, num_bytes, num_handles)) =
6368 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6369 {
6370 let member_inline_size =
6371 <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6372 if inlined != (member_inline_size <= 4) {
6373 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6374 }
6375 let inner_offset;
6376 let mut inner_depth = depth.clone();
6377 if inlined {
6378 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6379 inner_offset = next_offset;
6380 } else {
6381 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6382 inner_depth.increment()?;
6383 }
6384 let val_ref =
6385 self.mouse.get_or_insert_with(|| fidl::new_empty!(MouseInputReport, D));
6386 fidl::decode!(MouseInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6387 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6388 {
6389 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6390 }
6391 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6392 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6393 }
6394 }
6395
6396 next_offset += envelope_size;
6397 _next_ordinal_to_read += 1;
6398 if next_offset >= end_offset {
6399 return Ok(());
6400 }
6401
6402 while _next_ordinal_to_read < 3 {
6404 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6405 _next_ordinal_to_read += 1;
6406 next_offset += envelope_size;
6407 }
6408
6409 let next_out_of_line = decoder.next_out_of_line();
6410 let handles_before = decoder.remaining_handles();
6411 if let Some((inlined, num_bytes, num_handles)) =
6412 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6413 {
6414 let member_inline_size =
6415 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6416 if inlined != (member_inline_size <= 4) {
6417 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6418 }
6419 let inner_offset;
6420 let mut inner_depth = depth.clone();
6421 if inlined {
6422 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6423 inner_offset = next_offset;
6424 } else {
6425 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6426 inner_depth.increment()?;
6427 }
6428 let val_ref = self.trace_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
6429 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
6430 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6431 {
6432 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6433 }
6434 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6435 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6436 }
6437 }
6438
6439 next_offset += envelope_size;
6440 _next_ordinal_to_read += 1;
6441 if next_offset >= end_offset {
6442 return Ok(());
6443 }
6444
6445 while _next_ordinal_to_read < 4 {
6447 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6448 _next_ordinal_to_read += 1;
6449 next_offset += envelope_size;
6450 }
6451
6452 let next_out_of_line = decoder.next_out_of_line();
6453 let handles_before = decoder.remaining_handles();
6454 if let Some((inlined, num_bytes, num_handles)) =
6455 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6456 {
6457 let member_inline_size =
6458 <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6459 if inlined != (member_inline_size <= 4) {
6460 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6461 }
6462 let inner_offset;
6463 let mut inner_depth = depth.clone();
6464 if inlined {
6465 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6466 inner_offset = next_offset;
6467 } else {
6468 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6469 inner_depth.increment()?;
6470 }
6471 let val_ref =
6472 self.sensor.get_or_insert_with(|| fidl::new_empty!(SensorInputReport, D));
6473 fidl::decode!(SensorInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6474 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6475 {
6476 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6477 }
6478 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6479 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6480 }
6481 }
6482
6483 next_offset += envelope_size;
6484 _next_ordinal_to_read += 1;
6485 if next_offset >= end_offset {
6486 return Ok(());
6487 }
6488
6489 while _next_ordinal_to_read < 5 {
6491 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6492 _next_ordinal_to_read += 1;
6493 next_offset += envelope_size;
6494 }
6495
6496 let next_out_of_line = decoder.next_out_of_line();
6497 let handles_before = decoder.remaining_handles();
6498 if let Some((inlined, num_bytes, num_handles)) =
6499 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6500 {
6501 let member_inline_size =
6502 <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6503 if inlined != (member_inline_size <= 4) {
6504 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6505 }
6506 let inner_offset;
6507 let mut inner_depth = depth.clone();
6508 if inlined {
6509 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6510 inner_offset = next_offset;
6511 } else {
6512 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6513 inner_depth.increment()?;
6514 }
6515 let val_ref =
6516 self.touch.get_or_insert_with(|| fidl::new_empty!(TouchInputReport, D));
6517 fidl::decode!(TouchInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6519 {
6520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6521 }
6522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6524 }
6525 }
6526
6527 next_offset += envelope_size;
6528 _next_ordinal_to_read += 1;
6529 if next_offset >= end_offset {
6530 return Ok(());
6531 }
6532
6533 while _next_ordinal_to_read < 6 {
6535 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6536 _next_ordinal_to_read += 1;
6537 next_offset += envelope_size;
6538 }
6539
6540 let next_out_of_line = decoder.next_out_of_line();
6541 let handles_before = decoder.remaining_handles();
6542 if let Some((inlined, num_bytes, num_handles)) =
6543 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6544 {
6545 let member_inline_size =
6546 <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
6547 decoder.context,
6548 );
6549 if inlined != (member_inline_size <= 4) {
6550 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6551 }
6552 let inner_offset;
6553 let mut inner_depth = depth.clone();
6554 if inlined {
6555 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6556 inner_offset = next_offset;
6557 } else {
6558 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6559 inner_depth.increment()?;
6560 }
6561 let val_ref =
6562 self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardInputReport, D));
6563 fidl::decode!(KeyboardInputReport, D, val_ref, decoder, inner_offset, inner_depth)?;
6564 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6565 {
6566 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6567 }
6568 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6569 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6570 }
6571 }
6572
6573 next_offset += envelope_size;
6574 _next_ordinal_to_read += 1;
6575 if next_offset >= end_offset {
6576 return Ok(());
6577 }
6578
6579 while _next_ordinal_to_read < 7 {
6581 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6582 _next_ordinal_to_read += 1;
6583 next_offset += envelope_size;
6584 }
6585
6586 let next_out_of_line = decoder.next_out_of_line();
6587 let handles_before = decoder.remaining_handles();
6588 if let Some((inlined, num_bytes, num_handles)) =
6589 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6590 {
6591 let member_inline_size =
6592 <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
6593 decoder.context,
6594 );
6595 if inlined != (member_inline_size <= 4) {
6596 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6597 }
6598 let inner_offset;
6599 let mut inner_depth = depth.clone();
6600 if inlined {
6601 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6602 inner_offset = next_offset;
6603 } else {
6604 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6605 inner_depth.increment()?;
6606 }
6607 let val_ref = self
6608 .consumer_control
6609 .get_or_insert_with(|| fidl::new_empty!(ConsumerControlInputReport, D));
6610 fidl::decode!(
6611 ConsumerControlInputReport,
6612 D,
6613 val_ref,
6614 decoder,
6615 inner_offset,
6616 inner_depth
6617 )?;
6618 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6619 {
6620 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6621 }
6622 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6623 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6624 }
6625 }
6626
6627 next_offset += envelope_size;
6628 _next_ordinal_to_read += 1;
6629 if next_offset >= end_offset {
6630 return Ok(());
6631 }
6632
6633 while _next_ordinal_to_read < 8 {
6635 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6636 _next_ordinal_to_read += 1;
6637 next_offset += envelope_size;
6638 }
6639
6640 let next_out_of_line = decoder.next_out_of_line();
6641 let handles_before = decoder.remaining_handles();
6642 if let Some((inlined, num_bytes, num_handles)) =
6643 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6644 {
6645 let member_inline_size =
6646 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6647 if inlined != (member_inline_size <= 4) {
6648 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6649 }
6650 let inner_offset;
6651 let mut inner_depth = depth.clone();
6652 if inlined {
6653 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6654 inner_offset = next_offset;
6655 } else {
6656 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6657 inner_depth.increment()?;
6658 }
6659 let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
6660 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
6661 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6662 {
6663 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6664 }
6665 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6666 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6667 }
6668 }
6669
6670 next_offset += envelope_size;
6671
6672 while next_offset < end_offset {
6674 _next_ordinal_to_read += 1;
6675 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6676 next_offset += envelope_size;
6677 }
6678
6679 Ok(())
6680 }
6681 }
6682
6683 impl KeyboardDescriptor {
6684 #[inline(always)]
6685 fn max_ordinal_present(&self) -> u64 {
6686 if let Some(_) = self.output {
6687 return 2;
6688 }
6689 if let Some(_) = self.input {
6690 return 1;
6691 }
6692 0
6693 }
6694 }
6695
6696 impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
6697 type Borrowed<'a> = &'a Self;
6698 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6699 value
6700 }
6701 }
6702
6703 unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
6704 type Owned = Self;
6705
6706 #[inline(always)]
6707 fn inline_align(_context: fidl::encoding::Context) -> usize {
6708 8
6709 }
6710
6711 #[inline(always)]
6712 fn inline_size(_context: fidl::encoding::Context) -> usize {
6713 16
6714 }
6715 }
6716
6717 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
6718 for &KeyboardDescriptor
6719 {
6720 unsafe fn encode(
6721 self,
6722 encoder: &mut fidl::encoding::Encoder<'_, D>,
6723 offset: usize,
6724 mut depth: fidl::encoding::Depth,
6725 ) -> fidl::Result<()> {
6726 encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
6727 let max_ordinal: u64 = self.max_ordinal_present();
6729 encoder.write_num(max_ordinal, offset);
6730 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6731 if max_ordinal == 0 {
6733 return Ok(());
6734 }
6735 depth.increment()?;
6736 let envelope_size = 8;
6737 let bytes_len = max_ordinal as usize * envelope_size;
6738 #[allow(unused_variables)]
6739 let offset = encoder.out_of_line_offset(bytes_len);
6740 let mut _prev_end_offset: usize = 0;
6741 if 1 > max_ordinal {
6742 return Ok(());
6743 }
6744
6745 let cur_offset: usize = (1 - 1) * envelope_size;
6748
6749 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6751
6752 fidl::encoding::encode_in_envelope_optional::<KeyboardInputDescriptor, D>(
6757 self.input
6758 .as_ref()
6759 .map(<KeyboardInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6760 encoder,
6761 offset + cur_offset,
6762 depth,
6763 )?;
6764
6765 _prev_end_offset = cur_offset + envelope_size;
6766 if 2 > max_ordinal {
6767 return Ok(());
6768 }
6769
6770 let cur_offset: usize = (2 - 1) * envelope_size;
6773
6774 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
6776
6777 fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
6782 self.output
6783 .as_ref()
6784 .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
6785 encoder,
6786 offset + cur_offset,
6787 depth,
6788 )?;
6789
6790 _prev_end_offset = cur_offset + envelope_size;
6791
6792 Ok(())
6793 }
6794 }
6795
6796 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
6797 #[inline(always)]
6798 fn new_empty() -> Self {
6799 Self::default()
6800 }
6801
6802 unsafe fn decode(
6803 &mut self,
6804 decoder: &mut fidl::encoding::Decoder<'_, D>,
6805 offset: usize,
6806 mut depth: fidl::encoding::Depth,
6807 ) -> fidl::Result<()> {
6808 decoder.debug_check_bounds::<Self>(offset);
6809 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6810 None => return Err(fidl::Error::NotNullable),
6811 Some(len) => len,
6812 };
6813 if len == 0 {
6815 return Ok(());
6816 };
6817 depth.increment()?;
6818 let envelope_size = 8;
6819 let bytes_len = len * envelope_size;
6820 let offset = decoder.out_of_line_offset(bytes_len)?;
6821 let mut _next_ordinal_to_read = 0;
6823 let mut next_offset = offset;
6824 let end_offset = offset + bytes_len;
6825 _next_ordinal_to_read += 1;
6826 if next_offset >= end_offset {
6827 return Ok(());
6828 }
6829
6830 while _next_ordinal_to_read < 1 {
6832 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6833 _next_ordinal_to_read += 1;
6834 next_offset += envelope_size;
6835 }
6836
6837 let next_out_of_line = decoder.next_out_of_line();
6838 let handles_before = decoder.remaining_handles();
6839 if let Some((inlined, num_bytes, num_handles)) =
6840 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6841 {
6842 let member_inline_size =
6843 <KeyboardInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6844 decoder.context,
6845 );
6846 if inlined != (member_inline_size <= 4) {
6847 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6848 }
6849 let inner_offset;
6850 let mut inner_depth = depth.clone();
6851 if inlined {
6852 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6853 inner_offset = next_offset;
6854 } else {
6855 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6856 inner_depth.increment()?;
6857 }
6858 let val_ref =
6859 self.input.get_or_insert_with(|| fidl::new_empty!(KeyboardInputDescriptor, D));
6860 fidl::decode!(
6861 KeyboardInputDescriptor,
6862 D,
6863 val_ref,
6864 decoder,
6865 inner_offset,
6866 inner_depth
6867 )?;
6868 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6869 {
6870 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6871 }
6872 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6873 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6874 }
6875 }
6876
6877 next_offset += envelope_size;
6878 _next_ordinal_to_read += 1;
6879 if next_offset >= end_offset {
6880 return Ok(());
6881 }
6882
6883 while _next_ordinal_to_read < 2 {
6885 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6886 _next_ordinal_to_read += 1;
6887 next_offset += envelope_size;
6888 }
6889
6890 let next_out_of_line = decoder.next_out_of_line();
6891 let handles_before = decoder.remaining_handles();
6892 if let Some((inlined, num_bytes, num_handles)) =
6893 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6894 {
6895 let member_inline_size =
6896 <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
6897 decoder.context,
6898 );
6899 if inlined != (member_inline_size <= 4) {
6900 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6901 }
6902 let inner_offset;
6903 let mut inner_depth = depth.clone();
6904 if inlined {
6905 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6906 inner_offset = next_offset;
6907 } else {
6908 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6909 inner_depth.increment()?;
6910 }
6911 let val_ref = self
6912 .output
6913 .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
6914 fidl::decode!(
6915 KeyboardOutputDescriptor,
6916 D,
6917 val_ref,
6918 decoder,
6919 inner_offset,
6920 inner_depth
6921 )?;
6922 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6923 {
6924 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6925 }
6926 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6927 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6928 }
6929 }
6930
6931 next_offset += envelope_size;
6932
6933 while next_offset < end_offset {
6935 _next_ordinal_to_read += 1;
6936 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6937 next_offset += envelope_size;
6938 }
6939
6940 Ok(())
6941 }
6942 }
6943
6944 impl KeyboardInputDescriptor {
6945 #[inline(always)]
6946 fn max_ordinal_present(&self) -> u64 {
6947 if let Some(_) = self.keys3 {
6948 return 2;
6949 }
6950 0
6951 }
6952 }
6953
6954 impl fidl::encoding::ValueTypeMarker for KeyboardInputDescriptor {
6955 type Borrowed<'a> = &'a Self;
6956 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6957 value
6958 }
6959 }
6960
6961 unsafe impl fidl::encoding::TypeMarker for KeyboardInputDescriptor {
6962 type Owned = Self;
6963
6964 #[inline(always)]
6965 fn inline_align(_context: fidl::encoding::Context) -> usize {
6966 8
6967 }
6968
6969 #[inline(always)]
6970 fn inline_size(_context: fidl::encoding::Context) -> usize {
6971 16
6972 }
6973 }
6974
6975 unsafe impl<D: fidl::encoding::ResourceDialect>
6976 fidl::encoding::Encode<KeyboardInputDescriptor, D> for &KeyboardInputDescriptor
6977 {
6978 unsafe fn encode(
6979 self,
6980 encoder: &mut fidl::encoding::Encoder<'_, D>,
6981 offset: usize,
6982 mut depth: fidl::encoding::Depth,
6983 ) -> fidl::Result<()> {
6984 encoder.debug_check_bounds::<KeyboardInputDescriptor>(offset);
6985 let max_ordinal: u64 = self.max_ordinal_present();
6987 encoder.write_num(max_ordinal, offset);
6988 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6989 if max_ordinal == 0 {
6991 return Ok(());
6992 }
6993 depth.increment()?;
6994 let envelope_size = 8;
6995 let bytes_len = max_ordinal as usize * envelope_size;
6996 #[allow(unused_variables)]
6997 let offset = encoder.out_of_line_offset(bytes_len);
6998 let mut _prev_end_offset: usize = 0;
6999 if 2 > max_ordinal {
7000 return Ok(());
7001 }
7002
7003 let cur_offset: usize = (2 - 1) * envelope_size;
7006
7007 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7009
7010 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input::Key, 256>, D>(
7015 self.keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7016 encoder, offset + cur_offset, depth
7017 )?;
7018
7019 _prev_end_offset = cur_offset + envelope_size;
7020
7021 Ok(())
7022 }
7023 }
7024
7025 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7026 for KeyboardInputDescriptor
7027 {
7028 #[inline(always)]
7029 fn new_empty() -> Self {
7030 Self::default()
7031 }
7032
7033 unsafe fn decode(
7034 &mut self,
7035 decoder: &mut fidl::encoding::Decoder<'_, D>,
7036 offset: usize,
7037 mut depth: fidl::encoding::Depth,
7038 ) -> fidl::Result<()> {
7039 decoder.debug_check_bounds::<Self>(offset);
7040 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7041 None => return Err(fidl::Error::NotNullable),
7042 Some(len) => len,
7043 };
7044 if len == 0 {
7046 return Ok(());
7047 };
7048 depth.increment()?;
7049 let envelope_size = 8;
7050 let bytes_len = len * envelope_size;
7051 let offset = decoder.out_of_line_offset(bytes_len)?;
7052 let mut _next_ordinal_to_read = 0;
7054 let mut next_offset = offset;
7055 let end_offset = offset + bytes_len;
7056 _next_ordinal_to_read += 1;
7057 if next_offset >= end_offset {
7058 return Ok(());
7059 }
7060
7061 while _next_ordinal_to_read < 2 {
7063 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7064 _next_ordinal_to_read += 1;
7065 next_offset += envelope_size;
7066 }
7067
7068 let next_out_of_line = decoder.next_out_of_line();
7069 let handles_before = decoder.remaining_handles();
7070 if let Some((inlined, num_bytes, num_handles)) =
7071 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7072 {
7073 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_input::Key, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7074 if inlined != (member_inline_size <= 4) {
7075 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7076 }
7077 let inner_offset;
7078 let mut inner_depth = depth.clone();
7079 if inlined {
7080 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7081 inner_offset = next_offset;
7082 } else {
7083 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7084 inner_depth.increment()?;
7085 }
7086 let val_ref = self.keys3.get_or_insert_with(
7087 || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input::Key, 256>, D),
7088 );
7089 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7090 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7091 {
7092 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7093 }
7094 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7095 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7096 }
7097 }
7098
7099 next_offset += envelope_size;
7100
7101 while next_offset < end_offset {
7103 _next_ordinal_to_read += 1;
7104 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7105 next_offset += envelope_size;
7106 }
7107
7108 Ok(())
7109 }
7110 }
7111
7112 impl KeyboardInputReport {
7113 #[inline(always)]
7114 fn max_ordinal_present(&self) -> u64 {
7115 if let Some(_) = self.pressed_keys3 {
7116 return 2;
7117 }
7118 0
7119 }
7120 }
7121
7122 impl fidl::encoding::ValueTypeMarker for KeyboardInputReport {
7123 type Borrowed<'a> = &'a Self;
7124 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7125 value
7126 }
7127 }
7128
7129 unsafe impl fidl::encoding::TypeMarker for KeyboardInputReport {
7130 type Owned = Self;
7131
7132 #[inline(always)]
7133 fn inline_align(_context: fidl::encoding::Context) -> usize {
7134 8
7135 }
7136
7137 #[inline(always)]
7138 fn inline_size(_context: fidl::encoding::Context) -> usize {
7139 16
7140 }
7141 }
7142
7143 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardInputReport, D>
7144 for &KeyboardInputReport
7145 {
7146 unsafe fn encode(
7147 self,
7148 encoder: &mut fidl::encoding::Encoder<'_, D>,
7149 offset: usize,
7150 mut depth: fidl::encoding::Depth,
7151 ) -> fidl::Result<()> {
7152 encoder.debug_check_bounds::<KeyboardInputReport>(offset);
7153 let max_ordinal: u64 = self.max_ordinal_present();
7155 encoder.write_num(max_ordinal, offset);
7156 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7157 if max_ordinal == 0 {
7159 return Ok(());
7160 }
7161 depth.increment()?;
7162 let envelope_size = 8;
7163 let bytes_len = max_ordinal as usize * envelope_size;
7164 #[allow(unused_variables)]
7165 let offset = encoder.out_of_line_offset(bytes_len);
7166 let mut _prev_end_offset: usize = 0;
7167 if 2 > max_ordinal {
7168 return Ok(());
7169 }
7170
7171 let cur_offset: usize = (2 - 1) * envelope_size;
7174
7175 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7177
7178 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_input::Key, 256>, D>(
7183 self.pressed_keys3.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_input::Key, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7184 encoder, offset + cur_offset, depth
7185 )?;
7186
7187 _prev_end_offset = cur_offset + envelope_size;
7188
7189 Ok(())
7190 }
7191 }
7192
7193 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardInputReport {
7194 #[inline(always)]
7195 fn new_empty() -> Self {
7196 Self::default()
7197 }
7198
7199 unsafe fn decode(
7200 &mut self,
7201 decoder: &mut fidl::encoding::Decoder<'_, D>,
7202 offset: usize,
7203 mut depth: fidl::encoding::Depth,
7204 ) -> fidl::Result<()> {
7205 decoder.debug_check_bounds::<Self>(offset);
7206 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7207 None => return Err(fidl::Error::NotNullable),
7208 Some(len) => len,
7209 };
7210 if len == 0 {
7212 return Ok(());
7213 };
7214 depth.increment()?;
7215 let envelope_size = 8;
7216 let bytes_len = len * envelope_size;
7217 let offset = decoder.out_of_line_offset(bytes_len)?;
7218 let mut _next_ordinal_to_read = 0;
7220 let mut next_offset = offset;
7221 let end_offset = offset + bytes_len;
7222 _next_ordinal_to_read += 1;
7223 if next_offset >= end_offset {
7224 return Ok(());
7225 }
7226
7227 while _next_ordinal_to_read < 2 {
7229 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7230 _next_ordinal_to_read += 1;
7231 next_offset += envelope_size;
7232 }
7233
7234 let next_out_of_line = decoder.next_out_of_line();
7235 let handles_before = decoder.remaining_handles();
7236 if let Some((inlined, num_bytes, num_handles)) =
7237 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7238 {
7239 let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_input::Key, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7240 if inlined != (member_inline_size <= 4) {
7241 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7242 }
7243 let inner_offset;
7244 let mut inner_depth = depth.clone();
7245 if inlined {
7246 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7247 inner_offset = next_offset;
7248 } else {
7249 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7250 inner_depth.increment()?;
7251 }
7252 let val_ref = self.pressed_keys3.get_or_insert_with(
7253 || fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_input::Key, 256>, D),
7254 );
7255 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_input::Key, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7256 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7257 {
7258 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7259 }
7260 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7261 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7262 }
7263 }
7264
7265 next_offset += envelope_size;
7266
7267 while next_offset < end_offset {
7269 _next_ordinal_to_read += 1;
7270 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7271 next_offset += envelope_size;
7272 }
7273
7274 Ok(())
7275 }
7276 }
7277
7278 impl KeyboardOutputDescriptor {
7279 #[inline(always)]
7280 fn max_ordinal_present(&self) -> u64 {
7281 if let Some(_) = self.leds {
7282 return 1;
7283 }
7284 0
7285 }
7286 }
7287
7288 impl fidl::encoding::ValueTypeMarker for KeyboardOutputDescriptor {
7289 type Borrowed<'a> = &'a Self;
7290 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7291 value
7292 }
7293 }
7294
7295 unsafe impl fidl::encoding::TypeMarker for KeyboardOutputDescriptor {
7296 type Owned = Self;
7297
7298 #[inline(always)]
7299 fn inline_align(_context: fidl::encoding::Context) -> usize {
7300 8
7301 }
7302
7303 #[inline(always)]
7304 fn inline_size(_context: fidl::encoding::Context) -> usize {
7305 16
7306 }
7307 }
7308
7309 unsafe impl<D: fidl::encoding::ResourceDialect>
7310 fidl::encoding::Encode<KeyboardOutputDescriptor, D> for &KeyboardOutputDescriptor
7311 {
7312 unsafe fn encode(
7313 self,
7314 encoder: &mut fidl::encoding::Encoder<'_, D>,
7315 offset: usize,
7316 mut depth: fidl::encoding::Depth,
7317 ) -> fidl::Result<()> {
7318 encoder.debug_check_bounds::<KeyboardOutputDescriptor>(offset);
7319 let max_ordinal: u64 = self.max_ordinal_present();
7321 encoder.write_num(max_ordinal, offset);
7322 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7323 if max_ordinal == 0 {
7325 return Ok(());
7326 }
7327 depth.increment()?;
7328 let envelope_size = 8;
7329 let bytes_len = max_ordinal as usize * envelope_size;
7330 #[allow(unused_variables)]
7331 let offset = encoder.out_of_line_offset(bytes_len);
7332 let mut _prev_end_offset: usize = 0;
7333 if 1 > max_ordinal {
7334 return Ok(());
7335 }
7336
7337 let cur_offset: usize = (1 - 1) * envelope_size;
7340
7341 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7343
7344 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7349 self.leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7350 encoder, offset + cur_offset, depth
7351 )?;
7352
7353 _prev_end_offset = cur_offset + envelope_size;
7354
7355 Ok(())
7356 }
7357 }
7358
7359 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
7360 for KeyboardOutputDescriptor
7361 {
7362 #[inline(always)]
7363 fn new_empty() -> Self {
7364 Self::default()
7365 }
7366
7367 unsafe fn decode(
7368 &mut self,
7369 decoder: &mut fidl::encoding::Decoder<'_, D>,
7370 offset: usize,
7371 mut depth: fidl::encoding::Depth,
7372 ) -> fidl::Result<()> {
7373 decoder.debug_check_bounds::<Self>(offset);
7374 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7375 None => return Err(fidl::Error::NotNullable),
7376 Some(len) => len,
7377 };
7378 if len == 0 {
7380 return Ok(());
7381 };
7382 depth.increment()?;
7383 let envelope_size = 8;
7384 let bytes_len = len * envelope_size;
7385 let offset = decoder.out_of_line_offset(bytes_len)?;
7386 let mut _next_ordinal_to_read = 0;
7388 let mut next_offset = offset;
7389 let end_offset = offset + bytes_len;
7390 _next_ordinal_to_read += 1;
7391 if next_offset >= end_offset {
7392 return Ok(());
7393 }
7394
7395 while _next_ordinal_to_read < 1 {
7397 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7398 _next_ordinal_to_read += 1;
7399 next_offset += envelope_size;
7400 }
7401
7402 let next_out_of_line = decoder.next_out_of_line();
7403 let handles_before = decoder.remaining_handles();
7404 if let Some((inlined, num_bytes, num_handles)) =
7405 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7406 {
7407 let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7408 if inlined != (member_inline_size <= 4) {
7409 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7410 }
7411 let inner_offset;
7412 let mut inner_depth = depth.clone();
7413 if inlined {
7414 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7415 inner_offset = next_offset;
7416 } else {
7417 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7418 inner_depth.increment()?;
7419 }
7420 let val_ref = self.leds.get_or_insert_with(
7421 || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7422 );
7423 fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7424 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7425 {
7426 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7427 }
7428 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7429 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7430 }
7431 }
7432
7433 next_offset += envelope_size;
7434
7435 while next_offset < end_offset {
7437 _next_ordinal_to_read += 1;
7438 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7439 next_offset += envelope_size;
7440 }
7441
7442 Ok(())
7443 }
7444 }
7445
7446 impl KeyboardOutputReport {
7447 #[inline(always)]
7448 fn max_ordinal_present(&self) -> u64 {
7449 if let Some(_) = self.enabled_leds {
7450 return 1;
7451 }
7452 0
7453 }
7454 }
7455
7456 impl fidl::encoding::ValueTypeMarker for KeyboardOutputReport {
7457 type Borrowed<'a> = &'a Self;
7458 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7459 value
7460 }
7461 }
7462
7463 unsafe impl fidl::encoding::TypeMarker for KeyboardOutputReport {
7464 type Owned = Self;
7465
7466 #[inline(always)]
7467 fn inline_align(_context: fidl::encoding::Context) -> usize {
7468 8
7469 }
7470
7471 #[inline(always)]
7472 fn inline_size(_context: fidl::encoding::Context) -> usize {
7473 16
7474 }
7475 }
7476
7477 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardOutputReport, D>
7478 for &KeyboardOutputReport
7479 {
7480 unsafe fn encode(
7481 self,
7482 encoder: &mut fidl::encoding::Encoder<'_, D>,
7483 offset: usize,
7484 mut depth: fidl::encoding::Depth,
7485 ) -> fidl::Result<()> {
7486 encoder.debug_check_bounds::<KeyboardOutputReport>(offset);
7487 let max_ordinal: u64 = self.max_ordinal_present();
7489 encoder.write_num(max_ordinal, offset);
7490 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7491 if max_ordinal == 0 {
7493 return Ok(());
7494 }
7495 depth.increment()?;
7496 let envelope_size = 8;
7497 let bytes_len = max_ordinal as usize * envelope_size;
7498 #[allow(unused_variables)]
7499 let offset = encoder.out_of_line_offset(bytes_len);
7500 let mut _prev_end_offset: usize = 0;
7501 if 1 > max_ordinal {
7502 return Ok(());
7503 }
7504
7505 let cur_offset: usize = (1 - 1) * envelope_size;
7508
7509 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7511
7512 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<LedType, 256>, D>(
7517 self.enabled_leds.as_ref().map(<fidl::encoding::Vector<LedType, 256> as fidl::encoding::ValueTypeMarker>::borrow),
7518 encoder, offset + cur_offset, depth
7519 )?;
7520
7521 _prev_end_offset = cur_offset + envelope_size;
7522
7523 Ok(())
7524 }
7525 }
7526
7527 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardOutputReport {
7528 #[inline(always)]
7529 fn new_empty() -> Self {
7530 Self::default()
7531 }
7532
7533 unsafe fn decode(
7534 &mut self,
7535 decoder: &mut fidl::encoding::Decoder<'_, D>,
7536 offset: usize,
7537 mut depth: fidl::encoding::Depth,
7538 ) -> fidl::Result<()> {
7539 decoder.debug_check_bounds::<Self>(offset);
7540 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7541 None => return Err(fidl::Error::NotNullable),
7542 Some(len) => len,
7543 };
7544 if len == 0 {
7546 return Ok(());
7547 };
7548 depth.increment()?;
7549 let envelope_size = 8;
7550 let bytes_len = len * envelope_size;
7551 let offset = decoder.out_of_line_offset(bytes_len)?;
7552 let mut _next_ordinal_to_read = 0;
7554 let mut next_offset = offset;
7555 let end_offset = offset + bytes_len;
7556 _next_ordinal_to_read += 1;
7557 if next_offset >= end_offset {
7558 return Ok(());
7559 }
7560
7561 while _next_ordinal_to_read < 1 {
7563 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7564 _next_ordinal_to_read += 1;
7565 next_offset += envelope_size;
7566 }
7567
7568 let next_out_of_line = decoder.next_out_of_line();
7569 let handles_before = decoder.remaining_handles();
7570 if let Some((inlined, num_bytes, num_handles)) =
7571 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7572 {
7573 let member_inline_size = <fidl::encoding::Vector<LedType, 256> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7574 if inlined != (member_inline_size <= 4) {
7575 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7576 }
7577 let inner_offset;
7578 let mut inner_depth = depth.clone();
7579 if inlined {
7580 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7581 inner_offset = next_offset;
7582 } else {
7583 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7584 inner_depth.increment()?;
7585 }
7586 let val_ref = self.enabled_leds.get_or_insert_with(
7587 || fidl::new_empty!(fidl::encoding::Vector<LedType, 256>, D),
7588 );
7589 fidl::decode!(fidl::encoding::Vector<LedType, 256>, D, val_ref, decoder, inner_offset, inner_depth)?;
7590 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7591 {
7592 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7593 }
7594 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7595 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7596 }
7597 }
7598
7599 next_offset += envelope_size;
7600
7601 while next_offset < end_offset {
7603 _next_ordinal_to_read += 1;
7604 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7605 next_offset += envelope_size;
7606 }
7607
7608 Ok(())
7609 }
7610 }
7611
7612 impl MouseDescriptor {
7613 #[inline(always)]
7614 fn max_ordinal_present(&self) -> u64 {
7615 if let Some(_) = self.input {
7616 return 1;
7617 }
7618 0
7619 }
7620 }
7621
7622 impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
7623 type Borrowed<'a> = &'a Self;
7624 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7625 value
7626 }
7627 }
7628
7629 unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
7630 type Owned = Self;
7631
7632 #[inline(always)]
7633 fn inline_align(_context: fidl::encoding::Context) -> usize {
7634 8
7635 }
7636
7637 #[inline(always)]
7638 fn inline_size(_context: fidl::encoding::Context) -> usize {
7639 16
7640 }
7641 }
7642
7643 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
7644 for &MouseDescriptor
7645 {
7646 unsafe fn encode(
7647 self,
7648 encoder: &mut fidl::encoding::Encoder<'_, D>,
7649 offset: usize,
7650 mut depth: fidl::encoding::Depth,
7651 ) -> fidl::Result<()> {
7652 encoder.debug_check_bounds::<MouseDescriptor>(offset);
7653 let max_ordinal: u64 = self.max_ordinal_present();
7655 encoder.write_num(max_ordinal, offset);
7656 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7657 if max_ordinal == 0 {
7659 return Ok(());
7660 }
7661 depth.increment()?;
7662 let envelope_size = 8;
7663 let bytes_len = max_ordinal as usize * envelope_size;
7664 #[allow(unused_variables)]
7665 let offset = encoder.out_of_line_offset(bytes_len);
7666 let mut _prev_end_offset: usize = 0;
7667 if 1 > max_ordinal {
7668 return Ok(());
7669 }
7670
7671 let cur_offset: usize = (1 - 1) * envelope_size;
7674
7675 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7677
7678 fidl::encoding::encode_in_envelope_optional::<MouseInputDescriptor, D>(
7683 self.input
7684 .as_ref()
7685 .map(<MouseInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
7686 encoder,
7687 offset + cur_offset,
7688 depth,
7689 )?;
7690
7691 _prev_end_offset = cur_offset + envelope_size;
7692
7693 Ok(())
7694 }
7695 }
7696
7697 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
7698 #[inline(always)]
7699 fn new_empty() -> Self {
7700 Self::default()
7701 }
7702
7703 unsafe fn decode(
7704 &mut self,
7705 decoder: &mut fidl::encoding::Decoder<'_, D>,
7706 offset: usize,
7707 mut depth: fidl::encoding::Depth,
7708 ) -> fidl::Result<()> {
7709 decoder.debug_check_bounds::<Self>(offset);
7710 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7711 None => return Err(fidl::Error::NotNullable),
7712 Some(len) => len,
7713 };
7714 if len == 0 {
7716 return Ok(());
7717 };
7718 depth.increment()?;
7719 let envelope_size = 8;
7720 let bytes_len = len * envelope_size;
7721 let offset = decoder.out_of_line_offset(bytes_len)?;
7722 let mut _next_ordinal_to_read = 0;
7724 let mut next_offset = offset;
7725 let end_offset = offset + bytes_len;
7726 _next_ordinal_to_read += 1;
7727 if next_offset >= end_offset {
7728 return Ok(());
7729 }
7730
7731 while _next_ordinal_to_read < 1 {
7733 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7734 _next_ordinal_to_read += 1;
7735 next_offset += envelope_size;
7736 }
7737
7738 let next_out_of_line = decoder.next_out_of_line();
7739 let handles_before = decoder.remaining_handles();
7740 if let Some((inlined, num_bytes, num_handles)) =
7741 fidl::encoding::decode_envelope_header(decoder, next_offset)?
7742 {
7743 let member_inline_size =
7744 <MouseInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
7745 decoder.context,
7746 );
7747 if inlined != (member_inline_size <= 4) {
7748 return Err(fidl::Error::InvalidInlineBitInEnvelope);
7749 }
7750 let inner_offset;
7751 let mut inner_depth = depth.clone();
7752 if inlined {
7753 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7754 inner_offset = next_offset;
7755 } else {
7756 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7757 inner_depth.increment()?;
7758 }
7759 let val_ref =
7760 self.input.get_or_insert_with(|| fidl::new_empty!(MouseInputDescriptor, D));
7761 fidl::decode!(
7762 MouseInputDescriptor,
7763 D,
7764 val_ref,
7765 decoder,
7766 inner_offset,
7767 inner_depth
7768 )?;
7769 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7770 {
7771 return Err(fidl::Error::InvalidNumBytesInEnvelope);
7772 }
7773 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7774 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7775 }
7776 }
7777
7778 next_offset += envelope_size;
7779
7780 while next_offset < end_offset {
7782 _next_ordinal_to_read += 1;
7783 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7784 next_offset += envelope_size;
7785 }
7786
7787 Ok(())
7788 }
7789 }
7790
7791 impl MouseInputDescriptor {
7792 #[inline(always)]
7793 fn max_ordinal_present(&self) -> u64 {
7794 if let Some(_) = self.position_y {
7795 return 7;
7796 }
7797 if let Some(_) = self.position_x {
7798 return 6;
7799 }
7800 if let Some(_) = self.buttons {
7801 return 5;
7802 }
7803 if let Some(_) = self.scroll_h {
7804 return 4;
7805 }
7806 if let Some(_) = self.scroll_v {
7807 return 3;
7808 }
7809 if let Some(_) = self.movement_y {
7810 return 2;
7811 }
7812 if let Some(_) = self.movement_x {
7813 return 1;
7814 }
7815 0
7816 }
7817 }
7818
7819 impl fidl::encoding::ValueTypeMarker for MouseInputDescriptor {
7820 type Borrowed<'a> = &'a Self;
7821 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7822 value
7823 }
7824 }
7825
7826 unsafe impl fidl::encoding::TypeMarker for MouseInputDescriptor {
7827 type Owned = Self;
7828
7829 #[inline(always)]
7830 fn inline_align(_context: fidl::encoding::Context) -> usize {
7831 8
7832 }
7833
7834 #[inline(always)]
7835 fn inline_size(_context: fidl::encoding::Context) -> usize {
7836 16
7837 }
7838 }
7839
7840 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputDescriptor, D>
7841 for &MouseInputDescriptor
7842 {
7843 unsafe fn encode(
7844 self,
7845 encoder: &mut fidl::encoding::Encoder<'_, D>,
7846 offset: usize,
7847 mut depth: fidl::encoding::Depth,
7848 ) -> fidl::Result<()> {
7849 encoder.debug_check_bounds::<MouseInputDescriptor>(offset);
7850 let max_ordinal: u64 = self.max_ordinal_present();
7852 encoder.write_num(max_ordinal, offset);
7853 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7854 if max_ordinal == 0 {
7856 return Ok(());
7857 }
7858 depth.increment()?;
7859 let envelope_size = 8;
7860 let bytes_len = max_ordinal as usize * envelope_size;
7861 #[allow(unused_variables)]
7862 let offset = encoder.out_of_line_offset(bytes_len);
7863 let mut _prev_end_offset: usize = 0;
7864 if 1 > max_ordinal {
7865 return Ok(());
7866 }
7867
7868 let cur_offset: usize = (1 - 1) * envelope_size;
7871
7872 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7874
7875 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7880 self.movement_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7881 encoder,
7882 offset + cur_offset,
7883 depth,
7884 )?;
7885
7886 _prev_end_offset = cur_offset + envelope_size;
7887 if 2 > max_ordinal {
7888 return Ok(());
7889 }
7890
7891 let cur_offset: usize = (2 - 1) * envelope_size;
7894
7895 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7897
7898 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7903 self.movement_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7904 encoder,
7905 offset + cur_offset,
7906 depth,
7907 )?;
7908
7909 _prev_end_offset = cur_offset + envelope_size;
7910 if 3 > max_ordinal {
7911 return Ok(());
7912 }
7913
7914 let cur_offset: usize = (3 - 1) * envelope_size;
7917
7918 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7920
7921 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7926 self.scroll_v.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7927 encoder,
7928 offset + cur_offset,
7929 depth,
7930 )?;
7931
7932 _prev_end_offset = cur_offset + envelope_size;
7933 if 4 > max_ordinal {
7934 return Ok(());
7935 }
7936
7937 let cur_offset: usize = (4 - 1) * envelope_size;
7940
7941 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7943
7944 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7949 self.scroll_h.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7950 encoder,
7951 offset + cur_offset,
7952 depth,
7953 )?;
7954
7955 _prev_end_offset = cur_offset + envelope_size;
7956 if 5 > max_ordinal {
7957 return Ok(());
7958 }
7959
7960 let cur_offset: usize = (5 - 1) * envelope_size;
7963
7964 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7966
7967 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
7972 self.buttons.as_ref().map(
7973 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
7974 ),
7975 encoder,
7976 offset + cur_offset,
7977 depth,
7978 )?;
7979
7980 _prev_end_offset = cur_offset + envelope_size;
7981 if 6 > max_ordinal {
7982 return Ok(());
7983 }
7984
7985 let cur_offset: usize = (6 - 1) * envelope_size;
7988
7989 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7991
7992 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
7997 self.position_x.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
7998 encoder,
7999 offset + cur_offset,
8000 depth,
8001 )?;
8002
8003 _prev_end_offset = cur_offset + envelope_size;
8004 if 7 > max_ordinal {
8005 return Ok(());
8006 }
8007
8008 let cur_offset: usize = (7 - 1) * envelope_size;
8011
8012 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8014
8015 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
8020 self.position_y.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
8021 encoder,
8022 offset + cur_offset,
8023 depth,
8024 )?;
8025
8026 _prev_end_offset = cur_offset + envelope_size;
8027
8028 Ok(())
8029 }
8030 }
8031
8032 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputDescriptor {
8033 #[inline(always)]
8034 fn new_empty() -> Self {
8035 Self::default()
8036 }
8037
8038 unsafe fn decode(
8039 &mut self,
8040 decoder: &mut fidl::encoding::Decoder<'_, D>,
8041 offset: usize,
8042 mut depth: fidl::encoding::Depth,
8043 ) -> fidl::Result<()> {
8044 decoder.debug_check_bounds::<Self>(offset);
8045 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8046 None => return Err(fidl::Error::NotNullable),
8047 Some(len) => len,
8048 };
8049 if len == 0 {
8051 return Ok(());
8052 };
8053 depth.increment()?;
8054 let envelope_size = 8;
8055 let bytes_len = len * envelope_size;
8056 let offset = decoder.out_of_line_offset(bytes_len)?;
8057 let mut _next_ordinal_to_read = 0;
8059 let mut next_offset = offset;
8060 let end_offset = offset + bytes_len;
8061 _next_ordinal_to_read += 1;
8062 if next_offset >= end_offset {
8063 return Ok(());
8064 }
8065
8066 while _next_ordinal_to_read < 1 {
8068 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8069 _next_ordinal_to_read += 1;
8070 next_offset += envelope_size;
8071 }
8072
8073 let next_out_of_line = decoder.next_out_of_line();
8074 let handles_before = decoder.remaining_handles();
8075 if let Some((inlined, num_bytes, num_handles)) =
8076 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8077 {
8078 let member_inline_size =
8079 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8080 if inlined != (member_inline_size <= 4) {
8081 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8082 }
8083 let inner_offset;
8084 let mut inner_depth = depth.clone();
8085 if inlined {
8086 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8087 inner_offset = next_offset;
8088 } else {
8089 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8090 inner_depth.increment()?;
8091 }
8092 let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8093 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8094 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8095 {
8096 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8097 }
8098 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8099 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8100 }
8101 }
8102
8103 next_offset += envelope_size;
8104 _next_ordinal_to_read += 1;
8105 if next_offset >= end_offset {
8106 return Ok(());
8107 }
8108
8109 while _next_ordinal_to_read < 2 {
8111 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8112 _next_ordinal_to_read += 1;
8113 next_offset += envelope_size;
8114 }
8115
8116 let next_out_of_line = decoder.next_out_of_line();
8117 let handles_before = decoder.remaining_handles();
8118 if let Some((inlined, num_bytes, num_handles)) =
8119 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8120 {
8121 let member_inline_size =
8122 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8123 if inlined != (member_inline_size <= 4) {
8124 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8125 }
8126 let inner_offset;
8127 let mut inner_depth = depth.clone();
8128 if inlined {
8129 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8130 inner_offset = next_offset;
8131 } else {
8132 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8133 inner_depth.increment()?;
8134 }
8135 let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8136 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8137 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8138 {
8139 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8140 }
8141 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8142 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8143 }
8144 }
8145
8146 next_offset += envelope_size;
8147 _next_ordinal_to_read += 1;
8148 if next_offset >= end_offset {
8149 return Ok(());
8150 }
8151
8152 while _next_ordinal_to_read < 3 {
8154 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8155 _next_ordinal_to_read += 1;
8156 next_offset += envelope_size;
8157 }
8158
8159 let next_out_of_line = decoder.next_out_of_line();
8160 let handles_before = decoder.remaining_handles();
8161 if let Some((inlined, num_bytes, num_handles)) =
8162 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8163 {
8164 let member_inline_size =
8165 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8166 if inlined != (member_inline_size <= 4) {
8167 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8168 }
8169 let inner_offset;
8170 let mut inner_depth = depth.clone();
8171 if inlined {
8172 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8173 inner_offset = next_offset;
8174 } else {
8175 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8176 inner_depth.increment()?;
8177 }
8178 let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8179 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8180 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8181 {
8182 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8183 }
8184 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8185 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8186 }
8187 }
8188
8189 next_offset += envelope_size;
8190 _next_ordinal_to_read += 1;
8191 if next_offset >= end_offset {
8192 return Ok(());
8193 }
8194
8195 while _next_ordinal_to_read < 4 {
8197 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8198 _next_ordinal_to_read += 1;
8199 next_offset += envelope_size;
8200 }
8201
8202 let next_out_of_line = decoder.next_out_of_line();
8203 let handles_before = decoder.remaining_handles();
8204 if let Some((inlined, num_bytes, num_handles)) =
8205 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8206 {
8207 let member_inline_size =
8208 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8209 if inlined != (member_inline_size <= 4) {
8210 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8211 }
8212 let inner_offset;
8213 let mut inner_depth = depth.clone();
8214 if inlined {
8215 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8216 inner_offset = next_offset;
8217 } else {
8218 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8219 inner_depth.increment()?;
8220 }
8221 let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8222 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8223 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8224 {
8225 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8226 }
8227 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8228 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8229 }
8230 }
8231
8232 next_offset += envelope_size;
8233 _next_ordinal_to_read += 1;
8234 if next_offset >= end_offset {
8235 return Ok(());
8236 }
8237
8238 while _next_ordinal_to_read < 5 {
8240 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8241 _next_ordinal_to_read += 1;
8242 next_offset += envelope_size;
8243 }
8244
8245 let next_out_of_line = decoder.next_out_of_line();
8246 let handles_before = decoder.remaining_handles();
8247 if let Some((inlined, num_bytes, num_handles)) =
8248 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8249 {
8250 let member_inline_size =
8251 <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8252 decoder.context,
8253 );
8254 if inlined != (member_inline_size <= 4) {
8255 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8256 }
8257 let inner_offset;
8258 let mut inner_depth = depth.clone();
8259 if inlined {
8260 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8261 inner_offset = next_offset;
8262 } else {
8263 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8264 inner_depth.increment()?;
8265 }
8266 let val_ref = self
8267 .buttons
8268 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8269 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8270 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8271 {
8272 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8273 }
8274 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8275 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8276 }
8277 }
8278
8279 next_offset += envelope_size;
8280 _next_ordinal_to_read += 1;
8281 if next_offset >= end_offset {
8282 return Ok(());
8283 }
8284
8285 while _next_ordinal_to_read < 6 {
8287 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8288 _next_ordinal_to_read += 1;
8289 next_offset += envelope_size;
8290 }
8291
8292 let next_out_of_line = decoder.next_out_of_line();
8293 let handles_before = decoder.remaining_handles();
8294 if let Some((inlined, num_bytes, num_handles)) =
8295 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8296 {
8297 let member_inline_size =
8298 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8299 if inlined != (member_inline_size <= 4) {
8300 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8301 }
8302 let inner_offset;
8303 let mut inner_depth = depth.clone();
8304 if inlined {
8305 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8306 inner_offset = next_offset;
8307 } else {
8308 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8309 inner_depth.increment()?;
8310 }
8311 let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8312 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8313 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8314 {
8315 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8316 }
8317 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8318 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8319 }
8320 }
8321
8322 next_offset += envelope_size;
8323 _next_ordinal_to_read += 1;
8324 if next_offset >= end_offset {
8325 return Ok(());
8326 }
8327
8328 while _next_ordinal_to_read < 7 {
8330 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8331 _next_ordinal_to_read += 1;
8332 next_offset += envelope_size;
8333 }
8334
8335 let next_out_of_line = decoder.next_out_of_line();
8336 let handles_before = decoder.remaining_handles();
8337 if let Some((inlined, num_bytes, num_handles)) =
8338 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8339 {
8340 let member_inline_size =
8341 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8342 if inlined != (member_inline_size <= 4) {
8343 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8344 }
8345 let inner_offset;
8346 let mut inner_depth = depth.clone();
8347 if inlined {
8348 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8349 inner_offset = next_offset;
8350 } else {
8351 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8352 inner_depth.increment()?;
8353 }
8354 let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(Axis, D));
8355 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
8356 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8357 {
8358 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8359 }
8360 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8361 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8362 }
8363 }
8364
8365 next_offset += envelope_size;
8366
8367 while next_offset < end_offset {
8369 _next_ordinal_to_read += 1;
8370 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8371 next_offset += envelope_size;
8372 }
8373
8374 Ok(())
8375 }
8376 }
8377
8378 impl MouseInputReport {
8379 #[inline(always)]
8380 fn max_ordinal_present(&self) -> u64 {
8381 if let Some(_) = self.position_y {
8382 return 7;
8383 }
8384 if let Some(_) = self.position_x {
8385 return 6;
8386 }
8387 if let Some(_) = self.pressed_buttons {
8388 return 5;
8389 }
8390 if let Some(_) = self.scroll_h {
8391 return 4;
8392 }
8393 if let Some(_) = self.scroll_v {
8394 return 3;
8395 }
8396 if let Some(_) = self.movement_y {
8397 return 2;
8398 }
8399 if let Some(_) = self.movement_x {
8400 return 1;
8401 }
8402 0
8403 }
8404 }
8405
8406 impl fidl::encoding::ValueTypeMarker for MouseInputReport {
8407 type Borrowed<'a> = &'a Self;
8408 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8409 value
8410 }
8411 }
8412
8413 unsafe impl fidl::encoding::TypeMarker for MouseInputReport {
8414 type Owned = Self;
8415
8416 #[inline(always)]
8417 fn inline_align(_context: fidl::encoding::Context) -> usize {
8418 8
8419 }
8420
8421 #[inline(always)]
8422 fn inline_size(_context: fidl::encoding::Context) -> usize {
8423 16
8424 }
8425 }
8426
8427 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseInputReport, D>
8428 for &MouseInputReport
8429 {
8430 unsafe fn encode(
8431 self,
8432 encoder: &mut fidl::encoding::Encoder<'_, D>,
8433 offset: usize,
8434 mut depth: fidl::encoding::Depth,
8435 ) -> fidl::Result<()> {
8436 encoder.debug_check_bounds::<MouseInputReport>(offset);
8437 let max_ordinal: u64 = self.max_ordinal_present();
8439 encoder.write_num(max_ordinal, offset);
8440 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8441 if max_ordinal == 0 {
8443 return Ok(());
8444 }
8445 depth.increment()?;
8446 let envelope_size = 8;
8447 let bytes_len = max_ordinal as usize * envelope_size;
8448 #[allow(unused_variables)]
8449 let offset = encoder.out_of_line_offset(bytes_len);
8450 let mut _prev_end_offset: usize = 0;
8451 if 1 > max_ordinal {
8452 return Ok(());
8453 }
8454
8455 let cur_offset: usize = (1 - 1) * envelope_size;
8458
8459 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8461
8462 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8467 self.movement_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8468 encoder,
8469 offset + cur_offset,
8470 depth,
8471 )?;
8472
8473 _prev_end_offset = cur_offset + envelope_size;
8474 if 2 > max_ordinal {
8475 return Ok(());
8476 }
8477
8478 let cur_offset: usize = (2 - 1) * envelope_size;
8481
8482 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8484
8485 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8490 self.movement_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8491 encoder,
8492 offset + cur_offset,
8493 depth,
8494 )?;
8495
8496 _prev_end_offset = cur_offset + envelope_size;
8497 if 3 > max_ordinal {
8498 return Ok(());
8499 }
8500
8501 let cur_offset: usize = (3 - 1) * envelope_size;
8504
8505 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8507
8508 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8513 self.scroll_v.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8514 encoder,
8515 offset + cur_offset,
8516 depth,
8517 )?;
8518
8519 _prev_end_offset = cur_offset + envelope_size;
8520 if 4 > max_ordinal {
8521 return Ok(());
8522 }
8523
8524 let cur_offset: usize = (4 - 1) * envelope_size;
8527
8528 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8530
8531 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8536 self.scroll_h.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8537 encoder,
8538 offset + cur_offset,
8539 depth,
8540 )?;
8541
8542 _prev_end_offset = cur_offset + envelope_size;
8543 if 5 > max_ordinal {
8544 return Ok(());
8545 }
8546
8547 let cur_offset: usize = (5 - 1) * envelope_size;
8550
8551 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8553
8554 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
8559 self.pressed_buttons.as_ref().map(
8560 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
8561 ),
8562 encoder,
8563 offset + cur_offset,
8564 depth,
8565 )?;
8566
8567 _prev_end_offset = cur_offset + envelope_size;
8568 if 6 > max_ordinal {
8569 return Ok(());
8570 }
8571
8572 let cur_offset: usize = (6 - 1) * envelope_size;
8575
8576 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8578
8579 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8584 self.position_x.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8585 encoder,
8586 offset + cur_offset,
8587 depth,
8588 )?;
8589
8590 _prev_end_offset = cur_offset + envelope_size;
8591 if 7 > max_ordinal {
8592 return Ok(());
8593 }
8594
8595 let cur_offset: usize = (7 - 1) * envelope_size;
8598
8599 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8601
8602 fidl::encoding::encode_in_envelope_optional::<i64, D>(
8607 self.position_y.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
8608 encoder,
8609 offset + cur_offset,
8610 depth,
8611 )?;
8612
8613 _prev_end_offset = cur_offset + envelope_size;
8614
8615 Ok(())
8616 }
8617 }
8618
8619 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseInputReport {
8620 #[inline(always)]
8621 fn new_empty() -> Self {
8622 Self::default()
8623 }
8624
8625 unsafe fn decode(
8626 &mut self,
8627 decoder: &mut fidl::encoding::Decoder<'_, D>,
8628 offset: usize,
8629 mut depth: fidl::encoding::Depth,
8630 ) -> fidl::Result<()> {
8631 decoder.debug_check_bounds::<Self>(offset);
8632 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8633 None => return Err(fidl::Error::NotNullable),
8634 Some(len) => len,
8635 };
8636 if len == 0 {
8638 return Ok(());
8639 };
8640 depth.increment()?;
8641 let envelope_size = 8;
8642 let bytes_len = len * envelope_size;
8643 let offset = decoder.out_of_line_offset(bytes_len)?;
8644 let mut _next_ordinal_to_read = 0;
8646 let mut next_offset = offset;
8647 let end_offset = offset + bytes_len;
8648 _next_ordinal_to_read += 1;
8649 if next_offset >= end_offset {
8650 return Ok(());
8651 }
8652
8653 while _next_ordinal_to_read < 1 {
8655 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8656 _next_ordinal_to_read += 1;
8657 next_offset += envelope_size;
8658 }
8659
8660 let next_out_of_line = decoder.next_out_of_line();
8661 let handles_before = decoder.remaining_handles();
8662 if let Some((inlined, num_bytes, num_handles)) =
8663 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8664 {
8665 let member_inline_size =
8666 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8667 if inlined != (member_inline_size <= 4) {
8668 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8669 }
8670 let inner_offset;
8671 let mut inner_depth = depth.clone();
8672 if inlined {
8673 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8674 inner_offset = next_offset;
8675 } else {
8676 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8677 inner_depth.increment()?;
8678 }
8679 let val_ref = self.movement_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8680 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8681 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8682 {
8683 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8684 }
8685 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8686 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8687 }
8688 }
8689
8690 next_offset += envelope_size;
8691 _next_ordinal_to_read += 1;
8692 if next_offset >= end_offset {
8693 return Ok(());
8694 }
8695
8696 while _next_ordinal_to_read < 2 {
8698 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8699 _next_ordinal_to_read += 1;
8700 next_offset += envelope_size;
8701 }
8702
8703 let next_out_of_line = decoder.next_out_of_line();
8704 let handles_before = decoder.remaining_handles();
8705 if let Some((inlined, num_bytes, num_handles)) =
8706 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8707 {
8708 let member_inline_size =
8709 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8710 if inlined != (member_inline_size <= 4) {
8711 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8712 }
8713 let inner_offset;
8714 let mut inner_depth = depth.clone();
8715 if inlined {
8716 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8717 inner_offset = next_offset;
8718 } else {
8719 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8720 inner_depth.increment()?;
8721 }
8722 let val_ref = self.movement_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8723 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8724 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8725 {
8726 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8727 }
8728 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8729 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8730 }
8731 }
8732
8733 next_offset += envelope_size;
8734 _next_ordinal_to_read += 1;
8735 if next_offset >= end_offset {
8736 return Ok(());
8737 }
8738
8739 while _next_ordinal_to_read < 3 {
8741 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8742 _next_ordinal_to_read += 1;
8743 next_offset += envelope_size;
8744 }
8745
8746 let next_out_of_line = decoder.next_out_of_line();
8747 let handles_before = decoder.remaining_handles();
8748 if let Some((inlined, num_bytes, num_handles)) =
8749 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8750 {
8751 let member_inline_size =
8752 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8753 if inlined != (member_inline_size <= 4) {
8754 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8755 }
8756 let inner_offset;
8757 let mut inner_depth = depth.clone();
8758 if inlined {
8759 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8760 inner_offset = next_offset;
8761 } else {
8762 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8763 inner_depth.increment()?;
8764 }
8765 let val_ref = self.scroll_v.get_or_insert_with(|| fidl::new_empty!(i64, D));
8766 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8767 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8768 {
8769 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8770 }
8771 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8772 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8773 }
8774 }
8775
8776 next_offset += envelope_size;
8777 _next_ordinal_to_read += 1;
8778 if next_offset >= end_offset {
8779 return Ok(());
8780 }
8781
8782 while _next_ordinal_to_read < 4 {
8784 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8785 _next_ordinal_to_read += 1;
8786 next_offset += envelope_size;
8787 }
8788
8789 let next_out_of_line = decoder.next_out_of_line();
8790 let handles_before = decoder.remaining_handles();
8791 if let Some((inlined, num_bytes, num_handles)) =
8792 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8793 {
8794 let member_inline_size =
8795 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8796 if inlined != (member_inline_size <= 4) {
8797 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8798 }
8799 let inner_offset;
8800 let mut inner_depth = depth.clone();
8801 if inlined {
8802 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8803 inner_offset = next_offset;
8804 } else {
8805 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8806 inner_depth.increment()?;
8807 }
8808 let val_ref = self.scroll_h.get_or_insert_with(|| fidl::new_empty!(i64, D));
8809 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8810 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8811 {
8812 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8813 }
8814 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8815 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8816 }
8817 }
8818
8819 next_offset += envelope_size;
8820 _next_ordinal_to_read += 1;
8821 if next_offset >= end_offset {
8822 return Ok(());
8823 }
8824
8825 while _next_ordinal_to_read < 5 {
8827 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8828 _next_ordinal_to_read += 1;
8829 next_offset += envelope_size;
8830 }
8831
8832 let next_out_of_line = decoder.next_out_of_line();
8833 let handles_before = decoder.remaining_handles();
8834 if let Some((inlined, num_bytes, num_handles)) =
8835 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8836 {
8837 let member_inline_size =
8838 <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
8839 decoder.context,
8840 );
8841 if inlined != (member_inline_size <= 4) {
8842 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8843 }
8844 let inner_offset;
8845 let mut inner_depth = depth.clone();
8846 if inlined {
8847 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8848 inner_offset = next_offset;
8849 } else {
8850 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8851 inner_depth.increment()?;
8852 }
8853 let val_ref = self
8854 .pressed_buttons
8855 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
8856 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
8857 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8858 {
8859 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8860 }
8861 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8862 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8863 }
8864 }
8865
8866 next_offset += envelope_size;
8867 _next_ordinal_to_read += 1;
8868 if next_offset >= end_offset {
8869 return Ok(());
8870 }
8871
8872 while _next_ordinal_to_read < 6 {
8874 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8875 _next_ordinal_to_read += 1;
8876 next_offset += envelope_size;
8877 }
8878
8879 let next_out_of_line = decoder.next_out_of_line();
8880 let handles_before = decoder.remaining_handles();
8881 if let Some((inlined, num_bytes, num_handles)) =
8882 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8883 {
8884 let member_inline_size =
8885 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8886 if inlined != (member_inline_size <= 4) {
8887 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8888 }
8889 let inner_offset;
8890 let mut inner_depth = depth.clone();
8891 if inlined {
8892 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8893 inner_offset = next_offset;
8894 } else {
8895 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8896 inner_depth.increment()?;
8897 }
8898 let val_ref = self.position_x.get_or_insert_with(|| fidl::new_empty!(i64, D));
8899 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8900 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8901 {
8902 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8903 }
8904 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8905 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8906 }
8907 }
8908
8909 next_offset += envelope_size;
8910 _next_ordinal_to_read += 1;
8911 if next_offset >= end_offset {
8912 return Ok(());
8913 }
8914
8915 while _next_ordinal_to_read < 7 {
8917 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8918 _next_ordinal_to_read += 1;
8919 next_offset += envelope_size;
8920 }
8921
8922 let next_out_of_line = decoder.next_out_of_line();
8923 let handles_before = decoder.remaining_handles();
8924 if let Some((inlined, num_bytes, num_handles)) =
8925 fidl::encoding::decode_envelope_header(decoder, next_offset)?
8926 {
8927 let member_inline_size =
8928 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8929 if inlined != (member_inline_size <= 4) {
8930 return Err(fidl::Error::InvalidInlineBitInEnvelope);
8931 }
8932 let inner_offset;
8933 let mut inner_depth = depth.clone();
8934 if inlined {
8935 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8936 inner_offset = next_offset;
8937 } else {
8938 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8939 inner_depth.increment()?;
8940 }
8941 let val_ref = self.position_y.get_or_insert_with(|| fidl::new_empty!(i64, D));
8942 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
8943 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8944 {
8945 return Err(fidl::Error::InvalidNumBytesInEnvelope);
8946 }
8947 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8948 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8949 }
8950 }
8951
8952 next_offset += envelope_size;
8953
8954 while next_offset < end_offset {
8956 _next_ordinal_to_read += 1;
8957 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8958 next_offset += envelope_size;
8959 }
8960
8961 Ok(())
8962 }
8963 }
8964
8965 impl OutputDescriptor {
8966 #[inline(always)]
8967 fn max_ordinal_present(&self) -> u64 {
8968 if let Some(_) = self.keyboard {
8969 return 1;
8970 }
8971 0
8972 }
8973 }
8974
8975 impl fidl::encoding::ValueTypeMarker for OutputDescriptor {
8976 type Borrowed<'a> = &'a Self;
8977 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8978 value
8979 }
8980 }
8981
8982 unsafe impl fidl::encoding::TypeMarker for OutputDescriptor {
8983 type Owned = Self;
8984
8985 #[inline(always)]
8986 fn inline_align(_context: fidl::encoding::Context) -> usize {
8987 8
8988 }
8989
8990 #[inline(always)]
8991 fn inline_size(_context: fidl::encoding::Context) -> usize {
8992 16
8993 }
8994 }
8995
8996 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputDescriptor, D>
8997 for &OutputDescriptor
8998 {
8999 unsafe fn encode(
9000 self,
9001 encoder: &mut fidl::encoding::Encoder<'_, D>,
9002 offset: usize,
9003 mut depth: fidl::encoding::Depth,
9004 ) -> fidl::Result<()> {
9005 encoder.debug_check_bounds::<OutputDescriptor>(offset);
9006 let max_ordinal: u64 = self.max_ordinal_present();
9008 encoder.write_num(max_ordinal, offset);
9009 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9010 if max_ordinal == 0 {
9012 return Ok(());
9013 }
9014 depth.increment()?;
9015 let envelope_size = 8;
9016 let bytes_len = max_ordinal as usize * envelope_size;
9017 #[allow(unused_variables)]
9018 let offset = encoder.out_of_line_offset(bytes_len);
9019 let mut _prev_end_offset: usize = 0;
9020 if 1 > max_ordinal {
9021 return Ok(());
9022 }
9023
9024 let cur_offset: usize = (1 - 1) * envelope_size;
9027
9028 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9030
9031 fidl::encoding::encode_in_envelope_optional::<KeyboardOutputDescriptor, D>(
9036 self.keyboard
9037 .as_ref()
9038 .map(<KeyboardOutputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
9039 encoder,
9040 offset + cur_offset,
9041 depth,
9042 )?;
9043
9044 _prev_end_offset = cur_offset + envelope_size;
9045
9046 Ok(())
9047 }
9048 }
9049
9050 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputDescriptor {
9051 #[inline(always)]
9052 fn new_empty() -> Self {
9053 Self::default()
9054 }
9055
9056 unsafe fn decode(
9057 &mut self,
9058 decoder: &mut fidl::encoding::Decoder<'_, D>,
9059 offset: usize,
9060 mut depth: fidl::encoding::Depth,
9061 ) -> fidl::Result<()> {
9062 decoder.debug_check_bounds::<Self>(offset);
9063 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9064 None => return Err(fidl::Error::NotNullable),
9065 Some(len) => len,
9066 };
9067 if len == 0 {
9069 return Ok(());
9070 };
9071 depth.increment()?;
9072 let envelope_size = 8;
9073 let bytes_len = len * envelope_size;
9074 let offset = decoder.out_of_line_offset(bytes_len)?;
9075 let mut _next_ordinal_to_read = 0;
9077 let mut next_offset = offset;
9078 let end_offset = offset + bytes_len;
9079 _next_ordinal_to_read += 1;
9080 if next_offset >= end_offset {
9081 return Ok(());
9082 }
9083
9084 while _next_ordinal_to_read < 1 {
9086 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9087 _next_ordinal_to_read += 1;
9088 next_offset += envelope_size;
9089 }
9090
9091 let next_out_of_line = decoder.next_out_of_line();
9092 let handles_before = decoder.remaining_handles();
9093 if let Some((inlined, num_bytes, num_handles)) =
9094 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9095 {
9096 let member_inline_size =
9097 <KeyboardOutputDescriptor as fidl::encoding::TypeMarker>::inline_size(
9098 decoder.context,
9099 );
9100 if inlined != (member_inline_size <= 4) {
9101 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9102 }
9103 let inner_offset;
9104 let mut inner_depth = depth.clone();
9105 if inlined {
9106 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9107 inner_offset = next_offset;
9108 } else {
9109 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9110 inner_depth.increment()?;
9111 }
9112 let val_ref = self
9113 .keyboard
9114 .get_or_insert_with(|| fidl::new_empty!(KeyboardOutputDescriptor, D));
9115 fidl::decode!(
9116 KeyboardOutputDescriptor,
9117 D,
9118 val_ref,
9119 decoder,
9120 inner_offset,
9121 inner_depth
9122 )?;
9123 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9124 {
9125 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9126 }
9127 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9128 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9129 }
9130 }
9131
9132 next_offset += envelope_size;
9133
9134 while next_offset < end_offset {
9136 _next_ordinal_to_read += 1;
9137 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9138 next_offset += envelope_size;
9139 }
9140
9141 Ok(())
9142 }
9143 }
9144
9145 impl OutputReport {
9146 #[inline(always)]
9147 fn max_ordinal_present(&self) -> u64 {
9148 if let Some(_) = self.keyboard {
9149 return 1;
9150 }
9151 0
9152 }
9153 }
9154
9155 impl fidl::encoding::ValueTypeMarker for OutputReport {
9156 type Borrowed<'a> = &'a Self;
9157 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9158 value
9159 }
9160 }
9161
9162 unsafe impl fidl::encoding::TypeMarker for OutputReport {
9163 type Owned = Self;
9164
9165 #[inline(always)]
9166 fn inline_align(_context: fidl::encoding::Context) -> usize {
9167 8
9168 }
9169
9170 #[inline(always)]
9171 fn inline_size(_context: fidl::encoding::Context) -> usize {
9172 16
9173 }
9174 }
9175
9176 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutputReport, D>
9177 for &OutputReport
9178 {
9179 unsafe fn encode(
9180 self,
9181 encoder: &mut fidl::encoding::Encoder<'_, D>,
9182 offset: usize,
9183 mut depth: fidl::encoding::Depth,
9184 ) -> fidl::Result<()> {
9185 encoder.debug_check_bounds::<OutputReport>(offset);
9186 let max_ordinal: u64 = self.max_ordinal_present();
9188 encoder.write_num(max_ordinal, offset);
9189 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9190 if max_ordinal == 0 {
9192 return Ok(());
9193 }
9194 depth.increment()?;
9195 let envelope_size = 8;
9196 let bytes_len = max_ordinal as usize * envelope_size;
9197 #[allow(unused_variables)]
9198 let offset = encoder.out_of_line_offset(bytes_len);
9199 let mut _prev_end_offset: usize = 0;
9200 if 1 > max_ordinal {
9201 return Ok(());
9202 }
9203
9204 let cur_offset: usize = (1 - 1) * envelope_size;
9207
9208 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9210
9211 fidl::encoding::encode_in_envelope_optional::<KeyboardOutputReport, D>(
9216 self.keyboard
9217 .as_ref()
9218 .map(<KeyboardOutputReport as fidl::encoding::ValueTypeMarker>::borrow),
9219 encoder,
9220 offset + cur_offset,
9221 depth,
9222 )?;
9223
9224 _prev_end_offset = cur_offset + envelope_size;
9225
9226 Ok(())
9227 }
9228 }
9229
9230 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutputReport {
9231 #[inline(always)]
9232 fn new_empty() -> Self {
9233 Self::default()
9234 }
9235
9236 unsafe fn decode(
9237 &mut self,
9238 decoder: &mut fidl::encoding::Decoder<'_, D>,
9239 offset: usize,
9240 mut depth: fidl::encoding::Depth,
9241 ) -> fidl::Result<()> {
9242 decoder.debug_check_bounds::<Self>(offset);
9243 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9244 None => return Err(fidl::Error::NotNullable),
9245 Some(len) => len,
9246 };
9247 if len == 0 {
9249 return Ok(());
9250 };
9251 depth.increment()?;
9252 let envelope_size = 8;
9253 let bytes_len = len * envelope_size;
9254 let offset = decoder.out_of_line_offset(bytes_len)?;
9255 let mut _next_ordinal_to_read = 0;
9257 let mut next_offset = offset;
9258 let end_offset = offset + bytes_len;
9259 _next_ordinal_to_read += 1;
9260 if next_offset >= end_offset {
9261 return Ok(());
9262 }
9263
9264 while _next_ordinal_to_read < 1 {
9266 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9267 _next_ordinal_to_read += 1;
9268 next_offset += envelope_size;
9269 }
9270
9271 let next_out_of_line = decoder.next_out_of_line();
9272 let handles_before = decoder.remaining_handles();
9273 if let Some((inlined, num_bytes, num_handles)) =
9274 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9275 {
9276 let member_inline_size =
9277 <KeyboardOutputReport as fidl::encoding::TypeMarker>::inline_size(
9278 decoder.context,
9279 );
9280 if inlined != (member_inline_size <= 4) {
9281 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9282 }
9283 let inner_offset;
9284 let mut inner_depth = depth.clone();
9285 if inlined {
9286 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9287 inner_offset = next_offset;
9288 } else {
9289 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9290 inner_depth.increment()?;
9291 }
9292 let val_ref =
9293 self.keyboard.get_or_insert_with(|| fidl::new_empty!(KeyboardOutputReport, D));
9294 fidl::decode!(
9295 KeyboardOutputReport,
9296 D,
9297 val_ref,
9298 decoder,
9299 inner_offset,
9300 inner_depth
9301 )?;
9302 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9303 {
9304 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9305 }
9306 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9307 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9308 }
9309 }
9310
9311 next_offset += envelope_size;
9312
9313 while next_offset < end_offset {
9315 _next_ordinal_to_read += 1;
9316 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9317 next_offset += envelope_size;
9318 }
9319
9320 Ok(())
9321 }
9322 }
9323
9324 impl SelectiveReportingFeatureReport {
9325 #[inline(always)]
9326 fn max_ordinal_present(&self) -> u64 {
9327 if let Some(_) = self.button_switch {
9328 return 2;
9329 }
9330 if let Some(_) = self.surface_switch {
9331 return 1;
9332 }
9333 0
9334 }
9335 }
9336
9337 impl fidl::encoding::ValueTypeMarker for SelectiveReportingFeatureReport {
9338 type Borrowed<'a> = &'a Self;
9339 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9340 value
9341 }
9342 }
9343
9344 unsafe impl fidl::encoding::TypeMarker for SelectiveReportingFeatureReport {
9345 type Owned = Self;
9346
9347 #[inline(always)]
9348 fn inline_align(_context: fidl::encoding::Context) -> usize {
9349 8
9350 }
9351
9352 #[inline(always)]
9353 fn inline_size(_context: fidl::encoding::Context) -> usize {
9354 16
9355 }
9356 }
9357
9358 unsafe impl<D: fidl::encoding::ResourceDialect>
9359 fidl::encoding::Encode<SelectiveReportingFeatureReport, D>
9360 for &SelectiveReportingFeatureReport
9361 {
9362 unsafe fn encode(
9363 self,
9364 encoder: &mut fidl::encoding::Encoder<'_, D>,
9365 offset: usize,
9366 mut depth: fidl::encoding::Depth,
9367 ) -> fidl::Result<()> {
9368 encoder.debug_check_bounds::<SelectiveReportingFeatureReport>(offset);
9369 let max_ordinal: u64 = self.max_ordinal_present();
9371 encoder.write_num(max_ordinal, offset);
9372 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9373 if max_ordinal == 0 {
9375 return Ok(());
9376 }
9377 depth.increment()?;
9378 let envelope_size = 8;
9379 let bytes_len = max_ordinal as usize * envelope_size;
9380 #[allow(unused_variables)]
9381 let offset = encoder.out_of_line_offset(bytes_len);
9382 let mut _prev_end_offset: usize = 0;
9383 if 1 > max_ordinal {
9384 return Ok(());
9385 }
9386
9387 let cur_offset: usize = (1 - 1) * envelope_size;
9390
9391 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9393
9394 fidl::encoding::encode_in_envelope_optional::<bool, D>(
9399 self.surface_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9400 encoder,
9401 offset + cur_offset,
9402 depth,
9403 )?;
9404
9405 _prev_end_offset = cur_offset + envelope_size;
9406 if 2 > max_ordinal {
9407 return Ok(());
9408 }
9409
9410 let cur_offset: usize = (2 - 1) * envelope_size;
9413
9414 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9416
9417 fidl::encoding::encode_in_envelope_optional::<bool, D>(
9422 self.button_switch.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9423 encoder,
9424 offset + cur_offset,
9425 depth,
9426 )?;
9427
9428 _prev_end_offset = cur_offset + envelope_size;
9429
9430 Ok(())
9431 }
9432 }
9433
9434 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9435 for SelectiveReportingFeatureReport
9436 {
9437 #[inline(always)]
9438 fn new_empty() -> Self {
9439 Self::default()
9440 }
9441
9442 unsafe fn decode(
9443 &mut self,
9444 decoder: &mut fidl::encoding::Decoder<'_, D>,
9445 offset: usize,
9446 mut depth: fidl::encoding::Depth,
9447 ) -> fidl::Result<()> {
9448 decoder.debug_check_bounds::<Self>(offset);
9449 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9450 None => return Err(fidl::Error::NotNullable),
9451 Some(len) => len,
9452 };
9453 if len == 0 {
9455 return Ok(());
9456 };
9457 depth.increment()?;
9458 let envelope_size = 8;
9459 let bytes_len = len * envelope_size;
9460 let offset = decoder.out_of_line_offset(bytes_len)?;
9461 let mut _next_ordinal_to_read = 0;
9463 let mut next_offset = offset;
9464 let end_offset = offset + bytes_len;
9465 _next_ordinal_to_read += 1;
9466 if next_offset >= end_offset {
9467 return Ok(());
9468 }
9469
9470 while _next_ordinal_to_read < 1 {
9472 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9473 _next_ordinal_to_read += 1;
9474 next_offset += envelope_size;
9475 }
9476
9477 let next_out_of_line = decoder.next_out_of_line();
9478 let handles_before = decoder.remaining_handles();
9479 if let Some((inlined, num_bytes, num_handles)) =
9480 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9481 {
9482 let member_inline_size =
9483 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9484 if inlined != (member_inline_size <= 4) {
9485 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9486 }
9487 let inner_offset;
9488 let mut inner_depth = depth.clone();
9489 if inlined {
9490 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9491 inner_offset = next_offset;
9492 } else {
9493 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9494 inner_depth.increment()?;
9495 }
9496 let val_ref = self.surface_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9497 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9498 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9499 {
9500 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9501 }
9502 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9503 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9504 }
9505 }
9506
9507 next_offset += envelope_size;
9508 _next_ordinal_to_read += 1;
9509 if next_offset >= end_offset {
9510 return Ok(());
9511 }
9512
9513 while _next_ordinal_to_read < 2 {
9515 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9516 _next_ordinal_to_read += 1;
9517 next_offset += envelope_size;
9518 }
9519
9520 let next_out_of_line = decoder.next_out_of_line();
9521 let handles_before = decoder.remaining_handles();
9522 if let Some((inlined, num_bytes, num_handles)) =
9523 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9524 {
9525 let member_inline_size =
9526 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9527 if inlined != (member_inline_size <= 4) {
9528 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9529 }
9530 let inner_offset;
9531 let mut inner_depth = depth.clone();
9532 if inlined {
9533 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9534 inner_offset = next_offset;
9535 } else {
9536 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9537 inner_depth.increment()?;
9538 }
9539 let val_ref = self.button_switch.get_or_insert_with(|| fidl::new_empty!(bool, D));
9540 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
9541 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9542 {
9543 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9544 }
9545 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9546 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9547 }
9548 }
9549
9550 next_offset += envelope_size;
9551
9552 while next_offset < end_offset {
9554 _next_ordinal_to_read += 1;
9555 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9556 next_offset += envelope_size;
9557 }
9558
9559 Ok(())
9560 }
9561 }
9562
9563 impl SensorDescriptor {
9564 #[inline(always)]
9565 fn max_ordinal_present(&self) -> u64 {
9566 if let Some(_) = self.feature {
9567 return 2;
9568 }
9569 if let Some(_) = self.input {
9570 return 1;
9571 }
9572 0
9573 }
9574 }
9575
9576 impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
9577 type Borrowed<'a> = &'a Self;
9578 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9579 value
9580 }
9581 }
9582
9583 unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
9584 type Owned = Self;
9585
9586 #[inline(always)]
9587 fn inline_align(_context: fidl::encoding::Context) -> usize {
9588 8
9589 }
9590
9591 #[inline(always)]
9592 fn inline_size(_context: fidl::encoding::Context) -> usize {
9593 16
9594 }
9595 }
9596
9597 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
9598 for &SensorDescriptor
9599 {
9600 unsafe fn encode(
9601 self,
9602 encoder: &mut fidl::encoding::Encoder<'_, D>,
9603 offset: usize,
9604 mut depth: fidl::encoding::Depth,
9605 ) -> fidl::Result<()> {
9606 encoder.debug_check_bounds::<SensorDescriptor>(offset);
9607 let max_ordinal: u64 = self.max_ordinal_present();
9609 encoder.write_num(max_ordinal, offset);
9610 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9611 if max_ordinal == 0 {
9613 return Ok(());
9614 }
9615 depth.increment()?;
9616 let envelope_size = 8;
9617 let bytes_len = max_ordinal as usize * envelope_size;
9618 #[allow(unused_variables)]
9619 let offset = encoder.out_of_line_offset(bytes_len);
9620 let mut _prev_end_offset: usize = 0;
9621 if 1 > max_ordinal {
9622 return Ok(());
9623 }
9624
9625 let cur_offset: usize = (1 - 1) * envelope_size;
9628
9629 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9631
9632 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorInputDescriptor, 255>, D>(
9637 self.input.as_ref().map(<fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9638 encoder, offset + cur_offset, depth
9639 )?;
9640
9641 _prev_end_offset = cur_offset + envelope_size;
9642 if 2 > max_ordinal {
9643 return Ok(());
9644 }
9645
9646 let cur_offset: usize = (2 - 1) * envelope_size;
9649
9650 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9652
9653 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D>(
9658 self.feature.as_ref().map(<fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::ValueTypeMarker>::borrow),
9659 encoder, offset + cur_offset, depth
9660 )?;
9661
9662 _prev_end_offset = cur_offset + envelope_size;
9663
9664 Ok(())
9665 }
9666 }
9667
9668 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
9669 #[inline(always)]
9670 fn new_empty() -> Self {
9671 Self::default()
9672 }
9673
9674 unsafe fn decode(
9675 &mut self,
9676 decoder: &mut fidl::encoding::Decoder<'_, D>,
9677 offset: usize,
9678 mut depth: fidl::encoding::Depth,
9679 ) -> fidl::Result<()> {
9680 decoder.debug_check_bounds::<Self>(offset);
9681 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9682 None => return Err(fidl::Error::NotNullable),
9683 Some(len) => len,
9684 };
9685 if len == 0 {
9687 return Ok(());
9688 };
9689 depth.increment()?;
9690 let envelope_size = 8;
9691 let bytes_len = len * envelope_size;
9692 let offset = decoder.out_of_line_offset(bytes_len)?;
9693 let mut _next_ordinal_to_read = 0;
9695 let mut next_offset = offset;
9696 let end_offset = offset + bytes_len;
9697 _next_ordinal_to_read += 1;
9698 if next_offset >= end_offset {
9699 return Ok(());
9700 }
9701
9702 while _next_ordinal_to_read < 1 {
9704 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9705 _next_ordinal_to_read += 1;
9706 next_offset += envelope_size;
9707 }
9708
9709 let next_out_of_line = decoder.next_out_of_line();
9710 let handles_before = decoder.remaining_handles();
9711 if let Some((inlined, num_bytes, num_handles)) =
9712 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9713 {
9714 let member_inline_size = <fidl::encoding::Vector<SensorInputDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9715 if inlined != (member_inline_size <= 4) {
9716 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9717 }
9718 let inner_offset;
9719 let mut inner_depth = depth.clone();
9720 if inlined {
9721 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9722 inner_offset = next_offset;
9723 } else {
9724 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9725 inner_depth.increment()?;
9726 }
9727 let val_ref = self.input.get_or_insert_with(
9728 || fidl::new_empty!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D),
9729 );
9730 fidl::decode!(fidl::encoding::Vector<SensorInputDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9731 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9732 {
9733 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9734 }
9735 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9736 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9737 }
9738 }
9739
9740 next_offset += envelope_size;
9741 _next_ordinal_to_read += 1;
9742 if next_offset >= end_offset {
9743 return Ok(());
9744 }
9745
9746 while _next_ordinal_to_read < 2 {
9748 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9749 _next_ordinal_to_read += 1;
9750 next_offset += envelope_size;
9751 }
9752
9753 let next_out_of_line = decoder.next_out_of_line();
9754 let handles_before = decoder.remaining_handles();
9755 if let Some((inlined, num_bytes, num_handles)) =
9756 fidl::encoding::decode_envelope_header(decoder, next_offset)?
9757 {
9758 let member_inline_size = <fidl::encoding::Vector<SensorFeatureDescriptor, 255> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9759 if inlined != (member_inline_size <= 4) {
9760 return Err(fidl::Error::InvalidInlineBitInEnvelope);
9761 }
9762 let inner_offset;
9763 let mut inner_depth = depth.clone();
9764 if inlined {
9765 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9766 inner_offset = next_offset;
9767 } else {
9768 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9769 inner_depth.increment()?;
9770 }
9771 let val_ref = self.feature.get_or_insert_with(
9772 || fidl::new_empty!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D),
9773 );
9774 fidl::decode!(fidl::encoding::Vector<SensorFeatureDescriptor, 255>, D, val_ref, decoder, inner_offset, inner_depth)?;
9775 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9776 {
9777 return Err(fidl::Error::InvalidNumBytesInEnvelope);
9778 }
9779 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9780 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9781 }
9782 }
9783
9784 next_offset += envelope_size;
9785
9786 while next_offset < end_offset {
9788 _next_ordinal_to_read += 1;
9789 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9790 next_offset += envelope_size;
9791 }
9792
9793 Ok(())
9794 }
9795 }
9796
9797 impl SensorFeatureDescriptor {
9798 #[inline(always)]
9799 fn max_ordinal_present(&self) -> u64 {
9800 if let Some(_) = self.report_id {
9801 return 7;
9802 }
9803 if let Some(_) = self.sampling_rate {
9804 return 6;
9805 }
9806 if let Some(_) = self.threshold_low {
9807 return 5;
9808 }
9809 if let Some(_) = self.threshold_high {
9810 return 4;
9811 }
9812 if let Some(_) = self.supports_reporting_state {
9813 return 3;
9814 }
9815 if let Some(_) = self.sensitivity {
9816 return 2;
9817 }
9818 if let Some(_) = self.report_interval {
9819 return 1;
9820 }
9821 0
9822 }
9823 }
9824
9825 impl fidl::encoding::ValueTypeMarker for SensorFeatureDescriptor {
9826 type Borrowed<'a> = &'a Self;
9827 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9828 value
9829 }
9830 }
9831
9832 unsafe impl fidl::encoding::TypeMarker for SensorFeatureDescriptor {
9833 type Owned = Self;
9834
9835 #[inline(always)]
9836 fn inline_align(_context: fidl::encoding::Context) -> usize {
9837 8
9838 }
9839
9840 #[inline(always)]
9841 fn inline_size(_context: fidl::encoding::Context) -> usize {
9842 16
9843 }
9844 }
9845
9846 unsafe impl<D: fidl::encoding::ResourceDialect>
9847 fidl::encoding::Encode<SensorFeatureDescriptor, D> for &SensorFeatureDescriptor
9848 {
9849 unsafe fn encode(
9850 self,
9851 encoder: &mut fidl::encoding::Encoder<'_, D>,
9852 offset: usize,
9853 mut depth: fidl::encoding::Depth,
9854 ) -> fidl::Result<()> {
9855 encoder.debug_check_bounds::<SensorFeatureDescriptor>(offset);
9856 let max_ordinal: u64 = self.max_ordinal_present();
9858 encoder.write_num(max_ordinal, offset);
9859 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9860 if max_ordinal == 0 {
9862 return Ok(());
9863 }
9864 depth.increment()?;
9865 let envelope_size = 8;
9866 let bytes_len = max_ordinal as usize * envelope_size;
9867 #[allow(unused_variables)]
9868 let offset = encoder.out_of_line_offset(bytes_len);
9869 let mut _prev_end_offset: usize = 0;
9870 if 1 > max_ordinal {
9871 return Ok(());
9872 }
9873
9874 let cur_offset: usize = (1 - 1) * envelope_size;
9877
9878 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9880
9881 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
9886 self.report_interval
9887 .as_ref()
9888 .map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
9889 encoder,
9890 offset + cur_offset,
9891 depth,
9892 )?;
9893
9894 _prev_end_offset = cur_offset + envelope_size;
9895 if 2 > max_ordinal {
9896 return Ok(());
9897 }
9898
9899 let cur_offset: usize = (2 - 1) * envelope_size;
9902
9903 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9905
9906 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9911 self.sensitivity.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9912 encoder, offset + cur_offset, depth
9913 )?;
9914
9915 _prev_end_offset = cur_offset + envelope_size;
9916 if 3 > max_ordinal {
9917 return Ok(());
9918 }
9919
9920 let cur_offset: usize = (3 - 1) * envelope_size;
9923
9924 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9926
9927 fidl::encoding::encode_in_envelope_optional::<bool, D>(
9932 self.supports_reporting_state
9933 .as_ref()
9934 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
9935 encoder,
9936 offset + cur_offset,
9937 depth,
9938 )?;
9939
9940 _prev_end_offset = cur_offset + envelope_size;
9941 if 4 > max_ordinal {
9942 return Ok(());
9943 }
9944
9945 let cur_offset: usize = (4 - 1) * envelope_size;
9948
9949 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9951
9952 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9957 self.threshold_high.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9958 encoder, offset + cur_offset, depth
9959 )?;
9960
9961 _prev_end_offset = cur_offset + envelope_size;
9962 if 5 > max_ordinal {
9963 return Ok(());
9964 }
9965
9966 let cur_offset: usize = (5 - 1) * envelope_size;
9969
9970 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9972
9973 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
9978 self.threshold_low.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
9979 encoder, offset + cur_offset, depth
9980 )?;
9981
9982 _prev_end_offset = cur_offset + envelope_size;
9983 if 6 > max_ordinal {
9984 return Ok(());
9985 }
9986
9987 let cur_offset: usize = (6 - 1) * envelope_size;
9990
9991 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9993
9994 fidl::encoding::encode_in_envelope_optional::<Axis, D>(
9999 self.sampling_rate.as_ref().map(<Axis as fidl::encoding::ValueTypeMarker>::borrow),
10000 encoder,
10001 offset + cur_offset,
10002 depth,
10003 )?;
10004
10005 _prev_end_offset = cur_offset + envelope_size;
10006 if 7 > max_ordinal {
10007 return Ok(());
10008 }
10009
10010 let cur_offset: usize = (7 - 1) * envelope_size;
10013
10014 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10016
10017 fidl::encoding::encode_in_envelope_optional::<u8, D>(
10022 self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
10023 encoder,
10024 offset + cur_offset,
10025 depth,
10026 )?;
10027
10028 _prev_end_offset = cur_offset + envelope_size;
10029
10030 Ok(())
10031 }
10032 }
10033
10034 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10035 for SensorFeatureDescriptor
10036 {
10037 #[inline(always)]
10038 fn new_empty() -> Self {
10039 Self::default()
10040 }
10041
10042 unsafe fn decode(
10043 &mut self,
10044 decoder: &mut fidl::encoding::Decoder<'_, D>,
10045 offset: usize,
10046 mut depth: fidl::encoding::Depth,
10047 ) -> fidl::Result<()> {
10048 decoder.debug_check_bounds::<Self>(offset);
10049 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10050 None => return Err(fidl::Error::NotNullable),
10051 Some(len) => len,
10052 };
10053 if len == 0 {
10055 return Ok(());
10056 };
10057 depth.increment()?;
10058 let envelope_size = 8;
10059 let bytes_len = len * envelope_size;
10060 let offset = decoder.out_of_line_offset(bytes_len)?;
10061 let mut _next_ordinal_to_read = 0;
10063 let mut next_offset = offset;
10064 let end_offset = offset + bytes_len;
10065 _next_ordinal_to_read += 1;
10066 if next_offset >= end_offset {
10067 return Ok(());
10068 }
10069
10070 while _next_ordinal_to_read < 1 {
10072 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10073 _next_ordinal_to_read += 1;
10074 next_offset += envelope_size;
10075 }
10076
10077 let next_out_of_line = decoder.next_out_of_line();
10078 let handles_before = decoder.remaining_handles();
10079 if let Some((inlined, num_bytes, num_handles)) =
10080 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10081 {
10082 let member_inline_size =
10083 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10084 if inlined != (member_inline_size <= 4) {
10085 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10086 }
10087 let inner_offset;
10088 let mut inner_depth = depth.clone();
10089 if inlined {
10090 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10091 inner_offset = next_offset;
10092 } else {
10093 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10094 inner_depth.increment()?;
10095 }
10096 let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10097 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10098 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10099 {
10100 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10101 }
10102 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10103 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10104 }
10105 }
10106
10107 next_offset += envelope_size;
10108 _next_ordinal_to_read += 1;
10109 if next_offset >= end_offset {
10110 return Ok(());
10111 }
10112
10113 while _next_ordinal_to_read < 2 {
10115 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10116 _next_ordinal_to_read += 1;
10117 next_offset += envelope_size;
10118 }
10119
10120 let next_out_of_line = decoder.next_out_of_line();
10121 let handles_before = decoder.remaining_handles();
10122 if let Some((inlined, num_bytes, num_handles)) =
10123 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10124 {
10125 let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10126 if inlined != (member_inline_size <= 4) {
10127 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10128 }
10129 let inner_offset;
10130 let mut inner_depth = depth.clone();
10131 if inlined {
10132 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10133 inner_offset = next_offset;
10134 } else {
10135 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10136 inner_depth.increment()?;
10137 }
10138 let val_ref = self.sensitivity.get_or_insert_with(
10139 || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10140 );
10141 fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10142 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10143 {
10144 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10145 }
10146 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10147 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10148 }
10149 }
10150
10151 next_offset += envelope_size;
10152 _next_ordinal_to_read += 1;
10153 if next_offset >= end_offset {
10154 return Ok(());
10155 }
10156
10157 while _next_ordinal_to_read < 3 {
10159 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10160 _next_ordinal_to_read += 1;
10161 next_offset += envelope_size;
10162 }
10163
10164 let next_out_of_line = decoder.next_out_of_line();
10165 let handles_before = decoder.remaining_handles();
10166 if let Some((inlined, num_bytes, num_handles)) =
10167 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10168 {
10169 let member_inline_size =
10170 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10171 if inlined != (member_inline_size <= 4) {
10172 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10173 }
10174 let inner_offset;
10175 let mut inner_depth = depth.clone();
10176 if inlined {
10177 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10178 inner_offset = next_offset;
10179 } else {
10180 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10181 inner_depth.increment()?;
10182 }
10183 let val_ref =
10184 self.supports_reporting_state.get_or_insert_with(|| fidl::new_empty!(bool, D));
10185 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
10186 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10187 {
10188 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10189 }
10190 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10191 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10192 }
10193 }
10194
10195 next_offset += envelope_size;
10196 _next_ordinal_to_read += 1;
10197 if next_offset >= end_offset {
10198 return Ok(());
10199 }
10200
10201 while _next_ordinal_to_read < 4 {
10203 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10204 _next_ordinal_to_read += 1;
10205 next_offset += envelope_size;
10206 }
10207
10208 let next_out_of_line = decoder.next_out_of_line();
10209 let handles_before = decoder.remaining_handles();
10210 if let Some((inlined, num_bytes, num_handles)) =
10211 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10212 {
10213 let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10214 if inlined != (member_inline_size <= 4) {
10215 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10216 }
10217 let inner_offset;
10218 let mut inner_depth = depth.clone();
10219 if inlined {
10220 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10221 inner_offset = next_offset;
10222 } else {
10223 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10224 inner_depth.increment()?;
10225 }
10226 let val_ref = self.threshold_high.get_or_insert_with(
10227 || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10228 );
10229 fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10230 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10231 {
10232 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10233 }
10234 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10235 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10236 }
10237 }
10238
10239 next_offset += envelope_size;
10240 _next_ordinal_to_read += 1;
10241 if next_offset >= end_offset {
10242 return Ok(());
10243 }
10244
10245 while _next_ordinal_to_read < 5 {
10247 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10248 _next_ordinal_to_read += 1;
10249 next_offset += envelope_size;
10250 }
10251
10252 let next_out_of_line = decoder.next_out_of_line();
10253 let handles_before = decoder.remaining_handles();
10254 if let Some((inlined, num_bytes, num_handles)) =
10255 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10256 {
10257 let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10258 if inlined != (member_inline_size <= 4) {
10259 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10260 }
10261 let inner_offset;
10262 let mut inner_depth = depth.clone();
10263 if inlined {
10264 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10265 inner_offset = next_offset;
10266 } else {
10267 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10268 inner_depth.increment()?;
10269 }
10270 let val_ref = self.threshold_low.get_or_insert_with(
10271 || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
10272 );
10273 fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10274 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10275 {
10276 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10277 }
10278 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10279 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10280 }
10281 }
10282
10283 next_offset += envelope_size;
10284 _next_ordinal_to_read += 1;
10285 if next_offset >= end_offset {
10286 return Ok(());
10287 }
10288
10289 while _next_ordinal_to_read < 6 {
10291 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10292 _next_ordinal_to_read += 1;
10293 next_offset += envelope_size;
10294 }
10295
10296 let next_out_of_line = decoder.next_out_of_line();
10297 let handles_before = decoder.remaining_handles();
10298 if let Some((inlined, num_bytes, num_handles)) =
10299 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10300 {
10301 let member_inline_size =
10302 <Axis as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10303 if inlined != (member_inline_size <= 4) {
10304 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10305 }
10306 let inner_offset;
10307 let mut inner_depth = depth.clone();
10308 if inlined {
10309 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10310 inner_offset = next_offset;
10311 } else {
10312 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10313 inner_depth.increment()?;
10314 }
10315 let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(Axis, D));
10316 fidl::decode!(Axis, D, val_ref, decoder, inner_offset, inner_depth)?;
10317 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10318 {
10319 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10320 }
10321 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10322 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10323 }
10324 }
10325
10326 next_offset += envelope_size;
10327 _next_ordinal_to_read += 1;
10328 if next_offset >= end_offset {
10329 return Ok(());
10330 }
10331
10332 while _next_ordinal_to_read < 7 {
10334 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10335 _next_ordinal_to_read += 1;
10336 next_offset += envelope_size;
10337 }
10338
10339 let next_out_of_line = decoder.next_out_of_line();
10340 let handles_before = decoder.remaining_handles();
10341 if let Some((inlined, num_bytes, num_handles)) =
10342 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10343 {
10344 let member_inline_size =
10345 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10346 if inlined != (member_inline_size <= 4) {
10347 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10348 }
10349 let inner_offset;
10350 let mut inner_depth = depth.clone();
10351 if inlined {
10352 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10353 inner_offset = next_offset;
10354 } else {
10355 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10356 inner_depth.increment()?;
10357 }
10358 let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
10359 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
10360 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10361 {
10362 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10363 }
10364 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10365 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10366 }
10367 }
10368
10369 next_offset += envelope_size;
10370
10371 while next_offset < end_offset {
10373 _next_ordinal_to_read += 1;
10374 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10375 next_offset += envelope_size;
10376 }
10377
10378 Ok(())
10379 }
10380 }
10381
10382 impl SensorFeatureReport {
10383 #[inline(always)]
10384 fn max_ordinal_present(&self) -> u64 {
10385 if let Some(_) = self.sampling_rate {
10386 return 6;
10387 }
10388 if let Some(_) = self.threshold_low {
10389 return 5;
10390 }
10391 if let Some(_) = self.threshold_high {
10392 return 4;
10393 }
10394 if let Some(_) = self.reporting_state {
10395 return 3;
10396 }
10397 if let Some(_) = self.sensitivity {
10398 return 2;
10399 }
10400 if let Some(_) = self.report_interval {
10401 return 1;
10402 }
10403 0
10404 }
10405 }
10406
10407 impl fidl::encoding::ValueTypeMarker for SensorFeatureReport {
10408 type Borrowed<'a> = &'a Self;
10409 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10410 value
10411 }
10412 }
10413
10414 unsafe impl fidl::encoding::TypeMarker for SensorFeatureReport {
10415 type Owned = Self;
10416
10417 #[inline(always)]
10418 fn inline_align(_context: fidl::encoding::Context) -> usize {
10419 8
10420 }
10421
10422 #[inline(always)]
10423 fn inline_size(_context: fidl::encoding::Context) -> usize {
10424 16
10425 }
10426 }
10427
10428 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorFeatureReport, D>
10429 for &SensorFeatureReport
10430 {
10431 unsafe fn encode(
10432 self,
10433 encoder: &mut fidl::encoding::Encoder<'_, D>,
10434 offset: usize,
10435 mut depth: fidl::encoding::Depth,
10436 ) -> fidl::Result<()> {
10437 encoder.debug_check_bounds::<SensorFeatureReport>(offset);
10438 let max_ordinal: u64 = self.max_ordinal_present();
10440 encoder.write_num(max_ordinal, offset);
10441 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10442 if max_ordinal == 0 {
10444 return Ok(());
10445 }
10446 depth.increment()?;
10447 let envelope_size = 8;
10448 let bytes_len = max_ordinal as usize * envelope_size;
10449 #[allow(unused_variables)]
10450 let offset = encoder.out_of_line_offset(bytes_len);
10451 let mut _prev_end_offset: usize = 0;
10452 if 1 > max_ordinal {
10453 return Ok(());
10454 }
10455
10456 let cur_offset: usize = (1 - 1) * envelope_size;
10459
10460 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10462
10463 fidl::encoding::encode_in_envelope_optional::<i64, D>(
10468 self.report_interval.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10469 encoder,
10470 offset + cur_offset,
10471 depth,
10472 )?;
10473
10474 _prev_end_offset = cur_offset + envelope_size;
10475 if 2 > max_ordinal {
10476 return Ok(());
10477 }
10478
10479 let cur_offset: usize = (2 - 1) * envelope_size;
10482
10483 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10485
10486 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10491 self.sensitivity.as_ref().map(
10492 <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10493 ),
10494 encoder,
10495 offset + cur_offset,
10496 depth,
10497 )?;
10498
10499 _prev_end_offset = cur_offset + envelope_size;
10500 if 3 > max_ordinal {
10501 return Ok(());
10502 }
10503
10504 let cur_offset: usize = (3 - 1) * envelope_size;
10507
10508 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10510
10511 fidl::encoding::encode_in_envelope_optional::<SensorReportingState, D>(
10516 self.reporting_state
10517 .as_ref()
10518 .map(<SensorReportingState as fidl::encoding::ValueTypeMarker>::borrow),
10519 encoder,
10520 offset + cur_offset,
10521 depth,
10522 )?;
10523
10524 _prev_end_offset = cur_offset + envelope_size;
10525 if 4 > max_ordinal {
10526 return Ok(());
10527 }
10528
10529 let cur_offset: usize = (4 - 1) * envelope_size;
10532
10533 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10535
10536 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10541 self.threshold_high.as_ref().map(
10542 <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10543 ),
10544 encoder,
10545 offset + cur_offset,
10546 depth,
10547 )?;
10548
10549 _prev_end_offset = cur_offset + envelope_size;
10550 if 5 > max_ordinal {
10551 return Ok(());
10552 }
10553
10554 let cur_offset: usize = (5 - 1) * envelope_size;
10557
10558 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10560
10561 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
10566 self.threshold_low.as_ref().map(
10567 <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
10568 ),
10569 encoder,
10570 offset + cur_offset,
10571 depth,
10572 )?;
10573
10574 _prev_end_offset = cur_offset + envelope_size;
10575 if 6 > max_ordinal {
10576 return Ok(());
10577 }
10578
10579 let cur_offset: usize = (6 - 1) * envelope_size;
10582
10583 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10585
10586 fidl::encoding::encode_in_envelope_optional::<i64, D>(
10591 self.sampling_rate.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
10592 encoder,
10593 offset + cur_offset,
10594 depth,
10595 )?;
10596
10597 _prev_end_offset = cur_offset + envelope_size;
10598
10599 Ok(())
10600 }
10601 }
10602
10603 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorFeatureReport {
10604 #[inline(always)]
10605 fn new_empty() -> Self {
10606 Self::default()
10607 }
10608
10609 unsafe fn decode(
10610 &mut self,
10611 decoder: &mut fidl::encoding::Decoder<'_, D>,
10612 offset: usize,
10613 mut depth: fidl::encoding::Depth,
10614 ) -> fidl::Result<()> {
10615 decoder.debug_check_bounds::<Self>(offset);
10616 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10617 None => return Err(fidl::Error::NotNullable),
10618 Some(len) => len,
10619 };
10620 if len == 0 {
10622 return Ok(());
10623 };
10624 depth.increment()?;
10625 let envelope_size = 8;
10626 let bytes_len = len * envelope_size;
10627 let offset = decoder.out_of_line_offset(bytes_len)?;
10628 let mut _next_ordinal_to_read = 0;
10630 let mut next_offset = offset;
10631 let end_offset = offset + bytes_len;
10632 _next_ordinal_to_read += 1;
10633 if next_offset >= end_offset {
10634 return Ok(());
10635 }
10636
10637 while _next_ordinal_to_read < 1 {
10639 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10640 _next_ordinal_to_read += 1;
10641 next_offset += envelope_size;
10642 }
10643
10644 let next_out_of_line = decoder.next_out_of_line();
10645 let handles_before = decoder.remaining_handles();
10646 if let Some((inlined, num_bytes, num_handles)) =
10647 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10648 {
10649 let member_inline_size =
10650 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10651 if inlined != (member_inline_size <= 4) {
10652 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10653 }
10654 let inner_offset;
10655 let mut inner_depth = depth.clone();
10656 if inlined {
10657 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10658 inner_offset = next_offset;
10659 } else {
10660 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10661 inner_depth.increment()?;
10662 }
10663 let val_ref = self.report_interval.get_or_insert_with(|| fidl::new_empty!(i64, D));
10664 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10665 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10666 {
10667 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10668 }
10669 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10670 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10671 }
10672 }
10673
10674 next_offset += envelope_size;
10675 _next_ordinal_to_read += 1;
10676 if next_offset >= end_offset {
10677 return Ok(());
10678 }
10679
10680 while _next_ordinal_to_read < 2 {
10682 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10683 _next_ordinal_to_read += 1;
10684 next_offset += envelope_size;
10685 }
10686
10687 let next_out_of_line = decoder.next_out_of_line();
10688 let handles_before = decoder.remaining_handles();
10689 if let Some((inlined, num_bytes, num_handles)) =
10690 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10691 {
10692 let member_inline_size =
10693 <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10694 decoder.context,
10695 );
10696 if inlined != (member_inline_size <= 4) {
10697 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10698 }
10699 let inner_offset;
10700 let mut inner_depth = depth.clone();
10701 if inlined {
10702 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10703 inner_offset = next_offset;
10704 } else {
10705 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10706 inner_depth.increment()?;
10707 }
10708 let val_ref = self
10709 .sensitivity
10710 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10711 fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10712 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10713 {
10714 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10715 }
10716 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10717 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10718 }
10719 }
10720
10721 next_offset += envelope_size;
10722 _next_ordinal_to_read += 1;
10723 if next_offset >= end_offset {
10724 return Ok(());
10725 }
10726
10727 while _next_ordinal_to_read < 3 {
10729 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10730 _next_ordinal_to_read += 1;
10731 next_offset += envelope_size;
10732 }
10733
10734 let next_out_of_line = decoder.next_out_of_line();
10735 let handles_before = decoder.remaining_handles();
10736 if let Some((inlined, num_bytes, num_handles)) =
10737 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10738 {
10739 let member_inline_size =
10740 <SensorReportingState as fidl::encoding::TypeMarker>::inline_size(
10741 decoder.context,
10742 );
10743 if inlined != (member_inline_size <= 4) {
10744 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10745 }
10746 let inner_offset;
10747 let mut inner_depth = depth.clone();
10748 if inlined {
10749 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10750 inner_offset = next_offset;
10751 } else {
10752 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10753 inner_depth.increment()?;
10754 }
10755 let val_ref = self
10756 .reporting_state
10757 .get_or_insert_with(|| fidl::new_empty!(SensorReportingState, D));
10758 fidl::decode!(
10759 SensorReportingState,
10760 D,
10761 val_ref,
10762 decoder,
10763 inner_offset,
10764 inner_depth
10765 )?;
10766 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10767 {
10768 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10769 }
10770 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10771 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10772 }
10773 }
10774
10775 next_offset += envelope_size;
10776 _next_ordinal_to_read += 1;
10777 if next_offset >= end_offset {
10778 return Ok(());
10779 }
10780
10781 while _next_ordinal_to_read < 4 {
10783 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10784 _next_ordinal_to_read += 1;
10785 next_offset += envelope_size;
10786 }
10787
10788 let next_out_of_line = decoder.next_out_of_line();
10789 let handles_before = decoder.remaining_handles();
10790 if let Some((inlined, num_bytes, num_handles)) =
10791 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10792 {
10793 let member_inline_size =
10794 <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10795 decoder.context,
10796 );
10797 if inlined != (member_inline_size <= 4) {
10798 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10799 }
10800 let inner_offset;
10801 let mut inner_depth = depth.clone();
10802 if inlined {
10803 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10804 inner_offset = next_offset;
10805 } else {
10806 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10807 inner_depth.increment()?;
10808 }
10809 let val_ref = self
10810 .threshold_high
10811 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10812 fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10813 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10814 {
10815 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10816 }
10817 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10818 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10819 }
10820 }
10821
10822 next_offset += envelope_size;
10823 _next_ordinal_to_read += 1;
10824 if next_offset >= end_offset {
10825 return Ok(());
10826 }
10827
10828 while _next_ordinal_to_read < 5 {
10830 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10831 _next_ordinal_to_read += 1;
10832 next_offset += envelope_size;
10833 }
10834
10835 let next_out_of_line = decoder.next_out_of_line();
10836 let handles_before = decoder.remaining_handles();
10837 if let Some((inlined, num_bytes, num_handles)) =
10838 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10839 {
10840 let member_inline_size =
10841 <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
10842 decoder.context,
10843 );
10844 if inlined != (member_inline_size <= 4) {
10845 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10846 }
10847 let inner_offset;
10848 let mut inner_depth = depth.clone();
10849 if inlined {
10850 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10851 inner_offset = next_offset;
10852 } else {
10853 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10854 inner_depth.increment()?;
10855 }
10856 let val_ref = self
10857 .threshold_low
10858 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
10859 fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
10860 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10861 {
10862 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10863 }
10864 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10865 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10866 }
10867 }
10868
10869 next_offset += envelope_size;
10870 _next_ordinal_to_read += 1;
10871 if next_offset >= end_offset {
10872 return Ok(());
10873 }
10874
10875 while _next_ordinal_to_read < 6 {
10877 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10878 _next_ordinal_to_read += 1;
10879 next_offset += envelope_size;
10880 }
10881
10882 let next_out_of_line = decoder.next_out_of_line();
10883 let handles_before = decoder.remaining_handles();
10884 if let Some((inlined, num_bytes, num_handles)) =
10885 fidl::encoding::decode_envelope_header(decoder, next_offset)?
10886 {
10887 let member_inline_size =
10888 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10889 if inlined != (member_inline_size <= 4) {
10890 return Err(fidl::Error::InvalidInlineBitInEnvelope);
10891 }
10892 let inner_offset;
10893 let mut inner_depth = depth.clone();
10894 if inlined {
10895 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10896 inner_offset = next_offset;
10897 } else {
10898 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10899 inner_depth.increment()?;
10900 }
10901 let val_ref = self.sampling_rate.get_or_insert_with(|| fidl::new_empty!(i64, D));
10902 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
10903 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10904 {
10905 return Err(fidl::Error::InvalidNumBytesInEnvelope);
10906 }
10907 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10908 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10909 }
10910 }
10911
10912 next_offset += envelope_size;
10913
10914 while next_offset < end_offset {
10916 _next_ordinal_to_read += 1;
10917 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10918 next_offset += envelope_size;
10919 }
10920
10921 Ok(())
10922 }
10923 }
10924
10925 impl SensorInputDescriptor {
10926 #[inline(always)]
10927 fn max_ordinal_present(&self) -> u64 {
10928 if let Some(_) = self.report_id {
10929 return 2;
10930 }
10931 if let Some(_) = self.values {
10932 return 1;
10933 }
10934 0
10935 }
10936 }
10937
10938 impl fidl::encoding::ValueTypeMarker for SensorInputDescriptor {
10939 type Borrowed<'a> = &'a Self;
10940 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10941 value
10942 }
10943 }
10944
10945 unsafe impl fidl::encoding::TypeMarker for SensorInputDescriptor {
10946 type Owned = Self;
10947
10948 #[inline(always)]
10949 fn inline_align(_context: fidl::encoding::Context) -> usize {
10950 8
10951 }
10952
10953 #[inline(always)]
10954 fn inline_size(_context: fidl::encoding::Context) -> usize {
10955 16
10956 }
10957 }
10958
10959 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputDescriptor, D>
10960 for &SensorInputDescriptor
10961 {
10962 unsafe fn encode(
10963 self,
10964 encoder: &mut fidl::encoding::Encoder<'_, D>,
10965 offset: usize,
10966 mut depth: fidl::encoding::Depth,
10967 ) -> fidl::Result<()> {
10968 encoder.debug_check_bounds::<SensorInputDescriptor>(offset);
10969 let max_ordinal: u64 = self.max_ordinal_present();
10971 encoder.write_num(max_ordinal, offset);
10972 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10973 if max_ordinal == 0 {
10975 return Ok(());
10976 }
10977 depth.increment()?;
10978 let envelope_size = 8;
10979 let bytes_len = max_ordinal as usize * envelope_size;
10980 #[allow(unused_variables)]
10981 let offset = encoder.out_of_line_offset(bytes_len);
10982 let mut _prev_end_offset: usize = 0;
10983 if 1 > max_ordinal {
10984 return Ok(());
10985 }
10986
10987 let cur_offset: usize = (1 - 1) * envelope_size;
10990
10991 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10993
10994 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<SensorAxis, 100>, D>(
10999 self.values.as_ref().map(<fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::ValueTypeMarker>::borrow),
11000 encoder, offset + cur_offset, depth
11001 )?;
11002
11003 _prev_end_offset = cur_offset + envelope_size;
11004 if 2 > max_ordinal {
11005 return Ok(());
11006 }
11007
11008 let cur_offset: usize = (2 - 1) * envelope_size;
11011
11012 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11014
11015 fidl::encoding::encode_in_envelope_optional::<u8, D>(
11020 self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
11021 encoder,
11022 offset + cur_offset,
11023 depth,
11024 )?;
11025
11026 _prev_end_offset = cur_offset + envelope_size;
11027
11028 Ok(())
11029 }
11030 }
11031
11032 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputDescriptor {
11033 #[inline(always)]
11034 fn new_empty() -> Self {
11035 Self::default()
11036 }
11037
11038 unsafe fn decode(
11039 &mut self,
11040 decoder: &mut fidl::encoding::Decoder<'_, D>,
11041 offset: usize,
11042 mut depth: fidl::encoding::Depth,
11043 ) -> fidl::Result<()> {
11044 decoder.debug_check_bounds::<Self>(offset);
11045 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11046 None => return Err(fidl::Error::NotNullable),
11047 Some(len) => len,
11048 };
11049 if len == 0 {
11051 return Ok(());
11052 };
11053 depth.increment()?;
11054 let envelope_size = 8;
11055 let bytes_len = len * envelope_size;
11056 let offset = decoder.out_of_line_offset(bytes_len)?;
11057 let mut _next_ordinal_to_read = 0;
11059 let mut next_offset = offset;
11060 let end_offset = offset + bytes_len;
11061 _next_ordinal_to_read += 1;
11062 if next_offset >= end_offset {
11063 return Ok(());
11064 }
11065
11066 while _next_ordinal_to_read < 1 {
11068 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11069 _next_ordinal_to_read += 1;
11070 next_offset += envelope_size;
11071 }
11072
11073 let next_out_of_line = decoder.next_out_of_line();
11074 let handles_before = decoder.remaining_handles();
11075 if let Some((inlined, num_bytes, num_handles)) =
11076 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11077 {
11078 let member_inline_size = <fidl::encoding::Vector<SensorAxis, 100> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11079 if inlined != (member_inline_size <= 4) {
11080 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11081 }
11082 let inner_offset;
11083 let mut inner_depth = depth.clone();
11084 if inlined {
11085 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11086 inner_offset = next_offset;
11087 } else {
11088 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11089 inner_depth.increment()?;
11090 }
11091 let val_ref = self.values.get_or_insert_with(
11092 || fidl::new_empty!(fidl::encoding::Vector<SensorAxis, 100>, D),
11093 );
11094 fidl::decode!(fidl::encoding::Vector<SensorAxis, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11095 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11096 {
11097 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11098 }
11099 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11100 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11101 }
11102 }
11103
11104 next_offset += envelope_size;
11105 _next_ordinal_to_read += 1;
11106 if next_offset >= end_offset {
11107 return Ok(());
11108 }
11109
11110 while _next_ordinal_to_read < 2 {
11112 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11113 _next_ordinal_to_read += 1;
11114 next_offset += envelope_size;
11115 }
11116
11117 let next_out_of_line = decoder.next_out_of_line();
11118 let handles_before = decoder.remaining_handles();
11119 if let Some((inlined, num_bytes, num_handles)) =
11120 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11121 {
11122 let member_inline_size =
11123 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11124 if inlined != (member_inline_size <= 4) {
11125 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11126 }
11127 let inner_offset;
11128 let mut inner_depth = depth.clone();
11129 if inlined {
11130 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11131 inner_offset = next_offset;
11132 } else {
11133 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11134 inner_depth.increment()?;
11135 }
11136 let val_ref = self.report_id.get_or_insert_with(|| fidl::new_empty!(u8, D));
11137 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
11138 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11139 {
11140 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11141 }
11142 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11143 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11144 }
11145 }
11146
11147 next_offset += envelope_size;
11148
11149 while next_offset < end_offset {
11151 _next_ordinal_to_read += 1;
11152 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11153 next_offset += envelope_size;
11154 }
11155
11156 Ok(())
11157 }
11158 }
11159
11160 impl SensorInputReport {
11161 #[inline(always)]
11162 fn max_ordinal_present(&self) -> u64 {
11163 if let Some(_) = self.values {
11164 return 1;
11165 }
11166 0
11167 }
11168 }
11169
11170 impl fidl::encoding::ValueTypeMarker for SensorInputReport {
11171 type Borrowed<'a> = &'a Self;
11172 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11173 value
11174 }
11175 }
11176
11177 unsafe impl fidl::encoding::TypeMarker for SensorInputReport {
11178 type Owned = Self;
11179
11180 #[inline(always)]
11181 fn inline_align(_context: fidl::encoding::Context) -> usize {
11182 8
11183 }
11184
11185 #[inline(always)]
11186 fn inline_size(_context: fidl::encoding::Context) -> usize {
11187 16
11188 }
11189 }
11190
11191 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorInputReport, D>
11192 for &SensorInputReport
11193 {
11194 unsafe fn encode(
11195 self,
11196 encoder: &mut fidl::encoding::Encoder<'_, D>,
11197 offset: usize,
11198 mut depth: fidl::encoding::Depth,
11199 ) -> fidl::Result<()> {
11200 encoder.debug_check_bounds::<SensorInputReport>(offset);
11201 let max_ordinal: u64 = self.max_ordinal_present();
11203 encoder.write_num(max_ordinal, offset);
11204 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11205 if max_ordinal == 0 {
11207 return Ok(());
11208 }
11209 depth.increment()?;
11210 let envelope_size = 8;
11211 let bytes_len = max_ordinal as usize * envelope_size;
11212 #[allow(unused_variables)]
11213 let offset = encoder.out_of_line_offset(bytes_len);
11214 let mut _prev_end_offset: usize = 0;
11215 if 1 > max_ordinal {
11216 return Ok(());
11217 }
11218
11219 let cur_offset: usize = (1 - 1) * envelope_size;
11222
11223 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11225
11226 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<i64, 100>, D>(
11231 self.values.as_ref().map(
11232 <fidl::encoding::Vector<i64, 100> as fidl::encoding::ValueTypeMarker>::borrow,
11233 ),
11234 encoder,
11235 offset + cur_offset,
11236 depth,
11237 )?;
11238
11239 _prev_end_offset = cur_offset + envelope_size;
11240
11241 Ok(())
11242 }
11243 }
11244
11245 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorInputReport {
11246 #[inline(always)]
11247 fn new_empty() -> Self {
11248 Self::default()
11249 }
11250
11251 unsafe fn decode(
11252 &mut self,
11253 decoder: &mut fidl::encoding::Decoder<'_, D>,
11254 offset: usize,
11255 mut depth: fidl::encoding::Depth,
11256 ) -> fidl::Result<()> {
11257 decoder.debug_check_bounds::<Self>(offset);
11258 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11259 None => return Err(fidl::Error::NotNullable),
11260 Some(len) => len,
11261 };
11262 if len == 0 {
11264 return Ok(());
11265 };
11266 depth.increment()?;
11267 let envelope_size = 8;
11268 let bytes_len = len * envelope_size;
11269 let offset = decoder.out_of_line_offset(bytes_len)?;
11270 let mut _next_ordinal_to_read = 0;
11272 let mut next_offset = offset;
11273 let end_offset = offset + bytes_len;
11274 _next_ordinal_to_read += 1;
11275 if next_offset >= end_offset {
11276 return Ok(());
11277 }
11278
11279 while _next_ordinal_to_read < 1 {
11281 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11282 _next_ordinal_to_read += 1;
11283 next_offset += envelope_size;
11284 }
11285
11286 let next_out_of_line = decoder.next_out_of_line();
11287 let handles_before = decoder.remaining_handles();
11288 if let Some((inlined, num_bytes, num_handles)) =
11289 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11290 {
11291 let member_inline_size =
11292 <fidl::encoding::Vector<i64, 100> as fidl::encoding::TypeMarker>::inline_size(
11293 decoder.context,
11294 );
11295 if inlined != (member_inline_size <= 4) {
11296 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11297 }
11298 let inner_offset;
11299 let mut inner_depth = depth.clone();
11300 if inlined {
11301 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11302 inner_offset = next_offset;
11303 } else {
11304 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11305 inner_depth.increment()?;
11306 }
11307 let val_ref = self
11308 .values
11309 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<i64, 100>, D));
11310 fidl::decode!(fidl::encoding::Vector<i64, 100>, D, val_ref, decoder, inner_offset, inner_depth)?;
11311 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11312 {
11313 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11314 }
11315 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11316 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11317 }
11318 }
11319
11320 next_offset += envelope_size;
11321
11322 while next_offset < end_offset {
11324 _next_ordinal_to_read += 1;
11325 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11326 next_offset += envelope_size;
11327 }
11328
11329 Ok(())
11330 }
11331 }
11332
11333 impl TouchDescriptor {
11334 #[inline(always)]
11335 fn max_ordinal_present(&self) -> u64 {
11336 if let Some(_) = self.feature {
11337 return 2;
11338 }
11339 if let Some(_) = self.input {
11340 return 1;
11341 }
11342 0
11343 }
11344 }
11345
11346 impl fidl::encoding::ValueTypeMarker for TouchDescriptor {
11347 type Borrowed<'a> = &'a Self;
11348 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11349 value
11350 }
11351 }
11352
11353 unsafe impl fidl::encoding::TypeMarker for TouchDescriptor {
11354 type Owned = Self;
11355
11356 #[inline(always)]
11357 fn inline_align(_context: fidl::encoding::Context) -> usize {
11358 8
11359 }
11360
11361 #[inline(always)]
11362 fn inline_size(_context: fidl::encoding::Context) -> usize {
11363 16
11364 }
11365 }
11366
11367 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchDescriptor, D>
11368 for &TouchDescriptor
11369 {
11370 unsafe fn encode(
11371 self,
11372 encoder: &mut fidl::encoding::Encoder<'_, D>,
11373 offset: usize,
11374 mut depth: fidl::encoding::Depth,
11375 ) -> fidl::Result<()> {
11376 encoder.debug_check_bounds::<TouchDescriptor>(offset);
11377 let max_ordinal: u64 = self.max_ordinal_present();
11379 encoder.write_num(max_ordinal, offset);
11380 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11381 if max_ordinal == 0 {
11383 return Ok(());
11384 }
11385 depth.increment()?;
11386 let envelope_size = 8;
11387 let bytes_len = max_ordinal as usize * envelope_size;
11388 #[allow(unused_variables)]
11389 let offset = encoder.out_of_line_offset(bytes_len);
11390 let mut _prev_end_offset: usize = 0;
11391 if 1 > max_ordinal {
11392 return Ok(());
11393 }
11394
11395 let cur_offset: usize = (1 - 1) * envelope_size;
11398
11399 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11401
11402 fidl::encoding::encode_in_envelope_optional::<TouchInputDescriptor, D>(
11407 self.input
11408 .as_ref()
11409 .map(<TouchInputDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11410 encoder,
11411 offset + cur_offset,
11412 depth,
11413 )?;
11414
11415 _prev_end_offset = cur_offset + envelope_size;
11416 if 2 > max_ordinal {
11417 return Ok(());
11418 }
11419
11420 let cur_offset: usize = (2 - 1) * envelope_size;
11423
11424 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11426
11427 fidl::encoding::encode_in_envelope_optional::<TouchFeatureDescriptor, D>(
11432 self.feature
11433 .as_ref()
11434 .map(<TouchFeatureDescriptor as fidl::encoding::ValueTypeMarker>::borrow),
11435 encoder,
11436 offset + cur_offset,
11437 depth,
11438 )?;
11439
11440 _prev_end_offset = cur_offset + envelope_size;
11441
11442 Ok(())
11443 }
11444 }
11445
11446 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchDescriptor {
11447 #[inline(always)]
11448 fn new_empty() -> Self {
11449 Self::default()
11450 }
11451
11452 unsafe fn decode(
11453 &mut self,
11454 decoder: &mut fidl::encoding::Decoder<'_, D>,
11455 offset: usize,
11456 mut depth: fidl::encoding::Depth,
11457 ) -> fidl::Result<()> {
11458 decoder.debug_check_bounds::<Self>(offset);
11459 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11460 None => return Err(fidl::Error::NotNullable),
11461 Some(len) => len,
11462 };
11463 if len == 0 {
11465 return Ok(());
11466 };
11467 depth.increment()?;
11468 let envelope_size = 8;
11469 let bytes_len = len * envelope_size;
11470 let offset = decoder.out_of_line_offset(bytes_len)?;
11471 let mut _next_ordinal_to_read = 0;
11473 let mut next_offset = offset;
11474 let end_offset = offset + bytes_len;
11475 _next_ordinal_to_read += 1;
11476 if next_offset >= end_offset {
11477 return Ok(());
11478 }
11479
11480 while _next_ordinal_to_read < 1 {
11482 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11483 _next_ordinal_to_read += 1;
11484 next_offset += envelope_size;
11485 }
11486
11487 let next_out_of_line = decoder.next_out_of_line();
11488 let handles_before = decoder.remaining_handles();
11489 if let Some((inlined, num_bytes, num_handles)) =
11490 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11491 {
11492 let member_inline_size =
11493 <TouchInputDescriptor as fidl::encoding::TypeMarker>::inline_size(
11494 decoder.context,
11495 );
11496 if inlined != (member_inline_size <= 4) {
11497 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11498 }
11499 let inner_offset;
11500 let mut inner_depth = depth.clone();
11501 if inlined {
11502 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11503 inner_offset = next_offset;
11504 } else {
11505 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11506 inner_depth.increment()?;
11507 }
11508 let val_ref =
11509 self.input.get_or_insert_with(|| fidl::new_empty!(TouchInputDescriptor, D));
11510 fidl::decode!(
11511 TouchInputDescriptor,
11512 D,
11513 val_ref,
11514 decoder,
11515 inner_offset,
11516 inner_depth
11517 )?;
11518 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11519 {
11520 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11521 }
11522 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11523 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11524 }
11525 }
11526
11527 next_offset += envelope_size;
11528 _next_ordinal_to_read += 1;
11529 if next_offset >= end_offset {
11530 return Ok(());
11531 }
11532
11533 while _next_ordinal_to_read < 2 {
11535 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11536 _next_ordinal_to_read += 1;
11537 next_offset += envelope_size;
11538 }
11539
11540 let next_out_of_line = decoder.next_out_of_line();
11541 let handles_before = decoder.remaining_handles();
11542 if let Some((inlined, num_bytes, num_handles)) =
11543 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11544 {
11545 let member_inline_size =
11546 <TouchFeatureDescriptor as fidl::encoding::TypeMarker>::inline_size(
11547 decoder.context,
11548 );
11549 if inlined != (member_inline_size <= 4) {
11550 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11551 }
11552 let inner_offset;
11553 let mut inner_depth = depth.clone();
11554 if inlined {
11555 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11556 inner_offset = next_offset;
11557 } else {
11558 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11559 inner_depth.increment()?;
11560 }
11561 let val_ref =
11562 self.feature.get_or_insert_with(|| fidl::new_empty!(TouchFeatureDescriptor, D));
11563 fidl::decode!(
11564 TouchFeatureDescriptor,
11565 D,
11566 val_ref,
11567 decoder,
11568 inner_offset,
11569 inner_depth
11570 )?;
11571 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11572 {
11573 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11574 }
11575 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11576 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11577 }
11578 }
11579
11580 next_offset += envelope_size;
11581
11582 while next_offset < end_offset {
11584 _next_ordinal_to_read += 1;
11585 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11586 next_offset += envelope_size;
11587 }
11588
11589 Ok(())
11590 }
11591 }
11592
11593 impl TouchFeatureDescriptor {
11594 #[inline(always)]
11595 fn max_ordinal_present(&self) -> u64 {
11596 if let Some(_) = self.supports_selective_reporting {
11597 return 2;
11598 }
11599 if let Some(_) = self.supports_input_mode {
11600 return 1;
11601 }
11602 0
11603 }
11604 }
11605
11606 impl fidl::encoding::ValueTypeMarker for TouchFeatureDescriptor {
11607 type Borrowed<'a> = &'a Self;
11608 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11609 value
11610 }
11611 }
11612
11613 unsafe impl fidl::encoding::TypeMarker for TouchFeatureDescriptor {
11614 type Owned = Self;
11615
11616 #[inline(always)]
11617 fn inline_align(_context: fidl::encoding::Context) -> usize {
11618 8
11619 }
11620
11621 #[inline(always)]
11622 fn inline_size(_context: fidl::encoding::Context) -> usize {
11623 16
11624 }
11625 }
11626
11627 unsafe impl<D: fidl::encoding::ResourceDialect>
11628 fidl::encoding::Encode<TouchFeatureDescriptor, D> for &TouchFeatureDescriptor
11629 {
11630 unsafe fn encode(
11631 self,
11632 encoder: &mut fidl::encoding::Encoder<'_, D>,
11633 offset: usize,
11634 mut depth: fidl::encoding::Depth,
11635 ) -> fidl::Result<()> {
11636 encoder.debug_check_bounds::<TouchFeatureDescriptor>(offset);
11637 let max_ordinal: u64 = self.max_ordinal_present();
11639 encoder.write_num(max_ordinal, offset);
11640 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11641 if max_ordinal == 0 {
11643 return Ok(());
11644 }
11645 depth.increment()?;
11646 let envelope_size = 8;
11647 let bytes_len = max_ordinal as usize * envelope_size;
11648 #[allow(unused_variables)]
11649 let offset = encoder.out_of_line_offset(bytes_len);
11650 let mut _prev_end_offset: usize = 0;
11651 if 1 > max_ordinal {
11652 return Ok(());
11653 }
11654
11655 let cur_offset: usize = (1 - 1) * envelope_size;
11658
11659 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11661
11662 fidl::encoding::encode_in_envelope_optional::<bool, D>(
11667 self.supports_input_mode
11668 .as_ref()
11669 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11670 encoder,
11671 offset + cur_offset,
11672 depth,
11673 )?;
11674
11675 _prev_end_offset = cur_offset + envelope_size;
11676 if 2 > max_ordinal {
11677 return Ok(());
11678 }
11679
11680 let cur_offset: usize = (2 - 1) * envelope_size;
11683
11684 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11686
11687 fidl::encoding::encode_in_envelope_optional::<bool, D>(
11692 self.supports_selective_reporting
11693 .as_ref()
11694 .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
11695 encoder,
11696 offset + cur_offset,
11697 depth,
11698 )?;
11699
11700 _prev_end_offset = cur_offset + envelope_size;
11701
11702 Ok(())
11703 }
11704 }
11705
11706 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
11707 for TouchFeatureDescriptor
11708 {
11709 #[inline(always)]
11710 fn new_empty() -> Self {
11711 Self::default()
11712 }
11713
11714 unsafe fn decode(
11715 &mut self,
11716 decoder: &mut fidl::encoding::Decoder<'_, D>,
11717 offset: usize,
11718 mut depth: fidl::encoding::Depth,
11719 ) -> fidl::Result<()> {
11720 decoder.debug_check_bounds::<Self>(offset);
11721 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11722 None => return Err(fidl::Error::NotNullable),
11723 Some(len) => len,
11724 };
11725 if len == 0 {
11727 return Ok(());
11728 };
11729 depth.increment()?;
11730 let envelope_size = 8;
11731 let bytes_len = len * envelope_size;
11732 let offset = decoder.out_of_line_offset(bytes_len)?;
11733 let mut _next_ordinal_to_read = 0;
11735 let mut next_offset = offset;
11736 let end_offset = offset + bytes_len;
11737 _next_ordinal_to_read += 1;
11738 if next_offset >= end_offset {
11739 return Ok(());
11740 }
11741
11742 while _next_ordinal_to_read < 1 {
11744 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11745 _next_ordinal_to_read += 1;
11746 next_offset += envelope_size;
11747 }
11748
11749 let next_out_of_line = decoder.next_out_of_line();
11750 let handles_before = decoder.remaining_handles();
11751 if let Some((inlined, num_bytes, num_handles)) =
11752 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11753 {
11754 let member_inline_size =
11755 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11756 if inlined != (member_inline_size <= 4) {
11757 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11758 }
11759 let inner_offset;
11760 let mut inner_depth = depth.clone();
11761 if inlined {
11762 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11763 inner_offset = next_offset;
11764 } else {
11765 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11766 inner_depth.increment()?;
11767 }
11768 let val_ref =
11769 self.supports_input_mode.get_or_insert_with(|| fidl::new_empty!(bool, D));
11770 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11771 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11772 {
11773 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11774 }
11775 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11776 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11777 }
11778 }
11779
11780 next_offset += envelope_size;
11781 _next_ordinal_to_read += 1;
11782 if next_offset >= end_offset {
11783 return Ok(());
11784 }
11785
11786 while _next_ordinal_to_read < 2 {
11788 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11789 _next_ordinal_to_read += 1;
11790 next_offset += envelope_size;
11791 }
11792
11793 let next_out_of_line = decoder.next_out_of_line();
11794 let handles_before = decoder.remaining_handles();
11795 if let Some((inlined, num_bytes, num_handles)) =
11796 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11797 {
11798 let member_inline_size =
11799 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11800 if inlined != (member_inline_size <= 4) {
11801 return Err(fidl::Error::InvalidInlineBitInEnvelope);
11802 }
11803 let inner_offset;
11804 let mut inner_depth = depth.clone();
11805 if inlined {
11806 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11807 inner_offset = next_offset;
11808 } else {
11809 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11810 inner_depth.increment()?;
11811 }
11812 let val_ref = self
11813 .supports_selective_reporting
11814 .get_or_insert_with(|| fidl::new_empty!(bool, D));
11815 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
11816 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11817 {
11818 return Err(fidl::Error::InvalidNumBytesInEnvelope);
11819 }
11820 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11821 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11822 }
11823 }
11824
11825 next_offset += envelope_size;
11826
11827 while next_offset < end_offset {
11829 _next_ordinal_to_read += 1;
11830 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11831 next_offset += envelope_size;
11832 }
11833
11834 Ok(())
11835 }
11836 }
11837
11838 impl TouchFeatureReport {
11839 #[inline(always)]
11840 fn max_ordinal_present(&self) -> u64 {
11841 if let Some(_) = self.selective_reporting {
11842 return 2;
11843 }
11844 if let Some(_) = self.input_mode {
11845 return 1;
11846 }
11847 0
11848 }
11849 }
11850
11851 impl fidl::encoding::ValueTypeMarker for TouchFeatureReport {
11852 type Borrowed<'a> = &'a Self;
11853 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11854 value
11855 }
11856 }
11857
11858 unsafe impl fidl::encoding::TypeMarker for TouchFeatureReport {
11859 type Owned = Self;
11860
11861 #[inline(always)]
11862 fn inline_align(_context: fidl::encoding::Context) -> usize {
11863 8
11864 }
11865
11866 #[inline(always)]
11867 fn inline_size(_context: fidl::encoding::Context) -> usize {
11868 16
11869 }
11870 }
11871
11872 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchFeatureReport, D>
11873 for &TouchFeatureReport
11874 {
11875 unsafe fn encode(
11876 self,
11877 encoder: &mut fidl::encoding::Encoder<'_, D>,
11878 offset: usize,
11879 mut depth: fidl::encoding::Depth,
11880 ) -> fidl::Result<()> {
11881 encoder.debug_check_bounds::<TouchFeatureReport>(offset);
11882 let max_ordinal: u64 = self.max_ordinal_present();
11884 encoder.write_num(max_ordinal, offset);
11885 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11886 if max_ordinal == 0 {
11888 return Ok(());
11889 }
11890 depth.increment()?;
11891 let envelope_size = 8;
11892 let bytes_len = max_ordinal as usize * envelope_size;
11893 #[allow(unused_variables)]
11894 let offset = encoder.out_of_line_offset(bytes_len);
11895 let mut _prev_end_offset: usize = 0;
11896 if 1 > max_ordinal {
11897 return Ok(());
11898 }
11899
11900 let cur_offset: usize = (1 - 1) * envelope_size;
11903
11904 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11906
11907 fidl::encoding::encode_in_envelope_optional::<TouchConfigurationInputMode, D>(
11912 self.input_mode
11913 .as_ref()
11914 .map(<TouchConfigurationInputMode as fidl::encoding::ValueTypeMarker>::borrow),
11915 encoder,
11916 offset + cur_offset,
11917 depth,
11918 )?;
11919
11920 _prev_end_offset = cur_offset + envelope_size;
11921 if 2 > max_ordinal {
11922 return Ok(());
11923 }
11924
11925 let cur_offset: usize = (2 - 1) * envelope_size;
11928
11929 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11931
11932 fidl::encoding::encode_in_envelope_optional::<SelectiveReportingFeatureReport, D>(
11937 self.selective_reporting.as_ref().map(
11938 <SelectiveReportingFeatureReport as fidl::encoding::ValueTypeMarker>::borrow,
11939 ),
11940 encoder,
11941 offset + cur_offset,
11942 depth,
11943 )?;
11944
11945 _prev_end_offset = cur_offset + envelope_size;
11946
11947 Ok(())
11948 }
11949 }
11950
11951 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchFeatureReport {
11952 #[inline(always)]
11953 fn new_empty() -> Self {
11954 Self::default()
11955 }
11956
11957 unsafe fn decode(
11958 &mut self,
11959 decoder: &mut fidl::encoding::Decoder<'_, D>,
11960 offset: usize,
11961 mut depth: fidl::encoding::Depth,
11962 ) -> fidl::Result<()> {
11963 decoder.debug_check_bounds::<Self>(offset);
11964 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11965 None => return Err(fidl::Error::NotNullable),
11966 Some(len) => len,
11967 };
11968 if len == 0 {
11970 return Ok(());
11971 };
11972 depth.increment()?;
11973 let envelope_size = 8;
11974 let bytes_len = len * envelope_size;
11975 let offset = decoder.out_of_line_offset(bytes_len)?;
11976 let mut _next_ordinal_to_read = 0;
11978 let mut next_offset = offset;
11979 let end_offset = offset + bytes_len;
11980 _next_ordinal_to_read += 1;
11981 if next_offset >= end_offset {
11982 return Ok(());
11983 }
11984
11985 while _next_ordinal_to_read < 1 {
11987 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11988 _next_ordinal_to_read += 1;
11989 next_offset += envelope_size;
11990 }
11991
11992 let next_out_of_line = decoder.next_out_of_line();
11993 let handles_before = decoder.remaining_handles();
11994 if let Some((inlined, num_bytes, num_handles)) =
11995 fidl::encoding::decode_envelope_header(decoder, next_offset)?
11996 {
11997 let member_inline_size =
11998 <TouchConfigurationInputMode as fidl::encoding::TypeMarker>::inline_size(
11999 decoder.context,
12000 );
12001 if inlined != (member_inline_size <= 4) {
12002 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12003 }
12004 let inner_offset;
12005 let mut inner_depth = depth.clone();
12006 if inlined {
12007 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12008 inner_offset = next_offset;
12009 } else {
12010 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12011 inner_depth.increment()?;
12012 }
12013 let val_ref = self
12014 .input_mode
12015 .get_or_insert_with(|| fidl::new_empty!(TouchConfigurationInputMode, D));
12016 fidl::decode!(
12017 TouchConfigurationInputMode,
12018 D,
12019 val_ref,
12020 decoder,
12021 inner_offset,
12022 inner_depth
12023 )?;
12024 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12025 {
12026 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12027 }
12028 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12029 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12030 }
12031 }
12032
12033 next_offset += envelope_size;
12034 _next_ordinal_to_read += 1;
12035 if next_offset >= end_offset {
12036 return Ok(());
12037 }
12038
12039 while _next_ordinal_to_read < 2 {
12041 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12042 _next_ordinal_to_read += 1;
12043 next_offset += envelope_size;
12044 }
12045
12046 let next_out_of_line = decoder.next_out_of_line();
12047 let handles_before = decoder.remaining_handles();
12048 if let Some((inlined, num_bytes, num_handles)) =
12049 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12050 {
12051 let member_inline_size =
12052 <SelectiveReportingFeatureReport as fidl::encoding::TypeMarker>::inline_size(
12053 decoder.context,
12054 );
12055 if inlined != (member_inline_size <= 4) {
12056 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12057 }
12058 let inner_offset;
12059 let mut inner_depth = depth.clone();
12060 if inlined {
12061 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12062 inner_offset = next_offset;
12063 } else {
12064 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12065 inner_depth.increment()?;
12066 }
12067 let val_ref = self
12068 .selective_reporting
12069 .get_or_insert_with(|| fidl::new_empty!(SelectiveReportingFeatureReport, D));
12070 fidl::decode!(
12071 SelectiveReportingFeatureReport,
12072 D,
12073 val_ref,
12074 decoder,
12075 inner_offset,
12076 inner_depth
12077 )?;
12078 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12079 {
12080 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12081 }
12082 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12083 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12084 }
12085 }
12086
12087 next_offset += envelope_size;
12088
12089 while next_offset < end_offset {
12091 _next_ordinal_to_read += 1;
12092 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12093 next_offset += envelope_size;
12094 }
12095
12096 Ok(())
12097 }
12098 }
12099
12100 impl TouchInputDescriptor {
12101 #[inline(always)]
12102 fn max_ordinal_present(&self) -> u64 {
12103 if let Some(_) = self.buttons {
12104 return 4;
12105 }
12106 if let Some(_) = self.touch_type {
12107 return 3;
12108 }
12109 if let Some(_) = self.max_contacts {
12110 return 2;
12111 }
12112 if let Some(_) = self.contacts {
12113 return 1;
12114 }
12115 0
12116 }
12117 }
12118
12119 impl fidl::encoding::ValueTypeMarker for TouchInputDescriptor {
12120 type Borrowed<'a> = &'a Self;
12121 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12122 value
12123 }
12124 }
12125
12126 unsafe impl fidl::encoding::TypeMarker for TouchInputDescriptor {
12127 type Owned = Self;
12128
12129 #[inline(always)]
12130 fn inline_align(_context: fidl::encoding::Context) -> usize {
12131 8
12132 }
12133
12134 #[inline(always)]
12135 fn inline_size(_context: fidl::encoding::Context) -> usize {
12136 16
12137 }
12138 }
12139
12140 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputDescriptor, D>
12141 for &TouchInputDescriptor
12142 {
12143 unsafe fn encode(
12144 self,
12145 encoder: &mut fidl::encoding::Encoder<'_, D>,
12146 offset: usize,
12147 mut depth: fidl::encoding::Depth,
12148 ) -> fidl::Result<()> {
12149 encoder.debug_check_bounds::<TouchInputDescriptor>(offset);
12150 let max_ordinal: u64 = self.max_ordinal_present();
12152 encoder.write_num(max_ordinal, offset);
12153 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12154 if max_ordinal == 0 {
12156 return Ok(());
12157 }
12158 depth.increment()?;
12159 let envelope_size = 8;
12160 let bytes_len = max_ordinal as usize * envelope_size;
12161 #[allow(unused_variables)]
12162 let offset = encoder.out_of_line_offset(bytes_len);
12163 let mut _prev_end_offset: usize = 0;
12164 if 1 > max_ordinal {
12165 return Ok(());
12166 }
12167
12168 let cur_offset: usize = (1 - 1) * envelope_size;
12171
12172 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12174
12175 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputDescriptor, 10>, D>(
12180 self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12181 encoder, offset + cur_offset, depth
12182 )?;
12183
12184 _prev_end_offset = cur_offset + envelope_size;
12185 if 2 > max_ordinal {
12186 return Ok(());
12187 }
12188
12189 let cur_offset: usize = (2 - 1) * envelope_size;
12192
12193 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12195
12196 fidl::encoding::encode_in_envelope_optional::<u32, D>(
12201 self.max_contacts.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
12202 encoder,
12203 offset + cur_offset,
12204 depth,
12205 )?;
12206
12207 _prev_end_offset = cur_offset + envelope_size;
12208 if 3 > max_ordinal {
12209 return Ok(());
12210 }
12211
12212 let cur_offset: usize = (3 - 1) * envelope_size;
12215
12216 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12218
12219 fidl::encoding::encode_in_envelope_optional::<TouchType, D>(
12224 self.touch_type
12225 .as_ref()
12226 .map(<TouchType as fidl::encoding::ValueTypeMarker>::borrow),
12227 encoder,
12228 offset + cur_offset,
12229 depth,
12230 )?;
12231
12232 _prev_end_offset = cur_offset + envelope_size;
12233 if 4 > max_ordinal {
12234 return Ok(());
12235 }
12236
12237 let cur_offset: usize = (4 - 1) * envelope_size;
12240
12241 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12243
12244 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
12249 self.buttons.as_ref().map(
12250 <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
12251 ),
12252 encoder,
12253 offset + cur_offset,
12254 depth,
12255 )?;
12256
12257 _prev_end_offset = cur_offset + envelope_size;
12258
12259 Ok(())
12260 }
12261 }
12262
12263 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputDescriptor {
12264 #[inline(always)]
12265 fn new_empty() -> Self {
12266 Self::default()
12267 }
12268
12269 unsafe fn decode(
12270 &mut self,
12271 decoder: &mut fidl::encoding::Decoder<'_, D>,
12272 offset: usize,
12273 mut depth: fidl::encoding::Depth,
12274 ) -> fidl::Result<()> {
12275 decoder.debug_check_bounds::<Self>(offset);
12276 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12277 None => return Err(fidl::Error::NotNullable),
12278 Some(len) => len,
12279 };
12280 if len == 0 {
12282 return Ok(());
12283 };
12284 depth.increment()?;
12285 let envelope_size = 8;
12286 let bytes_len = len * envelope_size;
12287 let offset = decoder.out_of_line_offset(bytes_len)?;
12288 let mut _next_ordinal_to_read = 0;
12290 let mut next_offset = offset;
12291 let end_offset = offset + bytes_len;
12292 _next_ordinal_to_read += 1;
12293 if next_offset >= end_offset {
12294 return Ok(());
12295 }
12296
12297 while _next_ordinal_to_read < 1 {
12299 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12300 _next_ordinal_to_read += 1;
12301 next_offset += envelope_size;
12302 }
12303
12304 let next_out_of_line = decoder.next_out_of_line();
12305 let handles_before = decoder.remaining_handles();
12306 if let Some((inlined, num_bytes, num_handles)) =
12307 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12308 {
12309 let member_inline_size = <fidl::encoding::Vector<ContactInputDescriptor, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12310 if inlined != (member_inline_size <= 4) {
12311 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12312 }
12313 let inner_offset;
12314 let mut inner_depth = depth.clone();
12315 if inlined {
12316 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12317 inner_offset = next_offset;
12318 } else {
12319 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12320 inner_depth.increment()?;
12321 }
12322 let val_ref = self.contacts.get_or_insert_with(
12323 || fidl::new_empty!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D),
12324 );
12325 fidl::decode!(fidl::encoding::Vector<ContactInputDescriptor, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12326 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12327 {
12328 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12329 }
12330 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12331 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12332 }
12333 }
12334
12335 next_offset += envelope_size;
12336 _next_ordinal_to_read += 1;
12337 if next_offset >= end_offset {
12338 return Ok(());
12339 }
12340
12341 while _next_ordinal_to_read < 2 {
12343 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12344 _next_ordinal_to_read += 1;
12345 next_offset += envelope_size;
12346 }
12347
12348 let next_out_of_line = decoder.next_out_of_line();
12349 let handles_before = decoder.remaining_handles();
12350 if let Some((inlined, num_bytes, num_handles)) =
12351 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12352 {
12353 let member_inline_size =
12354 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12355 if inlined != (member_inline_size <= 4) {
12356 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12357 }
12358 let inner_offset;
12359 let mut inner_depth = depth.clone();
12360 if inlined {
12361 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12362 inner_offset = next_offset;
12363 } else {
12364 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12365 inner_depth.increment()?;
12366 }
12367 let val_ref = self.max_contacts.get_or_insert_with(|| fidl::new_empty!(u32, D));
12368 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
12369 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12370 {
12371 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12372 }
12373 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12374 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12375 }
12376 }
12377
12378 next_offset += envelope_size;
12379 _next_ordinal_to_read += 1;
12380 if next_offset >= end_offset {
12381 return Ok(());
12382 }
12383
12384 while _next_ordinal_to_read < 3 {
12386 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12387 _next_ordinal_to_read += 1;
12388 next_offset += envelope_size;
12389 }
12390
12391 let next_out_of_line = decoder.next_out_of_line();
12392 let handles_before = decoder.remaining_handles();
12393 if let Some((inlined, num_bytes, num_handles)) =
12394 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12395 {
12396 let member_inline_size =
12397 <TouchType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12398 if inlined != (member_inline_size <= 4) {
12399 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12400 }
12401 let inner_offset;
12402 let mut inner_depth = depth.clone();
12403 if inlined {
12404 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12405 inner_offset = next_offset;
12406 } else {
12407 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12408 inner_depth.increment()?;
12409 }
12410 let val_ref = self.touch_type.get_or_insert_with(|| fidl::new_empty!(TouchType, D));
12411 fidl::decode!(TouchType, D, val_ref, decoder, inner_offset, inner_depth)?;
12412 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12413 {
12414 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12415 }
12416 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12417 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12418 }
12419 }
12420
12421 next_offset += envelope_size;
12422 _next_ordinal_to_read += 1;
12423 if next_offset >= end_offset {
12424 return Ok(());
12425 }
12426
12427 while _next_ordinal_to_read < 4 {
12429 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12430 _next_ordinal_to_read += 1;
12431 next_offset += envelope_size;
12432 }
12433
12434 let next_out_of_line = decoder.next_out_of_line();
12435 let handles_before = decoder.remaining_handles();
12436 if let Some((inlined, num_bytes, num_handles)) =
12437 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12438 {
12439 let member_inline_size =
12440 <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
12441 decoder.context,
12442 );
12443 if inlined != (member_inline_size <= 4) {
12444 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12445 }
12446 let inner_offset;
12447 let mut inner_depth = depth.clone();
12448 if inlined {
12449 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12450 inner_offset = next_offset;
12451 } else {
12452 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12453 inner_depth.increment()?;
12454 }
12455 let val_ref = self
12456 .buttons
12457 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
12458 fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12459 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12460 {
12461 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12462 }
12463 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12464 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12465 }
12466 }
12467
12468 next_offset += envelope_size;
12469
12470 while next_offset < end_offset {
12472 _next_ordinal_to_read += 1;
12473 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12474 next_offset += envelope_size;
12475 }
12476
12477 Ok(())
12478 }
12479 }
12480
12481 impl TouchInputReport {
12482 #[inline(always)]
12483 fn max_ordinal_present(&self) -> u64 {
12484 if let Some(_) = self.pressed_buttons {
12485 return 2;
12486 }
12487 if let Some(_) = self.contacts {
12488 return 1;
12489 }
12490 0
12491 }
12492 }
12493
12494 impl fidl::encoding::ValueTypeMarker for TouchInputReport {
12495 type Borrowed<'a> = &'a Self;
12496 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12497 value
12498 }
12499 }
12500
12501 unsafe impl fidl::encoding::TypeMarker for TouchInputReport {
12502 type Owned = Self;
12503
12504 #[inline(always)]
12505 fn inline_align(_context: fidl::encoding::Context) -> usize {
12506 8
12507 }
12508
12509 #[inline(always)]
12510 fn inline_size(_context: fidl::encoding::Context) -> usize {
12511 16
12512 }
12513 }
12514
12515 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchInputReport, D>
12516 for &TouchInputReport
12517 {
12518 unsafe fn encode(
12519 self,
12520 encoder: &mut fidl::encoding::Encoder<'_, D>,
12521 offset: usize,
12522 mut depth: fidl::encoding::Depth,
12523 ) -> fidl::Result<()> {
12524 encoder.debug_check_bounds::<TouchInputReport>(offset);
12525 let max_ordinal: u64 = self.max_ordinal_present();
12527 encoder.write_num(max_ordinal, offset);
12528 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12529 if max_ordinal == 0 {
12531 return Ok(());
12532 }
12533 depth.increment()?;
12534 let envelope_size = 8;
12535 let bytes_len = max_ordinal as usize * envelope_size;
12536 #[allow(unused_variables)]
12537 let offset = encoder.out_of_line_offset(bytes_len);
12538 let mut _prev_end_offset: usize = 0;
12539 if 1 > max_ordinal {
12540 return Ok(());
12541 }
12542
12543 let cur_offset: usize = (1 - 1) * envelope_size;
12546
12547 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12549
12550 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<ContactInputReport, 10>, D>(
12555 self.contacts.as_ref().map(<fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::ValueTypeMarker>::borrow),
12556 encoder, offset + cur_offset, depth
12557 )?;
12558
12559 _prev_end_offset = cur_offset + envelope_size;
12560 if 2 > max_ordinal {
12561 return Ok(());
12562 }
12563
12564 let cur_offset: usize = (2 - 1) * envelope_size;
12567
12568 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12570
12571 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 10>, D>(
12576 self.pressed_buttons.as_ref().map(
12577 <fidl::encoding::Vector<u8, 10> as fidl::encoding::ValueTypeMarker>::borrow,
12578 ),
12579 encoder,
12580 offset + cur_offset,
12581 depth,
12582 )?;
12583
12584 _prev_end_offset = cur_offset + envelope_size;
12585
12586 Ok(())
12587 }
12588 }
12589
12590 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchInputReport {
12591 #[inline(always)]
12592 fn new_empty() -> Self {
12593 Self::default()
12594 }
12595
12596 unsafe fn decode(
12597 &mut self,
12598 decoder: &mut fidl::encoding::Decoder<'_, D>,
12599 offset: usize,
12600 mut depth: fidl::encoding::Depth,
12601 ) -> fidl::Result<()> {
12602 decoder.debug_check_bounds::<Self>(offset);
12603 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12604 None => return Err(fidl::Error::NotNullable),
12605 Some(len) => len,
12606 };
12607 if len == 0 {
12609 return Ok(());
12610 };
12611 depth.increment()?;
12612 let envelope_size = 8;
12613 let bytes_len = len * envelope_size;
12614 let offset = decoder.out_of_line_offset(bytes_len)?;
12615 let mut _next_ordinal_to_read = 0;
12617 let mut next_offset = offset;
12618 let end_offset = offset + bytes_len;
12619 _next_ordinal_to_read += 1;
12620 if next_offset >= end_offset {
12621 return Ok(());
12622 }
12623
12624 while _next_ordinal_to_read < 1 {
12626 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12627 _next_ordinal_to_read += 1;
12628 next_offset += envelope_size;
12629 }
12630
12631 let next_out_of_line = decoder.next_out_of_line();
12632 let handles_before = decoder.remaining_handles();
12633 if let Some((inlined, num_bytes, num_handles)) =
12634 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12635 {
12636 let member_inline_size = <fidl::encoding::Vector<ContactInputReport, 10> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12637 if inlined != (member_inline_size <= 4) {
12638 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12639 }
12640 let inner_offset;
12641 let mut inner_depth = depth.clone();
12642 if inlined {
12643 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12644 inner_offset = next_offset;
12645 } else {
12646 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12647 inner_depth.increment()?;
12648 }
12649 let val_ref = self.contacts.get_or_insert_with(
12650 || fidl::new_empty!(fidl::encoding::Vector<ContactInputReport, 10>, D),
12651 );
12652 fidl::decode!(fidl::encoding::Vector<ContactInputReport, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12653 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12654 {
12655 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12656 }
12657 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12658 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12659 }
12660 }
12661
12662 next_offset += envelope_size;
12663 _next_ordinal_to_read += 1;
12664 if next_offset >= end_offset {
12665 return Ok(());
12666 }
12667
12668 while _next_ordinal_to_read < 2 {
12670 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12671 _next_ordinal_to_read += 1;
12672 next_offset += envelope_size;
12673 }
12674
12675 let next_out_of_line = decoder.next_out_of_line();
12676 let handles_before = decoder.remaining_handles();
12677 if let Some((inlined, num_bytes, num_handles)) =
12678 fidl::encoding::decode_envelope_header(decoder, next_offset)?
12679 {
12680 let member_inline_size =
12681 <fidl::encoding::Vector<u8, 10> as fidl::encoding::TypeMarker>::inline_size(
12682 decoder.context,
12683 );
12684 if inlined != (member_inline_size <= 4) {
12685 return Err(fidl::Error::InvalidInlineBitInEnvelope);
12686 }
12687 let inner_offset;
12688 let mut inner_depth = depth.clone();
12689 if inlined {
12690 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12691 inner_offset = next_offset;
12692 } else {
12693 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12694 inner_depth.increment()?;
12695 }
12696 let val_ref = self
12697 .pressed_buttons
12698 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 10>, D));
12699 fidl::decode!(fidl::encoding::Vector<u8, 10>, D, val_ref, decoder, inner_offset, inner_depth)?;
12700 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12701 {
12702 return Err(fidl::Error::InvalidNumBytesInEnvelope);
12703 }
12704 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12705 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12706 }
12707 }
12708
12709 next_offset += envelope_size;
12710
12711 while next_offset < end_offset {
12713 _next_ordinal_to_read += 1;
12714 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12715 next_offset += envelope_size;
12716 }
12717
12718 Ok(())
12719 }
12720 }
12721}