1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_input_report__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct InputDeviceGetInputReportsReaderRequest {
16 pub reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for InputDeviceGetInputReportsReaderRequest
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct InputDeviceGetInputReportResponse {
26 pub report: InputReport,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for InputDeviceGetInputReportResponse
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct InputReportsReaderReadInputReportsResponse {
36 pub reports: Vec<InputReport>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for InputReportsReaderReadInputReportsResponse
41{
42}
43
44#[derive(Debug, Default, PartialEq)]
49pub struct InputReport {
50 pub event_time: Option<i64>,
52 pub mouse: Option<MouseInputReport>,
54 pub sensor: Option<SensorInputReport>,
56 pub touch: Option<TouchInputReport>,
58 pub keyboard: Option<KeyboardInputReport>,
60 pub consumer_control: Option<ConsumerControlInputReport>,
63 pub trace_id: Option<u64>,
65 pub report_id: Option<u8>,
68 pub wake_lease: Option<fidl::EventPair>,
70 #[doc(hidden)]
71 pub __source_breaking: fidl::marker::SourceBreaking,
72}
73
74impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {}
75
76#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
77pub struct InputDeviceMarker;
78
79impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
80 type Proxy = InputDeviceProxy;
81 type RequestStream = InputDeviceRequestStream;
82 #[cfg(target_os = "fuchsia")]
83 type SynchronousProxy = InputDeviceSynchronousProxy;
84
85 const DEBUG_NAME: &'static str = "fuchsia.input.report.InputDevice";
86}
87impl fidl::endpoints::DiscoverableProtocolMarker for InputDeviceMarker {}
88pub type InputDeviceSendOutputReportResult = Result<(), i32>;
89pub type InputDeviceGetFeatureReportResult = Result<FeatureReport, i32>;
90pub type InputDeviceSetFeatureReportResult = Result<(), i32>;
91pub type InputDeviceGetInputReportResult = Result<InputReport, i32>;
92
93pub trait InputDeviceProxyInterface: Send + Sync {
94 fn r#get_input_reports_reader(
95 &self,
96 reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
97 ) -> Result<(), fidl::Error>;
98 type GetDescriptorResponseFut: std::future::Future<Output = Result<DeviceDescriptor, fidl::Error>>
99 + Send;
100 fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut;
101 type SendOutputReportResponseFut: std::future::Future<Output = Result<InputDeviceSendOutputReportResult, fidl::Error>>
102 + Send;
103 fn r#send_output_report(&self, report: &OutputReport) -> Self::SendOutputReportResponseFut;
104 type GetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceGetFeatureReportResult, fidl::Error>>
105 + Send;
106 fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut;
107 type SetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceSetFeatureReportResult, fidl::Error>>
108 + Send;
109 fn r#set_feature_report(&self, report: &FeatureReport) -> Self::SetFeatureReportResponseFut;
110 type GetInputReportResponseFut: std::future::Future<Output = Result<InputDeviceGetInputReportResult, fidl::Error>>
111 + Send;
112 fn r#get_input_report(&self, device_type: DeviceType) -> Self::GetInputReportResponseFut;
113}
114#[derive(Debug)]
115#[cfg(target_os = "fuchsia")]
116pub struct InputDeviceSynchronousProxy {
117 client: fidl::client::sync::Client,
118}
119
120#[cfg(target_os = "fuchsia")]
121impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
122 type Proxy = InputDeviceProxy;
123 type Protocol = InputDeviceMarker;
124
125 fn from_channel(inner: fidl::Channel) -> Self {
126 Self::new(inner)
127 }
128
129 fn into_channel(self) -> fidl::Channel {
130 self.client.into_channel()
131 }
132
133 fn as_channel(&self) -> &fidl::Channel {
134 self.client.as_channel()
135 }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl InputDeviceSynchronousProxy {
140 pub fn new(channel: fidl::Channel) -> Self {
141 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
142 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
143 }
144
145 pub fn into_channel(self) -> fidl::Channel {
146 self.client.into_channel()
147 }
148
149 pub fn wait_for_event(
152 &self,
153 deadline: zx::MonotonicInstant,
154 ) -> Result<InputDeviceEvent, fidl::Error> {
155 InputDeviceEvent::decode(self.client.wait_for_event(deadline)?)
156 }
157
158 pub fn r#get_input_reports_reader(
161 &self,
162 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
163 ) -> Result<(), fidl::Error> {
164 self.client.send::<InputDeviceGetInputReportsReaderRequest>(
165 (reader,),
166 0x68d9cf83e397ab41,
167 fidl::encoding::DynamicFlags::empty(),
168 )
169 }
170
171 pub fn r#get_descriptor(
173 &self,
174 ___deadline: zx::MonotonicInstant,
175 ) -> Result<DeviceDescriptor, fidl::Error> {
176 let _response = self
177 .client
178 .send_query::<fidl::encoding::EmptyPayload, InputDeviceGetDescriptorResponse>(
179 (),
180 0x3d76420f2ff8ad32,
181 fidl::encoding::DynamicFlags::empty(),
182 ___deadline,
183 )?;
184 Ok(_response.descriptor)
185 }
186
187 pub fn r#send_output_report(
190 &self,
191 mut report: &OutputReport,
192 ___deadline: zx::MonotonicInstant,
193 ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
194 let _response = self.client.send_query::<
195 InputDeviceSendOutputReportRequest,
196 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
197 >(
198 (report,),
199 0x67a4888774e6f3a,
200 fidl::encoding::DynamicFlags::empty(),
201 ___deadline,
202 )?;
203 Ok(_response.map(|x| x))
204 }
205
206 pub fn r#get_feature_report(
209 &self,
210 ___deadline: zx::MonotonicInstant,
211 ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
212 let _response = self.client.send_query::<
213 fidl::encoding::EmptyPayload,
214 fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
215 >(
216 (),
217 0x497a7d98d9391f16,
218 fidl::encoding::DynamicFlags::empty(),
219 ___deadline,
220 )?;
221 Ok(_response.map(|x| x.report))
222 }
223
224 pub fn r#set_feature_report(
227 &self,
228 mut report: &FeatureReport,
229 ___deadline: zx::MonotonicInstant,
230 ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
231 let _response = self.client.send_query::<
232 InputDeviceSetFeatureReportRequest,
233 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
234 >(
235 (report,),
236 0x7679a2f5a42842ef,
237 fidl::encoding::DynamicFlags::empty(),
238 ___deadline,
239 )?;
240 Ok(_response.map(|x| x))
241 }
242
243 pub fn r#get_input_report(
249 &self,
250 mut device_type: DeviceType,
251 ___deadline: zx::MonotonicInstant,
252 ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
253 let _response = self.client.send_query::<
254 InputDeviceGetInputReportRequest,
255 fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
256 >(
257 (device_type,),
258 0x4752ccab96c10248,
259 fidl::encoding::DynamicFlags::empty(),
260 ___deadline,
261 )?;
262 Ok(_response.map(|x| x.report))
263 }
264}
265
266#[cfg(target_os = "fuchsia")]
267impl From<InputDeviceSynchronousProxy> for zx::Handle {
268 fn from(value: InputDeviceSynchronousProxy) -> Self {
269 value.into_channel().into()
270 }
271}
272
273#[cfg(target_os = "fuchsia")]
274impl From<fidl::Channel> for InputDeviceSynchronousProxy {
275 fn from(value: fidl::Channel) -> Self {
276 Self::new(value)
277 }
278}
279
280#[cfg(target_os = "fuchsia")]
281impl fidl::endpoints::FromClient for InputDeviceSynchronousProxy {
282 type Protocol = InputDeviceMarker;
283
284 fn from_client(value: fidl::endpoints::ClientEnd<InputDeviceMarker>) -> Self {
285 Self::new(value.into_channel())
286 }
287}
288
289#[derive(Debug, Clone)]
290pub struct InputDeviceProxy {
291 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
292}
293
294impl fidl::endpoints::Proxy for InputDeviceProxy {
295 type Protocol = InputDeviceMarker;
296
297 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
298 Self::new(inner)
299 }
300
301 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
302 self.client.into_channel().map_err(|client| Self { client })
303 }
304
305 fn as_channel(&self) -> &::fidl::AsyncChannel {
306 self.client.as_channel()
307 }
308}
309
310impl InputDeviceProxy {
311 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
313 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
314 Self { client: fidl::client::Client::new(channel, protocol_name) }
315 }
316
317 pub fn take_event_stream(&self) -> InputDeviceEventStream {
323 InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
324 }
325
326 pub fn r#get_input_reports_reader(
329 &self,
330 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
331 ) -> Result<(), fidl::Error> {
332 InputDeviceProxyInterface::r#get_input_reports_reader(self, reader)
333 }
334
335 pub fn r#get_descriptor(
337 &self,
338 ) -> fidl::client::QueryResponseFut<
339 DeviceDescriptor,
340 fidl::encoding::DefaultFuchsiaResourceDialect,
341 > {
342 InputDeviceProxyInterface::r#get_descriptor(self)
343 }
344
345 pub fn r#send_output_report(
348 &self,
349 mut report: &OutputReport,
350 ) -> fidl::client::QueryResponseFut<
351 InputDeviceSendOutputReportResult,
352 fidl::encoding::DefaultFuchsiaResourceDialect,
353 > {
354 InputDeviceProxyInterface::r#send_output_report(self, report)
355 }
356
357 pub fn r#get_feature_report(
360 &self,
361 ) -> fidl::client::QueryResponseFut<
362 InputDeviceGetFeatureReportResult,
363 fidl::encoding::DefaultFuchsiaResourceDialect,
364 > {
365 InputDeviceProxyInterface::r#get_feature_report(self)
366 }
367
368 pub fn r#set_feature_report(
371 &self,
372 mut report: &FeatureReport,
373 ) -> fidl::client::QueryResponseFut<
374 InputDeviceSetFeatureReportResult,
375 fidl::encoding::DefaultFuchsiaResourceDialect,
376 > {
377 InputDeviceProxyInterface::r#set_feature_report(self, report)
378 }
379
380 pub fn r#get_input_report(
386 &self,
387 mut device_type: DeviceType,
388 ) -> fidl::client::QueryResponseFut<
389 InputDeviceGetInputReportResult,
390 fidl::encoding::DefaultFuchsiaResourceDialect,
391 > {
392 InputDeviceProxyInterface::r#get_input_report(self, device_type)
393 }
394}
395
396impl InputDeviceProxyInterface for InputDeviceProxy {
397 fn r#get_input_reports_reader(
398 &self,
399 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
400 ) -> Result<(), fidl::Error> {
401 self.client.send::<InputDeviceGetInputReportsReaderRequest>(
402 (reader,),
403 0x68d9cf83e397ab41,
404 fidl::encoding::DynamicFlags::empty(),
405 )
406 }
407
408 type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
409 DeviceDescriptor,
410 fidl::encoding::DefaultFuchsiaResourceDialect,
411 >;
412 fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut {
413 fn _decode(
414 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
415 ) -> Result<DeviceDescriptor, fidl::Error> {
416 let _response = fidl::client::decode_transaction_body::<
417 InputDeviceGetDescriptorResponse,
418 fidl::encoding::DefaultFuchsiaResourceDialect,
419 0x3d76420f2ff8ad32,
420 >(_buf?)?;
421 Ok(_response.descriptor)
422 }
423 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescriptor>(
424 (),
425 0x3d76420f2ff8ad32,
426 fidl::encoding::DynamicFlags::empty(),
427 _decode,
428 )
429 }
430
431 type SendOutputReportResponseFut = fidl::client::QueryResponseFut<
432 InputDeviceSendOutputReportResult,
433 fidl::encoding::DefaultFuchsiaResourceDialect,
434 >;
435 fn r#send_output_report(&self, mut report: &OutputReport) -> Self::SendOutputReportResponseFut {
436 fn _decode(
437 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
438 ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
439 let _response = fidl::client::decode_transaction_body::<
440 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
441 fidl::encoding::DefaultFuchsiaResourceDialect,
442 0x67a4888774e6f3a,
443 >(_buf?)?;
444 Ok(_response.map(|x| x))
445 }
446 self.client.send_query_and_decode::<
447 InputDeviceSendOutputReportRequest,
448 InputDeviceSendOutputReportResult,
449 >(
450 (report,),
451 0x67a4888774e6f3a,
452 fidl::encoding::DynamicFlags::empty(),
453 _decode,
454 )
455 }
456
457 type GetFeatureReportResponseFut = fidl::client::QueryResponseFut<
458 InputDeviceGetFeatureReportResult,
459 fidl::encoding::DefaultFuchsiaResourceDialect,
460 >;
461 fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut {
462 fn _decode(
463 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
464 ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
465 let _response = fidl::client::decode_transaction_body::<
466 fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
467 fidl::encoding::DefaultFuchsiaResourceDialect,
468 0x497a7d98d9391f16,
469 >(_buf?)?;
470 Ok(_response.map(|x| x.report))
471 }
472 self.client.send_query_and_decode::<
473 fidl::encoding::EmptyPayload,
474 InputDeviceGetFeatureReportResult,
475 >(
476 (),
477 0x497a7d98d9391f16,
478 fidl::encoding::DynamicFlags::empty(),
479 _decode,
480 )
481 }
482
483 type SetFeatureReportResponseFut = fidl::client::QueryResponseFut<
484 InputDeviceSetFeatureReportResult,
485 fidl::encoding::DefaultFuchsiaResourceDialect,
486 >;
487 fn r#set_feature_report(
488 &self,
489 mut report: &FeatureReport,
490 ) -> Self::SetFeatureReportResponseFut {
491 fn _decode(
492 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
493 ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
494 let _response = fidl::client::decode_transaction_body::<
495 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
496 fidl::encoding::DefaultFuchsiaResourceDialect,
497 0x7679a2f5a42842ef,
498 >(_buf?)?;
499 Ok(_response.map(|x| x))
500 }
501 self.client.send_query_and_decode::<
502 InputDeviceSetFeatureReportRequest,
503 InputDeviceSetFeatureReportResult,
504 >(
505 (report,),
506 0x7679a2f5a42842ef,
507 fidl::encoding::DynamicFlags::empty(),
508 _decode,
509 )
510 }
511
512 type GetInputReportResponseFut = fidl::client::QueryResponseFut<
513 InputDeviceGetInputReportResult,
514 fidl::encoding::DefaultFuchsiaResourceDialect,
515 >;
516 fn r#get_input_report(&self, mut device_type: DeviceType) -> Self::GetInputReportResponseFut {
517 fn _decode(
518 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
519 ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
520 let _response = fidl::client::decode_transaction_body::<
521 fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
522 fidl::encoding::DefaultFuchsiaResourceDialect,
523 0x4752ccab96c10248,
524 >(_buf?)?;
525 Ok(_response.map(|x| x.report))
526 }
527 self.client.send_query_and_decode::<
528 InputDeviceGetInputReportRequest,
529 InputDeviceGetInputReportResult,
530 >(
531 (device_type,),
532 0x4752ccab96c10248,
533 fidl::encoding::DynamicFlags::empty(),
534 _decode,
535 )
536 }
537}
538
539pub struct InputDeviceEventStream {
540 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
541}
542
543impl std::marker::Unpin for InputDeviceEventStream {}
544
545impl futures::stream::FusedStream for InputDeviceEventStream {
546 fn is_terminated(&self) -> bool {
547 self.event_receiver.is_terminated()
548 }
549}
550
551impl futures::Stream for InputDeviceEventStream {
552 type Item = Result<InputDeviceEvent, fidl::Error>;
553
554 fn poll_next(
555 mut self: std::pin::Pin<&mut Self>,
556 cx: &mut std::task::Context<'_>,
557 ) -> std::task::Poll<Option<Self::Item>> {
558 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
559 &mut self.event_receiver,
560 cx
561 )?) {
562 Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
563 None => std::task::Poll::Ready(None),
564 }
565 }
566}
567
568#[derive(Debug)]
569pub enum InputDeviceEvent {
570 #[non_exhaustive]
571 _UnknownEvent {
572 ordinal: u64,
574 },
575}
576
577impl InputDeviceEvent {
578 fn decode(
580 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
581 ) -> Result<InputDeviceEvent, fidl::Error> {
582 let (bytes, _handles) = buf.split_mut();
583 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
584 debug_assert_eq!(tx_header.tx_id, 0);
585 match tx_header.ordinal {
586 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
587 Ok(InputDeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
588 }
589 _ => Err(fidl::Error::UnknownOrdinal {
590 ordinal: tx_header.ordinal,
591 protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
592 }),
593 }
594 }
595}
596
597pub struct InputDeviceRequestStream {
599 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
600 is_terminated: bool,
601}
602
603impl std::marker::Unpin for InputDeviceRequestStream {}
604
605impl futures::stream::FusedStream for InputDeviceRequestStream {
606 fn is_terminated(&self) -> bool {
607 self.is_terminated
608 }
609}
610
611impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
612 type Protocol = InputDeviceMarker;
613 type ControlHandle = InputDeviceControlHandle;
614
615 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
616 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
617 }
618
619 fn control_handle(&self) -> Self::ControlHandle {
620 InputDeviceControlHandle { inner: self.inner.clone() }
621 }
622
623 fn into_inner(
624 self,
625 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
626 {
627 (self.inner, self.is_terminated)
628 }
629
630 fn from_inner(
631 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
632 is_terminated: bool,
633 ) -> Self {
634 Self { inner, is_terminated }
635 }
636}
637
638impl futures::Stream for InputDeviceRequestStream {
639 type Item = Result<InputDeviceRequest, fidl::Error>;
640
641 fn poll_next(
642 mut self: std::pin::Pin<&mut Self>,
643 cx: &mut std::task::Context<'_>,
644 ) -> std::task::Poll<Option<Self::Item>> {
645 let this = &mut *self;
646 if this.inner.check_shutdown(cx) {
647 this.is_terminated = true;
648 return std::task::Poll::Ready(None);
649 }
650 if this.is_terminated {
651 panic!("polled InputDeviceRequestStream after completion");
652 }
653 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
654 |bytes, handles| {
655 match this.inner.channel().read_etc(cx, bytes, handles) {
656 std::task::Poll::Ready(Ok(())) => {}
657 std::task::Poll::Pending => return std::task::Poll::Pending,
658 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
659 this.is_terminated = true;
660 return std::task::Poll::Ready(None);
661 }
662 std::task::Poll::Ready(Err(e)) => {
663 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
664 e.into(),
665 ))));
666 }
667 }
668
669 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
671
672 std::task::Poll::Ready(Some(match header.ordinal {
673 0x68d9cf83e397ab41 => {
674 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
675 let mut req = fidl::new_empty!(
676 InputDeviceGetInputReportsReaderRequest,
677 fidl::encoding::DefaultFuchsiaResourceDialect
678 );
679 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
680 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
681 Ok(InputDeviceRequest::GetInputReportsReader {
682 reader: req.reader,
683
684 control_handle,
685 })
686 }
687 0x3d76420f2ff8ad32 => {
688 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
689 let mut req = fidl::new_empty!(
690 fidl::encoding::EmptyPayload,
691 fidl::encoding::DefaultFuchsiaResourceDialect
692 );
693 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
694 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
695 Ok(InputDeviceRequest::GetDescriptor {
696 responder: InputDeviceGetDescriptorResponder {
697 control_handle: std::mem::ManuallyDrop::new(control_handle),
698 tx_id: header.tx_id,
699 },
700 })
701 }
702 0x67a4888774e6f3a => {
703 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
704 let mut req = fidl::new_empty!(
705 InputDeviceSendOutputReportRequest,
706 fidl::encoding::DefaultFuchsiaResourceDialect
707 );
708 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSendOutputReportRequest>(&header, _body_bytes, handles, &mut req)?;
709 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
710 Ok(InputDeviceRequest::SendOutputReport {
711 report: req.report,
712
713 responder: InputDeviceSendOutputReportResponder {
714 control_handle: std::mem::ManuallyDrop::new(control_handle),
715 tx_id: header.tx_id,
716 },
717 })
718 }
719 0x497a7d98d9391f16 => {
720 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
721 let mut req = fidl::new_empty!(
722 fidl::encoding::EmptyPayload,
723 fidl::encoding::DefaultFuchsiaResourceDialect
724 );
725 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
726 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
727 Ok(InputDeviceRequest::GetFeatureReport {
728 responder: InputDeviceGetFeatureReportResponder {
729 control_handle: std::mem::ManuallyDrop::new(control_handle),
730 tx_id: header.tx_id,
731 },
732 })
733 }
734 0x7679a2f5a42842ef => {
735 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
736 let mut req = fidl::new_empty!(
737 InputDeviceSetFeatureReportRequest,
738 fidl::encoding::DefaultFuchsiaResourceDialect
739 );
740 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSetFeatureReportRequest>(&header, _body_bytes, handles, &mut req)?;
741 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
742 Ok(InputDeviceRequest::SetFeatureReport {
743 report: req.report,
744
745 responder: InputDeviceSetFeatureReportResponder {
746 control_handle: std::mem::ManuallyDrop::new(control_handle),
747 tx_id: header.tx_id,
748 },
749 })
750 }
751 0x4752ccab96c10248 => {
752 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
753 let mut req = fidl::new_empty!(
754 InputDeviceGetInputReportRequest,
755 fidl::encoding::DefaultFuchsiaResourceDialect
756 );
757 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportRequest>(&header, _body_bytes, handles, &mut req)?;
758 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
759 Ok(InputDeviceRequest::GetInputReport {
760 device_type: req.device_type,
761
762 responder: InputDeviceGetInputReportResponder {
763 control_handle: std::mem::ManuallyDrop::new(control_handle),
764 tx_id: header.tx_id,
765 },
766 })
767 }
768 _ if header.tx_id == 0
769 && header
770 .dynamic_flags()
771 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
772 {
773 Ok(InputDeviceRequest::_UnknownMethod {
774 ordinal: header.ordinal,
775 control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
776 method_type: fidl::MethodType::OneWay,
777 })
778 }
779 _ if header
780 .dynamic_flags()
781 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
782 {
783 this.inner.send_framework_err(
784 fidl::encoding::FrameworkErr::UnknownMethod,
785 header.tx_id,
786 header.ordinal,
787 header.dynamic_flags(),
788 (bytes, handles),
789 )?;
790 Ok(InputDeviceRequest::_UnknownMethod {
791 ordinal: header.ordinal,
792 control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
793 method_type: fidl::MethodType::TwoWay,
794 })
795 }
796 _ => Err(fidl::Error::UnknownOrdinal {
797 ordinal: header.ordinal,
798 protocol_name:
799 <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
800 }),
801 }))
802 },
803 )
804 }
805}
806
807#[derive(Debug)]
813pub enum InputDeviceRequest {
814 GetInputReportsReader {
817 reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
818 control_handle: InputDeviceControlHandle,
819 },
820 GetDescriptor { responder: InputDeviceGetDescriptorResponder },
822 SendOutputReport { report: OutputReport, responder: InputDeviceSendOutputReportResponder },
825 GetFeatureReport { responder: InputDeviceGetFeatureReportResponder },
828 SetFeatureReport { report: FeatureReport, responder: InputDeviceSetFeatureReportResponder },
831 GetInputReport { device_type: DeviceType, responder: InputDeviceGetInputReportResponder },
837 #[non_exhaustive]
839 _UnknownMethod {
840 ordinal: u64,
842 control_handle: InputDeviceControlHandle,
843 method_type: fidl::MethodType,
844 },
845}
846
847impl InputDeviceRequest {
848 #[allow(irrefutable_let_patterns)]
849 pub fn into_get_input_reports_reader(
850 self,
851 ) -> Option<(fidl::endpoints::ServerEnd<InputReportsReaderMarker>, InputDeviceControlHandle)>
852 {
853 if let InputDeviceRequest::GetInputReportsReader { reader, control_handle } = self {
854 Some((reader, control_handle))
855 } else {
856 None
857 }
858 }
859
860 #[allow(irrefutable_let_patterns)]
861 pub fn into_get_descriptor(self) -> Option<(InputDeviceGetDescriptorResponder)> {
862 if let InputDeviceRequest::GetDescriptor { responder } = self {
863 Some((responder))
864 } else {
865 None
866 }
867 }
868
869 #[allow(irrefutable_let_patterns)]
870 pub fn into_send_output_report(
871 self,
872 ) -> Option<(OutputReport, InputDeviceSendOutputReportResponder)> {
873 if let InputDeviceRequest::SendOutputReport { report, responder } = self {
874 Some((report, responder))
875 } else {
876 None
877 }
878 }
879
880 #[allow(irrefutable_let_patterns)]
881 pub fn into_get_feature_report(self) -> Option<(InputDeviceGetFeatureReportResponder)> {
882 if let InputDeviceRequest::GetFeatureReport { responder } = self {
883 Some((responder))
884 } else {
885 None
886 }
887 }
888
889 #[allow(irrefutable_let_patterns)]
890 pub fn into_set_feature_report(
891 self,
892 ) -> Option<(FeatureReport, InputDeviceSetFeatureReportResponder)> {
893 if let InputDeviceRequest::SetFeatureReport { report, responder } = self {
894 Some((report, responder))
895 } else {
896 None
897 }
898 }
899
900 #[allow(irrefutable_let_patterns)]
901 pub fn into_get_input_report(self) -> Option<(DeviceType, InputDeviceGetInputReportResponder)> {
902 if let InputDeviceRequest::GetInputReport { device_type, responder } = self {
903 Some((device_type, responder))
904 } else {
905 None
906 }
907 }
908
909 pub fn method_name(&self) -> &'static str {
911 match *self {
912 InputDeviceRequest::GetInputReportsReader { .. } => "get_input_reports_reader",
913 InputDeviceRequest::GetDescriptor { .. } => "get_descriptor",
914 InputDeviceRequest::SendOutputReport { .. } => "send_output_report",
915 InputDeviceRequest::GetFeatureReport { .. } => "get_feature_report",
916 InputDeviceRequest::SetFeatureReport { .. } => "set_feature_report",
917 InputDeviceRequest::GetInputReport { .. } => "get_input_report",
918 InputDeviceRequest::_UnknownMethod {
919 method_type: fidl::MethodType::OneWay, ..
920 } => "unknown one-way method",
921 InputDeviceRequest::_UnknownMethod {
922 method_type: fidl::MethodType::TwoWay, ..
923 } => "unknown two-way method",
924 }
925 }
926}
927
928#[derive(Debug, Clone)]
929pub struct InputDeviceControlHandle {
930 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
931}
932
933impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
934 fn shutdown(&self) {
935 self.inner.shutdown()
936 }
937 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
938 self.inner.shutdown_with_epitaph(status)
939 }
940
941 fn is_closed(&self) -> bool {
942 self.inner.channel().is_closed()
943 }
944 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
945 self.inner.channel().on_closed()
946 }
947
948 #[cfg(target_os = "fuchsia")]
949 fn signal_peer(
950 &self,
951 clear_mask: zx::Signals,
952 set_mask: zx::Signals,
953 ) -> Result<(), zx_status::Status> {
954 use fidl::Peered;
955 self.inner.channel().signal_peer(clear_mask, set_mask)
956 }
957}
958
959impl InputDeviceControlHandle {}
960
961#[must_use = "FIDL methods require a response to be sent"]
962#[derive(Debug)]
963pub struct InputDeviceGetDescriptorResponder {
964 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
965 tx_id: u32,
966}
967
968impl std::ops::Drop for InputDeviceGetDescriptorResponder {
972 fn drop(&mut self) {
973 self.control_handle.shutdown();
974 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
976 }
977}
978
979impl fidl::endpoints::Responder for InputDeviceGetDescriptorResponder {
980 type ControlHandle = InputDeviceControlHandle;
981
982 fn control_handle(&self) -> &InputDeviceControlHandle {
983 &self.control_handle
984 }
985
986 fn drop_without_shutdown(mut self) {
987 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
989 std::mem::forget(self);
991 }
992}
993
994impl InputDeviceGetDescriptorResponder {
995 pub fn send(self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
999 let _result = self.send_raw(descriptor);
1000 if _result.is_err() {
1001 self.control_handle.shutdown();
1002 }
1003 self.drop_without_shutdown();
1004 _result
1005 }
1006
1007 pub fn send_no_shutdown_on_err(
1009 self,
1010 mut descriptor: &DeviceDescriptor,
1011 ) -> Result<(), fidl::Error> {
1012 let _result = self.send_raw(descriptor);
1013 self.drop_without_shutdown();
1014 _result
1015 }
1016
1017 fn send_raw(&self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1018 self.control_handle.inner.send::<InputDeviceGetDescriptorResponse>(
1019 (descriptor,),
1020 self.tx_id,
1021 0x3d76420f2ff8ad32,
1022 fidl::encoding::DynamicFlags::empty(),
1023 )
1024 }
1025}
1026
1027#[must_use = "FIDL methods require a response to be sent"]
1028#[derive(Debug)]
1029pub struct InputDeviceSendOutputReportResponder {
1030 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1031 tx_id: u32,
1032}
1033
1034impl std::ops::Drop for InputDeviceSendOutputReportResponder {
1038 fn drop(&mut self) {
1039 self.control_handle.shutdown();
1040 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1042 }
1043}
1044
1045impl fidl::endpoints::Responder for InputDeviceSendOutputReportResponder {
1046 type ControlHandle = InputDeviceControlHandle;
1047
1048 fn control_handle(&self) -> &InputDeviceControlHandle {
1049 &self.control_handle
1050 }
1051
1052 fn drop_without_shutdown(mut self) {
1053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1055 std::mem::forget(self);
1057 }
1058}
1059
1060impl InputDeviceSendOutputReportResponder {
1061 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1065 let _result = self.send_raw(result);
1066 if _result.is_err() {
1067 self.control_handle.shutdown();
1068 }
1069 self.drop_without_shutdown();
1070 _result
1071 }
1072
1073 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1075 let _result = self.send_raw(result);
1076 self.drop_without_shutdown();
1077 _result
1078 }
1079
1080 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1081 self.control_handle
1082 .inner
1083 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1084 result,
1085 self.tx_id,
1086 0x67a4888774e6f3a,
1087 fidl::encoding::DynamicFlags::empty(),
1088 )
1089 }
1090}
1091
1092#[must_use = "FIDL methods require a response to be sent"]
1093#[derive(Debug)]
1094pub struct InputDeviceGetFeatureReportResponder {
1095 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1096 tx_id: u32,
1097}
1098
1099impl std::ops::Drop for InputDeviceGetFeatureReportResponder {
1103 fn drop(&mut self) {
1104 self.control_handle.shutdown();
1105 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1107 }
1108}
1109
1110impl fidl::endpoints::Responder for InputDeviceGetFeatureReportResponder {
1111 type ControlHandle = InputDeviceControlHandle;
1112
1113 fn control_handle(&self) -> &InputDeviceControlHandle {
1114 &self.control_handle
1115 }
1116
1117 fn drop_without_shutdown(mut self) {
1118 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1120 std::mem::forget(self);
1122 }
1123}
1124
1125impl InputDeviceGetFeatureReportResponder {
1126 pub fn send(self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1130 let _result = self.send_raw(result);
1131 if _result.is_err() {
1132 self.control_handle.shutdown();
1133 }
1134 self.drop_without_shutdown();
1135 _result
1136 }
1137
1138 pub fn send_no_shutdown_on_err(
1140 self,
1141 mut result: Result<&FeatureReport, i32>,
1142 ) -> Result<(), fidl::Error> {
1143 let _result = self.send_raw(result);
1144 self.drop_without_shutdown();
1145 _result
1146 }
1147
1148 fn send_raw(&self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1149 self.control_handle.inner.send::<fidl::encoding::ResultType<
1150 InputDeviceGetFeatureReportResponse,
1151 i32,
1152 >>(
1153 result.map(|report| (report,)),
1154 self.tx_id,
1155 0x497a7d98d9391f16,
1156 fidl::encoding::DynamicFlags::empty(),
1157 )
1158 }
1159}
1160
1161#[must_use = "FIDL methods require a response to be sent"]
1162#[derive(Debug)]
1163pub struct InputDeviceSetFeatureReportResponder {
1164 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1165 tx_id: u32,
1166}
1167
1168impl std::ops::Drop for InputDeviceSetFeatureReportResponder {
1172 fn drop(&mut self) {
1173 self.control_handle.shutdown();
1174 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1176 }
1177}
1178
1179impl fidl::endpoints::Responder for InputDeviceSetFeatureReportResponder {
1180 type ControlHandle = InputDeviceControlHandle;
1181
1182 fn control_handle(&self) -> &InputDeviceControlHandle {
1183 &self.control_handle
1184 }
1185
1186 fn drop_without_shutdown(mut self) {
1187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189 std::mem::forget(self);
1191 }
1192}
1193
1194impl InputDeviceSetFeatureReportResponder {
1195 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1199 let _result = self.send_raw(result);
1200 if _result.is_err() {
1201 self.control_handle.shutdown();
1202 }
1203 self.drop_without_shutdown();
1204 _result
1205 }
1206
1207 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1209 let _result = self.send_raw(result);
1210 self.drop_without_shutdown();
1211 _result
1212 }
1213
1214 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1215 self.control_handle
1216 .inner
1217 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1218 result,
1219 self.tx_id,
1220 0x7679a2f5a42842ef,
1221 fidl::encoding::DynamicFlags::empty(),
1222 )
1223 }
1224}
1225
1226#[must_use = "FIDL methods require a response to be sent"]
1227#[derive(Debug)]
1228pub struct InputDeviceGetInputReportResponder {
1229 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1230 tx_id: u32,
1231}
1232
1233impl std::ops::Drop for InputDeviceGetInputReportResponder {
1237 fn drop(&mut self) {
1238 self.control_handle.shutdown();
1239 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1241 }
1242}
1243
1244impl fidl::endpoints::Responder for InputDeviceGetInputReportResponder {
1245 type ControlHandle = InputDeviceControlHandle;
1246
1247 fn control_handle(&self) -> &InputDeviceControlHandle {
1248 &self.control_handle
1249 }
1250
1251 fn drop_without_shutdown(mut self) {
1252 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1254 std::mem::forget(self);
1256 }
1257}
1258
1259impl InputDeviceGetInputReportResponder {
1260 pub fn send(self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1264 let _result = self.send_raw(result);
1265 if _result.is_err() {
1266 self.control_handle.shutdown();
1267 }
1268 self.drop_without_shutdown();
1269 _result
1270 }
1271
1272 pub fn send_no_shutdown_on_err(
1274 self,
1275 mut result: Result<InputReport, i32>,
1276 ) -> Result<(), fidl::Error> {
1277 let _result = self.send_raw(result);
1278 self.drop_without_shutdown();
1279 _result
1280 }
1281
1282 fn send_raw(&self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1283 self.control_handle
1284 .inner
1285 .send::<fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>>(
1286 result.as_mut().map_err(|e| *e).map(|report| (report,)),
1287 self.tx_id,
1288 0x4752ccab96c10248,
1289 fidl::encoding::DynamicFlags::empty(),
1290 )
1291 }
1292}
1293
1294#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1295pub struct InputReportsReaderMarker;
1296
1297impl fidl::endpoints::ProtocolMarker for InputReportsReaderMarker {
1298 type Proxy = InputReportsReaderProxy;
1299 type RequestStream = InputReportsReaderRequestStream;
1300 #[cfg(target_os = "fuchsia")]
1301 type SynchronousProxy = InputReportsReaderSynchronousProxy;
1302
1303 const DEBUG_NAME: &'static str = "(anonymous) InputReportsReader";
1304}
1305pub type InputReportsReaderReadInputReportsResult = Result<Vec<InputReport>, i32>;
1306
1307pub trait InputReportsReaderProxyInterface: Send + Sync {
1308 type ReadInputReportsResponseFut: std::future::Future<Output = Result<InputReportsReaderReadInputReportsResult, fidl::Error>>
1309 + Send;
1310 fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut;
1311}
1312#[derive(Debug)]
1313#[cfg(target_os = "fuchsia")]
1314pub struct InputReportsReaderSynchronousProxy {
1315 client: fidl::client::sync::Client,
1316}
1317
1318#[cfg(target_os = "fuchsia")]
1319impl fidl::endpoints::SynchronousProxy for InputReportsReaderSynchronousProxy {
1320 type Proxy = InputReportsReaderProxy;
1321 type Protocol = InputReportsReaderMarker;
1322
1323 fn from_channel(inner: fidl::Channel) -> Self {
1324 Self::new(inner)
1325 }
1326
1327 fn into_channel(self) -> fidl::Channel {
1328 self.client.into_channel()
1329 }
1330
1331 fn as_channel(&self) -> &fidl::Channel {
1332 self.client.as_channel()
1333 }
1334}
1335
1336#[cfg(target_os = "fuchsia")]
1337impl InputReportsReaderSynchronousProxy {
1338 pub fn new(channel: fidl::Channel) -> Self {
1339 let protocol_name =
1340 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1341 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1342 }
1343
1344 pub fn into_channel(self) -> fidl::Channel {
1345 self.client.into_channel()
1346 }
1347
1348 pub fn wait_for_event(
1351 &self,
1352 deadline: zx::MonotonicInstant,
1353 ) -> Result<InputReportsReaderEvent, fidl::Error> {
1354 InputReportsReaderEvent::decode(self.client.wait_for_event(deadline)?)
1355 }
1356
1357 pub fn r#read_input_reports(
1363 &self,
1364 ___deadline: zx::MonotonicInstant,
1365 ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1366 let _response =
1367 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1368 InputReportsReaderReadInputReportsResponse,
1369 i32,
1370 >>(
1371 (),
1372 0x3595efdc88842559,
1373 fidl::encoding::DynamicFlags::empty(),
1374 ___deadline,
1375 )?;
1376 Ok(_response.map(|x| x.reports))
1377 }
1378}
1379
1380#[cfg(target_os = "fuchsia")]
1381impl From<InputReportsReaderSynchronousProxy> for zx::Handle {
1382 fn from(value: InputReportsReaderSynchronousProxy) -> Self {
1383 value.into_channel().into()
1384 }
1385}
1386
1387#[cfg(target_os = "fuchsia")]
1388impl From<fidl::Channel> for InputReportsReaderSynchronousProxy {
1389 fn from(value: fidl::Channel) -> Self {
1390 Self::new(value)
1391 }
1392}
1393
1394#[cfg(target_os = "fuchsia")]
1395impl fidl::endpoints::FromClient for InputReportsReaderSynchronousProxy {
1396 type Protocol = InputReportsReaderMarker;
1397
1398 fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderMarker>) -> Self {
1399 Self::new(value.into_channel())
1400 }
1401}
1402
1403#[derive(Debug, Clone)]
1404pub struct InputReportsReaderProxy {
1405 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1406}
1407
1408impl fidl::endpoints::Proxy for InputReportsReaderProxy {
1409 type Protocol = InputReportsReaderMarker;
1410
1411 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1412 Self::new(inner)
1413 }
1414
1415 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1416 self.client.into_channel().map_err(|client| Self { client })
1417 }
1418
1419 fn as_channel(&self) -> &::fidl::AsyncChannel {
1420 self.client.as_channel()
1421 }
1422}
1423
1424impl InputReportsReaderProxy {
1425 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1427 let protocol_name =
1428 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1429 Self { client: fidl::client::Client::new(channel, protocol_name) }
1430 }
1431
1432 pub fn take_event_stream(&self) -> InputReportsReaderEventStream {
1438 InputReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
1439 }
1440
1441 pub fn r#read_input_reports(
1447 &self,
1448 ) -> fidl::client::QueryResponseFut<
1449 InputReportsReaderReadInputReportsResult,
1450 fidl::encoding::DefaultFuchsiaResourceDialect,
1451 > {
1452 InputReportsReaderProxyInterface::r#read_input_reports(self)
1453 }
1454}
1455
1456impl InputReportsReaderProxyInterface for InputReportsReaderProxy {
1457 type ReadInputReportsResponseFut = fidl::client::QueryResponseFut<
1458 InputReportsReaderReadInputReportsResult,
1459 fidl::encoding::DefaultFuchsiaResourceDialect,
1460 >;
1461 fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut {
1462 fn _decode(
1463 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1464 ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1465 let _response = fidl::client::decode_transaction_body::<
1466 fidl::encoding::ResultType<InputReportsReaderReadInputReportsResponse, i32>,
1467 fidl::encoding::DefaultFuchsiaResourceDialect,
1468 0x3595efdc88842559,
1469 >(_buf?)?;
1470 Ok(_response.map(|x| x.reports))
1471 }
1472 self.client.send_query_and_decode::<
1473 fidl::encoding::EmptyPayload,
1474 InputReportsReaderReadInputReportsResult,
1475 >(
1476 (),
1477 0x3595efdc88842559,
1478 fidl::encoding::DynamicFlags::empty(),
1479 _decode,
1480 )
1481 }
1482}
1483
1484pub struct InputReportsReaderEventStream {
1485 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1486}
1487
1488impl std::marker::Unpin for InputReportsReaderEventStream {}
1489
1490impl futures::stream::FusedStream for InputReportsReaderEventStream {
1491 fn is_terminated(&self) -> bool {
1492 self.event_receiver.is_terminated()
1493 }
1494}
1495
1496impl futures::Stream for InputReportsReaderEventStream {
1497 type Item = Result<InputReportsReaderEvent, fidl::Error>;
1498
1499 fn poll_next(
1500 mut self: std::pin::Pin<&mut Self>,
1501 cx: &mut std::task::Context<'_>,
1502 ) -> std::task::Poll<Option<Self::Item>> {
1503 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1504 &mut self.event_receiver,
1505 cx
1506 )?) {
1507 Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderEvent::decode(buf))),
1508 None => std::task::Poll::Ready(None),
1509 }
1510 }
1511}
1512
1513#[derive(Debug)]
1514pub enum InputReportsReaderEvent {}
1515
1516impl InputReportsReaderEvent {
1517 fn decode(
1519 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1520 ) -> Result<InputReportsReaderEvent, fidl::Error> {
1521 let (bytes, _handles) = buf.split_mut();
1522 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1523 debug_assert_eq!(tx_header.tx_id, 0);
1524 match tx_header.ordinal {
1525 _ => Err(fidl::Error::UnknownOrdinal {
1526 ordinal: tx_header.ordinal,
1527 protocol_name:
1528 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1529 }),
1530 }
1531 }
1532}
1533
1534pub struct InputReportsReaderRequestStream {
1536 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1537 is_terminated: bool,
1538}
1539
1540impl std::marker::Unpin for InputReportsReaderRequestStream {}
1541
1542impl futures::stream::FusedStream for InputReportsReaderRequestStream {
1543 fn is_terminated(&self) -> bool {
1544 self.is_terminated
1545 }
1546}
1547
1548impl fidl::endpoints::RequestStream for InputReportsReaderRequestStream {
1549 type Protocol = InputReportsReaderMarker;
1550 type ControlHandle = InputReportsReaderControlHandle;
1551
1552 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1553 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1554 }
1555
1556 fn control_handle(&self) -> Self::ControlHandle {
1557 InputReportsReaderControlHandle { inner: self.inner.clone() }
1558 }
1559
1560 fn into_inner(
1561 self,
1562 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1563 {
1564 (self.inner, self.is_terminated)
1565 }
1566
1567 fn from_inner(
1568 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1569 is_terminated: bool,
1570 ) -> Self {
1571 Self { inner, is_terminated }
1572 }
1573}
1574
1575impl futures::Stream for InputReportsReaderRequestStream {
1576 type Item = Result<InputReportsReaderRequest, fidl::Error>;
1577
1578 fn poll_next(
1579 mut self: std::pin::Pin<&mut Self>,
1580 cx: &mut std::task::Context<'_>,
1581 ) -> std::task::Poll<Option<Self::Item>> {
1582 let this = &mut *self;
1583 if this.inner.check_shutdown(cx) {
1584 this.is_terminated = true;
1585 return std::task::Poll::Ready(None);
1586 }
1587 if this.is_terminated {
1588 panic!("polled InputReportsReaderRequestStream after completion");
1589 }
1590 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1591 |bytes, handles| {
1592 match this.inner.channel().read_etc(cx, bytes, handles) {
1593 std::task::Poll::Ready(Ok(())) => {}
1594 std::task::Poll::Pending => return std::task::Poll::Pending,
1595 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1596 this.is_terminated = true;
1597 return std::task::Poll::Ready(None);
1598 }
1599 std::task::Poll::Ready(Err(e)) => {
1600 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1601 e.into(),
1602 ))));
1603 }
1604 }
1605
1606 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1608
1609 std::task::Poll::Ready(Some(match header.ordinal {
1610 0x3595efdc88842559 => {
1611 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1612 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1613 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1614 let control_handle = InputReportsReaderControlHandle {
1615 inner: this.inner.clone(),
1616 };
1617 Ok(InputReportsReaderRequest::ReadInputReports {
1618 responder: InputReportsReaderReadInputReportsResponder {
1619 control_handle: std::mem::ManuallyDrop::new(control_handle),
1620 tx_id: header.tx_id,
1621 },
1622 })
1623 }
1624 _ => Err(fidl::Error::UnknownOrdinal {
1625 ordinal: header.ordinal,
1626 protocol_name: <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1627 }),
1628 }))
1629 },
1630 )
1631 }
1632}
1633
1634#[derive(Debug)]
1639pub enum InputReportsReaderRequest {
1640 ReadInputReports { responder: InputReportsReaderReadInputReportsResponder },
1646}
1647
1648impl InputReportsReaderRequest {
1649 #[allow(irrefutable_let_patterns)]
1650 pub fn into_read_input_reports(self) -> Option<(InputReportsReaderReadInputReportsResponder)> {
1651 if let InputReportsReaderRequest::ReadInputReports { responder } = self {
1652 Some((responder))
1653 } else {
1654 None
1655 }
1656 }
1657
1658 pub fn method_name(&self) -> &'static str {
1660 match *self {
1661 InputReportsReaderRequest::ReadInputReports { .. } => "read_input_reports",
1662 }
1663 }
1664}
1665
1666#[derive(Debug, Clone)]
1667pub struct InputReportsReaderControlHandle {
1668 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1669}
1670
1671impl fidl::endpoints::ControlHandle for InputReportsReaderControlHandle {
1672 fn shutdown(&self) {
1673 self.inner.shutdown()
1674 }
1675 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1676 self.inner.shutdown_with_epitaph(status)
1677 }
1678
1679 fn is_closed(&self) -> bool {
1680 self.inner.channel().is_closed()
1681 }
1682 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1683 self.inner.channel().on_closed()
1684 }
1685
1686 #[cfg(target_os = "fuchsia")]
1687 fn signal_peer(
1688 &self,
1689 clear_mask: zx::Signals,
1690 set_mask: zx::Signals,
1691 ) -> Result<(), zx_status::Status> {
1692 use fidl::Peered;
1693 self.inner.channel().signal_peer(clear_mask, set_mask)
1694 }
1695}
1696
1697impl InputReportsReaderControlHandle {}
1698
1699#[must_use = "FIDL methods require a response to be sent"]
1700#[derive(Debug)]
1701pub struct InputReportsReaderReadInputReportsResponder {
1702 control_handle: std::mem::ManuallyDrop<InputReportsReaderControlHandle>,
1703 tx_id: u32,
1704}
1705
1706impl std::ops::Drop for InputReportsReaderReadInputReportsResponder {
1710 fn drop(&mut self) {
1711 self.control_handle.shutdown();
1712 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1714 }
1715}
1716
1717impl fidl::endpoints::Responder for InputReportsReaderReadInputReportsResponder {
1718 type ControlHandle = InputReportsReaderControlHandle;
1719
1720 fn control_handle(&self) -> &InputReportsReaderControlHandle {
1721 &self.control_handle
1722 }
1723
1724 fn drop_without_shutdown(mut self) {
1725 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1727 std::mem::forget(self);
1729 }
1730}
1731
1732impl InputReportsReaderReadInputReportsResponder {
1733 pub fn send(self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1737 let _result = self.send_raw(result);
1738 if _result.is_err() {
1739 self.control_handle.shutdown();
1740 }
1741 self.drop_without_shutdown();
1742 _result
1743 }
1744
1745 pub fn send_no_shutdown_on_err(
1747 self,
1748 mut result: Result<Vec<InputReport>, i32>,
1749 ) -> Result<(), fidl::Error> {
1750 let _result = self.send_raw(result);
1751 self.drop_without_shutdown();
1752 _result
1753 }
1754
1755 fn send_raw(&self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1756 self.control_handle.inner.send::<fidl::encoding::ResultType<
1757 InputReportsReaderReadInputReportsResponse,
1758 i32,
1759 >>(
1760 result.as_mut().map_err(|e| *e).map(|reports| (reports.as_mut_slice(),)),
1761 self.tx_id,
1762 0x3595efdc88842559,
1763 fidl::encoding::DynamicFlags::empty(),
1764 )
1765 }
1766}
1767
1768#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1769pub struct ServiceMarker;
1770
1771#[cfg(target_os = "fuchsia")]
1772impl fidl::endpoints::ServiceMarker for ServiceMarker {
1773 type Proxy = ServiceProxy;
1774 type Request = ServiceRequest;
1775 const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
1776}
1777
1778#[cfg(target_os = "fuchsia")]
1781pub enum ServiceRequest {
1782 InputDevice(InputDeviceRequestStream),
1783}
1784
1785#[cfg(target_os = "fuchsia")]
1786impl fidl::endpoints::ServiceRequest for ServiceRequest {
1787 type Service = ServiceMarker;
1788
1789 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1790 match name {
1791 "input_device" => Self::InputDevice(
1792 <InputDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
1793 _channel,
1794 ),
1795 ),
1796 _ => panic!("no such member protocol name for service Service"),
1797 }
1798 }
1799
1800 fn member_names() -> &'static [&'static str] {
1801 &["input_device"]
1802 }
1803}
1804#[cfg(target_os = "fuchsia")]
1805pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1806
1807#[cfg(target_os = "fuchsia")]
1808impl fidl::endpoints::ServiceProxy for ServiceProxy {
1809 type Service = ServiceMarker;
1810
1811 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1812 Self(opener)
1813 }
1814}
1815
1816#[cfg(target_os = "fuchsia")]
1817impl ServiceProxy {
1818 pub fn connect_to_input_device(&self) -> Result<InputDeviceProxy, fidl::Error> {
1819 let (proxy, server_end) = fidl::endpoints::create_proxy::<InputDeviceMarker>();
1820 self.connect_channel_to_input_device(server_end)?;
1821 Ok(proxy)
1822 }
1823
1824 pub fn connect_to_input_device_sync(&self) -> Result<InputDeviceSynchronousProxy, fidl::Error> {
1827 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<InputDeviceMarker>();
1828 self.connect_channel_to_input_device(server_end)?;
1829 Ok(proxy)
1830 }
1831
1832 pub fn connect_channel_to_input_device(
1835 &self,
1836 server_end: fidl::endpoints::ServerEnd<InputDeviceMarker>,
1837 ) -> Result<(), fidl::Error> {
1838 self.0.open_member("input_device", server_end.into_channel())
1839 }
1840
1841 pub fn instance_name(&self) -> &str {
1842 self.0.instance_name()
1843 }
1844}
1845
1846mod internal {
1847 use super::*;
1848
1849 impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderRequest {
1850 type Borrowed<'a> = &'a mut Self;
1851 fn take_or_borrow<'a>(
1852 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1853 ) -> Self::Borrowed<'a> {
1854 value
1855 }
1856 }
1857
1858 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderRequest {
1859 type Owned = Self;
1860
1861 #[inline(always)]
1862 fn inline_align(_context: fidl::encoding::Context) -> usize {
1863 4
1864 }
1865
1866 #[inline(always)]
1867 fn inline_size(_context: fidl::encoding::Context) -> usize {
1868 4
1869 }
1870 }
1871
1872 unsafe impl
1873 fidl::encoding::Encode<
1874 InputDeviceGetInputReportsReaderRequest,
1875 fidl::encoding::DefaultFuchsiaResourceDialect,
1876 > for &mut InputDeviceGetInputReportsReaderRequest
1877 {
1878 #[inline]
1879 unsafe fn encode(
1880 self,
1881 encoder: &mut fidl::encoding::Encoder<
1882 '_,
1883 fidl::encoding::DefaultFuchsiaResourceDialect,
1884 >,
1885 offset: usize,
1886 _depth: fidl::encoding::Depth,
1887 ) -> fidl::Result<()> {
1888 encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1889 fidl::encoding::Encode::<InputDeviceGetInputReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1891 (
1892 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
1893 ),
1894 encoder, offset, _depth
1895 )
1896 }
1897 }
1898 unsafe impl<
1899 T0: fidl::encoding::Encode<
1900 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1901 fidl::encoding::DefaultFuchsiaResourceDialect,
1902 >,
1903 >
1904 fidl::encoding::Encode<
1905 InputDeviceGetInputReportsReaderRequest,
1906 fidl::encoding::DefaultFuchsiaResourceDialect,
1907 > for (T0,)
1908 {
1909 #[inline]
1910 unsafe fn encode(
1911 self,
1912 encoder: &mut fidl::encoding::Encoder<
1913 '_,
1914 fidl::encoding::DefaultFuchsiaResourceDialect,
1915 >,
1916 offset: usize,
1917 depth: fidl::encoding::Depth,
1918 ) -> fidl::Result<()> {
1919 encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1920 self.0.encode(encoder, offset + 0, depth)?;
1924 Ok(())
1925 }
1926 }
1927
1928 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1929 for InputDeviceGetInputReportsReaderRequest
1930 {
1931 #[inline(always)]
1932 fn new_empty() -> Self {
1933 Self {
1934 reader: fidl::new_empty!(
1935 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1936 fidl::encoding::DefaultFuchsiaResourceDialect
1937 ),
1938 }
1939 }
1940
1941 #[inline]
1942 unsafe fn decode(
1943 &mut self,
1944 decoder: &mut fidl::encoding::Decoder<
1945 '_,
1946 fidl::encoding::DefaultFuchsiaResourceDialect,
1947 >,
1948 offset: usize,
1949 _depth: fidl::encoding::Depth,
1950 ) -> fidl::Result<()> {
1951 decoder.debug_check_bounds::<Self>(offset);
1952 fidl::decode!(
1954 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1955 fidl::encoding::DefaultFuchsiaResourceDialect,
1956 &mut self.reader,
1957 decoder,
1958 offset + 0,
1959 _depth
1960 )?;
1961 Ok(())
1962 }
1963 }
1964
1965 impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportResponse {
1966 type Borrowed<'a> = &'a mut Self;
1967 fn take_or_borrow<'a>(
1968 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1969 ) -> Self::Borrowed<'a> {
1970 value
1971 }
1972 }
1973
1974 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
1975 type Owned = Self;
1976
1977 #[inline(always)]
1978 fn inline_align(_context: fidl::encoding::Context) -> usize {
1979 8
1980 }
1981
1982 #[inline(always)]
1983 fn inline_size(_context: fidl::encoding::Context) -> usize {
1984 16
1985 }
1986 }
1987
1988 unsafe impl
1989 fidl::encoding::Encode<
1990 InputDeviceGetInputReportResponse,
1991 fidl::encoding::DefaultFuchsiaResourceDialect,
1992 > for &mut InputDeviceGetInputReportResponse
1993 {
1994 #[inline]
1995 unsafe fn encode(
1996 self,
1997 encoder: &mut fidl::encoding::Encoder<
1998 '_,
1999 fidl::encoding::DefaultFuchsiaResourceDialect,
2000 >,
2001 offset: usize,
2002 _depth: fidl::encoding::Depth,
2003 ) -> fidl::Result<()> {
2004 encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2005 fidl::encoding::Encode::<
2007 InputDeviceGetInputReportResponse,
2008 fidl::encoding::DefaultFuchsiaResourceDialect,
2009 >::encode(
2010 (<InputReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2011 &mut self.report,
2012 ),),
2013 encoder,
2014 offset,
2015 _depth,
2016 )
2017 }
2018 }
2019 unsafe impl<
2020 T0: fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>,
2021 >
2022 fidl::encoding::Encode<
2023 InputDeviceGetInputReportResponse,
2024 fidl::encoding::DefaultFuchsiaResourceDialect,
2025 > for (T0,)
2026 {
2027 #[inline]
2028 unsafe fn encode(
2029 self,
2030 encoder: &mut fidl::encoding::Encoder<
2031 '_,
2032 fidl::encoding::DefaultFuchsiaResourceDialect,
2033 >,
2034 offset: usize,
2035 depth: fidl::encoding::Depth,
2036 ) -> fidl::Result<()> {
2037 encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2038 self.0.encode(encoder, offset + 0, depth)?;
2042 Ok(())
2043 }
2044 }
2045
2046 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2047 for InputDeviceGetInputReportResponse
2048 {
2049 #[inline(always)]
2050 fn new_empty() -> Self {
2051 Self {
2052 report: fidl::new_empty!(
2053 InputReport,
2054 fidl::encoding::DefaultFuchsiaResourceDialect
2055 ),
2056 }
2057 }
2058
2059 #[inline]
2060 unsafe fn decode(
2061 &mut self,
2062 decoder: &mut fidl::encoding::Decoder<
2063 '_,
2064 fidl::encoding::DefaultFuchsiaResourceDialect,
2065 >,
2066 offset: usize,
2067 _depth: fidl::encoding::Depth,
2068 ) -> fidl::Result<()> {
2069 decoder.debug_check_bounds::<Self>(offset);
2070 fidl::decode!(
2072 InputReport,
2073 fidl::encoding::DefaultFuchsiaResourceDialect,
2074 &mut self.report,
2075 decoder,
2076 offset + 0,
2077 _depth
2078 )?;
2079 Ok(())
2080 }
2081 }
2082
2083 impl fidl::encoding::ResourceTypeMarker for InputReportsReaderReadInputReportsResponse {
2084 type Borrowed<'a> = &'a mut Self;
2085 fn take_or_borrow<'a>(
2086 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2087 ) -> Self::Borrowed<'a> {
2088 value
2089 }
2090 }
2091
2092 unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2093 type Owned = Self;
2094
2095 #[inline(always)]
2096 fn inline_align(_context: fidl::encoding::Context) -> usize {
2097 8
2098 }
2099
2100 #[inline(always)]
2101 fn inline_size(_context: fidl::encoding::Context) -> usize {
2102 16
2103 }
2104 }
2105
2106 unsafe impl
2107 fidl::encoding::Encode<
2108 InputReportsReaderReadInputReportsResponse,
2109 fidl::encoding::DefaultFuchsiaResourceDialect,
2110 > for &mut InputReportsReaderReadInputReportsResponse
2111 {
2112 #[inline]
2113 unsafe fn encode(
2114 self,
2115 encoder: &mut fidl::encoding::Encoder<
2116 '_,
2117 fidl::encoding::DefaultFuchsiaResourceDialect,
2118 >,
2119 offset: usize,
2120 _depth: fidl::encoding::Depth,
2121 ) -> fidl::Result<()> {
2122 encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2123 fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2125 (
2126 <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
2127 ),
2128 encoder, offset, _depth
2129 )
2130 }
2131 }
2132 unsafe impl<
2133 T0: fidl::encoding::Encode<
2134 fidl::encoding::Vector<InputReport, 50>,
2135 fidl::encoding::DefaultFuchsiaResourceDialect,
2136 >,
2137 >
2138 fidl::encoding::Encode<
2139 InputReportsReaderReadInputReportsResponse,
2140 fidl::encoding::DefaultFuchsiaResourceDialect,
2141 > for (T0,)
2142 {
2143 #[inline]
2144 unsafe fn encode(
2145 self,
2146 encoder: &mut fidl::encoding::Encoder<
2147 '_,
2148 fidl::encoding::DefaultFuchsiaResourceDialect,
2149 >,
2150 offset: usize,
2151 depth: fidl::encoding::Depth,
2152 ) -> fidl::Result<()> {
2153 encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2154 self.0.encode(encoder, offset + 0, depth)?;
2158 Ok(())
2159 }
2160 }
2161
2162 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2163 for InputReportsReaderReadInputReportsResponse
2164 {
2165 #[inline(always)]
2166 fn new_empty() -> Self {
2167 Self {
2168 reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
2169 }
2170 }
2171
2172 #[inline]
2173 unsafe fn decode(
2174 &mut self,
2175 decoder: &mut fidl::encoding::Decoder<
2176 '_,
2177 fidl::encoding::DefaultFuchsiaResourceDialect,
2178 >,
2179 offset: usize,
2180 _depth: fidl::encoding::Depth,
2181 ) -> fidl::Result<()> {
2182 decoder.debug_check_bounds::<Self>(offset);
2183 fidl::decode!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
2185 Ok(())
2186 }
2187 }
2188
2189 impl InputReport {
2190 #[inline(always)]
2191 fn max_ordinal_present(&self) -> u64 {
2192 if let Some(_) = self.wake_lease {
2193 return 9;
2194 }
2195 if let Some(_) = self.report_id {
2196 return 8;
2197 }
2198 if let Some(_) = self.trace_id {
2199 return 7;
2200 }
2201 if let Some(_) = self.consumer_control {
2202 return 6;
2203 }
2204 if let Some(_) = self.keyboard {
2205 return 5;
2206 }
2207 if let Some(_) = self.touch {
2208 return 4;
2209 }
2210 if let Some(_) = self.sensor {
2211 return 3;
2212 }
2213 if let Some(_) = self.mouse {
2214 return 2;
2215 }
2216 if let Some(_) = self.event_time {
2217 return 1;
2218 }
2219 0
2220 }
2221 }
2222
2223 impl fidl::encoding::ResourceTypeMarker for InputReport {
2224 type Borrowed<'a> = &'a mut Self;
2225 fn take_or_borrow<'a>(
2226 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2227 ) -> Self::Borrowed<'a> {
2228 value
2229 }
2230 }
2231
2232 unsafe impl fidl::encoding::TypeMarker for InputReport {
2233 type Owned = Self;
2234
2235 #[inline(always)]
2236 fn inline_align(_context: fidl::encoding::Context) -> usize {
2237 8
2238 }
2239
2240 #[inline(always)]
2241 fn inline_size(_context: fidl::encoding::Context) -> usize {
2242 16
2243 }
2244 }
2245
2246 unsafe impl fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>
2247 for &mut InputReport
2248 {
2249 unsafe fn encode(
2250 self,
2251 encoder: &mut fidl::encoding::Encoder<
2252 '_,
2253 fidl::encoding::DefaultFuchsiaResourceDialect,
2254 >,
2255 offset: usize,
2256 mut depth: fidl::encoding::Depth,
2257 ) -> fidl::Result<()> {
2258 encoder.debug_check_bounds::<InputReport>(offset);
2259 let max_ordinal: u64 = self.max_ordinal_present();
2261 encoder.write_num(max_ordinal, offset);
2262 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2263 if max_ordinal == 0 {
2265 return Ok(());
2266 }
2267 depth.increment()?;
2268 let envelope_size = 8;
2269 let bytes_len = max_ordinal as usize * envelope_size;
2270 #[allow(unused_variables)]
2271 let offset = encoder.out_of_line_offset(bytes_len);
2272 let mut _prev_end_offset: usize = 0;
2273 if 1 > max_ordinal {
2274 return Ok(());
2275 }
2276
2277 let cur_offset: usize = (1 - 1) * envelope_size;
2280
2281 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2283
2284 fidl::encoding::encode_in_envelope_optional::<
2289 i64,
2290 fidl::encoding::DefaultFuchsiaResourceDialect,
2291 >(
2292 self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2293 encoder,
2294 offset + cur_offset,
2295 depth,
2296 )?;
2297
2298 _prev_end_offset = cur_offset + envelope_size;
2299 if 2 > max_ordinal {
2300 return Ok(());
2301 }
2302
2303 let cur_offset: usize = (2 - 1) * envelope_size;
2306
2307 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2309
2310 fidl::encoding::encode_in_envelope_optional::<
2315 MouseInputReport,
2316 fidl::encoding::DefaultFuchsiaResourceDialect,
2317 >(
2318 self.mouse
2319 .as_ref()
2320 .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2321 encoder,
2322 offset + cur_offset,
2323 depth,
2324 )?;
2325
2326 _prev_end_offset = cur_offset + envelope_size;
2327 if 3 > max_ordinal {
2328 return Ok(());
2329 }
2330
2331 let cur_offset: usize = (3 - 1) * envelope_size;
2334
2335 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2337
2338 fidl::encoding::encode_in_envelope_optional::<
2343 SensorInputReport,
2344 fidl::encoding::DefaultFuchsiaResourceDialect,
2345 >(
2346 self.sensor
2347 .as_ref()
2348 .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2349 encoder,
2350 offset + cur_offset,
2351 depth,
2352 )?;
2353
2354 _prev_end_offset = cur_offset + envelope_size;
2355 if 4 > max_ordinal {
2356 return Ok(());
2357 }
2358
2359 let cur_offset: usize = (4 - 1) * envelope_size;
2362
2363 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2365
2366 fidl::encoding::encode_in_envelope_optional::<
2371 TouchInputReport,
2372 fidl::encoding::DefaultFuchsiaResourceDialect,
2373 >(
2374 self.touch
2375 .as_ref()
2376 .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2377 encoder,
2378 offset + cur_offset,
2379 depth,
2380 )?;
2381
2382 _prev_end_offset = cur_offset + envelope_size;
2383 if 5 > max_ordinal {
2384 return Ok(());
2385 }
2386
2387 let cur_offset: usize = (5 - 1) * envelope_size;
2390
2391 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2393
2394 fidl::encoding::encode_in_envelope_optional::<
2399 KeyboardInputReport,
2400 fidl::encoding::DefaultFuchsiaResourceDialect,
2401 >(
2402 self.keyboard
2403 .as_ref()
2404 .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2405 encoder,
2406 offset + cur_offset,
2407 depth,
2408 )?;
2409
2410 _prev_end_offset = cur_offset + envelope_size;
2411 if 6 > max_ordinal {
2412 return Ok(());
2413 }
2414
2415 let cur_offset: usize = (6 - 1) * envelope_size;
2418
2419 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2421
2422 fidl::encoding::encode_in_envelope_optional::<
2427 ConsumerControlInputReport,
2428 fidl::encoding::DefaultFuchsiaResourceDialect,
2429 >(
2430 self.consumer_control
2431 .as_ref()
2432 .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2433 encoder,
2434 offset + cur_offset,
2435 depth,
2436 )?;
2437
2438 _prev_end_offset = cur_offset + envelope_size;
2439 if 7 > max_ordinal {
2440 return Ok(());
2441 }
2442
2443 let cur_offset: usize = (7 - 1) * envelope_size;
2446
2447 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2449
2450 fidl::encoding::encode_in_envelope_optional::<
2455 u64,
2456 fidl::encoding::DefaultFuchsiaResourceDialect,
2457 >(
2458 self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2459 encoder,
2460 offset + cur_offset,
2461 depth,
2462 )?;
2463
2464 _prev_end_offset = cur_offset + envelope_size;
2465 if 8 > max_ordinal {
2466 return Ok(());
2467 }
2468
2469 let cur_offset: usize = (8 - 1) * envelope_size;
2472
2473 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2475
2476 fidl::encoding::encode_in_envelope_optional::<
2481 u8,
2482 fidl::encoding::DefaultFuchsiaResourceDialect,
2483 >(
2484 self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
2485 encoder,
2486 offset + cur_offset,
2487 depth,
2488 )?;
2489
2490 _prev_end_offset = cur_offset + envelope_size;
2491 if 9 > max_ordinal {
2492 return Ok(());
2493 }
2494
2495 let cur_offset: usize = (9 - 1) * envelope_size;
2498
2499 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2501
2502 fidl::encoding::encode_in_envelope_optional::<
2507 fidl::encoding::HandleType<
2508 fidl::EventPair,
2509 { fidl::ObjectType::EVENTPAIR.into_raw() },
2510 2147483648,
2511 >,
2512 fidl::encoding::DefaultFuchsiaResourceDialect,
2513 >(
2514 self.wake_lease.as_mut().map(
2515 <fidl::encoding::HandleType<
2516 fidl::EventPair,
2517 { fidl::ObjectType::EVENTPAIR.into_raw() },
2518 2147483648,
2519 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2520 ),
2521 encoder,
2522 offset + cur_offset,
2523 depth,
2524 )?;
2525
2526 _prev_end_offset = cur_offset + envelope_size;
2527
2528 Ok(())
2529 }
2530 }
2531
2532 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {
2533 #[inline(always)]
2534 fn new_empty() -> Self {
2535 Self::default()
2536 }
2537
2538 unsafe fn decode(
2539 &mut self,
2540 decoder: &mut fidl::encoding::Decoder<
2541 '_,
2542 fidl::encoding::DefaultFuchsiaResourceDialect,
2543 >,
2544 offset: usize,
2545 mut depth: fidl::encoding::Depth,
2546 ) -> fidl::Result<()> {
2547 decoder.debug_check_bounds::<Self>(offset);
2548 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2549 None => return Err(fidl::Error::NotNullable),
2550 Some(len) => len,
2551 };
2552 if len == 0 {
2554 return Ok(());
2555 };
2556 depth.increment()?;
2557 let envelope_size = 8;
2558 let bytes_len = len * envelope_size;
2559 let offset = decoder.out_of_line_offset(bytes_len)?;
2560 let mut _next_ordinal_to_read = 0;
2562 let mut next_offset = offset;
2563 let end_offset = offset + bytes_len;
2564 _next_ordinal_to_read += 1;
2565 if next_offset >= end_offset {
2566 return Ok(());
2567 }
2568
2569 while _next_ordinal_to_read < 1 {
2571 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2572 _next_ordinal_to_read += 1;
2573 next_offset += envelope_size;
2574 }
2575
2576 let next_out_of_line = decoder.next_out_of_line();
2577 let handles_before = decoder.remaining_handles();
2578 if let Some((inlined, num_bytes, num_handles)) =
2579 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2580 {
2581 let member_inline_size =
2582 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2583 if inlined != (member_inline_size <= 4) {
2584 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2585 }
2586 let inner_offset;
2587 let mut inner_depth = depth.clone();
2588 if inlined {
2589 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2590 inner_offset = next_offset;
2591 } else {
2592 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2593 inner_depth.increment()?;
2594 }
2595 let val_ref = self.event_time.get_or_insert_with(|| {
2596 fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
2597 });
2598 fidl::decode!(
2599 i64,
2600 fidl::encoding::DefaultFuchsiaResourceDialect,
2601 val_ref,
2602 decoder,
2603 inner_offset,
2604 inner_depth
2605 )?;
2606 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2607 {
2608 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2609 }
2610 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2611 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2612 }
2613 }
2614
2615 next_offset += envelope_size;
2616 _next_ordinal_to_read += 1;
2617 if next_offset >= end_offset {
2618 return Ok(());
2619 }
2620
2621 while _next_ordinal_to_read < 2 {
2623 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2624 _next_ordinal_to_read += 1;
2625 next_offset += envelope_size;
2626 }
2627
2628 let next_out_of_line = decoder.next_out_of_line();
2629 let handles_before = decoder.remaining_handles();
2630 if let Some((inlined, num_bytes, num_handles)) =
2631 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2632 {
2633 let member_inline_size =
2634 <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2635 if inlined != (member_inline_size <= 4) {
2636 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2637 }
2638 let inner_offset;
2639 let mut inner_depth = depth.clone();
2640 if inlined {
2641 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2642 inner_offset = next_offset;
2643 } else {
2644 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2645 inner_depth.increment()?;
2646 }
2647 let val_ref = self.mouse.get_or_insert_with(|| {
2648 fidl::new_empty!(
2649 MouseInputReport,
2650 fidl::encoding::DefaultFuchsiaResourceDialect
2651 )
2652 });
2653 fidl::decode!(
2654 MouseInputReport,
2655 fidl::encoding::DefaultFuchsiaResourceDialect,
2656 val_ref,
2657 decoder,
2658 inner_offset,
2659 inner_depth
2660 )?;
2661 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2662 {
2663 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2664 }
2665 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2666 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2667 }
2668 }
2669
2670 next_offset += envelope_size;
2671 _next_ordinal_to_read += 1;
2672 if next_offset >= end_offset {
2673 return Ok(());
2674 }
2675
2676 while _next_ordinal_to_read < 3 {
2678 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2679 _next_ordinal_to_read += 1;
2680 next_offset += envelope_size;
2681 }
2682
2683 let next_out_of_line = decoder.next_out_of_line();
2684 let handles_before = decoder.remaining_handles();
2685 if let Some((inlined, num_bytes, num_handles)) =
2686 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2687 {
2688 let member_inline_size =
2689 <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2690 if inlined != (member_inline_size <= 4) {
2691 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2692 }
2693 let inner_offset;
2694 let mut inner_depth = depth.clone();
2695 if inlined {
2696 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2697 inner_offset = next_offset;
2698 } else {
2699 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2700 inner_depth.increment()?;
2701 }
2702 let val_ref = self.sensor.get_or_insert_with(|| {
2703 fidl::new_empty!(
2704 SensorInputReport,
2705 fidl::encoding::DefaultFuchsiaResourceDialect
2706 )
2707 });
2708 fidl::decode!(
2709 SensorInputReport,
2710 fidl::encoding::DefaultFuchsiaResourceDialect,
2711 val_ref,
2712 decoder,
2713 inner_offset,
2714 inner_depth
2715 )?;
2716 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2717 {
2718 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2719 }
2720 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2721 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2722 }
2723 }
2724
2725 next_offset += envelope_size;
2726 _next_ordinal_to_read += 1;
2727 if next_offset >= end_offset {
2728 return Ok(());
2729 }
2730
2731 while _next_ordinal_to_read < 4 {
2733 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2734 _next_ordinal_to_read += 1;
2735 next_offset += envelope_size;
2736 }
2737
2738 let next_out_of_line = decoder.next_out_of_line();
2739 let handles_before = decoder.remaining_handles();
2740 if let Some((inlined, num_bytes, num_handles)) =
2741 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2742 {
2743 let member_inline_size =
2744 <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2745 if inlined != (member_inline_size <= 4) {
2746 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2747 }
2748 let inner_offset;
2749 let mut inner_depth = depth.clone();
2750 if inlined {
2751 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2752 inner_offset = next_offset;
2753 } else {
2754 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2755 inner_depth.increment()?;
2756 }
2757 let val_ref = self.touch.get_or_insert_with(|| {
2758 fidl::new_empty!(
2759 TouchInputReport,
2760 fidl::encoding::DefaultFuchsiaResourceDialect
2761 )
2762 });
2763 fidl::decode!(
2764 TouchInputReport,
2765 fidl::encoding::DefaultFuchsiaResourceDialect,
2766 val_ref,
2767 decoder,
2768 inner_offset,
2769 inner_depth
2770 )?;
2771 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2772 {
2773 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2774 }
2775 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2776 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2777 }
2778 }
2779
2780 next_offset += envelope_size;
2781 _next_ordinal_to_read += 1;
2782 if next_offset >= end_offset {
2783 return Ok(());
2784 }
2785
2786 while _next_ordinal_to_read < 5 {
2788 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2789 _next_ordinal_to_read += 1;
2790 next_offset += envelope_size;
2791 }
2792
2793 let next_out_of_line = decoder.next_out_of_line();
2794 let handles_before = decoder.remaining_handles();
2795 if let Some((inlined, num_bytes, num_handles)) =
2796 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2797 {
2798 let member_inline_size =
2799 <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
2800 decoder.context,
2801 );
2802 if inlined != (member_inline_size <= 4) {
2803 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2804 }
2805 let inner_offset;
2806 let mut inner_depth = depth.clone();
2807 if inlined {
2808 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2809 inner_offset = next_offset;
2810 } else {
2811 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2812 inner_depth.increment()?;
2813 }
2814 let val_ref = self.keyboard.get_or_insert_with(|| {
2815 fidl::new_empty!(
2816 KeyboardInputReport,
2817 fidl::encoding::DefaultFuchsiaResourceDialect
2818 )
2819 });
2820 fidl::decode!(
2821 KeyboardInputReport,
2822 fidl::encoding::DefaultFuchsiaResourceDialect,
2823 val_ref,
2824 decoder,
2825 inner_offset,
2826 inner_depth
2827 )?;
2828 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2829 {
2830 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2831 }
2832 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2833 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2834 }
2835 }
2836
2837 next_offset += envelope_size;
2838 _next_ordinal_to_read += 1;
2839 if next_offset >= end_offset {
2840 return Ok(());
2841 }
2842
2843 while _next_ordinal_to_read < 6 {
2845 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2846 _next_ordinal_to_read += 1;
2847 next_offset += envelope_size;
2848 }
2849
2850 let next_out_of_line = decoder.next_out_of_line();
2851 let handles_before = decoder.remaining_handles();
2852 if let Some((inlined, num_bytes, num_handles)) =
2853 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2854 {
2855 let member_inline_size =
2856 <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
2857 decoder.context,
2858 );
2859 if inlined != (member_inline_size <= 4) {
2860 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2861 }
2862 let inner_offset;
2863 let mut inner_depth = depth.clone();
2864 if inlined {
2865 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2866 inner_offset = next_offset;
2867 } else {
2868 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2869 inner_depth.increment()?;
2870 }
2871 let val_ref = self.consumer_control.get_or_insert_with(|| {
2872 fidl::new_empty!(
2873 ConsumerControlInputReport,
2874 fidl::encoding::DefaultFuchsiaResourceDialect
2875 )
2876 });
2877 fidl::decode!(
2878 ConsumerControlInputReport,
2879 fidl::encoding::DefaultFuchsiaResourceDialect,
2880 val_ref,
2881 decoder,
2882 inner_offset,
2883 inner_depth
2884 )?;
2885 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2886 {
2887 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2888 }
2889 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2890 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2891 }
2892 }
2893
2894 next_offset += envelope_size;
2895 _next_ordinal_to_read += 1;
2896 if next_offset >= end_offset {
2897 return Ok(());
2898 }
2899
2900 while _next_ordinal_to_read < 7 {
2902 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2903 _next_ordinal_to_read += 1;
2904 next_offset += envelope_size;
2905 }
2906
2907 let next_out_of_line = decoder.next_out_of_line();
2908 let handles_before = decoder.remaining_handles();
2909 if let Some((inlined, num_bytes, num_handles)) =
2910 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2911 {
2912 let member_inline_size =
2913 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2914 if inlined != (member_inline_size <= 4) {
2915 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2916 }
2917 let inner_offset;
2918 let mut inner_depth = depth.clone();
2919 if inlined {
2920 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2921 inner_offset = next_offset;
2922 } else {
2923 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2924 inner_depth.increment()?;
2925 }
2926 let val_ref = self.trace_id.get_or_insert_with(|| {
2927 fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2928 });
2929 fidl::decode!(
2930 u64,
2931 fidl::encoding::DefaultFuchsiaResourceDialect,
2932 val_ref,
2933 decoder,
2934 inner_offset,
2935 inner_depth
2936 )?;
2937 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2938 {
2939 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2940 }
2941 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2942 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2943 }
2944 }
2945
2946 next_offset += envelope_size;
2947 _next_ordinal_to_read += 1;
2948 if next_offset >= end_offset {
2949 return Ok(());
2950 }
2951
2952 while _next_ordinal_to_read < 8 {
2954 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2955 _next_ordinal_to_read += 1;
2956 next_offset += envelope_size;
2957 }
2958
2959 let next_out_of_line = decoder.next_out_of_line();
2960 let handles_before = decoder.remaining_handles();
2961 if let Some((inlined, num_bytes, num_handles)) =
2962 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2963 {
2964 let member_inline_size =
2965 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2966 if inlined != (member_inline_size <= 4) {
2967 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2968 }
2969 let inner_offset;
2970 let mut inner_depth = depth.clone();
2971 if inlined {
2972 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2973 inner_offset = next_offset;
2974 } else {
2975 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2976 inner_depth.increment()?;
2977 }
2978 let val_ref = self.report_id.get_or_insert_with(|| {
2979 fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
2980 });
2981 fidl::decode!(
2982 u8,
2983 fidl::encoding::DefaultFuchsiaResourceDialect,
2984 val_ref,
2985 decoder,
2986 inner_offset,
2987 inner_depth
2988 )?;
2989 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2990 {
2991 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2992 }
2993 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2994 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2995 }
2996 }
2997
2998 next_offset += envelope_size;
2999 _next_ordinal_to_read += 1;
3000 if next_offset >= end_offset {
3001 return Ok(());
3002 }
3003
3004 while _next_ordinal_to_read < 9 {
3006 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3007 _next_ordinal_to_read += 1;
3008 next_offset += envelope_size;
3009 }
3010
3011 let next_out_of_line = decoder.next_out_of_line();
3012 let handles_before = decoder.remaining_handles();
3013 if let Some((inlined, num_bytes, num_handles)) =
3014 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3015 {
3016 let member_inline_size = <fidl::encoding::HandleType<
3017 fidl::EventPair,
3018 { fidl::ObjectType::EVENTPAIR.into_raw() },
3019 2147483648,
3020 > as fidl::encoding::TypeMarker>::inline_size(
3021 decoder.context
3022 );
3023 if inlined != (member_inline_size <= 4) {
3024 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3025 }
3026 let inner_offset;
3027 let mut inner_depth = depth.clone();
3028 if inlined {
3029 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3030 inner_offset = next_offset;
3031 } else {
3032 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3033 inner_depth.increment()?;
3034 }
3035 let val_ref =
3036 self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3037 fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3038 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3039 {
3040 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3041 }
3042 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3043 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3044 }
3045 }
3046
3047 next_offset += envelope_size;
3048
3049 while next_offset < end_offset {
3051 _next_ordinal_to_read += 1;
3052 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3053 next_offset += envelope_size;
3054 }
3055
3056 Ok(())
3057 }
3058 }
3059}