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 MODIFIER_ALT: u32 = 96;
12
13pub const MODIFIER_CAPS_LOCK: u32 = 1;
14
15pub const MODIFIER_CONTROL: u32 = 24;
16
17pub const MODIFIER_LEFT_ALT: u32 = 32;
18
19pub const MODIFIER_LEFT_CONTROL: u32 = 8;
20
21pub const MODIFIER_LEFT_SHIFT: u32 = 2;
22
23pub const MODIFIER_LEFT_SUPER: u32 = 128;
24
25pub const MODIFIER_NONE: u32 = 0;
27
28pub const MODIFIER_RIGHT_ALT: u32 = 64;
29
30pub const MODIFIER_RIGHT_CONTROL: u32 = 16;
31
32pub const MODIFIER_RIGHT_SHIFT: u32 = 4;
33
34pub const MODIFIER_RIGHT_SUPER: u32 = 256;
35
36pub const MODIFIER_SHIFT: u32 = 6;
37
38pub const MODIFIER_SUPER: u32 = 384;
39
40#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
41pub enum AxisScale {
42 Linear,
43 Logarithmic,
44 #[doc(hidden)]
45 __SourceBreaking {
46 unknown_ordinal: u32,
47 },
48}
49
50#[macro_export]
52macro_rules! AxisScaleUnknown {
53 () => {
54 _
55 };
56}
57
58impl AxisScale {
59 #[inline]
60 pub fn from_primitive(prim: u32) -> Option<Self> {
61 match prim {
62 0 => Some(Self::Linear),
63 1 => Some(Self::Logarithmic),
64 _ => None,
65 }
66 }
67
68 #[inline]
69 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
70 match prim {
71 0 => Self::Linear,
72 1 => Self::Logarithmic,
73 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
74 }
75 }
76
77 #[inline]
78 pub fn unknown() -> Self {
79 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
80 }
81
82 #[inline]
83 pub const fn into_primitive(self) -> u32 {
84 match self {
85 Self::Linear => 0,
86 Self::Logarithmic => 1,
87 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
88 }
89 }
90
91 #[inline]
92 pub fn is_unknown(&self) -> bool {
93 match self {
94 Self::__SourceBreaking { unknown_ordinal: _ } => true,
95 _ => false,
96 }
97 }
98}
99
100#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
105pub enum InputMethodAction {
106 Unspecified,
108 None,
110 Go,
112 Search,
114 Send,
117 Next,
119 Done,
121 Previous,
123 Newline,
127 #[doc(hidden)]
128 __SourceBreaking { unknown_ordinal: u32 },
129}
130
131#[macro_export]
133macro_rules! InputMethodActionUnknown {
134 () => {
135 _
136 };
137}
138
139impl InputMethodAction {
140 #[inline]
141 pub fn from_primitive(prim: u32) -> Option<Self> {
142 match prim {
143 0 => Some(Self::Unspecified),
144 1 => Some(Self::None),
145 2 => Some(Self::Go),
146 3 => Some(Self::Search),
147 4 => Some(Self::Send),
148 5 => Some(Self::Next),
149 6 => Some(Self::Done),
150 7 => Some(Self::Previous),
151 8 => Some(Self::Newline),
152 _ => None,
153 }
154 }
155
156 #[inline]
157 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
158 match prim {
159 0 => Self::Unspecified,
160 1 => Self::None,
161 2 => Self::Go,
162 3 => Self::Search,
163 4 => Self::Send,
164 5 => Self::Next,
165 6 => Self::Done,
166 7 => Self::Previous,
167 8 => Self::Newline,
168 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
169 }
170 }
171
172 #[inline]
173 pub fn unknown() -> Self {
174 Self::__SourceBreaking { unknown_ordinal: 0x0 }
175 }
176
177 #[inline]
178 pub const fn into_primitive(self) -> u32 {
179 match self {
180 Self::Unspecified => 0,
181 Self::None => 1,
182 Self::Go => 2,
183 Self::Search => 3,
184 Self::Send => 4,
185 Self::Next => 5,
186 Self::Done => 6,
187 Self::Previous => 7,
188 Self::Newline => 8,
189 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
190 }
191 }
192
193 #[inline]
194 pub fn is_unknown(&self) -> bool {
195 match self {
196 Self::__SourceBreaking { unknown_ordinal: _ } => true,
197 _ => false,
198 }
199 }
200}
201
202#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
203pub enum KeyboardEventPhase {
204 Pressed,
206 Released,
208 Cancelled,
210 Repeat,
212 #[doc(hidden)]
213 __SourceBreaking { unknown_ordinal: u32 },
214}
215
216#[macro_export]
218macro_rules! KeyboardEventPhaseUnknown {
219 () => {
220 _
221 };
222}
223
224impl KeyboardEventPhase {
225 #[inline]
226 pub fn from_primitive(prim: u32) -> Option<Self> {
227 match prim {
228 0 => Some(Self::Pressed),
229 1 => Some(Self::Released),
230 2 => Some(Self::Cancelled),
231 3 => Some(Self::Repeat),
232 _ => None,
233 }
234 }
235
236 #[inline]
237 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
238 match prim {
239 0 => Self::Pressed,
240 1 => Self::Released,
241 2 => Self::Cancelled,
242 3 => Self::Repeat,
243 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
244 }
245 }
246
247 #[inline]
248 pub fn unknown() -> Self {
249 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
250 }
251
252 #[inline]
253 pub const fn into_primitive(self) -> u32 {
254 match self {
255 Self::Pressed => 0,
256 Self::Released => 1,
257 Self::Cancelled => 2,
258 Self::Repeat => 3,
259 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
260 }
261 }
262
263 #[inline]
264 pub fn is_unknown(&self) -> bool {
265 match self {
266 Self::__SourceBreaking { unknown_ordinal: _ } => true,
267 _ => false,
268 }
269 }
270}
271
272#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
281pub enum KeyboardType {
282 Text,
284 Number,
286 Phone,
289 Datetime,
292 Multiline,
294 #[doc(hidden)]
295 __SourceBreaking { unknown_ordinal: u32 },
296}
297
298#[macro_export]
300macro_rules! KeyboardTypeUnknown {
301 () => {
302 _
303 };
304}
305
306impl KeyboardType {
307 #[inline]
308 pub fn from_primitive(prim: u32) -> Option<Self> {
309 match prim {
310 0 => Some(Self::Text),
311 1 => Some(Self::Number),
312 2 => Some(Self::Phone),
313 3 => Some(Self::Datetime),
314 4 => Some(Self::Multiline),
315 _ => None,
316 }
317 }
318
319 #[inline]
320 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
321 match prim {
322 0 => Self::Text,
323 1 => Self::Number,
324 2 => Self::Phone,
325 3 => Self::Datetime,
326 4 => Self::Multiline,
327 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
328 }
329 }
330
331 #[inline]
332 pub fn unknown() -> Self {
333 Self::__SourceBreaking { unknown_ordinal: 0x0 }
334 }
335
336 #[inline]
337 pub const fn into_primitive(self) -> u32 {
338 match self {
339 Self::Text => 0,
340 Self::Number => 1,
341 Self::Phone => 2,
342 Self::Datetime => 3,
343 Self::Multiline => 4,
344 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
345 }
346 }
347
348 #[inline]
349 pub fn is_unknown(&self) -> bool {
350 match self {
351 Self::__SourceBreaking { unknown_ordinal: _ } => true,
352 _ => false,
353 }
354 }
355}
356
357#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
358#[repr(u32)]
359pub enum PointerEventPhase {
360 Add = 0,
365 Hover = 1,
368 Down = 2,
373 Move = 3,
376 Up = 4,
381 Remove = 5,
386 Cancel = 6,
388}
389
390impl PointerEventPhase {
391 #[inline]
392 pub fn from_primitive(prim: u32) -> Option<Self> {
393 match prim {
394 0 => Some(Self::Add),
395 1 => Some(Self::Hover),
396 2 => Some(Self::Down),
397 3 => Some(Self::Move),
398 4 => Some(Self::Up),
399 5 => Some(Self::Remove),
400 6 => Some(Self::Cancel),
401 _ => None,
402 }
403 }
404
405 #[inline]
406 pub const fn into_primitive(self) -> u32 {
407 self as u32
408 }
409
410 #[deprecated = "Strict enums should not use `is_unknown`"]
411 #[inline]
412 pub fn is_unknown(&self) -> bool {
413 false
414 }
415}
416
417#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
418#[repr(u32)]
419pub enum PointerEventType {
420 Touch = 0,
422 Stylus = 1,
424 InvertedStylus = 2,
426 Mouse = 3,
428}
429
430impl PointerEventType {
431 #[inline]
432 pub fn from_primitive(prim: u32) -> Option<Self> {
433 match prim {
434 0 => Some(Self::Touch),
435 1 => Some(Self::Stylus),
436 2 => Some(Self::InvertedStylus),
437 3 => Some(Self::Mouse),
438 _ => None,
439 }
440 }
441
442 #[inline]
443 pub const fn into_primitive(self) -> u32 {
444 self as u32
445 }
446
447 #[deprecated = "Strict enums should not use `is_unknown`"]
448 #[inline]
449 pub fn is_unknown(&self) -> bool {
450 false
451 }
452}
453
454#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
455pub enum SensorLocation {
456 Unknown,
457 Base,
458 Lid,
459 #[doc(hidden)]
460 __SourceBreaking {
461 unknown_ordinal: u32,
462 },
463}
464
465#[macro_export]
467macro_rules! SensorLocationUnknown {
468 () => {
469 _
470 };
471}
472
473impl SensorLocation {
474 #[inline]
475 pub fn from_primitive(prim: u32) -> Option<Self> {
476 match prim {
477 0 => Some(Self::Unknown),
478 1 => Some(Self::Base),
479 2 => Some(Self::Lid),
480 _ => None,
481 }
482 }
483
484 #[inline]
485 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
486 match prim {
487 0 => Self::Unknown,
488 1 => Self::Base,
489 2 => Self::Lid,
490 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
491 }
492 }
493
494 #[inline]
495 pub fn unknown() -> Self {
496 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
497 }
498
499 #[inline]
500 pub const fn into_primitive(self) -> u32 {
501 match self {
502 Self::Unknown => 0,
503 Self::Base => 1,
504 Self::Lid => 2,
505 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
506 }
507 }
508
509 #[inline]
510 pub fn is_unknown(&self) -> bool {
511 match self {
512 Self::__SourceBreaking { unknown_ordinal: _ } => true,
513 _ => false,
514 }
515 }
516}
517
518#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
519pub enum SensorType {
520 Accelerometer,
521 Gyroscope,
522 Magnetometer,
523 Lightmeter,
524 #[doc(hidden)]
525 __SourceBreaking {
526 unknown_ordinal: u32,
527 },
528}
529
530#[macro_export]
532macro_rules! SensorTypeUnknown {
533 () => {
534 _
535 };
536}
537
538impl SensorType {
539 #[inline]
540 pub fn from_primitive(prim: u32) -> Option<Self> {
541 match prim {
542 0 => Some(Self::Accelerometer),
543 1 => Some(Self::Gyroscope),
544 2 => Some(Self::Magnetometer),
545 3 => Some(Self::Lightmeter),
546 _ => None,
547 }
548 }
549
550 #[inline]
551 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
552 match prim {
553 0 => Self::Accelerometer,
554 1 => Self::Gyroscope,
555 2 => Self::Magnetometer,
556 3 => Self::Lightmeter,
557 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
558 }
559 }
560
561 #[inline]
562 pub fn unknown() -> Self {
563 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
564 }
565
566 #[inline]
567 pub const fn into_primitive(self) -> u32 {
568 match self {
569 Self::Accelerometer => 0,
570 Self::Gyroscope => 1,
571 Self::Magnetometer => 2,
572 Self::Lightmeter => 3,
573 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
574 }
575 }
576
577 #[inline]
578 pub fn is_unknown(&self) -> bool {
579 match self {
580 Self::__SourceBreaking { unknown_ordinal: _ } => true,
581 _ => false,
582 }
583 }
584}
585
586#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
596#[repr(u32)]
597pub enum TextAffinity {
598 Upstream = 0,
603 Downstream = 1,
608}
609
610impl TextAffinity {
611 #[inline]
612 pub fn from_primitive(prim: u32) -> Option<Self> {
613 match prim {
614 0 => Some(Self::Upstream),
615 1 => Some(Self::Downstream),
616 _ => None,
617 }
618 }
619
620 #[inline]
621 pub const fn into_primitive(self) -> u32 {
622 self as u32
623 }
624
625 #[deprecated = "Strict enums should not use `is_unknown`"]
626 #[inline]
627 pub fn is_unknown(&self) -> bool {
628 false
629 }
630}
631
632#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
633pub struct Axis {
634 pub range: Range,
635 pub resolution: i32,
636 pub scale: AxisScale,
637}
638
639impl fidl::Persistable for Axis {}
640
641#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
642pub struct AxisF {
643 pub range: RangeF,
644 pub resolution: f32,
645 pub scale: AxisScale,
646}
647
648impl fidl::Persistable for AxisF {}
649
650#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
651pub struct DeviceDescriptor {
652 pub device_info: Option<Box<DeviceInfo>>,
653 pub keyboard: Option<Box<KeyboardDescriptor>>,
654 pub media_buttons: Option<Box<MediaButtonsDescriptor>>,
655 pub mouse: Option<Box<MouseDescriptor>>,
656 pub stylus: Option<Box<StylusDescriptor>>,
657 pub touchscreen: Option<Box<TouchscreenDescriptor>>,
658 pub sensor: Option<Box<SensorDescriptor>>,
659}
660
661impl fidl::Persistable for DeviceDescriptor {}
662
663#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
664pub struct DeviceInfo {
665 pub vendor_id: u32,
666 pub product_id: u32,
667 pub version: u32,
668 pub name: String,
669}
670
671impl fidl::Persistable for DeviceInfo {}
672
673#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
674pub struct FocusEvent {
675 pub event_time: u64,
678 pub focused: bool,
680}
681
682impl fidl::Persistable for FocusEvent {}
683
684#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
685pub struct InputDeviceDispatchReportRequest {
686 pub report: InputReport,
687}
688
689impl fidl::Persistable for InputDeviceDispatchReportRequest {}
690
691#[derive(Clone, Debug, PartialEq, PartialOrd)]
692pub struct InputMethodEditorClientDidUpdateStateRequest {
693 pub state: TextInputState,
694 pub event: Option<Box<InputEvent>>,
695}
696
697impl fidl::Persistable for InputMethodEditorClientDidUpdateStateRequest {}
698
699#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
700pub struct InputMethodEditorClientOnActionRequest {
701 pub action: InputMethodAction,
702}
703
704impl fidl::Persistable for InputMethodEditorClientOnActionRequest {}
705
706#[derive(Clone, Debug, PartialEq)]
707pub struct InputMethodEditorDispatchKey3Request {
708 pub event: fidl_fuchsia_ui_input3::KeyEvent,
709}
710
711impl fidl::Persistable for InputMethodEditorDispatchKey3Request {}
712
713#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
714pub struct InputMethodEditorDispatchKey3Response {
715 pub handled: bool,
716}
717
718impl fidl::Persistable for InputMethodEditorDispatchKey3Response {}
719
720#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
721pub struct InputMethodEditorInjectInputRequest {
722 pub event: InputEvent,
723}
724
725impl fidl::Persistable for InputMethodEditorInjectInputRequest {}
726
727#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
728pub struct InputMethodEditorSetKeyboardTypeRequest {
729 pub keyboard_type: KeyboardType,
730}
731
732impl fidl::Persistable for InputMethodEditorSetKeyboardTypeRequest {}
733
734#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
735pub struct InputMethodEditorSetStateRequest {
736 pub state: TextInputState,
737}
738
739impl fidl::Persistable for InputMethodEditorSetStateRequest {}
740
741#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
742pub struct InputReport {
743 pub event_time: u64,
744 pub keyboard: Option<Box<KeyboardReport>>,
745 pub media_buttons: Option<Box<MediaButtonsReport>>,
746 pub mouse: Option<Box<MouseReport>>,
747 pub stylus: Option<Box<StylusReport>>,
748 pub touchscreen: Option<Box<TouchscreenReport>>,
749 pub sensor: Option<Box<SensorReport>>,
750 pub trace_id: u64,
751}
752
753impl fidl::Persistable for InputReport {}
754
755#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
756pub struct KeyboardDescriptor {
757 pub keys: Vec<u32>,
758}
759
760impl fidl::Persistable for KeyboardDescriptor {}
761
762#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
777pub struct KeyboardEvent {
778 pub event_time: u64,
781 pub device_id: u32,
782 pub phase: KeyboardEventPhase,
783 pub hid_usage: u32,
786 pub code_point: u32,
791 pub modifiers: u32,
794}
795
796impl fidl::Persistable for KeyboardEvent {}
797
798#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
799pub struct KeyboardReport {
800 pub pressed_keys: Vec<u32>,
801}
802
803impl fidl::Persistable for KeyboardReport {}
804
805#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
806#[repr(C)]
807pub struct MediaButtonsDescriptor {
808 pub buttons: u32,
809}
810
811impl fidl::Persistable for MediaButtonsDescriptor {}
812
813#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
817pub struct MediaButtonsReport {
818 pub volume_up: bool,
819 pub volume_down: bool,
820 pub mic_mute: bool,
821 pub reset: bool,
822 pub pause: bool,
823 pub camera_disable: bool,
824}
825
826impl fidl::Persistable for MediaButtonsReport {}
827
828#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
829pub struct MouseDescriptor {
830 pub rel_x: Axis,
831 pub rel_y: Axis,
832 pub vscroll: Option<Box<Axis>>,
833 pub hscroll: Option<Box<Axis>>,
834 pub buttons: u32,
835}
836
837impl fidl::Persistable for MouseDescriptor {}
838
839#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
840#[repr(C)]
841pub struct MouseReport {
842 pub rel_x: i32,
843 pub rel_y: i32,
844 pub rel_hscroll: i32,
845 pub rel_vscroll: i32,
846 pub pressed_buttons: u32,
847}
848
849impl fidl::Persistable for MouseReport {}
850
851#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
858pub struct PointerEvent {
859 pub event_time: u64,
862 pub device_id: u32,
863 pub pointer_id: u32,
864 pub type_: PointerEventType,
865 pub phase: PointerEventPhase,
866 pub x: f32,
868 pub y: f32,
869 pub radius_major: f32,
870 pub radius_minor: f32,
871 pub buttons: u32,
874}
875
876impl fidl::Persistable for PointerEvent {}
877
878#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
879#[repr(C)]
880pub struct Range {
881 pub min: i32,
882 pub max: i32,
883}
884
885impl fidl::Persistable for Range {}
886
887#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
888pub struct RangeF {
889 pub min: f32,
890 pub max: f32,
891}
892
893impl fidl::Persistable for RangeF {}
894
895#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
896pub struct SendKeyboardInputCmd {
897 pub compositor_id: u32,
898 pub keyboard_event: KeyboardEvent,
899}
900
901impl fidl::Persistable for SendKeyboardInputCmd {}
902
903#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
904pub struct SendPointerInputCmd {
905 pub compositor_id: u32,
906 pub pointer_event: PointerEvent,
907}
908
909impl fidl::Persistable for SendPointerInputCmd {}
910
911#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
912pub struct SensorDescriptor {
913 pub type_: SensorType,
914 pub loc: SensorLocation,
915 pub min_sampling_freq: u32,
916 pub max_sampling_freq: u32,
917 pub fifo_max_event_count: u32,
918 pub phys_min: i32,
919 pub phys_max: i32,
920}
921
922impl fidl::Persistable for SensorDescriptor {}
923
924#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
925pub struct SetHardKeyboardDeliveryCmd {
926 pub delivery_request: bool,
927}
928
929impl fidl::Persistable for SetHardKeyboardDeliveryCmd {}
930
931#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
932pub struct SetParallelDispatchCmd {
933 pub parallel_dispatch: bool,
934}
935
936impl fidl::Persistable for SetParallelDispatchCmd {}
937
938#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
939pub struct StylusDescriptor {
940 pub x: Axis,
941 pub y: Axis,
942 pub pressure: Option<Box<Axis>>,
943 pub is_invertible: bool,
944 pub buttons: u32,
945}
946
947impl fidl::Persistable for StylusDescriptor {}
948
949#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
950pub struct StylusReport {
951 pub x: i32,
952 pub y: i32,
953 pub pressure: u32,
954 pub is_in_contact: bool,
955 pub in_range: bool,
956 pub is_inverted: bool,
957 pub pressed_buttons: u32,
958}
959
960impl fidl::Persistable for StylusReport {}
961
962#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
964pub struct TextInputState {
965 pub revision: u32,
967 pub text: String,
969 pub selection: TextSelection,
971 pub composing: TextRange,
973}
974
975impl fidl::Persistable for TextInputState {}
976
977#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
982#[repr(C)]
983pub struct TextRange {
984 pub start: i64,
988 pub end: i64,
992}
993
994impl fidl::Persistable for TextRange {}
995
996#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1004pub struct TextSelection {
1005 pub base: i64,
1009 pub extent: i64,
1017 pub affinity: TextAffinity,
1021}
1022
1023impl fidl::Persistable for TextSelection {}
1024
1025#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1026#[repr(C)]
1027pub struct Touch {
1028 pub finger_id: u32,
1029 pub x: i32,
1030 pub y: i32,
1031 pub width: u32,
1032 pub height: u32,
1033}
1034
1035impl fidl::Persistable for Touch {}
1036
1037#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1038pub struct TouchscreenDescriptor {
1039 pub x: Axis,
1040 pub y: Axis,
1041 pub max_finger_id: u32,
1042}
1043
1044impl fidl::Persistable for TouchscreenDescriptor {}
1045
1046#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1047pub struct TouchscreenReport {
1048 pub touches: Vec<Touch>,
1049}
1050
1051impl fidl::Persistable for TouchscreenReport {}
1052
1053#[derive(Clone, Debug, Default, PartialEq)]
1054pub struct MediaButtonsEvent {
1055 pub volume: Option<i8>,
1056 pub mic_mute: Option<bool>,
1057 pub pause: Option<bool>,
1058 pub camera_disable: Option<bool>,
1059 pub power: Option<bool>,
1060 pub function: Option<bool>,
1061 pub device_id: Option<u32>,
1062 #[doc(hidden)]
1063 pub __source_breaking: fidl::marker::SourceBreaking,
1064}
1065
1066impl fidl::Persistable for MediaButtonsEvent {}
1067
1068#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1069pub enum Command {
1070 SendKeyboardInput(SendKeyboardInputCmd),
1071 SendPointerInput(SendPointerInputCmd),
1072 SetHardKeyboardDelivery(SetHardKeyboardDeliveryCmd),
1073 SetParallelDispatch(SetParallelDispatchCmd),
1074}
1075
1076impl Command {
1077 #[inline]
1078 pub fn ordinal(&self) -> u64 {
1079 match *self {
1080 Self::SendKeyboardInput(_) => 1,
1081 Self::SendPointerInput(_) => 2,
1082 Self::SetHardKeyboardDelivery(_) => 3,
1083 Self::SetParallelDispatch(_) => 4,
1084 }
1085 }
1086
1087 #[deprecated = "Strict unions should not use `is_unknown`"]
1088 #[inline]
1089 pub fn is_unknown(&self) -> bool {
1090 false
1091 }
1092}
1093
1094impl fidl::Persistable for Command {}
1095
1096#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
1097pub enum InputEvent {
1098 Pointer(PointerEvent),
1099 Keyboard(KeyboardEvent),
1100 Focus(FocusEvent),
1101}
1102
1103impl InputEvent {
1104 #[inline]
1105 pub fn ordinal(&self) -> u64 {
1106 match *self {
1107 Self::Pointer(_) => 1,
1108 Self::Keyboard(_) => 2,
1109 Self::Focus(_) => 3,
1110 }
1111 }
1112
1113 #[deprecated = "Strict unions should not use `is_unknown`"]
1114 #[inline]
1115 pub fn is_unknown(&self) -> bool {
1116 false
1117 }
1118}
1119
1120impl fidl::Persistable for InputEvent {}
1121
1122#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1123pub enum SensorReport {
1124 Vector([i16; 3]),
1125 Scalar(u16),
1126}
1127
1128impl SensorReport {
1129 #[inline]
1130 pub fn ordinal(&self) -> u64 {
1131 match *self {
1132 Self::Vector(_) => 1,
1133 Self::Scalar(_) => 2,
1134 }
1135 }
1136
1137 #[deprecated = "Strict unions should not use `is_unknown`"]
1138 #[inline]
1139 pub fn is_unknown(&self) -> bool {
1140 false
1141 }
1142}
1143
1144impl fidl::Persistable for SensorReport {}
1145
1146mod internal {
1147 use super::*;
1148 unsafe impl fidl::encoding::TypeMarker for AxisScale {
1149 type Owned = Self;
1150
1151 #[inline(always)]
1152 fn inline_align(_context: fidl::encoding::Context) -> usize {
1153 std::mem::align_of::<u32>()
1154 }
1155
1156 #[inline(always)]
1157 fn inline_size(_context: fidl::encoding::Context) -> usize {
1158 std::mem::size_of::<u32>()
1159 }
1160
1161 #[inline(always)]
1162 fn encode_is_copy() -> bool {
1163 false
1164 }
1165
1166 #[inline(always)]
1167 fn decode_is_copy() -> bool {
1168 false
1169 }
1170 }
1171
1172 impl fidl::encoding::ValueTypeMarker for AxisScale {
1173 type Borrowed<'a> = Self;
1174 #[inline(always)]
1175 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1176 *value
1177 }
1178 }
1179
1180 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for AxisScale {
1181 #[inline]
1182 unsafe fn encode(
1183 self,
1184 encoder: &mut fidl::encoding::Encoder<'_, D>,
1185 offset: usize,
1186 _depth: fidl::encoding::Depth,
1187 ) -> fidl::Result<()> {
1188 encoder.debug_check_bounds::<Self>(offset);
1189 encoder.write_num(self.into_primitive(), offset);
1190 Ok(())
1191 }
1192 }
1193
1194 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisScale {
1195 #[inline(always)]
1196 fn new_empty() -> Self {
1197 Self::unknown()
1198 }
1199
1200 #[inline]
1201 unsafe fn decode(
1202 &mut self,
1203 decoder: &mut fidl::encoding::Decoder<'_, D>,
1204 offset: usize,
1205 _depth: fidl::encoding::Depth,
1206 ) -> fidl::Result<()> {
1207 decoder.debug_check_bounds::<Self>(offset);
1208 let prim = decoder.read_num::<u32>(offset);
1209
1210 *self = Self::from_primitive_allow_unknown(prim);
1211 Ok(())
1212 }
1213 }
1214 unsafe impl fidl::encoding::TypeMarker for InputMethodAction {
1215 type Owned = Self;
1216
1217 #[inline(always)]
1218 fn inline_align(_context: fidl::encoding::Context) -> usize {
1219 std::mem::align_of::<u32>()
1220 }
1221
1222 #[inline(always)]
1223 fn inline_size(_context: fidl::encoding::Context) -> usize {
1224 std::mem::size_of::<u32>()
1225 }
1226
1227 #[inline(always)]
1228 fn encode_is_copy() -> bool {
1229 false
1230 }
1231
1232 #[inline(always)]
1233 fn decode_is_copy() -> bool {
1234 false
1235 }
1236 }
1237
1238 impl fidl::encoding::ValueTypeMarker for InputMethodAction {
1239 type Borrowed<'a> = Self;
1240 #[inline(always)]
1241 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1242 *value
1243 }
1244 }
1245
1246 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1247 for InputMethodAction
1248 {
1249 #[inline]
1250 unsafe fn encode(
1251 self,
1252 encoder: &mut fidl::encoding::Encoder<'_, D>,
1253 offset: usize,
1254 _depth: fidl::encoding::Depth,
1255 ) -> fidl::Result<()> {
1256 encoder.debug_check_bounds::<Self>(offset);
1257 encoder.write_num(self.into_primitive(), offset);
1258 Ok(())
1259 }
1260 }
1261
1262 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputMethodAction {
1263 #[inline(always)]
1264 fn new_empty() -> Self {
1265 Self::unknown()
1266 }
1267
1268 #[inline]
1269 unsafe fn decode(
1270 &mut self,
1271 decoder: &mut fidl::encoding::Decoder<'_, D>,
1272 offset: usize,
1273 _depth: fidl::encoding::Depth,
1274 ) -> fidl::Result<()> {
1275 decoder.debug_check_bounds::<Self>(offset);
1276 let prim = decoder.read_num::<u32>(offset);
1277
1278 *self = Self::from_primitive_allow_unknown(prim);
1279 Ok(())
1280 }
1281 }
1282 unsafe impl fidl::encoding::TypeMarker for KeyboardEventPhase {
1283 type Owned = Self;
1284
1285 #[inline(always)]
1286 fn inline_align(_context: fidl::encoding::Context) -> usize {
1287 std::mem::align_of::<u32>()
1288 }
1289
1290 #[inline(always)]
1291 fn inline_size(_context: fidl::encoding::Context) -> usize {
1292 std::mem::size_of::<u32>()
1293 }
1294
1295 #[inline(always)]
1296 fn encode_is_copy() -> bool {
1297 false
1298 }
1299
1300 #[inline(always)]
1301 fn decode_is_copy() -> bool {
1302 false
1303 }
1304 }
1305
1306 impl fidl::encoding::ValueTypeMarker for KeyboardEventPhase {
1307 type Borrowed<'a> = Self;
1308 #[inline(always)]
1309 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1310 *value
1311 }
1312 }
1313
1314 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1315 for KeyboardEventPhase
1316 {
1317 #[inline]
1318 unsafe fn encode(
1319 self,
1320 encoder: &mut fidl::encoding::Encoder<'_, D>,
1321 offset: usize,
1322 _depth: fidl::encoding::Depth,
1323 ) -> fidl::Result<()> {
1324 encoder.debug_check_bounds::<Self>(offset);
1325 encoder.write_num(self.into_primitive(), offset);
1326 Ok(())
1327 }
1328 }
1329
1330 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEventPhase {
1331 #[inline(always)]
1332 fn new_empty() -> Self {
1333 Self::unknown()
1334 }
1335
1336 #[inline]
1337 unsafe fn decode(
1338 &mut self,
1339 decoder: &mut fidl::encoding::Decoder<'_, D>,
1340 offset: usize,
1341 _depth: fidl::encoding::Depth,
1342 ) -> fidl::Result<()> {
1343 decoder.debug_check_bounds::<Self>(offset);
1344 let prim = decoder.read_num::<u32>(offset);
1345
1346 *self = Self::from_primitive_allow_unknown(prim);
1347 Ok(())
1348 }
1349 }
1350 unsafe impl fidl::encoding::TypeMarker for KeyboardType {
1351 type Owned = Self;
1352
1353 #[inline(always)]
1354 fn inline_align(_context: fidl::encoding::Context) -> usize {
1355 std::mem::align_of::<u32>()
1356 }
1357
1358 #[inline(always)]
1359 fn inline_size(_context: fidl::encoding::Context) -> usize {
1360 std::mem::size_of::<u32>()
1361 }
1362
1363 #[inline(always)]
1364 fn encode_is_copy() -> bool {
1365 false
1366 }
1367
1368 #[inline(always)]
1369 fn decode_is_copy() -> bool {
1370 false
1371 }
1372 }
1373
1374 impl fidl::encoding::ValueTypeMarker for KeyboardType {
1375 type Borrowed<'a> = Self;
1376 #[inline(always)]
1377 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1378 *value
1379 }
1380 }
1381
1382 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyboardType {
1383 #[inline]
1384 unsafe fn encode(
1385 self,
1386 encoder: &mut fidl::encoding::Encoder<'_, D>,
1387 offset: usize,
1388 _depth: fidl::encoding::Depth,
1389 ) -> fidl::Result<()> {
1390 encoder.debug_check_bounds::<Self>(offset);
1391 encoder.write_num(self.into_primitive(), offset);
1392 Ok(())
1393 }
1394 }
1395
1396 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardType {
1397 #[inline(always)]
1398 fn new_empty() -> Self {
1399 Self::unknown()
1400 }
1401
1402 #[inline]
1403 unsafe fn decode(
1404 &mut self,
1405 decoder: &mut fidl::encoding::Decoder<'_, D>,
1406 offset: usize,
1407 _depth: fidl::encoding::Depth,
1408 ) -> fidl::Result<()> {
1409 decoder.debug_check_bounds::<Self>(offset);
1410 let prim = decoder.read_num::<u32>(offset);
1411
1412 *self = Self::from_primitive_allow_unknown(prim);
1413 Ok(())
1414 }
1415 }
1416 unsafe impl fidl::encoding::TypeMarker for PointerEventPhase {
1417 type Owned = Self;
1418
1419 #[inline(always)]
1420 fn inline_align(_context: fidl::encoding::Context) -> usize {
1421 std::mem::align_of::<u32>()
1422 }
1423
1424 #[inline(always)]
1425 fn inline_size(_context: fidl::encoding::Context) -> usize {
1426 std::mem::size_of::<u32>()
1427 }
1428
1429 #[inline(always)]
1430 fn encode_is_copy() -> bool {
1431 true
1432 }
1433
1434 #[inline(always)]
1435 fn decode_is_copy() -> bool {
1436 false
1437 }
1438 }
1439
1440 impl fidl::encoding::ValueTypeMarker for PointerEventPhase {
1441 type Borrowed<'a> = Self;
1442 #[inline(always)]
1443 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1444 *value
1445 }
1446 }
1447
1448 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1449 for PointerEventPhase
1450 {
1451 #[inline]
1452 unsafe fn encode(
1453 self,
1454 encoder: &mut fidl::encoding::Encoder<'_, D>,
1455 offset: usize,
1456 _depth: fidl::encoding::Depth,
1457 ) -> fidl::Result<()> {
1458 encoder.debug_check_bounds::<Self>(offset);
1459 encoder.write_num(self.into_primitive(), offset);
1460 Ok(())
1461 }
1462 }
1463
1464 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventPhase {
1465 #[inline(always)]
1466 fn new_empty() -> Self {
1467 Self::Add
1468 }
1469
1470 #[inline]
1471 unsafe fn decode(
1472 &mut self,
1473 decoder: &mut fidl::encoding::Decoder<'_, D>,
1474 offset: usize,
1475 _depth: fidl::encoding::Depth,
1476 ) -> fidl::Result<()> {
1477 decoder.debug_check_bounds::<Self>(offset);
1478 let prim = decoder.read_num::<u32>(offset);
1479
1480 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1481 Ok(())
1482 }
1483 }
1484 unsafe impl fidl::encoding::TypeMarker for PointerEventType {
1485 type Owned = Self;
1486
1487 #[inline(always)]
1488 fn inline_align(_context: fidl::encoding::Context) -> usize {
1489 std::mem::align_of::<u32>()
1490 }
1491
1492 #[inline(always)]
1493 fn inline_size(_context: fidl::encoding::Context) -> usize {
1494 std::mem::size_of::<u32>()
1495 }
1496
1497 #[inline(always)]
1498 fn encode_is_copy() -> bool {
1499 true
1500 }
1501
1502 #[inline(always)]
1503 fn decode_is_copy() -> bool {
1504 false
1505 }
1506 }
1507
1508 impl fidl::encoding::ValueTypeMarker for PointerEventType {
1509 type Borrowed<'a> = Self;
1510 #[inline(always)]
1511 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1512 *value
1513 }
1514 }
1515
1516 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1517 for PointerEventType
1518 {
1519 #[inline]
1520 unsafe fn encode(
1521 self,
1522 encoder: &mut fidl::encoding::Encoder<'_, D>,
1523 offset: usize,
1524 _depth: fidl::encoding::Depth,
1525 ) -> fidl::Result<()> {
1526 encoder.debug_check_bounds::<Self>(offset);
1527 encoder.write_num(self.into_primitive(), offset);
1528 Ok(())
1529 }
1530 }
1531
1532 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEventType {
1533 #[inline(always)]
1534 fn new_empty() -> Self {
1535 Self::Touch
1536 }
1537
1538 #[inline]
1539 unsafe fn decode(
1540 &mut self,
1541 decoder: &mut fidl::encoding::Decoder<'_, D>,
1542 offset: usize,
1543 _depth: fidl::encoding::Depth,
1544 ) -> fidl::Result<()> {
1545 decoder.debug_check_bounds::<Self>(offset);
1546 let prim = decoder.read_num::<u32>(offset);
1547
1548 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1549 Ok(())
1550 }
1551 }
1552 unsafe impl fidl::encoding::TypeMarker for SensorLocation {
1553 type Owned = Self;
1554
1555 #[inline(always)]
1556 fn inline_align(_context: fidl::encoding::Context) -> usize {
1557 std::mem::align_of::<u32>()
1558 }
1559
1560 #[inline(always)]
1561 fn inline_size(_context: fidl::encoding::Context) -> usize {
1562 std::mem::size_of::<u32>()
1563 }
1564
1565 #[inline(always)]
1566 fn encode_is_copy() -> bool {
1567 false
1568 }
1569
1570 #[inline(always)]
1571 fn decode_is_copy() -> bool {
1572 false
1573 }
1574 }
1575
1576 impl fidl::encoding::ValueTypeMarker for SensorLocation {
1577 type Borrowed<'a> = Self;
1578 #[inline(always)]
1579 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1580 *value
1581 }
1582 }
1583
1584 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorLocation {
1585 #[inline]
1586 unsafe fn encode(
1587 self,
1588 encoder: &mut fidl::encoding::Encoder<'_, D>,
1589 offset: usize,
1590 _depth: fidl::encoding::Depth,
1591 ) -> fidl::Result<()> {
1592 encoder.debug_check_bounds::<Self>(offset);
1593 encoder.write_num(self.into_primitive(), offset);
1594 Ok(())
1595 }
1596 }
1597
1598 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorLocation {
1599 #[inline(always)]
1600 fn new_empty() -> Self {
1601 Self::unknown()
1602 }
1603
1604 #[inline]
1605 unsafe fn decode(
1606 &mut self,
1607 decoder: &mut fidl::encoding::Decoder<'_, D>,
1608 offset: usize,
1609 _depth: fidl::encoding::Depth,
1610 ) -> fidl::Result<()> {
1611 decoder.debug_check_bounds::<Self>(offset);
1612 let prim = decoder.read_num::<u32>(offset);
1613
1614 *self = Self::from_primitive_allow_unknown(prim);
1615 Ok(())
1616 }
1617 }
1618 unsafe impl fidl::encoding::TypeMarker for SensorType {
1619 type Owned = Self;
1620
1621 #[inline(always)]
1622 fn inline_align(_context: fidl::encoding::Context) -> usize {
1623 std::mem::align_of::<u32>()
1624 }
1625
1626 #[inline(always)]
1627 fn inline_size(_context: fidl::encoding::Context) -> usize {
1628 std::mem::size_of::<u32>()
1629 }
1630
1631 #[inline(always)]
1632 fn encode_is_copy() -> bool {
1633 false
1634 }
1635
1636 #[inline(always)]
1637 fn decode_is_copy() -> bool {
1638 false
1639 }
1640 }
1641
1642 impl fidl::encoding::ValueTypeMarker for SensorType {
1643 type Borrowed<'a> = Self;
1644 #[inline(always)]
1645 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1646 *value
1647 }
1648 }
1649
1650 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SensorType {
1651 #[inline]
1652 unsafe fn encode(
1653 self,
1654 encoder: &mut fidl::encoding::Encoder<'_, D>,
1655 offset: usize,
1656 _depth: fidl::encoding::Depth,
1657 ) -> fidl::Result<()> {
1658 encoder.debug_check_bounds::<Self>(offset);
1659 encoder.write_num(self.into_primitive(), offset);
1660 Ok(())
1661 }
1662 }
1663
1664 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorType {
1665 #[inline(always)]
1666 fn new_empty() -> Self {
1667 Self::unknown()
1668 }
1669
1670 #[inline]
1671 unsafe fn decode(
1672 &mut self,
1673 decoder: &mut fidl::encoding::Decoder<'_, D>,
1674 offset: usize,
1675 _depth: fidl::encoding::Depth,
1676 ) -> fidl::Result<()> {
1677 decoder.debug_check_bounds::<Self>(offset);
1678 let prim = decoder.read_num::<u32>(offset);
1679
1680 *self = Self::from_primitive_allow_unknown(prim);
1681 Ok(())
1682 }
1683 }
1684 unsafe impl fidl::encoding::TypeMarker for TextAffinity {
1685 type Owned = Self;
1686
1687 #[inline(always)]
1688 fn inline_align(_context: fidl::encoding::Context) -> usize {
1689 std::mem::align_of::<u32>()
1690 }
1691
1692 #[inline(always)]
1693 fn inline_size(_context: fidl::encoding::Context) -> usize {
1694 std::mem::size_of::<u32>()
1695 }
1696
1697 #[inline(always)]
1698 fn encode_is_copy() -> bool {
1699 true
1700 }
1701
1702 #[inline(always)]
1703 fn decode_is_copy() -> bool {
1704 false
1705 }
1706 }
1707
1708 impl fidl::encoding::ValueTypeMarker for TextAffinity {
1709 type Borrowed<'a> = Self;
1710 #[inline(always)]
1711 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1712 *value
1713 }
1714 }
1715
1716 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for TextAffinity {
1717 #[inline]
1718 unsafe fn encode(
1719 self,
1720 encoder: &mut fidl::encoding::Encoder<'_, D>,
1721 offset: usize,
1722 _depth: fidl::encoding::Depth,
1723 ) -> fidl::Result<()> {
1724 encoder.debug_check_bounds::<Self>(offset);
1725 encoder.write_num(self.into_primitive(), offset);
1726 Ok(())
1727 }
1728 }
1729
1730 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextAffinity {
1731 #[inline(always)]
1732 fn new_empty() -> Self {
1733 Self::Upstream
1734 }
1735
1736 #[inline]
1737 unsafe fn decode(
1738 &mut self,
1739 decoder: &mut fidl::encoding::Decoder<'_, D>,
1740 offset: usize,
1741 _depth: fidl::encoding::Depth,
1742 ) -> fidl::Result<()> {
1743 decoder.debug_check_bounds::<Self>(offset);
1744 let prim = decoder.read_num::<u32>(offset);
1745
1746 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1747 Ok(())
1748 }
1749 }
1750
1751 impl fidl::encoding::ValueTypeMarker for Axis {
1752 type Borrowed<'a> = &'a Self;
1753 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1754 value
1755 }
1756 }
1757
1758 unsafe impl fidl::encoding::TypeMarker for Axis {
1759 type Owned = Self;
1760
1761 #[inline(always)]
1762 fn inline_align(_context: fidl::encoding::Context) -> usize {
1763 4
1764 }
1765
1766 #[inline(always)]
1767 fn inline_size(_context: fidl::encoding::Context) -> usize {
1768 16
1769 }
1770 }
1771
1772 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Axis, D> for &Axis {
1773 #[inline]
1774 unsafe fn encode(
1775 self,
1776 encoder: &mut fidl::encoding::Encoder<'_, D>,
1777 offset: usize,
1778 _depth: fidl::encoding::Depth,
1779 ) -> fidl::Result<()> {
1780 encoder.debug_check_bounds::<Axis>(offset);
1781 fidl::encoding::Encode::<Axis, D>::encode(
1783 (
1784 <Range as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
1785 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
1786 <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
1787 ),
1788 encoder,
1789 offset,
1790 _depth,
1791 )
1792 }
1793 }
1794 unsafe impl<
1795 D: fidl::encoding::ResourceDialect,
1796 T0: fidl::encoding::Encode<Range, D>,
1797 T1: fidl::encoding::Encode<i32, D>,
1798 T2: fidl::encoding::Encode<AxisScale, D>,
1799 > fidl::encoding::Encode<Axis, D> for (T0, T1, T2)
1800 {
1801 #[inline]
1802 unsafe fn encode(
1803 self,
1804 encoder: &mut fidl::encoding::Encoder<'_, D>,
1805 offset: usize,
1806 depth: fidl::encoding::Depth,
1807 ) -> fidl::Result<()> {
1808 encoder.debug_check_bounds::<Axis>(offset);
1809 self.0.encode(encoder, offset + 0, depth)?;
1813 self.1.encode(encoder, offset + 8, depth)?;
1814 self.2.encode(encoder, offset + 12, depth)?;
1815 Ok(())
1816 }
1817 }
1818
1819 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Axis {
1820 #[inline(always)]
1821 fn new_empty() -> Self {
1822 Self {
1823 range: fidl::new_empty!(Range, D),
1824 resolution: fidl::new_empty!(i32, D),
1825 scale: fidl::new_empty!(AxisScale, D),
1826 }
1827 }
1828
1829 #[inline]
1830 unsafe fn decode(
1831 &mut self,
1832 decoder: &mut fidl::encoding::Decoder<'_, D>,
1833 offset: usize,
1834 _depth: fidl::encoding::Depth,
1835 ) -> fidl::Result<()> {
1836 decoder.debug_check_bounds::<Self>(offset);
1837 fidl::decode!(Range, D, &mut self.range, decoder, offset + 0, _depth)?;
1839 fidl::decode!(i32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
1840 fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
1841 Ok(())
1842 }
1843 }
1844
1845 impl fidl::encoding::ValueTypeMarker for AxisF {
1846 type Borrowed<'a> = &'a Self;
1847 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1848 value
1849 }
1850 }
1851
1852 unsafe impl fidl::encoding::TypeMarker for AxisF {
1853 type Owned = Self;
1854
1855 #[inline(always)]
1856 fn inline_align(_context: fidl::encoding::Context) -> usize {
1857 4
1858 }
1859
1860 #[inline(always)]
1861 fn inline_size(_context: fidl::encoding::Context) -> usize {
1862 16
1863 }
1864 }
1865
1866 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AxisF, D> for &AxisF {
1867 #[inline]
1868 unsafe fn encode(
1869 self,
1870 encoder: &mut fidl::encoding::Encoder<'_, D>,
1871 offset: usize,
1872 _depth: fidl::encoding::Depth,
1873 ) -> fidl::Result<()> {
1874 encoder.debug_check_bounds::<AxisF>(offset);
1875 fidl::encoding::Encode::<AxisF, D>::encode(
1877 (
1878 <RangeF as fidl::encoding::ValueTypeMarker>::borrow(&self.range),
1879 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.resolution),
1880 <AxisScale as fidl::encoding::ValueTypeMarker>::borrow(&self.scale),
1881 ),
1882 encoder,
1883 offset,
1884 _depth,
1885 )
1886 }
1887 }
1888 unsafe impl<
1889 D: fidl::encoding::ResourceDialect,
1890 T0: fidl::encoding::Encode<RangeF, D>,
1891 T1: fidl::encoding::Encode<f32, D>,
1892 T2: fidl::encoding::Encode<AxisScale, D>,
1893 > fidl::encoding::Encode<AxisF, D> for (T0, T1, T2)
1894 {
1895 #[inline]
1896 unsafe fn encode(
1897 self,
1898 encoder: &mut fidl::encoding::Encoder<'_, D>,
1899 offset: usize,
1900 depth: fidl::encoding::Depth,
1901 ) -> fidl::Result<()> {
1902 encoder.debug_check_bounds::<AxisF>(offset);
1903 self.0.encode(encoder, offset + 0, depth)?;
1907 self.1.encode(encoder, offset + 8, depth)?;
1908 self.2.encode(encoder, offset + 12, depth)?;
1909 Ok(())
1910 }
1911 }
1912
1913 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AxisF {
1914 #[inline(always)]
1915 fn new_empty() -> Self {
1916 Self {
1917 range: fidl::new_empty!(RangeF, D),
1918 resolution: fidl::new_empty!(f32, D),
1919 scale: fidl::new_empty!(AxisScale, D),
1920 }
1921 }
1922
1923 #[inline]
1924 unsafe fn decode(
1925 &mut self,
1926 decoder: &mut fidl::encoding::Decoder<'_, D>,
1927 offset: usize,
1928 _depth: fidl::encoding::Depth,
1929 ) -> fidl::Result<()> {
1930 decoder.debug_check_bounds::<Self>(offset);
1931 fidl::decode!(RangeF, D, &mut self.range, decoder, offset + 0, _depth)?;
1933 fidl::decode!(f32, D, &mut self.resolution, decoder, offset + 8, _depth)?;
1934 fidl::decode!(AxisScale, D, &mut self.scale, decoder, offset + 12, _depth)?;
1935 Ok(())
1936 }
1937 }
1938
1939 impl fidl::encoding::ValueTypeMarker for DeviceDescriptor {
1940 type Borrowed<'a> = &'a Self;
1941 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1942 value
1943 }
1944 }
1945
1946 unsafe impl fidl::encoding::TypeMarker for DeviceDescriptor {
1947 type Owned = Self;
1948
1949 #[inline(always)]
1950 fn inline_align(_context: fidl::encoding::Context) -> usize {
1951 8
1952 }
1953
1954 #[inline(always)]
1955 fn inline_size(_context: fidl::encoding::Context) -> usize {
1956 56
1957 }
1958 }
1959
1960 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceDescriptor, D>
1961 for &DeviceDescriptor
1962 {
1963 #[inline]
1964 unsafe fn encode(
1965 self,
1966 encoder: &mut fidl::encoding::Encoder<'_, D>,
1967 offset: usize,
1968 _depth: fidl::encoding::Depth,
1969 ) -> fidl::Result<()> {
1970 encoder.debug_check_bounds::<DeviceDescriptor>(offset);
1971 fidl::encoding::Encode::<DeviceDescriptor, D>::encode(
1973 (
1974 <fidl::encoding::Boxed<DeviceInfo> as fidl::encoding::ValueTypeMarker>::borrow(&self.device_info),
1975 <fidl::encoding::Boxed<KeyboardDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
1976 <fidl::encoding::Boxed<MediaButtonsDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
1977 <fidl::encoding::Boxed<MouseDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
1978 <fidl::encoding::Boxed<StylusDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
1979 <fidl::encoding::Boxed<TouchscreenDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
1980 <fidl::encoding::Boxed<SensorDescriptor> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
1981 ),
1982 encoder, offset, _depth
1983 )
1984 }
1985 }
1986 unsafe impl<
1987 D: fidl::encoding::ResourceDialect,
1988 T0: fidl::encoding::Encode<fidl::encoding::Boxed<DeviceInfo>, D>,
1989 T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardDescriptor>, D>,
1990 T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsDescriptor>, D>,
1991 T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseDescriptor>, D>,
1992 T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusDescriptor>, D>,
1993 T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenDescriptor>, D>,
1994 T6: fidl::encoding::Encode<fidl::encoding::Boxed<SensorDescriptor>, D>,
1995 > fidl::encoding::Encode<DeviceDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
1996 {
1997 #[inline]
1998 unsafe fn encode(
1999 self,
2000 encoder: &mut fidl::encoding::Encoder<'_, D>,
2001 offset: usize,
2002 depth: fidl::encoding::Depth,
2003 ) -> fidl::Result<()> {
2004 encoder.debug_check_bounds::<DeviceDescriptor>(offset);
2005 self.0.encode(encoder, offset + 0, depth)?;
2009 self.1.encode(encoder, offset + 8, depth)?;
2010 self.2.encode(encoder, offset + 16, depth)?;
2011 self.3.encode(encoder, offset + 24, depth)?;
2012 self.4.encode(encoder, offset + 32, depth)?;
2013 self.5.encode(encoder, offset + 40, depth)?;
2014 self.6.encode(encoder, offset + 48, depth)?;
2015 Ok(())
2016 }
2017 }
2018
2019 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceDescriptor {
2020 #[inline(always)]
2021 fn new_empty() -> Self {
2022 Self {
2023 device_info: fidl::new_empty!(fidl::encoding::Boxed<DeviceInfo>, D),
2024 keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardDescriptor>, D),
2025 media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsDescriptor>, D),
2026 mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseDescriptor>, D),
2027 stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusDescriptor>, D),
2028 touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenDescriptor>, D),
2029 sensor: fidl::new_empty!(fidl::encoding::Boxed<SensorDescriptor>, D),
2030 }
2031 }
2032
2033 #[inline]
2034 unsafe fn decode(
2035 &mut self,
2036 decoder: &mut fidl::encoding::Decoder<'_, D>,
2037 offset: usize,
2038 _depth: fidl::encoding::Depth,
2039 ) -> fidl::Result<()> {
2040 decoder.debug_check_bounds::<Self>(offset);
2041 fidl::decode!(
2043 fidl::encoding::Boxed<DeviceInfo>,
2044 D,
2045 &mut self.device_info,
2046 decoder,
2047 offset + 0,
2048 _depth
2049 )?;
2050 fidl::decode!(
2051 fidl::encoding::Boxed<KeyboardDescriptor>,
2052 D,
2053 &mut self.keyboard,
2054 decoder,
2055 offset + 8,
2056 _depth
2057 )?;
2058 fidl::decode!(
2059 fidl::encoding::Boxed<MediaButtonsDescriptor>,
2060 D,
2061 &mut self.media_buttons,
2062 decoder,
2063 offset + 16,
2064 _depth
2065 )?;
2066 fidl::decode!(
2067 fidl::encoding::Boxed<MouseDescriptor>,
2068 D,
2069 &mut self.mouse,
2070 decoder,
2071 offset + 24,
2072 _depth
2073 )?;
2074 fidl::decode!(
2075 fidl::encoding::Boxed<StylusDescriptor>,
2076 D,
2077 &mut self.stylus,
2078 decoder,
2079 offset + 32,
2080 _depth
2081 )?;
2082 fidl::decode!(
2083 fidl::encoding::Boxed<TouchscreenDescriptor>,
2084 D,
2085 &mut self.touchscreen,
2086 decoder,
2087 offset + 40,
2088 _depth
2089 )?;
2090 fidl::decode!(
2091 fidl::encoding::Boxed<SensorDescriptor>,
2092 D,
2093 &mut self.sensor,
2094 decoder,
2095 offset + 48,
2096 _depth
2097 )?;
2098 Ok(())
2099 }
2100 }
2101
2102 impl fidl::encoding::ValueTypeMarker for DeviceInfo {
2103 type Borrowed<'a> = &'a Self;
2104 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2105 value
2106 }
2107 }
2108
2109 unsafe impl fidl::encoding::TypeMarker for DeviceInfo {
2110 type Owned = Self;
2111
2112 #[inline(always)]
2113 fn inline_align(_context: fidl::encoding::Context) -> usize {
2114 8
2115 }
2116
2117 #[inline(always)]
2118 fn inline_size(_context: fidl::encoding::Context) -> usize {
2119 32
2120 }
2121 }
2122
2123 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceInfo, D>
2124 for &DeviceInfo
2125 {
2126 #[inline]
2127 unsafe fn encode(
2128 self,
2129 encoder: &mut fidl::encoding::Encoder<'_, D>,
2130 offset: usize,
2131 _depth: fidl::encoding::Depth,
2132 ) -> fidl::Result<()> {
2133 encoder.debug_check_bounds::<DeviceInfo>(offset);
2134 fidl::encoding::Encode::<DeviceInfo, D>::encode(
2136 (
2137 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.vendor_id),
2138 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.product_id),
2139 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.version),
2140 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
2141 &self.name,
2142 ),
2143 ),
2144 encoder,
2145 offset,
2146 _depth,
2147 )
2148 }
2149 }
2150 unsafe impl<
2151 D: fidl::encoding::ResourceDialect,
2152 T0: fidl::encoding::Encode<u32, D>,
2153 T1: fidl::encoding::Encode<u32, D>,
2154 T2: fidl::encoding::Encode<u32, D>,
2155 T3: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
2156 > fidl::encoding::Encode<DeviceInfo, D> for (T0, T1, T2, T3)
2157 {
2158 #[inline]
2159 unsafe fn encode(
2160 self,
2161 encoder: &mut fidl::encoding::Encoder<'_, D>,
2162 offset: usize,
2163 depth: fidl::encoding::Depth,
2164 ) -> fidl::Result<()> {
2165 encoder.debug_check_bounds::<DeviceInfo>(offset);
2166 unsafe {
2169 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2170 (ptr as *mut u64).write_unaligned(0);
2171 }
2172 self.0.encode(encoder, offset + 0, depth)?;
2174 self.1.encode(encoder, offset + 4, depth)?;
2175 self.2.encode(encoder, offset + 8, depth)?;
2176 self.3.encode(encoder, offset + 16, depth)?;
2177 Ok(())
2178 }
2179 }
2180
2181 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceInfo {
2182 #[inline(always)]
2183 fn new_empty() -> Self {
2184 Self {
2185 vendor_id: fidl::new_empty!(u32, D),
2186 product_id: fidl::new_empty!(u32, D),
2187 version: fidl::new_empty!(u32, D),
2188 name: fidl::new_empty!(fidl::encoding::UnboundedString, D),
2189 }
2190 }
2191
2192 #[inline]
2193 unsafe fn decode(
2194 &mut self,
2195 decoder: &mut fidl::encoding::Decoder<'_, D>,
2196 offset: usize,
2197 _depth: fidl::encoding::Depth,
2198 ) -> fidl::Result<()> {
2199 decoder.debug_check_bounds::<Self>(offset);
2200 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2202 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2203 let mask = 0xffffffff00000000u64;
2204 let maskedval = padval & mask;
2205 if maskedval != 0 {
2206 return Err(fidl::Error::NonZeroPadding {
2207 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2208 });
2209 }
2210 fidl::decode!(u32, D, &mut self.vendor_id, decoder, offset + 0, _depth)?;
2211 fidl::decode!(u32, D, &mut self.product_id, decoder, offset + 4, _depth)?;
2212 fidl::decode!(u32, D, &mut self.version, decoder, offset + 8, _depth)?;
2213 fidl::decode!(
2214 fidl::encoding::UnboundedString,
2215 D,
2216 &mut self.name,
2217 decoder,
2218 offset + 16,
2219 _depth
2220 )?;
2221 Ok(())
2222 }
2223 }
2224
2225 impl fidl::encoding::ValueTypeMarker for FocusEvent {
2226 type Borrowed<'a> = &'a Self;
2227 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2228 value
2229 }
2230 }
2231
2232 unsafe impl fidl::encoding::TypeMarker for FocusEvent {
2233 type Owned = Self;
2234
2235 #[inline(always)]
2236 fn inline_align(_context: fidl::encoding::Context) -> usize {
2237 8
2238 }
2239
2240 #[inline(always)]
2241 fn inline_size(_context: fidl::encoding::Context) -> usize {
2242 16
2243 }
2244 }
2245
2246 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FocusEvent, D>
2247 for &FocusEvent
2248 {
2249 #[inline]
2250 unsafe fn encode(
2251 self,
2252 encoder: &mut fidl::encoding::Encoder<'_, D>,
2253 offset: usize,
2254 _depth: fidl::encoding::Depth,
2255 ) -> fidl::Result<()> {
2256 encoder.debug_check_bounds::<FocusEvent>(offset);
2257 fidl::encoding::Encode::<FocusEvent, D>::encode(
2259 (
2260 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
2261 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.focused),
2262 ),
2263 encoder,
2264 offset,
2265 _depth,
2266 )
2267 }
2268 }
2269 unsafe impl<
2270 D: fidl::encoding::ResourceDialect,
2271 T0: fidl::encoding::Encode<u64, D>,
2272 T1: fidl::encoding::Encode<bool, D>,
2273 > fidl::encoding::Encode<FocusEvent, D> for (T0, T1)
2274 {
2275 #[inline]
2276 unsafe fn encode(
2277 self,
2278 encoder: &mut fidl::encoding::Encoder<'_, D>,
2279 offset: usize,
2280 depth: fidl::encoding::Depth,
2281 ) -> fidl::Result<()> {
2282 encoder.debug_check_bounds::<FocusEvent>(offset);
2283 unsafe {
2286 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2287 (ptr as *mut u64).write_unaligned(0);
2288 }
2289 self.0.encode(encoder, offset + 0, depth)?;
2291 self.1.encode(encoder, offset + 8, depth)?;
2292 Ok(())
2293 }
2294 }
2295
2296 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FocusEvent {
2297 #[inline(always)]
2298 fn new_empty() -> Self {
2299 Self { event_time: fidl::new_empty!(u64, D), focused: fidl::new_empty!(bool, D) }
2300 }
2301
2302 #[inline]
2303 unsafe fn decode(
2304 &mut self,
2305 decoder: &mut fidl::encoding::Decoder<'_, D>,
2306 offset: usize,
2307 _depth: fidl::encoding::Depth,
2308 ) -> fidl::Result<()> {
2309 decoder.debug_check_bounds::<Self>(offset);
2310 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2312 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2313 let mask = 0xffffffffffffff00u64;
2314 let maskedval = padval & mask;
2315 if maskedval != 0 {
2316 return Err(fidl::Error::NonZeroPadding {
2317 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2318 });
2319 }
2320 fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
2321 fidl::decode!(bool, D, &mut self.focused, decoder, offset + 8, _depth)?;
2322 Ok(())
2323 }
2324 }
2325
2326 impl fidl::encoding::ValueTypeMarker for InputDeviceDispatchReportRequest {
2327 type Borrowed<'a> = &'a Self;
2328 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2329 value
2330 }
2331 }
2332
2333 unsafe impl fidl::encoding::TypeMarker for InputDeviceDispatchReportRequest {
2334 type Owned = Self;
2335
2336 #[inline(always)]
2337 fn inline_align(_context: fidl::encoding::Context) -> usize {
2338 8
2339 }
2340
2341 #[inline(always)]
2342 fn inline_size(_context: fidl::encoding::Context) -> usize {
2343 72
2344 }
2345 }
2346
2347 unsafe impl<D: fidl::encoding::ResourceDialect>
2348 fidl::encoding::Encode<InputDeviceDispatchReportRequest, D>
2349 for &InputDeviceDispatchReportRequest
2350 {
2351 #[inline]
2352 unsafe fn encode(
2353 self,
2354 encoder: &mut fidl::encoding::Encoder<'_, D>,
2355 offset: usize,
2356 _depth: fidl::encoding::Depth,
2357 ) -> fidl::Result<()> {
2358 encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
2359 fidl::encoding::Encode::<InputDeviceDispatchReportRequest, D>::encode(
2361 (<InputReport as fidl::encoding::ValueTypeMarker>::borrow(&self.report),),
2362 encoder,
2363 offset,
2364 _depth,
2365 )
2366 }
2367 }
2368 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputReport, D>>
2369 fidl::encoding::Encode<InputDeviceDispatchReportRequest, D> for (T0,)
2370 {
2371 #[inline]
2372 unsafe fn encode(
2373 self,
2374 encoder: &mut fidl::encoding::Encoder<'_, D>,
2375 offset: usize,
2376 depth: fidl::encoding::Depth,
2377 ) -> fidl::Result<()> {
2378 encoder.debug_check_bounds::<InputDeviceDispatchReportRequest>(offset);
2379 self.0.encode(encoder, offset + 0, depth)?;
2383 Ok(())
2384 }
2385 }
2386
2387 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2388 for InputDeviceDispatchReportRequest
2389 {
2390 #[inline(always)]
2391 fn new_empty() -> Self {
2392 Self { report: fidl::new_empty!(InputReport, D) }
2393 }
2394
2395 #[inline]
2396 unsafe fn decode(
2397 &mut self,
2398 decoder: &mut fidl::encoding::Decoder<'_, D>,
2399 offset: usize,
2400 _depth: fidl::encoding::Depth,
2401 ) -> fidl::Result<()> {
2402 decoder.debug_check_bounds::<Self>(offset);
2403 fidl::decode!(InputReport, D, &mut self.report, decoder, offset + 0, _depth)?;
2405 Ok(())
2406 }
2407 }
2408
2409 impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientDidUpdateStateRequest {
2410 type Borrowed<'a> = &'a Self;
2411 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2412 value
2413 }
2414 }
2415
2416 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientDidUpdateStateRequest {
2417 type Owned = Self;
2418
2419 #[inline(always)]
2420 fn inline_align(_context: fidl::encoding::Context) -> usize {
2421 8
2422 }
2423
2424 #[inline(always)]
2425 fn inline_size(_context: fidl::encoding::Context) -> usize {
2426 80
2427 }
2428 }
2429
2430 unsafe impl<D: fidl::encoding::ResourceDialect>
2431 fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D>
2432 for &InputMethodEditorClientDidUpdateStateRequest
2433 {
2434 #[inline]
2435 unsafe fn encode(
2436 self,
2437 encoder: &mut fidl::encoding::Encoder<'_, D>,
2438 offset: usize,
2439 _depth: fidl::encoding::Depth,
2440 ) -> fidl::Result<()> {
2441 encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
2442 fidl::encoding::Encode::<InputMethodEditorClientDidUpdateStateRequest, D>::encode(
2444 (
2445 <TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),
2446 <fidl::encoding::OptionalUnion<InputEvent> as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2447 ),
2448 encoder, offset, _depth
2449 )
2450 }
2451 }
2452 unsafe impl<
2453 D: fidl::encoding::ResourceDialect,
2454 T0: fidl::encoding::Encode<TextInputState, D>,
2455 T1: fidl::encoding::Encode<fidl::encoding::OptionalUnion<InputEvent>, D>,
2456 > fidl::encoding::Encode<InputMethodEditorClientDidUpdateStateRequest, D> for (T0, T1)
2457 {
2458 #[inline]
2459 unsafe fn encode(
2460 self,
2461 encoder: &mut fidl::encoding::Encoder<'_, D>,
2462 offset: usize,
2463 depth: fidl::encoding::Depth,
2464 ) -> fidl::Result<()> {
2465 encoder.debug_check_bounds::<InputMethodEditorClientDidUpdateStateRequest>(offset);
2466 self.0.encode(encoder, offset + 0, depth)?;
2470 self.1.encode(encoder, offset + 64, depth)?;
2471 Ok(())
2472 }
2473 }
2474
2475 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2476 for InputMethodEditorClientDidUpdateStateRequest
2477 {
2478 #[inline(always)]
2479 fn new_empty() -> Self {
2480 Self {
2481 state: fidl::new_empty!(TextInputState, D),
2482 event: fidl::new_empty!(fidl::encoding::OptionalUnion<InputEvent>, D),
2483 }
2484 }
2485
2486 #[inline]
2487 unsafe fn decode(
2488 &mut self,
2489 decoder: &mut fidl::encoding::Decoder<'_, D>,
2490 offset: usize,
2491 _depth: fidl::encoding::Depth,
2492 ) -> fidl::Result<()> {
2493 decoder.debug_check_bounds::<Self>(offset);
2494 fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
2496 fidl::decode!(
2497 fidl::encoding::OptionalUnion<InputEvent>,
2498 D,
2499 &mut self.event,
2500 decoder,
2501 offset + 64,
2502 _depth
2503 )?;
2504 Ok(())
2505 }
2506 }
2507
2508 impl fidl::encoding::ValueTypeMarker for InputMethodEditorClientOnActionRequest {
2509 type Borrowed<'a> = &'a Self;
2510 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2511 value
2512 }
2513 }
2514
2515 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorClientOnActionRequest {
2516 type Owned = Self;
2517
2518 #[inline(always)]
2519 fn inline_align(_context: fidl::encoding::Context) -> usize {
2520 4
2521 }
2522
2523 #[inline(always)]
2524 fn inline_size(_context: fidl::encoding::Context) -> usize {
2525 4
2526 }
2527 }
2528
2529 unsafe impl<D: fidl::encoding::ResourceDialect>
2530 fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D>
2531 for &InputMethodEditorClientOnActionRequest
2532 {
2533 #[inline]
2534 unsafe fn encode(
2535 self,
2536 encoder: &mut fidl::encoding::Encoder<'_, D>,
2537 offset: usize,
2538 _depth: fidl::encoding::Depth,
2539 ) -> fidl::Result<()> {
2540 encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
2541 fidl::encoding::Encode::<InputMethodEditorClientOnActionRequest, D>::encode(
2543 (<InputMethodAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),),
2544 encoder,
2545 offset,
2546 _depth,
2547 )
2548 }
2549 }
2550 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputMethodAction, D>>
2551 fidl::encoding::Encode<InputMethodEditorClientOnActionRequest, D> for (T0,)
2552 {
2553 #[inline]
2554 unsafe fn encode(
2555 self,
2556 encoder: &mut fidl::encoding::Encoder<'_, D>,
2557 offset: usize,
2558 depth: fidl::encoding::Depth,
2559 ) -> fidl::Result<()> {
2560 encoder.debug_check_bounds::<InputMethodEditorClientOnActionRequest>(offset);
2561 self.0.encode(encoder, offset + 0, depth)?;
2565 Ok(())
2566 }
2567 }
2568
2569 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2570 for InputMethodEditorClientOnActionRequest
2571 {
2572 #[inline(always)]
2573 fn new_empty() -> Self {
2574 Self { action: fidl::new_empty!(InputMethodAction, D) }
2575 }
2576
2577 #[inline]
2578 unsafe fn decode(
2579 &mut self,
2580 decoder: &mut fidl::encoding::Decoder<'_, D>,
2581 offset: usize,
2582 _depth: fidl::encoding::Depth,
2583 ) -> fidl::Result<()> {
2584 decoder.debug_check_bounds::<Self>(offset);
2585 fidl::decode!(InputMethodAction, D, &mut self.action, decoder, offset + 0, _depth)?;
2587 Ok(())
2588 }
2589 }
2590
2591 impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Request {
2592 type Borrowed<'a> = &'a Self;
2593 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2594 value
2595 }
2596 }
2597
2598 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Request {
2599 type Owned = Self;
2600
2601 #[inline(always)]
2602 fn inline_align(_context: fidl::encoding::Context) -> usize {
2603 8
2604 }
2605
2606 #[inline(always)]
2607 fn inline_size(_context: fidl::encoding::Context) -> usize {
2608 16
2609 }
2610 }
2611
2612 unsafe impl<D: fidl::encoding::ResourceDialect>
2613 fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D>
2614 for &InputMethodEditorDispatchKey3Request
2615 {
2616 #[inline]
2617 unsafe fn encode(
2618 self,
2619 encoder: &mut fidl::encoding::Encoder<'_, D>,
2620 offset: usize,
2621 _depth: fidl::encoding::Depth,
2622 ) -> fidl::Result<()> {
2623 encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2624 fidl::encoding::Encode::<InputMethodEditorDispatchKey3Request, D>::encode(
2626 (<fidl_fuchsia_ui_input3::KeyEvent as fidl::encoding::ValueTypeMarker>::borrow(
2627 &self.event,
2628 ),),
2629 encoder,
2630 offset,
2631 _depth,
2632 )
2633 }
2634 }
2635 unsafe impl<
2636 D: fidl::encoding::ResourceDialect,
2637 T0: fidl::encoding::Encode<fidl_fuchsia_ui_input3::KeyEvent, D>,
2638 > fidl::encoding::Encode<InputMethodEditorDispatchKey3Request, D> for (T0,)
2639 {
2640 #[inline]
2641 unsafe fn encode(
2642 self,
2643 encoder: &mut fidl::encoding::Encoder<'_, D>,
2644 offset: usize,
2645 depth: fidl::encoding::Depth,
2646 ) -> fidl::Result<()> {
2647 encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Request>(offset);
2648 self.0.encode(encoder, offset + 0, depth)?;
2652 Ok(())
2653 }
2654 }
2655
2656 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2657 for InputMethodEditorDispatchKey3Request
2658 {
2659 #[inline(always)]
2660 fn new_empty() -> Self {
2661 Self { event: fidl::new_empty!(fidl_fuchsia_ui_input3::KeyEvent, D) }
2662 }
2663
2664 #[inline]
2665 unsafe fn decode(
2666 &mut self,
2667 decoder: &mut fidl::encoding::Decoder<'_, D>,
2668 offset: usize,
2669 _depth: fidl::encoding::Depth,
2670 ) -> fidl::Result<()> {
2671 decoder.debug_check_bounds::<Self>(offset);
2672 fidl::decode!(
2674 fidl_fuchsia_ui_input3::KeyEvent,
2675 D,
2676 &mut self.event,
2677 decoder,
2678 offset + 0,
2679 _depth
2680 )?;
2681 Ok(())
2682 }
2683 }
2684
2685 impl fidl::encoding::ValueTypeMarker for InputMethodEditorDispatchKey3Response {
2686 type Borrowed<'a> = &'a Self;
2687 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2688 value
2689 }
2690 }
2691
2692 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorDispatchKey3Response {
2693 type Owned = Self;
2694
2695 #[inline(always)]
2696 fn inline_align(_context: fidl::encoding::Context) -> usize {
2697 1
2698 }
2699
2700 #[inline(always)]
2701 fn inline_size(_context: fidl::encoding::Context) -> usize {
2702 1
2703 }
2704 }
2705
2706 unsafe impl<D: fidl::encoding::ResourceDialect>
2707 fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D>
2708 for &InputMethodEditorDispatchKey3Response
2709 {
2710 #[inline]
2711 unsafe fn encode(
2712 self,
2713 encoder: &mut fidl::encoding::Encoder<'_, D>,
2714 offset: usize,
2715 _depth: fidl::encoding::Depth,
2716 ) -> fidl::Result<()> {
2717 encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2718 fidl::encoding::Encode::<InputMethodEditorDispatchKey3Response, D>::encode(
2720 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.handled),),
2721 encoder,
2722 offset,
2723 _depth,
2724 )
2725 }
2726 }
2727 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
2728 fidl::encoding::Encode<InputMethodEditorDispatchKey3Response, D> for (T0,)
2729 {
2730 #[inline]
2731 unsafe fn encode(
2732 self,
2733 encoder: &mut fidl::encoding::Encoder<'_, D>,
2734 offset: usize,
2735 depth: fidl::encoding::Depth,
2736 ) -> fidl::Result<()> {
2737 encoder.debug_check_bounds::<InputMethodEditorDispatchKey3Response>(offset);
2738 self.0.encode(encoder, offset + 0, depth)?;
2742 Ok(())
2743 }
2744 }
2745
2746 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2747 for InputMethodEditorDispatchKey3Response
2748 {
2749 #[inline(always)]
2750 fn new_empty() -> Self {
2751 Self { handled: fidl::new_empty!(bool, D) }
2752 }
2753
2754 #[inline]
2755 unsafe fn decode(
2756 &mut self,
2757 decoder: &mut fidl::encoding::Decoder<'_, D>,
2758 offset: usize,
2759 _depth: fidl::encoding::Depth,
2760 ) -> fidl::Result<()> {
2761 decoder.debug_check_bounds::<Self>(offset);
2762 fidl::decode!(bool, D, &mut self.handled, decoder, offset + 0, _depth)?;
2764 Ok(())
2765 }
2766 }
2767
2768 impl fidl::encoding::ValueTypeMarker for InputMethodEditorInjectInputRequest {
2769 type Borrowed<'a> = &'a Self;
2770 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2771 value
2772 }
2773 }
2774
2775 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorInjectInputRequest {
2776 type Owned = Self;
2777
2778 #[inline(always)]
2779 fn inline_align(_context: fidl::encoding::Context) -> usize {
2780 8
2781 }
2782
2783 #[inline(always)]
2784 fn inline_size(_context: fidl::encoding::Context) -> usize {
2785 16
2786 }
2787 }
2788
2789 unsafe impl<D: fidl::encoding::ResourceDialect>
2790 fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D>
2791 for &InputMethodEditorInjectInputRequest
2792 {
2793 #[inline]
2794 unsafe fn encode(
2795 self,
2796 encoder: &mut fidl::encoding::Encoder<'_, D>,
2797 offset: usize,
2798 _depth: fidl::encoding::Depth,
2799 ) -> fidl::Result<()> {
2800 encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2801 fidl::encoding::Encode::<InputMethodEditorInjectInputRequest, D>::encode(
2803 (<InputEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
2804 encoder,
2805 offset,
2806 _depth,
2807 )
2808 }
2809 }
2810 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<InputEvent, D>>
2811 fidl::encoding::Encode<InputMethodEditorInjectInputRequest, D> for (T0,)
2812 {
2813 #[inline]
2814 unsafe fn encode(
2815 self,
2816 encoder: &mut fidl::encoding::Encoder<'_, D>,
2817 offset: usize,
2818 depth: fidl::encoding::Depth,
2819 ) -> fidl::Result<()> {
2820 encoder.debug_check_bounds::<InputMethodEditorInjectInputRequest>(offset);
2821 self.0.encode(encoder, offset + 0, depth)?;
2825 Ok(())
2826 }
2827 }
2828
2829 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2830 for InputMethodEditorInjectInputRequest
2831 {
2832 #[inline(always)]
2833 fn new_empty() -> Self {
2834 Self { event: fidl::new_empty!(InputEvent, D) }
2835 }
2836
2837 #[inline]
2838 unsafe fn decode(
2839 &mut self,
2840 decoder: &mut fidl::encoding::Decoder<'_, D>,
2841 offset: usize,
2842 _depth: fidl::encoding::Depth,
2843 ) -> fidl::Result<()> {
2844 decoder.debug_check_bounds::<Self>(offset);
2845 fidl::decode!(InputEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
2847 Ok(())
2848 }
2849 }
2850
2851 impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2852 type Borrowed<'a> = &'a Self;
2853 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2854 value
2855 }
2856 }
2857
2858 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetKeyboardTypeRequest {
2859 type Owned = Self;
2860
2861 #[inline(always)]
2862 fn inline_align(_context: fidl::encoding::Context) -> usize {
2863 4
2864 }
2865
2866 #[inline(always)]
2867 fn inline_size(_context: fidl::encoding::Context) -> usize {
2868 4
2869 }
2870 }
2871
2872 unsafe impl<D: fidl::encoding::ResourceDialect>
2873 fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D>
2874 for &InputMethodEditorSetKeyboardTypeRequest
2875 {
2876 #[inline]
2877 unsafe fn encode(
2878 self,
2879 encoder: &mut fidl::encoding::Encoder<'_, D>,
2880 offset: usize,
2881 _depth: fidl::encoding::Depth,
2882 ) -> fidl::Result<()> {
2883 encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
2884 fidl::encoding::Encode::<InputMethodEditorSetKeyboardTypeRequest, D>::encode(
2886 (<KeyboardType as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard_type),),
2887 encoder,
2888 offset,
2889 _depth,
2890 )
2891 }
2892 }
2893 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<KeyboardType, D>>
2894 fidl::encoding::Encode<InputMethodEditorSetKeyboardTypeRequest, D> for (T0,)
2895 {
2896 #[inline]
2897 unsafe fn encode(
2898 self,
2899 encoder: &mut fidl::encoding::Encoder<'_, D>,
2900 offset: usize,
2901 depth: fidl::encoding::Depth,
2902 ) -> fidl::Result<()> {
2903 encoder.debug_check_bounds::<InputMethodEditorSetKeyboardTypeRequest>(offset);
2904 self.0.encode(encoder, offset + 0, depth)?;
2908 Ok(())
2909 }
2910 }
2911
2912 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2913 for InputMethodEditorSetKeyboardTypeRequest
2914 {
2915 #[inline(always)]
2916 fn new_empty() -> Self {
2917 Self { keyboard_type: fidl::new_empty!(KeyboardType, D) }
2918 }
2919
2920 #[inline]
2921 unsafe fn decode(
2922 &mut self,
2923 decoder: &mut fidl::encoding::Decoder<'_, D>,
2924 offset: usize,
2925 _depth: fidl::encoding::Depth,
2926 ) -> fidl::Result<()> {
2927 decoder.debug_check_bounds::<Self>(offset);
2928 fidl::decode!(KeyboardType, D, &mut self.keyboard_type, decoder, offset + 0, _depth)?;
2930 Ok(())
2931 }
2932 }
2933
2934 impl fidl::encoding::ValueTypeMarker for InputMethodEditorSetStateRequest {
2935 type Borrowed<'a> = &'a Self;
2936 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2937 value
2938 }
2939 }
2940
2941 unsafe impl fidl::encoding::TypeMarker for InputMethodEditorSetStateRequest {
2942 type Owned = Self;
2943
2944 #[inline(always)]
2945 fn inline_align(_context: fidl::encoding::Context) -> usize {
2946 8
2947 }
2948
2949 #[inline(always)]
2950 fn inline_size(_context: fidl::encoding::Context) -> usize {
2951 64
2952 }
2953 }
2954
2955 unsafe impl<D: fidl::encoding::ResourceDialect>
2956 fidl::encoding::Encode<InputMethodEditorSetStateRequest, D>
2957 for &InputMethodEditorSetStateRequest
2958 {
2959 #[inline]
2960 unsafe fn encode(
2961 self,
2962 encoder: &mut fidl::encoding::Encoder<'_, D>,
2963 offset: usize,
2964 _depth: fidl::encoding::Depth,
2965 ) -> fidl::Result<()> {
2966 encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
2967 fidl::encoding::Encode::<InputMethodEditorSetStateRequest, D>::encode(
2969 (<TextInputState as fidl::encoding::ValueTypeMarker>::borrow(&self.state),),
2970 encoder,
2971 offset,
2972 _depth,
2973 )
2974 }
2975 }
2976 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TextInputState, D>>
2977 fidl::encoding::Encode<InputMethodEditorSetStateRequest, D> for (T0,)
2978 {
2979 #[inline]
2980 unsafe fn encode(
2981 self,
2982 encoder: &mut fidl::encoding::Encoder<'_, D>,
2983 offset: usize,
2984 depth: fidl::encoding::Depth,
2985 ) -> fidl::Result<()> {
2986 encoder.debug_check_bounds::<InputMethodEditorSetStateRequest>(offset);
2987 self.0.encode(encoder, offset + 0, depth)?;
2991 Ok(())
2992 }
2993 }
2994
2995 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2996 for InputMethodEditorSetStateRequest
2997 {
2998 #[inline(always)]
2999 fn new_empty() -> Self {
3000 Self { state: fidl::new_empty!(TextInputState, D) }
3001 }
3002
3003 #[inline]
3004 unsafe fn decode(
3005 &mut self,
3006 decoder: &mut fidl::encoding::Decoder<'_, D>,
3007 offset: usize,
3008 _depth: fidl::encoding::Depth,
3009 ) -> fidl::Result<()> {
3010 decoder.debug_check_bounds::<Self>(offset);
3011 fidl::decode!(TextInputState, D, &mut self.state, decoder, offset + 0, _depth)?;
3013 Ok(())
3014 }
3015 }
3016
3017 impl fidl::encoding::ValueTypeMarker for InputReport {
3018 type Borrowed<'a> = &'a Self;
3019 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3020 value
3021 }
3022 }
3023
3024 unsafe impl fidl::encoding::TypeMarker for InputReport {
3025 type Owned = Self;
3026
3027 #[inline(always)]
3028 fn inline_align(_context: fidl::encoding::Context) -> usize {
3029 8
3030 }
3031
3032 #[inline(always)]
3033 fn inline_size(_context: fidl::encoding::Context) -> usize {
3034 72
3035 }
3036 }
3037
3038 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputReport, D>
3039 for &InputReport
3040 {
3041 #[inline]
3042 unsafe fn encode(
3043 self,
3044 encoder: &mut fidl::encoding::Encoder<'_, D>,
3045 offset: usize,
3046 _depth: fidl::encoding::Depth,
3047 ) -> fidl::Result<()> {
3048 encoder.debug_check_bounds::<InputReport>(offset);
3049 fidl::encoding::Encode::<InputReport, D>::encode(
3051 (
3052 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3053 <fidl::encoding::Boxed<KeyboardReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.keyboard),
3054 <fidl::encoding::Boxed<MediaButtonsReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.media_buttons),
3055 <fidl::encoding::Boxed<MouseReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.mouse),
3056 <fidl::encoding::Boxed<StylusReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.stylus),
3057 <fidl::encoding::Boxed<TouchscreenReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.touchscreen),
3058 <fidl::encoding::OptionalUnion<SensorReport> as fidl::encoding::ValueTypeMarker>::borrow(&self.sensor),
3059 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.trace_id),
3060 ),
3061 encoder, offset, _depth
3062 )
3063 }
3064 }
3065 unsafe impl<
3066 D: fidl::encoding::ResourceDialect,
3067 T0: fidl::encoding::Encode<u64, D>,
3068 T1: fidl::encoding::Encode<fidl::encoding::Boxed<KeyboardReport>, D>,
3069 T2: fidl::encoding::Encode<fidl::encoding::Boxed<MediaButtonsReport>, D>,
3070 T3: fidl::encoding::Encode<fidl::encoding::Boxed<MouseReport>, D>,
3071 T4: fidl::encoding::Encode<fidl::encoding::Boxed<StylusReport>, D>,
3072 T5: fidl::encoding::Encode<fidl::encoding::Boxed<TouchscreenReport>, D>,
3073 T6: fidl::encoding::Encode<fidl::encoding::OptionalUnion<SensorReport>, D>,
3074 T7: fidl::encoding::Encode<u64, D>,
3075 > fidl::encoding::Encode<InputReport, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
3076 {
3077 #[inline]
3078 unsafe fn encode(
3079 self,
3080 encoder: &mut fidl::encoding::Encoder<'_, D>,
3081 offset: usize,
3082 depth: fidl::encoding::Depth,
3083 ) -> fidl::Result<()> {
3084 encoder.debug_check_bounds::<InputReport>(offset);
3085 self.0.encode(encoder, offset + 0, depth)?;
3089 self.1.encode(encoder, offset + 8, depth)?;
3090 self.2.encode(encoder, offset + 16, depth)?;
3091 self.3.encode(encoder, offset + 24, depth)?;
3092 self.4.encode(encoder, offset + 32, depth)?;
3093 self.5.encode(encoder, offset + 40, depth)?;
3094 self.6.encode(encoder, offset + 48, depth)?;
3095 self.7.encode(encoder, offset + 64, depth)?;
3096 Ok(())
3097 }
3098 }
3099
3100 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputReport {
3101 #[inline(always)]
3102 fn new_empty() -> Self {
3103 Self {
3104 event_time: fidl::new_empty!(u64, D),
3105 keyboard: fidl::new_empty!(fidl::encoding::Boxed<KeyboardReport>, D),
3106 media_buttons: fidl::new_empty!(fidl::encoding::Boxed<MediaButtonsReport>, D),
3107 mouse: fidl::new_empty!(fidl::encoding::Boxed<MouseReport>, D),
3108 stylus: fidl::new_empty!(fidl::encoding::Boxed<StylusReport>, D),
3109 touchscreen: fidl::new_empty!(fidl::encoding::Boxed<TouchscreenReport>, D),
3110 sensor: fidl::new_empty!(fidl::encoding::OptionalUnion<SensorReport>, D),
3111 trace_id: fidl::new_empty!(u64, D),
3112 }
3113 }
3114
3115 #[inline]
3116 unsafe fn decode(
3117 &mut self,
3118 decoder: &mut fidl::encoding::Decoder<'_, D>,
3119 offset: usize,
3120 _depth: fidl::encoding::Depth,
3121 ) -> fidl::Result<()> {
3122 decoder.debug_check_bounds::<Self>(offset);
3123 fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3125 fidl::decode!(
3126 fidl::encoding::Boxed<KeyboardReport>,
3127 D,
3128 &mut self.keyboard,
3129 decoder,
3130 offset + 8,
3131 _depth
3132 )?;
3133 fidl::decode!(
3134 fidl::encoding::Boxed<MediaButtonsReport>,
3135 D,
3136 &mut self.media_buttons,
3137 decoder,
3138 offset + 16,
3139 _depth
3140 )?;
3141 fidl::decode!(
3142 fidl::encoding::Boxed<MouseReport>,
3143 D,
3144 &mut self.mouse,
3145 decoder,
3146 offset + 24,
3147 _depth
3148 )?;
3149 fidl::decode!(
3150 fidl::encoding::Boxed<StylusReport>,
3151 D,
3152 &mut self.stylus,
3153 decoder,
3154 offset + 32,
3155 _depth
3156 )?;
3157 fidl::decode!(
3158 fidl::encoding::Boxed<TouchscreenReport>,
3159 D,
3160 &mut self.touchscreen,
3161 decoder,
3162 offset + 40,
3163 _depth
3164 )?;
3165 fidl::decode!(
3166 fidl::encoding::OptionalUnion<SensorReport>,
3167 D,
3168 &mut self.sensor,
3169 decoder,
3170 offset + 48,
3171 _depth
3172 )?;
3173 fidl::decode!(u64, D, &mut self.trace_id, decoder, offset + 64, _depth)?;
3174 Ok(())
3175 }
3176 }
3177
3178 impl fidl::encoding::ValueTypeMarker for KeyboardDescriptor {
3179 type Borrowed<'a> = &'a Self;
3180 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3181 value
3182 }
3183 }
3184
3185 unsafe impl fidl::encoding::TypeMarker for KeyboardDescriptor {
3186 type Owned = Self;
3187
3188 #[inline(always)]
3189 fn inline_align(_context: fidl::encoding::Context) -> usize {
3190 8
3191 }
3192
3193 #[inline(always)]
3194 fn inline_size(_context: fidl::encoding::Context) -> usize {
3195 16
3196 }
3197 }
3198
3199 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardDescriptor, D>
3200 for &KeyboardDescriptor
3201 {
3202 #[inline]
3203 unsafe fn encode(
3204 self,
3205 encoder: &mut fidl::encoding::Encoder<'_, D>,
3206 offset: usize,
3207 _depth: fidl::encoding::Depth,
3208 ) -> fidl::Result<()> {
3209 encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3210 fidl::encoding::Encode::<KeyboardDescriptor, D>::encode(
3212 (
3213 <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
3214 ),
3215 encoder, offset, _depth
3216 )
3217 }
3218 }
3219 unsafe impl<
3220 D: fidl::encoding::ResourceDialect,
3221 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3222 > fidl::encoding::Encode<KeyboardDescriptor, D> for (T0,)
3223 {
3224 #[inline]
3225 unsafe fn encode(
3226 self,
3227 encoder: &mut fidl::encoding::Encoder<'_, D>,
3228 offset: usize,
3229 depth: fidl::encoding::Depth,
3230 ) -> fidl::Result<()> {
3231 encoder.debug_check_bounds::<KeyboardDescriptor>(offset);
3232 self.0.encode(encoder, offset + 0, depth)?;
3236 Ok(())
3237 }
3238 }
3239
3240 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardDescriptor {
3241 #[inline(always)]
3242 fn new_empty() -> Self {
3243 Self { keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3244 }
3245
3246 #[inline]
3247 unsafe fn decode(
3248 &mut self,
3249 decoder: &mut fidl::encoding::Decoder<'_, D>,
3250 offset: usize,
3251 _depth: fidl::encoding::Depth,
3252 ) -> fidl::Result<()> {
3253 decoder.debug_check_bounds::<Self>(offset);
3254 fidl::decode!(
3256 fidl::encoding::UnboundedVector<u32>,
3257 D,
3258 &mut self.keys,
3259 decoder,
3260 offset + 0,
3261 _depth
3262 )?;
3263 Ok(())
3264 }
3265 }
3266
3267 impl fidl::encoding::ValueTypeMarker for KeyboardEvent {
3268 type Borrowed<'a> = &'a Self;
3269 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3270 value
3271 }
3272 }
3273
3274 unsafe impl fidl::encoding::TypeMarker for KeyboardEvent {
3275 type Owned = Self;
3276
3277 #[inline(always)]
3278 fn inline_align(_context: fidl::encoding::Context) -> usize {
3279 8
3280 }
3281
3282 #[inline(always)]
3283 fn inline_size(_context: fidl::encoding::Context) -> usize {
3284 32
3285 }
3286 }
3287
3288 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardEvent, D>
3289 for &KeyboardEvent
3290 {
3291 #[inline]
3292 unsafe fn encode(
3293 self,
3294 encoder: &mut fidl::encoding::Encoder<'_, D>,
3295 offset: usize,
3296 _depth: fidl::encoding::Depth,
3297 ) -> fidl::Result<()> {
3298 encoder.debug_check_bounds::<KeyboardEvent>(offset);
3299 fidl::encoding::Encode::<KeyboardEvent, D>::encode(
3301 (
3302 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3303 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
3304 <KeyboardEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
3305 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hid_usage),
3306 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.code_point),
3307 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.modifiers),
3308 ),
3309 encoder,
3310 offset,
3311 _depth,
3312 )
3313 }
3314 }
3315 unsafe impl<
3316 D: fidl::encoding::ResourceDialect,
3317 T0: fidl::encoding::Encode<u64, D>,
3318 T1: fidl::encoding::Encode<u32, D>,
3319 T2: fidl::encoding::Encode<KeyboardEventPhase, D>,
3320 T3: fidl::encoding::Encode<u32, D>,
3321 T4: fidl::encoding::Encode<u32, D>,
3322 T5: fidl::encoding::Encode<u32, D>,
3323 > fidl::encoding::Encode<KeyboardEvent, D> for (T0, T1, T2, T3, T4, T5)
3324 {
3325 #[inline]
3326 unsafe fn encode(
3327 self,
3328 encoder: &mut fidl::encoding::Encoder<'_, D>,
3329 offset: usize,
3330 depth: fidl::encoding::Depth,
3331 ) -> fidl::Result<()> {
3332 encoder.debug_check_bounds::<KeyboardEvent>(offset);
3333 unsafe {
3336 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3337 (ptr as *mut u64).write_unaligned(0);
3338 }
3339 self.0.encode(encoder, offset + 0, depth)?;
3341 self.1.encode(encoder, offset + 8, depth)?;
3342 self.2.encode(encoder, offset + 12, depth)?;
3343 self.3.encode(encoder, offset + 16, depth)?;
3344 self.4.encode(encoder, offset + 20, depth)?;
3345 self.5.encode(encoder, offset + 24, depth)?;
3346 Ok(())
3347 }
3348 }
3349
3350 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardEvent {
3351 #[inline(always)]
3352 fn new_empty() -> Self {
3353 Self {
3354 event_time: fidl::new_empty!(u64, D),
3355 device_id: fidl::new_empty!(u32, D),
3356 phase: fidl::new_empty!(KeyboardEventPhase, D),
3357 hid_usage: fidl::new_empty!(u32, D),
3358 code_point: fidl::new_empty!(u32, D),
3359 modifiers: fidl::new_empty!(u32, D),
3360 }
3361 }
3362
3363 #[inline]
3364 unsafe fn decode(
3365 &mut self,
3366 decoder: &mut fidl::encoding::Decoder<'_, D>,
3367 offset: usize,
3368 _depth: fidl::encoding::Depth,
3369 ) -> fidl::Result<()> {
3370 decoder.debug_check_bounds::<Self>(offset);
3371 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3373 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3374 let mask = 0xffffffff00000000u64;
3375 let maskedval = padval & mask;
3376 if maskedval != 0 {
3377 return Err(fidl::Error::NonZeroPadding {
3378 padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3379 });
3380 }
3381 fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
3382 fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
3383 fidl::decode!(KeyboardEventPhase, D, &mut self.phase, decoder, offset + 12, _depth)?;
3384 fidl::decode!(u32, D, &mut self.hid_usage, decoder, offset + 16, _depth)?;
3385 fidl::decode!(u32, D, &mut self.code_point, decoder, offset + 20, _depth)?;
3386 fidl::decode!(u32, D, &mut self.modifiers, decoder, offset + 24, _depth)?;
3387 Ok(())
3388 }
3389 }
3390
3391 impl fidl::encoding::ValueTypeMarker for KeyboardReport {
3392 type Borrowed<'a> = &'a Self;
3393 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3394 value
3395 }
3396 }
3397
3398 unsafe impl fidl::encoding::TypeMarker for KeyboardReport {
3399 type Owned = Self;
3400
3401 #[inline(always)]
3402 fn inline_align(_context: fidl::encoding::Context) -> usize {
3403 8
3404 }
3405
3406 #[inline(always)]
3407 fn inline_size(_context: fidl::encoding::Context) -> usize {
3408 16
3409 }
3410 }
3411
3412 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<KeyboardReport, D>
3413 for &KeyboardReport
3414 {
3415 #[inline]
3416 unsafe fn encode(
3417 self,
3418 encoder: &mut fidl::encoding::Encoder<'_, D>,
3419 offset: usize,
3420 _depth: fidl::encoding::Depth,
3421 ) -> fidl::Result<()> {
3422 encoder.debug_check_bounds::<KeyboardReport>(offset);
3423 fidl::encoding::Encode::<KeyboardReport, D>::encode(
3425 (
3426 <fidl::encoding::UnboundedVector<u32> as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_keys),
3427 ),
3428 encoder, offset, _depth
3429 )
3430 }
3431 }
3432 unsafe impl<
3433 D: fidl::encoding::ResourceDialect,
3434 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u32>, D>,
3435 > fidl::encoding::Encode<KeyboardReport, D> for (T0,)
3436 {
3437 #[inline]
3438 unsafe fn encode(
3439 self,
3440 encoder: &mut fidl::encoding::Encoder<'_, D>,
3441 offset: usize,
3442 depth: fidl::encoding::Depth,
3443 ) -> fidl::Result<()> {
3444 encoder.debug_check_bounds::<KeyboardReport>(offset);
3445 self.0.encode(encoder, offset + 0, depth)?;
3449 Ok(())
3450 }
3451 }
3452
3453 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyboardReport {
3454 #[inline(always)]
3455 fn new_empty() -> Self {
3456 Self { pressed_keys: fidl::new_empty!(fidl::encoding::UnboundedVector<u32>, D) }
3457 }
3458
3459 #[inline]
3460 unsafe fn decode(
3461 &mut self,
3462 decoder: &mut fidl::encoding::Decoder<'_, D>,
3463 offset: usize,
3464 _depth: fidl::encoding::Depth,
3465 ) -> fidl::Result<()> {
3466 decoder.debug_check_bounds::<Self>(offset);
3467 fidl::decode!(
3469 fidl::encoding::UnboundedVector<u32>,
3470 D,
3471 &mut self.pressed_keys,
3472 decoder,
3473 offset + 0,
3474 _depth
3475 )?;
3476 Ok(())
3477 }
3478 }
3479
3480 impl fidl::encoding::ValueTypeMarker for MediaButtonsDescriptor {
3481 type Borrowed<'a> = &'a Self;
3482 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3483 value
3484 }
3485 }
3486
3487 unsafe impl fidl::encoding::TypeMarker for MediaButtonsDescriptor {
3488 type Owned = Self;
3489
3490 #[inline(always)]
3491 fn inline_align(_context: fidl::encoding::Context) -> usize {
3492 4
3493 }
3494
3495 #[inline(always)]
3496 fn inline_size(_context: fidl::encoding::Context) -> usize {
3497 4
3498 }
3499 #[inline(always)]
3500 fn encode_is_copy() -> bool {
3501 true
3502 }
3503
3504 #[inline(always)]
3505 fn decode_is_copy() -> bool {
3506 true
3507 }
3508 }
3509
3510 unsafe impl<D: fidl::encoding::ResourceDialect>
3511 fidl::encoding::Encode<MediaButtonsDescriptor, D> for &MediaButtonsDescriptor
3512 {
3513 #[inline]
3514 unsafe fn encode(
3515 self,
3516 encoder: &mut fidl::encoding::Encoder<'_, D>,
3517 offset: usize,
3518 _depth: fidl::encoding::Depth,
3519 ) -> fidl::Result<()> {
3520 encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3521 unsafe {
3522 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3524 (buf_ptr as *mut MediaButtonsDescriptor)
3525 .write_unaligned((self as *const MediaButtonsDescriptor).read());
3526 }
3529 Ok(())
3530 }
3531 }
3532 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3533 fidl::encoding::Encode<MediaButtonsDescriptor, D> for (T0,)
3534 {
3535 #[inline]
3536 unsafe fn encode(
3537 self,
3538 encoder: &mut fidl::encoding::Encoder<'_, D>,
3539 offset: usize,
3540 depth: fidl::encoding::Depth,
3541 ) -> fidl::Result<()> {
3542 encoder.debug_check_bounds::<MediaButtonsDescriptor>(offset);
3543 self.0.encode(encoder, offset + 0, depth)?;
3547 Ok(())
3548 }
3549 }
3550
3551 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3552 for MediaButtonsDescriptor
3553 {
3554 #[inline(always)]
3555 fn new_empty() -> Self {
3556 Self { buttons: fidl::new_empty!(u32, D) }
3557 }
3558
3559 #[inline]
3560 unsafe fn decode(
3561 &mut self,
3562 decoder: &mut fidl::encoding::Decoder<'_, D>,
3563 offset: usize,
3564 _depth: fidl::encoding::Depth,
3565 ) -> fidl::Result<()> {
3566 decoder.debug_check_bounds::<Self>(offset);
3567 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3568 unsafe {
3571 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3572 }
3573 Ok(())
3574 }
3575 }
3576
3577 impl fidl::encoding::ValueTypeMarker for MediaButtonsReport {
3578 type Borrowed<'a> = &'a Self;
3579 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3580 value
3581 }
3582 }
3583
3584 unsafe impl fidl::encoding::TypeMarker for MediaButtonsReport {
3585 type Owned = Self;
3586
3587 #[inline(always)]
3588 fn inline_align(_context: fidl::encoding::Context) -> usize {
3589 1
3590 }
3591
3592 #[inline(always)]
3593 fn inline_size(_context: fidl::encoding::Context) -> usize {
3594 6
3595 }
3596 }
3597
3598 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsReport, D>
3599 for &MediaButtonsReport
3600 {
3601 #[inline]
3602 unsafe fn encode(
3603 self,
3604 encoder: &mut fidl::encoding::Encoder<'_, D>,
3605 offset: usize,
3606 _depth: fidl::encoding::Depth,
3607 ) -> fidl::Result<()> {
3608 encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3609 fidl::encoding::Encode::<MediaButtonsReport, D>::encode(
3611 (
3612 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_up),
3613 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.volume_down),
3614 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.mic_mute),
3615 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.reset),
3616 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.pause),
3617 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.camera_disable),
3618 ),
3619 encoder,
3620 offset,
3621 _depth,
3622 )
3623 }
3624 }
3625 unsafe impl<
3626 D: fidl::encoding::ResourceDialect,
3627 T0: fidl::encoding::Encode<bool, D>,
3628 T1: fidl::encoding::Encode<bool, D>,
3629 T2: fidl::encoding::Encode<bool, D>,
3630 T3: fidl::encoding::Encode<bool, D>,
3631 T4: fidl::encoding::Encode<bool, D>,
3632 T5: fidl::encoding::Encode<bool, D>,
3633 > fidl::encoding::Encode<MediaButtonsReport, D> for (T0, T1, T2, T3, T4, T5)
3634 {
3635 #[inline]
3636 unsafe fn encode(
3637 self,
3638 encoder: &mut fidl::encoding::Encoder<'_, D>,
3639 offset: usize,
3640 depth: fidl::encoding::Depth,
3641 ) -> fidl::Result<()> {
3642 encoder.debug_check_bounds::<MediaButtonsReport>(offset);
3643 self.0.encode(encoder, offset + 0, depth)?;
3647 self.1.encode(encoder, offset + 1, depth)?;
3648 self.2.encode(encoder, offset + 2, depth)?;
3649 self.3.encode(encoder, offset + 3, depth)?;
3650 self.4.encode(encoder, offset + 4, depth)?;
3651 self.5.encode(encoder, offset + 5, depth)?;
3652 Ok(())
3653 }
3654 }
3655
3656 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsReport {
3657 #[inline(always)]
3658 fn new_empty() -> Self {
3659 Self {
3660 volume_up: fidl::new_empty!(bool, D),
3661 volume_down: fidl::new_empty!(bool, D),
3662 mic_mute: fidl::new_empty!(bool, D),
3663 reset: fidl::new_empty!(bool, D),
3664 pause: fidl::new_empty!(bool, D),
3665 camera_disable: fidl::new_empty!(bool, D),
3666 }
3667 }
3668
3669 #[inline]
3670 unsafe fn decode(
3671 &mut self,
3672 decoder: &mut fidl::encoding::Decoder<'_, D>,
3673 offset: usize,
3674 _depth: fidl::encoding::Depth,
3675 ) -> fidl::Result<()> {
3676 decoder.debug_check_bounds::<Self>(offset);
3677 fidl::decode!(bool, D, &mut self.volume_up, decoder, offset + 0, _depth)?;
3679 fidl::decode!(bool, D, &mut self.volume_down, decoder, offset + 1, _depth)?;
3680 fidl::decode!(bool, D, &mut self.mic_mute, decoder, offset + 2, _depth)?;
3681 fidl::decode!(bool, D, &mut self.reset, decoder, offset + 3, _depth)?;
3682 fidl::decode!(bool, D, &mut self.pause, decoder, offset + 4, _depth)?;
3683 fidl::decode!(bool, D, &mut self.camera_disable, decoder, offset + 5, _depth)?;
3684 Ok(())
3685 }
3686 }
3687
3688 impl fidl::encoding::ValueTypeMarker for MouseDescriptor {
3689 type Borrowed<'a> = &'a Self;
3690 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3691 value
3692 }
3693 }
3694
3695 unsafe impl fidl::encoding::TypeMarker for MouseDescriptor {
3696 type Owned = Self;
3697
3698 #[inline(always)]
3699 fn inline_align(_context: fidl::encoding::Context) -> usize {
3700 8
3701 }
3702
3703 #[inline(always)]
3704 fn inline_size(_context: fidl::encoding::Context) -> usize {
3705 56
3706 }
3707 }
3708
3709 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseDescriptor, D>
3710 for &MouseDescriptor
3711 {
3712 #[inline]
3713 unsafe fn encode(
3714 self,
3715 encoder: &mut fidl::encoding::Encoder<'_, D>,
3716 offset: usize,
3717 _depth: fidl::encoding::Depth,
3718 ) -> fidl::Result<()> {
3719 encoder.debug_check_bounds::<MouseDescriptor>(offset);
3720 fidl::encoding::Encode::<MouseDescriptor, D>::encode(
3722 (
3723 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_x),
3724 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.rel_y),
3725 <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3726 &self.vscroll,
3727 ),
3728 <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
3729 &self.hscroll,
3730 ),
3731 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
3732 ),
3733 encoder,
3734 offset,
3735 _depth,
3736 )
3737 }
3738 }
3739 unsafe impl<
3740 D: fidl::encoding::ResourceDialect,
3741 T0: fidl::encoding::Encode<Axis, D>,
3742 T1: fidl::encoding::Encode<Axis, D>,
3743 T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3744 T3: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
3745 T4: fidl::encoding::Encode<u32, D>,
3746 > fidl::encoding::Encode<MouseDescriptor, D> for (T0, T1, T2, T3, T4)
3747 {
3748 #[inline]
3749 unsafe fn encode(
3750 self,
3751 encoder: &mut fidl::encoding::Encoder<'_, D>,
3752 offset: usize,
3753 depth: fidl::encoding::Depth,
3754 ) -> fidl::Result<()> {
3755 encoder.debug_check_bounds::<MouseDescriptor>(offset);
3756 unsafe {
3759 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
3760 (ptr as *mut u64).write_unaligned(0);
3761 }
3762 self.0.encode(encoder, offset + 0, depth)?;
3764 self.1.encode(encoder, offset + 16, depth)?;
3765 self.2.encode(encoder, offset + 32, depth)?;
3766 self.3.encode(encoder, offset + 40, depth)?;
3767 self.4.encode(encoder, offset + 48, depth)?;
3768 Ok(())
3769 }
3770 }
3771
3772 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseDescriptor {
3773 #[inline(always)]
3774 fn new_empty() -> Self {
3775 Self {
3776 rel_x: fidl::new_empty!(Axis, D),
3777 rel_y: fidl::new_empty!(Axis, D),
3778 vscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3779 hscroll: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
3780 buttons: fidl::new_empty!(u32, D),
3781 }
3782 }
3783
3784 #[inline]
3785 unsafe fn decode(
3786 &mut self,
3787 decoder: &mut fidl::encoding::Decoder<'_, D>,
3788 offset: usize,
3789 _depth: fidl::encoding::Depth,
3790 ) -> fidl::Result<()> {
3791 decoder.debug_check_bounds::<Self>(offset);
3792 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
3794 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3795 let mask = 0xffffffff00000000u64;
3796 let maskedval = padval & mask;
3797 if maskedval != 0 {
3798 return Err(fidl::Error::NonZeroPadding {
3799 padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
3800 });
3801 }
3802 fidl::decode!(Axis, D, &mut self.rel_x, decoder, offset + 0, _depth)?;
3803 fidl::decode!(Axis, D, &mut self.rel_y, decoder, offset + 16, _depth)?;
3804 fidl::decode!(
3805 fidl::encoding::Boxed<Axis>,
3806 D,
3807 &mut self.vscroll,
3808 decoder,
3809 offset + 32,
3810 _depth
3811 )?;
3812 fidl::decode!(
3813 fidl::encoding::Boxed<Axis>,
3814 D,
3815 &mut self.hscroll,
3816 decoder,
3817 offset + 40,
3818 _depth
3819 )?;
3820 fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 48, _depth)?;
3821 Ok(())
3822 }
3823 }
3824
3825 impl fidl::encoding::ValueTypeMarker for MouseReport {
3826 type Borrowed<'a> = &'a Self;
3827 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3828 value
3829 }
3830 }
3831
3832 unsafe impl fidl::encoding::TypeMarker for MouseReport {
3833 type Owned = Self;
3834
3835 #[inline(always)]
3836 fn inline_align(_context: fidl::encoding::Context) -> usize {
3837 4
3838 }
3839
3840 #[inline(always)]
3841 fn inline_size(_context: fidl::encoding::Context) -> usize {
3842 20
3843 }
3844 #[inline(always)]
3845 fn encode_is_copy() -> bool {
3846 true
3847 }
3848
3849 #[inline(always)]
3850 fn decode_is_copy() -> bool {
3851 true
3852 }
3853 }
3854
3855 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MouseReport, D>
3856 for &MouseReport
3857 {
3858 #[inline]
3859 unsafe fn encode(
3860 self,
3861 encoder: &mut fidl::encoding::Encoder<'_, D>,
3862 offset: usize,
3863 _depth: fidl::encoding::Depth,
3864 ) -> fidl::Result<()> {
3865 encoder.debug_check_bounds::<MouseReport>(offset);
3866 unsafe {
3867 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3869 (buf_ptr as *mut MouseReport).write_unaligned((self as *const MouseReport).read());
3870 }
3873 Ok(())
3874 }
3875 }
3876 unsafe impl<
3877 D: fidl::encoding::ResourceDialect,
3878 T0: fidl::encoding::Encode<i32, D>,
3879 T1: fidl::encoding::Encode<i32, D>,
3880 T2: fidl::encoding::Encode<i32, D>,
3881 T3: fidl::encoding::Encode<i32, D>,
3882 T4: fidl::encoding::Encode<u32, D>,
3883 > fidl::encoding::Encode<MouseReport, D> for (T0, T1, T2, T3, T4)
3884 {
3885 #[inline]
3886 unsafe fn encode(
3887 self,
3888 encoder: &mut fidl::encoding::Encoder<'_, D>,
3889 offset: usize,
3890 depth: fidl::encoding::Depth,
3891 ) -> fidl::Result<()> {
3892 encoder.debug_check_bounds::<MouseReport>(offset);
3893 self.0.encode(encoder, offset + 0, depth)?;
3897 self.1.encode(encoder, offset + 4, depth)?;
3898 self.2.encode(encoder, offset + 8, depth)?;
3899 self.3.encode(encoder, offset + 12, depth)?;
3900 self.4.encode(encoder, offset + 16, depth)?;
3901 Ok(())
3902 }
3903 }
3904
3905 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MouseReport {
3906 #[inline(always)]
3907 fn new_empty() -> Self {
3908 Self {
3909 rel_x: fidl::new_empty!(i32, D),
3910 rel_y: fidl::new_empty!(i32, D),
3911 rel_hscroll: fidl::new_empty!(i32, D),
3912 rel_vscroll: fidl::new_empty!(i32, D),
3913 pressed_buttons: fidl::new_empty!(u32, D),
3914 }
3915 }
3916
3917 #[inline]
3918 unsafe fn decode(
3919 &mut self,
3920 decoder: &mut fidl::encoding::Decoder<'_, D>,
3921 offset: usize,
3922 _depth: fidl::encoding::Depth,
3923 ) -> fidl::Result<()> {
3924 decoder.debug_check_bounds::<Self>(offset);
3925 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3926 unsafe {
3929 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
3930 }
3931 Ok(())
3932 }
3933 }
3934
3935 impl fidl::encoding::ValueTypeMarker for PointerEvent {
3936 type Borrowed<'a> = &'a Self;
3937 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3938 value
3939 }
3940 }
3941
3942 unsafe impl fidl::encoding::TypeMarker for PointerEvent {
3943 type Owned = Self;
3944
3945 #[inline(always)]
3946 fn inline_align(_context: fidl::encoding::Context) -> usize {
3947 8
3948 }
3949
3950 #[inline(always)]
3951 fn inline_size(_context: fidl::encoding::Context) -> usize {
3952 48
3953 }
3954 }
3955
3956 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PointerEvent, D>
3957 for &PointerEvent
3958 {
3959 #[inline]
3960 unsafe fn encode(
3961 self,
3962 encoder: &mut fidl::encoding::Encoder<'_, D>,
3963 offset: usize,
3964 _depth: fidl::encoding::Depth,
3965 ) -> fidl::Result<()> {
3966 encoder.debug_check_bounds::<PointerEvent>(offset);
3967 fidl::encoding::Encode::<PointerEvent, D>::encode(
3969 (
3970 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.event_time),
3971 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
3972 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_id),
3973 <PointerEventType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3974 <PointerEventPhase as fidl::encoding::ValueTypeMarker>::borrow(&self.phase),
3975 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
3976 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
3977 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_major),
3978 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.radius_minor),
3979 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
3980 ),
3981 encoder,
3982 offset,
3983 _depth,
3984 )
3985 }
3986 }
3987 unsafe impl<
3988 D: fidl::encoding::ResourceDialect,
3989 T0: fidl::encoding::Encode<u64, D>,
3990 T1: fidl::encoding::Encode<u32, D>,
3991 T2: fidl::encoding::Encode<u32, D>,
3992 T3: fidl::encoding::Encode<PointerEventType, D>,
3993 T4: fidl::encoding::Encode<PointerEventPhase, D>,
3994 T5: fidl::encoding::Encode<f32, D>,
3995 T6: fidl::encoding::Encode<f32, D>,
3996 T7: fidl::encoding::Encode<f32, D>,
3997 T8: fidl::encoding::Encode<f32, D>,
3998 T9: fidl::encoding::Encode<u32, D>,
3999 > fidl::encoding::Encode<PointerEvent, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
4000 {
4001 #[inline]
4002 unsafe fn encode(
4003 self,
4004 encoder: &mut fidl::encoding::Encoder<'_, D>,
4005 offset: usize,
4006 depth: fidl::encoding::Depth,
4007 ) -> fidl::Result<()> {
4008 encoder.debug_check_bounds::<PointerEvent>(offset);
4009 unsafe {
4012 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4013 (ptr as *mut u64).write_unaligned(0);
4014 }
4015 self.0.encode(encoder, offset + 0, depth)?;
4017 self.1.encode(encoder, offset + 8, depth)?;
4018 self.2.encode(encoder, offset + 12, depth)?;
4019 self.3.encode(encoder, offset + 16, depth)?;
4020 self.4.encode(encoder, offset + 20, depth)?;
4021 self.5.encode(encoder, offset + 24, depth)?;
4022 self.6.encode(encoder, offset + 28, depth)?;
4023 self.7.encode(encoder, offset + 32, depth)?;
4024 self.8.encode(encoder, offset + 36, depth)?;
4025 self.9.encode(encoder, offset + 40, depth)?;
4026 Ok(())
4027 }
4028 }
4029
4030 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PointerEvent {
4031 #[inline(always)]
4032 fn new_empty() -> Self {
4033 Self {
4034 event_time: fidl::new_empty!(u64, D),
4035 device_id: fidl::new_empty!(u32, D),
4036 pointer_id: fidl::new_empty!(u32, D),
4037 type_: fidl::new_empty!(PointerEventType, D),
4038 phase: fidl::new_empty!(PointerEventPhase, D),
4039 x: fidl::new_empty!(f32, D),
4040 y: fidl::new_empty!(f32, D),
4041 radius_major: fidl::new_empty!(f32, D),
4042 radius_minor: fidl::new_empty!(f32, D),
4043 buttons: fidl::new_empty!(u32, D),
4044 }
4045 }
4046
4047 #[inline]
4048 unsafe fn decode(
4049 &mut self,
4050 decoder: &mut fidl::encoding::Decoder<'_, D>,
4051 offset: usize,
4052 _depth: fidl::encoding::Depth,
4053 ) -> fidl::Result<()> {
4054 decoder.debug_check_bounds::<Self>(offset);
4055 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4057 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4058 let mask = 0xffffffff00000000u64;
4059 let maskedval = padval & mask;
4060 if maskedval != 0 {
4061 return Err(fidl::Error::NonZeroPadding {
4062 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4063 });
4064 }
4065 fidl::decode!(u64, D, &mut self.event_time, decoder, offset + 0, _depth)?;
4066 fidl::decode!(u32, D, &mut self.device_id, decoder, offset + 8, _depth)?;
4067 fidl::decode!(u32, D, &mut self.pointer_id, decoder, offset + 12, _depth)?;
4068 fidl::decode!(PointerEventType, D, &mut self.type_, decoder, offset + 16, _depth)?;
4069 fidl::decode!(PointerEventPhase, D, &mut self.phase, decoder, offset + 20, _depth)?;
4070 fidl::decode!(f32, D, &mut self.x, decoder, offset + 24, _depth)?;
4071 fidl::decode!(f32, D, &mut self.y, decoder, offset + 28, _depth)?;
4072 fidl::decode!(f32, D, &mut self.radius_major, decoder, offset + 32, _depth)?;
4073 fidl::decode!(f32, D, &mut self.radius_minor, decoder, offset + 36, _depth)?;
4074 fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 40, _depth)?;
4075 Ok(())
4076 }
4077 }
4078
4079 impl fidl::encoding::ValueTypeMarker for Range {
4080 type Borrowed<'a> = &'a Self;
4081 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4082 value
4083 }
4084 }
4085
4086 unsafe impl fidl::encoding::TypeMarker for Range {
4087 type Owned = Self;
4088
4089 #[inline(always)]
4090 fn inline_align(_context: fidl::encoding::Context) -> usize {
4091 4
4092 }
4093
4094 #[inline(always)]
4095 fn inline_size(_context: fidl::encoding::Context) -> usize {
4096 8
4097 }
4098 #[inline(always)]
4099 fn encode_is_copy() -> bool {
4100 true
4101 }
4102
4103 #[inline(always)]
4104 fn decode_is_copy() -> bool {
4105 true
4106 }
4107 }
4108
4109 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Range, D> for &Range {
4110 #[inline]
4111 unsafe fn encode(
4112 self,
4113 encoder: &mut fidl::encoding::Encoder<'_, D>,
4114 offset: usize,
4115 _depth: fidl::encoding::Depth,
4116 ) -> fidl::Result<()> {
4117 encoder.debug_check_bounds::<Range>(offset);
4118 unsafe {
4119 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4121 (buf_ptr as *mut Range).write_unaligned((self as *const Range).read());
4122 }
4125 Ok(())
4126 }
4127 }
4128 unsafe impl<
4129 D: fidl::encoding::ResourceDialect,
4130 T0: fidl::encoding::Encode<i32, D>,
4131 T1: fidl::encoding::Encode<i32, D>,
4132 > fidl::encoding::Encode<Range, D> for (T0, T1)
4133 {
4134 #[inline]
4135 unsafe fn encode(
4136 self,
4137 encoder: &mut fidl::encoding::Encoder<'_, D>,
4138 offset: usize,
4139 depth: fidl::encoding::Depth,
4140 ) -> fidl::Result<()> {
4141 encoder.debug_check_bounds::<Range>(offset);
4142 self.0.encode(encoder, offset + 0, depth)?;
4146 self.1.encode(encoder, offset + 4, depth)?;
4147 Ok(())
4148 }
4149 }
4150
4151 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Range {
4152 #[inline(always)]
4153 fn new_empty() -> Self {
4154 Self { min: fidl::new_empty!(i32, D), max: fidl::new_empty!(i32, D) }
4155 }
4156
4157 #[inline]
4158 unsafe fn decode(
4159 &mut self,
4160 decoder: &mut fidl::encoding::Decoder<'_, D>,
4161 offset: usize,
4162 _depth: fidl::encoding::Depth,
4163 ) -> fidl::Result<()> {
4164 decoder.debug_check_bounds::<Self>(offset);
4165 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4166 unsafe {
4169 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
4170 }
4171 Ok(())
4172 }
4173 }
4174
4175 impl fidl::encoding::ValueTypeMarker for RangeF {
4176 type Borrowed<'a> = &'a Self;
4177 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4178 value
4179 }
4180 }
4181
4182 unsafe impl fidl::encoding::TypeMarker for RangeF {
4183 type Owned = Self;
4184
4185 #[inline(always)]
4186 fn inline_align(_context: fidl::encoding::Context) -> usize {
4187 4
4188 }
4189
4190 #[inline(always)]
4191 fn inline_size(_context: fidl::encoding::Context) -> usize {
4192 8
4193 }
4194 }
4195
4196 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RangeF, D> for &RangeF {
4197 #[inline]
4198 unsafe fn encode(
4199 self,
4200 encoder: &mut fidl::encoding::Encoder<'_, D>,
4201 offset: usize,
4202 _depth: fidl::encoding::Depth,
4203 ) -> fidl::Result<()> {
4204 encoder.debug_check_bounds::<RangeF>(offset);
4205 fidl::encoding::Encode::<RangeF, D>::encode(
4207 (
4208 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min),
4209 <f32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max),
4210 ),
4211 encoder,
4212 offset,
4213 _depth,
4214 )
4215 }
4216 }
4217 unsafe impl<
4218 D: fidl::encoding::ResourceDialect,
4219 T0: fidl::encoding::Encode<f32, D>,
4220 T1: fidl::encoding::Encode<f32, D>,
4221 > fidl::encoding::Encode<RangeF, D> for (T0, T1)
4222 {
4223 #[inline]
4224 unsafe fn encode(
4225 self,
4226 encoder: &mut fidl::encoding::Encoder<'_, D>,
4227 offset: usize,
4228 depth: fidl::encoding::Depth,
4229 ) -> fidl::Result<()> {
4230 encoder.debug_check_bounds::<RangeF>(offset);
4231 self.0.encode(encoder, offset + 0, depth)?;
4235 self.1.encode(encoder, offset + 4, depth)?;
4236 Ok(())
4237 }
4238 }
4239
4240 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RangeF {
4241 #[inline(always)]
4242 fn new_empty() -> Self {
4243 Self { min: fidl::new_empty!(f32, D), max: fidl::new_empty!(f32, D) }
4244 }
4245
4246 #[inline]
4247 unsafe fn decode(
4248 &mut self,
4249 decoder: &mut fidl::encoding::Decoder<'_, D>,
4250 offset: usize,
4251 _depth: fidl::encoding::Depth,
4252 ) -> fidl::Result<()> {
4253 decoder.debug_check_bounds::<Self>(offset);
4254 fidl::decode!(f32, D, &mut self.min, decoder, offset + 0, _depth)?;
4256 fidl::decode!(f32, D, &mut self.max, decoder, offset + 4, _depth)?;
4257 Ok(())
4258 }
4259 }
4260
4261 impl fidl::encoding::ValueTypeMarker for SendKeyboardInputCmd {
4262 type Borrowed<'a> = &'a Self;
4263 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4264 value
4265 }
4266 }
4267
4268 unsafe impl fidl::encoding::TypeMarker for SendKeyboardInputCmd {
4269 type Owned = Self;
4270
4271 #[inline(always)]
4272 fn inline_align(_context: fidl::encoding::Context) -> usize {
4273 8
4274 }
4275
4276 #[inline(always)]
4277 fn inline_size(_context: fidl::encoding::Context) -> usize {
4278 40
4279 }
4280 }
4281
4282 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendKeyboardInputCmd, D>
4283 for &SendKeyboardInputCmd
4284 {
4285 #[inline]
4286 unsafe fn encode(
4287 self,
4288 encoder: &mut fidl::encoding::Encoder<'_, D>,
4289 offset: usize,
4290 _depth: fidl::encoding::Depth,
4291 ) -> fidl::Result<()> {
4292 encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4293 fidl::encoding::Encode::<SendKeyboardInputCmd, D>::encode(
4295 (
4296 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4297 <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(
4298 &self.keyboard_event,
4299 ),
4300 ),
4301 encoder,
4302 offset,
4303 _depth,
4304 )
4305 }
4306 }
4307 unsafe impl<
4308 D: fidl::encoding::ResourceDialect,
4309 T0: fidl::encoding::Encode<u32, D>,
4310 T1: fidl::encoding::Encode<KeyboardEvent, D>,
4311 > fidl::encoding::Encode<SendKeyboardInputCmd, D> for (T0, T1)
4312 {
4313 #[inline]
4314 unsafe fn encode(
4315 self,
4316 encoder: &mut fidl::encoding::Encoder<'_, D>,
4317 offset: usize,
4318 depth: fidl::encoding::Depth,
4319 ) -> fidl::Result<()> {
4320 encoder.debug_check_bounds::<SendKeyboardInputCmd>(offset);
4321 unsafe {
4324 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4325 (ptr as *mut u64).write_unaligned(0);
4326 }
4327 self.0.encode(encoder, offset + 0, depth)?;
4329 self.1.encode(encoder, offset + 8, depth)?;
4330 Ok(())
4331 }
4332 }
4333
4334 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendKeyboardInputCmd {
4335 #[inline(always)]
4336 fn new_empty() -> Self {
4337 Self {
4338 compositor_id: fidl::new_empty!(u32, D),
4339 keyboard_event: fidl::new_empty!(KeyboardEvent, D),
4340 }
4341 }
4342
4343 #[inline]
4344 unsafe fn decode(
4345 &mut self,
4346 decoder: &mut fidl::encoding::Decoder<'_, D>,
4347 offset: usize,
4348 _depth: fidl::encoding::Depth,
4349 ) -> fidl::Result<()> {
4350 decoder.debug_check_bounds::<Self>(offset);
4351 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4353 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4354 let mask = 0xffffffff00000000u64;
4355 let maskedval = padval & mask;
4356 if maskedval != 0 {
4357 return Err(fidl::Error::NonZeroPadding {
4358 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4359 });
4360 }
4361 fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4362 fidl::decode!(KeyboardEvent, D, &mut self.keyboard_event, decoder, offset + 8, _depth)?;
4363 Ok(())
4364 }
4365 }
4366
4367 impl fidl::encoding::ValueTypeMarker for SendPointerInputCmd {
4368 type Borrowed<'a> = &'a Self;
4369 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4370 value
4371 }
4372 }
4373
4374 unsafe impl fidl::encoding::TypeMarker for SendPointerInputCmd {
4375 type Owned = Self;
4376
4377 #[inline(always)]
4378 fn inline_align(_context: fidl::encoding::Context) -> usize {
4379 8
4380 }
4381
4382 #[inline(always)]
4383 fn inline_size(_context: fidl::encoding::Context) -> usize {
4384 56
4385 }
4386 }
4387
4388 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SendPointerInputCmd, D>
4389 for &SendPointerInputCmd
4390 {
4391 #[inline]
4392 unsafe fn encode(
4393 self,
4394 encoder: &mut fidl::encoding::Encoder<'_, D>,
4395 offset: usize,
4396 _depth: fidl::encoding::Depth,
4397 ) -> fidl::Result<()> {
4398 encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4399 fidl::encoding::Encode::<SendPointerInputCmd, D>::encode(
4401 (
4402 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.compositor_id),
4403 <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.pointer_event),
4404 ),
4405 encoder,
4406 offset,
4407 _depth,
4408 )
4409 }
4410 }
4411 unsafe impl<
4412 D: fidl::encoding::ResourceDialect,
4413 T0: fidl::encoding::Encode<u32, D>,
4414 T1: fidl::encoding::Encode<PointerEvent, D>,
4415 > fidl::encoding::Encode<SendPointerInputCmd, D> for (T0, T1)
4416 {
4417 #[inline]
4418 unsafe fn encode(
4419 self,
4420 encoder: &mut fidl::encoding::Encoder<'_, D>,
4421 offset: usize,
4422 depth: fidl::encoding::Depth,
4423 ) -> fidl::Result<()> {
4424 encoder.debug_check_bounds::<SendPointerInputCmd>(offset);
4425 unsafe {
4428 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4429 (ptr as *mut u64).write_unaligned(0);
4430 }
4431 self.0.encode(encoder, offset + 0, depth)?;
4433 self.1.encode(encoder, offset + 8, depth)?;
4434 Ok(())
4435 }
4436 }
4437
4438 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SendPointerInputCmd {
4439 #[inline(always)]
4440 fn new_empty() -> Self {
4441 Self {
4442 compositor_id: fidl::new_empty!(u32, D),
4443 pointer_event: fidl::new_empty!(PointerEvent, D),
4444 }
4445 }
4446
4447 #[inline]
4448 unsafe fn decode(
4449 &mut self,
4450 decoder: &mut fidl::encoding::Decoder<'_, D>,
4451 offset: usize,
4452 _depth: fidl::encoding::Depth,
4453 ) -> fidl::Result<()> {
4454 decoder.debug_check_bounds::<Self>(offset);
4455 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4457 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4458 let mask = 0xffffffff00000000u64;
4459 let maskedval = padval & mask;
4460 if maskedval != 0 {
4461 return Err(fidl::Error::NonZeroPadding {
4462 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4463 });
4464 }
4465 fidl::decode!(u32, D, &mut self.compositor_id, decoder, offset + 0, _depth)?;
4466 fidl::decode!(PointerEvent, D, &mut self.pointer_event, decoder, offset + 8, _depth)?;
4467 Ok(())
4468 }
4469 }
4470
4471 impl fidl::encoding::ValueTypeMarker for SensorDescriptor {
4472 type Borrowed<'a> = &'a Self;
4473 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4474 value
4475 }
4476 }
4477
4478 unsafe impl fidl::encoding::TypeMarker for SensorDescriptor {
4479 type Owned = Self;
4480
4481 #[inline(always)]
4482 fn inline_align(_context: fidl::encoding::Context) -> usize {
4483 4
4484 }
4485
4486 #[inline(always)]
4487 fn inline_size(_context: fidl::encoding::Context) -> usize {
4488 28
4489 }
4490 }
4491
4492 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorDescriptor, D>
4493 for &SensorDescriptor
4494 {
4495 #[inline]
4496 unsafe fn encode(
4497 self,
4498 encoder: &mut fidl::encoding::Encoder<'_, D>,
4499 offset: usize,
4500 _depth: fidl::encoding::Depth,
4501 ) -> fidl::Result<()> {
4502 encoder.debug_check_bounds::<SensorDescriptor>(offset);
4503 fidl::encoding::Encode::<SensorDescriptor, D>::encode(
4505 (
4506 <SensorType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
4507 <SensorLocation as fidl::encoding::ValueTypeMarker>::borrow(&self.loc),
4508 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.min_sampling_freq),
4509 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_sampling_freq),
4510 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.fifo_max_event_count),
4511 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_min),
4512 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.phys_max),
4513 ),
4514 encoder,
4515 offset,
4516 _depth,
4517 )
4518 }
4519 }
4520 unsafe impl<
4521 D: fidl::encoding::ResourceDialect,
4522 T0: fidl::encoding::Encode<SensorType, D>,
4523 T1: fidl::encoding::Encode<SensorLocation, D>,
4524 T2: fidl::encoding::Encode<u32, D>,
4525 T3: fidl::encoding::Encode<u32, D>,
4526 T4: fidl::encoding::Encode<u32, D>,
4527 T5: fidl::encoding::Encode<i32, D>,
4528 T6: fidl::encoding::Encode<i32, D>,
4529 > fidl::encoding::Encode<SensorDescriptor, D> for (T0, T1, T2, T3, T4, T5, T6)
4530 {
4531 #[inline]
4532 unsafe fn encode(
4533 self,
4534 encoder: &mut fidl::encoding::Encoder<'_, D>,
4535 offset: usize,
4536 depth: fidl::encoding::Depth,
4537 ) -> fidl::Result<()> {
4538 encoder.debug_check_bounds::<SensorDescriptor>(offset);
4539 self.0.encode(encoder, offset + 0, depth)?;
4543 self.1.encode(encoder, offset + 4, depth)?;
4544 self.2.encode(encoder, offset + 8, depth)?;
4545 self.3.encode(encoder, offset + 12, depth)?;
4546 self.4.encode(encoder, offset + 16, depth)?;
4547 self.5.encode(encoder, offset + 20, depth)?;
4548 self.6.encode(encoder, offset + 24, depth)?;
4549 Ok(())
4550 }
4551 }
4552
4553 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorDescriptor {
4554 #[inline(always)]
4555 fn new_empty() -> Self {
4556 Self {
4557 type_: fidl::new_empty!(SensorType, D),
4558 loc: fidl::new_empty!(SensorLocation, D),
4559 min_sampling_freq: fidl::new_empty!(u32, D),
4560 max_sampling_freq: fidl::new_empty!(u32, D),
4561 fifo_max_event_count: fidl::new_empty!(u32, D),
4562 phys_min: fidl::new_empty!(i32, D),
4563 phys_max: fidl::new_empty!(i32, D),
4564 }
4565 }
4566
4567 #[inline]
4568 unsafe fn decode(
4569 &mut self,
4570 decoder: &mut fidl::encoding::Decoder<'_, D>,
4571 offset: usize,
4572 _depth: fidl::encoding::Depth,
4573 ) -> fidl::Result<()> {
4574 decoder.debug_check_bounds::<Self>(offset);
4575 fidl::decode!(SensorType, D, &mut self.type_, decoder, offset + 0, _depth)?;
4577 fidl::decode!(SensorLocation, D, &mut self.loc, decoder, offset + 4, _depth)?;
4578 fidl::decode!(u32, D, &mut self.min_sampling_freq, decoder, offset + 8, _depth)?;
4579 fidl::decode!(u32, D, &mut self.max_sampling_freq, decoder, offset + 12, _depth)?;
4580 fidl::decode!(u32, D, &mut self.fifo_max_event_count, decoder, offset + 16, _depth)?;
4581 fidl::decode!(i32, D, &mut self.phys_min, decoder, offset + 20, _depth)?;
4582 fidl::decode!(i32, D, &mut self.phys_max, decoder, offset + 24, _depth)?;
4583 Ok(())
4584 }
4585 }
4586
4587 impl fidl::encoding::ValueTypeMarker for SetHardKeyboardDeliveryCmd {
4588 type Borrowed<'a> = &'a Self;
4589 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4590 value
4591 }
4592 }
4593
4594 unsafe impl fidl::encoding::TypeMarker for SetHardKeyboardDeliveryCmd {
4595 type Owned = Self;
4596
4597 #[inline(always)]
4598 fn inline_align(_context: fidl::encoding::Context) -> usize {
4599 1
4600 }
4601
4602 #[inline(always)]
4603 fn inline_size(_context: fidl::encoding::Context) -> usize {
4604 1
4605 }
4606 }
4607
4608 unsafe impl<D: fidl::encoding::ResourceDialect>
4609 fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for &SetHardKeyboardDeliveryCmd
4610 {
4611 #[inline]
4612 unsafe fn encode(
4613 self,
4614 encoder: &mut fidl::encoding::Encoder<'_, D>,
4615 offset: usize,
4616 _depth: fidl::encoding::Depth,
4617 ) -> fidl::Result<()> {
4618 encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4619 fidl::encoding::Encode::<SetHardKeyboardDeliveryCmd, D>::encode(
4621 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.delivery_request),),
4622 encoder,
4623 offset,
4624 _depth,
4625 )
4626 }
4627 }
4628 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4629 fidl::encoding::Encode<SetHardKeyboardDeliveryCmd, D> for (T0,)
4630 {
4631 #[inline]
4632 unsafe fn encode(
4633 self,
4634 encoder: &mut fidl::encoding::Encoder<'_, D>,
4635 offset: usize,
4636 depth: fidl::encoding::Depth,
4637 ) -> fidl::Result<()> {
4638 encoder.debug_check_bounds::<SetHardKeyboardDeliveryCmd>(offset);
4639 self.0.encode(encoder, offset + 0, depth)?;
4643 Ok(())
4644 }
4645 }
4646
4647 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4648 for SetHardKeyboardDeliveryCmd
4649 {
4650 #[inline(always)]
4651 fn new_empty() -> Self {
4652 Self { delivery_request: fidl::new_empty!(bool, D) }
4653 }
4654
4655 #[inline]
4656 unsafe fn decode(
4657 &mut self,
4658 decoder: &mut fidl::encoding::Decoder<'_, D>,
4659 offset: usize,
4660 _depth: fidl::encoding::Depth,
4661 ) -> fidl::Result<()> {
4662 decoder.debug_check_bounds::<Self>(offset);
4663 fidl::decode!(bool, D, &mut self.delivery_request, decoder, offset + 0, _depth)?;
4665 Ok(())
4666 }
4667 }
4668
4669 impl fidl::encoding::ValueTypeMarker for SetParallelDispatchCmd {
4670 type Borrowed<'a> = &'a Self;
4671 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4672 value
4673 }
4674 }
4675
4676 unsafe impl fidl::encoding::TypeMarker for SetParallelDispatchCmd {
4677 type Owned = Self;
4678
4679 #[inline(always)]
4680 fn inline_align(_context: fidl::encoding::Context) -> usize {
4681 1
4682 }
4683
4684 #[inline(always)]
4685 fn inline_size(_context: fidl::encoding::Context) -> usize {
4686 1
4687 }
4688 }
4689
4690 unsafe impl<D: fidl::encoding::ResourceDialect>
4691 fidl::encoding::Encode<SetParallelDispatchCmd, D> for &SetParallelDispatchCmd
4692 {
4693 #[inline]
4694 unsafe fn encode(
4695 self,
4696 encoder: &mut fidl::encoding::Encoder<'_, D>,
4697 offset: usize,
4698 _depth: fidl::encoding::Depth,
4699 ) -> fidl::Result<()> {
4700 encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4701 fidl::encoding::Encode::<SetParallelDispatchCmd, D>::encode(
4703 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.parallel_dispatch),),
4704 encoder,
4705 offset,
4706 _depth,
4707 )
4708 }
4709 }
4710 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
4711 fidl::encoding::Encode<SetParallelDispatchCmd, D> for (T0,)
4712 {
4713 #[inline]
4714 unsafe fn encode(
4715 self,
4716 encoder: &mut fidl::encoding::Encoder<'_, D>,
4717 offset: usize,
4718 depth: fidl::encoding::Depth,
4719 ) -> fidl::Result<()> {
4720 encoder.debug_check_bounds::<SetParallelDispatchCmd>(offset);
4721 self.0.encode(encoder, offset + 0, depth)?;
4725 Ok(())
4726 }
4727 }
4728
4729 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4730 for SetParallelDispatchCmd
4731 {
4732 #[inline(always)]
4733 fn new_empty() -> Self {
4734 Self { parallel_dispatch: fidl::new_empty!(bool, D) }
4735 }
4736
4737 #[inline]
4738 unsafe fn decode(
4739 &mut self,
4740 decoder: &mut fidl::encoding::Decoder<'_, D>,
4741 offset: usize,
4742 _depth: fidl::encoding::Depth,
4743 ) -> fidl::Result<()> {
4744 decoder.debug_check_bounds::<Self>(offset);
4745 fidl::decode!(bool, D, &mut self.parallel_dispatch, decoder, offset + 0, _depth)?;
4747 Ok(())
4748 }
4749 }
4750
4751 impl fidl::encoding::ValueTypeMarker for StylusDescriptor {
4752 type Borrowed<'a> = &'a Self;
4753 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4754 value
4755 }
4756 }
4757
4758 unsafe impl fidl::encoding::TypeMarker for StylusDescriptor {
4759 type Owned = Self;
4760
4761 #[inline(always)]
4762 fn inline_align(_context: fidl::encoding::Context) -> usize {
4763 8
4764 }
4765
4766 #[inline(always)]
4767 fn inline_size(_context: fidl::encoding::Context) -> usize {
4768 48
4769 }
4770 }
4771
4772 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusDescriptor, D>
4773 for &StylusDescriptor
4774 {
4775 #[inline]
4776 unsafe fn encode(
4777 self,
4778 encoder: &mut fidl::encoding::Encoder<'_, D>,
4779 offset: usize,
4780 _depth: fidl::encoding::Depth,
4781 ) -> fidl::Result<()> {
4782 encoder.debug_check_bounds::<StylusDescriptor>(offset);
4783 fidl::encoding::Encode::<StylusDescriptor, D>::encode(
4785 (
4786 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4787 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4788 <fidl::encoding::Boxed<Axis> as fidl::encoding::ValueTypeMarker>::borrow(
4789 &self.pressure,
4790 ),
4791 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_invertible),
4792 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.buttons),
4793 ),
4794 encoder,
4795 offset,
4796 _depth,
4797 )
4798 }
4799 }
4800 unsafe impl<
4801 D: fidl::encoding::ResourceDialect,
4802 T0: fidl::encoding::Encode<Axis, D>,
4803 T1: fidl::encoding::Encode<Axis, D>,
4804 T2: fidl::encoding::Encode<fidl::encoding::Boxed<Axis>, D>,
4805 T3: fidl::encoding::Encode<bool, D>,
4806 T4: fidl::encoding::Encode<u32, D>,
4807 > fidl::encoding::Encode<StylusDescriptor, D> for (T0, T1, T2, T3, T4)
4808 {
4809 #[inline]
4810 unsafe fn encode(
4811 self,
4812 encoder: &mut fidl::encoding::Encoder<'_, D>,
4813 offset: usize,
4814 depth: fidl::encoding::Depth,
4815 ) -> fidl::Result<()> {
4816 encoder.debug_check_bounds::<StylusDescriptor>(offset);
4817 unsafe {
4820 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
4821 (ptr as *mut u64).write_unaligned(0);
4822 }
4823 self.0.encode(encoder, offset + 0, depth)?;
4825 self.1.encode(encoder, offset + 16, depth)?;
4826 self.2.encode(encoder, offset + 32, depth)?;
4827 self.3.encode(encoder, offset + 40, depth)?;
4828 self.4.encode(encoder, offset + 44, depth)?;
4829 Ok(())
4830 }
4831 }
4832
4833 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusDescriptor {
4834 #[inline(always)]
4835 fn new_empty() -> Self {
4836 Self {
4837 x: fidl::new_empty!(Axis, D),
4838 y: fidl::new_empty!(Axis, D),
4839 pressure: fidl::new_empty!(fidl::encoding::Boxed<Axis>, D),
4840 is_invertible: fidl::new_empty!(bool, D),
4841 buttons: fidl::new_empty!(u32, D),
4842 }
4843 }
4844
4845 #[inline]
4846 unsafe fn decode(
4847 &mut self,
4848 decoder: &mut fidl::encoding::Decoder<'_, D>,
4849 offset: usize,
4850 _depth: fidl::encoding::Depth,
4851 ) -> fidl::Result<()> {
4852 decoder.debug_check_bounds::<Self>(offset);
4853 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4855 let padval = unsafe { (ptr as *const u64).read_unaligned() };
4856 let mask = 0xffffff00u64;
4857 let maskedval = padval & mask;
4858 if maskedval != 0 {
4859 return Err(fidl::Error::NonZeroPadding {
4860 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4861 });
4862 }
4863 fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
4864 fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
4865 fidl::decode!(
4866 fidl::encoding::Boxed<Axis>,
4867 D,
4868 &mut self.pressure,
4869 decoder,
4870 offset + 32,
4871 _depth
4872 )?;
4873 fidl::decode!(bool, D, &mut self.is_invertible, decoder, offset + 40, _depth)?;
4874 fidl::decode!(u32, D, &mut self.buttons, decoder, offset + 44, _depth)?;
4875 Ok(())
4876 }
4877 }
4878
4879 impl fidl::encoding::ValueTypeMarker for StylusReport {
4880 type Borrowed<'a> = &'a Self;
4881 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4882 value
4883 }
4884 }
4885
4886 unsafe impl fidl::encoding::TypeMarker for StylusReport {
4887 type Owned = Self;
4888
4889 #[inline(always)]
4890 fn inline_align(_context: fidl::encoding::Context) -> usize {
4891 4
4892 }
4893
4894 #[inline(always)]
4895 fn inline_size(_context: fidl::encoding::Context) -> usize {
4896 20
4897 }
4898 }
4899
4900 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StylusReport, D>
4901 for &StylusReport
4902 {
4903 #[inline]
4904 unsafe fn encode(
4905 self,
4906 encoder: &mut fidl::encoding::Encoder<'_, D>,
4907 offset: usize,
4908 _depth: fidl::encoding::Depth,
4909 ) -> fidl::Result<()> {
4910 encoder.debug_check_bounds::<StylusReport>(offset);
4911 fidl::encoding::Encode::<StylusReport, D>::encode(
4913 (
4914 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
4915 <i32 as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
4916 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressure),
4917 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_in_contact),
4918 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.in_range),
4919 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.is_inverted),
4920 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.pressed_buttons),
4921 ),
4922 encoder,
4923 offset,
4924 _depth,
4925 )
4926 }
4927 }
4928 unsafe impl<
4929 D: fidl::encoding::ResourceDialect,
4930 T0: fidl::encoding::Encode<i32, D>,
4931 T1: fidl::encoding::Encode<i32, D>,
4932 T2: fidl::encoding::Encode<u32, D>,
4933 T3: fidl::encoding::Encode<bool, D>,
4934 T4: fidl::encoding::Encode<bool, D>,
4935 T5: fidl::encoding::Encode<bool, D>,
4936 T6: fidl::encoding::Encode<u32, D>,
4937 > fidl::encoding::Encode<StylusReport, D> for (T0, T1, T2, T3, T4, T5, T6)
4938 {
4939 #[inline]
4940 unsafe fn encode(
4941 self,
4942 encoder: &mut fidl::encoding::Encoder<'_, D>,
4943 offset: usize,
4944 depth: fidl::encoding::Depth,
4945 ) -> fidl::Result<()> {
4946 encoder.debug_check_bounds::<StylusReport>(offset);
4947 unsafe {
4950 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
4951 (ptr as *mut u32).write_unaligned(0);
4952 }
4953 self.0.encode(encoder, offset + 0, depth)?;
4955 self.1.encode(encoder, offset + 4, depth)?;
4956 self.2.encode(encoder, offset + 8, depth)?;
4957 self.3.encode(encoder, offset + 12, depth)?;
4958 self.4.encode(encoder, offset + 13, depth)?;
4959 self.5.encode(encoder, offset + 14, depth)?;
4960 self.6.encode(encoder, offset + 16, depth)?;
4961 Ok(())
4962 }
4963 }
4964
4965 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StylusReport {
4966 #[inline(always)]
4967 fn new_empty() -> Self {
4968 Self {
4969 x: fidl::new_empty!(i32, D),
4970 y: fidl::new_empty!(i32, D),
4971 pressure: fidl::new_empty!(u32, D),
4972 is_in_contact: fidl::new_empty!(bool, D),
4973 in_range: fidl::new_empty!(bool, D),
4974 is_inverted: fidl::new_empty!(bool, D),
4975 pressed_buttons: fidl::new_empty!(u32, D),
4976 }
4977 }
4978
4979 #[inline]
4980 unsafe fn decode(
4981 &mut self,
4982 decoder: &mut fidl::encoding::Decoder<'_, D>,
4983 offset: usize,
4984 _depth: fidl::encoding::Depth,
4985 ) -> fidl::Result<()> {
4986 decoder.debug_check_bounds::<Self>(offset);
4987 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
4989 let padval = unsafe { (ptr as *const u32).read_unaligned() };
4990 let mask = 0xff000000u32;
4991 let maskedval = padval & mask;
4992 if maskedval != 0 {
4993 return Err(fidl::Error::NonZeroPadding {
4994 padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
4995 });
4996 }
4997 fidl::decode!(i32, D, &mut self.x, decoder, offset + 0, _depth)?;
4998 fidl::decode!(i32, D, &mut self.y, decoder, offset + 4, _depth)?;
4999 fidl::decode!(u32, D, &mut self.pressure, decoder, offset + 8, _depth)?;
5000 fidl::decode!(bool, D, &mut self.is_in_contact, decoder, offset + 12, _depth)?;
5001 fidl::decode!(bool, D, &mut self.in_range, decoder, offset + 13, _depth)?;
5002 fidl::decode!(bool, D, &mut self.is_inverted, decoder, offset + 14, _depth)?;
5003 fidl::decode!(u32, D, &mut self.pressed_buttons, decoder, offset + 16, _depth)?;
5004 Ok(())
5005 }
5006 }
5007
5008 impl fidl::encoding::ValueTypeMarker for TextInputState {
5009 type Borrowed<'a> = &'a Self;
5010 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5011 value
5012 }
5013 }
5014
5015 unsafe impl fidl::encoding::TypeMarker for TextInputState {
5016 type Owned = Self;
5017
5018 #[inline(always)]
5019 fn inline_align(_context: fidl::encoding::Context) -> usize {
5020 8
5021 }
5022
5023 #[inline(always)]
5024 fn inline_size(_context: fidl::encoding::Context) -> usize {
5025 64
5026 }
5027 }
5028
5029 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextInputState, D>
5030 for &TextInputState
5031 {
5032 #[inline]
5033 unsafe fn encode(
5034 self,
5035 encoder: &mut fidl::encoding::Encoder<'_, D>,
5036 offset: usize,
5037 _depth: fidl::encoding::Depth,
5038 ) -> fidl::Result<()> {
5039 encoder.debug_check_bounds::<TextInputState>(offset);
5040 fidl::encoding::Encode::<TextInputState, D>::encode(
5042 (
5043 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.revision),
5044 <fidl::encoding::UnboundedString as fidl::encoding::ValueTypeMarker>::borrow(
5045 &self.text,
5046 ),
5047 <TextSelection as fidl::encoding::ValueTypeMarker>::borrow(&self.selection),
5048 <TextRange as fidl::encoding::ValueTypeMarker>::borrow(&self.composing),
5049 ),
5050 encoder,
5051 offset,
5052 _depth,
5053 )
5054 }
5055 }
5056 unsafe impl<
5057 D: fidl::encoding::ResourceDialect,
5058 T0: fidl::encoding::Encode<u32, D>,
5059 T1: fidl::encoding::Encode<fidl::encoding::UnboundedString, D>,
5060 T2: fidl::encoding::Encode<TextSelection, D>,
5061 T3: fidl::encoding::Encode<TextRange, D>,
5062 > fidl::encoding::Encode<TextInputState, D> for (T0, T1, T2, T3)
5063 {
5064 #[inline]
5065 unsafe fn encode(
5066 self,
5067 encoder: &mut fidl::encoding::Encoder<'_, D>,
5068 offset: usize,
5069 depth: fidl::encoding::Depth,
5070 ) -> fidl::Result<()> {
5071 encoder.debug_check_bounds::<TextInputState>(offset);
5072 unsafe {
5075 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
5076 (ptr as *mut u64).write_unaligned(0);
5077 }
5078 self.0.encode(encoder, offset + 0, depth)?;
5080 self.1.encode(encoder, offset + 8, depth)?;
5081 self.2.encode(encoder, offset + 24, depth)?;
5082 self.3.encode(encoder, offset + 48, depth)?;
5083 Ok(())
5084 }
5085 }
5086
5087 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextInputState {
5088 #[inline(always)]
5089 fn new_empty() -> Self {
5090 Self {
5091 revision: fidl::new_empty!(u32, D),
5092 text: fidl::new_empty!(fidl::encoding::UnboundedString, D),
5093 selection: fidl::new_empty!(TextSelection, D),
5094 composing: fidl::new_empty!(TextRange, D),
5095 }
5096 }
5097
5098 #[inline]
5099 unsafe fn decode(
5100 &mut self,
5101 decoder: &mut fidl::encoding::Decoder<'_, D>,
5102 offset: usize,
5103 _depth: fidl::encoding::Depth,
5104 ) -> fidl::Result<()> {
5105 decoder.debug_check_bounds::<Self>(offset);
5106 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
5108 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5109 let mask = 0xffffffff00000000u64;
5110 let maskedval = padval & mask;
5111 if maskedval != 0 {
5112 return Err(fidl::Error::NonZeroPadding {
5113 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
5114 });
5115 }
5116 fidl::decode!(u32, D, &mut self.revision, decoder, offset + 0, _depth)?;
5117 fidl::decode!(
5118 fidl::encoding::UnboundedString,
5119 D,
5120 &mut self.text,
5121 decoder,
5122 offset + 8,
5123 _depth
5124 )?;
5125 fidl::decode!(TextSelection, D, &mut self.selection, decoder, offset + 24, _depth)?;
5126 fidl::decode!(TextRange, D, &mut self.composing, decoder, offset + 48, _depth)?;
5127 Ok(())
5128 }
5129 }
5130
5131 impl fidl::encoding::ValueTypeMarker for TextRange {
5132 type Borrowed<'a> = &'a Self;
5133 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5134 value
5135 }
5136 }
5137
5138 unsafe impl fidl::encoding::TypeMarker for TextRange {
5139 type Owned = Self;
5140
5141 #[inline(always)]
5142 fn inline_align(_context: fidl::encoding::Context) -> usize {
5143 8
5144 }
5145
5146 #[inline(always)]
5147 fn inline_size(_context: fidl::encoding::Context) -> usize {
5148 16
5149 }
5150 #[inline(always)]
5151 fn encode_is_copy() -> bool {
5152 true
5153 }
5154
5155 #[inline(always)]
5156 fn decode_is_copy() -> bool {
5157 true
5158 }
5159 }
5160
5161 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextRange, D>
5162 for &TextRange
5163 {
5164 #[inline]
5165 unsafe fn encode(
5166 self,
5167 encoder: &mut fidl::encoding::Encoder<'_, D>,
5168 offset: usize,
5169 _depth: fidl::encoding::Depth,
5170 ) -> fidl::Result<()> {
5171 encoder.debug_check_bounds::<TextRange>(offset);
5172 unsafe {
5173 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5175 (buf_ptr as *mut TextRange).write_unaligned((self as *const TextRange).read());
5176 }
5179 Ok(())
5180 }
5181 }
5182 unsafe impl<
5183 D: fidl::encoding::ResourceDialect,
5184 T0: fidl::encoding::Encode<i64, D>,
5185 T1: fidl::encoding::Encode<i64, D>,
5186 > fidl::encoding::Encode<TextRange, D> for (T0, T1)
5187 {
5188 #[inline]
5189 unsafe fn encode(
5190 self,
5191 encoder: &mut fidl::encoding::Encoder<'_, D>,
5192 offset: usize,
5193 depth: fidl::encoding::Depth,
5194 ) -> fidl::Result<()> {
5195 encoder.debug_check_bounds::<TextRange>(offset);
5196 self.0.encode(encoder, offset + 0, depth)?;
5200 self.1.encode(encoder, offset + 8, depth)?;
5201 Ok(())
5202 }
5203 }
5204
5205 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextRange {
5206 #[inline(always)]
5207 fn new_empty() -> Self {
5208 Self { start: fidl::new_empty!(i64, D), end: fidl::new_empty!(i64, D) }
5209 }
5210
5211 #[inline]
5212 unsafe fn decode(
5213 &mut self,
5214 decoder: &mut fidl::encoding::Decoder<'_, D>,
5215 offset: usize,
5216 _depth: fidl::encoding::Depth,
5217 ) -> fidl::Result<()> {
5218 decoder.debug_check_bounds::<Self>(offset);
5219 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5220 unsafe {
5223 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
5224 }
5225 Ok(())
5226 }
5227 }
5228
5229 impl fidl::encoding::ValueTypeMarker for TextSelection {
5230 type Borrowed<'a> = &'a Self;
5231 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5232 value
5233 }
5234 }
5235
5236 unsafe impl fidl::encoding::TypeMarker for TextSelection {
5237 type Owned = Self;
5238
5239 #[inline(always)]
5240 fn inline_align(_context: fidl::encoding::Context) -> usize {
5241 8
5242 }
5243
5244 #[inline(always)]
5245 fn inline_size(_context: fidl::encoding::Context) -> usize {
5246 24
5247 }
5248 }
5249
5250 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TextSelection, D>
5251 for &TextSelection
5252 {
5253 #[inline]
5254 unsafe fn encode(
5255 self,
5256 encoder: &mut fidl::encoding::Encoder<'_, D>,
5257 offset: usize,
5258 _depth: fidl::encoding::Depth,
5259 ) -> fidl::Result<()> {
5260 encoder.debug_check_bounds::<TextSelection>(offset);
5261 fidl::encoding::Encode::<TextSelection, D>::encode(
5263 (
5264 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.base),
5265 <i64 as fidl::encoding::ValueTypeMarker>::borrow(&self.extent),
5266 <TextAffinity as fidl::encoding::ValueTypeMarker>::borrow(&self.affinity),
5267 ),
5268 encoder,
5269 offset,
5270 _depth,
5271 )
5272 }
5273 }
5274 unsafe impl<
5275 D: fidl::encoding::ResourceDialect,
5276 T0: fidl::encoding::Encode<i64, D>,
5277 T1: fidl::encoding::Encode<i64, D>,
5278 T2: fidl::encoding::Encode<TextAffinity, D>,
5279 > fidl::encoding::Encode<TextSelection, D> for (T0, T1, T2)
5280 {
5281 #[inline]
5282 unsafe fn encode(
5283 self,
5284 encoder: &mut fidl::encoding::Encoder<'_, D>,
5285 offset: usize,
5286 depth: fidl::encoding::Depth,
5287 ) -> fidl::Result<()> {
5288 encoder.debug_check_bounds::<TextSelection>(offset);
5289 unsafe {
5292 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5293 (ptr as *mut u64).write_unaligned(0);
5294 }
5295 self.0.encode(encoder, offset + 0, depth)?;
5297 self.1.encode(encoder, offset + 8, depth)?;
5298 self.2.encode(encoder, offset + 16, depth)?;
5299 Ok(())
5300 }
5301 }
5302
5303 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TextSelection {
5304 #[inline(always)]
5305 fn new_empty() -> Self {
5306 Self {
5307 base: fidl::new_empty!(i64, D),
5308 extent: fidl::new_empty!(i64, D),
5309 affinity: fidl::new_empty!(TextAffinity, D),
5310 }
5311 }
5312
5313 #[inline]
5314 unsafe fn decode(
5315 &mut self,
5316 decoder: &mut fidl::encoding::Decoder<'_, D>,
5317 offset: usize,
5318 _depth: fidl::encoding::Depth,
5319 ) -> fidl::Result<()> {
5320 decoder.debug_check_bounds::<Self>(offset);
5321 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5323 let padval = unsafe { (ptr as *const u64).read_unaligned() };
5324 let mask = 0xffffffff00000000u64;
5325 let maskedval = padval & mask;
5326 if maskedval != 0 {
5327 return Err(fidl::Error::NonZeroPadding {
5328 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5329 });
5330 }
5331 fidl::decode!(i64, D, &mut self.base, decoder, offset + 0, _depth)?;
5332 fidl::decode!(i64, D, &mut self.extent, decoder, offset + 8, _depth)?;
5333 fidl::decode!(TextAffinity, D, &mut self.affinity, decoder, offset + 16, _depth)?;
5334 Ok(())
5335 }
5336 }
5337
5338 impl fidl::encoding::ValueTypeMarker for Touch {
5339 type Borrowed<'a> = &'a Self;
5340 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5341 value
5342 }
5343 }
5344
5345 unsafe impl fidl::encoding::TypeMarker for Touch {
5346 type Owned = Self;
5347
5348 #[inline(always)]
5349 fn inline_align(_context: fidl::encoding::Context) -> usize {
5350 4
5351 }
5352
5353 #[inline(always)]
5354 fn inline_size(_context: fidl::encoding::Context) -> usize {
5355 20
5356 }
5357 #[inline(always)]
5358 fn encode_is_copy() -> bool {
5359 true
5360 }
5361
5362 #[inline(always)]
5363 fn decode_is_copy() -> bool {
5364 true
5365 }
5366 }
5367
5368 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Touch, D> for &Touch {
5369 #[inline]
5370 unsafe fn encode(
5371 self,
5372 encoder: &mut fidl::encoding::Encoder<'_, D>,
5373 offset: usize,
5374 _depth: fidl::encoding::Depth,
5375 ) -> fidl::Result<()> {
5376 encoder.debug_check_bounds::<Touch>(offset);
5377 unsafe {
5378 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
5380 (buf_ptr as *mut Touch).write_unaligned((self as *const Touch).read());
5381 }
5384 Ok(())
5385 }
5386 }
5387 unsafe impl<
5388 D: fidl::encoding::ResourceDialect,
5389 T0: fidl::encoding::Encode<u32, D>,
5390 T1: fidl::encoding::Encode<i32, D>,
5391 T2: fidl::encoding::Encode<i32, D>,
5392 T3: fidl::encoding::Encode<u32, D>,
5393 T4: fidl::encoding::Encode<u32, D>,
5394 > fidl::encoding::Encode<Touch, D> for (T0, T1, T2, T3, T4)
5395 {
5396 #[inline]
5397 unsafe fn encode(
5398 self,
5399 encoder: &mut fidl::encoding::Encoder<'_, D>,
5400 offset: usize,
5401 depth: fidl::encoding::Depth,
5402 ) -> fidl::Result<()> {
5403 encoder.debug_check_bounds::<Touch>(offset);
5404 self.0.encode(encoder, offset + 0, depth)?;
5408 self.1.encode(encoder, offset + 4, depth)?;
5409 self.2.encode(encoder, offset + 8, depth)?;
5410 self.3.encode(encoder, offset + 12, depth)?;
5411 self.4.encode(encoder, offset + 16, depth)?;
5412 Ok(())
5413 }
5414 }
5415
5416 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Touch {
5417 #[inline(always)]
5418 fn new_empty() -> Self {
5419 Self {
5420 finger_id: fidl::new_empty!(u32, D),
5421 x: fidl::new_empty!(i32, D),
5422 y: fidl::new_empty!(i32, D),
5423 width: fidl::new_empty!(u32, D),
5424 height: fidl::new_empty!(u32, D),
5425 }
5426 }
5427
5428 #[inline]
5429 unsafe fn decode(
5430 &mut self,
5431 decoder: &mut fidl::encoding::Decoder<'_, D>,
5432 offset: usize,
5433 _depth: fidl::encoding::Depth,
5434 ) -> fidl::Result<()> {
5435 decoder.debug_check_bounds::<Self>(offset);
5436 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
5437 unsafe {
5440 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 20);
5441 }
5442 Ok(())
5443 }
5444 }
5445
5446 impl fidl::encoding::ValueTypeMarker for TouchscreenDescriptor {
5447 type Borrowed<'a> = &'a Self;
5448 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5449 value
5450 }
5451 }
5452
5453 unsafe impl fidl::encoding::TypeMarker for TouchscreenDescriptor {
5454 type Owned = Self;
5455
5456 #[inline(always)]
5457 fn inline_align(_context: fidl::encoding::Context) -> usize {
5458 4
5459 }
5460
5461 #[inline(always)]
5462 fn inline_size(_context: fidl::encoding::Context) -> usize {
5463 36
5464 }
5465 }
5466
5467 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenDescriptor, D>
5468 for &TouchscreenDescriptor
5469 {
5470 #[inline]
5471 unsafe fn encode(
5472 self,
5473 encoder: &mut fidl::encoding::Encoder<'_, D>,
5474 offset: usize,
5475 _depth: fidl::encoding::Depth,
5476 ) -> fidl::Result<()> {
5477 encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5478 fidl::encoding::Encode::<TouchscreenDescriptor, D>::encode(
5480 (
5481 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.x),
5482 <Axis as fidl::encoding::ValueTypeMarker>::borrow(&self.y),
5483 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.max_finger_id),
5484 ),
5485 encoder,
5486 offset,
5487 _depth,
5488 )
5489 }
5490 }
5491 unsafe impl<
5492 D: fidl::encoding::ResourceDialect,
5493 T0: fidl::encoding::Encode<Axis, D>,
5494 T1: fidl::encoding::Encode<Axis, D>,
5495 T2: fidl::encoding::Encode<u32, D>,
5496 > fidl::encoding::Encode<TouchscreenDescriptor, D> for (T0, T1, T2)
5497 {
5498 #[inline]
5499 unsafe fn encode(
5500 self,
5501 encoder: &mut fidl::encoding::Encoder<'_, D>,
5502 offset: usize,
5503 depth: fidl::encoding::Depth,
5504 ) -> fidl::Result<()> {
5505 encoder.debug_check_bounds::<TouchscreenDescriptor>(offset);
5506 self.0.encode(encoder, offset + 0, depth)?;
5510 self.1.encode(encoder, offset + 16, depth)?;
5511 self.2.encode(encoder, offset + 32, depth)?;
5512 Ok(())
5513 }
5514 }
5515
5516 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenDescriptor {
5517 #[inline(always)]
5518 fn new_empty() -> Self {
5519 Self {
5520 x: fidl::new_empty!(Axis, D),
5521 y: fidl::new_empty!(Axis, D),
5522 max_finger_id: fidl::new_empty!(u32, D),
5523 }
5524 }
5525
5526 #[inline]
5527 unsafe fn decode(
5528 &mut self,
5529 decoder: &mut fidl::encoding::Decoder<'_, D>,
5530 offset: usize,
5531 _depth: fidl::encoding::Depth,
5532 ) -> fidl::Result<()> {
5533 decoder.debug_check_bounds::<Self>(offset);
5534 fidl::decode!(Axis, D, &mut self.x, decoder, offset + 0, _depth)?;
5536 fidl::decode!(Axis, D, &mut self.y, decoder, offset + 16, _depth)?;
5537 fidl::decode!(u32, D, &mut self.max_finger_id, decoder, offset + 32, _depth)?;
5538 Ok(())
5539 }
5540 }
5541
5542 impl fidl::encoding::ValueTypeMarker for TouchscreenReport {
5543 type Borrowed<'a> = &'a Self;
5544 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5545 value
5546 }
5547 }
5548
5549 unsafe impl fidl::encoding::TypeMarker for TouchscreenReport {
5550 type Owned = Self;
5551
5552 #[inline(always)]
5553 fn inline_align(_context: fidl::encoding::Context) -> usize {
5554 8
5555 }
5556
5557 #[inline(always)]
5558 fn inline_size(_context: fidl::encoding::Context) -> usize {
5559 16
5560 }
5561 }
5562
5563 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TouchscreenReport, D>
5564 for &TouchscreenReport
5565 {
5566 #[inline]
5567 unsafe fn encode(
5568 self,
5569 encoder: &mut fidl::encoding::Encoder<'_, D>,
5570 offset: usize,
5571 _depth: fidl::encoding::Depth,
5572 ) -> fidl::Result<()> {
5573 encoder.debug_check_bounds::<TouchscreenReport>(offset);
5574 fidl::encoding::Encode::<TouchscreenReport, D>::encode(
5576 (
5577 <fidl::encoding::UnboundedVector<Touch> as fidl::encoding::ValueTypeMarker>::borrow(&self.touches),
5578 ),
5579 encoder, offset, _depth
5580 )
5581 }
5582 }
5583 unsafe impl<
5584 D: fidl::encoding::ResourceDialect,
5585 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Touch>, D>,
5586 > fidl::encoding::Encode<TouchscreenReport, D> for (T0,)
5587 {
5588 #[inline]
5589 unsafe fn encode(
5590 self,
5591 encoder: &mut fidl::encoding::Encoder<'_, D>,
5592 offset: usize,
5593 depth: fidl::encoding::Depth,
5594 ) -> fidl::Result<()> {
5595 encoder.debug_check_bounds::<TouchscreenReport>(offset);
5596 self.0.encode(encoder, offset + 0, depth)?;
5600 Ok(())
5601 }
5602 }
5603
5604 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TouchscreenReport {
5605 #[inline(always)]
5606 fn new_empty() -> Self {
5607 Self { touches: fidl::new_empty!(fidl::encoding::UnboundedVector<Touch>, D) }
5608 }
5609
5610 #[inline]
5611 unsafe fn decode(
5612 &mut self,
5613 decoder: &mut fidl::encoding::Decoder<'_, D>,
5614 offset: usize,
5615 _depth: fidl::encoding::Depth,
5616 ) -> fidl::Result<()> {
5617 decoder.debug_check_bounds::<Self>(offset);
5618 fidl::decode!(
5620 fidl::encoding::UnboundedVector<Touch>,
5621 D,
5622 &mut self.touches,
5623 decoder,
5624 offset + 0,
5625 _depth
5626 )?;
5627 Ok(())
5628 }
5629 }
5630
5631 impl MediaButtonsEvent {
5632 #[inline(always)]
5633 fn max_ordinal_present(&self) -> u64 {
5634 if let Some(_) = self.device_id {
5635 return 7;
5636 }
5637 if let Some(_) = self.function {
5638 return 6;
5639 }
5640 if let Some(_) = self.power {
5641 return 5;
5642 }
5643 if let Some(_) = self.camera_disable {
5644 return 4;
5645 }
5646 if let Some(_) = self.pause {
5647 return 3;
5648 }
5649 if let Some(_) = self.mic_mute {
5650 return 2;
5651 }
5652 if let Some(_) = self.volume {
5653 return 1;
5654 }
5655 0
5656 }
5657 }
5658
5659 impl fidl::encoding::ValueTypeMarker for MediaButtonsEvent {
5660 type Borrowed<'a> = &'a Self;
5661 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5662 value
5663 }
5664 }
5665
5666 unsafe impl fidl::encoding::TypeMarker for MediaButtonsEvent {
5667 type Owned = Self;
5668
5669 #[inline(always)]
5670 fn inline_align(_context: fidl::encoding::Context) -> usize {
5671 8
5672 }
5673
5674 #[inline(always)]
5675 fn inline_size(_context: fidl::encoding::Context) -> usize {
5676 16
5677 }
5678 }
5679
5680 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MediaButtonsEvent, D>
5681 for &MediaButtonsEvent
5682 {
5683 unsafe fn encode(
5684 self,
5685 encoder: &mut fidl::encoding::Encoder<'_, D>,
5686 offset: usize,
5687 mut depth: fidl::encoding::Depth,
5688 ) -> fidl::Result<()> {
5689 encoder.debug_check_bounds::<MediaButtonsEvent>(offset);
5690 let max_ordinal: u64 = self.max_ordinal_present();
5692 encoder.write_num(max_ordinal, offset);
5693 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5694 if max_ordinal == 0 {
5696 return Ok(());
5697 }
5698 depth.increment()?;
5699 let envelope_size = 8;
5700 let bytes_len = max_ordinal as usize * envelope_size;
5701 #[allow(unused_variables)]
5702 let offset = encoder.out_of_line_offset(bytes_len);
5703 let mut _prev_end_offset: usize = 0;
5704 if 1 > max_ordinal {
5705 return Ok(());
5706 }
5707
5708 let cur_offset: usize = (1 - 1) * envelope_size;
5711
5712 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5714
5715 fidl::encoding::encode_in_envelope_optional::<i8, D>(
5720 self.volume.as_ref().map(<i8 as fidl::encoding::ValueTypeMarker>::borrow),
5721 encoder,
5722 offset + cur_offset,
5723 depth,
5724 )?;
5725
5726 _prev_end_offset = cur_offset + envelope_size;
5727 if 2 > max_ordinal {
5728 return Ok(());
5729 }
5730
5731 let cur_offset: usize = (2 - 1) * envelope_size;
5734
5735 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5737
5738 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5743 self.mic_mute.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5744 encoder,
5745 offset + cur_offset,
5746 depth,
5747 )?;
5748
5749 _prev_end_offset = cur_offset + envelope_size;
5750 if 3 > max_ordinal {
5751 return Ok(());
5752 }
5753
5754 let cur_offset: usize = (3 - 1) * envelope_size;
5757
5758 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5760
5761 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5766 self.pause.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5767 encoder,
5768 offset + cur_offset,
5769 depth,
5770 )?;
5771
5772 _prev_end_offset = cur_offset + envelope_size;
5773 if 4 > max_ordinal {
5774 return Ok(());
5775 }
5776
5777 let cur_offset: usize = (4 - 1) * envelope_size;
5780
5781 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5783
5784 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5789 self.camera_disable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5790 encoder,
5791 offset + cur_offset,
5792 depth,
5793 )?;
5794
5795 _prev_end_offset = cur_offset + envelope_size;
5796 if 5 > max_ordinal {
5797 return Ok(());
5798 }
5799
5800 let cur_offset: usize = (5 - 1) * envelope_size;
5803
5804 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5806
5807 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5812 self.power.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5813 encoder,
5814 offset + cur_offset,
5815 depth,
5816 )?;
5817
5818 _prev_end_offset = cur_offset + envelope_size;
5819 if 6 > max_ordinal {
5820 return Ok(());
5821 }
5822
5823 let cur_offset: usize = (6 - 1) * envelope_size;
5826
5827 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5829
5830 fidl::encoding::encode_in_envelope_optional::<bool, D>(
5835 self.function.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
5836 encoder,
5837 offset + cur_offset,
5838 depth,
5839 )?;
5840
5841 _prev_end_offset = cur_offset + envelope_size;
5842 if 7 > max_ordinal {
5843 return Ok(());
5844 }
5845
5846 let cur_offset: usize = (7 - 1) * envelope_size;
5849
5850 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5852
5853 fidl::encoding::encode_in_envelope_optional::<u32, D>(
5858 self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5859 encoder,
5860 offset + cur_offset,
5861 depth,
5862 )?;
5863
5864 _prev_end_offset = cur_offset + envelope_size;
5865
5866 Ok(())
5867 }
5868 }
5869
5870 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MediaButtonsEvent {
5871 #[inline(always)]
5872 fn new_empty() -> Self {
5873 Self::default()
5874 }
5875
5876 unsafe fn decode(
5877 &mut self,
5878 decoder: &mut fidl::encoding::Decoder<'_, D>,
5879 offset: usize,
5880 mut depth: fidl::encoding::Depth,
5881 ) -> fidl::Result<()> {
5882 decoder.debug_check_bounds::<Self>(offset);
5883 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5884 None => return Err(fidl::Error::NotNullable),
5885 Some(len) => len,
5886 };
5887 if len == 0 {
5889 return Ok(());
5890 };
5891 depth.increment()?;
5892 let envelope_size = 8;
5893 let bytes_len = len * envelope_size;
5894 let offset = decoder.out_of_line_offset(bytes_len)?;
5895 let mut _next_ordinal_to_read = 0;
5897 let mut next_offset = offset;
5898 let end_offset = offset + bytes_len;
5899 _next_ordinal_to_read += 1;
5900 if next_offset >= end_offset {
5901 return Ok(());
5902 }
5903
5904 while _next_ordinal_to_read < 1 {
5906 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5907 _next_ordinal_to_read += 1;
5908 next_offset += envelope_size;
5909 }
5910
5911 let next_out_of_line = decoder.next_out_of_line();
5912 let handles_before = decoder.remaining_handles();
5913 if let Some((inlined, num_bytes, num_handles)) =
5914 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5915 {
5916 let member_inline_size =
5917 <i8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5918 if inlined != (member_inline_size <= 4) {
5919 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5920 }
5921 let inner_offset;
5922 let mut inner_depth = depth.clone();
5923 if inlined {
5924 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5925 inner_offset = next_offset;
5926 } else {
5927 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5928 inner_depth.increment()?;
5929 }
5930 let val_ref = self.volume.get_or_insert_with(|| fidl::new_empty!(i8, D));
5931 fidl::decode!(i8, D, val_ref, decoder, inner_offset, inner_depth)?;
5932 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5933 {
5934 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5935 }
5936 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5937 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5938 }
5939 }
5940
5941 next_offset += envelope_size;
5942 _next_ordinal_to_read += 1;
5943 if next_offset >= end_offset {
5944 return Ok(());
5945 }
5946
5947 while _next_ordinal_to_read < 2 {
5949 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5950 _next_ordinal_to_read += 1;
5951 next_offset += envelope_size;
5952 }
5953
5954 let next_out_of_line = decoder.next_out_of_line();
5955 let handles_before = decoder.remaining_handles();
5956 if let Some((inlined, num_bytes, num_handles)) =
5957 fidl::encoding::decode_envelope_header(decoder, next_offset)?
5958 {
5959 let member_inline_size =
5960 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5961 if inlined != (member_inline_size <= 4) {
5962 return Err(fidl::Error::InvalidInlineBitInEnvelope);
5963 }
5964 let inner_offset;
5965 let mut inner_depth = depth.clone();
5966 if inlined {
5967 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5968 inner_offset = next_offset;
5969 } else {
5970 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5971 inner_depth.increment()?;
5972 }
5973 let val_ref = self.mic_mute.get_or_insert_with(|| fidl::new_empty!(bool, D));
5974 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
5975 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5976 {
5977 return Err(fidl::Error::InvalidNumBytesInEnvelope);
5978 }
5979 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5980 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5981 }
5982 }
5983
5984 next_offset += envelope_size;
5985 _next_ordinal_to_read += 1;
5986 if next_offset >= end_offset {
5987 return Ok(());
5988 }
5989
5990 while _next_ordinal_to_read < 3 {
5992 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5993 _next_ordinal_to_read += 1;
5994 next_offset += envelope_size;
5995 }
5996
5997 let next_out_of_line = decoder.next_out_of_line();
5998 let handles_before = decoder.remaining_handles();
5999 if let Some((inlined, num_bytes, num_handles)) =
6000 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6001 {
6002 let member_inline_size =
6003 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6004 if inlined != (member_inline_size <= 4) {
6005 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6006 }
6007 let inner_offset;
6008 let mut inner_depth = depth.clone();
6009 if inlined {
6010 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6011 inner_offset = next_offset;
6012 } else {
6013 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6014 inner_depth.increment()?;
6015 }
6016 let val_ref = self.pause.get_or_insert_with(|| fidl::new_empty!(bool, D));
6017 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6018 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6019 {
6020 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6021 }
6022 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6023 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6024 }
6025 }
6026
6027 next_offset += envelope_size;
6028 _next_ordinal_to_read += 1;
6029 if next_offset >= end_offset {
6030 return Ok(());
6031 }
6032
6033 while _next_ordinal_to_read < 4 {
6035 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6036 _next_ordinal_to_read += 1;
6037 next_offset += envelope_size;
6038 }
6039
6040 let next_out_of_line = decoder.next_out_of_line();
6041 let handles_before = decoder.remaining_handles();
6042 if let Some((inlined, num_bytes, num_handles)) =
6043 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6044 {
6045 let member_inline_size =
6046 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6047 if inlined != (member_inline_size <= 4) {
6048 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6049 }
6050 let inner_offset;
6051 let mut inner_depth = depth.clone();
6052 if inlined {
6053 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6054 inner_offset = next_offset;
6055 } else {
6056 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6057 inner_depth.increment()?;
6058 }
6059 let val_ref = self.camera_disable.get_or_insert_with(|| fidl::new_empty!(bool, D));
6060 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6061 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6062 {
6063 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6064 }
6065 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6066 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6067 }
6068 }
6069
6070 next_offset += envelope_size;
6071 _next_ordinal_to_read += 1;
6072 if next_offset >= end_offset {
6073 return Ok(());
6074 }
6075
6076 while _next_ordinal_to_read < 5 {
6078 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6079 _next_ordinal_to_read += 1;
6080 next_offset += envelope_size;
6081 }
6082
6083 let next_out_of_line = decoder.next_out_of_line();
6084 let handles_before = decoder.remaining_handles();
6085 if let Some((inlined, num_bytes, num_handles)) =
6086 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6087 {
6088 let member_inline_size =
6089 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6090 if inlined != (member_inline_size <= 4) {
6091 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6092 }
6093 let inner_offset;
6094 let mut inner_depth = depth.clone();
6095 if inlined {
6096 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6097 inner_offset = next_offset;
6098 } else {
6099 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6100 inner_depth.increment()?;
6101 }
6102 let val_ref = self.power.get_or_insert_with(|| fidl::new_empty!(bool, D));
6103 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6104 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6105 {
6106 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6107 }
6108 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6109 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6110 }
6111 }
6112
6113 next_offset += envelope_size;
6114 _next_ordinal_to_read += 1;
6115 if next_offset >= end_offset {
6116 return Ok(());
6117 }
6118
6119 while _next_ordinal_to_read < 6 {
6121 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6122 _next_ordinal_to_read += 1;
6123 next_offset += envelope_size;
6124 }
6125
6126 let next_out_of_line = decoder.next_out_of_line();
6127 let handles_before = decoder.remaining_handles();
6128 if let Some((inlined, num_bytes, num_handles)) =
6129 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6130 {
6131 let member_inline_size =
6132 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6133 if inlined != (member_inline_size <= 4) {
6134 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6135 }
6136 let inner_offset;
6137 let mut inner_depth = depth.clone();
6138 if inlined {
6139 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6140 inner_offset = next_offset;
6141 } else {
6142 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6143 inner_depth.increment()?;
6144 }
6145 let val_ref = self.function.get_or_insert_with(|| fidl::new_empty!(bool, D));
6146 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
6147 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6148 {
6149 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6150 }
6151 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6152 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6153 }
6154 }
6155
6156 next_offset += envelope_size;
6157 _next_ordinal_to_read += 1;
6158 if next_offset >= end_offset {
6159 return Ok(());
6160 }
6161
6162 while _next_ordinal_to_read < 7 {
6164 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6165 _next_ordinal_to_read += 1;
6166 next_offset += envelope_size;
6167 }
6168
6169 let next_out_of_line = decoder.next_out_of_line();
6170 let handles_before = decoder.remaining_handles();
6171 if let Some((inlined, num_bytes, num_handles)) =
6172 fidl::encoding::decode_envelope_header(decoder, next_offset)?
6173 {
6174 let member_inline_size =
6175 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6176 if inlined != (member_inline_size <= 4) {
6177 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6178 }
6179 let inner_offset;
6180 let mut inner_depth = depth.clone();
6181 if inlined {
6182 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6183 inner_offset = next_offset;
6184 } else {
6185 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6186 inner_depth.increment()?;
6187 }
6188 let val_ref = self.device_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
6189 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
6190 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6191 {
6192 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6193 }
6194 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6195 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6196 }
6197 }
6198
6199 next_offset += envelope_size;
6200
6201 while next_offset < end_offset {
6203 _next_ordinal_to_read += 1;
6204 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6205 next_offset += envelope_size;
6206 }
6207
6208 Ok(())
6209 }
6210 }
6211
6212 impl fidl::encoding::ValueTypeMarker for Command {
6213 type Borrowed<'a> = &'a Self;
6214 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6215 value
6216 }
6217 }
6218
6219 unsafe impl fidl::encoding::TypeMarker for Command {
6220 type Owned = Self;
6221
6222 #[inline(always)]
6223 fn inline_align(_context: fidl::encoding::Context) -> usize {
6224 8
6225 }
6226
6227 #[inline(always)]
6228 fn inline_size(_context: fidl::encoding::Context) -> usize {
6229 16
6230 }
6231 }
6232
6233 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Command, D> for &Command {
6234 #[inline]
6235 unsafe fn encode(
6236 self,
6237 encoder: &mut fidl::encoding::Encoder<'_, D>,
6238 offset: usize,
6239 _depth: fidl::encoding::Depth,
6240 ) -> fidl::Result<()> {
6241 encoder.debug_check_bounds::<Command>(offset);
6242 encoder.write_num::<u64>(self.ordinal(), offset);
6243 match self {
6244 Command::SendKeyboardInput(ref val) => {
6245 fidl::encoding::encode_in_envelope::<SendKeyboardInputCmd, D>(
6246 <SendKeyboardInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6247 encoder,
6248 offset + 8,
6249 _depth,
6250 )
6251 }
6252 Command::SendPointerInput(ref val) => {
6253 fidl::encoding::encode_in_envelope::<SendPointerInputCmd, D>(
6254 <SendPointerInputCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6255 encoder,
6256 offset + 8,
6257 _depth,
6258 )
6259 }
6260 Command::SetHardKeyboardDelivery(ref val) => fidl::encoding::encode_in_envelope::<
6261 SetHardKeyboardDeliveryCmd,
6262 D,
6263 >(
6264 <SetHardKeyboardDeliveryCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6265 encoder,
6266 offset + 8,
6267 _depth,
6268 ),
6269 Command::SetParallelDispatch(ref val) => {
6270 fidl::encoding::encode_in_envelope::<SetParallelDispatchCmd, D>(
6271 <SetParallelDispatchCmd as fidl::encoding::ValueTypeMarker>::borrow(val),
6272 encoder,
6273 offset + 8,
6274 _depth,
6275 )
6276 }
6277 }
6278 }
6279 }
6280
6281 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Command {
6282 #[inline(always)]
6283 fn new_empty() -> Self {
6284 Self::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D))
6285 }
6286
6287 #[inline]
6288 unsafe fn decode(
6289 &mut self,
6290 decoder: &mut fidl::encoding::Decoder<'_, D>,
6291 offset: usize,
6292 mut depth: fidl::encoding::Depth,
6293 ) -> fidl::Result<()> {
6294 decoder.debug_check_bounds::<Self>(offset);
6295 #[allow(unused_variables)]
6296 let next_out_of_line = decoder.next_out_of_line();
6297 let handles_before = decoder.remaining_handles();
6298 let (ordinal, inlined, num_bytes, num_handles) =
6299 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6300
6301 let member_inline_size = match ordinal {
6302 1 => <SendKeyboardInputCmd as fidl::encoding::TypeMarker>::inline_size(
6303 decoder.context,
6304 ),
6305 2 => <SendPointerInputCmd as fidl::encoding::TypeMarker>::inline_size(
6306 decoder.context,
6307 ),
6308 3 => <SetHardKeyboardDeliveryCmd as fidl::encoding::TypeMarker>::inline_size(
6309 decoder.context,
6310 ),
6311 4 => <SetParallelDispatchCmd as fidl::encoding::TypeMarker>::inline_size(
6312 decoder.context,
6313 ),
6314 _ => return Err(fidl::Error::UnknownUnionTag),
6315 };
6316
6317 if inlined != (member_inline_size <= 4) {
6318 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6319 }
6320 let _inner_offset;
6321 if inlined {
6322 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6323 _inner_offset = offset + 8;
6324 } else {
6325 depth.increment()?;
6326 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6327 }
6328 match ordinal {
6329 1 => {
6330 #[allow(irrefutable_let_patterns)]
6331 if let Command::SendKeyboardInput(_) = self {
6332 } else {
6334 *self =
6336 Command::SendKeyboardInput(fidl::new_empty!(SendKeyboardInputCmd, D));
6337 }
6338 #[allow(irrefutable_let_patterns)]
6339 if let Command::SendKeyboardInput(ref mut val) = self {
6340 fidl::decode!(SendKeyboardInputCmd, D, val, decoder, _inner_offset, depth)?;
6341 } else {
6342 unreachable!()
6343 }
6344 }
6345 2 => {
6346 #[allow(irrefutable_let_patterns)]
6347 if let Command::SendPointerInput(_) = self {
6348 } else {
6350 *self = Command::SendPointerInput(fidl::new_empty!(SendPointerInputCmd, D));
6352 }
6353 #[allow(irrefutable_let_patterns)]
6354 if let Command::SendPointerInput(ref mut val) = self {
6355 fidl::decode!(SendPointerInputCmd, D, val, decoder, _inner_offset, depth)?;
6356 } else {
6357 unreachable!()
6358 }
6359 }
6360 3 => {
6361 #[allow(irrefutable_let_patterns)]
6362 if let Command::SetHardKeyboardDelivery(_) = self {
6363 } else {
6365 *self = Command::SetHardKeyboardDelivery(fidl::new_empty!(
6367 SetHardKeyboardDeliveryCmd,
6368 D
6369 ));
6370 }
6371 #[allow(irrefutable_let_patterns)]
6372 if let Command::SetHardKeyboardDelivery(ref mut val) = self {
6373 fidl::decode!(
6374 SetHardKeyboardDeliveryCmd,
6375 D,
6376 val,
6377 decoder,
6378 _inner_offset,
6379 depth
6380 )?;
6381 } else {
6382 unreachable!()
6383 }
6384 }
6385 4 => {
6386 #[allow(irrefutable_let_patterns)]
6387 if let Command::SetParallelDispatch(_) = self {
6388 } else {
6390 *self = Command::SetParallelDispatch(fidl::new_empty!(
6392 SetParallelDispatchCmd,
6393 D
6394 ));
6395 }
6396 #[allow(irrefutable_let_patterns)]
6397 if let Command::SetParallelDispatch(ref mut val) = self {
6398 fidl::decode!(
6399 SetParallelDispatchCmd,
6400 D,
6401 val,
6402 decoder,
6403 _inner_offset,
6404 depth
6405 )?;
6406 } else {
6407 unreachable!()
6408 }
6409 }
6410 ordinal => panic!("unexpected ordinal {:?}", ordinal),
6411 }
6412 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6413 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6414 }
6415 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6416 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6417 }
6418 Ok(())
6419 }
6420 }
6421
6422 impl fidl::encoding::ValueTypeMarker for InputEvent {
6423 type Borrowed<'a> = &'a Self;
6424 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6425 value
6426 }
6427 }
6428
6429 unsafe impl fidl::encoding::TypeMarker for InputEvent {
6430 type Owned = Self;
6431
6432 #[inline(always)]
6433 fn inline_align(_context: fidl::encoding::Context) -> usize {
6434 8
6435 }
6436
6437 #[inline(always)]
6438 fn inline_size(_context: fidl::encoding::Context) -> usize {
6439 16
6440 }
6441 }
6442
6443 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InputEvent, D>
6444 for &InputEvent
6445 {
6446 #[inline]
6447 unsafe fn encode(
6448 self,
6449 encoder: &mut fidl::encoding::Encoder<'_, D>,
6450 offset: usize,
6451 _depth: fidl::encoding::Depth,
6452 ) -> fidl::Result<()> {
6453 encoder.debug_check_bounds::<InputEvent>(offset);
6454 encoder.write_num::<u64>(self.ordinal(), offset);
6455 match self {
6456 InputEvent::Pointer(ref val) => {
6457 fidl::encoding::encode_in_envelope::<PointerEvent, D>(
6458 <PointerEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
6459 encoder,
6460 offset + 8,
6461 _depth,
6462 )
6463 }
6464 InputEvent::Keyboard(ref val) => {
6465 fidl::encoding::encode_in_envelope::<KeyboardEvent, D>(
6466 <KeyboardEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
6467 encoder,
6468 offset + 8,
6469 _depth,
6470 )
6471 }
6472 InputEvent::Focus(ref val) => fidl::encoding::encode_in_envelope::<FocusEvent, D>(
6473 <FocusEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
6474 encoder,
6475 offset + 8,
6476 _depth,
6477 ),
6478 }
6479 }
6480 }
6481
6482 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InputEvent {
6483 #[inline(always)]
6484 fn new_empty() -> Self {
6485 Self::Pointer(fidl::new_empty!(PointerEvent, D))
6486 }
6487
6488 #[inline]
6489 unsafe fn decode(
6490 &mut self,
6491 decoder: &mut fidl::encoding::Decoder<'_, D>,
6492 offset: usize,
6493 mut depth: fidl::encoding::Depth,
6494 ) -> fidl::Result<()> {
6495 decoder.debug_check_bounds::<Self>(offset);
6496 #[allow(unused_variables)]
6497 let next_out_of_line = decoder.next_out_of_line();
6498 let handles_before = decoder.remaining_handles();
6499 let (ordinal, inlined, num_bytes, num_handles) =
6500 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6501
6502 let member_inline_size = match ordinal {
6503 1 => <PointerEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6504 2 => <KeyboardEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6505 3 => <FocusEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6506 _ => return Err(fidl::Error::UnknownUnionTag),
6507 };
6508
6509 if inlined != (member_inline_size <= 4) {
6510 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6511 }
6512 let _inner_offset;
6513 if inlined {
6514 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6515 _inner_offset = offset + 8;
6516 } else {
6517 depth.increment()?;
6518 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6519 }
6520 match ordinal {
6521 1 => {
6522 #[allow(irrefutable_let_patterns)]
6523 if let InputEvent::Pointer(_) = self {
6524 } else {
6526 *self = InputEvent::Pointer(fidl::new_empty!(PointerEvent, D));
6528 }
6529 #[allow(irrefutable_let_patterns)]
6530 if let InputEvent::Pointer(ref mut val) = self {
6531 fidl::decode!(PointerEvent, D, val, decoder, _inner_offset, depth)?;
6532 } else {
6533 unreachable!()
6534 }
6535 }
6536 2 => {
6537 #[allow(irrefutable_let_patterns)]
6538 if let InputEvent::Keyboard(_) = self {
6539 } else {
6541 *self = InputEvent::Keyboard(fidl::new_empty!(KeyboardEvent, D));
6543 }
6544 #[allow(irrefutable_let_patterns)]
6545 if let InputEvent::Keyboard(ref mut val) = self {
6546 fidl::decode!(KeyboardEvent, D, val, decoder, _inner_offset, depth)?;
6547 } else {
6548 unreachable!()
6549 }
6550 }
6551 3 => {
6552 #[allow(irrefutable_let_patterns)]
6553 if let InputEvent::Focus(_) = self {
6554 } else {
6556 *self = InputEvent::Focus(fidl::new_empty!(FocusEvent, D));
6558 }
6559 #[allow(irrefutable_let_patterns)]
6560 if let InputEvent::Focus(ref mut val) = self {
6561 fidl::decode!(FocusEvent, D, val, decoder, _inner_offset, depth)?;
6562 } else {
6563 unreachable!()
6564 }
6565 }
6566 ordinal => panic!("unexpected ordinal {:?}", ordinal),
6567 }
6568 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6569 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6570 }
6571 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6572 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6573 }
6574 Ok(())
6575 }
6576 }
6577
6578 impl fidl::encoding::ValueTypeMarker for SensorReport {
6579 type Borrowed<'a> = &'a Self;
6580 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6581 value
6582 }
6583 }
6584
6585 unsafe impl fidl::encoding::TypeMarker for SensorReport {
6586 type Owned = Self;
6587
6588 #[inline(always)]
6589 fn inline_align(_context: fidl::encoding::Context) -> usize {
6590 8
6591 }
6592
6593 #[inline(always)]
6594 fn inline_size(_context: fidl::encoding::Context) -> usize {
6595 16
6596 }
6597 }
6598
6599 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SensorReport, D>
6600 for &SensorReport
6601 {
6602 #[inline]
6603 unsafe fn encode(
6604 self,
6605 encoder: &mut fidl::encoding::Encoder<'_, D>,
6606 offset: usize,
6607 _depth: fidl::encoding::Depth,
6608 ) -> fidl::Result<()> {
6609 encoder.debug_check_bounds::<SensorReport>(offset);
6610 encoder.write_num::<u64>(self.ordinal(), offset);
6611 match self {
6612 SensorReport::Vector(ref val) => fidl::encoding::encode_in_envelope::<
6613 fidl::encoding::Array<i16, 3>,
6614 D,
6615 >(
6616 <fidl::encoding::Array<i16, 3> as fidl::encoding::ValueTypeMarker>::borrow(val),
6617 encoder,
6618 offset + 8,
6619 _depth,
6620 ),
6621 SensorReport::Scalar(ref val) => fidl::encoding::encode_in_envelope::<u16, D>(
6622 <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
6623 encoder,
6624 offset + 8,
6625 _depth,
6626 ),
6627 }
6628 }
6629 }
6630
6631 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SensorReport {
6632 #[inline(always)]
6633 fn new_empty() -> Self {
6634 Self::Vector(fidl::new_empty!(fidl::encoding::Array<i16, 3>, D))
6635 }
6636
6637 #[inline]
6638 unsafe fn decode(
6639 &mut self,
6640 decoder: &mut fidl::encoding::Decoder<'_, D>,
6641 offset: usize,
6642 mut depth: fidl::encoding::Depth,
6643 ) -> fidl::Result<()> {
6644 decoder.debug_check_bounds::<Self>(offset);
6645 #[allow(unused_variables)]
6646 let next_out_of_line = decoder.next_out_of_line();
6647 let handles_before = decoder.remaining_handles();
6648 let (ordinal, inlined, num_bytes, num_handles) =
6649 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6650
6651 let member_inline_size = match ordinal {
6652 1 => <fidl::encoding::Array<i16, 3> as fidl::encoding::TypeMarker>::inline_size(
6653 decoder.context,
6654 ),
6655 2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6656 _ => return Err(fidl::Error::UnknownUnionTag),
6657 };
6658
6659 if inlined != (member_inline_size <= 4) {
6660 return Err(fidl::Error::InvalidInlineBitInEnvelope);
6661 }
6662 let _inner_offset;
6663 if inlined {
6664 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6665 _inner_offset = offset + 8;
6666 } else {
6667 depth.increment()?;
6668 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6669 }
6670 match ordinal {
6671 1 => {
6672 #[allow(irrefutable_let_patterns)]
6673 if let SensorReport::Vector(_) = self {
6674 } else {
6676 *self = SensorReport::Vector(
6678 fidl::new_empty!(fidl::encoding::Array<i16, 3>, D),
6679 );
6680 }
6681 #[allow(irrefutable_let_patterns)]
6682 if let SensorReport::Vector(ref mut val) = self {
6683 fidl::decode!(fidl::encoding::Array<i16, 3>, D, val, decoder, _inner_offset, depth)?;
6684 } else {
6685 unreachable!()
6686 }
6687 }
6688 2 => {
6689 #[allow(irrefutable_let_patterns)]
6690 if let SensorReport::Scalar(_) = self {
6691 } else {
6693 *self = SensorReport::Scalar(fidl::new_empty!(u16, D));
6695 }
6696 #[allow(irrefutable_let_patterns)]
6697 if let SensorReport::Scalar(ref mut val) = self {
6698 fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
6699 } else {
6700 unreachable!()
6701 }
6702 }
6703 ordinal => panic!("unexpected ordinal {:?}", ordinal),
6704 }
6705 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6706 return Err(fidl::Error::InvalidNumBytesInEnvelope);
6707 }
6708 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6709 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6710 }
6711 Ok(())
6712 }
6713 }
6714}