1#![warn(clippy::all)]
3#![allow(unused_parens, unused_variables, unused_mut, unused_imports, unreachable_code)]
4
5pub mod natural {
6
7 pub use fidl_next_common_fuchsia_input_report::natural::*;
8
9 #[derive(Debug, PartialEq)]
10 #[repr(C)]
11 pub struct InputDeviceGetInputReportsReaderRequest {
12 pub reader:
13 ::fidl_next::ServerEnd<crate::InputReportsReader, ::fidl_next::fuchsia::zx::Channel>,
14 }
15
16 unsafe impl<___E>
17 ::fidl_next::Encode<crate::wire::InputDeviceGetInputReportsReaderRequest, ___E>
18 for InputDeviceGetInputReportsReaderRequest
19 where
20 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
21 ___E: ::fidl_next::fuchsia::HandleEncoder,
22 {
23 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
24 Self,
25 crate::wire::InputDeviceGetInputReportsReaderRequest,
26 > = unsafe {
27 ::fidl_next::CopyOptimization::enable_if(
28 true && <::fidl_next::ServerEnd<
29 crate::InputReportsReader,
30 ::fidl_next::fuchsia::zx::Channel,
31 > as ::fidl_next::Encode<
32 ::fidl_next::ServerEnd<
33 crate::InputReportsReader,
34 ::fidl_next::wire::fuchsia::Channel,
35 >,
36 ___E,
37 >>::COPY_OPTIMIZATION
38 .is_enabled(),
39 )
40 };
41
42 #[inline]
43 fn encode(
44 self,
45 encoder_: &mut ___E,
46 out_: &mut ::core::mem::MaybeUninit<
47 crate::wire::InputDeviceGetInputReportsReaderRequest,
48 >,
49 _: (),
50 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
51 ::fidl_next::munge! {
52 let crate::wire::InputDeviceGetInputReportsReaderRequest {
53 reader,
54
55 } = out_;
56 }
57
58 ::fidl_next::Encode::encode(self.reader, encoder_, reader, ())?;
59
60 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(reader.as_mut_ptr()) };
61
62 Ok(())
63 }
64 }
65
66 unsafe impl<___E>
67 ::fidl_next::EncodeOption<
68 ::fidl_next::wire::Box<'static, crate::wire::InputDeviceGetInputReportsReaderRequest>,
69 ___E,
70 > for InputDeviceGetInputReportsReaderRequest
71 where
72 ___E: ::fidl_next::Encoder + ?Sized,
73 InputDeviceGetInputReportsReaderRequest:
74 ::fidl_next::Encode<crate::wire::InputDeviceGetInputReportsReaderRequest, ___E>,
75 {
76 #[inline]
77 fn encode_option(
78 this: ::core::option::Option<Self>,
79 encoder: &mut ___E,
80 out: &mut ::core::mem::MaybeUninit<
81 ::fidl_next::wire::Box<
82 'static,
83 crate::wire::InputDeviceGetInputReportsReaderRequest,
84 >,
85 >,
86 _: (),
87 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
88 if let Some(inner) = this {
89 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
90 ::fidl_next::wire::Box::encode_present(out);
91 } else {
92 ::fidl_next::wire::Box::encode_absent(out);
93 }
94
95 Ok(())
96 }
97 }
98
99 impl ::fidl_next::FromWire<crate::wire::InputDeviceGetInputReportsReaderRequest>
100 for InputDeviceGetInputReportsReaderRequest
101 {
102 const COPY_OPTIMIZATION: ::fidl_next::CopyOptimization<
103 crate::wire::InputDeviceGetInputReportsReaderRequest,
104 Self,
105 > = unsafe {
106 ::fidl_next::CopyOptimization::enable_if(
107 true && <::fidl_next::ServerEnd<
108 crate::InputReportsReader,
109 ::fidl_next::fuchsia::zx::Channel,
110 > as ::fidl_next::FromWire<
111 ::fidl_next::ServerEnd<
112 crate::InputReportsReader,
113 ::fidl_next::wire::fuchsia::Channel,
114 >,
115 >>::COPY_OPTIMIZATION
116 .is_enabled(),
117 )
118 };
119
120 #[inline]
121 fn from_wire(wire: crate::wire::InputDeviceGetInputReportsReaderRequest) -> Self {
122 Self { reader: ::fidl_next::FromWire::from_wire(wire.reader) }
123 }
124 }
125
126 #[doc = " An `InputReport` is a single report that is created by an input device.\n An `InputReport` can contain one of many different report types. The report\n types are not mutually exclusive. The `event_time` is the time in\n nanoseconds when the report was generated.\n"]
127 #[derive(Debug, Default, PartialEq)]
128 pub struct InputReport {
129 pub event_time: ::core::option::Option<i64>,
130
131 pub mouse: ::core::option::Option<crate::natural::MouseInputReport>,
132
133 pub sensor: ::core::option::Option<crate::natural::SensorInputReport>,
134
135 pub touch: ::core::option::Option<crate::natural::TouchInputReport>,
136
137 pub keyboard: ::core::option::Option<crate::natural::KeyboardInputReport>,
138
139 pub consumer_control: ::core::option::Option<crate::natural::ConsumerControlInputReport>,
140
141 pub trace_id: ::core::option::Option<u64>,
142
143 pub report_id: ::core::option::Option<u8>,
144
145 pub wake_lease: ::core::option::Option<::fidl_next::fuchsia::zx::EventPair>,
146 }
147
148 impl InputReport {
149 fn __max_ordinal(&self) -> usize {
150 if self.wake_lease.is_some() {
151 return 9;
152 }
153
154 if self.report_id.is_some() {
155 return 8;
156 }
157
158 if self.trace_id.is_some() {
159 return 7;
160 }
161
162 if self.consumer_control.is_some() {
163 return 6;
164 }
165
166 if self.keyboard.is_some() {
167 return 5;
168 }
169
170 if self.touch.is_some() {
171 return 4;
172 }
173
174 if self.sensor.is_some() {
175 return 3;
176 }
177
178 if self.mouse.is_some() {
179 return 2;
180 }
181
182 if self.event_time.is_some() {
183 return 1;
184 }
185
186 0
187 }
188 }
189
190 unsafe impl<___E> ::fidl_next::Encode<crate::wire::InputReport<'static>, ___E> for InputReport
191 where
192 ___E: ::fidl_next::Encoder + ?Sized,
193 ___E: ::fidl_next::fuchsia::HandleEncoder,
194 {
195 #[inline]
196 fn encode(
197 mut self,
198 encoder: &mut ___E,
199 out: &mut ::core::mem::MaybeUninit<crate::wire::InputReport<'static>>,
200 _: (),
201 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
202 ::fidl_next::munge!(let crate::wire::InputReport { table } = out);
203
204 let max_ord = self.__max_ordinal();
205
206 let mut out = ::core::mem::MaybeUninit::<::fidl_next::wire::Envelope>::uninit();
207 ::fidl_next::Wire::zero_padding(&mut out);
208
209 let mut preallocated = ::fidl_next::EncoderExt::preallocate::<
210 ::fidl_next::wire::Envelope,
211 >(encoder, max_ord);
212
213 for i in 1..=max_ord {
214 match i {
215 9 => {
216 if let Some(value) = self.wake_lease.take() {
217 ::fidl_next::wire::Envelope::encode_value::<
218 ::fidl_next::wire::fuchsia::EventPair,
219 ___E,
220 >(
221 value, preallocated.encoder, &mut out, ()
222 )?;
223 } else {
224 ::fidl_next::wire::Envelope::encode_zero(&mut out)
225 }
226 }
227
228 8 => {
229 if let Some(value) = self.report_id.take() {
230 ::fidl_next::wire::Envelope::encode_value::<u8, ___E>(
231 value,
232 preallocated.encoder,
233 &mut out,
234 (),
235 )?;
236 } else {
237 ::fidl_next::wire::Envelope::encode_zero(&mut out)
238 }
239 }
240
241 7 => {
242 if let Some(value) = self.trace_id.take() {
243 ::fidl_next::wire::Envelope::encode_value::<
244 ::fidl_next::wire::Uint64,
245 ___E,
246 >(
247 value, preallocated.encoder, &mut out, ()
248 )?;
249 } else {
250 ::fidl_next::wire::Envelope::encode_zero(&mut out)
251 }
252 }
253
254 6 => {
255 if let Some(value) = self.consumer_control.take() {
256 ::fidl_next::wire::Envelope::encode_value::<
257 crate::wire::ConsumerControlInputReport<'static>,
258 ___E,
259 >(
260 value, preallocated.encoder, &mut out, ()
261 )?;
262 } else {
263 ::fidl_next::wire::Envelope::encode_zero(&mut out)
264 }
265 }
266
267 5 => {
268 if let Some(value) = self.keyboard.take() {
269 ::fidl_next::wire::Envelope::encode_value::<
270 crate::wire::KeyboardInputReport<'static>,
271 ___E,
272 >(
273 value, preallocated.encoder, &mut out, ()
274 )?;
275 } else {
276 ::fidl_next::wire::Envelope::encode_zero(&mut out)
277 }
278 }
279
280 4 => {
281 if let Some(value) = self.touch.take() {
282 ::fidl_next::wire::Envelope::encode_value::<
283 crate::wire::TouchInputReport<'static>,
284 ___E,
285 >(
286 value, preallocated.encoder, &mut out, ()
287 )?;
288 } else {
289 ::fidl_next::wire::Envelope::encode_zero(&mut out)
290 }
291 }
292
293 3 => {
294 if let Some(value) = self.sensor.take() {
295 ::fidl_next::wire::Envelope::encode_value::<
296 crate::wire::SensorInputReport<'static>,
297 ___E,
298 >(
299 value, preallocated.encoder, &mut out, ()
300 )?;
301 } else {
302 ::fidl_next::wire::Envelope::encode_zero(&mut out)
303 }
304 }
305
306 2 => {
307 if let Some(value) = self.mouse.take() {
308 ::fidl_next::wire::Envelope::encode_value::<
309 crate::wire::MouseInputReport<'static>,
310 ___E,
311 >(
312 value, preallocated.encoder, &mut out, ()
313 )?;
314 } else {
315 ::fidl_next::wire::Envelope::encode_zero(&mut out)
316 }
317 }
318
319 1 => {
320 if let Some(value) = self.event_time.take() {
321 ::fidl_next::wire::Envelope::encode_value::<
322 ::fidl_next::wire::Int64,
323 ___E,
324 >(
325 value, preallocated.encoder, &mut out, ()
326 )?;
327 } else {
328 ::fidl_next::wire::Envelope::encode_zero(&mut out)
329 }
330 }
331
332 _ => ::fidl_next::wire::Envelope::encode_zero(&mut out),
333 }
334 unsafe {
335 preallocated.write_next(out.assume_init_ref());
336 }
337 }
338
339 ::fidl_next::wire::Table::encode_len(table, max_ord);
340
341 Ok(())
342 }
343 }
344
345 impl<'de> ::fidl_next::FromWire<crate::wire::InputReport<'de>> for InputReport {
346 #[inline]
347 fn from_wire(wire_: crate::wire::InputReport<'de>) -> Self {
348 let wire_ = ::core::mem::ManuallyDrop::new(wire_);
349
350 let event_time = wire_.table.get(1);
351
352 let mouse = wire_.table.get(2);
353
354 let sensor = wire_.table.get(3);
355
356 let touch = wire_.table.get(4);
357
358 let keyboard = wire_.table.get(5);
359
360 let consumer_control = wire_.table.get(6);
361
362 let trace_id = wire_.table.get(7);
363
364 let report_id = wire_.table.get(8);
365
366 let wake_lease = wire_.table.get(9);
367
368 Self {
369 event_time: event_time.map(|envelope| {
370 ::fidl_next::FromWire::from_wire(unsafe {
371 envelope.read_unchecked::<::fidl_next::wire::Int64>()
372 })
373 }),
374
375 mouse: mouse.map(|envelope| {
376 ::fidl_next::FromWire::from_wire(unsafe {
377 envelope.read_unchecked::<crate::wire::MouseInputReport<'de>>()
378 })
379 }),
380
381 sensor: sensor.map(|envelope| {
382 ::fidl_next::FromWire::from_wire(unsafe {
383 envelope.read_unchecked::<crate::wire::SensorInputReport<'de>>()
384 })
385 }),
386
387 touch: touch.map(|envelope| {
388 ::fidl_next::FromWire::from_wire(unsafe {
389 envelope.read_unchecked::<crate::wire::TouchInputReport<'de>>()
390 })
391 }),
392
393 keyboard: keyboard.map(|envelope| {
394 ::fidl_next::FromWire::from_wire(unsafe {
395 envelope.read_unchecked::<crate::wire::KeyboardInputReport<'de>>()
396 })
397 }),
398
399 consumer_control: consumer_control.map(|envelope| {
400 ::fidl_next::FromWire::from_wire(unsafe {
401 envelope.read_unchecked::<crate::wire::ConsumerControlInputReport<'de>>()
402 })
403 }),
404
405 trace_id: trace_id.map(|envelope| {
406 ::fidl_next::FromWire::from_wire(unsafe {
407 envelope.read_unchecked::<::fidl_next::wire::Uint64>()
408 })
409 }),
410
411 report_id: report_id.map(|envelope| {
412 ::fidl_next::FromWire::from_wire(unsafe { envelope.read_unchecked::<u8>() })
413 }),
414
415 wake_lease: wake_lease.map(|envelope| {
416 ::fidl_next::FromWire::from_wire(unsafe {
417 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
418 })
419 }),
420 }
421 }
422 }
423
424 #[derive(Debug, PartialEq)]
425 pub struct InputDeviceGetInputReportResponse {
426 pub report: crate::natural::InputReport,
427 }
428
429 unsafe impl<___E>
430 ::fidl_next::Encode<crate::wire::InputDeviceGetInputReportResponse<'static>, ___E>
431 for InputDeviceGetInputReportResponse
432 where
433 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
434 ___E: ::fidl_next::Encoder,
435 ___E: ::fidl_next::fuchsia::HandleEncoder,
436 {
437 #[inline]
438 fn encode(
439 self,
440 encoder_: &mut ___E,
441 out_: &mut ::core::mem::MaybeUninit<
442 crate::wire::InputDeviceGetInputReportResponse<'static>,
443 >,
444 _: (),
445 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
446 ::fidl_next::munge! {
447 let crate::wire::InputDeviceGetInputReportResponse {
448 report,
449
450 } = out_;
451 }
452
453 ::fidl_next::Encode::encode(self.report, encoder_, report, ())?;
454
455 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(report.as_mut_ptr()) };
456
457 Ok(())
458 }
459 }
460
461 unsafe impl<___E>
462 ::fidl_next::EncodeOption<
463 ::fidl_next::wire::Box<
464 'static,
465 crate::wire::InputDeviceGetInputReportResponse<'static>,
466 >,
467 ___E,
468 > for InputDeviceGetInputReportResponse
469 where
470 ___E: ::fidl_next::Encoder + ?Sized,
471 InputDeviceGetInputReportResponse:
472 ::fidl_next::Encode<crate::wire::InputDeviceGetInputReportResponse<'static>, ___E>,
473 {
474 #[inline]
475 fn encode_option(
476 this: ::core::option::Option<Self>,
477 encoder: &mut ___E,
478 out: &mut ::core::mem::MaybeUninit<
479 ::fidl_next::wire::Box<
480 'static,
481 crate::wire::InputDeviceGetInputReportResponse<'static>,
482 >,
483 >,
484 _: (),
485 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
486 if let Some(inner) = this {
487 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
488 ::fidl_next::wire::Box::encode_present(out);
489 } else {
490 ::fidl_next::wire::Box::encode_absent(out);
491 }
492
493 Ok(())
494 }
495 }
496
497 impl<'de> ::fidl_next::FromWire<crate::wire::InputDeviceGetInputReportResponse<'de>>
498 for InputDeviceGetInputReportResponse
499 {
500 #[inline]
501 fn from_wire(wire: crate::wire::InputDeviceGetInputReportResponse<'de>) -> Self {
502 Self { report: ::fidl_next::FromWire::from_wire(wire.report) }
503 }
504 }
505
506 #[derive(Debug, PartialEq)]
507 pub struct InputReportsReaderReadInputReportsResponse {
508 pub reports: ::std::vec::Vec<crate::natural::InputReport>,
509 }
510
511 unsafe impl<___E>
512 ::fidl_next::Encode<crate::wire::InputReportsReaderReadInputReportsResponse<'static>, ___E>
513 for InputReportsReaderReadInputReportsResponse
514 where
515 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
516 ___E: ::fidl_next::Encoder,
517 ___E: ::fidl_next::fuchsia::HandleEncoder,
518 {
519 #[inline]
520 fn encode(
521 self,
522 encoder_: &mut ___E,
523 out_: &mut ::core::mem::MaybeUninit<
524 crate::wire::InputReportsReaderReadInputReportsResponse<'static>,
525 >,
526 _: (),
527 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
528 ::fidl_next::munge! {
529 let crate::wire::InputReportsReaderReadInputReportsResponse {
530 reports,
531
532 } = out_;
533 }
534
535 ::fidl_next::Encode::encode(self.reports, encoder_, reports, (50, ()))?;
536
537 let mut _field = unsafe { ::fidl_next::Slot::new_unchecked(reports.as_mut_ptr()) };
538 ::fidl_next::Constrained::validate(_field, (50, ()))?;
539
540 Ok(())
541 }
542 }
543
544 unsafe impl<___E>
545 ::fidl_next::EncodeOption<
546 ::fidl_next::wire::Box<
547 'static,
548 crate::wire::InputReportsReaderReadInputReportsResponse<'static>,
549 >,
550 ___E,
551 > for InputReportsReaderReadInputReportsResponse
552 where
553 ___E: ::fidl_next::Encoder + ?Sized,
554 InputReportsReaderReadInputReportsResponse: ::fidl_next::Encode<
555 crate::wire::InputReportsReaderReadInputReportsResponse<'static>,
556 ___E,
557 >,
558 {
559 #[inline]
560 fn encode_option(
561 this: ::core::option::Option<Self>,
562 encoder: &mut ___E,
563 out: &mut ::core::mem::MaybeUninit<
564 ::fidl_next::wire::Box<
565 'static,
566 crate::wire::InputReportsReaderReadInputReportsResponse<'static>,
567 >,
568 >,
569 _: (),
570 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
571 if let Some(inner) = this {
572 ::fidl_next::EncoderExt::encode_next(encoder, inner)?;
573 ::fidl_next::wire::Box::encode_present(out);
574 } else {
575 ::fidl_next::wire::Box::encode_absent(out);
576 }
577
578 Ok(())
579 }
580 }
581
582 impl<'de> ::fidl_next::FromWire<crate::wire::InputReportsReaderReadInputReportsResponse<'de>>
583 for InputReportsReaderReadInputReportsResponse
584 {
585 #[inline]
586 fn from_wire(wire: crate::wire::InputReportsReaderReadInputReportsResponse<'de>) -> Self {
587 Self { reports: ::fidl_next::FromWire::from_wire(wire.reports) }
588 }
589 }
590}
591
592pub mod wire {
593
594 pub use fidl_next_common_fuchsia_input_report::wire::*;
595
596 #[derive(Debug)]
598 #[repr(C)]
599 pub struct InputDeviceGetInputReportsReaderRequest {
600 pub reader:
601 ::fidl_next::ServerEnd<crate::InputReportsReader, ::fidl_next::wire::fuchsia::Channel>,
602 }
603
604 static_assertions::const_assert_eq!(
605 std::mem::size_of::<InputDeviceGetInputReportsReaderRequest>(),
606 4
607 );
608 static_assertions::const_assert_eq!(
609 std::mem::align_of::<InputDeviceGetInputReportsReaderRequest>(),
610 4
611 );
612
613 static_assertions::const_assert_eq!(
614 std::mem::offset_of!(InputDeviceGetInputReportsReaderRequest, reader),
615 0
616 );
617
618 impl ::fidl_next::Constrained for InputDeviceGetInputReportsReaderRequest {
619 type Constraint = ();
620
621 fn validate(
622 _: ::fidl_next::Slot<'_, Self>,
623 _: Self::Constraint,
624 ) -> Result<(), ::fidl_next::ValidationError> {
625 Ok(())
626 }
627 }
628
629 unsafe impl ::fidl_next::Wire for InputDeviceGetInputReportsReaderRequest {
630 type Narrowed<'de> = InputDeviceGetInputReportsReaderRequest;
631
632 #[inline]
633 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
634 ::fidl_next::munge! {
635 let Self {
636 reader,
637
638 } = &mut *out_;
639 }
640
641 ::fidl_next::Wire::zero_padding(reader);
642 }
643 }
644
645 unsafe impl<___D> ::fidl_next::Decode<___D> for InputDeviceGetInputReportsReaderRequest
646 where
647 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
648 ___D: ::fidl_next::fuchsia::HandleDecoder,
649 {
650 fn decode(
651 slot_: ::fidl_next::Slot<'_, Self>,
652 decoder_: &mut ___D,
653 _: (),
654 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
655 ::fidl_next::munge! {
656 let Self {
657 mut reader,
658
659 } = slot_;
660 }
661
662 let _field = reader.as_mut();
663
664 ::fidl_next::Decode::decode(reader.as_mut(), decoder_, ())?;
665
666 Ok(())
667 }
668 }
669
670 impl ::fidl_next::IntoNatural for InputDeviceGetInputReportsReaderRequest {
671 type Natural = crate::natural::InputDeviceGetInputReportsReaderRequest;
672 }
673
674 #[repr(C)]
676 pub struct InputReport<'de> {
677 pub(crate) table: ::fidl_next::wire::Table<'de>,
678 }
679
680 impl<'de> Drop for InputReport<'de> {
681 fn drop(&mut self) {
682 let _ = self
683 .table
684 .get(1)
685 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Int64>() });
686
687 let _ = self.table.get(2).map(|envelope| unsafe {
688 envelope.read_unchecked::<crate::wire::MouseInputReport<'de>>()
689 });
690
691 let _ = self.table.get(3).map(|envelope| unsafe {
692 envelope.read_unchecked::<crate::wire::SensorInputReport<'de>>()
693 });
694
695 let _ = self.table.get(4).map(|envelope| unsafe {
696 envelope.read_unchecked::<crate::wire::TouchInputReport<'de>>()
697 });
698
699 let _ = self.table.get(5).map(|envelope| unsafe {
700 envelope.read_unchecked::<crate::wire::KeyboardInputReport<'de>>()
701 });
702
703 let _ = self.table.get(6).map(|envelope| unsafe {
704 envelope.read_unchecked::<crate::wire::ConsumerControlInputReport<'de>>()
705 });
706
707 let _ = self
708 .table
709 .get(7)
710 .map(|envelope| unsafe { envelope.read_unchecked::<::fidl_next::wire::Uint64>() });
711
712 let _ = self.table.get(8).map(|envelope| unsafe { envelope.read_unchecked::<u8>() });
713
714 let _ = self.table.get(9).map(|envelope| unsafe {
715 envelope.read_unchecked::<::fidl_next::wire::fuchsia::EventPair>()
716 });
717 }
718 }
719
720 impl ::fidl_next::Constrained for InputReport<'_> {
721 type Constraint = ();
722
723 fn validate(
724 _: ::fidl_next::Slot<'_, Self>,
725 _: Self::Constraint,
726 ) -> Result<(), ::fidl_next::ValidationError> {
727 Ok(())
728 }
729 }
730
731 unsafe impl ::fidl_next::Wire for InputReport<'static> {
732 type Narrowed<'de> = InputReport<'de>;
733
734 #[inline]
735 fn zero_padding(out: &mut ::core::mem::MaybeUninit<Self>) {
736 ::fidl_next::munge!(let Self { table } = out);
737 ::fidl_next::wire::Table::zero_padding(table);
738 }
739 }
740
741 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for InputReport<'de>
742 where
743 ___D: ::fidl_next::Decoder<'de> + ?Sized,
744 ___D: ::fidl_next::fuchsia::HandleDecoder,
745 {
746 fn decode(
747 slot: ::fidl_next::Slot<'_, Self>,
748 decoder: &mut ___D,
749 _: (),
750 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
751 ::fidl_next::munge!(let Self { table } = slot);
752
753 ::fidl_next::wire::Table::decode_with(table, decoder, |ordinal, mut slot, decoder| {
754 match ordinal {
755 0 => unsafe { ::core::hint::unreachable_unchecked() },
756
757 1 => {
758 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Int64>(
759 slot.as_mut(),
760 decoder,
761 (),
762 )?;
763
764 Ok(())
765 }
766
767 2 => {
768 ::fidl_next::wire::Envelope::decode_as::<
769 ___D,
770 crate::wire::MouseInputReport<'de>,
771 >(slot.as_mut(), decoder, ())?;
772
773 Ok(())
774 }
775
776 3 => {
777 ::fidl_next::wire::Envelope::decode_as::<
778 ___D,
779 crate::wire::SensorInputReport<'de>,
780 >(slot.as_mut(), decoder, ())?;
781
782 Ok(())
783 }
784
785 4 => {
786 ::fidl_next::wire::Envelope::decode_as::<
787 ___D,
788 crate::wire::TouchInputReport<'de>,
789 >(slot.as_mut(), decoder, ())?;
790
791 Ok(())
792 }
793
794 5 => {
795 ::fidl_next::wire::Envelope::decode_as::<
796 ___D,
797 crate::wire::KeyboardInputReport<'de>,
798 >(slot.as_mut(), decoder, ())?;
799
800 Ok(())
801 }
802
803 6 => {
804 ::fidl_next::wire::Envelope::decode_as::<
805 ___D,
806 crate::wire::ConsumerControlInputReport<'de>,
807 >(slot.as_mut(), decoder, ())?;
808
809 Ok(())
810 }
811
812 7 => {
813 ::fidl_next::wire::Envelope::decode_as::<___D, ::fidl_next::wire::Uint64>(
814 slot.as_mut(),
815 decoder,
816 (),
817 )?;
818
819 Ok(())
820 }
821
822 8 => {
823 ::fidl_next::wire::Envelope::decode_as::<___D, u8>(
824 slot.as_mut(),
825 decoder,
826 (),
827 )?;
828
829 Ok(())
830 }
831
832 9 => {
833 ::fidl_next::wire::Envelope::decode_as::<
834 ___D,
835 ::fidl_next::wire::fuchsia::EventPair,
836 >(slot.as_mut(), decoder, ())?;
837
838 Ok(())
839 }
840
841 _ => ::fidl_next::wire::Envelope::decode_unknown(slot, decoder),
842 }
843 })
844 }
845 }
846
847 impl<'de> InputReport<'de> {
848 pub fn event_time(&self) -> ::core::option::Option<&::fidl_next::wire::Int64> {
849 unsafe { Some(self.table.get(1)?.deref_unchecked()) }
850 }
851
852 pub fn mouse(&self) -> ::core::option::Option<&crate::wire::MouseInputReport<'de>> {
853 unsafe { Some(self.table.get(2)?.deref_unchecked()) }
854 }
855
856 pub fn sensor(&self) -> ::core::option::Option<&crate::wire::SensorInputReport<'de>> {
857 unsafe { Some(self.table.get(3)?.deref_unchecked()) }
858 }
859
860 pub fn touch(&self) -> ::core::option::Option<&crate::wire::TouchInputReport<'de>> {
861 unsafe { Some(self.table.get(4)?.deref_unchecked()) }
862 }
863
864 pub fn keyboard(&self) -> ::core::option::Option<&crate::wire::KeyboardInputReport<'de>> {
865 unsafe { Some(self.table.get(5)?.deref_unchecked()) }
866 }
867
868 pub fn consumer_control(
869 &self,
870 ) -> ::core::option::Option<&crate::wire::ConsumerControlInputReport<'de>> {
871 unsafe { Some(self.table.get(6)?.deref_unchecked()) }
872 }
873
874 pub fn trace_id(&self) -> ::core::option::Option<&::fidl_next::wire::Uint64> {
875 unsafe { Some(self.table.get(7)?.deref_unchecked()) }
876 }
877
878 pub fn report_id(&self) -> ::core::option::Option<&u8> {
879 unsafe { Some(self.table.get(8)?.deref_unchecked()) }
880 }
881
882 pub fn wake_lease(&self) -> ::core::option::Option<&::fidl_next::wire::fuchsia::EventPair> {
883 unsafe { Some(self.table.get(9)?.deref_unchecked()) }
884 }
885 }
886
887 impl<'de> ::core::fmt::Debug for InputReport<'de> {
888 fn fmt(
889 &self,
890 f: &mut ::core::fmt::Formatter<'_>,
891 ) -> ::core::result::Result<(), ::core::fmt::Error> {
892 f.debug_struct("InputReport")
893 .field("event_time", &self.event_time())
894 .field("mouse", &self.mouse())
895 .field("sensor", &self.sensor())
896 .field("touch", &self.touch())
897 .field("keyboard", &self.keyboard())
898 .field("consumer_control", &self.consumer_control())
899 .field("trace_id", &self.trace_id())
900 .field("report_id", &self.report_id())
901 .field("wake_lease", &self.wake_lease())
902 .finish()
903 }
904 }
905
906 impl<'de> ::fidl_next::IntoNatural for InputReport<'de> {
907 type Natural = crate::natural::InputReport;
908 }
909
910 #[derive(Debug)]
912 #[repr(C)]
913 pub struct InputDeviceGetInputReportResponse<'de> {
914 pub report: crate::wire::InputReport<'de>,
915 }
916
917 static_assertions::const_assert_eq!(
918 std::mem::size_of::<InputDeviceGetInputReportResponse<'_>>(),
919 16
920 );
921 static_assertions::const_assert_eq!(
922 std::mem::align_of::<InputDeviceGetInputReportResponse<'_>>(),
923 8
924 );
925
926 static_assertions::const_assert_eq!(
927 std::mem::offset_of!(InputDeviceGetInputReportResponse<'_>, report),
928 0
929 );
930
931 impl ::fidl_next::Constrained for InputDeviceGetInputReportResponse<'_> {
932 type Constraint = ();
933
934 fn validate(
935 _: ::fidl_next::Slot<'_, Self>,
936 _: Self::Constraint,
937 ) -> Result<(), ::fidl_next::ValidationError> {
938 Ok(())
939 }
940 }
941
942 unsafe impl ::fidl_next::Wire for InputDeviceGetInputReportResponse<'static> {
943 type Narrowed<'de> = InputDeviceGetInputReportResponse<'de>;
944
945 #[inline]
946 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
947 ::fidl_next::munge! {
948 let Self {
949 report,
950
951 } = &mut *out_;
952 }
953
954 ::fidl_next::Wire::zero_padding(report);
955 }
956 }
957
958 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for InputDeviceGetInputReportResponse<'de>
959 where
960 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
961 ___D: ::fidl_next::Decoder<'de>,
962 ___D: ::fidl_next::fuchsia::HandleDecoder,
963 {
964 fn decode(
965 slot_: ::fidl_next::Slot<'_, Self>,
966 decoder_: &mut ___D,
967 _: (),
968 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
969 ::fidl_next::munge! {
970 let Self {
971 mut report,
972
973 } = slot_;
974 }
975
976 let _field = report.as_mut();
977
978 ::fidl_next::Decode::decode(report.as_mut(), decoder_, ())?;
979
980 Ok(())
981 }
982 }
983
984 impl<'de> ::fidl_next::IntoNatural for InputDeviceGetInputReportResponse<'de> {
985 type Natural = crate::natural::InputDeviceGetInputReportResponse;
986 }
987
988 #[derive(Debug)]
990 #[repr(C)]
991 pub struct InputReportsReaderReadInputReportsResponse<'de> {
992 pub reports: ::fidl_next::wire::Vector<'de, crate::wire::InputReport<'de>>,
993 }
994
995 static_assertions::const_assert_eq!(
996 std::mem::size_of::<InputReportsReaderReadInputReportsResponse<'_>>(),
997 16
998 );
999 static_assertions::const_assert_eq!(
1000 std::mem::align_of::<InputReportsReaderReadInputReportsResponse<'_>>(),
1001 8
1002 );
1003
1004 static_assertions::const_assert_eq!(
1005 std::mem::offset_of!(InputReportsReaderReadInputReportsResponse<'_>, reports),
1006 0
1007 );
1008
1009 impl ::fidl_next::Constrained for InputReportsReaderReadInputReportsResponse<'_> {
1010 type Constraint = ();
1011
1012 fn validate(
1013 _: ::fidl_next::Slot<'_, Self>,
1014 _: Self::Constraint,
1015 ) -> Result<(), ::fidl_next::ValidationError> {
1016 Ok(())
1017 }
1018 }
1019
1020 unsafe impl ::fidl_next::Wire for InputReportsReaderReadInputReportsResponse<'static> {
1021 type Narrowed<'de> = InputReportsReaderReadInputReportsResponse<'de>;
1022
1023 #[inline]
1024 fn zero_padding(out_: &mut ::core::mem::MaybeUninit<Self>) {
1025 ::fidl_next::munge! {
1026 let Self {
1027 reports,
1028
1029 } = &mut *out_;
1030 }
1031
1032 ::fidl_next::Wire::zero_padding(reports);
1033 }
1034 }
1035
1036 unsafe impl<'de, ___D> ::fidl_next::Decode<___D> for InputReportsReaderReadInputReportsResponse<'de>
1037 where
1038 ___D: ::fidl_next::decoder::InternalHandleDecoder + ?Sized,
1039 ___D: ::fidl_next::Decoder<'de>,
1040 ___D: ::fidl_next::fuchsia::HandleDecoder,
1041 {
1042 fn decode(
1043 slot_: ::fidl_next::Slot<'_, Self>,
1044 decoder_: &mut ___D,
1045 _: (),
1046 ) -> ::core::result::Result<(), ::fidl_next::DecodeError> {
1047 ::fidl_next::munge! {
1048 let Self {
1049 mut reports,
1050
1051 } = slot_;
1052 }
1053
1054 let _field = reports.as_mut();
1055 ::fidl_next::Constrained::validate(_field, (50, ()))?;
1056 ::fidl_next::Decode::decode(reports.as_mut(), decoder_, (50, ()))?;
1057
1058 let reports = unsafe { reports.deref_unchecked() };
1059
1060 if reports.len() > 50 {
1061 return Err(::fidl_next::DecodeError::VectorTooLong {
1062 size: reports.len() as u64,
1063 limit: 50,
1064 });
1065 }
1066
1067 Ok(())
1068 }
1069 }
1070
1071 impl<'de> ::fidl_next::IntoNatural for InputReportsReaderReadInputReportsResponse<'de> {
1072 type Natural = crate::natural::InputReportsReaderReadInputReportsResponse;
1073 }
1074}
1075
1076pub mod wire_optional {
1077
1078 pub use fidl_next_common_fuchsia_input_report::wire_optional::*;
1079}
1080
1081pub mod generic {
1082
1083 pub use fidl_next_common_fuchsia_input_report::generic::*;
1084
1085 pub struct InputDeviceGetInputReportsReaderRequest<T0> {
1087 pub reader: T0,
1088 }
1089
1090 unsafe impl<___E, T0>
1091 ::fidl_next::Encode<crate::wire::InputDeviceGetInputReportsReaderRequest, ___E>
1092 for InputDeviceGetInputReportsReaderRequest<T0>
1093 where
1094 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1095 ___E: ::fidl_next::fuchsia::HandleEncoder,
1096 T0: ::fidl_next::Encode<
1097 ::fidl_next::ServerEnd<
1098 crate::InputReportsReader,
1099 ::fidl_next::wire::fuchsia::Channel,
1100 >,
1101 ___E,
1102 >,
1103 {
1104 #[inline]
1105 fn encode(
1106 self,
1107 encoder_: &mut ___E,
1108 out_: &mut ::core::mem::MaybeUninit<
1109 crate::wire::InputDeviceGetInputReportsReaderRequest,
1110 >,
1111 _: (),
1112 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1113 ::fidl_next::munge! {
1114 let crate::wire::InputDeviceGetInputReportsReaderRequest {
1115 reader,
1116
1117 } = out_;
1118 }
1119
1120 ::fidl_next::Encode::encode(self.reader, encoder_, reader, ())?;
1121
1122 Ok(())
1123 }
1124 }
1125
1126 pub struct InputDeviceGetInputReportResponse<T0> {
1128 pub report: T0,
1129 }
1130
1131 unsafe impl<___E, T0>
1132 ::fidl_next::Encode<crate::wire::InputDeviceGetInputReportResponse<'static>, ___E>
1133 for InputDeviceGetInputReportResponse<T0>
1134 where
1135 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1136 ___E: ::fidl_next::Encoder,
1137 ___E: ::fidl_next::fuchsia::HandleEncoder,
1138 T0: ::fidl_next::Encode<crate::wire::InputReport<'static>, ___E>,
1139 {
1140 #[inline]
1141 fn encode(
1142 self,
1143 encoder_: &mut ___E,
1144 out_: &mut ::core::mem::MaybeUninit<
1145 crate::wire::InputDeviceGetInputReportResponse<'static>,
1146 >,
1147 _: (),
1148 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1149 ::fidl_next::munge! {
1150 let crate::wire::InputDeviceGetInputReportResponse {
1151 report,
1152
1153 } = out_;
1154 }
1155
1156 ::fidl_next::Encode::encode(self.report, encoder_, report, ())?;
1157
1158 Ok(())
1159 }
1160 }
1161
1162 pub struct InputReportsReaderReadInputReportsResponse<T0> {
1164 pub reports: T0,
1165 }
1166
1167 unsafe impl<___E, T0>
1168 ::fidl_next::Encode<crate::wire::InputReportsReaderReadInputReportsResponse<'static>, ___E>
1169 for InputReportsReaderReadInputReportsResponse<T0>
1170 where
1171 ___E: ::fidl_next::encoder::InternalHandleEncoder + ?Sized,
1172 ___E: ::fidl_next::Encoder,
1173 ___E: ::fidl_next::fuchsia::HandleEncoder,
1174 T0: ::fidl_next::Encode<
1175 ::fidl_next::wire::Vector<'static, crate::wire::InputReport<'static>>,
1176 ___E,
1177 >,
1178 {
1179 #[inline]
1180 fn encode(
1181 self,
1182 encoder_: &mut ___E,
1183 out_: &mut ::core::mem::MaybeUninit<
1184 crate::wire::InputReportsReaderReadInputReportsResponse<'static>,
1185 >,
1186 _: (),
1187 ) -> ::core::result::Result<(), ::fidl_next::EncodeError> {
1188 ::fidl_next::munge! {
1189 let crate::wire::InputReportsReaderReadInputReportsResponse {
1190 reports,
1191
1192 } = out_;
1193 }
1194
1195 ::fidl_next::Encode::encode(self.reports, encoder_, reports, (50, ()))?;
1196
1197 Ok(())
1198 }
1199 }
1200}
1201
1202pub use self::natural::*;
1203
1204#[doc = " An `InputDevice` driver represents a single physical input device.\n The InputDevice maintains an internal FIFO of `MAX_DEVICE_REPORT_COUNT`\n reports for each client that connects. Reports are removed from the FIFO\n once they are read by the client. If the FIFO is full, it will drop the\n oldest report to make room for an incoming report.\n"]
1206#[derive(PartialEq, Debug)]
1207pub struct InputDevice;
1208
1209impl ::fidl_next::Discoverable for InputDevice {
1210 const PROTOCOL_NAME: &'static str = "fuchsia.input.report.InputDevice";
1211}
1212
1213#[cfg(target_os = "fuchsia")]
1214impl ::fidl_next::HasTransport for InputDevice {
1215 type Transport = ::fidl_next::fuchsia::zx::Channel;
1216}
1217
1218pub mod input_device {
1219 pub mod prelude {
1220 pub use crate::{
1221 InputDevice, InputDeviceClientHandler, InputDeviceLocalClientHandler,
1222 InputDeviceLocalServerHandler, InputDeviceServerHandler, input_device,
1223 };
1224
1225 pub use crate::natural::InputDeviceGetDescriptorResponse;
1226
1227 pub use crate::natural::InputDeviceGetInputReportRequest;
1228
1229 pub use crate::natural::InputDeviceGetInputReportsReaderRequest;
1230
1231 pub use crate::natural::InputDeviceSendOutputReportRequest;
1232
1233 pub use crate::natural::InputDeviceSetFeatureReportRequest;
1234
1235 pub use crate::natural::InputDeviceGetFeatureReportResponse;
1236
1237 pub use crate::natural::InputDeviceGetInputReportResponse;
1238
1239 pub use crate::natural::InputDeviceSendOutputReportResponse;
1240
1241 pub use crate::natural::InputDeviceSetFeatureReportResponse;
1242 }
1243
1244 pub struct GetInputReportsReader;
1245
1246 impl ::fidl_next::Method for GetInputReportsReader {
1247 const ORDINAL: u64 = 7555298015256750913;
1248 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1249 ::fidl_next::protocol::Flexibility::Strict;
1250
1251 type Protocol = crate::InputDevice;
1252
1253 type Request = crate::wire::InputDeviceGetInputReportsReaderRequest;
1254 }
1255
1256 pub struct GetDescriptor;
1257
1258 impl ::fidl_next::Method for GetDescriptor {
1259 const ORDINAL: u64 = 4428799916562230578;
1260 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1261 ::fidl_next::protocol::Flexibility::Strict;
1262
1263 type Protocol = crate::InputDevice;
1264
1265 type Request = ::fidl_next::wire::EmptyMessageBody;
1266 }
1267
1268 impl ::fidl_next::TwoWayMethod for GetDescriptor {
1269 type Response = crate::wire::InputDeviceGetDescriptorResponse<'static>;
1270 }
1271
1272 impl<___R> ::fidl_next::Respond<___R> for GetDescriptor {
1273 type Output = crate::generic::InputDeviceGetDescriptorResponse<___R>;
1274
1275 fn respond(response: ___R) -> Self::Output {
1276 crate::generic::InputDeviceGetDescriptorResponse { descriptor: response }
1277 }
1278 }
1279
1280 pub struct SendOutputReport;
1281
1282 impl ::fidl_next::Method for SendOutputReport {
1283 const ORDINAL: u64 = 466765262340648762;
1284 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1285 ::fidl_next::protocol::Flexibility::Strict;
1286
1287 type Protocol = crate::InputDevice;
1288
1289 type Request = crate::wire::InputDeviceSendOutputReportRequest<'static>;
1290 }
1291
1292 impl ::fidl_next::TwoWayMethod for SendOutputReport {
1293 type Response = ::fidl_next::wire::Result<
1294 'static,
1295 crate::wire::InputDeviceSendOutputReportResponse,
1296 ::fidl_next::wire::Int32,
1297 >;
1298 }
1299
1300 impl<___R> ::fidl_next::Respond<___R> for SendOutputReport {
1301 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
1302
1303 fn respond(response: ___R) -> Self::Output {
1304 ::core::result::Result::Ok(response)
1305 }
1306 }
1307
1308 impl<___R> ::fidl_next::RespondErr<___R> for SendOutputReport {
1309 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1310
1311 fn respond_err(response: ___R) -> Self::Output {
1312 ::core::result::Result::Err(response)
1313 }
1314 }
1315
1316 pub struct GetFeatureReport;
1317
1318 impl ::fidl_next::Method for GetFeatureReport {
1319 const ORDINAL: u64 = 5294682407360339734;
1320 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1321 ::fidl_next::protocol::Flexibility::Strict;
1322
1323 type Protocol = crate::InputDevice;
1324
1325 type Request = ::fidl_next::wire::EmptyMessageBody;
1326 }
1327
1328 impl ::fidl_next::TwoWayMethod for GetFeatureReport {
1329 type Response = ::fidl_next::wire::Result<
1330 'static,
1331 crate::wire::InputDeviceGetFeatureReportResponse<'static>,
1332 ::fidl_next::wire::Int32,
1333 >;
1334 }
1335
1336 impl<___R> ::fidl_next::Respond<___R> for GetFeatureReport {
1337 type Output = ::core::result::Result<
1338 crate::generic::InputDeviceGetFeatureReportResponse<___R>,
1339 ::fidl_next::util::Never,
1340 >;
1341
1342 fn respond(response: ___R) -> Self::Output {
1343 ::core::result::Result::Ok(crate::generic::InputDeviceGetFeatureReportResponse {
1344 report: response,
1345 })
1346 }
1347 }
1348
1349 impl<___R> ::fidl_next::RespondErr<___R> for GetFeatureReport {
1350 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1351
1352 fn respond_err(response: ___R) -> Self::Output {
1353 ::core::result::Result::Err(response)
1354 }
1355 }
1356
1357 pub struct SetFeatureReport;
1358
1359 impl ::fidl_next::Method for SetFeatureReport {
1360 const ORDINAL: u64 = 8537033744562275055;
1361 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1362 ::fidl_next::protocol::Flexibility::Strict;
1363
1364 type Protocol = crate::InputDevice;
1365
1366 type Request = crate::wire::InputDeviceSetFeatureReportRequest<'static>;
1367 }
1368
1369 impl ::fidl_next::TwoWayMethod for SetFeatureReport {
1370 type Response = ::fidl_next::wire::Result<
1371 'static,
1372 crate::wire::InputDeviceSetFeatureReportResponse,
1373 ::fidl_next::wire::Int32,
1374 >;
1375 }
1376
1377 impl<___R> ::fidl_next::Respond<___R> for SetFeatureReport {
1378 type Output = ::core::result::Result<___R, ::fidl_next::util::Never>;
1379
1380 fn respond(response: ___R) -> Self::Output {
1381 ::core::result::Result::Ok(response)
1382 }
1383 }
1384
1385 impl<___R> ::fidl_next::RespondErr<___R> for SetFeatureReport {
1386 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1387
1388 fn respond_err(response: ___R) -> Self::Output {
1389 ::core::result::Result::Err(response)
1390 }
1391 }
1392
1393 pub struct GetInputReport;
1394
1395 impl ::fidl_next::Method for GetInputReport {
1396 const ORDINAL: u64 = 5139395162123862600;
1397 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
1398 ::fidl_next::protocol::Flexibility::Strict;
1399
1400 type Protocol = crate::InputDevice;
1401
1402 type Request = crate::wire::InputDeviceGetInputReportRequest;
1403 }
1404
1405 impl ::fidl_next::TwoWayMethod for GetInputReport {
1406 type Response = ::fidl_next::wire::Result<
1407 'static,
1408 crate::wire::InputDeviceGetInputReportResponse<'static>,
1409 ::fidl_next::wire::Int32,
1410 >;
1411 }
1412
1413 impl<___R> ::fidl_next::Respond<___R> for GetInputReport {
1414 type Output = ::core::result::Result<
1415 crate::generic::InputDeviceGetInputReportResponse<___R>,
1416 ::fidl_next::util::Never,
1417 >;
1418
1419 fn respond(response: ___R) -> Self::Output {
1420 ::core::result::Result::Ok(crate::generic::InputDeviceGetInputReportResponse {
1421 report: response,
1422 })
1423 }
1424 }
1425
1426 impl<___R> ::fidl_next::RespondErr<___R> for GetInputReport {
1427 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
1428
1429 fn respond_err(response: ___R) -> Self::Output {
1430 ::core::result::Result::Err(response)
1431 }
1432 }
1433
1434 mod ___detail {
1435 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::InputDevice
1436 where
1437 ___T: ::fidl_next::Transport,
1438 {
1439 type Client = InputDeviceClient<___T>;
1440 type Server = InputDeviceServer<___T>;
1441 }
1442
1443 #[repr(transparent)]
1445 pub struct InputDeviceClient<___T: ::fidl_next::Transport> {
1446 #[allow(dead_code)]
1447 client: ::fidl_next::protocol::Client<___T>,
1448 }
1449
1450 impl<___T> InputDeviceClient<___T>
1451 where
1452 ___T: ::fidl_next::Transport,
1453 {
1454 #[doc = " Open a new InputReportsReader on this device. Each reader receives\n their own reports.\n"]
1455 pub fn get_input_reports_reader(
1456 &self,
1457
1458 reader: impl ::fidl_next::Encode<
1459 ::fidl_next::ServerEnd<
1460 crate::InputReportsReader,
1461 ::fidl_next::wire::fuchsia::Channel,
1462 >,
1463 <___T as ::fidl_next::Transport>::SendBuffer,
1464 >,
1465 ) -> ::fidl_next::SendFuture<'_, ___T>
1466 where
1467 <___T as ::fidl_next::Transport>::SendBuffer:
1468 ::fidl_next::encoder::InternalHandleEncoder,
1469 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::fuchsia::HandleEncoder,
1470 {
1471 self.get_input_reports_reader_with(
1472 crate::generic::InputDeviceGetInputReportsReaderRequest { reader },
1473 )
1474 }
1475
1476 #[doc = " Open a new InputReportsReader on this device. Each reader receives\n their own reports.\n"]
1477 pub fn get_input_reports_reader_with<___R>(
1478 &self,
1479 request: ___R,
1480 ) -> ::fidl_next::SendFuture<'_, ___T>
1481 where
1482 ___R: ::fidl_next::Encode<
1483 crate::wire::InputDeviceGetInputReportsReaderRequest,
1484 <___T as ::fidl_next::Transport>::SendBuffer,
1485 >,
1486 {
1487 ::fidl_next::SendFuture::from_untyped(self.client.send_one_way(
1488 7555298015256750913,
1489 <super::GetInputReportsReader as ::fidl_next::Method>::FLEXIBILITY,
1490 request,
1491 ))
1492 }
1493
1494 #[doc = " Gets the device descriptor for this device.\n"]
1495 pub fn get_descriptor(
1496 &self,
1497 ) -> ::fidl_next::TwoWayFuture<'_, super::GetDescriptor, ___T> {
1498 ::fidl_next::TwoWayFuture::from_untyped(
1499 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1500 4428799916562230578,
1501 <super::GetDescriptor as ::fidl_next::Method>::FLEXIBILITY,
1502 (),
1503 ),
1504 )
1505 }
1506
1507 #[doc = " Send a single output report to the device. This will throw an error\n if the output report does not follow the OutputDescriptor.\n"]
1508 pub fn send_output_report(
1509 &self,
1510
1511 report: impl ::fidl_next::Encode<
1512 crate::wire::OutputReport<'static>,
1513 <___T as ::fidl_next::Transport>::SendBuffer,
1514 >,
1515 ) -> ::fidl_next::TwoWayFuture<'_, super::SendOutputReport, ___T>
1516 where
1517 <___T as ::fidl_next::Transport>::SendBuffer:
1518 ::fidl_next::encoder::InternalHandleEncoder,
1519 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1520 {
1521 self.send_output_report_with(crate::generic::InputDeviceSendOutputReportRequest {
1522 report,
1523 })
1524 }
1525
1526 #[doc = " Send a single output report to the device. This will throw an error\n if the output report does not follow the OutputDescriptor.\n"]
1527 pub fn send_output_report_with<___R>(
1528 &self,
1529 request: ___R,
1530 ) -> ::fidl_next::TwoWayFuture<'_, super::SendOutputReport, ___T>
1531 where
1532 ___R: ::fidl_next::Encode<
1533 crate::wire::InputDeviceSendOutputReportRequest<'static>,
1534 <___T as ::fidl_next::Transport>::SendBuffer,
1535 >,
1536 {
1537 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1538 466765262340648762,
1539 <super::SendOutputReport as ::fidl_next::Method>::FLEXIBILITY,
1540 request,
1541 ))
1542 }
1543
1544 #[doc = " Get the feature report for a given device. This requests the state of\n the device\'s features.\n"]
1545 pub fn get_feature_report(
1546 &self,
1547 ) -> ::fidl_next::TwoWayFuture<'_, super::GetFeatureReport, ___T> {
1548 ::fidl_next::TwoWayFuture::from_untyped(
1549 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
1550 5294682407360339734,
1551 <super::GetFeatureReport as ::fidl_next::Method>::FLEXIBILITY,
1552 (),
1553 ),
1554 )
1555 }
1556
1557 #[doc = " Set the feature report for a given device. This sets the state of\n the device\'s features.\n"]
1558 pub fn set_feature_report(
1559 &self,
1560
1561 report: impl ::fidl_next::Encode<
1562 crate::wire::FeatureReport<'static>,
1563 <___T as ::fidl_next::Transport>::SendBuffer,
1564 >,
1565 ) -> ::fidl_next::TwoWayFuture<'_, super::SetFeatureReport, ___T>
1566 where
1567 <___T as ::fidl_next::Transport>::SendBuffer:
1568 ::fidl_next::encoder::InternalHandleEncoder,
1569 <___T as ::fidl_next::Transport>::SendBuffer: ::fidl_next::Encoder,
1570 {
1571 self.set_feature_report_with(crate::generic::InputDeviceSetFeatureReportRequest {
1572 report,
1573 })
1574 }
1575
1576 #[doc = " Set the feature report for a given device. This sets the state of\n the device\'s features.\n"]
1577 pub fn set_feature_report_with<___R>(
1578 &self,
1579 request: ___R,
1580 ) -> ::fidl_next::TwoWayFuture<'_, super::SetFeatureReport, ___T>
1581 where
1582 ___R: ::fidl_next::Encode<
1583 crate::wire::InputDeviceSetFeatureReportRequest<'static>,
1584 <___T as ::fidl_next::Transport>::SendBuffer,
1585 >,
1586 {
1587 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1588 8537033744562275055,
1589 <super::SetFeatureReport as ::fidl_next::Method>::FLEXIBILITY,
1590 request,
1591 ))
1592 }
1593
1594 #[doc = " For general cases, InputReportReader is the preferred way of getting\n InputReports. For devices that don\'t send InputReports naturally, this\n method can be used to request a report from the device type indicated.\n Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or\n `device_type` are not supported.\n"]
1595 pub fn get_input_report(
1596 &self,
1597
1598 device_type: impl ::fidl_next::Encode<
1599 crate::wire::DeviceType,
1600 <___T as ::fidl_next::Transport>::SendBuffer,
1601 >,
1602 ) -> ::fidl_next::TwoWayFuture<'_, super::GetInputReport, ___T>
1603 where
1604 <___T as ::fidl_next::Transport>::SendBuffer:
1605 ::fidl_next::encoder::InternalHandleEncoder,
1606 {
1607 self.get_input_report_with(crate::generic::InputDeviceGetInputReportRequest {
1608 device_type,
1609 })
1610 }
1611
1612 #[doc = " For general cases, InputReportReader is the preferred way of getting\n InputReports. For devices that don\'t send InputReports naturally, this\n method can be used to request a report from the device type indicated.\n Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or\n `device_type` are not supported.\n"]
1613 pub fn get_input_report_with<___R>(
1614 &self,
1615 request: ___R,
1616 ) -> ::fidl_next::TwoWayFuture<'_, super::GetInputReport, ___T>
1617 where
1618 ___R: ::fidl_next::Encode<
1619 crate::wire::InputDeviceGetInputReportRequest,
1620 <___T as ::fidl_next::Transport>::SendBuffer,
1621 >,
1622 {
1623 ::fidl_next::TwoWayFuture::from_untyped(self.client.send_two_way(
1624 5139395162123862600,
1625 <super::GetInputReport as ::fidl_next::Method>::FLEXIBILITY,
1626 request,
1627 ))
1628 }
1629 }
1630
1631 #[repr(transparent)]
1633 pub struct InputDeviceServer<___T: ::fidl_next::Transport> {
1634 server: ::fidl_next::protocol::Server<___T>,
1635 }
1636
1637 impl<___T> InputDeviceServer<___T> where ___T: ::fidl_next::Transport {}
1638 }
1639}
1640
1641#[diagnostic::on_unimplemented(
1642 note = "If {Self} implements the non-local InputDeviceClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
1643)]
1644
1645pub trait InputDeviceLocalClientHandler<
1649 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1650 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1651>
1652{
1653 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1654 ::core::future::ready(())
1655 }
1656}
1657
1658impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for InputDevice
1659where
1660 ___H: InputDeviceLocalClientHandler<___T>,
1661 ___T: ::fidl_next::Transport,
1662{
1663 async fn on_event(
1664 handler: &mut ___H,
1665 ordinal: u64,
1666 flexibility: ::fidl_next::protocol::Flexibility,
1667 body: ::fidl_next::Body<___T>,
1668 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1669 match ordinal {
1670 ordinal => {
1671 handler.on_unknown_interaction(ordinal).await;
1672 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1673 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1674 } else {
1675 Ok(())
1676 }
1677 }
1678 }
1679 }
1680}
1681
1682#[diagnostic::on_unimplemented(
1683 note = "If {Self} implements the non-local InputDeviceServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
1684)]
1685
1686pub trait InputDeviceLocalServerHandler<
1690 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1691 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1692>
1693{
1694 #[doc = " Open a new InputReportsReader on this device. Each reader receives\n their own reports.\n"]
1695 fn get_input_reports_reader(
1696 &mut self,
1697
1698 request: ::fidl_next::Request<input_device::GetInputReportsReader, ___T>,
1699 ) -> impl ::core::future::Future<Output = ()>;
1700
1701 #[doc = " Gets the device descriptor for this device.\n"]
1702 fn get_descriptor(
1703 &mut self,
1704
1705 responder: ::fidl_next::Responder<input_device::GetDescriptor, ___T>,
1706 ) -> impl ::core::future::Future<Output = ()>;
1707
1708 #[doc = " Send a single output report to the device. This will throw an error\n if the output report does not follow the OutputDescriptor.\n"]
1709 fn send_output_report(
1710 &mut self,
1711
1712 request: ::fidl_next::Request<input_device::SendOutputReport, ___T>,
1713
1714 responder: ::fidl_next::Responder<input_device::SendOutputReport, ___T>,
1715 ) -> impl ::core::future::Future<Output = ()>;
1716
1717 #[doc = " Get the feature report for a given device. This requests the state of\n the device\'s features.\n"]
1718 fn get_feature_report(
1719 &mut self,
1720
1721 responder: ::fidl_next::Responder<input_device::GetFeatureReport, ___T>,
1722 ) -> impl ::core::future::Future<Output = ()>;
1723
1724 #[doc = " Set the feature report for a given device. This sets the state of\n the device\'s features.\n"]
1725 fn set_feature_report(
1726 &mut self,
1727
1728 request: ::fidl_next::Request<input_device::SetFeatureReport, ___T>,
1729
1730 responder: ::fidl_next::Responder<input_device::SetFeatureReport, ___T>,
1731 ) -> impl ::core::future::Future<Output = ()>;
1732
1733 #[doc = " For general cases, InputReportReader is the preferred way of getting\n InputReports. For devices that don\'t send InputReports naturally, this\n method can be used to request a report from the device type indicated.\n Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or\n `device_type` are not supported.\n"]
1734 fn get_input_report(
1735 &mut self,
1736
1737 request: ::fidl_next::Request<input_device::GetInputReport, ___T>,
1738
1739 responder: ::fidl_next::Responder<input_device::GetInputReport, ___T>,
1740 ) -> impl ::core::future::Future<Output = ()>;
1741
1742 fn on_unknown_interaction(&mut self, ordinal: u64) -> impl ::core::future::Future<Output = ()> {
1743 ::core::future::ready(())
1744 }
1745}
1746
1747impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for InputDevice
1748where
1749 ___H: InputDeviceLocalServerHandler<___T>,
1750 ___T: ::fidl_next::Transport,
1751 for<'de> crate::wire::InputDeviceGetInputReportsReaderRequest: ::fidl_next::Decode<
1752 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1753 Constraint = (),
1754 >,
1755 for<'de> crate::wire::InputDeviceSendOutputReportRequest<'de>: ::fidl_next::Decode<
1756 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1757 Constraint = (),
1758 >,
1759 for<'de> crate::wire::InputDeviceSetFeatureReportRequest<'de>: ::fidl_next::Decode<
1760 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1761 Constraint = (),
1762 >,
1763 for<'de> crate::wire::InputDeviceGetInputReportRequest: ::fidl_next::Decode<
1764 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
1765 Constraint = (),
1766 >,
1767{
1768 async fn on_one_way(
1769 handler: &mut ___H,
1770 ordinal: u64,
1771 flexibility: ::fidl_next::protocol::Flexibility,
1772 body: ::fidl_next::Body<___T>,
1773 ) -> ::core::result::Result<
1774 (),
1775 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1776 > {
1777 match ordinal {
1778 7555298015256750913 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
1779 Ok(decoded) => {
1780 handler
1781 .get_input_reports_reader(::fidl_next::Request::from_decoded(decoded))
1782 .await;
1783 Ok(())
1784 }
1785 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1786 ordinal: 7555298015256750913,
1787 error,
1788 }),
1789 },
1790
1791 ordinal => {
1792 handler.on_unknown_interaction(ordinal).await;
1793 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1794 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1795 } else {
1796 Ok(())
1797 }
1798 }
1799 }
1800 }
1801
1802 async fn on_two_way(
1803 handler: &mut ___H,
1804 ordinal: u64,
1805 flexibility: ::fidl_next::protocol::Flexibility,
1806 body: ::fidl_next::Body<___T>,
1807 responder: ::fidl_next::protocol::Responder<___T>,
1808 ) -> ::core::result::Result<
1809 (),
1810 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
1811 > {
1812 match ordinal {
1813 4428799916562230578 => {
1814 let responder = ::fidl_next::Responder::from_untyped(responder);
1815
1816 handler.get_descriptor(responder).await;
1817 Ok(())
1818 }
1819
1820 466765262340648762 => {
1821 let responder = ::fidl_next::Responder::from_untyped(responder);
1822
1823 match ::fidl_next::AsDecoderExt::into_decoded(body) {
1824 Ok(decoded) => {
1825 handler
1826 .send_output_report(
1827 ::fidl_next::Request::from_decoded(decoded),
1828 responder,
1829 )
1830 .await;
1831 Ok(())
1832 }
1833 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1834 ordinal: 466765262340648762,
1835 error,
1836 }),
1837 }
1838 }
1839
1840 5294682407360339734 => {
1841 let responder = ::fidl_next::Responder::from_untyped(responder);
1842
1843 handler.get_feature_report(responder).await;
1844 Ok(())
1845 }
1846
1847 8537033744562275055 => {
1848 let responder = ::fidl_next::Responder::from_untyped(responder);
1849
1850 match ::fidl_next::AsDecoderExt::into_decoded(body) {
1851 Ok(decoded) => {
1852 handler
1853 .set_feature_report(
1854 ::fidl_next::Request::from_decoded(decoded),
1855 responder,
1856 )
1857 .await;
1858 Ok(())
1859 }
1860 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1861 ordinal: 8537033744562275055,
1862 error,
1863 }),
1864 }
1865 }
1866
1867 5139395162123862600 => {
1868 let responder = ::fidl_next::Responder::from_untyped(responder);
1869
1870 match ::fidl_next::AsDecoderExt::into_decoded(body) {
1871 Ok(decoded) => {
1872 handler
1873 .get_input_report(
1874 ::fidl_next::Request::from_decoded(decoded),
1875 responder,
1876 )
1877 .await;
1878 Ok(())
1879 }
1880 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
1881 ordinal: 5139395162123862600,
1882 error,
1883 }),
1884 }
1885 }
1886
1887 ordinal => {
1888 handler.on_unknown_interaction(ordinal).await;
1889 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1890 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1891 } else {
1892 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
1893 ordinal,
1894 flexibility,
1895 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
1896 )
1897 .expect("encoding a framework error should never fail")
1898 .await?;
1899 Ok(())
1900 }
1901 }
1902 }
1903 }
1904}
1905
1906pub trait InputDeviceClientHandler<
1910 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1911 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1912>
1913{
1914 fn on_unknown_interaction(
1915 &mut self,
1916 ordinal: u64,
1917 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
1918 ::core::future::ready(())
1919 }
1920}
1921
1922impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for InputDevice
1923where
1924 ___H: InputDeviceClientHandler<___T> + ::core::marker::Send,
1925 ___T: ::fidl_next::Transport,
1926{
1927 async fn on_event(
1928 handler: &mut ___H,
1929 ordinal: u64,
1930 flexibility: ::fidl_next::protocol::Flexibility,
1931 body: ::fidl_next::Body<___T>,
1932 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
1933 match ordinal {
1934 ordinal => {
1935 handler.on_unknown_interaction(ordinal).await;
1936 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
1937 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
1938 } else {
1939 Ok(())
1940 }
1941 }
1942 }
1943 }
1944}
1945
1946pub trait InputDeviceServerHandler<
1950 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
1951 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
1952>
1953{
1954 #[doc = " Open a new InputReportsReader on this device. Each reader receives\n their own reports.\n"]
1955 fn get_input_reports_reader(
1956 &mut self,
1957
1958 request: ::fidl_next::Request<input_device::GetInputReportsReader, ___T>,
1959 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1960
1961 #[doc = " Gets the device descriptor for this device.\n"]
1962 fn get_descriptor(
1963 &mut self,
1964
1965 responder: ::fidl_next::Responder<input_device::GetDescriptor, ___T>,
1966 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1967
1968 #[doc = " Send a single output report to the device. This will throw an error\n if the output report does not follow the OutputDescriptor.\n"]
1969 fn send_output_report(
1970 &mut self,
1971
1972 request: ::fidl_next::Request<input_device::SendOutputReport, ___T>,
1973
1974 responder: ::fidl_next::Responder<input_device::SendOutputReport, ___T>,
1975 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1976
1977 #[doc = " Get the feature report for a given device. This requests the state of\n the device\'s features.\n"]
1978 fn get_feature_report(
1979 &mut self,
1980
1981 responder: ::fidl_next::Responder<input_device::GetFeatureReport, ___T>,
1982 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1983
1984 #[doc = " Set the feature report for a given device. This sets the state of\n the device\'s features.\n"]
1985 fn set_feature_report(
1986 &mut self,
1987
1988 request: ::fidl_next::Request<input_device::SetFeatureReport, ___T>,
1989
1990 responder: ::fidl_next::Responder<input_device::SetFeatureReport, ___T>,
1991 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
1992
1993 #[doc = " For general cases, InputReportReader is the preferred way of getting\n InputReports. For devices that don\'t send InputReports naturally, this\n method can be used to request a report from the device type indicated.\n Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or\n `device_type` are not supported.\n"]
1994 fn get_input_report(
1995 &mut self,
1996
1997 request: ::fidl_next::Request<input_device::GetInputReport, ___T>,
1998
1999 responder: ::fidl_next::Responder<input_device::GetInputReport, ___T>,
2000 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2001
2002 fn on_unknown_interaction(
2003 &mut self,
2004 ordinal: u64,
2005 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send {
2006 ::core::future::ready(())
2007 }
2008}
2009
2010impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for InputDevice
2011where
2012 ___H: InputDeviceServerHandler<___T> + ::core::marker::Send,
2013 ___T: ::fidl_next::Transport,
2014 for<'de> crate::wire::InputDeviceGetInputReportsReaderRequest: ::fidl_next::Decode<
2015 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2016 Constraint = (),
2017 >,
2018 for<'de> crate::wire::InputDeviceSendOutputReportRequest<'de>: ::fidl_next::Decode<
2019 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2020 Constraint = (),
2021 >,
2022 for<'de> crate::wire::InputDeviceSetFeatureReportRequest<'de>: ::fidl_next::Decode<
2023 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2024 Constraint = (),
2025 >,
2026 for<'de> crate::wire::InputDeviceGetInputReportRequest: ::fidl_next::Decode<
2027 <<___T as ::fidl_next::Transport>::RecvBuffer as ::fidl_next::AsDecoder<'de>>::Decoder,
2028 Constraint = (),
2029 >,
2030{
2031 async fn on_one_way(
2032 handler: &mut ___H,
2033 ordinal: u64,
2034 flexibility: ::fidl_next::protocol::Flexibility,
2035 body: ::fidl_next::Body<___T>,
2036 ) -> ::core::result::Result<
2037 (),
2038 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2039 > {
2040 match ordinal {
2041 7555298015256750913 => match ::fidl_next::AsDecoderExt::into_decoded(body) {
2042 Ok(decoded) => {
2043 handler
2044 .get_input_reports_reader(::fidl_next::Request::from_decoded(decoded))
2045 .await;
2046 Ok(())
2047 }
2048 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2049 ordinal: 7555298015256750913,
2050 error,
2051 }),
2052 },
2053
2054 ordinal => {
2055 handler.on_unknown_interaction(ordinal).await;
2056 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
2057 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2058 } else {
2059 Ok(())
2060 }
2061 }
2062 }
2063 }
2064
2065 async fn on_two_way(
2066 handler: &mut ___H,
2067 ordinal: u64,
2068 flexibility: ::fidl_next::protocol::Flexibility,
2069 body: ::fidl_next::Body<___T>,
2070 responder: ::fidl_next::protocol::Responder<___T>,
2071 ) -> ::core::result::Result<
2072 (),
2073 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2074 > {
2075 match ordinal {
2076 4428799916562230578 => {
2077 let responder = ::fidl_next::Responder::from_untyped(responder);
2078
2079 handler.get_descriptor(responder).await;
2080 Ok(())
2081 }
2082
2083 466765262340648762 => {
2084 let responder = ::fidl_next::Responder::from_untyped(responder);
2085
2086 match ::fidl_next::AsDecoderExt::into_decoded(body) {
2087 Ok(decoded) => {
2088 handler
2089 .send_output_report(
2090 ::fidl_next::Request::from_decoded(decoded),
2091 responder,
2092 )
2093 .await;
2094 Ok(())
2095 }
2096 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2097 ordinal: 466765262340648762,
2098 error,
2099 }),
2100 }
2101 }
2102
2103 5294682407360339734 => {
2104 let responder = ::fidl_next::Responder::from_untyped(responder);
2105
2106 handler.get_feature_report(responder).await;
2107 Ok(())
2108 }
2109
2110 8537033744562275055 => {
2111 let responder = ::fidl_next::Responder::from_untyped(responder);
2112
2113 match ::fidl_next::AsDecoderExt::into_decoded(body) {
2114 Ok(decoded) => {
2115 handler
2116 .set_feature_report(
2117 ::fidl_next::Request::from_decoded(decoded),
2118 responder,
2119 )
2120 .await;
2121 Ok(())
2122 }
2123 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2124 ordinal: 8537033744562275055,
2125 error,
2126 }),
2127 }
2128 }
2129
2130 5139395162123862600 => {
2131 let responder = ::fidl_next::Responder::from_untyped(responder);
2132
2133 match ::fidl_next::AsDecoderExt::into_decoded(body) {
2134 Ok(decoded) => {
2135 handler
2136 .get_input_report(
2137 ::fidl_next::Request::from_decoded(decoded),
2138 responder,
2139 )
2140 .await;
2141 Ok(())
2142 }
2143 Err(error) => Err(::fidl_next::ProtocolError::InvalidMessage {
2144 ordinal: 5139395162123862600,
2145 error,
2146 }),
2147 }
2148 }
2149
2150 ordinal => {
2151 handler.on_unknown_interaction(ordinal).await;
2152 if ::core::matches!(flexibility, ::fidl_next::protocol::Flexibility::Strict) {
2153 Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal))
2154 } else {
2155 responder.respond::<::fidl_next::wire::Flexible<'_, ::fidl_next::wire::EmptyMessageBody>>(
2156 ordinal,
2157 flexibility,
2158 ::fidl_next::Flexible::<::fidl_next::util::Never>::FrameworkErr(::fidl_next::FrameworkError::UnknownMethod),
2159 )
2160 .expect("encoding a framework error should never fail")
2161 .await?;
2162 Ok(())
2163 }
2164 }
2165 }
2166 }
2167}
2168
2169impl<___T> InputDeviceClientHandler<___T> for ::fidl_next::IgnoreEvents
2170where
2171 ___T: ::fidl_next::Transport,
2172{
2173 async fn on_unknown_interaction(&mut self, _: u64) {}
2174}
2175
2176impl<___H, ___T> InputDeviceLocalClientHandler<___T> for ::fidl_next::Local<___H>
2177where
2178 ___H: InputDeviceClientHandler<___T>,
2179 ___T: ::fidl_next::Transport,
2180{
2181 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2182 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2183 }
2184}
2185
2186impl<___H, ___T> InputDeviceLocalServerHandler<___T> for ::fidl_next::Local<___H>
2187where
2188 ___H: InputDeviceServerHandler<___T>,
2189 ___T: ::fidl_next::Transport,
2190{
2191 async fn get_input_reports_reader(
2192 &mut self,
2193
2194 request: ::fidl_next::Request<input_device::GetInputReportsReader, ___T>,
2195 ) {
2196 ___H::get_input_reports_reader(&mut self.0, request).await
2197 }
2198
2199 async fn get_descriptor(
2200 &mut self,
2201
2202 responder: ::fidl_next::Responder<input_device::GetDescriptor, ___T>,
2203 ) {
2204 ___H::get_descriptor(&mut self.0, responder).await
2205 }
2206
2207 async fn send_output_report(
2208 &mut self,
2209
2210 request: ::fidl_next::Request<input_device::SendOutputReport, ___T>,
2211
2212 responder: ::fidl_next::Responder<input_device::SendOutputReport, ___T>,
2213 ) {
2214 ___H::send_output_report(&mut self.0, request, responder).await
2215 }
2216
2217 async fn get_feature_report(
2218 &mut self,
2219
2220 responder: ::fidl_next::Responder<input_device::GetFeatureReport, ___T>,
2221 ) {
2222 ___H::get_feature_report(&mut self.0, responder).await
2223 }
2224
2225 async fn set_feature_report(
2226 &mut self,
2227
2228 request: ::fidl_next::Request<input_device::SetFeatureReport, ___T>,
2229
2230 responder: ::fidl_next::Responder<input_device::SetFeatureReport, ___T>,
2231 ) {
2232 ___H::set_feature_report(&mut self.0, request, responder).await
2233 }
2234
2235 async fn get_input_report(
2236 &mut self,
2237
2238 request: ::fidl_next::Request<input_device::GetInputReport, ___T>,
2239
2240 responder: ::fidl_next::Responder<input_device::GetInputReport, ___T>,
2241 ) {
2242 ___H::get_input_report(&mut self.0, request, responder).await
2243 }
2244
2245 async fn on_unknown_interaction(&mut self, ordinal: u64) {
2246 ___H::on_unknown_interaction(&mut self.0, ordinal).await
2247 }
2248}
2249
2250#[doc = " Each `InputReportsReader` has its own FIFO of InputReports that it maintains.\n When ReadInputReports is called it drains the InputReports FIFO.\n If too many InputReports are created before the FIFO is drained, then\n the oldest InputReport will be silently discarded.\n"]
2252#[derive(PartialEq, Debug)]
2253pub struct InputReportsReader;
2254
2255#[cfg(target_os = "fuchsia")]
2256impl ::fidl_next::HasTransport for InputReportsReader {
2257 type Transport = ::fidl_next::fuchsia::zx::Channel;
2258}
2259
2260pub mod input_reports_reader {
2261 pub mod prelude {
2262 pub use crate::{
2263 InputReportsReader, InputReportsReaderClientHandler,
2264 InputReportsReaderLocalClientHandler, InputReportsReaderLocalServerHandler,
2265 InputReportsReaderServerHandler, input_reports_reader,
2266 };
2267
2268 pub use crate::natural::InputReportsReaderReadInputReportsResponse;
2269 }
2270
2271 pub struct ReadInputReports;
2272
2273 impl ::fidl_next::Method for ReadInputReports {
2274 const ORDINAL: u64 = 3861255986002273625;
2275 const FLEXIBILITY: ::fidl_next::protocol::Flexibility =
2276 ::fidl_next::protocol::Flexibility::Strict;
2277
2278 type Protocol = crate::InputReportsReader;
2279
2280 type Request = ::fidl_next::wire::EmptyMessageBody;
2281 }
2282
2283 impl ::fidl_next::TwoWayMethod for ReadInputReports {
2284 type Response = ::fidl_next::wire::Result<
2285 'static,
2286 crate::wire::InputReportsReaderReadInputReportsResponse<'static>,
2287 ::fidl_next::wire::Int32,
2288 >;
2289 }
2290
2291 impl<___R> ::fidl_next::Respond<___R> for ReadInputReports {
2292 type Output = ::core::result::Result<
2293 crate::generic::InputReportsReaderReadInputReportsResponse<___R>,
2294 ::fidl_next::util::Never,
2295 >;
2296
2297 fn respond(response: ___R) -> Self::Output {
2298 ::core::result::Result::Ok(crate::generic::InputReportsReaderReadInputReportsResponse {
2299 reports: response,
2300 })
2301 }
2302 }
2303
2304 impl<___R> ::fidl_next::RespondErr<___R> for ReadInputReports {
2305 type Output = ::core::result::Result<::fidl_next::util::Never, ___R>;
2306
2307 fn respond_err(response: ___R) -> Self::Output {
2308 ::core::result::Result::Err(response)
2309 }
2310 }
2311
2312 mod ___detail {
2313 unsafe impl<___T> ::fidl_next::HasConnectionHandles<___T> for crate::InputReportsReader
2314 where
2315 ___T: ::fidl_next::Transport,
2316 {
2317 type Client = InputReportsReaderClient<___T>;
2318 type Server = InputReportsReaderServer<___T>;
2319 }
2320
2321 #[repr(transparent)]
2323 pub struct InputReportsReaderClient<___T: ::fidl_next::Transport> {
2324 #[allow(dead_code)]
2325 client: ::fidl_next::protocol::Client<___T>,
2326 }
2327
2328 impl<___T> InputReportsReaderClient<___T>
2329 where
2330 ___T: ::fidl_next::Transport,
2331 {
2332 #[doc = " This is a Hanging-Get function to read the reports in the\n InputReport FIFO. This will not reply until there is at least one\n report available.\n If there is already one outstanding Hanging-Get, calling this\n again will return ZX_ERR_ALREADY_BOUND.\n"]
2333 pub fn read_input_reports(
2334 &self,
2335 ) -> ::fidl_next::TwoWayFuture<'_, super::ReadInputReports, ___T> {
2336 ::fidl_next::TwoWayFuture::from_untyped(
2337 self.client.send_two_way::<::fidl_next::wire::EmptyMessageBody>(
2338 3861255986002273625,
2339 <super::ReadInputReports as ::fidl_next::Method>::FLEXIBILITY,
2340 (),
2341 ),
2342 )
2343 }
2344 }
2345
2346 #[repr(transparent)]
2348 pub struct InputReportsReaderServer<___T: ::fidl_next::Transport> {
2349 server: ::fidl_next::protocol::Server<___T>,
2350 }
2351
2352 impl<___T> InputReportsReaderServer<___T> where ___T: ::fidl_next::Transport {}
2353 }
2354}
2355
2356#[diagnostic::on_unimplemented(
2357 note = "If {Self} implements the non-local InputReportsReaderClientHandler trait, use `spawn_as_local` or the `Local` adapter type"
2358)]
2359
2360pub trait InputReportsReaderLocalClientHandler<
2364 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2365 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2366>
2367{
2368}
2369
2370impl<___H, ___T> ::fidl_next::DispatchLocalClientMessage<___H, ___T> for InputReportsReader
2371where
2372 ___H: InputReportsReaderLocalClientHandler<___T>,
2373 ___T: ::fidl_next::Transport,
2374{
2375 async fn on_event(
2376 handler: &mut ___H,
2377 ordinal: u64,
2378 flexibility: ::fidl_next::protocol::Flexibility,
2379 body: ::fidl_next::Body<___T>,
2380 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2381 match ordinal {
2382 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2383 }
2384 }
2385}
2386
2387#[diagnostic::on_unimplemented(
2388 note = "If {Self} implements the non-local InputReportsReaderServerHandler trait, use `spawn_as_local` or the `Local` adapter type"
2389)]
2390
2391pub trait InputReportsReaderLocalServerHandler<
2395 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2396 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2397>
2398{
2399 #[doc = " This is a Hanging-Get function to read the reports in the\n InputReport FIFO. This will not reply until there is at least one\n report available.\n If there is already one outstanding Hanging-Get, calling this\n again will return ZX_ERR_ALREADY_BOUND.\n"]
2400 fn read_input_reports(
2401 &mut self,
2402
2403 responder: ::fidl_next::Responder<input_reports_reader::ReadInputReports, ___T>,
2404 ) -> impl ::core::future::Future<Output = ()>;
2405}
2406
2407impl<___H, ___T> ::fidl_next::DispatchLocalServerMessage<___H, ___T> for InputReportsReader
2408where
2409 ___H: InputReportsReaderLocalServerHandler<___T>,
2410 ___T: ::fidl_next::Transport,
2411{
2412 async fn on_one_way(
2413 handler: &mut ___H,
2414 ordinal: u64,
2415 flexibility: ::fidl_next::protocol::Flexibility,
2416 body: ::fidl_next::Body<___T>,
2417 ) -> ::core::result::Result<
2418 (),
2419 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2420 > {
2421 match ordinal {
2422 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2423 }
2424 }
2425
2426 async fn on_two_way(
2427 handler: &mut ___H,
2428 ordinal: u64,
2429 flexibility: ::fidl_next::protocol::Flexibility,
2430 body: ::fidl_next::Body<___T>,
2431 responder: ::fidl_next::protocol::Responder<___T>,
2432 ) -> ::core::result::Result<
2433 (),
2434 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2435 > {
2436 match ordinal {
2437 3861255986002273625 => {
2438 let responder = ::fidl_next::Responder::from_untyped(responder);
2439
2440 handler.read_input_reports(responder).await;
2441 Ok(())
2442 }
2443
2444 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2445 }
2446 }
2447}
2448
2449pub trait InputReportsReaderClientHandler<
2453 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2454 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2455>
2456{
2457}
2458
2459impl<___H, ___T> ::fidl_next::DispatchClientMessage<___H, ___T> for InputReportsReader
2460where
2461 ___H: InputReportsReaderClientHandler<___T> + ::core::marker::Send,
2462 ___T: ::fidl_next::Transport,
2463{
2464 async fn on_event(
2465 handler: &mut ___H,
2466 ordinal: u64,
2467 flexibility: ::fidl_next::protocol::Flexibility,
2468 body: ::fidl_next::Body<___T>,
2469 ) -> ::core::result::Result<(), ::fidl_next::ProtocolError<___T::Error>> {
2470 match ordinal {
2471 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2472 }
2473 }
2474}
2475
2476pub trait InputReportsReaderServerHandler<
2480 #[cfg(target_os = "fuchsia")] ___T: ::fidl_next::Transport = ::fidl_next::fuchsia::zx::Channel,
2481 #[cfg(not(target_os = "fuchsia"))] ___T: ::fidl_next::Transport,
2482>
2483{
2484 #[doc = " This is a Hanging-Get function to read the reports in the\n InputReport FIFO. This will not reply until there is at least one\n report available.\n If there is already one outstanding Hanging-Get, calling this\n again will return ZX_ERR_ALREADY_BOUND.\n"]
2485 fn read_input_reports(
2486 &mut self,
2487
2488 responder: ::fidl_next::Responder<input_reports_reader::ReadInputReports, ___T>,
2489 ) -> impl ::core::future::Future<Output = ()> + ::core::marker::Send;
2490}
2491
2492impl<___H, ___T> ::fidl_next::DispatchServerMessage<___H, ___T> for InputReportsReader
2493where
2494 ___H: InputReportsReaderServerHandler<___T> + ::core::marker::Send,
2495 ___T: ::fidl_next::Transport,
2496{
2497 async fn on_one_way(
2498 handler: &mut ___H,
2499 ordinal: u64,
2500 flexibility: ::fidl_next::protocol::Flexibility,
2501 body: ::fidl_next::Body<___T>,
2502 ) -> ::core::result::Result<
2503 (),
2504 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2505 > {
2506 match ordinal {
2507 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2508 }
2509 }
2510
2511 async fn on_two_way(
2512 handler: &mut ___H,
2513 ordinal: u64,
2514 flexibility: ::fidl_next::protocol::Flexibility,
2515 body: ::fidl_next::Body<___T>,
2516 responder: ::fidl_next::protocol::Responder<___T>,
2517 ) -> ::core::result::Result<
2518 (),
2519 ::fidl_next::ProtocolError<<___T as ::fidl_next::Transport>::Error>,
2520 > {
2521 match ordinal {
2522 3861255986002273625 => {
2523 let responder = ::fidl_next::Responder::from_untyped(responder);
2524
2525 handler.read_input_reports(responder).await;
2526 Ok(())
2527 }
2528
2529 ordinal => Err(::fidl_next::ProtocolError::UnknownOrdinal(ordinal)),
2530 }
2531 }
2532}
2533
2534impl<___T> InputReportsReaderClientHandler<___T> for ::fidl_next::IgnoreEvents where
2535 ___T: ::fidl_next::Transport
2536{
2537}
2538
2539impl<___H, ___T> InputReportsReaderLocalClientHandler<___T> for ::fidl_next::Local<___H>
2540where
2541 ___H: InputReportsReaderClientHandler<___T>,
2542 ___T: ::fidl_next::Transport,
2543{
2544}
2545
2546impl<___H, ___T> InputReportsReaderLocalServerHandler<___T> for ::fidl_next::Local<___H>
2547where
2548 ___H: InputReportsReaderServerHandler<___T>,
2549 ___T: ::fidl_next::Transport,
2550{
2551 async fn read_input_reports(
2552 &mut self,
2553
2554 responder: ::fidl_next::Responder<input_reports_reader::ReadInputReports, ___T>,
2555 ) {
2556 ___H::read_input_reports(&mut self.0, responder).await
2557 }
2558}
2559
2560#[derive(Debug)]
2562pub struct Service;
2563
2564impl ::fidl_next::DiscoverableService for Service {
2565 const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
2566 const MEMBER_NAMES: &'static [&'static str] = &["input_device"];
2567}
2568
2569impl ::fidl_next::HasServiceRequest<::fidl_next::fuchsia::zx::Channel> for Service {}
2570
2571impl<___C> ::fidl_next::Service<___C> for Service
2572where
2573 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2574{
2575 type Connector = ServiceConnector<___C>;
2576}
2577
2578#[repr(transparent)]
2580pub struct ServiceConnector<___C> {
2581 #[allow(dead_code)]
2582 connector: ___C,
2583}
2584
2585impl<___C> ServiceConnector<___C>
2586where
2587 ___C: ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>,
2588{
2589 pub fn input_device(
2591 &self,
2592 server_end: ::fidl_next::ServerEnd<crate::InputDevice, ::fidl_next::fuchsia::zx::Channel>,
2593 ) -> ::core::result::Result<
2594 (),
2595 <___C as ::fidl_next::protocol::ServiceConnector<::fidl_next::fuchsia::zx::Channel>>::Error,
2596 > {
2597 ::fidl_next::protocol::ServiceConnector::<
2598 ::fidl_next::fuchsia::zx::Channel
2599 >::connect_to_member(
2600 &self.connector,
2601 "input_device",
2602 server_end.into_untyped(),
2603 )
2604 }
2605}
2606
2607pub trait ServiceHandler {
2609 fn input_device(
2611 &self,
2612 server_end: ::fidl_next::ServerEnd<crate::InputDevice, ::fidl_next::fuchsia::zx::Channel>,
2613 );
2614}
2615
2616impl<___H, ___T> ::fidl_next::DispatchServiceHandler<___H, ___T> for Service
2617where
2618 ___H: ServiceHandler,
2619 ::fidl_next::fuchsia::zx::Channel: ::fidl_next::InstanceFromServiceTransport<___T>,
2620{
2621 fn on_connection(handler: &___H, member: &str, server_end: ___T) {
2622 use ::fidl_next::InstanceFromServiceTransport;
2623 match member {
2624 "input_device" => handler.input_device(::fidl_next::ServerEnd::from_untyped(
2625 ::fidl_next::fuchsia::zx::Channel::from_service_transport(server_end),
2626 )),
2627
2628 _ => unreachable!(),
2629 }
2630 }
2631}
2632
2633pub use fidl_next_common_fuchsia_input_report::*;