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 MOUSE_MAX_NUM_BUTTONS: u32 = 32;
22
23pub const TOUCH_MAX_CONTACTS: u32 = 10;
26
27pub const TOUCH_MAX_NUM_BUTTONS: u32 = 10;
29
30#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
33pub enum ConsumerControlButton {
34 VolumeUp,
36 VolumeDown,
38 Pause,
40 FactoryReset,
42 MicMute,
44 Reboot,
46 CameraDisable,
48 Function,
50 Power,
52 #[doc(hidden)]
53 __SourceBreaking { unknown_ordinal: u32 },
54}
55
56#[macro_export]
58macro_rules! ConsumerControlButtonUnknown {
59 () => {
60 _
61 };
62}
63
64impl ConsumerControlButton {
65 #[inline]
66 pub fn from_primitive(prim: u32) -> Option<Self> {
67 match prim {
68 1 => Some(Self::VolumeUp),
69 2 => Some(Self::VolumeDown),
70 3 => Some(Self::Pause),
71 4 => Some(Self::FactoryReset),
72 5 => Some(Self::MicMute),
73 6 => Some(Self::Reboot),
74 7 => Some(Self::CameraDisable),
75 8 => Some(Self::Function),
76 9 => Some(Self::Power),
77 _ => None,
78 }
79 }
80
81 #[inline]
82 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
83 match prim {
84 1 => Self::VolumeUp,
85 2 => Self::VolumeDown,
86 3 => Self::Pause,
87 4 => Self::FactoryReset,
88 5 => Self::MicMute,
89 6 => Self::Reboot,
90 7 => Self::CameraDisable,
91 8 => Self::Function,
92 9 => Self::Power,
93 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
94 }
95 }
96
97 #[inline]
98 pub fn unknown() -> Self {
99 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
100 }
101
102 #[inline]
103 pub const fn into_primitive(self) -> u32 {
104 match self {
105 Self::VolumeUp => 1,
106 Self::VolumeDown => 2,
107 Self::Pause => 3,
108 Self::FactoryReset => 4,
109 Self::MicMute => 5,
110 Self::Reboot => 6,
111 Self::CameraDisable => 7,
112 Self::Function => 8,
113 Self::Power => 9,
114 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
115 }
116 }
117
118 #[inline]
119 pub fn is_unknown(&self) -> bool {
120 match self {
121 Self::__SourceBreaking { unknown_ordinal: _ } => true,
122 _ => false,
123 }
124 }
125}
126
127#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
138pub enum Key {
139 Unknown,
141 A,
143 B,
145 C,
147 D,
149 E,
151 F,
153 G,
155 H,
157 I,
159 J,
161 K,
163 L,
165 M,
167 N,
169 O,
171 P,
173 Q,
175 R,
177 S,
179 T,
181 U,
183 V,
185 W,
187 X,
189 Y,
191 Z,
193 Key1,
195 Key2,
197 Key3,
199 Key4,
201 Key5,
203 Key6,
205 Key7,
207 Key8,
209 Key9,
211 Key0,
213 Enter,
215 Escape,
217 Backspace,
219 Tab,
221 Space,
223 Minus,
225 Equals,
227 LeftBrace,
229 RightBrace,
231 Backslash,
233 NonUsHash,
235 Semicolon,
237 Apostrophe,
239 GraveAccent,
241 Comma,
243 Dot,
245 Slash,
247 CapsLock,
249 F1,
251 F2,
253 F3,
255 F4,
257 F5,
259 F6,
261 F7,
263 F8,
265 F9,
267 F10,
269 F11,
271 F12,
273 PrintScreen,
275 ScrollLock,
277 Pause,
279 Insert,
281 Home,
283 PageUp,
285 Delete,
287 End,
289 PageDown,
291 Right,
293 Left,
295 Down,
297 Up,
299 NumLock,
301 KeypadSlash,
303 KeypadAsterisk,
305 KeypadMinus,
307 KeypadPlus,
309 KeypadEnter,
311 Keypad1,
313 Keypad2,
315 Keypad3,
317 Keypad4,
319 Keypad5,
321 Keypad6,
323 Keypad7,
325 Keypad8,
327 Keypad9,
329 Keypad0,
331 KeypadDot,
333 NonUsBackslash,
335 KeypadEquals,
337 Menu,
339 LeftCtrl,
341 LeftShift,
343 LeftAlt,
345 LeftMeta,
347 RightCtrl,
349 RightShift,
351 RightAlt,
353 RightMeta,
355 Mute,
359 VolumeDown,
361 VolumeUp,
363 PlayPause,
365 MediaMute,
370 MediaVolumeIncrement,
372 MediaVolumeDecrement,
374 AcBack,
381 AcRefresh,
385 AcFullScreenView,
389 AcSelectTaskApplication,
393 BrightnessDown,
395 BrightnessUp,
397 Assistant,
401 Power,
403 Sleep,
405 Unknown0055,
410 Unknown0056,
411 Unknown0059,
412 Unknown005C,
413 Unknown005D,
414 Unknown005E,
415 Unknown0079,
416 Unknown007A,
417 Unknown007B,
418 Unknown007C,
419 Unknown0085,
420 Unknown0087,
421 Unknown0089,
422 Unknown009C,
423 Unknown009F,
424 Unknown00A0,
425 Unknown00A2,
426 Unknown00A3,
427 Unknown00A5,
428 Unknown00A6,
429 Unknown00A7,
430 Unknown00A8,
431 Unknown00A9,
432 Unknown00Ad,
433 Unknown00B1,
434 Unknown00B2,
435 Unknown00B3,
436 Unknown00B4,
437 Unknown00C9,
438 Unknown00Cf,
439 Unknown00D0,
440 Unknown00D4,
441 Unknown00E2,
442 Unknown0120,
443 Unknown0121,
444 Unknown0122,
445 Unknown0123,
446 Unknown0124,
447 Unknown0125,
448 Unknown0126,
449 Unknown0127,
450 Unknown0128,
451 Unknown0129,
452 Unknown012A,
453 Unknown012B,
454 Unknown012C,
455 Unknown012D,
456 Unknown012E,
457 Unknown012F,
458 Unknown0130,
459 Unknown0131,
460 Unknown0132,
461 Unknown0133,
462 Unknown0134,
463 Unknown0135,
464 Unknown0136,
465 Unknown0137,
466 Unknown0138,
467 Unknown0139,
468 Unknown013A,
469 Unknown013B,
470 Unknown013C,
471 Unknown013D,
472 Unknown013E,
473 Unknown0161,
474 Unknown016A,
475 Unknown016E,
476 Unknown0172,
477 Unknown0179,
478 Unknown018E,
479 Unknown018F,
480 Unknown0190,
481 Unknown0191,
482 Unknown0192,
483 Unknown0193,
484 Unknown0195,
485 Unknown01D0,
486 Unknown020A,
487 Unknown020B,
488 #[doc(hidden)]
489 __SourceBreaking {
490 unknown_ordinal: u32,
491 },
492}
493
494#[macro_export]
496macro_rules! KeyUnknown {
497 () => {
498 _
499 };
500}
501
502impl Key {
503 #[inline]
504 pub fn from_primitive(prim: u32) -> Option<Self> {
505 match prim {
506 0 => Some(Self::Unknown),
507 458756 => Some(Self::A),
508 458757 => Some(Self::B),
509 458758 => Some(Self::C),
510 458759 => Some(Self::D),
511 458760 => Some(Self::E),
512 458761 => Some(Self::F),
513 458762 => Some(Self::G),
514 458763 => Some(Self::H),
515 458764 => Some(Self::I),
516 458765 => Some(Self::J),
517 458766 => Some(Self::K),
518 458767 => Some(Self::L),
519 458768 => Some(Self::M),
520 458769 => Some(Self::N),
521 458770 => Some(Self::O),
522 458771 => Some(Self::P),
523 458772 => Some(Self::Q),
524 458773 => Some(Self::R),
525 458774 => Some(Self::S),
526 458775 => Some(Self::T),
527 458776 => Some(Self::U),
528 458777 => Some(Self::V),
529 458778 => Some(Self::W),
530 458779 => Some(Self::X),
531 458780 => Some(Self::Y),
532 458781 => Some(Self::Z),
533 458782 => Some(Self::Key1),
534 458783 => Some(Self::Key2),
535 458784 => Some(Self::Key3),
536 458785 => Some(Self::Key4),
537 458786 => Some(Self::Key5),
538 458787 => Some(Self::Key6),
539 458788 => Some(Self::Key7),
540 458789 => Some(Self::Key8),
541 458790 => Some(Self::Key9),
542 458791 => Some(Self::Key0),
543 458792 => Some(Self::Enter),
544 458793 => Some(Self::Escape),
545 458794 => Some(Self::Backspace),
546 458795 => Some(Self::Tab),
547 458796 => Some(Self::Space),
548 458797 => Some(Self::Minus),
549 458798 => Some(Self::Equals),
550 458799 => Some(Self::LeftBrace),
551 458800 => Some(Self::RightBrace),
552 458801 => Some(Self::Backslash),
553 458802 => Some(Self::NonUsHash),
554 458803 => Some(Self::Semicolon),
555 458804 => Some(Self::Apostrophe),
556 458805 => Some(Self::GraveAccent),
557 458806 => Some(Self::Comma),
558 458807 => Some(Self::Dot),
559 458808 => Some(Self::Slash),
560 458809 => Some(Self::CapsLock),
561 458810 => Some(Self::F1),
562 458811 => Some(Self::F2),
563 458812 => Some(Self::F3),
564 458813 => Some(Self::F4),
565 458814 => Some(Self::F5),
566 458815 => Some(Self::F6),
567 458816 => Some(Self::F7),
568 458817 => Some(Self::F8),
569 458818 => Some(Self::F9),
570 458819 => Some(Self::F10),
571 458820 => Some(Self::F11),
572 458821 => Some(Self::F12),
573 458822 => Some(Self::PrintScreen),
574 458823 => Some(Self::ScrollLock),
575 458824 => Some(Self::Pause),
576 458825 => Some(Self::Insert),
577 458826 => Some(Self::Home),
578 458827 => Some(Self::PageUp),
579 458828 => Some(Self::Delete),
580 458829 => Some(Self::End),
581 458830 => Some(Self::PageDown),
582 458831 => Some(Self::Right),
583 458832 => Some(Self::Left),
584 458833 => Some(Self::Down),
585 458834 => Some(Self::Up),
586 458835 => Some(Self::NumLock),
587 458836 => Some(Self::KeypadSlash),
588 458837 => Some(Self::KeypadAsterisk),
589 458838 => Some(Self::KeypadMinus),
590 458839 => Some(Self::KeypadPlus),
591 458840 => Some(Self::KeypadEnter),
592 458841 => Some(Self::Keypad1),
593 458842 => Some(Self::Keypad2),
594 458843 => Some(Self::Keypad3),
595 458844 => Some(Self::Keypad4),
596 458845 => Some(Self::Keypad5),
597 458846 => Some(Self::Keypad6),
598 458847 => Some(Self::Keypad7),
599 458848 => Some(Self::Keypad8),
600 458849 => Some(Self::Keypad9),
601 458850 => Some(Self::Keypad0),
602 458851 => Some(Self::KeypadDot),
603 458852 => Some(Self::NonUsBackslash),
604 458855 => Some(Self::KeypadEquals),
605 458870 => Some(Self::Menu),
606 458976 => Some(Self::LeftCtrl),
607 458977 => Some(Self::LeftShift),
608 458978 => Some(Self::LeftAlt),
609 458979 => Some(Self::LeftMeta),
610 458980 => Some(Self::RightCtrl),
611 458981 => Some(Self::RightShift),
612 458982 => Some(Self::RightAlt),
613 458983 => Some(Self::RightMeta),
614 458879 => Some(Self::Mute),
615 458881 => Some(Self::VolumeDown),
616 458880 => Some(Self::VolumeUp),
617 786637 => Some(Self::PlayPause),
618 786658 => Some(Self::MediaMute),
619 786665 => Some(Self::MediaVolumeIncrement),
620 786666 => Some(Self::MediaVolumeDecrement),
621 786980 => Some(Self::AcBack),
622 786983 => Some(Self::AcRefresh),
623 786992 => Some(Self::AcFullScreenView),
624 786850 => Some(Self::AcSelectTaskApplication),
625 786543 => Some(Self::BrightnessDown),
626 786544 => Some(Self::BrightnessUp),
627 4294901761 => Some(Self::Assistant),
628 4294901762 => Some(Self::Power),
629 4294901763 => Some(Self::Sleep),
630 4294901845 => Some(Self::Unknown0055),
631 4294901846 => Some(Self::Unknown0056),
632 4294901849 => Some(Self::Unknown0059),
633 4294901852 => Some(Self::Unknown005C),
634 4294901853 => Some(Self::Unknown005D),
635 4294901854 => Some(Self::Unknown005E),
636 4294901881 => Some(Self::Unknown0079),
637 4294901882 => Some(Self::Unknown007A),
638 4294901883 => Some(Self::Unknown007B),
639 4294901884 => Some(Self::Unknown007C),
640 4294901893 => Some(Self::Unknown0085),
641 4294901895 => Some(Self::Unknown0087),
642 4294901897 => Some(Self::Unknown0089),
643 4294901916 => Some(Self::Unknown009C),
644 4294901919 => Some(Self::Unknown009F),
645 4294901920 => Some(Self::Unknown00A0),
646 4294901922 => Some(Self::Unknown00A2),
647 4294901923 => Some(Self::Unknown00A3),
648 4294901925 => Some(Self::Unknown00A5),
649 4294901926 => Some(Self::Unknown00A6),
650 4294901927 => Some(Self::Unknown00A7),
651 4294901928 => Some(Self::Unknown00A8),
652 4294901929 => Some(Self::Unknown00A9),
653 4294901933 => Some(Self::Unknown00Ad),
654 4294901937 => Some(Self::Unknown00B1),
655 4294901938 => Some(Self::Unknown00B2),
656 4294901939 => Some(Self::Unknown00B3),
657 4294901940 => Some(Self::Unknown00B4),
658 4294901961 => Some(Self::Unknown00C9),
659 4294901967 => Some(Self::Unknown00Cf),
660 4294901968 => Some(Self::Unknown00D0),
661 4294901972 => Some(Self::Unknown00D4),
662 4294901986 => Some(Self::Unknown00E2),
663 4294902048 => Some(Self::Unknown0120),
664 4294902049 => Some(Self::Unknown0121),
665 4294902050 => Some(Self::Unknown0122),
666 4294902051 => Some(Self::Unknown0123),
667 4294902052 => Some(Self::Unknown0124),
668 4294902053 => Some(Self::Unknown0125),
669 4294902054 => Some(Self::Unknown0126),
670 4294902055 => Some(Self::Unknown0127),
671 4294902056 => Some(Self::Unknown0128),
672 4294902057 => Some(Self::Unknown0129),
673 4294902058 => Some(Self::Unknown012A),
674 4294902059 => Some(Self::Unknown012B),
675 4294902060 => Some(Self::Unknown012C),
676 4294902061 => Some(Self::Unknown012D),
677 4294902062 => Some(Self::Unknown012E),
678 4294902063 => Some(Self::Unknown012F),
679 4294902064 => Some(Self::Unknown0130),
680 4294902065 => Some(Self::Unknown0131),
681 4294902066 => Some(Self::Unknown0132),
682 4294902067 => Some(Self::Unknown0133),
683 4294902068 => Some(Self::Unknown0134),
684 4294902069 => Some(Self::Unknown0135),
685 4294902070 => Some(Self::Unknown0136),
686 4294902071 => Some(Self::Unknown0137),
687 4294902072 => Some(Self::Unknown0138),
688 4294902073 => Some(Self::Unknown0139),
689 4294902074 => Some(Self::Unknown013A),
690 4294902075 => Some(Self::Unknown013B),
691 4294902076 => Some(Self::Unknown013C),
692 4294902077 => Some(Self::Unknown013D),
693 4294902078 => Some(Self::Unknown013E),
694 4294902113 => Some(Self::Unknown0161),
695 4294902122 => Some(Self::Unknown016A),
696 4294902126 => Some(Self::Unknown016E),
697 4294902130 => Some(Self::Unknown0172),
698 4294902137 => Some(Self::Unknown0179),
699 4294902158 => Some(Self::Unknown018E),
700 4294902159 => Some(Self::Unknown018F),
701 4294902160 => Some(Self::Unknown0190),
702 4294902161 => Some(Self::Unknown0191),
703 4294902162 => Some(Self::Unknown0192),
704 4294902163 => Some(Self::Unknown0193),
705 4294902165 => Some(Self::Unknown0195),
706 4294902224 => Some(Self::Unknown01D0),
707 4294902282 => Some(Self::Unknown020A),
708 4294902283 => Some(Self::Unknown020B),
709 _ => None,
710 }
711 }
712
713 #[inline]
714 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
715 match prim {
716 0 => Self::Unknown,
717 458756 => Self::A,
718 458757 => Self::B,
719 458758 => Self::C,
720 458759 => Self::D,
721 458760 => Self::E,
722 458761 => Self::F,
723 458762 => Self::G,
724 458763 => Self::H,
725 458764 => Self::I,
726 458765 => Self::J,
727 458766 => Self::K,
728 458767 => Self::L,
729 458768 => Self::M,
730 458769 => Self::N,
731 458770 => Self::O,
732 458771 => Self::P,
733 458772 => Self::Q,
734 458773 => Self::R,
735 458774 => Self::S,
736 458775 => Self::T,
737 458776 => Self::U,
738 458777 => Self::V,
739 458778 => Self::W,
740 458779 => Self::X,
741 458780 => Self::Y,
742 458781 => Self::Z,
743 458782 => Self::Key1,
744 458783 => Self::Key2,
745 458784 => Self::Key3,
746 458785 => Self::Key4,
747 458786 => Self::Key5,
748 458787 => Self::Key6,
749 458788 => Self::Key7,
750 458789 => Self::Key8,
751 458790 => Self::Key9,
752 458791 => Self::Key0,
753 458792 => Self::Enter,
754 458793 => Self::Escape,
755 458794 => Self::Backspace,
756 458795 => Self::Tab,
757 458796 => Self::Space,
758 458797 => Self::Minus,
759 458798 => Self::Equals,
760 458799 => Self::LeftBrace,
761 458800 => Self::RightBrace,
762 458801 => Self::Backslash,
763 458802 => Self::NonUsHash,
764 458803 => Self::Semicolon,
765 458804 => Self::Apostrophe,
766 458805 => Self::GraveAccent,
767 458806 => Self::Comma,
768 458807 => Self::Dot,
769 458808 => Self::Slash,
770 458809 => Self::CapsLock,
771 458810 => Self::F1,
772 458811 => Self::F2,
773 458812 => Self::F3,
774 458813 => Self::F4,
775 458814 => Self::F5,
776 458815 => Self::F6,
777 458816 => Self::F7,
778 458817 => Self::F8,
779 458818 => Self::F9,
780 458819 => Self::F10,
781 458820 => Self::F11,
782 458821 => Self::F12,
783 458822 => Self::PrintScreen,
784 458823 => Self::ScrollLock,
785 458824 => Self::Pause,
786 458825 => Self::Insert,
787 458826 => Self::Home,
788 458827 => Self::PageUp,
789 458828 => Self::Delete,
790 458829 => Self::End,
791 458830 => Self::PageDown,
792 458831 => Self::Right,
793 458832 => Self::Left,
794 458833 => Self::Down,
795 458834 => Self::Up,
796 458835 => Self::NumLock,
797 458836 => Self::KeypadSlash,
798 458837 => Self::KeypadAsterisk,
799 458838 => Self::KeypadMinus,
800 458839 => Self::KeypadPlus,
801 458840 => Self::KeypadEnter,
802 458841 => Self::Keypad1,
803 458842 => Self::Keypad2,
804 458843 => Self::Keypad3,
805 458844 => Self::Keypad4,
806 458845 => Self::Keypad5,
807 458846 => Self::Keypad6,
808 458847 => Self::Keypad7,
809 458848 => Self::Keypad8,
810 458849 => Self::Keypad9,
811 458850 => Self::Keypad0,
812 458851 => Self::KeypadDot,
813 458852 => Self::NonUsBackslash,
814 458855 => Self::KeypadEquals,
815 458870 => Self::Menu,
816 458976 => Self::LeftCtrl,
817 458977 => Self::LeftShift,
818 458978 => Self::LeftAlt,
819 458979 => Self::LeftMeta,
820 458980 => Self::RightCtrl,
821 458981 => Self::RightShift,
822 458982 => Self::RightAlt,
823 458983 => Self::RightMeta,
824 458879 => Self::Mute,
825 458881 => Self::VolumeDown,
826 458880 => Self::VolumeUp,
827 786637 => Self::PlayPause,
828 786658 => Self::MediaMute,
829 786665 => Self::MediaVolumeIncrement,
830 786666 => Self::MediaVolumeDecrement,
831 786980 => Self::AcBack,
832 786983 => Self::AcRefresh,
833 786992 => Self::AcFullScreenView,
834 786850 => Self::AcSelectTaskApplication,
835 786543 => Self::BrightnessDown,
836 786544 => Self::BrightnessUp,
837 4294901761 => Self::Assistant,
838 4294901762 => Self::Power,
839 4294901763 => Self::Sleep,
840 4294901845 => Self::Unknown0055,
841 4294901846 => Self::Unknown0056,
842 4294901849 => Self::Unknown0059,
843 4294901852 => Self::Unknown005C,
844 4294901853 => Self::Unknown005D,
845 4294901854 => Self::Unknown005E,
846 4294901881 => Self::Unknown0079,
847 4294901882 => Self::Unknown007A,
848 4294901883 => Self::Unknown007B,
849 4294901884 => Self::Unknown007C,
850 4294901893 => Self::Unknown0085,
851 4294901895 => Self::Unknown0087,
852 4294901897 => Self::Unknown0089,
853 4294901916 => Self::Unknown009C,
854 4294901919 => Self::Unknown009F,
855 4294901920 => Self::Unknown00A0,
856 4294901922 => Self::Unknown00A2,
857 4294901923 => Self::Unknown00A3,
858 4294901925 => Self::Unknown00A5,
859 4294901926 => Self::Unknown00A6,
860 4294901927 => Self::Unknown00A7,
861 4294901928 => Self::Unknown00A8,
862 4294901929 => Self::Unknown00A9,
863 4294901933 => Self::Unknown00Ad,
864 4294901937 => Self::Unknown00B1,
865 4294901938 => Self::Unknown00B2,
866 4294901939 => Self::Unknown00B3,
867 4294901940 => Self::Unknown00B4,
868 4294901961 => Self::Unknown00C9,
869 4294901967 => Self::Unknown00Cf,
870 4294901968 => Self::Unknown00D0,
871 4294901972 => Self::Unknown00D4,
872 4294901986 => Self::Unknown00E2,
873 4294902048 => Self::Unknown0120,
874 4294902049 => Self::Unknown0121,
875 4294902050 => Self::Unknown0122,
876 4294902051 => Self::Unknown0123,
877 4294902052 => Self::Unknown0124,
878 4294902053 => Self::Unknown0125,
879 4294902054 => Self::Unknown0126,
880 4294902055 => Self::Unknown0127,
881 4294902056 => Self::Unknown0128,
882 4294902057 => Self::Unknown0129,
883 4294902058 => Self::Unknown012A,
884 4294902059 => Self::Unknown012B,
885 4294902060 => Self::Unknown012C,
886 4294902061 => Self::Unknown012D,
887 4294902062 => Self::Unknown012E,
888 4294902063 => Self::Unknown012F,
889 4294902064 => Self::Unknown0130,
890 4294902065 => Self::Unknown0131,
891 4294902066 => Self::Unknown0132,
892 4294902067 => Self::Unknown0133,
893 4294902068 => Self::Unknown0134,
894 4294902069 => Self::Unknown0135,
895 4294902070 => Self::Unknown0136,
896 4294902071 => Self::Unknown0137,
897 4294902072 => Self::Unknown0138,
898 4294902073 => Self::Unknown0139,
899 4294902074 => Self::Unknown013A,
900 4294902075 => Self::Unknown013B,
901 4294902076 => Self::Unknown013C,
902 4294902077 => Self::Unknown013D,
903 4294902078 => Self::Unknown013E,
904 4294902113 => Self::Unknown0161,
905 4294902122 => Self::Unknown016A,
906 4294902126 => Self::Unknown016E,
907 4294902130 => Self::Unknown0172,
908 4294902137 => Self::Unknown0179,
909 4294902158 => Self::Unknown018E,
910 4294902159 => Self::Unknown018F,
911 4294902160 => Self::Unknown0190,
912 4294902161 => Self::Unknown0191,
913 4294902162 => Self::Unknown0192,
914 4294902163 => Self::Unknown0193,
915 4294902165 => Self::Unknown0195,
916 4294902224 => Self::Unknown01D0,
917 4294902282 => Self::Unknown020A,
918 4294902283 => Self::Unknown020B,
919 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
920 }
921 }
922
923 #[inline]
924 pub fn unknown() -> Self {
925 Self::__SourceBreaking { unknown_ordinal: 0x0 }
926 }
927
928 #[inline]
929 pub const fn into_primitive(self) -> u32 {
930 match self {
931 Self::Unknown => 0,
932 Self::A => 458756,
933 Self::B => 458757,
934 Self::C => 458758,
935 Self::D => 458759,
936 Self::E => 458760,
937 Self::F => 458761,
938 Self::G => 458762,
939 Self::H => 458763,
940 Self::I => 458764,
941 Self::J => 458765,
942 Self::K => 458766,
943 Self::L => 458767,
944 Self::M => 458768,
945 Self::N => 458769,
946 Self::O => 458770,
947 Self::P => 458771,
948 Self::Q => 458772,
949 Self::R => 458773,
950 Self::S => 458774,
951 Self::T => 458775,
952 Self::U => 458776,
953 Self::V => 458777,
954 Self::W => 458778,
955 Self::X => 458779,
956 Self::Y => 458780,
957 Self::Z => 458781,
958 Self::Key1 => 458782,
959 Self::Key2 => 458783,
960 Self::Key3 => 458784,
961 Self::Key4 => 458785,
962 Self::Key5 => 458786,
963 Self::Key6 => 458787,
964 Self::Key7 => 458788,
965 Self::Key8 => 458789,
966 Self::Key9 => 458790,
967 Self::Key0 => 458791,
968 Self::Enter => 458792,
969 Self::Escape => 458793,
970 Self::Backspace => 458794,
971 Self::Tab => 458795,
972 Self::Space => 458796,
973 Self::Minus => 458797,
974 Self::Equals => 458798,
975 Self::LeftBrace => 458799,
976 Self::RightBrace => 458800,
977 Self::Backslash => 458801,
978 Self::NonUsHash => 458802,
979 Self::Semicolon => 458803,
980 Self::Apostrophe => 458804,
981 Self::GraveAccent => 458805,
982 Self::Comma => 458806,
983 Self::Dot => 458807,
984 Self::Slash => 458808,
985 Self::CapsLock => 458809,
986 Self::F1 => 458810,
987 Self::F2 => 458811,
988 Self::F3 => 458812,
989 Self::F4 => 458813,
990 Self::F5 => 458814,
991 Self::F6 => 458815,
992 Self::F7 => 458816,
993 Self::F8 => 458817,
994 Self::F9 => 458818,
995 Self::F10 => 458819,
996 Self::F11 => 458820,
997 Self::F12 => 458821,
998 Self::PrintScreen => 458822,
999 Self::ScrollLock => 458823,
1000 Self::Pause => 458824,
1001 Self::Insert => 458825,
1002 Self::Home => 458826,
1003 Self::PageUp => 458827,
1004 Self::Delete => 458828,
1005 Self::End => 458829,
1006 Self::PageDown => 458830,
1007 Self::Right => 458831,
1008 Self::Left => 458832,
1009 Self::Down => 458833,
1010 Self::Up => 458834,
1011 Self::NumLock => 458835,
1012 Self::KeypadSlash => 458836,
1013 Self::KeypadAsterisk => 458837,
1014 Self::KeypadMinus => 458838,
1015 Self::KeypadPlus => 458839,
1016 Self::KeypadEnter => 458840,
1017 Self::Keypad1 => 458841,
1018 Self::Keypad2 => 458842,
1019 Self::Keypad3 => 458843,
1020 Self::Keypad4 => 458844,
1021 Self::Keypad5 => 458845,
1022 Self::Keypad6 => 458846,
1023 Self::Keypad7 => 458847,
1024 Self::Keypad8 => 458848,
1025 Self::Keypad9 => 458849,
1026 Self::Keypad0 => 458850,
1027 Self::KeypadDot => 458851,
1028 Self::NonUsBackslash => 458852,
1029 Self::KeypadEquals => 458855,
1030 Self::Menu => 458870,
1031 Self::LeftCtrl => 458976,
1032 Self::LeftShift => 458977,
1033 Self::LeftAlt => 458978,
1034 Self::LeftMeta => 458979,
1035 Self::RightCtrl => 458980,
1036 Self::RightShift => 458981,
1037 Self::RightAlt => 458982,
1038 Self::RightMeta => 458983,
1039 Self::Mute => 458879,
1040 Self::VolumeDown => 458881,
1041 Self::VolumeUp => 458880,
1042 Self::PlayPause => 786637,
1043 Self::MediaMute => 786658,
1044 Self::MediaVolumeIncrement => 786665,
1045 Self::MediaVolumeDecrement => 786666,
1046 Self::AcBack => 786980,
1047 Self::AcRefresh => 786983,
1048 Self::AcFullScreenView => 786992,
1049 Self::AcSelectTaskApplication => 786850,
1050 Self::BrightnessDown => 786543,
1051 Self::BrightnessUp => 786544,
1052 Self::Assistant => 4294901761,
1053 Self::Power => 4294901762,
1054 Self::Sleep => 4294901763,
1055 Self::Unknown0055 => 4294901845,
1056 Self::Unknown0056 => 4294901846,
1057 Self::Unknown0059 => 4294901849,
1058 Self::Unknown005C => 4294901852,
1059 Self::Unknown005D => 4294901853,
1060 Self::Unknown005E => 4294901854,
1061 Self::Unknown0079 => 4294901881,
1062 Self::Unknown007A => 4294901882,
1063 Self::Unknown007B => 4294901883,
1064 Self::Unknown007C => 4294901884,
1065 Self::Unknown0085 => 4294901893,
1066 Self::Unknown0087 => 4294901895,
1067 Self::Unknown0089 => 4294901897,
1068 Self::Unknown009C => 4294901916,
1069 Self::Unknown009F => 4294901919,
1070 Self::Unknown00A0 => 4294901920,
1071 Self::Unknown00A2 => 4294901922,
1072 Self::Unknown00A3 => 4294901923,
1073 Self::Unknown00A5 => 4294901925,
1074 Self::Unknown00A6 => 4294901926,
1075 Self::Unknown00A7 => 4294901927,
1076 Self::Unknown00A8 => 4294901928,
1077 Self::Unknown00A9 => 4294901929,
1078 Self::Unknown00Ad => 4294901933,
1079 Self::Unknown00B1 => 4294901937,
1080 Self::Unknown00B2 => 4294901938,
1081 Self::Unknown00B3 => 4294901939,
1082 Self::Unknown00B4 => 4294901940,
1083 Self::Unknown00C9 => 4294901961,
1084 Self::Unknown00Cf => 4294901967,
1085 Self::Unknown00D0 => 4294901968,
1086 Self::Unknown00D4 => 4294901972,
1087 Self::Unknown00E2 => 4294901986,
1088 Self::Unknown0120 => 4294902048,
1089 Self::Unknown0121 => 4294902049,
1090 Self::Unknown0122 => 4294902050,
1091 Self::Unknown0123 => 4294902051,
1092 Self::Unknown0124 => 4294902052,
1093 Self::Unknown0125 => 4294902053,
1094 Self::Unknown0126 => 4294902054,
1095 Self::Unknown0127 => 4294902055,
1096 Self::Unknown0128 => 4294902056,
1097 Self::Unknown0129 => 4294902057,
1098 Self::Unknown012A => 4294902058,
1099 Self::Unknown012B => 4294902059,
1100 Self::Unknown012C => 4294902060,
1101 Self::Unknown012D => 4294902061,
1102 Self::Unknown012E => 4294902062,
1103 Self::Unknown012F => 4294902063,
1104 Self::Unknown0130 => 4294902064,
1105 Self::Unknown0131 => 4294902065,
1106 Self::Unknown0132 => 4294902066,
1107 Self::Unknown0133 => 4294902067,
1108 Self::Unknown0134 => 4294902068,
1109 Self::Unknown0135 => 4294902069,
1110 Self::Unknown0136 => 4294902070,
1111 Self::Unknown0137 => 4294902071,
1112 Self::Unknown0138 => 4294902072,
1113 Self::Unknown0139 => 4294902073,
1114 Self::Unknown013A => 4294902074,
1115 Self::Unknown013B => 4294902075,
1116 Self::Unknown013C => 4294902076,
1117 Self::Unknown013D => 4294902077,
1118 Self::Unknown013E => 4294902078,
1119 Self::Unknown0161 => 4294902113,
1120 Self::Unknown016A => 4294902122,
1121 Self::Unknown016E => 4294902126,
1122 Self::Unknown0172 => 4294902130,
1123 Self::Unknown0179 => 4294902137,
1124 Self::Unknown018E => 4294902158,
1125 Self::Unknown018F => 4294902159,
1126 Self::Unknown0190 => 4294902160,
1127 Self::Unknown0191 => 4294902161,
1128 Self::Unknown0192 => 4294902162,
1129 Self::Unknown0193 => 4294902163,
1130 Self::Unknown0195 => 4294902165,
1131 Self::Unknown01D0 => 4294902224,
1132 Self::Unknown020A => 4294902282,
1133 Self::Unknown020B => 4294902283,
1134 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1135 }
1136 }
1137
1138 #[inline]
1139 pub fn is_unknown(&self) -> bool {
1140 match self {
1141 Self::__SourceBreaking { unknown_ordinal: _ } => true,
1142 _ => false,
1143 }
1144 }
1145}
1146
1147#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1151pub enum KeymapId {
1152 UsQwerty,
1155 FrAzerty,
1157 UsDvorak,
1159 UsColemak,
1161 #[doc(hidden)]
1162 __SourceBreaking { unknown_ordinal: u32 },
1163}
1164
1165#[macro_export]
1167macro_rules! KeymapIdUnknown {
1168 () => {
1169 _
1170 };
1171}
1172
1173impl KeymapId {
1174 #[inline]
1175 pub fn from_primitive(prim: u32) -> Option<Self> {
1176 match prim {
1177 0 => Some(Self::UsQwerty),
1178 1 => Some(Self::FrAzerty),
1179 2 => Some(Self::UsDvorak),
1180 3 => Some(Self::UsColemak),
1181 _ => None,
1182 }
1183 }
1184
1185 #[inline]
1186 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1187 match prim {
1188 0 => Self::UsQwerty,
1189 1 => Self::FrAzerty,
1190 2 => Self::UsDvorak,
1191 3 => Self::UsColemak,
1192 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1193 }
1194 }
1195
1196 #[inline]
1197 pub fn unknown() -> Self {
1198 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1199 }
1200
1201 #[inline]
1202 pub const fn into_primitive(self) -> u32 {
1203 match self {
1204 Self::UsQwerty => 0,
1205 Self::FrAzerty => 1,
1206 Self::UsDvorak => 2,
1207 Self::UsColemak => 3,
1208 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1209 }
1210 }
1211
1212 #[inline]
1213 pub fn is_unknown(&self) -> bool {
1214 match self {
1215 Self::__SourceBreaking { unknown_ordinal: _ } => true,
1216 _ => false,
1217 }
1218 }
1219}
1220
1221#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1228pub enum UnitType {
1229 None,
1231 Other,
1233 Meters,
1235 Grams,
1237 Degrees,
1239 EnglishAngularVelocity,
1241 SiLinearVelocity,
1243 SiLinearAcceleration,
1245 Webers,
1247 Candelas,
1249 Pascals,
1251 Lux,
1253 Seconds,
1255 #[doc(hidden)]
1256 __SourceBreaking { unknown_ordinal: u32 },
1257}
1258
1259#[macro_export]
1261macro_rules! UnitTypeUnknown {
1262 () => {
1263 _
1264 };
1265}
1266
1267impl UnitType {
1268 #[inline]
1269 pub fn from_primitive(prim: u32) -> Option<Self> {
1270 match prim {
1271 0 => Some(Self::None),
1272 1 => Some(Self::Other),
1273 2 => Some(Self::Meters),
1274 3 => Some(Self::Grams),
1275 4 => Some(Self::Degrees),
1276 5 => Some(Self::EnglishAngularVelocity),
1277 6 => Some(Self::SiLinearVelocity),
1278 7 => Some(Self::SiLinearAcceleration),
1279 8 => Some(Self::Webers),
1280 9 => Some(Self::Candelas),
1281 10 => Some(Self::Pascals),
1282 11 => Some(Self::Lux),
1283 12 => Some(Self::Seconds),
1284 _ => None,
1285 }
1286 }
1287
1288 #[inline]
1289 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1290 match prim {
1291 0 => Self::None,
1292 1 => Self::Other,
1293 2 => Self::Meters,
1294 3 => Self::Grams,
1295 4 => Self::Degrees,
1296 5 => Self::EnglishAngularVelocity,
1297 6 => Self::SiLinearVelocity,
1298 7 => Self::SiLinearAcceleration,
1299 8 => Self::Webers,
1300 9 => Self::Candelas,
1301 10 => Self::Pascals,
1302 11 => Self::Lux,
1303 12 => Self::Seconds,
1304 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1305 }
1306 }
1307
1308 #[inline]
1309 pub fn unknown() -> Self {
1310 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1311 }
1312
1313 #[inline]
1314 pub const fn into_primitive(self) -> u32 {
1315 match self {
1316 Self::None => 0,
1317 Self::Other => 1,
1318 Self::Meters => 2,
1319 Self::Grams => 3,
1320 Self::Degrees => 4,
1321 Self::EnglishAngularVelocity => 5,
1322 Self::SiLinearVelocity => 6,
1323 Self::SiLinearAcceleration => 7,
1324 Self::Webers => 8,
1325 Self::Candelas => 9,
1326 Self::Pascals => 10,
1327 Self::Lux => 11,
1328 Self::Seconds => 12,
1329 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1330 }
1331 }
1332
1333 #[inline]
1334 pub fn is_unknown(&self) -> bool {
1335 match self {
1336 Self::__SourceBreaking { unknown_ordinal: _ } => true,
1337 _ => false,
1338 }
1339 }
1340}
1341
1342#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1344pub struct Axis {
1345 pub range: Range,
1346 pub unit: Unit,
1347}
1348
1349impl fidl::Persistable for Axis {}
1350
1351#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1353#[repr(C)]
1354pub struct Range {
1355 pub min: i64,
1356 pub max: i64,
1357}
1358
1359impl fidl::Persistable for Range {}
1360
1361#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1364pub struct Unit {
1365 pub type_: UnitType,
1366 pub exponent: i32,
1367}
1368
1369impl fidl::Persistable for Unit {}
1370
1371mod internal {
1372 use super::*;
1373 unsafe impl fidl::encoding::TypeMarker for ConsumerControlButton {
1374 type Owned = Self;
1375
1376 #[inline(always)]
1377 fn inline_align(_context: fidl::encoding::Context) -> usize {
1378 std::mem::align_of::<u32>()
1379 }
1380
1381 #[inline(always)]
1382 fn inline_size(_context: fidl::encoding::Context) -> usize {
1383 std::mem::size_of::<u32>()
1384 }
1385
1386 #[inline(always)]
1387 fn encode_is_copy() -> bool {
1388 false
1389 }
1390
1391 #[inline(always)]
1392 fn decode_is_copy() -> bool {
1393 false
1394 }
1395 }
1396
1397 impl fidl::encoding::ValueTypeMarker for ConsumerControlButton {
1398 type Borrowed<'a> = Self;
1399 #[inline(always)]
1400 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1401 *value
1402 }
1403 }
1404
1405 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1406 for ConsumerControlButton
1407 {
1408 #[inline]
1409 unsafe fn encode(
1410 self,
1411 encoder: &mut fidl::encoding::Encoder<'_, D>,
1412 offset: usize,
1413 _depth: fidl::encoding::Depth,
1414 ) -> fidl::Result<()> {
1415 encoder.debug_check_bounds::<Self>(offset);
1416 encoder.write_num(self.into_primitive(), offset);
1417 Ok(())
1418 }
1419 }
1420
1421 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConsumerControlButton {
1422 #[inline(always)]
1423 fn new_empty() -> Self {
1424 Self::unknown()
1425 }
1426
1427 #[inline]
1428 unsafe fn decode(
1429 &mut self,
1430 decoder: &mut fidl::encoding::Decoder<'_, D>,
1431 offset: usize,
1432 _depth: fidl::encoding::Depth,
1433 ) -> fidl::Result<()> {
1434 decoder.debug_check_bounds::<Self>(offset);
1435 let prim = decoder.read_num::<u32>(offset);
1436
1437 *self = Self::from_primitive_allow_unknown(prim);
1438 Ok(())
1439 }
1440 }
1441 unsafe impl fidl::encoding::TypeMarker for Key {
1442 type Owned = Self;
1443
1444 #[inline(always)]
1445 fn inline_align(_context: fidl::encoding::Context) -> usize {
1446 std::mem::align_of::<u32>()
1447 }
1448
1449 #[inline(always)]
1450 fn inline_size(_context: fidl::encoding::Context) -> usize {
1451 std::mem::size_of::<u32>()
1452 }
1453
1454 #[inline(always)]
1455 fn encode_is_copy() -> bool {
1456 false
1457 }
1458
1459 #[inline(always)]
1460 fn decode_is_copy() -> bool {
1461 false
1462 }
1463 }
1464
1465 impl fidl::encoding::ValueTypeMarker for Key {
1466 type Borrowed<'a> = Self;
1467 #[inline(always)]
1468 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1469 *value
1470 }
1471 }
1472
1473 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Key {
1474 #[inline]
1475 unsafe fn encode(
1476 self,
1477 encoder: &mut fidl::encoding::Encoder<'_, D>,
1478 offset: usize,
1479 _depth: fidl::encoding::Depth,
1480 ) -> fidl::Result<()> {
1481 encoder.debug_check_bounds::<Self>(offset);
1482 encoder.write_num(self.into_primitive(), offset);
1483 Ok(())
1484 }
1485 }
1486
1487 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Key {
1488 #[inline(always)]
1489 fn new_empty() -> Self {
1490 Self::unknown()
1491 }
1492
1493 #[inline]
1494 unsafe fn decode(
1495 &mut self,
1496 decoder: &mut fidl::encoding::Decoder<'_, D>,
1497 offset: usize,
1498 _depth: fidl::encoding::Depth,
1499 ) -> fidl::Result<()> {
1500 decoder.debug_check_bounds::<Self>(offset);
1501 let prim = decoder.read_num::<u32>(offset);
1502
1503 *self = Self::from_primitive_allow_unknown(prim);
1504 Ok(())
1505 }
1506 }
1507 unsafe impl fidl::encoding::TypeMarker for KeymapId {
1508 type Owned = Self;
1509
1510 #[inline(always)]
1511 fn inline_align(_context: fidl::encoding::Context) -> usize {
1512 std::mem::align_of::<u32>()
1513 }
1514
1515 #[inline(always)]
1516 fn inline_size(_context: fidl::encoding::Context) -> usize {
1517 std::mem::size_of::<u32>()
1518 }
1519
1520 #[inline(always)]
1521 fn encode_is_copy() -> bool {
1522 false
1523 }
1524
1525 #[inline(always)]
1526 fn decode_is_copy() -> bool {
1527 false
1528 }
1529 }
1530
1531 impl fidl::encoding::ValueTypeMarker for KeymapId {
1532 type Borrowed<'a> = Self;
1533 #[inline(always)]
1534 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1535 *value
1536 }
1537 }
1538
1539 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeymapId {
1540 #[inline]
1541 unsafe fn encode(
1542 self,
1543 encoder: &mut fidl::encoding::Encoder<'_, D>,
1544 offset: usize,
1545 _depth: fidl::encoding::Depth,
1546 ) -> fidl::Result<()> {
1547 encoder.debug_check_bounds::<Self>(offset);
1548 encoder.write_num(self.into_primitive(), offset);
1549 Ok(())
1550 }
1551 }
1552
1553 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeymapId {
1554 #[inline(always)]
1555 fn new_empty() -> Self {
1556 Self::unknown()
1557 }
1558
1559 #[inline]
1560 unsafe fn decode(
1561 &mut self,
1562 decoder: &mut fidl::encoding::Decoder<'_, D>,
1563 offset: usize,
1564 _depth: fidl::encoding::Depth,
1565 ) -> fidl::Result<()> {
1566 decoder.debug_check_bounds::<Self>(offset);
1567 let prim = decoder.read_num::<u32>(offset);
1568
1569 *self = Self::from_primitive_allow_unknown(prim);
1570 Ok(())
1571 }
1572 }
1573 unsafe impl fidl::encoding::TypeMarker for UnitType {
1574 type Owned = Self;
1575
1576 #[inline(always)]
1577 fn inline_align(_context: fidl::encoding::Context) -> usize {
1578 std::mem::align_of::<u32>()
1579 }
1580
1581 #[inline(always)]
1582 fn inline_size(_context: fidl::encoding::Context) -> usize {
1583 std::mem::size_of::<u32>()
1584 }
1585
1586 #[inline(always)]
1587 fn encode_is_copy() -> bool {
1588 false
1589 }
1590
1591 #[inline(always)]
1592 fn decode_is_copy() -> bool {
1593 false
1594 }
1595 }
1596
1597 impl fidl::encoding::ValueTypeMarker for UnitType {
1598 type Borrowed<'a> = Self;
1599 #[inline(always)]
1600 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1601 *value
1602 }
1603 }
1604
1605 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for UnitType {
1606 #[inline]
1607 unsafe fn encode(
1608 self,
1609 encoder: &mut fidl::encoding::Encoder<'_, D>,
1610 offset: usize,
1611 _depth: fidl::encoding::Depth,
1612 ) -> fidl::Result<()> {
1613 encoder.debug_check_bounds::<Self>(offset);
1614 encoder.write_num(self.into_primitive(), offset);
1615 Ok(())
1616 }
1617 }
1618
1619 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for UnitType {
1620 #[inline(always)]
1621 fn new_empty() -> Self {
1622 Self::unknown()
1623 }
1624
1625 #[inline]
1626 unsafe fn decode(
1627 &mut self,
1628 decoder: &mut fidl::encoding::Decoder<'_, D>,
1629 offset: usize,
1630 _depth: fidl::encoding::Depth,
1631 ) -> fidl::Result<()> {
1632 decoder.debug_check_bounds::<Self>(offset);
1633 let prim = decoder.read_num::<u32>(offset);
1634
1635 *self = Self::from_primitive_allow_unknown(prim);
1636 Ok(())
1637 }
1638 }
1639
1640 impl fidl::encoding::ValueTypeMarker for Axis {
1641 type Borrowed<'a> = &'a Self;
1642 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1643 value
1644 }
1645 }
1646
1647 unsafe impl fidl::encoding::TypeMarker for Axis {
1648 type Owned = Self;
1649
1650 #[inline(always)]
1651 fn inline_align(_context: fidl::encoding::Context) -> usize {
1652 8
1653 }
1654
1655 #[inline(always)]
1656 fn inline_size(_context: fidl::encoding::Context) -> usize {
1657 24
1658 }
1659 }
1660
1661 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
1662 #[inline]
1663 unsafe fn encode(
1664 self,
1665 encoder: &mut fidl::encoding::Encoder<'_, D>,
1666 offset: usize,
1667 _depth: fidl::encoding::Depth,
1668 ) -> fidl::Result<()> {
1669 encoder.debug_check_bounds::<Axis>(offset);
1670 fidl::encoding::Encode::<Axis, D>::encode(
1672 (
1673 <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
1674 <Unit as fidl::encoding::ValueTypeMarker>::borrow(&self.unit),
1675 ),
1676 encoder,
1677 offset,
1678 _depth,
1679 )
1680 }
1681 }
1682 unsafe impl<
1683 D: fidl::encoding::ResourceDialect,
1684 T0: fidl::encoding::Encode<Range, D>,
1685 T1: fidl::encoding::Encode<Unit, D>,
1686 > fidl::encoding::Encode<Axis, D> for (T0, T1)
1687 {
1688 #[inline]
1689 unsafe fn encode(
1690 self,
1691 encoder: &mut fidl::encoding::Encoder<'_, D>,
1692 offset: usize,
1693 depth: fidl::encoding::Depth,
1694 ) -> fidl::Result<()> {
1695 encoder.debug_check_bounds::<Axis>(offset);
1696 self.0.encode(encoder, offset + 0, depth)?;
1700 self.1.encode(encoder, offset + 16, depth)?;
1701 Ok(())
1702 }
1703 }
1704
1705 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
1706 #[inline(always)]
1707 fn new_empty() -> Self {
1708 Self { range: fidl::new_empty!(Range, D), unit: fidl::new_empty!(Unit, D) }
1709 }
1710
1711 #[inline]
1712 unsafe fn decode(
1713 &mut self,
1714 decoder: &mut fidl::encoding::Decoder<'_, D>,
1715 offset: usize,
1716 _depth: fidl::encoding::Depth,
1717 ) -> fidl::Result<()> {
1718 decoder.debug_check_bounds::<Self>(offset);
1719 fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
1721 fidl::decode!(Unit, D, &mut self.unit, decoder, offset + 16, _depth)?;
1722 Ok(())
1723 }
1724 }
1725
1726 impl fidl::encoding::ValueTypeMarker for Range {
1727 type Borrowed<'a> = &'a Self;
1728 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1729 value
1730 }
1731 }
1732
1733 unsafe impl fidl::encoding::TypeMarker for Range {
1734 type Owned = Self;
1735
1736 #[inline(always)]
1737 fn inline_align(_context: fidl::encoding::Context) -> usize {
1738 8
1739 }
1740
1741 #[inline(always)]
1742 fn inline_size(_context: fidl::encoding::Context) -> usize {
1743 16
1744 }
1745 #[inline(always)]
1746 fn encode_is_copy() -> bool {
1747 true
1748 }
1749
1750 #[inline(always)]
1751 fn decode_is_copy() -> bool {
1752 true
1753 }
1754 }
1755
1756 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
1757 #[inline]
1758 unsafe fn encode(
1759 self,
1760 encoder: &mut fidl::encoding::Encoder<'_, D>,
1761 offset: usize,
1762 _depth: fidl::encoding::Depth,
1763 ) -> fidl::Result<()> {
1764 encoder.debug_check_bounds::<Range>(offset);
1765 unsafe {
1766 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1768 (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
1769 }
1772 Ok(())
1773 }
1774 }
1775 unsafe impl<
1776 D: fidl::encoding::ResourceDialect,
1777 T0: fidl::encoding::Encode<i64, D>,
1778 T1: fidl::encoding::Encode<i64, D>,
1779 > fidl::encoding::Encode<Range, D> for (T0, T1)
1780 {
1781 #[inline]
1782 unsafe fn encode(
1783 self,
1784 encoder: &mut fidl::encoding::Encoder<'_, D>,
1785 offset: usize,
1786 depth: fidl::encoding::Depth,
1787 ) -> fidl::Result<()> {
1788 encoder.debug_check_bounds::<Range>(offset);
1789 self.0.encode(encoder, offset + 0, depth)?;
1793 self.1.encode(encoder, offset + 8, depth)?;
1794 Ok(())
1795 }
1796 }
1797
1798 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
1799 #[inline(always)]
1800 fn new_empty() -> Self {
1801 Self { min: fidl::new_empty!(i64, D), max: fidl::new_empty!(i64, D) }
1802 }
1803
1804 #[inline]
1805 unsafe fn decode(
1806 &mut self,
1807 decoder: &mut fidl::encoding::Decoder<'_, D>,
1808 offset: usize,
1809 _depth: fidl::encoding::Depth,
1810 ) -> fidl::Result<()> {
1811 decoder.debug_check_bounds::<Self>(offset);
1812 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1813 unsafe {
1816 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1817 }
1818 Ok(())
1819 }
1820 }
1821
1822 impl fidl::encoding::ValueTypeMarker for Unit {
1823 type Borrowed<'a> = &'a Self;
1824 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1825 value
1826 }
1827 }
1828
1829 unsafe impl fidl::encoding::TypeMarker for Unit {
1830 type Owned = Self;
1831
1832 #[inline(always)]
1833 fn inline_align(_context: fidl::encoding::Context) -> usize {
1834 4
1835 }
1836
1837 #[inline(always)]
1838 fn inline_size(_context: fidl::encoding::Context) -> usize {
1839 8
1840 }
1841 }
1842
1843 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
1844 #[inline]
1845 unsafe fn encode(
1846 self,
1847 encoder: &mut fidl::encoding::Encoder<'_, D>,
1848 offset: usize,
1849 _depth: fidl::encoding::Depth,
1850 ) -> fidl::Result<()> {
1851 encoder.debug_check_bounds::<Unit>(offset);
1852 fidl::encoding::Encode::<Unit, D>::encode(
1854 (
1855 <UnitType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
1856 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.exponent),
1857 ),
1858 encoder,
1859 offset,
1860 _depth,
1861 )
1862 }
1863 }
1864 unsafe impl<
1865 D: fidl::encoding::ResourceDialect,
1866 T0: fidl::encoding::Encode<UnitType, D>,
1867 T1: fidl::encoding::Encode<i32, D>,
1868 > fidl::encoding::Encode<Unit, D> for (T0, T1)
1869 {
1870 #[inline]
1871 unsafe fn encode(
1872 self,
1873 encoder: &mut fidl::encoding::Encoder<'_, D>,
1874 offset: usize,
1875 depth: fidl::encoding::Depth,
1876 ) -> fidl::Result<()> {
1877 encoder.debug_check_bounds::<Unit>(offset);
1878 self.0.encode(encoder, offset + 0, depth)?;
1882 self.1.encode(encoder, offset + 4, depth)?;
1883 Ok(())
1884 }
1885 }
1886
1887 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
1888 #[inline(always)]
1889 fn new_empty() -> Self {
1890 Self { type_: fidl::new_empty!(UnitType, D), exponent: fidl::new_empty!(i32, D) }
1891 }
1892
1893 #[inline]
1894 unsafe fn decode(
1895 &mut self,
1896 decoder: &mut fidl::encoding::Decoder<'_, D>,
1897 offset: usize,
1898 _depth: fidl::encoding::Depth,
1899 ) -> fidl::Result<()> {
1900 decoder.debug_check_bounds::<Self>(offset);
1901 fidl::decode!(UnitType, D, &mut self.type_, decoder, offset + 0, _depth)?;
1903 fidl::decode!(i32, D, &mut self.exponent, decoder, offset + 4, _depth)?;
1904 Ok(())
1905 }
1906 }
1907}