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#[derive(Debug, Clone)]
229pub struct InputDeviceProxy {
230 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
231}
232
233impl fidl::endpoints::Proxy for InputDeviceProxy {
234 type Protocol = InputDeviceMarker;
235
236 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
237 Self::new(inner)
238 }
239
240 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
241 self.client.into_channel().map_err(|client| Self { client })
242 }
243
244 fn as_channel(&self) -> &::fidl::AsyncChannel {
245 self.client.as_channel()
246 }
247}
248
249impl InputDeviceProxy {
250 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
252 let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
253 Self { client: fidl::client::Client::new(channel, protocol_name) }
254 }
255
256 pub fn take_event_stream(&self) -> InputDeviceEventStream {
262 InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
263 }
264
265 pub fn r#get_input_reports_reader(
268 &self,
269 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
270 ) -> Result<(), fidl::Error> {
271 InputDeviceProxyInterface::r#get_input_reports_reader(self, reader)
272 }
273
274 pub fn r#get_descriptor(
276 &self,
277 ) -> fidl::client::QueryResponseFut<
278 DeviceDescriptor,
279 fidl::encoding::DefaultFuchsiaResourceDialect,
280 > {
281 InputDeviceProxyInterface::r#get_descriptor(self)
282 }
283
284 pub fn r#send_output_report(
287 &self,
288 mut report: &OutputReport,
289 ) -> fidl::client::QueryResponseFut<
290 InputDeviceSendOutputReportResult,
291 fidl::encoding::DefaultFuchsiaResourceDialect,
292 > {
293 InputDeviceProxyInterface::r#send_output_report(self, report)
294 }
295
296 pub fn r#get_feature_report(
299 &self,
300 ) -> fidl::client::QueryResponseFut<
301 InputDeviceGetFeatureReportResult,
302 fidl::encoding::DefaultFuchsiaResourceDialect,
303 > {
304 InputDeviceProxyInterface::r#get_feature_report(self)
305 }
306
307 pub fn r#set_feature_report(
310 &self,
311 mut report: &FeatureReport,
312 ) -> fidl::client::QueryResponseFut<
313 InputDeviceSetFeatureReportResult,
314 fidl::encoding::DefaultFuchsiaResourceDialect,
315 > {
316 InputDeviceProxyInterface::r#set_feature_report(self, report)
317 }
318
319 pub fn r#get_input_report(
325 &self,
326 mut device_type: DeviceType,
327 ) -> fidl::client::QueryResponseFut<
328 InputDeviceGetInputReportResult,
329 fidl::encoding::DefaultFuchsiaResourceDialect,
330 > {
331 InputDeviceProxyInterface::r#get_input_report(self, device_type)
332 }
333}
334
335impl InputDeviceProxyInterface for InputDeviceProxy {
336 fn r#get_input_reports_reader(
337 &self,
338 mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
339 ) -> Result<(), fidl::Error> {
340 self.client.send::<InputDeviceGetInputReportsReaderRequest>(
341 (reader,),
342 0x68d9cf83e397ab41,
343 fidl::encoding::DynamicFlags::empty(),
344 )
345 }
346
347 type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
348 DeviceDescriptor,
349 fidl::encoding::DefaultFuchsiaResourceDialect,
350 >;
351 fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut {
352 fn _decode(
353 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
354 ) -> Result<DeviceDescriptor, fidl::Error> {
355 let _response = fidl::client::decode_transaction_body::<
356 InputDeviceGetDescriptorResponse,
357 fidl::encoding::DefaultFuchsiaResourceDialect,
358 0x3d76420f2ff8ad32,
359 >(_buf?)?;
360 Ok(_response.descriptor)
361 }
362 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescriptor>(
363 (),
364 0x3d76420f2ff8ad32,
365 fidl::encoding::DynamicFlags::empty(),
366 _decode,
367 )
368 }
369
370 type SendOutputReportResponseFut = fidl::client::QueryResponseFut<
371 InputDeviceSendOutputReportResult,
372 fidl::encoding::DefaultFuchsiaResourceDialect,
373 >;
374 fn r#send_output_report(&self, mut report: &OutputReport) -> Self::SendOutputReportResponseFut {
375 fn _decode(
376 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
377 ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
378 let _response = fidl::client::decode_transaction_body::<
379 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
380 fidl::encoding::DefaultFuchsiaResourceDialect,
381 0x67a4888774e6f3a,
382 >(_buf?)?;
383 Ok(_response.map(|x| x))
384 }
385 self.client.send_query_and_decode::<
386 InputDeviceSendOutputReportRequest,
387 InputDeviceSendOutputReportResult,
388 >(
389 (report,),
390 0x67a4888774e6f3a,
391 fidl::encoding::DynamicFlags::empty(),
392 _decode,
393 )
394 }
395
396 type GetFeatureReportResponseFut = fidl::client::QueryResponseFut<
397 InputDeviceGetFeatureReportResult,
398 fidl::encoding::DefaultFuchsiaResourceDialect,
399 >;
400 fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut {
401 fn _decode(
402 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
403 ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
404 let _response = fidl::client::decode_transaction_body::<
405 fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
406 fidl::encoding::DefaultFuchsiaResourceDialect,
407 0x497a7d98d9391f16,
408 >(_buf?)?;
409 Ok(_response.map(|x| x.report))
410 }
411 self.client.send_query_and_decode::<
412 fidl::encoding::EmptyPayload,
413 InputDeviceGetFeatureReportResult,
414 >(
415 (),
416 0x497a7d98d9391f16,
417 fidl::encoding::DynamicFlags::empty(),
418 _decode,
419 )
420 }
421
422 type SetFeatureReportResponseFut = fidl::client::QueryResponseFut<
423 InputDeviceSetFeatureReportResult,
424 fidl::encoding::DefaultFuchsiaResourceDialect,
425 >;
426 fn r#set_feature_report(
427 &self,
428 mut report: &FeatureReport,
429 ) -> Self::SetFeatureReportResponseFut {
430 fn _decode(
431 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
432 ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
433 let _response = fidl::client::decode_transaction_body::<
434 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
435 fidl::encoding::DefaultFuchsiaResourceDialect,
436 0x7679a2f5a42842ef,
437 >(_buf?)?;
438 Ok(_response.map(|x| x))
439 }
440 self.client.send_query_and_decode::<
441 InputDeviceSetFeatureReportRequest,
442 InputDeviceSetFeatureReportResult,
443 >(
444 (report,),
445 0x7679a2f5a42842ef,
446 fidl::encoding::DynamicFlags::empty(),
447 _decode,
448 )
449 }
450
451 type GetInputReportResponseFut = fidl::client::QueryResponseFut<
452 InputDeviceGetInputReportResult,
453 fidl::encoding::DefaultFuchsiaResourceDialect,
454 >;
455 fn r#get_input_report(&self, mut device_type: DeviceType) -> Self::GetInputReportResponseFut {
456 fn _decode(
457 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
458 ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
459 let _response = fidl::client::decode_transaction_body::<
460 fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
461 fidl::encoding::DefaultFuchsiaResourceDialect,
462 0x4752ccab96c10248,
463 >(_buf?)?;
464 Ok(_response.map(|x| x.report))
465 }
466 self.client.send_query_and_decode::<
467 InputDeviceGetInputReportRequest,
468 InputDeviceGetInputReportResult,
469 >(
470 (device_type,),
471 0x4752ccab96c10248,
472 fidl::encoding::DynamicFlags::empty(),
473 _decode,
474 )
475 }
476}
477
478pub struct InputDeviceEventStream {
479 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
480}
481
482impl std::marker::Unpin for InputDeviceEventStream {}
483
484impl futures::stream::FusedStream for InputDeviceEventStream {
485 fn is_terminated(&self) -> bool {
486 self.event_receiver.is_terminated()
487 }
488}
489
490impl futures::Stream for InputDeviceEventStream {
491 type Item = Result<InputDeviceEvent, fidl::Error>;
492
493 fn poll_next(
494 mut self: std::pin::Pin<&mut Self>,
495 cx: &mut std::task::Context<'_>,
496 ) -> std::task::Poll<Option<Self::Item>> {
497 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
498 &mut self.event_receiver,
499 cx
500 )?) {
501 Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
502 None => std::task::Poll::Ready(None),
503 }
504 }
505}
506
507#[derive(Debug)]
508pub enum InputDeviceEvent {
509 #[non_exhaustive]
510 _UnknownEvent {
511 ordinal: u64,
513 },
514}
515
516impl InputDeviceEvent {
517 fn decode(
519 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
520 ) -> Result<InputDeviceEvent, fidl::Error> {
521 let (bytes, _handles) = buf.split_mut();
522 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
523 debug_assert_eq!(tx_header.tx_id, 0);
524 match tx_header.ordinal {
525 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
526 Ok(InputDeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
527 }
528 _ => Err(fidl::Error::UnknownOrdinal {
529 ordinal: tx_header.ordinal,
530 protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
531 }),
532 }
533 }
534}
535
536pub struct InputDeviceRequestStream {
538 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
539 is_terminated: bool,
540}
541
542impl std::marker::Unpin for InputDeviceRequestStream {}
543
544impl futures::stream::FusedStream for InputDeviceRequestStream {
545 fn is_terminated(&self) -> bool {
546 self.is_terminated
547 }
548}
549
550impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
551 type Protocol = InputDeviceMarker;
552 type ControlHandle = InputDeviceControlHandle;
553
554 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
555 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
556 }
557
558 fn control_handle(&self) -> Self::ControlHandle {
559 InputDeviceControlHandle { inner: self.inner.clone() }
560 }
561
562 fn into_inner(
563 self,
564 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
565 {
566 (self.inner, self.is_terminated)
567 }
568
569 fn from_inner(
570 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
571 is_terminated: bool,
572 ) -> Self {
573 Self { inner, is_terminated }
574 }
575}
576
577impl futures::Stream for InputDeviceRequestStream {
578 type Item = Result<InputDeviceRequest, fidl::Error>;
579
580 fn poll_next(
581 mut self: std::pin::Pin<&mut Self>,
582 cx: &mut std::task::Context<'_>,
583 ) -> std::task::Poll<Option<Self::Item>> {
584 let this = &mut *self;
585 if this.inner.check_shutdown(cx) {
586 this.is_terminated = true;
587 return std::task::Poll::Ready(None);
588 }
589 if this.is_terminated {
590 panic!("polled InputDeviceRequestStream after completion");
591 }
592 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
593 |bytes, handles| {
594 match this.inner.channel().read_etc(cx, bytes, handles) {
595 std::task::Poll::Ready(Ok(())) => {}
596 std::task::Poll::Pending => return std::task::Poll::Pending,
597 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
598 this.is_terminated = true;
599 return std::task::Poll::Ready(None);
600 }
601 std::task::Poll::Ready(Err(e)) => {
602 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
603 e.into(),
604 ))))
605 }
606 }
607
608 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
610
611 std::task::Poll::Ready(Some(match header.ordinal {
612 0x68d9cf83e397ab41 => {
613 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
614 let mut req = fidl::new_empty!(
615 InputDeviceGetInputReportsReaderRequest,
616 fidl::encoding::DefaultFuchsiaResourceDialect
617 );
618 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
619 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
620 Ok(InputDeviceRequest::GetInputReportsReader {
621 reader: req.reader,
622
623 control_handle,
624 })
625 }
626 0x3d76420f2ff8ad32 => {
627 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
628 let mut req = fidl::new_empty!(
629 fidl::encoding::EmptyPayload,
630 fidl::encoding::DefaultFuchsiaResourceDialect
631 );
632 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
633 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
634 Ok(InputDeviceRequest::GetDescriptor {
635 responder: InputDeviceGetDescriptorResponder {
636 control_handle: std::mem::ManuallyDrop::new(control_handle),
637 tx_id: header.tx_id,
638 },
639 })
640 }
641 0x67a4888774e6f3a => {
642 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
643 let mut req = fidl::new_empty!(
644 InputDeviceSendOutputReportRequest,
645 fidl::encoding::DefaultFuchsiaResourceDialect
646 );
647 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSendOutputReportRequest>(&header, _body_bytes, handles, &mut req)?;
648 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
649 Ok(InputDeviceRequest::SendOutputReport {
650 report: req.report,
651
652 responder: InputDeviceSendOutputReportResponder {
653 control_handle: std::mem::ManuallyDrop::new(control_handle),
654 tx_id: header.tx_id,
655 },
656 })
657 }
658 0x497a7d98d9391f16 => {
659 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
660 let mut req = fidl::new_empty!(
661 fidl::encoding::EmptyPayload,
662 fidl::encoding::DefaultFuchsiaResourceDialect
663 );
664 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
665 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
666 Ok(InputDeviceRequest::GetFeatureReport {
667 responder: InputDeviceGetFeatureReportResponder {
668 control_handle: std::mem::ManuallyDrop::new(control_handle),
669 tx_id: header.tx_id,
670 },
671 })
672 }
673 0x7679a2f5a42842ef => {
674 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
675 let mut req = fidl::new_empty!(
676 InputDeviceSetFeatureReportRequest,
677 fidl::encoding::DefaultFuchsiaResourceDialect
678 );
679 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSetFeatureReportRequest>(&header, _body_bytes, handles, &mut req)?;
680 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
681 Ok(InputDeviceRequest::SetFeatureReport {
682 report: req.report,
683
684 responder: InputDeviceSetFeatureReportResponder {
685 control_handle: std::mem::ManuallyDrop::new(control_handle),
686 tx_id: header.tx_id,
687 },
688 })
689 }
690 0x4752ccab96c10248 => {
691 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
692 let mut req = fidl::new_empty!(
693 InputDeviceGetInputReportRequest,
694 fidl::encoding::DefaultFuchsiaResourceDialect
695 );
696 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportRequest>(&header, _body_bytes, handles, &mut req)?;
697 let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
698 Ok(InputDeviceRequest::GetInputReport {
699 device_type: req.device_type,
700
701 responder: InputDeviceGetInputReportResponder {
702 control_handle: std::mem::ManuallyDrop::new(control_handle),
703 tx_id: header.tx_id,
704 },
705 })
706 }
707 _ if header.tx_id == 0
708 && header
709 .dynamic_flags()
710 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
711 {
712 Ok(InputDeviceRequest::_UnknownMethod {
713 ordinal: header.ordinal,
714 control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
715 method_type: fidl::MethodType::OneWay,
716 })
717 }
718 _ if header
719 .dynamic_flags()
720 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
721 {
722 this.inner.send_framework_err(
723 fidl::encoding::FrameworkErr::UnknownMethod,
724 header.tx_id,
725 header.ordinal,
726 header.dynamic_flags(),
727 (bytes, handles),
728 )?;
729 Ok(InputDeviceRequest::_UnknownMethod {
730 ordinal: header.ordinal,
731 control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
732 method_type: fidl::MethodType::TwoWay,
733 })
734 }
735 _ => Err(fidl::Error::UnknownOrdinal {
736 ordinal: header.ordinal,
737 protocol_name:
738 <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
739 }),
740 }))
741 },
742 )
743 }
744}
745
746#[derive(Debug)]
752pub enum InputDeviceRequest {
753 GetInputReportsReader {
756 reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
757 control_handle: InputDeviceControlHandle,
758 },
759 GetDescriptor { responder: InputDeviceGetDescriptorResponder },
761 SendOutputReport { report: OutputReport, responder: InputDeviceSendOutputReportResponder },
764 GetFeatureReport { responder: InputDeviceGetFeatureReportResponder },
767 SetFeatureReport { report: FeatureReport, responder: InputDeviceSetFeatureReportResponder },
770 GetInputReport { device_type: DeviceType, responder: InputDeviceGetInputReportResponder },
776 #[non_exhaustive]
778 _UnknownMethod {
779 ordinal: u64,
781 control_handle: InputDeviceControlHandle,
782 method_type: fidl::MethodType,
783 },
784}
785
786impl InputDeviceRequest {
787 #[allow(irrefutable_let_patterns)]
788 pub fn into_get_input_reports_reader(
789 self,
790 ) -> Option<(fidl::endpoints::ServerEnd<InputReportsReaderMarker>, InputDeviceControlHandle)>
791 {
792 if let InputDeviceRequest::GetInputReportsReader { reader, control_handle } = self {
793 Some((reader, control_handle))
794 } else {
795 None
796 }
797 }
798
799 #[allow(irrefutable_let_patterns)]
800 pub fn into_get_descriptor(self) -> Option<(InputDeviceGetDescriptorResponder)> {
801 if let InputDeviceRequest::GetDescriptor { responder } = self {
802 Some((responder))
803 } else {
804 None
805 }
806 }
807
808 #[allow(irrefutable_let_patterns)]
809 pub fn into_send_output_report(
810 self,
811 ) -> Option<(OutputReport, InputDeviceSendOutputReportResponder)> {
812 if let InputDeviceRequest::SendOutputReport { report, responder } = self {
813 Some((report, responder))
814 } else {
815 None
816 }
817 }
818
819 #[allow(irrefutable_let_patterns)]
820 pub fn into_get_feature_report(self) -> Option<(InputDeviceGetFeatureReportResponder)> {
821 if let InputDeviceRequest::GetFeatureReport { responder } = self {
822 Some((responder))
823 } else {
824 None
825 }
826 }
827
828 #[allow(irrefutable_let_patterns)]
829 pub fn into_set_feature_report(
830 self,
831 ) -> Option<(FeatureReport, InputDeviceSetFeatureReportResponder)> {
832 if let InputDeviceRequest::SetFeatureReport { report, responder } = self {
833 Some((report, responder))
834 } else {
835 None
836 }
837 }
838
839 #[allow(irrefutable_let_patterns)]
840 pub fn into_get_input_report(self) -> Option<(DeviceType, InputDeviceGetInputReportResponder)> {
841 if let InputDeviceRequest::GetInputReport { device_type, responder } = self {
842 Some((device_type, responder))
843 } else {
844 None
845 }
846 }
847
848 pub fn method_name(&self) -> &'static str {
850 match *self {
851 InputDeviceRequest::GetInputReportsReader { .. } => "get_input_reports_reader",
852 InputDeviceRequest::GetDescriptor { .. } => "get_descriptor",
853 InputDeviceRequest::SendOutputReport { .. } => "send_output_report",
854 InputDeviceRequest::GetFeatureReport { .. } => "get_feature_report",
855 InputDeviceRequest::SetFeatureReport { .. } => "set_feature_report",
856 InputDeviceRequest::GetInputReport { .. } => "get_input_report",
857 InputDeviceRequest::_UnknownMethod {
858 method_type: fidl::MethodType::OneWay, ..
859 } => "unknown one-way method",
860 InputDeviceRequest::_UnknownMethod {
861 method_type: fidl::MethodType::TwoWay, ..
862 } => "unknown two-way method",
863 }
864 }
865}
866
867#[derive(Debug, Clone)]
868pub struct InputDeviceControlHandle {
869 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
870}
871
872impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
873 fn shutdown(&self) {
874 self.inner.shutdown()
875 }
876 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
877 self.inner.shutdown_with_epitaph(status)
878 }
879
880 fn is_closed(&self) -> bool {
881 self.inner.channel().is_closed()
882 }
883 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
884 self.inner.channel().on_closed()
885 }
886
887 #[cfg(target_os = "fuchsia")]
888 fn signal_peer(
889 &self,
890 clear_mask: zx::Signals,
891 set_mask: zx::Signals,
892 ) -> Result<(), zx_status::Status> {
893 use fidl::Peered;
894 self.inner.channel().signal_peer(clear_mask, set_mask)
895 }
896}
897
898impl InputDeviceControlHandle {}
899
900#[must_use = "FIDL methods require a response to be sent"]
901#[derive(Debug)]
902pub struct InputDeviceGetDescriptorResponder {
903 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
904 tx_id: u32,
905}
906
907impl std::ops::Drop for InputDeviceGetDescriptorResponder {
911 fn drop(&mut self) {
912 self.control_handle.shutdown();
913 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
915 }
916}
917
918impl fidl::endpoints::Responder for InputDeviceGetDescriptorResponder {
919 type ControlHandle = InputDeviceControlHandle;
920
921 fn control_handle(&self) -> &InputDeviceControlHandle {
922 &self.control_handle
923 }
924
925 fn drop_without_shutdown(mut self) {
926 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
928 std::mem::forget(self);
930 }
931}
932
933impl InputDeviceGetDescriptorResponder {
934 pub fn send(self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
938 let _result = self.send_raw(descriptor);
939 if _result.is_err() {
940 self.control_handle.shutdown();
941 }
942 self.drop_without_shutdown();
943 _result
944 }
945
946 pub fn send_no_shutdown_on_err(
948 self,
949 mut descriptor: &DeviceDescriptor,
950 ) -> Result<(), fidl::Error> {
951 let _result = self.send_raw(descriptor);
952 self.drop_without_shutdown();
953 _result
954 }
955
956 fn send_raw(&self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
957 self.control_handle.inner.send::<InputDeviceGetDescriptorResponse>(
958 (descriptor,),
959 self.tx_id,
960 0x3d76420f2ff8ad32,
961 fidl::encoding::DynamicFlags::empty(),
962 )
963 }
964}
965
966#[must_use = "FIDL methods require a response to be sent"]
967#[derive(Debug)]
968pub struct InputDeviceSendOutputReportResponder {
969 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
970 tx_id: u32,
971}
972
973impl std::ops::Drop for InputDeviceSendOutputReportResponder {
977 fn drop(&mut self) {
978 self.control_handle.shutdown();
979 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
981 }
982}
983
984impl fidl::endpoints::Responder for InputDeviceSendOutputReportResponder {
985 type ControlHandle = InputDeviceControlHandle;
986
987 fn control_handle(&self) -> &InputDeviceControlHandle {
988 &self.control_handle
989 }
990
991 fn drop_without_shutdown(mut self) {
992 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
994 std::mem::forget(self);
996 }
997}
998
999impl InputDeviceSendOutputReportResponder {
1000 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1004 let _result = self.send_raw(result);
1005 if _result.is_err() {
1006 self.control_handle.shutdown();
1007 }
1008 self.drop_without_shutdown();
1009 _result
1010 }
1011
1012 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1014 let _result = self.send_raw(result);
1015 self.drop_without_shutdown();
1016 _result
1017 }
1018
1019 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1020 self.control_handle
1021 .inner
1022 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1023 result,
1024 self.tx_id,
1025 0x67a4888774e6f3a,
1026 fidl::encoding::DynamicFlags::empty(),
1027 )
1028 }
1029}
1030
1031#[must_use = "FIDL methods require a response to be sent"]
1032#[derive(Debug)]
1033pub struct InputDeviceGetFeatureReportResponder {
1034 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1035 tx_id: u32,
1036}
1037
1038impl std::ops::Drop for InputDeviceGetFeatureReportResponder {
1042 fn drop(&mut self) {
1043 self.control_handle.shutdown();
1044 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1046 }
1047}
1048
1049impl fidl::endpoints::Responder for InputDeviceGetFeatureReportResponder {
1050 type ControlHandle = InputDeviceControlHandle;
1051
1052 fn control_handle(&self) -> &InputDeviceControlHandle {
1053 &self.control_handle
1054 }
1055
1056 fn drop_without_shutdown(mut self) {
1057 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1059 std::mem::forget(self);
1061 }
1062}
1063
1064impl InputDeviceGetFeatureReportResponder {
1065 pub fn send(self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1069 let _result = self.send_raw(result);
1070 if _result.is_err() {
1071 self.control_handle.shutdown();
1072 }
1073 self.drop_without_shutdown();
1074 _result
1075 }
1076
1077 pub fn send_no_shutdown_on_err(
1079 self,
1080 mut result: Result<&FeatureReport, i32>,
1081 ) -> Result<(), fidl::Error> {
1082 let _result = self.send_raw(result);
1083 self.drop_without_shutdown();
1084 _result
1085 }
1086
1087 fn send_raw(&self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1088 self.control_handle.inner.send::<fidl::encoding::ResultType<
1089 InputDeviceGetFeatureReportResponse,
1090 i32,
1091 >>(
1092 result.map(|report| (report,)),
1093 self.tx_id,
1094 0x497a7d98d9391f16,
1095 fidl::encoding::DynamicFlags::empty(),
1096 )
1097 }
1098}
1099
1100#[must_use = "FIDL methods require a response to be sent"]
1101#[derive(Debug)]
1102pub struct InputDeviceSetFeatureReportResponder {
1103 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1104 tx_id: u32,
1105}
1106
1107impl std::ops::Drop for InputDeviceSetFeatureReportResponder {
1111 fn drop(&mut self) {
1112 self.control_handle.shutdown();
1113 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1115 }
1116}
1117
1118impl fidl::endpoints::Responder for InputDeviceSetFeatureReportResponder {
1119 type ControlHandle = InputDeviceControlHandle;
1120
1121 fn control_handle(&self) -> &InputDeviceControlHandle {
1122 &self.control_handle
1123 }
1124
1125 fn drop_without_shutdown(mut self) {
1126 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1128 std::mem::forget(self);
1130 }
1131}
1132
1133impl InputDeviceSetFeatureReportResponder {
1134 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1138 let _result = self.send_raw(result);
1139 if _result.is_err() {
1140 self.control_handle.shutdown();
1141 }
1142 self.drop_without_shutdown();
1143 _result
1144 }
1145
1146 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1148 let _result = self.send_raw(result);
1149 self.drop_without_shutdown();
1150 _result
1151 }
1152
1153 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1154 self.control_handle
1155 .inner
1156 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1157 result,
1158 self.tx_id,
1159 0x7679a2f5a42842ef,
1160 fidl::encoding::DynamicFlags::empty(),
1161 )
1162 }
1163}
1164
1165#[must_use = "FIDL methods require a response to be sent"]
1166#[derive(Debug)]
1167pub struct InputDeviceGetInputReportResponder {
1168 control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1169 tx_id: u32,
1170}
1171
1172impl std::ops::Drop for InputDeviceGetInputReportResponder {
1176 fn drop(&mut self) {
1177 self.control_handle.shutdown();
1178 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1180 }
1181}
1182
1183impl fidl::endpoints::Responder for InputDeviceGetInputReportResponder {
1184 type ControlHandle = InputDeviceControlHandle;
1185
1186 fn control_handle(&self) -> &InputDeviceControlHandle {
1187 &self.control_handle
1188 }
1189
1190 fn drop_without_shutdown(mut self) {
1191 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1193 std::mem::forget(self);
1195 }
1196}
1197
1198impl InputDeviceGetInputReportResponder {
1199 pub fn send(self, mut result: Result<&InputReport, i32>) -> Result<(), fidl::Error> {
1203 let _result = self.send_raw(result);
1204 if _result.is_err() {
1205 self.control_handle.shutdown();
1206 }
1207 self.drop_without_shutdown();
1208 _result
1209 }
1210
1211 pub fn send_no_shutdown_on_err(
1213 self,
1214 mut result: Result<&InputReport, i32>,
1215 ) -> Result<(), fidl::Error> {
1216 let _result = self.send_raw(result);
1217 self.drop_without_shutdown();
1218 _result
1219 }
1220
1221 fn send_raw(&self, mut result: Result<&InputReport, i32>) -> Result<(), fidl::Error> {
1222 self.control_handle
1223 .inner
1224 .send::<fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>>(
1225 result.map(|report| (report,)),
1226 self.tx_id,
1227 0x4752ccab96c10248,
1228 fidl::encoding::DynamicFlags::empty(),
1229 )
1230 }
1231}
1232
1233#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1234pub struct InputReportsReaderMarker;
1235
1236impl fidl::endpoints::ProtocolMarker for InputReportsReaderMarker {
1237 type Proxy = InputReportsReaderProxy;
1238 type RequestStream = InputReportsReaderRequestStream;
1239 #[cfg(target_os = "fuchsia")]
1240 type SynchronousProxy = InputReportsReaderSynchronousProxy;
1241
1242 const DEBUG_NAME: &'static str = "(anonymous) InputReportsReader";
1243}
1244pub type InputReportsReaderReadInputReportsResult = Result<Vec<InputReport>, i32>;
1245
1246pub trait InputReportsReaderProxyInterface: Send + Sync {
1247 type ReadInputReportsResponseFut: std::future::Future<Output = Result<InputReportsReaderReadInputReportsResult, fidl::Error>>
1248 + Send;
1249 fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut;
1250}
1251#[derive(Debug)]
1252#[cfg(target_os = "fuchsia")]
1253pub struct InputReportsReaderSynchronousProxy {
1254 client: fidl::client::sync::Client,
1255}
1256
1257#[cfg(target_os = "fuchsia")]
1258impl fidl::endpoints::SynchronousProxy for InputReportsReaderSynchronousProxy {
1259 type Proxy = InputReportsReaderProxy;
1260 type Protocol = InputReportsReaderMarker;
1261
1262 fn from_channel(inner: fidl::Channel) -> Self {
1263 Self::new(inner)
1264 }
1265
1266 fn into_channel(self) -> fidl::Channel {
1267 self.client.into_channel()
1268 }
1269
1270 fn as_channel(&self) -> &fidl::Channel {
1271 self.client.as_channel()
1272 }
1273}
1274
1275#[cfg(target_os = "fuchsia")]
1276impl InputReportsReaderSynchronousProxy {
1277 pub fn new(channel: fidl::Channel) -> Self {
1278 let protocol_name =
1279 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1280 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1281 }
1282
1283 pub fn into_channel(self) -> fidl::Channel {
1284 self.client.into_channel()
1285 }
1286
1287 pub fn wait_for_event(
1290 &self,
1291 deadline: zx::MonotonicInstant,
1292 ) -> Result<InputReportsReaderEvent, fidl::Error> {
1293 InputReportsReaderEvent::decode(self.client.wait_for_event(deadline)?)
1294 }
1295
1296 pub fn r#read_input_reports(
1302 &self,
1303 ___deadline: zx::MonotonicInstant,
1304 ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1305 let _response =
1306 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1307 InputReportsReaderReadInputReportsResponse,
1308 i32,
1309 >>(
1310 (),
1311 0x3595efdc88842559,
1312 fidl::encoding::DynamicFlags::empty(),
1313 ___deadline,
1314 )?;
1315 Ok(_response.map(|x| x.reports))
1316 }
1317}
1318
1319#[cfg(target_os = "fuchsia")]
1320impl From<InputReportsReaderSynchronousProxy> for zx::Handle {
1321 fn from(value: InputReportsReaderSynchronousProxy) -> Self {
1322 value.into_channel().into()
1323 }
1324}
1325
1326#[cfg(target_os = "fuchsia")]
1327impl From<fidl::Channel> for InputReportsReaderSynchronousProxy {
1328 fn from(value: fidl::Channel) -> Self {
1329 Self::new(value)
1330 }
1331}
1332
1333#[derive(Debug, Clone)]
1334pub struct InputReportsReaderProxy {
1335 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1336}
1337
1338impl fidl::endpoints::Proxy for InputReportsReaderProxy {
1339 type Protocol = InputReportsReaderMarker;
1340
1341 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1342 Self::new(inner)
1343 }
1344
1345 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1346 self.client.into_channel().map_err(|client| Self { client })
1347 }
1348
1349 fn as_channel(&self) -> &::fidl::AsyncChannel {
1350 self.client.as_channel()
1351 }
1352}
1353
1354impl InputReportsReaderProxy {
1355 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1357 let protocol_name =
1358 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1359 Self { client: fidl::client::Client::new(channel, protocol_name) }
1360 }
1361
1362 pub fn take_event_stream(&self) -> InputReportsReaderEventStream {
1368 InputReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
1369 }
1370
1371 pub fn r#read_input_reports(
1377 &self,
1378 ) -> fidl::client::QueryResponseFut<
1379 InputReportsReaderReadInputReportsResult,
1380 fidl::encoding::DefaultFuchsiaResourceDialect,
1381 > {
1382 InputReportsReaderProxyInterface::r#read_input_reports(self)
1383 }
1384}
1385
1386impl InputReportsReaderProxyInterface for InputReportsReaderProxy {
1387 type ReadInputReportsResponseFut = fidl::client::QueryResponseFut<
1388 InputReportsReaderReadInputReportsResult,
1389 fidl::encoding::DefaultFuchsiaResourceDialect,
1390 >;
1391 fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut {
1392 fn _decode(
1393 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1394 ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1395 let _response = fidl::client::decode_transaction_body::<
1396 fidl::encoding::ResultType<InputReportsReaderReadInputReportsResponse, i32>,
1397 fidl::encoding::DefaultFuchsiaResourceDialect,
1398 0x3595efdc88842559,
1399 >(_buf?)?;
1400 Ok(_response.map(|x| x.reports))
1401 }
1402 self.client.send_query_and_decode::<
1403 fidl::encoding::EmptyPayload,
1404 InputReportsReaderReadInputReportsResult,
1405 >(
1406 (),
1407 0x3595efdc88842559,
1408 fidl::encoding::DynamicFlags::empty(),
1409 _decode,
1410 )
1411 }
1412}
1413
1414pub struct InputReportsReaderEventStream {
1415 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1416}
1417
1418impl std::marker::Unpin for InputReportsReaderEventStream {}
1419
1420impl futures::stream::FusedStream for InputReportsReaderEventStream {
1421 fn is_terminated(&self) -> bool {
1422 self.event_receiver.is_terminated()
1423 }
1424}
1425
1426impl futures::Stream for InputReportsReaderEventStream {
1427 type Item = Result<InputReportsReaderEvent, fidl::Error>;
1428
1429 fn poll_next(
1430 mut self: std::pin::Pin<&mut Self>,
1431 cx: &mut std::task::Context<'_>,
1432 ) -> std::task::Poll<Option<Self::Item>> {
1433 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1434 &mut self.event_receiver,
1435 cx
1436 )?) {
1437 Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderEvent::decode(buf))),
1438 None => std::task::Poll::Ready(None),
1439 }
1440 }
1441}
1442
1443#[derive(Debug)]
1444pub enum InputReportsReaderEvent {}
1445
1446impl InputReportsReaderEvent {
1447 fn decode(
1449 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1450 ) -> Result<InputReportsReaderEvent, fidl::Error> {
1451 let (bytes, _handles) = buf.split_mut();
1452 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1453 debug_assert_eq!(tx_header.tx_id, 0);
1454 match tx_header.ordinal {
1455 _ => Err(fidl::Error::UnknownOrdinal {
1456 ordinal: tx_header.ordinal,
1457 protocol_name:
1458 <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1459 }),
1460 }
1461 }
1462}
1463
1464pub struct InputReportsReaderRequestStream {
1466 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1467 is_terminated: bool,
1468}
1469
1470impl std::marker::Unpin for InputReportsReaderRequestStream {}
1471
1472impl futures::stream::FusedStream for InputReportsReaderRequestStream {
1473 fn is_terminated(&self) -> bool {
1474 self.is_terminated
1475 }
1476}
1477
1478impl fidl::endpoints::RequestStream for InputReportsReaderRequestStream {
1479 type Protocol = InputReportsReaderMarker;
1480 type ControlHandle = InputReportsReaderControlHandle;
1481
1482 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1483 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1484 }
1485
1486 fn control_handle(&self) -> Self::ControlHandle {
1487 InputReportsReaderControlHandle { inner: self.inner.clone() }
1488 }
1489
1490 fn into_inner(
1491 self,
1492 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1493 {
1494 (self.inner, self.is_terminated)
1495 }
1496
1497 fn from_inner(
1498 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1499 is_terminated: bool,
1500 ) -> Self {
1501 Self { inner, is_terminated }
1502 }
1503}
1504
1505impl futures::Stream for InputReportsReaderRequestStream {
1506 type Item = Result<InputReportsReaderRequest, fidl::Error>;
1507
1508 fn poll_next(
1509 mut self: std::pin::Pin<&mut Self>,
1510 cx: &mut std::task::Context<'_>,
1511 ) -> std::task::Poll<Option<Self::Item>> {
1512 let this = &mut *self;
1513 if this.inner.check_shutdown(cx) {
1514 this.is_terminated = true;
1515 return std::task::Poll::Ready(None);
1516 }
1517 if this.is_terminated {
1518 panic!("polled InputReportsReaderRequestStream after completion");
1519 }
1520 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1521 |bytes, handles| {
1522 match this.inner.channel().read_etc(cx, bytes, handles) {
1523 std::task::Poll::Ready(Ok(())) => {}
1524 std::task::Poll::Pending => return std::task::Poll::Pending,
1525 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1526 this.is_terminated = true;
1527 return std::task::Poll::Ready(None);
1528 }
1529 std::task::Poll::Ready(Err(e)) => {
1530 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1531 e.into(),
1532 ))))
1533 }
1534 }
1535
1536 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1538
1539 std::task::Poll::Ready(Some(match header.ordinal {
1540 0x3595efdc88842559 => {
1541 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1542 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1543 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1544 let control_handle = InputReportsReaderControlHandle {
1545 inner: this.inner.clone(),
1546 };
1547 Ok(InputReportsReaderRequest::ReadInputReports {
1548 responder: InputReportsReaderReadInputReportsResponder {
1549 control_handle: std::mem::ManuallyDrop::new(control_handle),
1550 tx_id: header.tx_id,
1551 },
1552 })
1553 }
1554 _ => Err(fidl::Error::UnknownOrdinal {
1555 ordinal: header.ordinal,
1556 protocol_name: <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1557 }),
1558 }))
1559 },
1560 )
1561 }
1562}
1563
1564#[derive(Debug)]
1569pub enum InputReportsReaderRequest {
1570 ReadInputReports { responder: InputReportsReaderReadInputReportsResponder },
1576}
1577
1578impl InputReportsReaderRequest {
1579 #[allow(irrefutable_let_patterns)]
1580 pub fn into_read_input_reports(self) -> Option<(InputReportsReaderReadInputReportsResponder)> {
1581 if let InputReportsReaderRequest::ReadInputReports { responder } = self {
1582 Some((responder))
1583 } else {
1584 None
1585 }
1586 }
1587
1588 pub fn method_name(&self) -> &'static str {
1590 match *self {
1591 InputReportsReaderRequest::ReadInputReports { .. } => "read_input_reports",
1592 }
1593 }
1594}
1595
1596#[derive(Debug, Clone)]
1597pub struct InputReportsReaderControlHandle {
1598 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1599}
1600
1601impl fidl::endpoints::ControlHandle for InputReportsReaderControlHandle {
1602 fn shutdown(&self) {
1603 self.inner.shutdown()
1604 }
1605 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1606 self.inner.shutdown_with_epitaph(status)
1607 }
1608
1609 fn is_closed(&self) -> bool {
1610 self.inner.channel().is_closed()
1611 }
1612 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1613 self.inner.channel().on_closed()
1614 }
1615
1616 #[cfg(target_os = "fuchsia")]
1617 fn signal_peer(
1618 &self,
1619 clear_mask: zx::Signals,
1620 set_mask: zx::Signals,
1621 ) -> Result<(), zx_status::Status> {
1622 use fidl::Peered;
1623 self.inner.channel().signal_peer(clear_mask, set_mask)
1624 }
1625}
1626
1627impl InputReportsReaderControlHandle {}
1628
1629#[must_use = "FIDL methods require a response to be sent"]
1630#[derive(Debug)]
1631pub struct InputReportsReaderReadInputReportsResponder {
1632 control_handle: std::mem::ManuallyDrop<InputReportsReaderControlHandle>,
1633 tx_id: u32,
1634}
1635
1636impl std::ops::Drop for InputReportsReaderReadInputReportsResponder {
1640 fn drop(&mut self) {
1641 self.control_handle.shutdown();
1642 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1644 }
1645}
1646
1647impl fidl::endpoints::Responder for InputReportsReaderReadInputReportsResponder {
1648 type ControlHandle = InputReportsReaderControlHandle;
1649
1650 fn control_handle(&self) -> &InputReportsReaderControlHandle {
1651 &self.control_handle
1652 }
1653
1654 fn drop_without_shutdown(mut self) {
1655 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1657 std::mem::forget(self);
1659 }
1660}
1661
1662impl InputReportsReaderReadInputReportsResponder {
1663 pub fn send(self, mut result: Result<&[InputReport], i32>) -> Result<(), fidl::Error> {
1667 let _result = self.send_raw(result);
1668 if _result.is_err() {
1669 self.control_handle.shutdown();
1670 }
1671 self.drop_without_shutdown();
1672 _result
1673 }
1674
1675 pub fn send_no_shutdown_on_err(
1677 self,
1678 mut result: Result<&[InputReport], i32>,
1679 ) -> Result<(), fidl::Error> {
1680 let _result = self.send_raw(result);
1681 self.drop_without_shutdown();
1682 _result
1683 }
1684
1685 fn send_raw(&self, mut result: Result<&[InputReport], i32>) -> Result<(), fidl::Error> {
1686 self.control_handle.inner.send::<fidl::encoding::ResultType<
1687 InputReportsReaderReadInputReportsResponse,
1688 i32,
1689 >>(
1690 result.map(|reports| (reports,)),
1691 self.tx_id,
1692 0x3595efdc88842559,
1693 fidl::encoding::DynamicFlags::empty(),
1694 )
1695 }
1696}
1697
1698#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1699pub struct ServiceMarker;
1700
1701#[cfg(target_os = "fuchsia")]
1702impl fidl::endpoints::ServiceMarker for ServiceMarker {
1703 type Proxy = ServiceProxy;
1704 type Request = ServiceRequest;
1705 const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
1706}
1707
1708#[cfg(target_os = "fuchsia")]
1711pub enum ServiceRequest {
1712 InputDevice(InputDeviceRequestStream),
1713}
1714
1715#[cfg(target_os = "fuchsia")]
1716impl fidl::endpoints::ServiceRequest for ServiceRequest {
1717 type Service = ServiceMarker;
1718
1719 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1720 match name {
1721 "input_device" => Self::InputDevice(
1722 <InputDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
1723 _channel,
1724 ),
1725 ),
1726 _ => panic!("no such member protocol name for service Service"),
1727 }
1728 }
1729
1730 fn member_names() -> &'static [&'static str] {
1731 &["input_device"]
1732 }
1733}
1734#[cfg(target_os = "fuchsia")]
1735pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1736
1737#[cfg(target_os = "fuchsia")]
1738impl fidl::endpoints::ServiceProxy for ServiceProxy {
1739 type Service = ServiceMarker;
1740
1741 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1742 Self(opener)
1743 }
1744}
1745
1746#[cfg(target_os = "fuchsia")]
1747impl ServiceProxy {
1748 pub fn connect_to_input_device(&self) -> Result<InputDeviceProxy, fidl::Error> {
1749 let (proxy, server_end) = fidl::endpoints::create_proxy::<InputDeviceMarker>();
1750 self.connect_channel_to_input_device(server_end)?;
1751 Ok(proxy)
1752 }
1753
1754 pub fn connect_to_input_device_sync(&self) -> Result<InputDeviceSynchronousProxy, fidl::Error> {
1757 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<InputDeviceMarker>();
1758 self.connect_channel_to_input_device(server_end)?;
1759 Ok(proxy)
1760 }
1761
1762 pub fn connect_channel_to_input_device(
1765 &self,
1766 server_end: fidl::endpoints::ServerEnd<InputDeviceMarker>,
1767 ) -> Result<(), fidl::Error> {
1768 self.0.open_member("input_device", server_end.into_channel())
1769 }
1770
1771 pub fn instance_name(&self) -> &str {
1772 self.0.instance_name()
1773 }
1774}
1775
1776mod internal {
1777 use super::*;
1778
1779 impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderRequest {
1780 type Borrowed<'a> = &'a mut Self;
1781 fn take_or_borrow<'a>(
1782 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1783 ) -> Self::Borrowed<'a> {
1784 value
1785 }
1786 }
1787
1788 unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderRequest {
1789 type Owned = Self;
1790
1791 #[inline(always)]
1792 fn inline_align(_context: fidl::encoding::Context) -> usize {
1793 4
1794 }
1795
1796 #[inline(always)]
1797 fn inline_size(_context: fidl::encoding::Context) -> usize {
1798 4
1799 }
1800 }
1801
1802 unsafe impl
1803 fidl::encoding::Encode<
1804 InputDeviceGetInputReportsReaderRequest,
1805 fidl::encoding::DefaultFuchsiaResourceDialect,
1806 > for &mut InputDeviceGetInputReportsReaderRequest
1807 {
1808 #[inline]
1809 unsafe fn encode(
1810 self,
1811 encoder: &mut fidl::encoding::Encoder<
1812 '_,
1813 fidl::encoding::DefaultFuchsiaResourceDialect,
1814 >,
1815 offset: usize,
1816 _depth: fidl::encoding::Depth,
1817 ) -> fidl::Result<()> {
1818 encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1819 fidl::encoding::Encode::<InputDeviceGetInputReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1821 (
1822 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
1823 ),
1824 encoder, offset, _depth
1825 )
1826 }
1827 }
1828 unsafe impl<
1829 T0: fidl::encoding::Encode<
1830 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1831 fidl::encoding::DefaultFuchsiaResourceDialect,
1832 >,
1833 >
1834 fidl::encoding::Encode<
1835 InputDeviceGetInputReportsReaderRequest,
1836 fidl::encoding::DefaultFuchsiaResourceDialect,
1837 > for (T0,)
1838 {
1839 #[inline]
1840 unsafe fn encode(
1841 self,
1842 encoder: &mut fidl::encoding::Encoder<
1843 '_,
1844 fidl::encoding::DefaultFuchsiaResourceDialect,
1845 >,
1846 offset: usize,
1847 depth: fidl::encoding::Depth,
1848 ) -> fidl::Result<()> {
1849 encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1850 self.0.encode(encoder, offset + 0, depth)?;
1854 Ok(())
1855 }
1856 }
1857
1858 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1859 for InputDeviceGetInputReportsReaderRequest
1860 {
1861 #[inline(always)]
1862 fn new_empty() -> Self {
1863 Self {
1864 reader: fidl::new_empty!(
1865 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1866 fidl::encoding::DefaultFuchsiaResourceDialect
1867 ),
1868 }
1869 }
1870
1871 #[inline]
1872 unsafe fn decode(
1873 &mut self,
1874 decoder: &mut fidl::encoding::Decoder<
1875 '_,
1876 fidl::encoding::DefaultFuchsiaResourceDialect,
1877 >,
1878 offset: usize,
1879 _depth: fidl::encoding::Depth,
1880 ) -> fidl::Result<()> {
1881 decoder.debug_check_bounds::<Self>(offset);
1882 fidl::decode!(
1884 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1885 fidl::encoding::DefaultFuchsiaResourceDialect,
1886 &mut self.reader,
1887 decoder,
1888 offset + 0,
1889 _depth
1890 )?;
1891 Ok(())
1892 }
1893 }
1894}