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, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
25pub struct InputDeviceMarker;
26
27impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
28 type Proxy = InputDeviceProxy;
29 type RequestStream = InputDeviceRequestStream;
30 #[cfg(target_os = "fuchsia")]
31 type SynchronousProxy = InputDeviceSynchronousProxy;
32
33 const DEBUG_NAME: &'static str = "fuchsia.input.report.InputDevice";
34}
35impl fidl::endpoints::DiscoverableProtocolMarker for InputDeviceMarker {}
36pub type InputDeviceSendOutputReportResult = Result<(), i32>;
37pub type InputDeviceGetFeatureReportResult = Result<FeatureReport, i32>;
38pub type InputDeviceSetFeatureReportResult = Result<(), i32>;
39pub type InputDeviceGetInputReportResult = Result<InputReport, i32>;
40
41pub trait InputDeviceProxyInterface: Send + Sync {
42 fn r#get_input_reports_reader(
43 &self,
44 reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
45 ) -> Result<(), fidl::Error>;
46 type GetDescriptorResponseFut: std::future::Future<Output = Result<DeviceDescriptor, fidl::Error>>
47 + Send;
48 fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut;
49 type SendOutputReportResponseFut: std::future::Future<Output = Result<InputDeviceSendOutputReportResult, fidl::Error>>
50 + Send;
51 fn r#send_output_report(&self, report: &OutputReport) -> Self::SendOutputReportResponseFut;
52 type GetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceGetFeatureReportResult, fidl::Error>>
53 + Send;
54 fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut;
55 type SetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceSetFeatureReportResult, fidl::Error>>
56 + Send;
57 fn r#set_feature_report(&self, report: &FeatureReport) -> Self::SetFeatureReportResponseFut;
58 type GetInputReportResponseFut: std::future::Future<Output = Result<InputDeviceGetInputReportResult, fidl::Error>>
59 + Send;
60 fn r#get_input_report(&self, device_type: DeviceType) -> Self::GetInputReportResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct InputDeviceSynchronousProxy {
65 client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
70 type Proxy = InputDeviceProxy;
71 type Protocol = InputDeviceMarker;
72
73 fn from_channel(inner: fidl::Channel) -> Self {
74 Self::new(inner)
75 }
76
77 fn into_channel(self) -> fidl::Channel {
78 self.client.into_channel()
79 }
80
81 fn as_channel(&self) -> &fidl::Channel {
82 self.client.as_channel()
83 }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl InputDeviceSynchronousProxy {
88 pub fn new(channel: fidl::Channel) -> Self {
89 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
90 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
91 }
92
93 pub fn into_channel(self) -> fidl::Channel {
94 self.client.into_channel()
95 }
96
97 pub fn wait_for_event(
100 &self,
101 deadline: zx::MonotonicInstant,
102 ) -> Result<InputDeviceEvent, fidl::Error> {
103 InputDeviceEvent::decode(self.client.wait_for_event(deadline)?)
104 }
105
106 pub fn r#get_input_reports_reader(
109 &self,
110 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
111 ) -> Result<(), fidl::Error> {
112 self.client.send::<InputDeviceGetInputReportsReaderRequest>(
113 (reader,),
114 0x68d9cf83e397ab41,
115 fidl::encoding::DynamicFlags::empty(),
116 )
117 }
118
119 pub fn r#get_descriptor(
121 &self,
122 ___deadline: zx::MonotonicInstant,
123 ) -> Result<DeviceDescriptor, fidl::Error> {
124 let _response = self
125 .client
126 .send_query::<fidl::encoding::EmptyPayload, InputDeviceGetDescriptorResponse>(
127 (),
128 0x3d76420f2ff8ad32,
129 fidl::encoding::DynamicFlags::empty(),
130 ___deadline,
131 )?;
132 Ok(_response.descriptor)
133 }
134
135 pub fn r#send_output_report(
138 &self,
139 mut report: &OutputReport,
140 ___deadline: zx::MonotonicInstant,
141 ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
142 let _response = self.client.send_query::<
143 InputDeviceSendOutputReportRequest,
144 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
145 >(
146 (report,),
147 0x67a4888774e6f3a,
148 fidl::encoding::DynamicFlags::empty(),
149 ___deadline,
150 )?;
151 Ok(_response.map(|x| x))
152 }
153
154 pub fn r#get_feature_report(
157 &self,
158 ___deadline: zx::MonotonicInstant,
159 ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
160 let _response = self.client.send_query::<
161 fidl::encoding::EmptyPayload,
162 fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
163 >(
164 (),
165 0x497a7d98d9391f16,
166 fidl::encoding::DynamicFlags::empty(),
167 ___deadline,
168 )?;
169 Ok(_response.map(|x| x.report))
170 }
171
172 pub fn r#set_feature_report(
175 &self,
176 mut report: &FeatureReport,
177 ___deadline: zx::MonotonicInstant,
178 ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
179 let _response = self.client.send_query::<
180 InputDeviceSetFeatureReportRequest,
181 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
182 >(
183 (report,),
184 0x7679a2f5a42842ef,
185 fidl::encoding::DynamicFlags::empty(),
186 ___deadline,
187 )?;
188 Ok(_response.map(|x| x))
189 }
190
191 pub fn r#get_input_report(
197 &self,
198 mut device_type: DeviceType,
199 ___deadline: zx::MonotonicInstant,
200 ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
201 let _response = self.client.send_query::<
202 InputDeviceGetInputReportRequest,
203 fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
204 >(
205 (device_type,),
206 0x4752ccab96c10248,
207 fidl::encoding::DynamicFlags::empty(),
208 ___deadline,
209 )?;
210 Ok(_response.map(|x| x.report))
211 }
212}
213
214#[cfg(target_os = "fuchsia")]
215impl From<InputDeviceSynchronousProxy> for zx::Handle {
216 fn from(value: InputDeviceSynchronousProxy) -> Self {
217 value.into_channel().into()
218 }
219}
220
221#[cfg(target_os = "fuchsia")]
222impl From<fidl::Channel> for InputDeviceSynchronousProxy {
223 fn from(value: fidl::Channel) -> Self {
224 Self::new(value)
225 }
226}
227
228#[cfg(target_os = "fuchsia")]
229impl fidl::endpoints::FromClient for InputDeviceSynchronousProxy {
230 type Protocol = InputDeviceMarker;
231
232 fn from_client(value: fidl::endpoints::ClientEnd<InputDeviceMarker>) -> Self {
233 Self::new(value.into_channel())
234 }
235}
236
237#[derive(Debug, Clone)]
238pub struct InputDeviceProxy {
239 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
240}
241
242impl fidl::endpoints::Proxy for InputDeviceProxy {
243 type Protocol = InputDeviceMarker;
244
245 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
246 Self::new(inner)
247 }
248
249 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
250 self.client.into_channel().map_err(|client| Self { client })
251 }
252
253 fn as_channel(&self) -> &::fidl::AsyncChannel {
254 self.client.as_channel()
255 }
256}
257
258impl InputDeviceProxy {
259 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
261 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
262 Self { client: fidl::client::Client::new(channel, protocol_name) }
263 }
264
265 pub fn take_event_stream(&self) -> InputDeviceEventStream {
271 InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
272 }
273
274 pub fn r#get_input_reports_reader(
277 &self,
278 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
279 ) -> Result<(), fidl::Error> {
280 InputDeviceProxyInterface::r#get_input_reports_reader(self, reader)
281 }
282
283 pub fn r#get_descriptor(
285 &self,
286 ) -> fidl::client::QueryResponseFut<
287 DeviceDescriptor,
288 fidl::encoding::DefaultFuchsiaResourceDialect,
289 > {
290 InputDeviceProxyInterface::r#get_descriptor(self)
291 }
292
293 pub fn r#send_output_report(
296 &self,
297 mut report: &OutputReport,
298 ) -> fidl::client::QueryResponseFut<
299 InputDeviceSendOutputReportResult,
300 fidl::encoding::DefaultFuchsiaResourceDialect,
301 > {
302 InputDeviceProxyInterface::r#send_output_report(self, report)
303 }
304
305 pub fn r#get_feature_report(
308 &self,
309 ) -> fidl::client::QueryResponseFut<
310 InputDeviceGetFeatureReportResult,
311 fidl::encoding::DefaultFuchsiaResourceDialect,
312 > {
313 InputDeviceProxyInterface::r#get_feature_report(self)
314 }
315
316 pub fn r#set_feature_report(
319 &self,
320 mut report: &FeatureReport,
321 ) -> fidl::client::QueryResponseFut<
322 InputDeviceSetFeatureReportResult,
323 fidl::encoding::DefaultFuchsiaResourceDialect,
324 > {
325 InputDeviceProxyInterface::r#set_feature_report(self, report)
326 }
327
328 pub fn r#get_input_report(
334 &self,
335 mut device_type: DeviceType,
336 ) -> fidl::client::QueryResponseFut<
337 InputDeviceGetInputReportResult,
338 fidl::encoding::DefaultFuchsiaResourceDialect,
339 > {
340 InputDeviceProxyInterface::r#get_input_report(self, device_type)
341 }
342}
343
344impl InputDeviceProxyInterface for InputDeviceProxy {
345 fn r#get_input_reports_reader(
346 &self,
347 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
348 ) -> Result<(), fidl::Error> {
349 self.client.send::<InputDeviceGetInputReportsReaderRequest>(
350 (reader,),
351 0x68d9cf83e397ab41,
352 fidl::encoding::DynamicFlags::empty(),
353 )
354 }
355
356 type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
357 DeviceDescriptor,
358 fidl::encoding::DefaultFuchsiaResourceDialect,
359 >;
360 fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut {
361 fn _decode(
362 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
363 ) -> Result<DeviceDescriptor, fidl::Error> {
364 let _response = fidl::client::decode_transaction_body::<
365 InputDeviceGetDescriptorResponse,
366 fidl::encoding::DefaultFuchsiaResourceDialect,
367 0x3d76420f2ff8ad32,
368 >(_buf?)?;
369 Ok(_response.descriptor)
370 }
371 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescriptor>(
372 (),
373 0x3d76420f2ff8ad32,
374 fidl::encoding::DynamicFlags::empty(),
375 _decode,
376 )
377 }
378
379 type SendOutputReportResponseFut = fidl::client::QueryResponseFut<
380 InputDeviceSendOutputReportResult,
381 fidl::encoding::DefaultFuchsiaResourceDialect,
382 >;
383 fn r#send_output_report(&self, mut report: &OutputReport) -> Self::SendOutputReportResponseFut {
384 fn _decode(
385 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
386 ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
387 let _response = fidl::client::decode_transaction_body::<
388 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
389 fidl::encoding::DefaultFuchsiaResourceDialect,
390 0x67a4888774e6f3a,
391 >(_buf?)?;
392 Ok(_response.map(|x| x))
393 }
394 self.client.send_query_and_decode::<
395 InputDeviceSendOutputReportRequest,
396 InputDeviceSendOutputReportResult,
397 >(
398 (report,),
399 0x67a4888774e6f3a,
400 fidl::encoding::DynamicFlags::empty(),
401 _decode,
402 )
403 }
404
405 type GetFeatureReportResponseFut = fidl::client::QueryResponseFut<
406 InputDeviceGetFeatureReportResult,
407 fidl::encoding::DefaultFuchsiaResourceDialect,
408 >;
409 fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut {
410 fn _decode(
411 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
412 ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
413 let _response = fidl::client::decode_transaction_body::<
414 fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
415 fidl::encoding::DefaultFuchsiaResourceDialect,
416 0x497a7d98d9391f16,
417 >(_buf?)?;
418 Ok(_response.map(|x| x.report))
419 }
420 self.client.send_query_and_decode::<
421 fidl::encoding::EmptyPayload,
422 InputDeviceGetFeatureReportResult,
423 >(
424 (),
425 0x497a7d98d9391f16,
426 fidl::encoding::DynamicFlags::empty(),
427 _decode,
428 )
429 }
430
431 type SetFeatureReportResponseFut = fidl::client::QueryResponseFut<
432 InputDeviceSetFeatureReportResult,
433 fidl::encoding::DefaultFuchsiaResourceDialect,
434 >;
435 fn r#set_feature_report(
436 &self,
437 mut report: &FeatureReport,
438 ) -> Self::SetFeatureReportResponseFut {
439 fn _decode(
440 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
441 ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
442 let _response = fidl::client::decode_transaction_body::<
443 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
444 fidl::encoding::DefaultFuchsiaResourceDialect,
445 0x7679a2f5a42842ef,
446 >(_buf?)?;
447 Ok(_response.map(|x| x))
448 }
449 self.client.send_query_and_decode::<
450 InputDeviceSetFeatureReportRequest,
451 InputDeviceSetFeatureReportResult,
452 >(
453 (report,),
454 0x7679a2f5a42842ef,
455 fidl::encoding::DynamicFlags::empty(),
456 _decode,
457 )
458 }
459
460 type GetInputReportResponseFut = fidl::client::QueryResponseFut<
461 InputDeviceGetInputReportResult,
462 fidl::encoding::DefaultFuchsiaResourceDialect,
463 >;
464 fn r#get_input_report(&self, mut device_type: DeviceType) -> Self::GetInputReportResponseFut {
465 fn _decode(
466 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
467 ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
468 let _response = fidl::client::decode_transaction_body::<
469 fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
470 fidl::encoding::DefaultFuchsiaResourceDialect,
471 0x4752ccab96c10248,
472 >(_buf?)?;
473 Ok(_response.map(|x| x.report))
474 }
475 self.client.send_query_and_decode::<
476 InputDeviceGetInputReportRequest,
477 InputDeviceGetInputReportResult,
478 >(
479 (device_type,),
480 0x4752ccab96c10248,
481 fidl::encoding::DynamicFlags::empty(),
482 _decode,
483 )
484 }
485}
486
487pub struct InputDeviceEventStream {
488 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
489}
490
491impl std::marker::Unpin for InputDeviceEventStream {}
492
493impl futures::stream::FusedStream for InputDeviceEventStream {
494 fn is_terminated(&self) -> bool {
495 self.event_receiver.is_terminated()
496 }
497}
498
499impl futures::Stream for InputDeviceEventStream {
500 type Item = Result<InputDeviceEvent, fidl::Error>;
501
502 fn poll_next(
503 mut self: std::pin::Pin<&mut Self>,
504 cx: &mut std::task::Context<'_>,
505 ) -> std::task::Poll<Option<Self::Item>> {
506 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
507 &mut self.event_receiver,
508 cx
509 )?) {
510 Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
511 None => std::task::Poll::Ready(None),
512 }
513 }
514}
515
516#[derive(Debug)]
517pub enum InputDeviceEvent {
518 #[non_exhaustive]
519 _UnknownEvent {
520 ordinal: u64,
522 },
523}
524
525impl InputDeviceEvent {
526 fn decode(
528 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
529 ) -> Result<InputDeviceEvent, fidl::Error> {
530 let (bytes, _handles) = buf.split_mut();
531 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
532 debug_assert_eq!(tx_header.tx_id, 0);
533 match tx_header.ordinal {
534 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
535 Ok(InputDeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
536 }
537 _ => Err(fidl::Error::UnknownOrdinal {
538 ordinal: tx_header.ordinal,
539 protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
540 }),
541 }
542 }
543}
544
545pub struct InputDeviceRequestStream {
547 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
548 is_terminated: bool,
549}
550
551impl std::marker::Unpin for InputDeviceRequestStream {}
552
553impl futures::stream::FusedStream for InputDeviceRequestStream {
554 fn is_terminated(&self) -> bool {
555 self.is_terminated
556 }
557}
558
559impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
560 type Protocol = InputDeviceMarker;
561 type ControlHandle = InputDeviceControlHandle;
562
563 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
564 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
565 }
566
567 fn control_handle(&self) -> Self::ControlHandle {
568 InputDeviceControlHandle { inner: self.inner.clone() }
569 }
570
571 fn into_inner(
572 self,
573 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
574 {
575 (self.inner, self.is_terminated)
576 }
577
578 fn from_inner(
579 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
580 is_terminated: bool,
581 ) -> Self {
582 Self { inner, is_terminated }
583 }
584}
585
586impl futures::Stream for InputDeviceRequestStream {
587 type Item = Result<InputDeviceRequest, fidl::Error>;
588
589 fn poll_next(
590 mut self: std::pin::Pin<&mut Self>,
591 cx: &mut std::task::Context<'_>,
592 ) -> std::task::Poll<Option<Self::Item>> {
593 let this = &mut *self;
594 if this.inner.check_shutdown(cx) {
595 this.is_terminated = true;
596 return std::task::Poll::Ready(None);
597 }
598 if this.is_terminated {
599 panic!("polled InputDeviceRequestStream after completion");
600 }
601 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
602 |bytes, handles| {
603 match this.inner.channel().read_etc(cx, bytes, handles) {
604 std::task::Poll::Ready(Ok(())) => {}
605 std::task::Poll::Pending => return std::task::Poll::Pending,
606 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
607 this.is_terminated = true;
608 return std::task::Poll::Ready(None);
609 }
610 std::task::Poll::Ready(Err(e)) => {
611 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
612 e.into(),
613 ))))
614 }
615 }
616
617 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
619
620 std::task::Poll::Ready(Some(match header.ordinal {
621 0x68d9cf83e397ab41 => {
622 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
623 let mut req = fidl::new_empty!(
624 InputDeviceGetInputReportsReaderRequest,
625 fidl::encoding::DefaultFuchsiaResourceDialect
626 );
627 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
628 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
629 Ok(InputDeviceRequest::GetInputReportsReader {
630 reader: req.reader,
631
632 control_handle,
633 })
634 }
635 0x3d76420f2ff8ad32 => {
636 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
637 let mut req = fidl::new_empty!(
638 fidl::encoding::EmptyPayload,
639 fidl::encoding::DefaultFuchsiaResourceDialect
640 );
641 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
642 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
643 Ok(InputDeviceRequest::GetDescriptor {
644 responder: InputDeviceGetDescriptorResponder {
645 control_handle: std::mem::ManuallyDrop::new(control_handle),
646 tx_id: header.tx_id,
647 },
648 })
649 }
650 0x67a4888774e6f3a => {
651 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
652 let mut req = fidl::new_empty!(
653 InputDeviceSendOutputReportRequest,
654 fidl::encoding::DefaultFuchsiaResourceDialect
655 );
656 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSendOutputReportRequest>(&header, _body_bytes, handles, &mut req)?;
657 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
658 Ok(InputDeviceRequest::SendOutputReport {
659 report: req.report,
660
661 responder: InputDeviceSendOutputReportResponder {
662 control_handle: std::mem::ManuallyDrop::new(control_handle),
663 tx_id: header.tx_id,
664 },
665 })
666 }
667 0x497a7d98d9391f16 => {
668 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
669 let mut req = fidl::new_empty!(
670 fidl::encoding::EmptyPayload,
671 fidl::encoding::DefaultFuchsiaResourceDialect
672 );
673 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
674 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
675 Ok(InputDeviceRequest::GetFeatureReport {
676 responder: InputDeviceGetFeatureReportResponder {
677 control_handle: std::mem::ManuallyDrop::new(control_handle),
678 tx_id: header.tx_id,
679 },
680 })
681 }
682 0x7679a2f5a42842ef => {
683 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
684 let mut req = fidl::new_empty!(
685 InputDeviceSetFeatureReportRequest,
686 fidl::encoding::DefaultFuchsiaResourceDialect
687 );
688 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSetFeatureReportRequest>(&header, _body_bytes, handles, &mut req)?;
689 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
690 Ok(InputDeviceRequest::SetFeatureReport {
691 report: req.report,
692
693 responder: InputDeviceSetFeatureReportResponder {
694 control_handle: std::mem::ManuallyDrop::new(control_handle),
695 tx_id: header.tx_id,
696 },
697 })
698 }
699 0x4752ccab96c10248 => {
700 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
701 let mut req = fidl::new_empty!(
702 InputDeviceGetInputReportRequest,
703 fidl::encoding::DefaultFuchsiaResourceDialect
704 );
705 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportRequest>(&header, _body_bytes, handles, &mut req)?;
706 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
707 Ok(InputDeviceRequest::GetInputReport {
708 device_type: req.device_type,
709
710 responder: InputDeviceGetInputReportResponder {
711 control_handle: std::mem::ManuallyDrop::new(control_handle),
712 tx_id: header.tx_id,
713 },
714 })
715 }
716 _ if header.tx_id == 0
717 && header
718 .dynamic_flags()
719 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
720 {
721 Ok(InputDeviceRequest::_UnknownMethod {
722 ordinal: header.ordinal,
723 control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
724 method_type: fidl::MethodType::OneWay,
725 })
726 }
727 _ if header
728 .dynamic_flags()
729 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
730 {
731 this.inner.send_framework_err(
732 fidl::encoding::FrameworkErr::UnknownMethod,
733 header.tx_id,
734 header.ordinal,
735 header.dynamic_flags(),
736 (bytes, handles),
737 )?;
738 Ok(InputDeviceRequest::_UnknownMethod {
739 ordinal: header.ordinal,
740 control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
741 method_type: fidl::MethodType::TwoWay,
742 })
743 }
744 _ => Err(fidl::Error::UnknownOrdinal {
745 ordinal: header.ordinal,
746 protocol_name:
747 <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
748 }),
749 }))
750 },
751 )
752 }
753}
754
755#[derive(Debug)]
761pub enum InputDeviceRequest {
762 GetInputReportsReader {
765 reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
766 control_handle: InputDeviceControlHandle,
767 },
768 GetDescriptor { responder: InputDeviceGetDescriptorResponder },
770 SendOutputReport { report: OutputReport, responder: InputDeviceSendOutputReportResponder },
773 GetFeatureReport { responder: InputDeviceGetFeatureReportResponder },
776 SetFeatureReport { report: FeatureReport, responder: InputDeviceSetFeatureReportResponder },
779 GetInputReport { device_type: DeviceType, responder: InputDeviceGetInputReportResponder },
785 #[non_exhaustive]
787 _UnknownMethod {
788 ordinal: u64,
790 control_handle: InputDeviceControlHandle,
791 method_type: fidl::MethodType,
792 },
793}
794
795impl InputDeviceRequest {
796 #[allow(irrefutable_let_patterns)]
797 pub fn into_get_input_reports_reader(
798 self,
799 ) -> Option<(fidl::endpoints::ServerEnd<InputReportsReaderMarker>, InputDeviceControlHandle)>
800 {
801 if let InputDeviceRequest::GetInputReportsReader { reader, control_handle } = self {
802 Some((reader, control_handle))
803 } else {
804 None
805 }
806 }
807
808 #[allow(irrefutable_let_patterns)]
809 pub fn into_get_descriptor(self) -> Option<(InputDeviceGetDescriptorResponder)> {
810 if let InputDeviceRequest::GetDescriptor { responder } = self {
811 Some((responder))
812 } else {
813 None
814 }
815 }
816
817 #[allow(irrefutable_let_patterns)]
818 pub fn into_send_output_report(
819 self,
820 ) -> Option<(OutputReport, InputDeviceSendOutputReportResponder)> {
821 if let InputDeviceRequest::SendOutputReport { report, responder } = self {
822 Some((report, responder))
823 } else {
824 None
825 }
826 }
827
828 #[allow(irrefutable_let_patterns)]
829 pub fn into_get_feature_report(self) -> Option<(InputDeviceGetFeatureReportResponder)> {
830 if let InputDeviceRequest::GetFeatureReport { responder } = self {
831 Some((responder))
832 } else {
833 None
834 }
835 }
836
837 #[allow(irrefutable_let_patterns)]
838 pub fn into_set_feature_report(
839 self,
840 ) -> Option<(FeatureReport, InputDeviceSetFeatureReportResponder)> {
841 if let InputDeviceRequest::SetFeatureReport { report, responder } = self {
842 Some((report, responder))
843 } else {
844 None
845 }
846 }
847
848 #[allow(irrefutable_let_patterns)]
849 pub fn into_get_input_report(self) -> Option<(DeviceType, InputDeviceGetInputReportResponder)> {
850 if let InputDeviceRequest::GetInputReport { device_type, responder } = self {
851 Some((device_type, responder))
852 } else {
853 None
854 }
855 }
856
857 pub fn method_name(&self) -> &'static str {
859 match *self {
860 InputDeviceRequest::GetInputReportsReader { .. } => "get_input_reports_reader",
861 InputDeviceRequest::GetDescriptor { .. } => "get_descriptor",
862 InputDeviceRequest::SendOutputReport { .. } => "send_output_report",
863 InputDeviceRequest::GetFeatureReport { .. } => "get_feature_report",
864 InputDeviceRequest::SetFeatureReport { .. } => "set_feature_report",
865 InputDeviceRequest::GetInputReport { .. } => "get_input_report",
866 InputDeviceRequest::_UnknownMethod {
867 method_type: fidl::MethodType::OneWay, ..
868 } => "unknown one-way method",
869 InputDeviceRequest::_UnknownMethod {
870 method_type: fidl::MethodType::TwoWay, ..
871 } => "unknown two-way method",
872 }
873 }
874}
875
876#[derive(Debug, Clone)]
877pub struct InputDeviceControlHandle {
878 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
879}
880
881impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
882 fn shutdown(&self) {
883 self.inner.shutdown()
884 }
885 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
886 self.inner.shutdown_with_epitaph(status)
887 }
888
889 fn is_closed(&self) -> bool {
890 self.inner.channel().is_closed()
891 }
892 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
893 self.inner.channel().on_closed()
894 }
895
896 #[cfg(target_os = "fuchsia")]
897 fn signal_peer(
898 &self,
899 clear_mask: zx::Signals,
900 set_mask: zx::Signals,
901 ) -> Result<(), zx_status::Status> {
902 use fidl::Peered;
903 self.inner.channel().signal_peer(clear_mask, set_mask)
904 }
905}
906
907impl InputDeviceControlHandle {}
908
909#[must_use = "FIDL methods require a response to be sent"]
910#[derive(Debug)]
911pub struct InputDeviceGetDescriptorResponder {
912 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
913 tx_id: u32,
914}
915
916impl std::ops::Drop for InputDeviceGetDescriptorResponder {
920 fn drop(&mut self) {
921 self.control_handle.shutdown();
922 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
924 }
925}
926
927impl fidl::endpoints::Responder for InputDeviceGetDescriptorResponder {
928 type ControlHandle = InputDeviceControlHandle;
929
930 fn control_handle(&self) -> &InputDeviceControlHandle {
931 &self.control_handle
932 }
933
934 fn drop_without_shutdown(mut self) {
935 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
937 std::mem::forget(self);
939 }
940}
941
942impl InputDeviceGetDescriptorResponder {
943 pub fn send(self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
947 let _result = self.send_raw(descriptor);
948 if _result.is_err() {
949 self.control_handle.shutdown();
950 }
951 self.drop_without_shutdown();
952 _result
953 }
954
955 pub fn send_no_shutdown_on_err(
957 self,
958 mut descriptor: &DeviceDescriptor,
959 ) -> Result<(), fidl::Error> {
960 let _result = self.send_raw(descriptor);
961 self.drop_without_shutdown();
962 _result
963 }
964
965 fn send_raw(&self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
966 self.control_handle.inner.send::<InputDeviceGetDescriptorResponse>(
967 (descriptor,),
968 self.tx_id,
969 0x3d76420f2ff8ad32,
970 fidl::encoding::DynamicFlags::empty(),
971 )
972 }
973}
974
975#[must_use = "FIDL methods require a response to be sent"]
976#[derive(Debug)]
977pub struct InputDeviceSendOutputReportResponder {
978 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
979 tx_id: u32,
980}
981
982impl std::ops::Drop for InputDeviceSendOutputReportResponder {
986 fn drop(&mut self) {
987 self.control_handle.shutdown();
988 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
990 }
991}
992
993impl fidl::endpoints::Responder for InputDeviceSendOutputReportResponder {
994 type ControlHandle = InputDeviceControlHandle;
995
996 fn control_handle(&self) -> &InputDeviceControlHandle {
997 &self.control_handle
998 }
999
1000 fn drop_without_shutdown(mut self) {
1001 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1003 std::mem::forget(self);
1005 }
1006}
1007
1008impl InputDeviceSendOutputReportResponder {
1009 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1013 let _result = self.send_raw(result);
1014 if _result.is_err() {
1015 self.control_handle.shutdown();
1016 }
1017 self.drop_without_shutdown();
1018 _result
1019 }
1020
1021 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1023 let _result = self.send_raw(result);
1024 self.drop_without_shutdown();
1025 _result
1026 }
1027
1028 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1029 self.control_handle
1030 .inner
1031 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1032 result,
1033 self.tx_id,
1034 0x67a4888774e6f3a,
1035 fidl::encoding::DynamicFlags::empty(),
1036 )
1037 }
1038}
1039
1040#[must_use = "FIDL methods require a response to be sent"]
1041#[derive(Debug)]
1042pub struct InputDeviceGetFeatureReportResponder {
1043 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1044 tx_id: u32,
1045}
1046
1047impl std::ops::Drop for InputDeviceGetFeatureReportResponder {
1051 fn drop(&mut self) {
1052 self.control_handle.shutdown();
1053 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1055 }
1056}
1057
1058impl fidl::endpoints::Responder for InputDeviceGetFeatureReportResponder {
1059 type ControlHandle = InputDeviceControlHandle;
1060
1061 fn control_handle(&self) -> &InputDeviceControlHandle {
1062 &self.control_handle
1063 }
1064
1065 fn drop_without_shutdown(mut self) {
1066 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1068 std::mem::forget(self);
1070 }
1071}
1072
1073impl InputDeviceGetFeatureReportResponder {
1074 pub fn send(self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1078 let _result = self.send_raw(result);
1079 if _result.is_err() {
1080 self.control_handle.shutdown();
1081 }
1082 self.drop_without_shutdown();
1083 _result
1084 }
1085
1086 pub fn send_no_shutdown_on_err(
1088 self,
1089 mut result: Result<&FeatureReport, i32>,
1090 ) -> Result<(), fidl::Error> {
1091 let _result = self.send_raw(result);
1092 self.drop_without_shutdown();
1093 _result
1094 }
1095
1096 fn send_raw(&self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1097 self.control_handle.inner.send::<fidl::encoding::ResultType<
1098 InputDeviceGetFeatureReportResponse,
1099 i32,
1100 >>(
1101 result.map(|report| (report,)),
1102 self.tx_id,
1103 0x497a7d98d9391f16,
1104 fidl::encoding::DynamicFlags::empty(),
1105 )
1106 }
1107}
1108
1109#[must_use = "FIDL methods require a response to be sent"]
1110#[derive(Debug)]
1111pub struct InputDeviceSetFeatureReportResponder {
1112 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1113 tx_id: u32,
1114}
1115
1116impl std::ops::Drop for InputDeviceSetFeatureReportResponder {
1120 fn drop(&mut self) {
1121 self.control_handle.shutdown();
1122 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1124 }
1125}
1126
1127impl fidl::endpoints::Responder for InputDeviceSetFeatureReportResponder {
1128 type ControlHandle = InputDeviceControlHandle;
1129
1130 fn control_handle(&self) -> &InputDeviceControlHandle {
1131 &self.control_handle
1132 }
1133
1134 fn drop_without_shutdown(mut self) {
1135 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1137 std::mem::forget(self);
1139 }
1140}
1141
1142impl InputDeviceSetFeatureReportResponder {
1143 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1147 let _result = self.send_raw(result);
1148 if _result.is_err() {
1149 self.control_handle.shutdown();
1150 }
1151 self.drop_without_shutdown();
1152 _result
1153 }
1154
1155 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1157 let _result = self.send_raw(result);
1158 self.drop_without_shutdown();
1159 _result
1160 }
1161
1162 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1163 self.control_handle
1164 .inner
1165 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1166 result,
1167 self.tx_id,
1168 0x7679a2f5a42842ef,
1169 fidl::encoding::DynamicFlags::empty(),
1170 )
1171 }
1172}
1173
1174#[must_use = "FIDL methods require a response to be sent"]
1175#[derive(Debug)]
1176pub struct InputDeviceGetInputReportResponder {
1177 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1178 tx_id: u32,
1179}
1180
1181impl std::ops::Drop for InputDeviceGetInputReportResponder {
1185 fn drop(&mut self) {
1186 self.control_handle.shutdown();
1187 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1189 }
1190}
1191
1192impl fidl::endpoints::Responder for InputDeviceGetInputReportResponder {
1193 type ControlHandle = InputDeviceControlHandle;
1194
1195 fn control_handle(&self) -> &InputDeviceControlHandle {
1196 &self.control_handle
1197 }
1198
1199 fn drop_without_shutdown(mut self) {
1200 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1202 std::mem::forget(self);
1204 }
1205}
1206
1207impl InputDeviceGetInputReportResponder {
1208 pub fn send(self, mut result: Result<&InputReport, i32>) -> Result<(), fidl::Error> {
1212 let _result = self.send_raw(result);
1213 if _result.is_err() {
1214 self.control_handle.shutdown();
1215 }
1216 self.drop_without_shutdown();
1217 _result
1218 }
1219
1220 pub fn send_no_shutdown_on_err(
1222 self,
1223 mut result: Result<&InputReport, i32>,
1224 ) -> Result<(), fidl::Error> {
1225 let _result = self.send_raw(result);
1226 self.drop_without_shutdown();
1227 _result
1228 }
1229
1230 fn send_raw(&self, mut result: Result<&InputReport, i32>) -> Result<(), fidl::Error> {
1231 self.control_handle
1232 .inner
1233 .send::<fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>>(
1234 result.map(|report| (report,)),
1235 self.tx_id,
1236 0x4752ccab96c10248,
1237 fidl::encoding::DynamicFlags::empty(),
1238 )
1239 }
1240}
1241
1242#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1243pub struct InputReportsReaderMarker;
1244
1245impl fidl::endpoints::ProtocolMarker for InputReportsReaderMarker {
1246 type Proxy = InputReportsReaderProxy;
1247 type RequestStream = InputReportsReaderRequestStream;
1248 #[cfg(target_os = "fuchsia")]
1249 type SynchronousProxy = InputReportsReaderSynchronousProxy;
1250
1251 const DEBUG_NAME: &'static str = "(anonymous) InputReportsReader";
1252}
1253pub type InputReportsReaderReadInputReportsResult = Result<Vec<InputReport>, i32>;
1254
1255pub trait InputReportsReaderProxyInterface: Send + Sync {
1256 type ReadInputReportsResponseFut: std::future::Future<Output = Result<InputReportsReaderReadInputReportsResult, fidl::Error>>
1257 + Send;
1258 fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut;
1259}
1260#[derive(Debug)]
1261#[cfg(target_os = "fuchsia")]
1262pub struct InputReportsReaderSynchronousProxy {
1263 client: fidl::client::sync::Client,
1264}
1265
1266#[cfg(target_os = "fuchsia")]
1267impl fidl::endpoints::SynchronousProxy for InputReportsReaderSynchronousProxy {
1268 type Proxy = InputReportsReaderProxy;
1269 type Protocol = InputReportsReaderMarker;
1270
1271 fn from_channel(inner: fidl::Channel) -> Self {
1272 Self::new(inner)
1273 }
1274
1275 fn into_channel(self) -> fidl::Channel {
1276 self.client.into_channel()
1277 }
1278
1279 fn as_channel(&self) -> &fidl::Channel {
1280 self.client.as_channel()
1281 }
1282}
1283
1284#[cfg(target_os = "fuchsia")]
1285impl InputReportsReaderSynchronousProxy {
1286 pub fn new(channel: fidl::Channel) -> Self {
1287 let protocol_name =
1288 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1289 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1290 }
1291
1292 pub fn into_channel(self) -> fidl::Channel {
1293 self.client.into_channel()
1294 }
1295
1296 pub fn wait_for_event(
1299 &self,
1300 deadline: zx::MonotonicInstant,
1301 ) -> Result<InputReportsReaderEvent, fidl::Error> {
1302 InputReportsReaderEvent::decode(self.client.wait_for_event(deadline)?)
1303 }
1304
1305 pub fn r#read_input_reports(
1311 &self,
1312 ___deadline: zx::MonotonicInstant,
1313 ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1314 let _response =
1315 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1316 InputReportsReaderReadInputReportsResponse,
1317 i32,
1318 >>(
1319 (),
1320 0x3595efdc88842559,
1321 fidl::encoding::DynamicFlags::empty(),
1322 ___deadline,
1323 )?;
1324 Ok(_response.map(|x| x.reports))
1325 }
1326}
1327
1328#[cfg(target_os = "fuchsia")]
1329impl From<InputReportsReaderSynchronousProxy> for zx::Handle {
1330 fn from(value: InputReportsReaderSynchronousProxy) -> Self {
1331 value.into_channel().into()
1332 }
1333}
1334
1335#[cfg(target_os = "fuchsia")]
1336impl From<fidl::Channel> for InputReportsReaderSynchronousProxy {
1337 fn from(value: fidl::Channel) -> Self {
1338 Self::new(value)
1339 }
1340}
1341
1342#[cfg(target_os = "fuchsia")]
1343impl fidl::endpoints::FromClient for InputReportsReaderSynchronousProxy {
1344 type Protocol = InputReportsReaderMarker;
1345
1346 fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderMarker>) -> Self {
1347 Self::new(value.into_channel())
1348 }
1349}
1350
1351#[derive(Debug, Clone)]
1352pub struct InputReportsReaderProxy {
1353 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1354}
1355
1356impl fidl::endpoints::Proxy for InputReportsReaderProxy {
1357 type Protocol = InputReportsReaderMarker;
1358
1359 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1360 Self::new(inner)
1361 }
1362
1363 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1364 self.client.into_channel().map_err(|client| Self { client })
1365 }
1366
1367 fn as_channel(&self) -> &::fidl::AsyncChannel {
1368 self.client.as_channel()
1369 }
1370}
1371
1372impl InputReportsReaderProxy {
1373 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1375 let protocol_name =
1376 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1377 Self { client: fidl::client::Client::new(channel, protocol_name) }
1378 }
1379
1380 pub fn take_event_stream(&self) -> InputReportsReaderEventStream {
1386 InputReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
1387 }
1388
1389 pub fn r#read_input_reports(
1395 &self,
1396 ) -> fidl::client::QueryResponseFut<
1397 InputReportsReaderReadInputReportsResult,
1398 fidl::encoding::DefaultFuchsiaResourceDialect,
1399 > {
1400 InputReportsReaderProxyInterface::r#read_input_reports(self)
1401 }
1402}
1403
1404impl InputReportsReaderProxyInterface for InputReportsReaderProxy {
1405 type ReadInputReportsResponseFut = fidl::client::QueryResponseFut<
1406 InputReportsReaderReadInputReportsResult,
1407 fidl::encoding::DefaultFuchsiaResourceDialect,
1408 >;
1409 fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut {
1410 fn _decode(
1411 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1412 ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1413 let _response = fidl::client::decode_transaction_body::<
1414 fidl::encoding::ResultType<InputReportsReaderReadInputReportsResponse, i32>,
1415 fidl::encoding::DefaultFuchsiaResourceDialect,
1416 0x3595efdc88842559,
1417 >(_buf?)?;
1418 Ok(_response.map(|x| x.reports))
1419 }
1420 self.client.send_query_and_decode::<
1421 fidl::encoding::EmptyPayload,
1422 InputReportsReaderReadInputReportsResult,
1423 >(
1424 (),
1425 0x3595efdc88842559,
1426 fidl::encoding::DynamicFlags::empty(),
1427 _decode,
1428 )
1429 }
1430}
1431
1432pub struct InputReportsReaderEventStream {
1433 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1434}
1435
1436impl std::marker::Unpin for InputReportsReaderEventStream {}
1437
1438impl futures::stream::FusedStream for InputReportsReaderEventStream {
1439 fn is_terminated(&self) -> bool {
1440 self.event_receiver.is_terminated()
1441 }
1442}
1443
1444impl futures::Stream for InputReportsReaderEventStream {
1445 type Item = Result<InputReportsReaderEvent, fidl::Error>;
1446
1447 fn poll_next(
1448 mut self: std::pin::Pin<&mut Self>,
1449 cx: &mut std::task::Context<'_>,
1450 ) -> std::task::Poll<Option<Self::Item>> {
1451 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1452 &mut self.event_receiver,
1453 cx
1454 )?) {
1455 Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderEvent::decode(buf))),
1456 None => std::task::Poll::Ready(None),
1457 }
1458 }
1459}
1460
1461#[derive(Debug)]
1462pub enum InputReportsReaderEvent {}
1463
1464impl InputReportsReaderEvent {
1465 fn decode(
1467 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1468 ) -> Result<InputReportsReaderEvent, fidl::Error> {
1469 let (bytes, _handles) = buf.split_mut();
1470 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1471 debug_assert_eq!(tx_header.tx_id, 0);
1472 match tx_header.ordinal {
1473 _ => Err(fidl::Error::UnknownOrdinal {
1474 ordinal: tx_header.ordinal,
1475 protocol_name:
1476 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1477 }),
1478 }
1479 }
1480}
1481
1482pub struct InputReportsReaderRequestStream {
1484 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1485 is_terminated: bool,
1486}
1487
1488impl std::marker::Unpin for InputReportsReaderRequestStream {}
1489
1490impl futures::stream::FusedStream for InputReportsReaderRequestStream {
1491 fn is_terminated(&self) -> bool {
1492 self.is_terminated
1493 }
1494}
1495
1496impl fidl::endpoints::RequestStream for InputReportsReaderRequestStream {
1497 type Protocol = InputReportsReaderMarker;
1498 type ControlHandle = InputReportsReaderControlHandle;
1499
1500 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1501 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1502 }
1503
1504 fn control_handle(&self) -> Self::ControlHandle {
1505 InputReportsReaderControlHandle { inner: self.inner.clone() }
1506 }
1507
1508 fn into_inner(
1509 self,
1510 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1511 {
1512 (self.inner, self.is_terminated)
1513 }
1514
1515 fn from_inner(
1516 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1517 is_terminated: bool,
1518 ) -> Self {
1519 Self { inner, is_terminated }
1520 }
1521}
1522
1523impl futures::Stream for InputReportsReaderRequestStream {
1524 type Item = Result<InputReportsReaderRequest, fidl::Error>;
1525
1526 fn poll_next(
1527 mut self: std::pin::Pin<&mut Self>,
1528 cx: &mut std::task::Context<'_>,
1529 ) -> std::task::Poll<Option<Self::Item>> {
1530 let this = &mut *self;
1531 if this.inner.check_shutdown(cx) {
1532 this.is_terminated = true;
1533 return std::task::Poll::Ready(None);
1534 }
1535 if this.is_terminated {
1536 panic!("polled InputReportsReaderRequestStream after completion");
1537 }
1538 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1539 |bytes, handles| {
1540 match this.inner.channel().read_etc(cx, bytes, handles) {
1541 std::task::Poll::Ready(Ok(())) => {}
1542 std::task::Poll::Pending => return std::task::Poll::Pending,
1543 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1544 this.is_terminated = true;
1545 return std::task::Poll::Ready(None);
1546 }
1547 std::task::Poll::Ready(Err(e)) => {
1548 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1549 e.into(),
1550 ))))
1551 }
1552 }
1553
1554 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1556
1557 std::task::Poll::Ready(Some(match header.ordinal {
1558 0x3595efdc88842559 => {
1559 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1560 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1561 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1562 let control_handle = InputReportsReaderControlHandle {
1563 inner: this.inner.clone(),
1564 };
1565 Ok(InputReportsReaderRequest::ReadInputReports {
1566 responder: InputReportsReaderReadInputReportsResponder {
1567 control_handle: std::mem::ManuallyDrop::new(control_handle),
1568 tx_id: header.tx_id,
1569 },
1570 })
1571 }
1572 _ => Err(fidl::Error::UnknownOrdinal {
1573 ordinal: header.ordinal,
1574 protocol_name: <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1575 }),
1576 }))
1577 },
1578 )
1579 }
1580}
1581
1582#[derive(Debug)]
1587pub enum InputReportsReaderRequest {
1588 ReadInputReports { responder: InputReportsReaderReadInputReportsResponder },
1594}
1595
1596impl InputReportsReaderRequest {
1597 #[allow(irrefutable_let_patterns)]
1598 pub fn into_read_input_reports(self) -> Option<(InputReportsReaderReadInputReportsResponder)> {
1599 if let InputReportsReaderRequest::ReadInputReports { responder } = self {
1600 Some((responder))
1601 } else {
1602 None
1603 }
1604 }
1605
1606 pub fn method_name(&self) -> &'static str {
1608 match *self {
1609 InputReportsReaderRequest::ReadInputReports { .. } => "read_input_reports",
1610 }
1611 }
1612}
1613
1614#[derive(Debug, Clone)]
1615pub struct InputReportsReaderControlHandle {
1616 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1617}
1618
1619impl fidl::endpoints::ControlHandle for InputReportsReaderControlHandle {
1620 fn shutdown(&self) {
1621 self.inner.shutdown()
1622 }
1623 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1624 self.inner.shutdown_with_epitaph(status)
1625 }
1626
1627 fn is_closed(&self) -> bool {
1628 self.inner.channel().is_closed()
1629 }
1630 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1631 self.inner.channel().on_closed()
1632 }
1633
1634 #[cfg(target_os = "fuchsia")]
1635 fn signal_peer(
1636 &self,
1637 clear_mask: zx::Signals,
1638 set_mask: zx::Signals,
1639 ) -> Result<(), zx_status::Status> {
1640 use fidl::Peered;
1641 self.inner.channel().signal_peer(clear_mask, set_mask)
1642 }
1643}
1644
1645impl InputReportsReaderControlHandle {}
1646
1647#[must_use = "FIDL methods require a response to be sent"]
1648#[derive(Debug)]
1649pub struct InputReportsReaderReadInputReportsResponder {
1650 control_handle: std::mem::ManuallyDrop<InputReportsReaderControlHandle>,
1651 tx_id: u32,
1652}
1653
1654impl std::ops::Drop for InputReportsReaderReadInputReportsResponder {
1658 fn drop(&mut self) {
1659 self.control_handle.shutdown();
1660 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1662 }
1663}
1664
1665impl fidl::endpoints::Responder for InputReportsReaderReadInputReportsResponder {
1666 type ControlHandle = InputReportsReaderControlHandle;
1667
1668 fn control_handle(&self) -> &InputReportsReaderControlHandle {
1669 &self.control_handle
1670 }
1671
1672 fn drop_without_shutdown(mut self) {
1673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1675 std::mem::forget(self);
1677 }
1678}
1679
1680impl InputReportsReaderReadInputReportsResponder {
1681 pub fn send(self, mut result: Result<&[InputReport], i32>) -> Result<(), fidl::Error> {
1685 let _result = self.send_raw(result);
1686 if _result.is_err() {
1687 self.control_handle.shutdown();
1688 }
1689 self.drop_without_shutdown();
1690 _result
1691 }
1692
1693 pub fn send_no_shutdown_on_err(
1695 self,
1696 mut result: Result<&[InputReport], i32>,
1697 ) -> Result<(), fidl::Error> {
1698 let _result = self.send_raw(result);
1699 self.drop_without_shutdown();
1700 _result
1701 }
1702
1703 fn send_raw(&self, mut result: Result<&[InputReport], i32>) -> Result<(), fidl::Error> {
1704 self.control_handle.inner.send::<fidl::encoding::ResultType<
1705 InputReportsReaderReadInputReportsResponse,
1706 i32,
1707 >>(
1708 result.map(|reports| (reports,)),
1709 self.tx_id,
1710 0x3595efdc88842559,
1711 fidl::encoding::DynamicFlags::empty(),
1712 )
1713 }
1714}
1715
1716#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1717pub struct ServiceMarker;
1718
1719#[cfg(target_os = "fuchsia")]
1720impl fidl::endpoints::ServiceMarker for ServiceMarker {
1721 type Proxy = ServiceProxy;
1722 type Request = ServiceRequest;
1723 const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
1724}
1725
1726#[cfg(target_os = "fuchsia")]
1729pub enum ServiceRequest {
1730 InputDevice(InputDeviceRequestStream),
1731}
1732
1733#[cfg(target_os = "fuchsia")]
1734impl fidl::endpoints::ServiceRequest for ServiceRequest {
1735 type Service = ServiceMarker;
1736
1737 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1738 match name {
1739 "input_device" => Self::InputDevice(
1740 <InputDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
1741 _channel,
1742 ),
1743 ),
1744 _ => panic!("no such member protocol name for service Service"),
1745 }
1746 }
1747
1748 fn member_names() -> &'static [&'static str] {
1749 &["input_device"]
1750 }
1751}
1752#[cfg(target_os = "fuchsia")]
1753pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1754
1755#[cfg(target_os = "fuchsia")]
1756impl fidl::endpoints::ServiceProxy for ServiceProxy {
1757 type Service = ServiceMarker;
1758
1759 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1760 Self(opener)
1761 }
1762}
1763
1764#[cfg(target_os = "fuchsia")]
1765impl ServiceProxy {
1766 pub fn connect_to_input_device(&self) -> Result<InputDeviceProxy, fidl::Error> {
1767 let (proxy, server_end) = fidl::endpoints::create_proxy::<InputDeviceMarker>();
1768 self.connect_channel_to_input_device(server_end)?;
1769 Ok(proxy)
1770 }
1771
1772 pub fn connect_to_input_device_sync(&self) -> Result<InputDeviceSynchronousProxy, fidl::Error> {
1775 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<InputDeviceMarker>();
1776 self.connect_channel_to_input_device(server_end)?;
1777 Ok(proxy)
1778 }
1779
1780 pub fn connect_channel_to_input_device(
1783 &self,
1784 server_end: fidl::endpoints::ServerEnd<InputDeviceMarker>,
1785 ) -> Result<(), fidl::Error> {
1786 self.0.open_member("input_device", server_end.into_channel())
1787 }
1788
1789 pub fn instance_name(&self) -> &str {
1790 self.0.instance_name()
1791 }
1792}
1793
1794mod internal {
1795 use super::*;
1796
1797 impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderRequest {
1798 type Borrowed<'a> = &'a mut Self;
1799 fn take_or_borrow<'a>(
1800 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1801 ) -> Self::Borrowed<'a> {
1802 value
1803 }
1804 }
1805
1806 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderRequest {
1807 type Owned = Self;
1808
1809 #[inline(always)]
1810 fn inline_align(_context: fidl::encoding::Context) -> usize {
1811 4
1812 }
1813
1814 #[inline(always)]
1815 fn inline_size(_context: fidl::encoding::Context) -> usize {
1816 4
1817 }
1818 }
1819
1820 unsafe impl
1821 fidl::encoding::Encode<
1822 InputDeviceGetInputReportsReaderRequest,
1823 fidl::encoding::DefaultFuchsiaResourceDialect,
1824 > for &mut InputDeviceGetInputReportsReaderRequest
1825 {
1826 #[inline]
1827 unsafe fn encode(
1828 self,
1829 encoder: &mut fidl::encoding::Encoder<
1830 '_,
1831 fidl::encoding::DefaultFuchsiaResourceDialect,
1832 >,
1833 offset: usize,
1834 _depth: fidl::encoding::Depth,
1835 ) -> fidl::Result<()> {
1836 encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1837 fidl::encoding::Encode::<InputDeviceGetInputReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1839 (
1840 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
1841 ),
1842 encoder, offset, _depth
1843 )
1844 }
1845 }
1846 unsafe impl<
1847 T0: fidl::encoding::Encode<
1848 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1849 fidl::encoding::DefaultFuchsiaResourceDialect,
1850 >,
1851 >
1852 fidl::encoding::Encode<
1853 InputDeviceGetInputReportsReaderRequest,
1854 fidl::encoding::DefaultFuchsiaResourceDialect,
1855 > for (T0,)
1856 {
1857 #[inline]
1858 unsafe fn encode(
1859 self,
1860 encoder: &mut fidl::encoding::Encoder<
1861 '_,
1862 fidl::encoding::DefaultFuchsiaResourceDialect,
1863 >,
1864 offset: usize,
1865 depth: fidl::encoding::Depth,
1866 ) -> fidl::Result<()> {
1867 encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1868 self.0.encode(encoder, offset + 0, depth)?;
1872 Ok(())
1873 }
1874 }
1875
1876 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1877 for InputDeviceGetInputReportsReaderRequest
1878 {
1879 #[inline(always)]
1880 fn new_empty() -> Self {
1881 Self {
1882 reader: fidl::new_empty!(
1883 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1884 fidl::encoding::DefaultFuchsiaResourceDialect
1885 ),
1886 }
1887 }
1888
1889 #[inline]
1890 unsafe fn decode(
1891 &mut self,
1892 decoder: &mut fidl::encoding::Decoder<
1893 '_,
1894 fidl::encoding::DefaultFuchsiaResourceDialect,
1895 >,
1896 offset: usize,
1897 _depth: fidl::encoding::Depth,
1898 ) -> fidl::Result<()> {
1899 decoder.debug_check_bounds::<Self>(offset);
1900 fidl::decode!(
1902 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1903 fidl::encoding::DefaultFuchsiaResourceDialect,
1904 &mut self.reader,
1905 decoder,
1906 offset + 0,
1907 _depth
1908 )?;
1909 Ok(())
1910 }
1911 }
1912}