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