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_hardware_input_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ControllerOpenSessionRequest {
16 pub session: fidl::endpoints::ServerEnd<DeviceMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20 for ControllerOpenSessionRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct DeviceGetDeviceReportsReaderRequest {
26 pub reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30 for DeviceGetDeviceReportsReaderRequest
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct DeviceReportsReaderReadReportsResponse {
36 pub reports: Vec<fidl_fuchsia_hardware_hidbus::Report>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40 for DeviceReportsReaderReadReportsResponse
41{
42}
43
44#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
45pub struct DeviceGetReportsEventResponse {
46 pub event: fidl::Event,
47}
48
49impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
50 for DeviceGetReportsEventResponse
51{
52}
53
54#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
55pub struct ControllerMarker;
56
57impl fidl::endpoints::ProtocolMarker for ControllerMarker {
58 type Proxy = ControllerProxy;
59 type RequestStream = ControllerRequestStream;
60 #[cfg(target_os = "fuchsia")]
61 type SynchronousProxy = ControllerSynchronousProxy;
62
63 const DEBUG_NAME: &'static str = "(anonymous) Controller";
64}
65
66pub trait ControllerProxyInterface: Send + Sync {
67 fn r#open_session(
68 &self,
69 session: fidl::endpoints::ServerEnd<DeviceMarker>,
70 ) -> Result<(), fidl::Error>;
71}
72#[derive(Debug)]
73#[cfg(target_os = "fuchsia")]
74pub struct ControllerSynchronousProxy {
75 client: fidl::client::sync::Client,
76}
77
78#[cfg(target_os = "fuchsia")]
79impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
80 type Proxy = ControllerProxy;
81 type Protocol = ControllerMarker;
82
83 fn from_channel(inner: fidl::Channel) -> Self {
84 Self::new(inner)
85 }
86
87 fn into_channel(self) -> fidl::Channel {
88 self.client.into_channel()
89 }
90
91 fn as_channel(&self) -> &fidl::Channel {
92 self.client.as_channel()
93 }
94}
95
96#[cfg(target_os = "fuchsia")]
97impl ControllerSynchronousProxy {
98 pub fn new(channel: fidl::Channel) -> Self {
99 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
100 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
101 }
102
103 pub fn into_channel(self) -> fidl::Channel {
104 self.client.into_channel()
105 }
106
107 pub fn wait_for_event(
110 &self,
111 deadline: zx::MonotonicInstant,
112 ) -> Result<ControllerEvent, fidl::Error> {
113 ControllerEvent::decode(self.client.wait_for_event(deadline)?)
114 }
115
116 pub fn r#open_session(
118 &self,
119 mut session: fidl::endpoints::ServerEnd<DeviceMarker>,
120 ) -> Result<(), fidl::Error> {
121 self.client.send::<ControllerOpenSessionRequest>(
122 (session,),
123 0x404db87008999427,
124 fidl::encoding::DynamicFlags::empty(),
125 )
126 }
127}
128
129#[cfg(target_os = "fuchsia")]
130impl From<ControllerSynchronousProxy> for zx::Handle {
131 fn from(value: ControllerSynchronousProxy) -> Self {
132 value.into_channel().into()
133 }
134}
135
136#[cfg(target_os = "fuchsia")]
137impl From<fidl::Channel> for ControllerSynchronousProxy {
138 fn from(value: fidl::Channel) -> Self {
139 Self::new(value)
140 }
141}
142
143#[derive(Debug, Clone)]
144pub struct ControllerProxy {
145 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
146}
147
148impl fidl::endpoints::Proxy for ControllerProxy {
149 type Protocol = ControllerMarker;
150
151 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
152 Self::new(inner)
153 }
154
155 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
156 self.client.into_channel().map_err(|client| Self { client })
157 }
158
159 fn as_channel(&self) -> &::fidl::AsyncChannel {
160 self.client.as_channel()
161 }
162}
163
164impl ControllerProxy {
165 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
167 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
168 Self { client: fidl::client::Client::new(channel, protocol_name) }
169 }
170
171 pub fn take_event_stream(&self) -> ControllerEventStream {
177 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
178 }
179
180 pub fn r#open_session(
182 &self,
183 mut session: fidl::endpoints::ServerEnd<DeviceMarker>,
184 ) -> Result<(), fidl::Error> {
185 ControllerProxyInterface::r#open_session(self, session)
186 }
187}
188
189impl ControllerProxyInterface for ControllerProxy {
190 fn r#open_session(
191 &self,
192 mut session: fidl::endpoints::ServerEnd<DeviceMarker>,
193 ) -> Result<(), fidl::Error> {
194 self.client.send::<ControllerOpenSessionRequest>(
195 (session,),
196 0x404db87008999427,
197 fidl::encoding::DynamicFlags::empty(),
198 )
199 }
200}
201
202pub struct ControllerEventStream {
203 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl std::marker::Unpin for ControllerEventStream {}
207
208impl futures::stream::FusedStream for ControllerEventStream {
209 fn is_terminated(&self) -> bool {
210 self.event_receiver.is_terminated()
211 }
212}
213
214impl futures::Stream for ControllerEventStream {
215 type Item = Result<ControllerEvent, fidl::Error>;
216
217 fn poll_next(
218 mut self: std::pin::Pin<&mut Self>,
219 cx: &mut std::task::Context<'_>,
220 ) -> std::task::Poll<Option<Self::Item>> {
221 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
222 &mut self.event_receiver,
223 cx
224 )?) {
225 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
226 None => std::task::Poll::Ready(None),
227 }
228 }
229}
230
231#[derive(Debug)]
232pub enum ControllerEvent {}
233
234impl ControllerEvent {
235 fn decode(
237 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
238 ) -> Result<ControllerEvent, fidl::Error> {
239 let (bytes, _handles) = buf.split_mut();
240 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
241 debug_assert_eq!(tx_header.tx_id, 0);
242 match tx_header.ordinal {
243 _ => Err(fidl::Error::UnknownOrdinal {
244 ordinal: tx_header.ordinal,
245 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
246 }),
247 }
248 }
249}
250
251pub struct ControllerRequestStream {
253 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
254 is_terminated: bool,
255}
256
257impl std::marker::Unpin for ControllerRequestStream {}
258
259impl futures::stream::FusedStream for ControllerRequestStream {
260 fn is_terminated(&self) -> bool {
261 self.is_terminated
262 }
263}
264
265impl fidl::endpoints::RequestStream for ControllerRequestStream {
266 type Protocol = ControllerMarker;
267 type ControlHandle = ControllerControlHandle;
268
269 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
270 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
271 }
272
273 fn control_handle(&self) -> Self::ControlHandle {
274 ControllerControlHandle { inner: self.inner.clone() }
275 }
276
277 fn into_inner(
278 self,
279 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
280 {
281 (self.inner, self.is_terminated)
282 }
283
284 fn from_inner(
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286 is_terminated: bool,
287 ) -> Self {
288 Self { inner, is_terminated }
289 }
290}
291
292impl futures::Stream for ControllerRequestStream {
293 type Item = Result<ControllerRequest, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 let this = &mut *self;
300 if this.inner.check_shutdown(cx) {
301 this.is_terminated = true;
302 return std::task::Poll::Ready(None);
303 }
304 if this.is_terminated {
305 panic!("polled ControllerRequestStream after completion");
306 }
307 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
308 |bytes, handles| {
309 match this.inner.channel().read_etc(cx, bytes, handles) {
310 std::task::Poll::Ready(Ok(())) => {}
311 std::task::Poll::Pending => return std::task::Poll::Pending,
312 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
313 this.is_terminated = true;
314 return std::task::Poll::Ready(None);
315 }
316 std::task::Poll::Ready(Err(e)) => {
317 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
318 e.into(),
319 ))))
320 }
321 }
322
323 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
325
326 std::task::Poll::Ready(Some(match header.ordinal {
327 0x404db87008999427 => {
328 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
329 let mut req = fidl::new_empty!(
330 ControllerOpenSessionRequest,
331 fidl::encoding::DefaultFuchsiaResourceDialect
332 );
333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
334 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
335 Ok(ControllerRequest::OpenSession { session: req.session, control_handle })
336 }
337 _ => Err(fidl::Error::UnknownOrdinal {
338 ordinal: header.ordinal,
339 protocol_name:
340 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
341 }),
342 }))
343 },
344 )
345 }
346}
347
348#[derive(Debug)]
349pub enum ControllerRequest {
350 OpenSession {
352 session: fidl::endpoints::ServerEnd<DeviceMarker>,
353 control_handle: ControllerControlHandle,
354 },
355}
356
357impl ControllerRequest {
358 #[allow(irrefutable_let_patterns)]
359 pub fn into_open_session(
360 self,
361 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, ControllerControlHandle)> {
362 if let ControllerRequest::OpenSession { session, control_handle } = self {
363 Some((session, control_handle))
364 } else {
365 None
366 }
367 }
368
369 pub fn method_name(&self) -> &'static str {
371 match *self {
372 ControllerRequest::OpenSession { .. } => "open_session",
373 }
374 }
375}
376
377#[derive(Debug, Clone)]
378pub struct ControllerControlHandle {
379 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
380}
381
382impl fidl::endpoints::ControlHandle for ControllerControlHandle {
383 fn shutdown(&self) {
384 self.inner.shutdown()
385 }
386 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
387 self.inner.shutdown_with_epitaph(status)
388 }
389
390 fn is_closed(&self) -> bool {
391 self.inner.channel().is_closed()
392 }
393 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
394 self.inner.channel().on_closed()
395 }
396
397 #[cfg(target_os = "fuchsia")]
398 fn signal_peer(
399 &self,
400 clear_mask: zx::Signals,
401 set_mask: zx::Signals,
402 ) -> Result<(), zx_status::Status> {
403 use fidl::Peered;
404 self.inner.channel().signal_peer(clear_mask, set_mask)
405 }
406}
407
408impl ControllerControlHandle {}
409
410#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
411pub struct DeviceMarker;
412
413impl fidl::endpoints::ProtocolMarker for DeviceMarker {
414 type Proxy = DeviceProxy;
415 type RequestStream = DeviceRequestStream;
416 #[cfg(target_os = "fuchsia")]
417 type SynchronousProxy = DeviceSynchronousProxy;
418
419 const DEBUG_NAME: &'static str = "(anonymous) Device";
420}
421pub type DeviceQueryResult = Result<fidl_fuchsia_hardware_hidbus::HidInfo, i32>;
422pub type DeviceGetDeviceReportsReaderResult = Result<(), i32>;
423pub type DeviceReadReportResult = Result<fidl_fuchsia_hardware_hidbus::Report, i32>;
424pub type DeviceReadReportsResult = Result<Vec<u8>, i32>;
425pub type DeviceGetReportsEventResult = Result<fidl::Event, i32>;
426pub type DeviceGetReportResult = Result<Vec<u8>, i32>;
427pub type DeviceSetReportResult = Result<(), i32>;
428
429pub trait DeviceProxyInterface: Send + Sync {
430 type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
431 + Send;
432 fn r#query(&self) -> Self::QueryResponseFut;
433 type GetReportDescResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
434 fn r#get_report_desc(&self) -> Self::GetReportDescResponseFut;
435 type GetDeviceReportsReaderResponseFut: std::future::Future<Output = Result<DeviceGetDeviceReportsReaderResult, fidl::Error>>
436 + Send;
437 fn r#get_device_reports_reader(
438 &self,
439 reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
440 ) -> Self::GetDeviceReportsReaderResponseFut;
441 type ReadReportResponseFut: std::future::Future<Output = Result<DeviceReadReportResult, fidl::Error>>
442 + Send;
443 fn r#read_report(&self) -> Self::ReadReportResponseFut;
444 type ReadReportsResponseFut: std::future::Future<Output = Result<DeviceReadReportsResult, fidl::Error>>
445 + Send;
446 fn r#read_reports(&self) -> Self::ReadReportsResponseFut;
447 type GetReportsEventResponseFut: std::future::Future<Output = Result<DeviceGetReportsEventResult, fidl::Error>>
448 + Send;
449 fn r#get_reports_event(&self) -> Self::GetReportsEventResponseFut;
450 type GetReportResponseFut: std::future::Future<Output = Result<DeviceGetReportResult, fidl::Error>>
451 + Send;
452 fn r#get_report(
453 &self,
454 type_: fidl_fuchsia_hardware_hidbus::ReportType,
455 id: u8,
456 ) -> Self::GetReportResponseFut;
457 type SetReportResponseFut: std::future::Future<Output = Result<DeviceSetReportResult, fidl::Error>>
458 + Send;
459 fn r#set_report(
460 &self,
461 type_: fidl_fuchsia_hardware_hidbus::ReportType,
462 id: u8,
463 report: &[u8],
464 ) -> Self::SetReportResponseFut;
465 fn r#set_trace_id(&self, id: u32) -> Result<(), fidl::Error>;
466}
467#[derive(Debug)]
468#[cfg(target_os = "fuchsia")]
469pub struct DeviceSynchronousProxy {
470 client: fidl::client::sync::Client,
471}
472
473#[cfg(target_os = "fuchsia")]
474impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
475 type Proxy = DeviceProxy;
476 type Protocol = DeviceMarker;
477
478 fn from_channel(inner: fidl::Channel) -> Self {
479 Self::new(inner)
480 }
481
482 fn into_channel(self) -> fidl::Channel {
483 self.client.into_channel()
484 }
485
486 fn as_channel(&self) -> &fidl::Channel {
487 self.client.as_channel()
488 }
489}
490
491#[cfg(target_os = "fuchsia")]
492impl DeviceSynchronousProxy {
493 pub fn new(channel: fidl::Channel) -> Self {
494 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
495 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
496 }
497
498 pub fn into_channel(self) -> fidl::Channel {
499 self.client.into_channel()
500 }
501
502 pub fn wait_for_event(
505 &self,
506 deadline: zx::MonotonicInstant,
507 ) -> Result<DeviceEvent, fidl::Error> {
508 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
509 }
510
511 pub fn r#query(
513 &self,
514 ___deadline: zx::MonotonicInstant,
515 ) -> Result<DeviceQueryResult, fidl::Error> {
516 let _response = self.client.send_query::<
517 fidl::encoding::EmptyPayload,
518 fidl::encoding::ResultType<DeviceQueryResponse, i32>,
519 >(
520 (),
521 0x6d1d90313259dae3,
522 fidl::encoding::DynamicFlags::empty(),
523 ___deadline,
524 )?;
525 Ok(_response.map(|x| x.info))
526 }
527
528 pub fn r#get_report_desc(
530 &self,
531 ___deadline: zx::MonotonicInstant,
532 ) -> Result<Vec<u8>, fidl::Error> {
533 let _response =
534 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetReportDescResponse>(
535 (),
536 0x7fe4aff57d9019f8,
537 fidl::encoding::DynamicFlags::empty(),
538 ___deadline,
539 )?;
540 Ok(_response.desc)
541 }
542
543 pub fn r#get_device_reports_reader(
546 &self,
547 mut reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
548 ___deadline: zx::MonotonicInstant,
549 ) -> Result<DeviceGetDeviceReportsReaderResult, fidl::Error> {
550 let _response = self.client.send_query::<
551 DeviceGetDeviceReportsReaderRequest,
552 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
553 >(
554 (reader,),
555 0x67aee4993bb823ee,
556 fidl::encoding::DynamicFlags::empty(),
557 ___deadline,
558 )?;
559 Ok(_response.map(|x| x))
560 }
561
562 pub fn r#read_report(
568 &self,
569 ___deadline: zx::MonotonicInstant,
570 ) -> Result<DeviceReadReportResult, fidl::Error> {
571 let _response = self.client.send_query::<
572 fidl::encoding::EmptyPayload,
573 fidl::encoding::ResultType<fidl_fuchsia_hardware_hidbus::Report, i32>,
574 >(
575 (),
576 0x69871e1e2b75e46f,
577 fidl::encoding::DynamicFlags::empty(),
578 ___deadline,
579 )?;
580 Ok(_response.map(|x| x))
581 }
582
583 pub fn r#read_reports(
591 &self,
592 ___deadline: zx::MonotonicInstant,
593 ) -> Result<DeviceReadReportsResult, fidl::Error> {
594 let _response = self.client.send_query::<
595 fidl::encoding::EmptyPayload,
596 fidl::encoding::ResultType<DeviceReadReportsResponse, i32>,
597 >(
598 (),
599 0x6e20cf64707a4ee4,
600 fidl::encoding::DynamicFlags::empty(),
601 ___deadline,
602 )?;
603 Ok(_response.map(|x| x.data))
604 }
605
606 pub fn r#get_reports_event(
611 &self,
612 ___deadline: zx::MonotonicInstant,
613 ) -> Result<DeviceGetReportsEventResult, fidl::Error> {
614 let _response = self.client.send_query::<
615 fidl::encoding::EmptyPayload,
616 fidl::encoding::ResultType<DeviceGetReportsEventResponse, i32>,
617 >(
618 (),
619 0x6198970f9308041c,
620 fidl::encoding::DynamicFlags::empty(),
621 ___deadline,
622 )?;
623 Ok(_response.map(|x| x.event))
624 }
625
626 pub fn r#get_report(
630 &self,
631 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
632 mut id: u8,
633 ___deadline: zx::MonotonicInstant,
634 ) -> Result<DeviceGetReportResult, fidl::Error> {
635 let _response = self.client.send_query::<
636 DeviceGetReportRequest,
637 fidl::encoding::ResultType<DeviceGetReportResponse, i32>,
638 >(
639 (type_, id,),
640 0x5b2a44555defd970,
641 fidl::encoding::DynamicFlags::empty(),
642 ___deadline,
643 )?;
644 Ok(_response.map(|x| x.report))
645 }
646
647 pub fn r#set_report(
649 &self,
650 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
651 mut id: u8,
652 mut report: &[u8],
653 ___deadline: zx::MonotonicInstant,
654 ) -> Result<DeviceSetReportResult, fidl::Error> {
655 let _response = self.client.send_query::<
656 DeviceSetReportRequest,
657 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
658 >(
659 (type_, id, report,),
660 0x51cc85eb4e769ee,
661 fidl::encoding::DynamicFlags::empty(),
662 ___deadline,
663 )?;
664 Ok(_response.map(|x| x))
665 }
666
667 pub fn r#set_trace_id(&self, mut id: u32) -> Result<(), fidl::Error> {
669 self.client.send::<DeviceSetTraceIdRequest>(
670 (id,),
671 0x7fe8815219c66700,
672 fidl::encoding::DynamicFlags::empty(),
673 )
674 }
675}
676
677#[cfg(target_os = "fuchsia")]
678impl From<DeviceSynchronousProxy> for zx::Handle {
679 fn from(value: DeviceSynchronousProxy) -> Self {
680 value.into_channel().into()
681 }
682}
683
684#[cfg(target_os = "fuchsia")]
685impl From<fidl::Channel> for DeviceSynchronousProxy {
686 fn from(value: fidl::Channel) -> Self {
687 Self::new(value)
688 }
689}
690
691#[derive(Debug, Clone)]
692pub struct DeviceProxy {
693 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
694}
695
696impl fidl::endpoints::Proxy for DeviceProxy {
697 type Protocol = DeviceMarker;
698
699 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
700 Self::new(inner)
701 }
702
703 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
704 self.client.into_channel().map_err(|client| Self { client })
705 }
706
707 fn as_channel(&self) -> &::fidl::AsyncChannel {
708 self.client.as_channel()
709 }
710}
711
712impl DeviceProxy {
713 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
715 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
716 Self { client: fidl::client::Client::new(channel, protocol_name) }
717 }
718
719 pub fn take_event_stream(&self) -> DeviceEventStream {
725 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
726 }
727
728 pub fn r#query(
730 &self,
731 ) -> fidl::client::QueryResponseFut<
732 DeviceQueryResult,
733 fidl::encoding::DefaultFuchsiaResourceDialect,
734 > {
735 DeviceProxyInterface::r#query(self)
736 }
737
738 pub fn r#get_report_desc(
740 &self,
741 ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
742 {
743 DeviceProxyInterface::r#get_report_desc(self)
744 }
745
746 pub fn r#get_device_reports_reader(
749 &self,
750 mut reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
751 ) -> fidl::client::QueryResponseFut<
752 DeviceGetDeviceReportsReaderResult,
753 fidl::encoding::DefaultFuchsiaResourceDialect,
754 > {
755 DeviceProxyInterface::r#get_device_reports_reader(self, reader)
756 }
757
758 pub fn r#read_report(
764 &self,
765 ) -> fidl::client::QueryResponseFut<
766 DeviceReadReportResult,
767 fidl::encoding::DefaultFuchsiaResourceDialect,
768 > {
769 DeviceProxyInterface::r#read_report(self)
770 }
771
772 pub fn r#read_reports(
780 &self,
781 ) -> fidl::client::QueryResponseFut<
782 DeviceReadReportsResult,
783 fidl::encoding::DefaultFuchsiaResourceDialect,
784 > {
785 DeviceProxyInterface::r#read_reports(self)
786 }
787
788 pub fn r#get_reports_event(
793 &self,
794 ) -> fidl::client::QueryResponseFut<
795 DeviceGetReportsEventResult,
796 fidl::encoding::DefaultFuchsiaResourceDialect,
797 > {
798 DeviceProxyInterface::r#get_reports_event(self)
799 }
800
801 pub fn r#get_report(
805 &self,
806 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
807 mut id: u8,
808 ) -> fidl::client::QueryResponseFut<
809 DeviceGetReportResult,
810 fidl::encoding::DefaultFuchsiaResourceDialect,
811 > {
812 DeviceProxyInterface::r#get_report(self, type_, id)
813 }
814
815 pub fn r#set_report(
817 &self,
818 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
819 mut id: u8,
820 mut report: &[u8],
821 ) -> fidl::client::QueryResponseFut<
822 DeviceSetReportResult,
823 fidl::encoding::DefaultFuchsiaResourceDialect,
824 > {
825 DeviceProxyInterface::r#set_report(self, type_, id, report)
826 }
827
828 pub fn r#set_trace_id(&self, mut id: u32) -> Result<(), fidl::Error> {
830 DeviceProxyInterface::r#set_trace_id(self, id)
831 }
832}
833
834impl DeviceProxyInterface for DeviceProxy {
835 type QueryResponseFut = fidl::client::QueryResponseFut<
836 DeviceQueryResult,
837 fidl::encoding::DefaultFuchsiaResourceDialect,
838 >;
839 fn r#query(&self) -> Self::QueryResponseFut {
840 fn _decode(
841 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
842 ) -> Result<DeviceQueryResult, fidl::Error> {
843 let _response = fidl::client::decode_transaction_body::<
844 fidl::encoding::ResultType<DeviceQueryResponse, i32>,
845 fidl::encoding::DefaultFuchsiaResourceDialect,
846 0x6d1d90313259dae3,
847 >(_buf?)?;
848 Ok(_response.map(|x| x.info))
849 }
850 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceQueryResult>(
851 (),
852 0x6d1d90313259dae3,
853 fidl::encoding::DynamicFlags::empty(),
854 _decode,
855 )
856 }
857
858 type GetReportDescResponseFut =
859 fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
860 fn r#get_report_desc(&self) -> Self::GetReportDescResponseFut {
861 fn _decode(
862 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
863 ) -> Result<Vec<u8>, fidl::Error> {
864 let _response = fidl::client::decode_transaction_body::<
865 DeviceGetReportDescResponse,
866 fidl::encoding::DefaultFuchsiaResourceDialect,
867 0x7fe4aff57d9019f8,
868 >(_buf?)?;
869 Ok(_response.desc)
870 }
871 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
872 (),
873 0x7fe4aff57d9019f8,
874 fidl::encoding::DynamicFlags::empty(),
875 _decode,
876 )
877 }
878
879 type GetDeviceReportsReaderResponseFut = fidl::client::QueryResponseFut<
880 DeviceGetDeviceReportsReaderResult,
881 fidl::encoding::DefaultFuchsiaResourceDialect,
882 >;
883 fn r#get_device_reports_reader(
884 &self,
885 mut reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
886 ) -> Self::GetDeviceReportsReaderResponseFut {
887 fn _decode(
888 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
889 ) -> Result<DeviceGetDeviceReportsReaderResult, fidl::Error> {
890 let _response = fidl::client::decode_transaction_body::<
891 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
892 fidl::encoding::DefaultFuchsiaResourceDialect,
893 0x67aee4993bb823ee,
894 >(_buf?)?;
895 Ok(_response.map(|x| x))
896 }
897 self.client.send_query_and_decode::<
898 DeviceGetDeviceReportsReaderRequest,
899 DeviceGetDeviceReportsReaderResult,
900 >(
901 (reader,),
902 0x67aee4993bb823ee,
903 fidl::encoding::DynamicFlags::empty(),
904 _decode,
905 )
906 }
907
908 type ReadReportResponseFut = fidl::client::QueryResponseFut<
909 DeviceReadReportResult,
910 fidl::encoding::DefaultFuchsiaResourceDialect,
911 >;
912 fn r#read_report(&self) -> Self::ReadReportResponseFut {
913 fn _decode(
914 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
915 ) -> Result<DeviceReadReportResult, fidl::Error> {
916 let _response = fidl::client::decode_transaction_body::<
917 fidl::encoding::ResultType<fidl_fuchsia_hardware_hidbus::Report, i32>,
918 fidl::encoding::DefaultFuchsiaResourceDialect,
919 0x69871e1e2b75e46f,
920 >(_buf?)?;
921 Ok(_response.map(|x| x))
922 }
923 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadReportResult>(
924 (),
925 0x69871e1e2b75e46f,
926 fidl::encoding::DynamicFlags::empty(),
927 _decode,
928 )
929 }
930
931 type ReadReportsResponseFut = fidl::client::QueryResponseFut<
932 DeviceReadReportsResult,
933 fidl::encoding::DefaultFuchsiaResourceDialect,
934 >;
935 fn r#read_reports(&self) -> Self::ReadReportsResponseFut {
936 fn _decode(
937 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
938 ) -> Result<DeviceReadReportsResult, fidl::Error> {
939 let _response = fidl::client::decode_transaction_body::<
940 fidl::encoding::ResultType<DeviceReadReportsResponse, i32>,
941 fidl::encoding::DefaultFuchsiaResourceDialect,
942 0x6e20cf64707a4ee4,
943 >(_buf?)?;
944 Ok(_response.map(|x| x.data))
945 }
946 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadReportsResult>(
947 (),
948 0x6e20cf64707a4ee4,
949 fidl::encoding::DynamicFlags::empty(),
950 _decode,
951 )
952 }
953
954 type GetReportsEventResponseFut = fidl::client::QueryResponseFut<
955 DeviceGetReportsEventResult,
956 fidl::encoding::DefaultFuchsiaResourceDialect,
957 >;
958 fn r#get_reports_event(&self) -> Self::GetReportsEventResponseFut {
959 fn _decode(
960 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
961 ) -> Result<DeviceGetReportsEventResult, fidl::Error> {
962 let _response = fidl::client::decode_transaction_body::<
963 fidl::encoding::ResultType<DeviceGetReportsEventResponse, i32>,
964 fidl::encoding::DefaultFuchsiaResourceDialect,
965 0x6198970f9308041c,
966 >(_buf?)?;
967 Ok(_response.map(|x| x.event))
968 }
969 self.client
970 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetReportsEventResult>(
971 (),
972 0x6198970f9308041c,
973 fidl::encoding::DynamicFlags::empty(),
974 _decode,
975 )
976 }
977
978 type GetReportResponseFut = fidl::client::QueryResponseFut<
979 DeviceGetReportResult,
980 fidl::encoding::DefaultFuchsiaResourceDialect,
981 >;
982 fn r#get_report(
983 &self,
984 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
985 mut id: u8,
986 ) -> Self::GetReportResponseFut {
987 fn _decode(
988 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
989 ) -> Result<DeviceGetReportResult, fidl::Error> {
990 let _response = fidl::client::decode_transaction_body::<
991 fidl::encoding::ResultType<DeviceGetReportResponse, i32>,
992 fidl::encoding::DefaultFuchsiaResourceDialect,
993 0x5b2a44555defd970,
994 >(_buf?)?;
995 Ok(_response.map(|x| x.report))
996 }
997 self.client.send_query_and_decode::<DeviceGetReportRequest, DeviceGetReportResult>(
998 (type_, id),
999 0x5b2a44555defd970,
1000 fidl::encoding::DynamicFlags::empty(),
1001 _decode,
1002 )
1003 }
1004
1005 type SetReportResponseFut = fidl::client::QueryResponseFut<
1006 DeviceSetReportResult,
1007 fidl::encoding::DefaultFuchsiaResourceDialect,
1008 >;
1009 fn r#set_report(
1010 &self,
1011 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
1012 mut id: u8,
1013 mut report: &[u8],
1014 ) -> Self::SetReportResponseFut {
1015 fn _decode(
1016 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1017 ) -> Result<DeviceSetReportResult, fidl::Error> {
1018 let _response = fidl::client::decode_transaction_body::<
1019 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1020 fidl::encoding::DefaultFuchsiaResourceDialect,
1021 0x51cc85eb4e769ee,
1022 >(_buf?)?;
1023 Ok(_response.map(|x| x))
1024 }
1025 self.client.send_query_and_decode::<DeviceSetReportRequest, DeviceSetReportResult>(
1026 (type_, id, report),
1027 0x51cc85eb4e769ee,
1028 fidl::encoding::DynamicFlags::empty(),
1029 _decode,
1030 )
1031 }
1032
1033 fn r#set_trace_id(&self, mut id: u32) -> Result<(), fidl::Error> {
1034 self.client.send::<DeviceSetTraceIdRequest>(
1035 (id,),
1036 0x7fe8815219c66700,
1037 fidl::encoding::DynamicFlags::empty(),
1038 )
1039 }
1040}
1041
1042pub struct DeviceEventStream {
1043 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1044}
1045
1046impl std::marker::Unpin for DeviceEventStream {}
1047
1048impl futures::stream::FusedStream for DeviceEventStream {
1049 fn is_terminated(&self) -> bool {
1050 self.event_receiver.is_terminated()
1051 }
1052}
1053
1054impl futures::Stream for DeviceEventStream {
1055 type Item = Result<DeviceEvent, fidl::Error>;
1056
1057 fn poll_next(
1058 mut self: std::pin::Pin<&mut Self>,
1059 cx: &mut std::task::Context<'_>,
1060 ) -> std::task::Poll<Option<Self::Item>> {
1061 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1062 &mut self.event_receiver,
1063 cx
1064 )?) {
1065 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1066 None => std::task::Poll::Ready(None),
1067 }
1068 }
1069}
1070
1071#[derive(Debug)]
1072pub enum DeviceEvent {}
1073
1074impl DeviceEvent {
1075 fn decode(
1077 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1078 ) -> Result<DeviceEvent, fidl::Error> {
1079 let (bytes, _handles) = buf.split_mut();
1080 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1081 debug_assert_eq!(tx_header.tx_id, 0);
1082 match tx_header.ordinal {
1083 _ => Err(fidl::Error::UnknownOrdinal {
1084 ordinal: tx_header.ordinal,
1085 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1086 }),
1087 }
1088 }
1089}
1090
1091pub struct DeviceRequestStream {
1093 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1094 is_terminated: bool,
1095}
1096
1097impl std::marker::Unpin for DeviceRequestStream {}
1098
1099impl futures::stream::FusedStream for DeviceRequestStream {
1100 fn is_terminated(&self) -> bool {
1101 self.is_terminated
1102 }
1103}
1104
1105impl fidl::endpoints::RequestStream for DeviceRequestStream {
1106 type Protocol = DeviceMarker;
1107 type ControlHandle = DeviceControlHandle;
1108
1109 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1110 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1111 }
1112
1113 fn control_handle(&self) -> Self::ControlHandle {
1114 DeviceControlHandle { inner: self.inner.clone() }
1115 }
1116
1117 fn into_inner(
1118 self,
1119 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1120 {
1121 (self.inner, self.is_terminated)
1122 }
1123
1124 fn from_inner(
1125 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1126 is_terminated: bool,
1127 ) -> Self {
1128 Self { inner, is_terminated }
1129 }
1130}
1131
1132impl futures::Stream for DeviceRequestStream {
1133 type Item = Result<DeviceRequest, fidl::Error>;
1134
1135 fn poll_next(
1136 mut self: std::pin::Pin<&mut Self>,
1137 cx: &mut std::task::Context<'_>,
1138 ) -> std::task::Poll<Option<Self::Item>> {
1139 let this = &mut *self;
1140 if this.inner.check_shutdown(cx) {
1141 this.is_terminated = true;
1142 return std::task::Poll::Ready(None);
1143 }
1144 if this.is_terminated {
1145 panic!("polled DeviceRequestStream after completion");
1146 }
1147 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1148 |bytes, handles| {
1149 match this.inner.channel().read_etc(cx, bytes, handles) {
1150 std::task::Poll::Ready(Ok(())) => {}
1151 std::task::Poll::Pending => return std::task::Poll::Pending,
1152 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1153 this.is_terminated = true;
1154 return std::task::Poll::Ready(None);
1155 }
1156 std::task::Poll::Ready(Err(e)) => {
1157 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1158 e.into(),
1159 ))))
1160 }
1161 }
1162
1163 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1165
1166 std::task::Poll::Ready(Some(match header.ordinal {
1167 0x6d1d90313259dae3 => {
1168 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1169 let mut req = fidl::new_empty!(
1170 fidl::encoding::EmptyPayload,
1171 fidl::encoding::DefaultFuchsiaResourceDialect
1172 );
1173 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1174 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1175 Ok(DeviceRequest::Query {
1176 responder: DeviceQueryResponder {
1177 control_handle: std::mem::ManuallyDrop::new(control_handle),
1178 tx_id: header.tx_id,
1179 },
1180 })
1181 }
1182 0x7fe4aff57d9019f8 => {
1183 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1184 let mut req = fidl::new_empty!(
1185 fidl::encoding::EmptyPayload,
1186 fidl::encoding::DefaultFuchsiaResourceDialect
1187 );
1188 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1189 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1190 Ok(DeviceRequest::GetReportDesc {
1191 responder: DeviceGetReportDescResponder {
1192 control_handle: std::mem::ManuallyDrop::new(control_handle),
1193 tx_id: header.tx_id,
1194 },
1195 })
1196 }
1197 0x67aee4993bb823ee => {
1198 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1199 let mut req = fidl::new_empty!(
1200 DeviceGetDeviceReportsReaderRequest,
1201 fidl::encoding::DefaultFuchsiaResourceDialect
1202 );
1203 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetDeviceReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
1204 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1205 Ok(DeviceRequest::GetDeviceReportsReader {
1206 reader: req.reader,
1207
1208 responder: DeviceGetDeviceReportsReaderResponder {
1209 control_handle: std::mem::ManuallyDrop::new(control_handle),
1210 tx_id: header.tx_id,
1211 },
1212 })
1213 }
1214 0x69871e1e2b75e46f => {
1215 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1216 let mut req = fidl::new_empty!(
1217 fidl::encoding::EmptyPayload,
1218 fidl::encoding::DefaultFuchsiaResourceDialect
1219 );
1220 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1221 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1222 Ok(DeviceRequest::ReadReport {
1223 responder: DeviceReadReportResponder {
1224 control_handle: std::mem::ManuallyDrop::new(control_handle),
1225 tx_id: header.tx_id,
1226 },
1227 })
1228 }
1229 0x6e20cf64707a4ee4 => {
1230 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1231 let mut req = fidl::new_empty!(
1232 fidl::encoding::EmptyPayload,
1233 fidl::encoding::DefaultFuchsiaResourceDialect
1234 );
1235 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1236 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1237 Ok(DeviceRequest::ReadReports {
1238 responder: DeviceReadReportsResponder {
1239 control_handle: std::mem::ManuallyDrop::new(control_handle),
1240 tx_id: header.tx_id,
1241 },
1242 })
1243 }
1244 0x6198970f9308041c => {
1245 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1246 let mut req = fidl::new_empty!(
1247 fidl::encoding::EmptyPayload,
1248 fidl::encoding::DefaultFuchsiaResourceDialect
1249 );
1250 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1251 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1252 Ok(DeviceRequest::GetReportsEvent {
1253 responder: DeviceGetReportsEventResponder {
1254 control_handle: std::mem::ManuallyDrop::new(control_handle),
1255 tx_id: header.tx_id,
1256 },
1257 })
1258 }
1259 0x5b2a44555defd970 => {
1260 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1261 let mut req = fidl::new_empty!(
1262 DeviceGetReportRequest,
1263 fidl::encoding::DefaultFuchsiaResourceDialect
1264 );
1265 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1266 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1267 Ok(DeviceRequest::GetReport {
1268 type_: req.type_,
1269 id: req.id,
1270
1271 responder: DeviceGetReportResponder {
1272 control_handle: std::mem::ManuallyDrop::new(control_handle),
1273 tx_id: header.tx_id,
1274 },
1275 })
1276 }
1277 0x51cc85eb4e769ee => {
1278 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1279 let mut req = fidl::new_empty!(
1280 DeviceSetReportRequest,
1281 fidl::encoding::DefaultFuchsiaResourceDialect
1282 );
1283 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1284 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1285 Ok(DeviceRequest::SetReport {
1286 type_: req.type_,
1287 id: req.id,
1288 report: req.report,
1289
1290 responder: DeviceSetReportResponder {
1291 control_handle: std::mem::ManuallyDrop::new(control_handle),
1292 tx_id: header.tx_id,
1293 },
1294 })
1295 }
1296 0x7fe8815219c66700 => {
1297 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1298 let mut req = fidl::new_empty!(
1299 DeviceSetTraceIdRequest,
1300 fidl::encoding::DefaultFuchsiaResourceDialect
1301 );
1302 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetTraceIdRequest>(&header, _body_bytes, handles, &mut req)?;
1303 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1304 Ok(DeviceRequest::SetTraceId { id: req.id, control_handle })
1305 }
1306 _ => Err(fidl::Error::UnknownOrdinal {
1307 ordinal: header.ordinal,
1308 protocol_name:
1309 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1310 }),
1311 }))
1312 },
1313 )
1314 }
1315}
1316
1317#[derive(Debug)]
1318pub enum DeviceRequest {
1319 Query { responder: DeviceQueryResponder },
1321 GetReportDesc { responder: DeviceGetReportDescResponder },
1323 GetDeviceReportsReader {
1326 reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
1327 responder: DeviceGetDeviceReportsReaderResponder,
1328 },
1329 ReadReport { responder: DeviceReadReportResponder },
1335 ReadReports { responder: DeviceReadReportsResponder },
1343 GetReportsEvent { responder: DeviceGetReportsEventResponder },
1348 GetReport {
1352 type_: fidl_fuchsia_hardware_hidbus::ReportType,
1353 id: u8,
1354 responder: DeviceGetReportResponder,
1355 },
1356 SetReport {
1358 type_: fidl_fuchsia_hardware_hidbus::ReportType,
1359 id: u8,
1360 report: Vec<u8>,
1361 responder: DeviceSetReportResponder,
1362 },
1363 SetTraceId { id: u32, control_handle: DeviceControlHandle },
1365}
1366
1367impl DeviceRequest {
1368 #[allow(irrefutable_let_patterns)]
1369 pub fn into_query(self) -> Option<(DeviceQueryResponder)> {
1370 if let DeviceRequest::Query { responder } = self {
1371 Some((responder))
1372 } else {
1373 None
1374 }
1375 }
1376
1377 #[allow(irrefutable_let_patterns)]
1378 pub fn into_get_report_desc(self) -> Option<(DeviceGetReportDescResponder)> {
1379 if let DeviceRequest::GetReportDesc { responder } = self {
1380 Some((responder))
1381 } else {
1382 None
1383 }
1384 }
1385
1386 #[allow(irrefutable_let_patterns)]
1387 pub fn into_get_device_reports_reader(
1388 self,
1389 ) -> Option<(
1390 fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
1391 DeviceGetDeviceReportsReaderResponder,
1392 )> {
1393 if let DeviceRequest::GetDeviceReportsReader { reader, responder } = self {
1394 Some((reader, responder))
1395 } else {
1396 None
1397 }
1398 }
1399
1400 #[allow(irrefutable_let_patterns)]
1401 pub fn into_read_report(self) -> Option<(DeviceReadReportResponder)> {
1402 if let DeviceRequest::ReadReport { responder } = self {
1403 Some((responder))
1404 } else {
1405 None
1406 }
1407 }
1408
1409 #[allow(irrefutable_let_patterns)]
1410 pub fn into_read_reports(self) -> Option<(DeviceReadReportsResponder)> {
1411 if let DeviceRequest::ReadReports { responder } = self {
1412 Some((responder))
1413 } else {
1414 None
1415 }
1416 }
1417
1418 #[allow(irrefutable_let_patterns)]
1419 pub fn into_get_reports_event(self) -> Option<(DeviceGetReportsEventResponder)> {
1420 if let DeviceRequest::GetReportsEvent { responder } = self {
1421 Some((responder))
1422 } else {
1423 None
1424 }
1425 }
1426
1427 #[allow(irrefutable_let_patterns)]
1428 pub fn into_get_report(
1429 self,
1430 ) -> Option<(fidl_fuchsia_hardware_hidbus::ReportType, u8, DeviceGetReportResponder)> {
1431 if let DeviceRequest::GetReport { type_, id, responder } = self {
1432 Some((type_, id, responder))
1433 } else {
1434 None
1435 }
1436 }
1437
1438 #[allow(irrefutable_let_patterns)]
1439 pub fn into_set_report(
1440 self,
1441 ) -> Option<(fidl_fuchsia_hardware_hidbus::ReportType, u8, Vec<u8>, DeviceSetReportResponder)>
1442 {
1443 if let DeviceRequest::SetReport { type_, id, report, responder } = self {
1444 Some((type_, id, report, responder))
1445 } else {
1446 None
1447 }
1448 }
1449
1450 #[allow(irrefutable_let_patterns)]
1451 pub fn into_set_trace_id(self) -> Option<(u32, DeviceControlHandle)> {
1452 if let DeviceRequest::SetTraceId { id, control_handle } = self {
1453 Some((id, control_handle))
1454 } else {
1455 None
1456 }
1457 }
1458
1459 pub fn method_name(&self) -> &'static str {
1461 match *self {
1462 DeviceRequest::Query { .. } => "query",
1463 DeviceRequest::GetReportDesc { .. } => "get_report_desc",
1464 DeviceRequest::GetDeviceReportsReader { .. } => "get_device_reports_reader",
1465 DeviceRequest::ReadReport { .. } => "read_report",
1466 DeviceRequest::ReadReports { .. } => "read_reports",
1467 DeviceRequest::GetReportsEvent { .. } => "get_reports_event",
1468 DeviceRequest::GetReport { .. } => "get_report",
1469 DeviceRequest::SetReport { .. } => "set_report",
1470 DeviceRequest::SetTraceId { .. } => "set_trace_id",
1471 }
1472 }
1473}
1474
1475#[derive(Debug, Clone)]
1476pub struct DeviceControlHandle {
1477 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1478}
1479
1480impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1481 fn shutdown(&self) {
1482 self.inner.shutdown()
1483 }
1484 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1485 self.inner.shutdown_with_epitaph(status)
1486 }
1487
1488 fn is_closed(&self) -> bool {
1489 self.inner.channel().is_closed()
1490 }
1491 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1492 self.inner.channel().on_closed()
1493 }
1494
1495 #[cfg(target_os = "fuchsia")]
1496 fn signal_peer(
1497 &self,
1498 clear_mask: zx::Signals,
1499 set_mask: zx::Signals,
1500 ) -> Result<(), zx_status::Status> {
1501 use fidl::Peered;
1502 self.inner.channel().signal_peer(clear_mask, set_mask)
1503 }
1504}
1505
1506impl DeviceControlHandle {}
1507
1508#[must_use = "FIDL methods require a response to be sent"]
1509#[derive(Debug)]
1510pub struct DeviceQueryResponder {
1511 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1512 tx_id: u32,
1513}
1514
1515impl std::ops::Drop for DeviceQueryResponder {
1519 fn drop(&mut self) {
1520 self.control_handle.shutdown();
1521 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1523 }
1524}
1525
1526impl fidl::endpoints::Responder for DeviceQueryResponder {
1527 type ControlHandle = DeviceControlHandle;
1528
1529 fn control_handle(&self) -> &DeviceControlHandle {
1530 &self.control_handle
1531 }
1532
1533 fn drop_without_shutdown(mut self) {
1534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1536 std::mem::forget(self);
1538 }
1539}
1540
1541impl DeviceQueryResponder {
1542 pub fn send(
1546 self,
1547 mut result: Result<&fidl_fuchsia_hardware_hidbus::HidInfo, i32>,
1548 ) -> Result<(), fidl::Error> {
1549 let _result = self.send_raw(result);
1550 if _result.is_err() {
1551 self.control_handle.shutdown();
1552 }
1553 self.drop_without_shutdown();
1554 _result
1555 }
1556
1557 pub fn send_no_shutdown_on_err(
1559 self,
1560 mut result: Result<&fidl_fuchsia_hardware_hidbus::HidInfo, i32>,
1561 ) -> Result<(), fidl::Error> {
1562 let _result = self.send_raw(result);
1563 self.drop_without_shutdown();
1564 _result
1565 }
1566
1567 fn send_raw(
1568 &self,
1569 mut result: Result<&fidl_fuchsia_hardware_hidbus::HidInfo, i32>,
1570 ) -> Result<(), fidl::Error> {
1571 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
1572 result.map(|info| (info,)),
1573 self.tx_id,
1574 0x6d1d90313259dae3,
1575 fidl::encoding::DynamicFlags::empty(),
1576 )
1577 }
1578}
1579
1580#[must_use = "FIDL methods require a response to be sent"]
1581#[derive(Debug)]
1582pub struct DeviceGetReportDescResponder {
1583 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1584 tx_id: u32,
1585}
1586
1587impl std::ops::Drop for DeviceGetReportDescResponder {
1591 fn drop(&mut self) {
1592 self.control_handle.shutdown();
1593 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1595 }
1596}
1597
1598impl fidl::endpoints::Responder for DeviceGetReportDescResponder {
1599 type ControlHandle = DeviceControlHandle;
1600
1601 fn control_handle(&self) -> &DeviceControlHandle {
1602 &self.control_handle
1603 }
1604
1605 fn drop_without_shutdown(mut self) {
1606 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1608 std::mem::forget(self);
1610 }
1611}
1612
1613impl DeviceGetReportDescResponder {
1614 pub fn send(self, mut desc: &[u8]) -> Result<(), fidl::Error> {
1618 let _result = self.send_raw(desc);
1619 if _result.is_err() {
1620 self.control_handle.shutdown();
1621 }
1622 self.drop_without_shutdown();
1623 _result
1624 }
1625
1626 pub fn send_no_shutdown_on_err(self, mut desc: &[u8]) -> Result<(), fidl::Error> {
1628 let _result = self.send_raw(desc);
1629 self.drop_without_shutdown();
1630 _result
1631 }
1632
1633 fn send_raw(&self, mut desc: &[u8]) -> Result<(), fidl::Error> {
1634 self.control_handle.inner.send::<DeviceGetReportDescResponse>(
1635 (desc,),
1636 self.tx_id,
1637 0x7fe4aff57d9019f8,
1638 fidl::encoding::DynamicFlags::empty(),
1639 )
1640 }
1641}
1642
1643#[must_use = "FIDL methods require a response to be sent"]
1644#[derive(Debug)]
1645pub struct DeviceGetDeviceReportsReaderResponder {
1646 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1647 tx_id: u32,
1648}
1649
1650impl std::ops::Drop for DeviceGetDeviceReportsReaderResponder {
1654 fn drop(&mut self) {
1655 self.control_handle.shutdown();
1656 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1658 }
1659}
1660
1661impl fidl::endpoints::Responder for DeviceGetDeviceReportsReaderResponder {
1662 type ControlHandle = DeviceControlHandle;
1663
1664 fn control_handle(&self) -> &DeviceControlHandle {
1665 &self.control_handle
1666 }
1667
1668 fn drop_without_shutdown(mut self) {
1669 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1671 std::mem::forget(self);
1673 }
1674}
1675
1676impl DeviceGetDeviceReportsReaderResponder {
1677 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1681 let _result = self.send_raw(result);
1682 if _result.is_err() {
1683 self.control_handle.shutdown();
1684 }
1685 self.drop_without_shutdown();
1686 _result
1687 }
1688
1689 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1691 let _result = self.send_raw(result);
1692 self.drop_without_shutdown();
1693 _result
1694 }
1695
1696 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1697 self.control_handle
1698 .inner
1699 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1700 result,
1701 self.tx_id,
1702 0x67aee4993bb823ee,
1703 fidl::encoding::DynamicFlags::empty(),
1704 )
1705 }
1706}
1707
1708#[must_use = "FIDL methods require a response to be sent"]
1709#[derive(Debug)]
1710pub struct DeviceReadReportResponder {
1711 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1712 tx_id: u32,
1713}
1714
1715impl std::ops::Drop for DeviceReadReportResponder {
1719 fn drop(&mut self) {
1720 self.control_handle.shutdown();
1721 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1723 }
1724}
1725
1726impl fidl::endpoints::Responder for DeviceReadReportResponder {
1727 type ControlHandle = DeviceControlHandle;
1728
1729 fn control_handle(&self) -> &DeviceControlHandle {
1730 &self.control_handle
1731 }
1732
1733 fn drop_without_shutdown(mut self) {
1734 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1736 std::mem::forget(self);
1738 }
1739}
1740
1741impl DeviceReadReportResponder {
1742 pub fn send(
1746 self,
1747 mut result: Result<fidl_fuchsia_hardware_hidbus::Report, i32>,
1748 ) -> Result<(), fidl::Error> {
1749 let _result = self.send_raw(result);
1750 if _result.is_err() {
1751 self.control_handle.shutdown();
1752 }
1753 self.drop_without_shutdown();
1754 _result
1755 }
1756
1757 pub fn send_no_shutdown_on_err(
1759 self,
1760 mut result: Result<fidl_fuchsia_hardware_hidbus::Report, i32>,
1761 ) -> Result<(), fidl::Error> {
1762 let _result = self.send_raw(result);
1763 self.drop_without_shutdown();
1764 _result
1765 }
1766
1767 fn send_raw(
1768 &self,
1769 mut result: Result<fidl_fuchsia_hardware_hidbus::Report, i32>,
1770 ) -> Result<(), fidl::Error> {
1771 self.control_handle.inner.send::<fidl::encoding::ResultType<
1772 fidl_fuchsia_hardware_hidbus::Report,
1773 i32,
1774 >>(
1775 result.as_mut().map_err(|e| *e),
1776 self.tx_id,
1777 0x69871e1e2b75e46f,
1778 fidl::encoding::DynamicFlags::empty(),
1779 )
1780 }
1781}
1782
1783#[must_use = "FIDL methods require a response to be sent"]
1784#[derive(Debug)]
1785pub struct DeviceReadReportsResponder {
1786 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1787 tx_id: u32,
1788}
1789
1790impl std::ops::Drop for DeviceReadReportsResponder {
1794 fn drop(&mut self) {
1795 self.control_handle.shutdown();
1796 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1798 }
1799}
1800
1801impl fidl::endpoints::Responder for DeviceReadReportsResponder {
1802 type ControlHandle = DeviceControlHandle;
1803
1804 fn control_handle(&self) -> &DeviceControlHandle {
1805 &self.control_handle
1806 }
1807
1808 fn drop_without_shutdown(mut self) {
1809 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1811 std::mem::forget(self);
1813 }
1814}
1815
1816impl DeviceReadReportsResponder {
1817 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1821 let _result = self.send_raw(result);
1822 if _result.is_err() {
1823 self.control_handle.shutdown();
1824 }
1825 self.drop_without_shutdown();
1826 _result
1827 }
1828
1829 pub fn send_no_shutdown_on_err(
1831 self,
1832 mut result: Result<&[u8], i32>,
1833 ) -> Result<(), fidl::Error> {
1834 let _result = self.send_raw(result);
1835 self.drop_without_shutdown();
1836 _result
1837 }
1838
1839 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1840 self.control_handle
1841 .inner
1842 .send::<fidl::encoding::ResultType<DeviceReadReportsResponse, i32>>(
1843 result.map(|data| (data,)),
1844 self.tx_id,
1845 0x6e20cf64707a4ee4,
1846 fidl::encoding::DynamicFlags::empty(),
1847 )
1848 }
1849}
1850
1851#[must_use = "FIDL methods require a response to be sent"]
1852#[derive(Debug)]
1853pub struct DeviceGetReportsEventResponder {
1854 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1855 tx_id: u32,
1856}
1857
1858impl std::ops::Drop for DeviceGetReportsEventResponder {
1862 fn drop(&mut self) {
1863 self.control_handle.shutdown();
1864 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866 }
1867}
1868
1869impl fidl::endpoints::Responder for DeviceGetReportsEventResponder {
1870 type ControlHandle = DeviceControlHandle;
1871
1872 fn control_handle(&self) -> &DeviceControlHandle {
1873 &self.control_handle
1874 }
1875
1876 fn drop_without_shutdown(mut self) {
1877 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1879 std::mem::forget(self);
1881 }
1882}
1883
1884impl DeviceGetReportsEventResponder {
1885 pub fn send(self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
1889 let _result = self.send_raw(result);
1890 if _result.is_err() {
1891 self.control_handle.shutdown();
1892 }
1893 self.drop_without_shutdown();
1894 _result
1895 }
1896
1897 pub fn send_no_shutdown_on_err(
1899 self,
1900 mut result: Result<fidl::Event, i32>,
1901 ) -> Result<(), fidl::Error> {
1902 let _result = self.send_raw(result);
1903 self.drop_without_shutdown();
1904 _result
1905 }
1906
1907 fn send_raw(&self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
1908 self.control_handle
1909 .inner
1910 .send::<fidl::encoding::ResultType<DeviceGetReportsEventResponse, i32>>(
1911 result.map(|event| (event,)),
1912 self.tx_id,
1913 0x6198970f9308041c,
1914 fidl::encoding::DynamicFlags::empty(),
1915 )
1916 }
1917}
1918
1919#[must_use = "FIDL methods require a response to be sent"]
1920#[derive(Debug)]
1921pub struct DeviceGetReportResponder {
1922 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1923 tx_id: u32,
1924}
1925
1926impl std::ops::Drop for DeviceGetReportResponder {
1930 fn drop(&mut self) {
1931 self.control_handle.shutdown();
1932 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1934 }
1935}
1936
1937impl fidl::endpoints::Responder for DeviceGetReportResponder {
1938 type ControlHandle = DeviceControlHandle;
1939
1940 fn control_handle(&self) -> &DeviceControlHandle {
1941 &self.control_handle
1942 }
1943
1944 fn drop_without_shutdown(mut self) {
1945 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1947 std::mem::forget(self);
1949 }
1950}
1951
1952impl DeviceGetReportResponder {
1953 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1957 let _result = self.send_raw(result);
1958 if _result.is_err() {
1959 self.control_handle.shutdown();
1960 }
1961 self.drop_without_shutdown();
1962 _result
1963 }
1964
1965 pub fn send_no_shutdown_on_err(
1967 self,
1968 mut result: Result<&[u8], i32>,
1969 ) -> Result<(), fidl::Error> {
1970 let _result = self.send_raw(result);
1971 self.drop_without_shutdown();
1972 _result
1973 }
1974
1975 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1976 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetReportResponse, i32>>(
1977 result.map(|report| (report,)),
1978 self.tx_id,
1979 0x5b2a44555defd970,
1980 fidl::encoding::DynamicFlags::empty(),
1981 )
1982 }
1983}
1984
1985#[must_use = "FIDL methods require a response to be sent"]
1986#[derive(Debug)]
1987pub struct DeviceSetReportResponder {
1988 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1989 tx_id: u32,
1990}
1991
1992impl std::ops::Drop for DeviceSetReportResponder {
1996 fn drop(&mut self) {
1997 self.control_handle.shutdown();
1998 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2000 }
2001}
2002
2003impl fidl::endpoints::Responder for DeviceSetReportResponder {
2004 type ControlHandle = DeviceControlHandle;
2005
2006 fn control_handle(&self) -> &DeviceControlHandle {
2007 &self.control_handle
2008 }
2009
2010 fn drop_without_shutdown(mut self) {
2011 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2013 std::mem::forget(self);
2015 }
2016}
2017
2018impl DeviceSetReportResponder {
2019 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2023 let _result = self.send_raw(result);
2024 if _result.is_err() {
2025 self.control_handle.shutdown();
2026 }
2027 self.drop_without_shutdown();
2028 _result
2029 }
2030
2031 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2033 let _result = self.send_raw(result);
2034 self.drop_without_shutdown();
2035 _result
2036 }
2037
2038 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2039 self.control_handle
2040 .inner
2041 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2042 result,
2043 self.tx_id,
2044 0x51cc85eb4e769ee,
2045 fidl::encoding::DynamicFlags::empty(),
2046 )
2047 }
2048}
2049
2050#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2051pub struct DeviceReportsReaderMarker;
2052
2053impl fidl::endpoints::ProtocolMarker for DeviceReportsReaderMarker {
2054 type Proxy = DeviceReportsReaderProxy;
2055 type RequestStream = DeviceReportsReaderRequestStream;
2056 #[cfg(target_os = "fuchsia")]
2057 type SynchronousProxy = DeviceReportsReaderSynchronousProxy;
2058
2059 const DEBUG_NAME: &'static str = "(anonymous) DeviceReportsReader";
2060}
2061pub type DeviceReportsReaderReadReportsResult =
2062 Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>;
2063
2064pub trait DeviceReportsReaderProxyInterface: Send + Sync {
2065 type ReadReportsResponseFut: std::future::Future<Output = Result<DeviceReportsReaderReadReportsResult, fidl::Error>>
2066 + Send;
2067 fn r#read_reports(&self) -> Self::ReadReportsResponseFut;
2068}
2069#[derive(Debug)]
2070#[cfg(target_os = "fuchsia")]
2071pub struct DeviceReportsReaderSynchronousProxy {
2072 client: fidl::client::sync::Client,
2073}
2074
2075#[cfg(target_os = "fuchsia")]
2076impl fidl::endpoints::SynchronousProxy for DeviceReportsReaderSynchronousProxy {
2077 type Proxy = DeviceReportsReaderProxy;
2078 type Protocol = DeviceReportsReaderMarker;
2079
2080 fn from_channel(inner: fidl::Channel) -> Self {
2081 Self::new(inner)
2082 }
2083
2084 fn into_channel(self) -> fidl::Channel {
2085 self.client.into_channel()
2086 }
2087
2088 fn as_channel(&self) -> &fidl::Channel {
2089 self.client.as_channel()
2090 }
2091}
2092
2093#[cfg(target_os = "fuchsia")]
2094impl DeviceReportsReaderSynchronousProxy {
2095 pub fn new(channel: fidl::Channel) -> Self {
2096 let protocol_name =
2097 <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2098 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2099 }
2100
2101 pub fn into_channel(self) -> fidl::Channel {
2102 self.client.into_channel()
2103 }
2104
2105 pub fn wait_for_event(
2108 &self,
2109 deadline: zx::MonotonicInstant,
2110 ) -> Result<DeviceReportsReaderEvent, fidl::Error> {
2111 DeviceReportsReaderEvent::decode(self.client.wait_for_event(deadline)?)
2112 }
2113
2114 pub fn r#read_reports(
2119 &self,
2120 ___deadline: zx::MonotonicInstant,
2121 ) -> Result<DeviceReportsReaderReadReportsResult, fidl::Error> {
2122 let _response = self.client.send_query::<
2123 fidl::encoding::EmptyPayload,
2124 fidl::encoding::ResultType<DeviceReportsReaderReadReportsResponse, i32>,
2125 >(
2126 (),
2127 0x36077c1b177d4291,
2128 fidl::encoding::DynamicFlags::empty(),
2129 ___deadline,
2130 )?;
2131 Ok(_response.map(|x| x.reports))
2132 }
2133}
2134
2135#[cfg(target_os = "fuchsia")]
2136impl From<DeviceReportsReaderSynchronousProxy> for zx::Handle {
2137 fn from(value: DeviceReportsReaderSynchronousProxy) -> Self {
2138 value.into_channel().into()
2139 }
2140}
2141
2142#[cfg(target_os = "fuchsia")]
2143impl From<fidl::Channel> for DeviceReportsReaderSynchronousProxy {
2144 fn from(value: fidl::Channel) -> Self {
2145 Self::new(value)
2146 }
2147}
2148
2149#[derive(Debug, Clone)]
2150pub struct DeviceReportsReaderProxy {
2151 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2152}
2153
2154impl fidl::endpoints::Proxy for DeviceReportsReaderProxy {
2155 type Protocol = DeviceReportsReaderMarker;
2156
2157 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2158 Self::new(inner)
2159 }
2160
2161 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2162 self.client.into_channel().map_err(|client| Self { client })
2163 }
2164
2165 fn as_channel(&self) -> &::fidl::AsyncChannel {
2166 self.client.as_channel()
2167 }
2168}
2169
2170impl DeviceReportsReaderProxy {
2171 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2173 let protocol_name =
2174 <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2175 Self { client: fidl::client::Client::new(channel, protocol_name) }
2176 }
2177
2178 pub fn take_event_stream(&self) -> DeviceReportsReaderEventStream {
2184 DeviceReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
2185 }
2186
2187 pub fn r#read_reports(
2192 &self,
2193 ) -> fidl::client::QueryResponseFut<
2194 DeviceReportsReaderReadReportsResult,
2195 fidl::encoding::DefaultFuchsiaResourceDialect,
2196 > {
2197 DeviceReportsReaderProxyInterface::r#read_reports(self)
2198 }
2199}
2200
2201impl DeviceReportsReaderProxyInterface for DeviceReportsReaderProxy {
2202 type ReadReportsResponseFut = fidl::client::QueryResponseFut<
2203 DeviceReportsReaderReadReportsResult,
2204 fidl::encoding::DefaultFuchsiaResourceDialect,
2205 >;
2206 fn r#read_reports(&self) -> Self::ReadReportsResponseFut {
2207 fn _decode(
2208 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2209 ) -> Result<DeviceReportsReaderReadReportsResult, fidl::Error> {
2210 let _response = fidl::client::decode_transaction_body::<
2211 fidl::encoding::ResultType<DeviceReportsReaderReadReportsResponse, i32>,
2212 fidl::encoding::DefaultFuchsiaResourceDialect,
2213 0x36077c1b177d4291,
2214 >(_buf?)?;
2215 Ok(_response.map(|x| x.reports))
2216 }
2217 self.client.send_query_and_decode::<
2218 fidl::encoding::EmptyPayload,
2219 DeviceReportsReaderReadReportsResult,
2220 >(
2221 (),
2222 0x36077c1b177d4291,
2223 fidl::encoding::DynamicFlags::empty(),
2224 _decode,
2225 )
2226 }
2227}
2228
2229pub struct DeviceReportsReaderEventStream {
2230 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2231}
2232
2233impl std::marker::Unpin for DeviceReportsReaderEventStream {}
2234
2235impl futures::stream::FusedStream for DeviceReportsReaderEventStream {
2236 fn is_terminated(&self) -> bool {
2237 self.event_receiver.is_terminated()
2238 }
2239}
2240
2241impl futures::Stream for DeviceReportsReaderEventStream {
2242 type Item = Result<DeviceReportsReaderEvent, fidl::Error>;
2243
2244 fn poll_next(
2245 mut self: std::pin::Pin<&mut Self>,
2246 cx: &mut std::task::Context<'_>,
2247 ) -> std::task::Poll<Option<Self::Item>> {
2248 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2249 &mut self.event_receiver,
2250 cx
2251 )?) {
2252 Some(buf) => std::task::Poll::Ready(Some(DeviceReportsReaderEvent::decode(buf))),
2253 None => std::task::Poll::Ready(None),
2254 }
2255 }
2256}
2257
2258#[derive(Debug)]
2259pub enum DeviceReportsReaderEvent {}
2260
2261impl DeviceReportsReaderEvent {
2262 fn decode(
2264 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2265 ) -> Result<DeviceReportsReaderEvent, fidl::Error> {
2266 let (bytes, _handles) = buf.split_mut();
2267 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2268 debug_assert_eq!(tx_header.tx_id, 0);
2269 match tx_header.ordinal {
2270 _ => Err(fidl::Error::UnknownOrdinal {
2271 ordinal: tx_header.ordinal,
2272 protocol_name:
2273 <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2274 }),
2275 }
2276 }
2277}
2278
2279pub struct DeviceReportsReaderRequestStream {
2281 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2282 is_terminated: bool,
2283}
2284
2285impl std::marker::Unpin for DeviceReportsReaderRequestStream {}
2286
2287impl futures::stream::FusedStream for DeviceReportsReaderRequestStream {
2288 fn is_terminated(&self) -> bool {
2289 self.is_terminated
2290 }
2291}
2292
2293impl fidl::endpoints::RequestStream for DeviceReportsReaderRequestStream {
2294 type Protocol = DeviceReportsReaderMarker;
2295 type ControlHandle = DeviceReportsReaderControlHandle;
2296
2297 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2298 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2299 }
2300
2301 fn control_handle(&self) -> Self::ControlHandle {
2302 DeviceReportsReaderControlHandle { inner: self.inner.clone() }
2303 }
2304
2305 fn into_inner(
2306 self,
2307 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2308 {
2309 (self.inner, self.is_terminated)
2310 }
2311
2312 fn from_inner(
2313 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2314 is_terminated: bool,
2315 ) -> Self {
2316 Self { inner, is_terminated }
2317 }
2318}
2319
2320impl futures::Stream for DeviceReportsReaderRequestStream {
2321 type Item = Result<DeviceReportsReaderRequest, fidl::Error>;
2322
2323 fn poll_next(
2324 mut self: std::pin::Pin<&mut Self>,
2325 cx: &mut std::task::Context<'_>,
2326 ) -> std::task::Poll<Option<Self::Item>> {
2327 let this = &mut *self;
2328 if this.inner.check_shutdown(cx) {
2329 this.is_terminated = true;
2330 return std::task::Poll::Ready(None);
2331 }
2332 if this.is_terminated {
2333 panic!("polled DeviceReportsReaderRequestStream after completion");
2334 }
2335 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2336 |bytes, handles| {
2337 match this.inner.channel().read_etc(cx, bytes, handles) {
2338 std::task::Poll::Ready(Ok(())) => {}
2339 std::task::Poll::Pending => return std::task::Poll::Pending,
2340 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2341 this.is_terminated = true;
2342 return std::task::Poll::Ready(None);
2343 }
2344 std::task::Poll::Ready(Err(e)) => {
2345 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2346 e.into(),
2347 ))))
2348 }
2349 }
2350
2351 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2353
2354 std::task::Poll::Ready(Some(match header.ordinal {
2355 0x36077c1b177d4291 => {
2356 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2357 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2358 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2359 let control_handle = DeviceReportsReaderControlHandle {
2360 inner: this.inner.clone(),
2361 };
2362 Ok(DeviceReportsReaderRequest::ReadReports {
2363 responder: DeviceReportsReaderReadReportsResponder {
2364 control_handle: std::mem::ManuallyDrop::new(control_handle),
2365 tx_id: header.tx_id,
2366 },
2367 })
2368 }
2369 _ => Err(fidl::Error::UnknownOrdinal {
2370 ordinal: header.ordinal,
2371 protocol_name: <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2372 }),
2373 }))
2374 },
2375 )
2376 }
2377}
2378
2379#[derive(Debug)]
2383pub enum DeviceReportsReaderRequest {
2384 ReadReports { responder: DeviceReportsReaderReadReportsResponder },
2389}
2390
2391impl DeviceReportsReaderRequest {
2392 #[allow(irrefutable_let_patterns)]
2393 pub fn into_read_reports(self) -> Option<(DeviceReportsReaderReadReportsResponder)> {
2394 if let DeviceReportsReaderRequest::ReadReports { responder } = self {
2395 Some((responder))
2396 } else {
2397 None
2398 }
2399 }
2400
2401 pub fn method_name(&self) -> &'static str {
2403 match *self {
2404 DeviceReportsReaderRequest::ReadReports { .. } => "read_reports",
2405 }
2406 }
2407}
2408
2409#[derive(Debug, Clone)]
2410pub struct DeviceReportsReaderControlHandle {
2411 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2412}
2413
2414impl fidl::endpoints::ControlHandle for DeviceReportsReaderControlHandle {
2415 fn shutdown(&self) {
2416 self.inner.shutdown()
2417 }
2418 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2419 self.inner.shutdown_with_epitaph(status)
2420 }
2421
2422 fn is_closed(&self) -> bool {
2423 self.inner.channel().is_closed()
2424 }
2425 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2426 self.inner.channel().on_closed()
2427 }
2428
2429 #[cfg(target_os = "fuchsia")]
2430 fn signal_peer(
2431 &self,
2432 clear_mask: zx::Signals,
2433 set_mask: zx::Signals,
2434 ) -> Result<(), zx_status::Status> {
2435 use fidl::Peered;
2436 self.inner.channel().signal_peer(clear_mask, set_mask)
2437 }
2438}
2439
2440impl DeviceReportsReaderControlHandle {}
2441
2442#[must_use = "FIDL methods require a response to be sent"]
2443#[derive(Debug)]
2444pub struct DeviceReportsReaderReadReportsResponder {
2445 control_handle: std::mem::ManuallyDrop<DeviceReportsReaderControlHandle>,
2446 tx_id: u32,
2447}
2448
2449impl std::ops::Drop for DeviceReportsReaderReadReportsResponder {
2453 fn drop(&mut self) {
2454 self.control_handle.shutdown();
2455 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2457 }
2458}
2459
2460impl fidl::endpoints::Responder for DeviceReportsReaderReadReportsResponder {
2461 type ControlHandle = DeviceReportsReaderControlHandle;
2462
2463 fn control_handle(&self) -> &DeviceReportsReaderControlHandle {
2464 &self.control_handle
2465 }
2466
2467 fn drop_without_shutdown(mut self) {
2468 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2470 std::mem::forget(self);
2472 }
2473}
2474
2475impl DeviceReportsReaderReadReportsResponder {
2476 pub fn send(
2480 self,
2481 mut result: Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>,
2482 ) -> Result<(), fidl::Error> {
2483 let _result = self.send_raw(result);
2484 if _result.is_err() {
2485 self.control_handle.shutdown();
2486 }
2487 self.drop_without_shutdown();
2488 _result
2489 }
2490
2491 pub fn send_no_shutdown_on_err(
2493 self,
2494 mut result: Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>,
2495 ) -> Result<(), fidl::Error> {
2496 let _result = self.send_raw(result);
2497 self.drop_without_shutdown();
2498 _result
2499 }
2500
2501 fn send_raw(
2502 &self,
2503 mut result: Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>,
2504 ) -> Result<(), fidl::Error> {
2505 self.control_handle.inner.send::<fidl::encoding::ResultType<
2506 DeviceReportsReaderReadReportsResponse,
2507 i32,
2508 >>(
2509 result.as_mut().map_err(|e| *e).map(|reports| (reports.as_mut_slice(),)),
2510 self.tx_id,
2511 0x36077c1b177d4291,
2512 fidl::encoding::DynamicFlags::empty(),
2513 )
2514 }
2515}
2516
2517#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2518pub struct ServiceMarker;
2519
2520#[cfg(target_os = "fuchsia")]
2521impl fidl::endpoints::ServiceMarker for ServiceMarker {
2522 type Proxy = ServiceProxy;
2523 type Request = ServiceRequest;
2524 const SERVICE_NAME: &'static str = "fuchsia.hardware.input.Service";
2525}
2526
2527#[cfg(target_os = "fuchsia")]
2530pub enum ServiceRequest {
2531 Controller(ControllerRequestStream),
2532}
2533
2534#[cfg(target_os = "fuchsia")]
2535impl fidl::endpoints::ServiceRequest for ServiceRequest {
2536 type Service = ServiceMarker;
2537
2538 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2539 match name {
2540 "controller" => Self::Controller(
2541 <ControllerRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2542 ),
2543 _ => panic!("no such member protocol name for service Service"),
2544 }
2545 }
2546
2547 fn member_names() -> &'static [&'static str] {
2548 &["controller"]
2549 }
2550}
2551#[cfg(target_os = "fuchsia")]
2552pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2553
2554#[cfg(target_os = "fuchsia")]
2555impl fidl::endpoints::ServiceProxy for ServiceProxy {
2556 type Service = ServiceMarker;
2557
2558 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2559 Self(opener)
2560 }
2561}
2562
2563#[cfg(target_os = "fuchsia")]
2564impl ServiceProxy {
2565 pub fn connect_to_controller(&self) -> Result<ControllerProxy, fidl::Error> {
2566 let (proxy, server_end) = fidl::endpoints::create_proxy::<ControllerMarker>();
2567 self.connect_channel_to_controller(server_end)?;
2568 Ok(proxy)
2569 }
2570
2571 pub fn connect_to_controller_sync(&self) -> Result<ControllerSynchronousProxy, fidl::Error> {
2574 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControllerMarker>();
2575 self.connect_channel_to_controller(server_end)?;
2576 Ok(proxy)
2577 }
2578
2579 pub fn connect_channel_to_controller(
2582 &self,
2583 server_end: fidl::endpoints::ServerEnd<ControllerMarker>,
2584 ) -> Result<(), fidl::Error> {
2585 self.0.open_member("controller", server_end.into_channel())
2586 }
2587
2588 pub fn instance_name(&self) -> &str {
2589 self.0.instance_name()
2590 }
2591}
2592
2593mod internal {
2594 use super::*;
2595
2596 impl fidl::encoding::ResourceTypeMarker for ControllerOpenSessionRequest {
2597 type Borrowed<'a> = &'a mut Self;
2598 fn take_or_borrow<'a>(
2599 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2600 ) -> Self::Borrowed<'a> {
2601 value
2602 }
2603 }
2604
2605 unsafe impl fidl::encoding::TypeMarker for ControllerOpenSessionRequest {
2606 type Owned = Self;
2607
2608 #[inline(always)]
2609 fn inline_align(_context: fidl::encoding::Context) -> usize {
2610 4
2611 }
2612
2613 #[inline(always)]
2614 fn inline_size(_context: fidl::encoding::Context) -> usize {
2615 4
2616 }
2617 }
2618
2619 unsafe impl
2620 fidl::encoding::Encode<
2621 ControllerOpenSessionRequest,
2622 fidl::encoding::DefaultFuchsiaResourceDialect,
2623 > for &mut ControllerOpenSessionRequest
2624 {
2625 #[inline]
2626 unsafe fn encode(
2627 self,
2628 encoder: &mut fidl::encoding::Encoder<
2629 '_,
2630 fidl::encoding::DefaultFuchsiaResourceDialect,
2631 >,
2632 offset: usize,
2633 _depth: fidl::encoding::Depth,
2634 ) -> fidl::Result<()> {
2635 encoder.debug_check_bounds::<ControllerOpenSessionRequest>(offset);
2636 fidl::encoding::Encode::<ControllerOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2638 (
2639 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
2640 ),
2641 encoder, offset, _depth
2642 )
2643 }
2644 }
2645 unsafe impl<
2646 T0: fidl::encoding::Encode<
2647 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2648 fidl::encoding::DefaultFuchsiaResourceDialect,
2649 >,
2650 >
2651 fidl::encoding::Encode<
2652 ControllerOpenSessionRequest,
2653 fidl::encoding::DefaultFuchsiaResourceDialect,
2654 > for (T0,)
2655 {
2656 #[inline]
2657 unsafe fn encode(
2658 self,
2659 encoder: &mut fidl::encoding::Encoder<
2660 '_,
2661 fidl::encoding::DefaultFuchsiaResourceDialect,
2662 >,
2663 offset: usize,
2664 depth: fidl::encoding::Depth,
2665 ) -> fidl::Result<()> {
2666 encoder.debug_check_bounds::<ControllerOpenSessionRequest>(offset);
2667 self.0.encode(encoder, offset + 0, depth)?;
2671 Ok(())
2672 }
2673 }
2674
2675 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2676 for ControllerOpenSessionRequest
2677 {
2678 #[inline(always)]
2679 fn new_empty() -> Self {
2680 Self {
2681 session: fidl::new_empty!(
2682 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2683 fidl::encoding::DefaultFuchsiaResourceDialect
2684 ),
2685 }
2686 }
2687
2688 #[inline]
2689 unsafe fn decode(
2690 &mut self,
2691 decoder: &mut fidl::encoding::Decoder<
2692 '_,
2693 fidl::encoding::DefaultFuchsiaResourceDialect,
2694 >,
2695 offset: usize,
2696 _depth: fidl::encoding::Depth,
2697 ) -> fidl::Result<()> {
2698 decoder.debug_check_bounds::<Self>(offset);
2699 fidl::decode!(
2701 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2702 fidl::encoding::DefaultFuchsiaResourceDialect,
2703 &mut self.session,
2704 decoder,
2705 offset + 0,
2706 _depth
2707 )?;
2708 Ok(())
2709 }
2710 }
2711
2712 impl fidl::encoding::ResourceTypeMarker for DeviceGetDeviceReportsReaderRequest {
2713 type Borrowed<'a> = &'a mut Self;
2714 fn take_or_borrow<'a>(
2715 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2716 ) -> Self::Borrowed<'a> {
2717 value
2718 }
2719 }
2720
2721 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceReportsReaderRequest {
2722 type Owned = Self;
2723
2724 #[inline(always)]
2725 fn inline_align(_context: fidl::encoding::Context) -> usize {
2726 4
2727 }
2728
2729 #[inline(always)]
2730 fn inline_size(_context: fidl::encoding::Context) -> usize {
2731 4
2732 }
2733 }
2734
2735 unsafe impl
2736 fidl::encoding::Encode<
2737 DeviceGetDeviceReportsReaderRequest,
2738 fidl::encoding::DefaultFuchsiaResourceDialect,
2739 > for &mut DeviceGetDeviceReportsReaderRequest
2740 {
2741 #[inline]
2742 unsafe fn encode(
2743 self,
2744 encoder: &mut fidl::encoding::Encoder<
2745 '_,
2746 fidl::encoding::DefaultFuchsiaResourceDialect,
2747 >,
2748 offset: usize,
2749 _depth: fidl::encoding::Depth,
2750 ) -> fidl::Result<()> {
2751 encoder.debug_check_bounds::<DeviceGetDeviceReportsReaderRequest>(offset);
2752 fidl::encoding::Encode::<DeviceGetDeviceReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2754 (
2755 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
2756 ),
2757 encoder, offset, _depth
2758 )
2759 }
2760 }
2761 unsafe impl<
2762 T0: fidl::encoding::Encode<
2763 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>>,
2764 fidl::encoding::DefaultFuchsiaResourceDialect,
2765 >,
2766 >
2767 fidl::encoding::Encode<
2768 DeviceGetDeviceReportsReaderRequest,
2769 fidl::encoding::DefaultFuchsiaResourceDialect,
2770 > for (T0,)
2771 {
2772 #[inline]
2773 unsafe fn encode(
2774 self,
2775 encoder: &mut fidl::encoding::Encoder<
2776 '_,
2777 fidl::encoding::DefaultFuchsiaResourceDialect,
2778 >,
2779 offset: usize,
2780 depth: fidl::encoding::Depth,
2781 ) -> fidl::Result<()> {
2782 encoder.debug_check_bounds::<DeviceGetDeviceReportsReaderRequest>(offset);
2783 self.0.encode(encoder, offset + 0, depth)?;
2787 Ok(())
2788 }
2789 }
2790
2791 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2792 for DeviceGetDeviceReportsReaderRequest
2793 {
2794 #[inline(always)]
2795 fn new_empty() -> Self {
2796 Self {
2797 reader: fidl::new_empty!(
2798 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>>,
2799 fidl::encoding::DefaultFuchsiaResourceDialect
2800 ),
2801 }
2802 }
2803
2804 #[inline]
2805 unsafe fn decode(
2806 &mut self,
2807 decoder: &mut fidl::encoding::Decoder<
2808 '_,
2809 fidl::encoding::DefaultFuchsiaResourceDialect,
2810 >,
2811 offset: usize,
2812 _depth: fidl::encoding::Depth,
2813 ) -> fidl::Result<()> {
2814 decoder.debug_check_bounds::<Self>(offset);
2815 fidl::decode!(
2817 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>>,
2818 fidl::encoding::DefaultFuchsiaResourceDialect,
2819 &mut self.reader,
2820 decoder,
2821 offset + 0,
2822 _depth
2823 )?;
2824 Ok(())
2825 }
2826 }
2827
2828 impl fidl::encoding::ResourceTypeMarker for DeviceReportsReaderReadReportsResponse {
2829 type Borrowed<'a> = &'a mut Self;
2830 fn take_or_borrow<'a>(
2831 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2832 ) -> Self::Borrowed<'a> {
2833 value
2834 }
2835 }
2836
2837 unsafe impl fidl::encoding::TypeMarker for DeviceReportsReaderReadReportsResponse {
2838 type Owned = Self;
2839
2840 #[inline(always)]
2841 fn inline_align(_context: fidl::encoding::Context) -> usize {
2842 8
2843 }
2844
2845 #[inline(always)]
2846 fn inline_size(_context: fidl::encoding::Context) -> usize {
2847 16
2848 }
2849 }
2850
2851 unsafe impl
2852 fidl::encoding::Encode<
2853 DeviceReportsReaderReadReportsResponse,
2854 fidl::encoding::DefaultFuchsiaResourceDialect,
2855 > for &mut DeviceReportsReaderReadReportsResponse
2856 {
2857 #[inline]
2858 unsafe fn encode(
2859 self,
2860 encoder: &mut fidl::encoding::Encoder<
2861 '_,
2862 fidl::encoding::DefaultFuchsiaResourceDialect,
2863 >,
2864 offset: usize,
2865 _depth: fidl::encoding::Depth,
2866 ) -> fidl::Result<()> {
2867 encoder.debug_check_bounds::<DeviceReportsReaderReadReportsResponse>(offset);
2868 fidl::encoding::Encode::<DeviceReportsReaderReadReportsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2870 (
2871 <fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
2872 ),
2873 encoder, offset, _depth
2874 )
2875 }
2876 }
2877 unsafe impl<
2878 T0: fidl::encoding::Encode<
2879 fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50>,
2880 fidl::encoding::DefaultFuchsiaResourceDialect,
2881 >,
2882 >
2883 fidl::encoding::Encode<
2884 DeviceReportsReaderReadReportsResponse,
2885 fidl::encoding::DefaultFuchsiaResourceDialect,
2886 > for (T0,)
2887 {
2888 #[inline]
2889 unsafe fn encode(
2890 self,
2891 encoder: &mut fidl::encoding::Encoder<
2892 '_,
2893 fidl::encoding::DefaultFuchsiaResourceDialect,
2894 >,
2895 offset: usize,
2896 depth: fidl::encoding::Depth,
2897 ) -> fidl::Result<()> {
2898 encoder.debug_check_bounds::<DeviceReportsReaderReadReportsResponse>(offset);
2899 self.0.encode(encoder, offset + 0, depth)?;
2903 Ok(())
2904 }
2905 }
2906
2907 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2908 for DeviceReportsReaderReadReportsResponse
2909 {
2910 #[inline(always)]
2911 fn new_empty() -> Self {
2912 Self {
2913 reports: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
2914 }
2915 }
2916
2917 #[inline]
2918 unsafe fn decode(
2919 &mut self,
2920 decoder: &mut fidl::encoding::Decoder<
2921 '_,
2922 fidl::encoding::DefaultFuchsiaResourceDialect,
2923 >,
2924 offset: usize,
2925 _depth: fidl::encoding::Depth,
2926 ) -> fidl::Result<()> {
2927 decoder.debug_check_bounds::<Self>(offset);
2928 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
2930 Ok(())
2931 }
2932 }
2933
2934 impl fidl::encoding::ResourceTypeMarker for DeviceGetReportsEventResponse {
2935 type Borrowed<'a> = &'a mut Self;
2936 fn take_or_borrow<'a>(
2937 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2938 ) -> Self::Borrowed<'a> {
2939 value
2940 }
2941 }
2942
2943 unsafe impl fidl::encoding::TypeMarker for DeviceGetReportsEventResponse {
2944 type Owned = Self;
2945
2946 #[inline(always)]
2947 fn inline_align(_context: fidl::encoding::Context) -> usize {
2948 4
2949 }
2950
2951 #[inline(always)]
2952 fn inline_size(_context: fidl::encoding::Context) -> usize {
2953 4
2954 }
2955 }
2956
2957 unsafe impl
2958 fidl::encoding::Encode<
2959 DeviceGetReportsEventResponse,
2960 fidl::encoding::DefaultFuchsiaResourceDialect,
2961 > for &mut DeviceGetReportsEventResponse
2962 {
2963 #[inline]
2964 unsafe fn encode(
2965 self,
2966 encoder: &mut fidl::encoding::Encoder<
2967 '_,
2968 fidl::encoding::DefaultFuchsiaResourceDialect,
2969 >,
2970 offset: usize,
2971 _depth: fidl::encoding::Depth,
2972 ) -> fidl::Result<()> {
2973 encoder.debug_check_bounds::<DeviceGetReportsEventResponse>(offset);
2974 fidl::encoding::Encode::<
2976 DeviceGetReportsEventResponse,
2977 fidl::encoding::DefaultFuchsiaResourceDialect,
2978 >::encode(
2979 (<fidl::encoding::HandleType<
2980 fidl::Event,
2981 { fidl::ObjectType::EVENT.into_raw() },
2982 2147483648,
2983 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2984 &mut self.event
2985 ),),
2986 encoder,
2987 offset,
2988 _depth,
2989 )
2990 }
2991 }
2992 unsafe impl<
2993 T0: fidl::encoding::Encode<
2994 fidl::encoding::HandleType<
2995 fidl::Event,
2996 { fidl::ObjectType::EVENT.into_raw() },
2997 2147483648,
2998 >,
2999 fidl::encoding::DefaultFuchsiaResourceDialect,
3000 >,
3001 >
3002 fidl::encoding::Encode<
3003 DeviceGetReportsEventResponse,
3004 fidl::encoding::DefaultFuchsiaResourceDialect,
3005 > for (T0,)
3006 {
3007 #[inline]
3008 unsafe fn encode(
3009 self,
3010 encoder: &mut fidl::encoding::Encoder<
3011 '_,
3012 fidl::encoding::DefaultFuchsiaResourceDialect,
3013 >,
3014 offset: usize,
3015 depth: fidl::encoding::Depth,
3016 ) -> fidl::Result<()> {
3017 encoder.debug_check_bounds::<DeviceGetReportsEventResponse>(offset);
3018 self.0.encode(encoder, offset + 0, depth)?;
3022 Ok(())
3023 }
3024 }
3025
3026 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3027 for DeviceGetReportsEventResponse
3028 {
3029 #[inline(always)]
3030 fn new_empty() -> Self {
3031 Self {
3032 event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3033 }
3034 }
3035
3036 #[inline]
3037 unsafe fn decode(
3038 &mut self,
3039 decoder: &mut fidl::encoding::Decoder<
3040 '_,
3041 fidl::encoding::DefaultFuchsiaResourceDialect,
3042 >,
3043 offset: usize,
3044 _depth: fidl::encoding::Depth,
3045 ) -> fidl::Result<()> {
3046 decoder.debug_check_bounds::<Self>(offset);
3047 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
3049 Ok(())
3050 }
3051 }
3052}