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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13pub const MAX_REPORTS_COUNT: u32 = 50;
14
15#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
16pub struct ControllerOpenSessionRequest {
17 pub session: fidl::endpoints::ServerEnd<DeviceMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for ControllerOpenSessionRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct DeviceGetDeviceReportsReaderRequest {
27 pub reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31 for DeviceGetDeviceReportsReaderRequest
32{
33}
34
35#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct DeviceGetReportDescResponse {
37 pub desc: Vec<u8>,
38}
39
40impl fidl::Persistable for DeviceGetReportDescResponse {}
41
42#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
43pub struct DeviceGetReportRequest {
44 pub type_: fidl_fuchsia_hardware_hidbus::ReportType,
45 pub id: u8,
46}
47
48impl fidl::Persistable for DeviceGetReportRequest {}
49
50#[derive(Debug, PartialEq)]
51pub struct DeviceReportsReaderReadReportsResponse {
52 pub reports: Vec<fidl_fuchsia_hardware_hidbus::Report>,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
56 for DeviceReportsReaderReadReportsResponse
57{
58}
59
60#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
61pub struct DeviceSetReportRequest {
62 pub type_: fidl_fuchsia_hardware_hidbus::ReportType,
63 pub id: u8,
64 pub report: Vec<u8>,
65}
66
67impl fidl::Persistable for DeviceSetReportRequest {}
68
69#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70#[repr(C)]
71pub struct DeviceSetTraceIdRequest {
72 pub id: u32,
73}
74
75impl fidl::Persistable for DeviceSetTraceIdRequest {}
76
77#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
78pub struct DeviceGetReportResponse {
79 pub report: Vec<u8>,
80}
81
82impl fidl::Persistable for DeviceGetReportResponse {}
83
84#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct DeviceGetReportsEventResponse {
86 pub event: fidl::Event,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
90 for DeviceGetReportsEventResponse
91{
92}
93
94#[derive(Clone, Debug, PartialEq)]
95pub struct DeviceQueryResponse {
96 pub info: fidl_fuchsia_hardware_hidbus::HidInfo,
97}
98
99impl fidl::Persistable for DeviceQueryResponse {}
100
101#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
102pub struct DeviceReadReportsResponse {
103 pub data: Vec<u8>,
104}
105
106impl fidl::Persistable for DeviceReadReportsResponse {}
107
108#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
109pub struct ControllerMarker;
110
111impl fidl::endpoints::ProtocolMarker for ControllerMarker {
112 type Proxy = ControllerProxy;
113 type RequestStream = ControllerRequestStream;
114 #[cfg(target_os = "fuchsia")]
115 type SynchronousProxy = ControllerSynchronousProxy;
116
117 const DEBUG_NAME: &'static str = "(anonymous) Controller";
118}
119
120pub trait ControllerProxyInterface: Send + Sync {
121 fn r#open_session(
122 &self,
123 session: fidl::endpoints::ServerEnd<DeviceMarker>,
124 ) -> Result<(), fidl::Error>;
125}
126#[derive(Debug)]
127#[cfg(target_os = "fuchsia")]
128pub struct ControllerSynchronousProxy {
129 client: fidl::client::sync::Client,
130}
131
132#[cfg(target_os = "fuchsia")]
133impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
134 type Proxy = ControllerProxy;
135 type Protocol = ControllerMarker;
136
137 fn from_channel(inner: fidl::Channel) -> Self {
138 Self::new(inner)
139 }
140
141 fn into_channel(self) -> fidl::Channel {
142 self.client.into_channel()
143 }
144
145 fn as_channel(&self) -> &fidl::Channel {
146 self.client.as_channel()
147 }
148}
149
150#[cfg(target_os = "fuchsia")]
151impl ControllerSynchronousProxy {
152 pub fn new(channel: fidl::Channel) -> Self {
153 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
154 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
155 }
156
157 pub fn into_channel(self) -> fidl::Channel {
158 self.client.into_channel()
159 }
160
161 pub fn wait_for_event(
164 &self,
165 deadline: zx::MonotonicInstant,
166 ) -> Result<ControllerEvent, fidl::Error> {
167 ControllerEvent::decode(self.client.wait_for_event(deadline)?)
168 }
169
170 pub fn r#open_session(
172 &self,
173 mut session: fidl::endpoints::ServerEnd<DeviceMarker>,
174 ) -> Result<(), fidl::Error> {
175 self.client.send::<ControllerOpenSessionRequest>(
176 (session,),
177 0x404db87008999427,
178 fidl::encoding::DynamicFlags::empty(),
179 )
180 }
181}
182
183#[derive(Debug, Clone)]
184pub struct ControllerProxy {
185 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
186}
187
188impl fidl::endpoints::Proxy for ControllerProxy {
189 type Protocol = ControllerMarker;
190
191 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
192 Self::new(inner)
193 }
194
195 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
196 self.client.into_channel().map_err(|client| Self { client })
197 }
198
199 fn as_channel(&self) -> &::fidl::AsyncChannel {
200 self.client.as_channel()
201 }
202}
203
204impl ControllerProxy {
205 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
207 let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
208 Self { client: fidl::client::Client::new(channel, protocol_name) }
209 }
210
211 pub fn take_event_stream(&self) -> ControllerEventStream {
217 ControllerEventStream { event_receiver: self.client.take_event_receiver() }
218 }
219
220 pub fn r#open_session(
222 &self,
223 mut session: fidl::endpoints::ServerEnd<DeviceMarker>,
224 ) -> Result<(), fidl::Error> {
225 ControllerProxyInterface::r#open_session(self, session)
226 }
227}
228
229impl ControllerProxyInterface for ControllerProxy {
230 fn r#open_session(
231 &self,
232 mut session: fidl::endpoints::ServerEnd<DeviceMarker>,
233 ) -> Result<(), fidl::Error> {
234 self.client.send::<ControllerOpenSessionRequest>(
235 (session,),
236 0x404db87008999427,
237 fidl::encoding::DynamicFlags::empty(),
238 )
239 }
240}
241
242pub struct ControllerEventStream {
243 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
244}
245
246impl std::marker::Unpin for ControllerEventStream {}
247
248impl futures::stream::FusedStream for ControllerEventStream {
249 fn is_terminated(&self) -> bool {
250 self.event_receiver.is_terminated()
251 }
252}
253
254impl futures::Stream for ControllerEventStream {
255 type Item = Result<ControllerEvent, fidl::Error>;
256
257 fn poll_next(
258 mut self: std::pin::Pin<&mut Self>,
259 cx: &mut std::task::Context<'_>,
260 ) -> std::task::Poll<Option<Self::Item>> {
261 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
262 &mut self.event_receiver,
263 cx
264 )?) {
265 Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
266 None => std::task::Poll::Ready(None),
267 }
268 }
269}
270
271#[derive(Debug)]
272pub enum ControllerEvent {}
273
274impl ControllerEvent {
275 fn decode(
277 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
278 ) -> Result<ControllerEvent, fidl::Error> {
279 let (bytes, _handles) = buf.split_mut();
280 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
281 debug_assert_eq!(tx_header.tx_id, 0);
282 match tx_header.ordinal {
283 _ => Err(fidl::Error::UnknownOrdinal {
284 ordinal: tx_header.ordinal,
285 protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
286 }),
287 }
288 }
289}
290
291pub struct ControllerRequestStream {
293 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
294 is_terminated: bool,
295}
296
297impl std::marker::Unpin for ControllerRequestStream {}
298
299impl futures::stream::FusedStream for ControllerRequestStream {
300 fn is_terminated(&self) -> bool {
301 self.is_terminated
302 }
303}
304
305impl fidl::endpoints::RequestStream for ControllerRequestStream {
306 type Protocol = ControllerMarker;
307 type ControlHandle = ControllerControlHandle;
308
309 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
310 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
311 }
312
313 fn control_handle(&self) -> Self::ControlHandle {
314 ControllerControlHandle { inner: self.inner.clone() }
315 }
316
317 fn into_inner(
318 self,
319 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
320 {
321 (self.inner, self.is_terminated)
322 }
323
324 fn from_inner(
325 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
326 is_terminated: bool,
327 ) -> Self {
328 Self { inner, is_terminated }
329 }
330}
331
332impl futures::Stream for ControllerRequestStream {
333 type Item = Result<ControllerRequest, fidl::Error>;
334
335 fn poll_next(
336 mut self: std::pin::Pin<&mut Self>,
337 cx: &mut std::task::Context<'_>,
338 ) -> std::task::Poll<Option<Self::Item>> {
339 let this = &mut *self;
340 if this.inner.check_shutdown(cx) {
341 this.is_terminated = true;
342 return std::task::Poll::Ready(None);
343 }
344 if this.is_terminated {
345 panic!("polled ControllerRequestStream after completion");
346 }
347 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
348 |bytes, handles| {
349 match this.inner.channel().read_etc(cx, bytes, handles) {
350 std::task::Poll::Ready(Ok(())) => {}
351 std::task::Poll::Pending => return std::task::Poll::Pending,
352 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
353 this.is_terminated = true;
354 return std::task::Poll::Ready(None);
355 }
356 std::task::Poll::Ready(Err(e)) => {
357 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
358 e.into(),
359 ))))
360 }
361 }
362
363 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
365
366 std::task::Poll::Ready(Some(match header.ordinal {
367 0x404db87008999427 => {
368 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
369 let mut req = fidl::new_empty!(
370 ControllerOpenSessionRequest,
371 fidl::encoding::DefaultFuchsiaResourceDialect
372 );
373 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerOpenSessionRequest>(&header, _body_bytes, handles, &mut req)?;
374 let control_handle = ControllerControlHandle { inner: this.inner.clone() };
375 Ok(ControllerRequest::OpenSession { session: req.session, control_handle })
376 }
377 _ => Err(fidl::Error::UnknownOrdinal {
378 ordinal: header.ordinal,
379 protocol_name:
380 <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
381 }),
382 }))
383 },
384 )
385 }
386}
387
388#[derive(Debug)]
389pub enum ControllerRequest {
390 OpenSession {
392 session: fidl::endpoints::ServerEnd<DeviceMarker>,
393 control_handle: ControllerControlHandle,
394 },
395}
396
397impl ControllerRequest {
398 #[allow(irrefutable_let_patterns)]
399 pub fn into_open_session(
400 self,
401 ) -> Option<(fidl::endpoints::ServerEnd<DeviceMarker>, ControllerControlHandle)> {
402 if let ControllerRequest::OpenSession { session, control_handle } = self {
403 Some((session, control_handle))
404 } else {
405 None
406 }
407 }
408
409 pub fn method_name(&self) -> &'static str {
411 match *self {
412 ControllerRequest::OpenSession { .. } => "open_session",
413 }
414 }
415}
416
417#[derive(Debug, Clone)]
418pub struct ControllerControlHandle {
419 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
420}
421
422impl fidl::endpoints::ControlHandle for ControllerControlHandle {
423 fn shutdown(&self) {
424 self.inner.shutdown()
425 }
426 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
427 self.inner.shutdown_with_epitaph(status)
428 }
429
430 fn is_closed(&self) -> bool {
431 self.inner.channel().is_closed()
432 }
433 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
434 self.inner.channel().on_closed()
435 }
436
437 #[cfg(target_os = "fuchsia")]
438 fn signal_peer(
439 &self,
440 clear_mask: zx::Signals,
441 set_mask: zx::Signals,
442 ) -> Result<(), zx_status::Status> {
443 use fidl::Peered;
444 self.inner.channel().signal_peer(clear_mask, set_mask)
445 }
446}
447
448impl ControllerControlHandle {}
449
450#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
451pub struct DeviceMarker;
452
453impl fidl::endpoints::ProtocolMarker for DeviceMarker {
454 type Proxy = DeviceProxy;
455 type RequestStream = DeviceRequestStream;
456 #[cfg(target_os = "fuchsia")]
457 type SynchronousProxy = DeviceSynchronousProxy;
458
459 const DEBUG_NAME: &'static str = "(anonymous) Device";
460}
461pub type DeviceQueryResult = Result<fidl_fuchsia_hardware_hidbus::HidInfo, i32>;
462pub type DeviceGetDeviceReportsReaderResult = Result<(), i32>;
463pub type DeviceReadReportResult = Result<fidl_fuchsia_hardware_hidbus::Report, i32>;
464pub type DeviceReadReportsResult = Result<Vec<u8>, i32>;
465pub type DeviceGetReportsEventResult = Result<fidl::Event, i32>;
466pub type DeviceGetReportResult = Result<Vec<u8>, i32>;
467pub type DeviceSetReportResult = Result<(), i32>;
468
469pub trait DeviceProxyInterface: Send + Sync {
470 type QueryResponseFut: std::future::Future<Output = Result<DeviceQueryResult, fidl::Error>>
471 + Send;
472 fn r#query(&self) -> Self::QueryResponseFut;
473 type GetReportDescResponseFut: std::future::Future<Output = Result<Vec<u8>, fidl::Error>> + Send;
474 fn r#get_report_desc(&self) -> Self::GetReportDescResponseFut;
475 type GetDeviceReportsReaderResponseFut: std::future::Future<Output = Result<DeviceGetDeviceReportsReaderResult, fidl::Error>>
476 + Send;
477 fn r#get_device_reports_reader(
478 &self,
479 reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
480 ) -> Self::GetDeviceReportsReaderResponseFut;
481 type ReadReportResponseFut: std::future::Future<Output = Result<DeviceReadReportResult, fidl::Error>>
482 + Send;
483 fn r#read_report(&self) -> Self::ReadReportResponseFut;
484 type ReadReportsResponseFut: std::future::Future<Output = Result<DeviceReadReportsResult, fidl::Error>>
485 + Send;
486 fn r#read_reports(&self) -> Self::ReadReportsResponseFut;
487 type GetReportsEventResponseFut: std::future::Future<Output = Result<DeviceGetReportsEventResult, fidl::Error>>
488 + Send;
489 fn r#get_reports_event(&self) -> Self::GetReportsEventResponseFut;
490 type GetReportResponseFut: std::future::Future<Output = Result<DeviceGetReportResult, fidl::Error>>
491 + Send;
492 fn r#get_report(
493 &self,
494 type_: fidl_fuchsia_hardware_hidbus::ReportType,
495 id: u8,
496 ) -> Self::GetReportResponseFut;
497 type SetReportResponseFut: std::future::Future<Output = Result<DeviceSetReportResult, fidl::Error>>
498 + Send;
499 fn r#set_report(
500 &self,
501 type_: fidl_fuchsia_hardware_hidbus::ReportType,
502 id: u8,
503 report: &[u8],
504 ) -> Self::SetReportResponseFut;
505 fn r#set_trace_id(&self, id: u32) -> Result<(), fidl::Error>;
506}
507#[derive(Debug)]
508#[cfg(target_os = "fuchsia")]
509pub struct DeviceSynchronousProxy {
510 client: fidl::client::sync::Client,
511}
512
513#[cfg(target_os = "fuchsia")]
514impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
515 type Proxy = DeviceProxy;
516 type Protocol = DeviceMarker;
517
518 fn from_channel(inner: fidl::Channel) -> Self {
519 Self::new(inner)
520 }
521
522 fn into_channel(self) -> fidl::Channel {
523 self.client.into_channel()
524 }
525
526 fn as_channel(&self) -> &fidl::Channel {
527 self.client.as_channel()
528 }
529}
530
531#[cfg(target_os = "fuchsia")]
532impl DeviceSynchronousProxy {
533 pub fn new(channel: fidl::Channel) -> Self {
534 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
535 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
536 }
537
538 pub fn into_channel(self) -> fidl::Channel {
539 self.client.into_channel()
540 }
541
542 pub fn wait_for_event(
545 &self,
546 deadline: zx::MonotonicInstant,
547 ) -> Result<DeviceEvent, fidl::Error> {
548 DeviceEvent::decode(self.client.wait_for_event(deadline)?)
549 }
550
551 pub fn r#query(
553 &self,
554 ___deadline: zx::MonotonicInstant,
555 ) -> Result<DeviceQueryResult, fidl::Error> {
556 let _response = self.client.send_query::<
557 fidl::encoding::EmptyPayload,
558 fidl::encoding::ResultType<DeviceQueryResponse, i32>,
559 >(
560 (),
561 0x6d1d90313259dae3,
562 fidl::encoding::DynamicFlags::empty(),
563 ___deadline,
564 )?;
565 Ok(_response.map(|x| x.info))
566 }
567
568 pub fn r#get_report_desc(
570 &self,
571 ___deadline: zx::MonotonicInstant,
572 ) -> Result<Vec<u8>, fidl::Error> {
573 let _response =
574 self.client.send_query::<fidl::encoding::EmptyPayload, DeviceGetReportDescResponse>(
575 (),
576 0x7fe4aff57d9019f8,
577 fidl::encoding::DynamicFlags::empty(),
578 ___deadline,
579 )?;
580 Ok(_response.desc)
581 }
582
583 pub fn r#get_device_reports_reader(
586 &self,
587 mut reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
588 ___deadline: zx::MonotonicInstant,
589 ) -> Result<DeviceGetDeviceReportsReaderResult, fidl::Error> {
590 let _response = self.client.send_query::<
591 DeviceGetDeviceReportsReaderRequest,
592 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
593 >(
594 (reader,),
595 0x67aee4993bb823ee,
596 fidl::encoding::DynamicFlags::empty(),
597 ___deadline,
598 )?;
599 Ok(_response.map(|x| x))
600 }
601
602 pub fn r#read_report(
608 &self,
609 ___deadline: zx::MonotonicInstant,
610 ) -> Result<DeviceReadReportResult, fidl::Error> {
611 let _response = self.client.send_query::<
612 fidl::encoding::EmptyPayload,
613 fidl::encoding::ResultType<fidl_fuchsia_hardware_hidbus::Report, i32>,
614 >(
615 (),
616 0x69871e1e2b75e46f,
617 fidl::encoding::DynamicFlags::empty(),
618 ___deadline,
619 )?;
620 Ok(_response.map(|x| x))
621 }
622
623 pub fn r#read_reports(
631 &self,
632 ___deadline: zx::MonotonicInstant,
633 ) -> Result<DeviceReadReportsResult, fidl::Error> {
634 let _response = self.client.send_query::<
635 fidl::encoding::EmptyPayload,
636 fidl::encoding::ResultType<DeviceReadReportsResponse, i32>,
637 >(
638 (),
639 0x6e20cf64707a4ee4,
640 fidl::encoding::DynamicFlags::empty(),
641 ___deadline,
642 )?;
643 Ok(_response.map(|x| x.data))
644 }
645
646 pub fn r#get_reports_event(
651 &self,
652 ___deadline: zx::MonotonicInstant,
653 ) -> Result<DeviceGetReportsEventResult, fidl::Error> {
654 let _response = self.client.send_query::<
655 fidl::encoding::EmptyPayload,
656 fidl::encoding::ResultType<DeviceGetReportsEventResponse, i32>,
657 >(
658 (),
659 0x6198970f9308041c,
660 fidl::encoding::DynamicFlags::empty(),
661 ___deadline,
662 )?;
663 Ok(_response.map(|x| x.event))
664 }
665
666 pub fn r#get_report(
670 &self,
671 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
672 mut id: u8,
673 ___deadline: zx::MonotonicInstant,
674 ) -> Result<DeviceGetReportResult, fidl::Error> {
675 let _response = self.client.send_query::<
676 DeviceGetReportRequest,
677 fidl::encoding::ResultType<DeviceGetReportResponse, i32>,
678 >(
679 (type_, id,),
680 0x5b2a44555defd970,
681 fidl::encoding::DynamicFlags::empty(),
682 ___deadline,
683 )?;
684 Ok(_response.map(|x| x.report))
685 }
686
687 pub fn r#set_report(
689 &self,
690 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
691 mut id: u8,
692 mut report: &[u8],
693 ___deadline: zx::MonotonicInstant,
694 ) -> Result<DeviceSetReportResult, fidl::Error> {
695 let _response = self.client.send_query::<
696 DeviceSetReportRequest,
697 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
698 >(
699 (type_, id, report,),
700 0x51cc85eb4e769ee,
701 fidl::encoding::DynamicFlags::empty(),
702 ___deadline,
703 )?;
704 Ok(_response.map(|x| x))
705 }
706
707 pub fn r#set_trace_id(&self, mut id: u32) -> Result<(), fidl::Error> {
709 self.client.send::<DeviceSetTraceIdRequest>(
710 (id,),
711 0x7fe8815219c66700,
712 fidl::encoding::DynamicFlags::empty(),
713 )
714 }
715}
716
717#[derive(Debug, Clone)]
718pub struct DeviceProxy {
719 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
720}
721
722impl fidl::endpoints::Proxy for DeviceProxy {
723 type Protocol = DeviceMarker;
724
725 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
726 Self::new(inner)
727 }
728
729 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
730 self.client.into_channel().map_err(|client| Self { client })
731 }
732
733 fn as_channel(&self) -> &::fidl::AsyncChannel {
734 self.client.as_channel()
735 }
736}
737
738impl DeviceProxy {
739 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
741 let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
742 Self { client: fidl::client::Client::new(channel, protocol_name) }
743 }
744
745 pub fn take_event_stream(&self) -> DeviceEventStream {
751 DeviceEventStream { event_receiver: self.client.take_event_receiver() }
752 }
753
754 pub fn r#query(
756 &self,
757 ) -> fidl::client::QueryResponseFut<
758 DeviceQueryResult,
759 fidl::encoding::DefaultFuchsiaResourceDialect,
760 > {
761 DeviceProxyInterface::r#query(self)
762 }
763
764 pub fn r#get_report_desc(
766 &self,
767 ) -> fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>
768 {
769 DeviceProxyInterface::r#get_report_desc(self)
770 }
771
772 pub fn r#get_device_reports_reader(
775 &self,
776 mut reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
777 ) -> fidl::client::QueryResponseFut<
778 DeviceGetDeviceReportsReaderResult,
779 fidl::encoding::DefaultFuchsiaResourceDialect,
780 > {
781 DeviceProxyInterface::r#get_device_reports_reader(self, reader)
782 }
783
784 pub fn r#read_report(
790 &self,
791 ) -> fidl::client::QueryResponseFut<
792 DeviceReadReportResult,
793 fidl::encoding::DefaultFuchsiaResourceDialect,
794 > {
795 DeviceProxyInterface::r#read_report(self)
796 }
797
798 pub fn r#read_reports(
806 &self,
807 ) -> fidl::client::QueryResponseFut<
808 DeviceReadReportsResult,
809 fidl::encoding::DefaultFuchsiaResourceDialect,
810 > {
811 DeviceProxyInterface::r#read_reports(self)
812 }
813
814 pub fn r#get_reports_event(
819 &self,
820 ) -> fidl::client::QueryResponseFut<
821 DeviceGetReportsEventResult,
822 fidl::encoding::DefaultFuchsiaResourceDialect,
823 > {
824 DeviceProxyInterface::r#get_reports_event(self)
825 }
826
827 pub fn r#get_report(
831 &self,
832 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
833 mut id: u8,
834 ) -> fidl::client::QueryResponseFut<
835 DeviceGetReportResult,
836 fidl::encoding::DefaultFuchsiaResourceDialect,
837 > {
838 DeviceProxyInterface::r#get_report(self, type_, id)
839 }
840
841 pub fn r#set_report(
843 &self,
844 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
845 mut id: u8,
846 mut report: &[u8],
847 ) -> fidl::client::QueryResponseFut<
848 DeviceSetReportResult,
849 fidl::encoding::DefaultFuchsiaResourceDialect,
850 > {
851 DeviceProxyInterface::r#set_report(self, type_, id, report)
852 }
853
854 pub fn r#set_trace_id(&self, mut id: u32) -> Result<(), fidl::Error> {
856 DeviceProxyInterface::r#set_trace_id(self, id)
857 }
858}
859
860impl DeviceProxyInterface for DeviceProxy {
861 type QueryResponseFut = fidl::client::QueryResponseFut<
862 DeviceQueryResult,
863 fidl::encoding::DefaultFuchsiaResourceDialect,
864 >;
865 fn r#query(&self) -> Self::QueryResponseFut {
866 fn _decode(
867 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
868 ) -> Result<DeviceQueryResult, fidl::Error> {
869 let _response = fidl::client::decode_transaction_body::<
870 fidl::encoding::ResultType<DeviceQueryResponse, i32>,
871 fidl::encoding::DefaultFuchsiaResourceDialect,
872 0x6d1d90313259dae3,
873 >(_buf?)?;
874 Ok(_response.map(|x| x.info))
875 }
876 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceQueryResult>(
877 (),
878 0x6d1d90313259dae3,
879 fidl::encoding::DynamicFlags::empty(),
880 _decode,
881 )
882 }
883
884 type GetReportDescResponseFut =
885 fidl::client::QueryResponseFut<Vec<u8>, fidl::encoding::DefaultFuchsiaResourceDialect>;
886 fn r#get_report_desc(&self) -> Self::GetReportDescResponseFut {
887 fn _decode(
888 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
889 ) -> Result<Vec<u8>, fidl::Error> {
890 let _response = fidl::client::decode_transaction_body::<
891 DeviceGetReportDescResponse,
892 fidl::encoding::DefaultFuchsiaResourceDialect,
893 0x7fe4aff57d9019f8,
894 >(_buf?)?;
895 Ok(_response.desc)
896 }
897 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<u8>>(
898 (),
899 0x7fe4aff57d9019f8,
900 fidl::encoding::DynamicFlags::empty(),
901 _decode,
902 )
903 }
904
905 type GetDeviceReportsReaderResponseFut = fidl::client::QueryResponseFut<
906 DeviceGetDeviceReportsReaderResult,
907 fidl::encoding::DefaultFuchsiaResourceDialect,
908 >;
909 fn r#get_device_reports_reader(
910 &self,
911 mut reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
912 ) -> Self::GetDeviceReportsReaderResponseFut {
913 fn _decode(
914 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
915 ) -> Result<DeviceGetDeviceReportsReaderResult, fidl::Error> {
916 let _response = fidl::client::decode_transaction_body::<
917 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
918 fidl::encoding::DefaultFuchsiaResourceDialect,
919 0x67aee4993bb823ee,
920 >(_buf?)?;
921 Ok(_response.map(|x| x))
922 }
923 self.client.send_query_and_decode::<
924 DeviceGetDeviceReportsReaderRequest,
925 DeviceGetDeviceReportsReaderResult,
926 >(
927 (reader,),
928 0x67aee4993bb823ee,
929 fidl::encoding::DynamicFlags::empty(),
930 _decode,
931 )
932 }
933
934 type ReadReportResponseFut = fidl::client::QueryResponseFut<
935 DeviceReadReportResult,
936 fidl::encoding::DefaultFuchsiaResourceDialect,
937 >;
938 fn r#read_report(&self) -> Self::ReadReportResponseFut {
939 fn _decode(
940 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
941 ) -> Result<DeviceReadReportResult, fidl::Error> {
942 let _response = fidl::client::decode_transaction_body::<
943 fidl::encoding::ResultType<fidl_fuchsia_hardware_hidbus::Report, i32>,
944 fidl::encoding::DefaultFuchsiaResourceDialect,
945 0x69871e1e2b75e46f,
946 >(_buf?)?;
947 Ok(_response.map(|x| x))
948 }
949 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadReportResult>(
950 (),
951 0x69871e1e2b75e46f,
952 fidl::encoding::DynamicFlags::empty(),
953 _decode,
954 )
955 }
956
957 type ReadReportsResponseFut = fidl::client::QueryResponseFut<
958 DeviceReadReportsResult,
959 fidl::encoding::DefaultFuchsiaResourceDialect,
960 >;
961 fn r#read_reports(&self) -> Self::ReadReportsResponseFut {
962 fn _decode(
963 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
964 ) -> Result<DeviceReadReportsResult, fidl::Error> {
965 let _response = fidl::client::decode_transaction_body::<
966 fidl::encoding::ResultType<DeviceReadReportsResponse, i32>,
967 fidl::encoding::DefaultFuchsiaResourceDialect,
968 0x6e20cf64707a4ee4,
969 >(_buf?)?;
970 Ok(_response.map(|x| x.data))
971 }
972 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceReadReportsResult>(
973 (),
974 0x6e20cf64707a4ee4,
975 fidl::encoding::DynamicFlags::empty(),
976 _decode,
977 )
978 }
979
980 type GetReportsEventResponseFut = fidl::client::QueryResponseFut<
981 DeviceGetReportsEventResult,
982 fidl::encoding::DefaultFuchsiaResourceDialect,
983 >;
984 fn r#get_reports_event(&self) -> Self::GetReportsEventResponseFut {
985 fn _decode(
986 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
987 ) -> Result<DeviceGetReportsEventResult, fidl::Error> {
988 let _response = fidl::client::decode_transaction_body::<
989 fidl::encoding::ResultType<DeviceGetReportsEventResponse, i32>,
990 fidl::encoding::DefaultFuchsiaResourceDialect,
991 0x6198970f9308041c,
992 >(_buf?)?;
993 Ok(_response.map(|x| x.event))
994 }
995 self.client
996 .send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceGetReportsEventResult>(
997 (),
998 0x6198970f9308041c,
999 fidl::encoding::DynamicFlags::empty(),
1000 _decode,
1001 )
1002 }
1003
1004 type GetReportResponseFut = fidl::client::QueryResponseFut<
1005 DeviceGetReportResult,
1006 fidl::encoding::DefaultFuchsiaResourceDialect,
1007 >;
1008 fn r#get_report(
1009 &self,
1010 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
1011 mut id: u8,
1012 ) -> Self::GetReportResponseFut {
1013 fn _decode(
1014 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1015 ) -> Result<DeviceGetReportResult, fidl::Error> {
1016 let _response = fidl::client::decode_transaction_body::<
1017 fidl::encoding::ResultType<DeviceGetReportResponse, i32>,
1018 fidl::encoding::DefaultFuchsiaResourceDialect,
1019 0x5b2a44555defd970,
1020 >(_buf?)?;
1021 Ok(_response.map(|x| x.report))
1022 }
1023 self.client.send_query_and_decode::<DeviceGetReportRequest, DeviceGetReportResult>(
1024 (type_, id),
1025 0x5b2a44555defd970,
1026 fidl::encoding::DynamicFlags::empty(),
1027 _decode,
1028 )
1029 }
1030
1031 type SetReportResponseFut = fidl::client::QueryResponseFut<
1032 DeviceSetReportResult,
1033 fidl::encoding::DefaultFuchsiaResourceDialect,
1034 >;
1035 fn r#set_report(
1036 &self,
1037 mut type_: fidl_fuchsia_hardware_hidbus::ReportType,
1038 mut id: u8,
1039 mut report: &[u8],
1040 ) -> Self::SetReportResponseFut {
1041 fn _decode(
1042 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1043 ) -> Result<DeviceSetReportResult, fidl::Error> {
1044 let _response = fidl::client::decode_transaction_body::<
1045 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1046 fidl::encoding::DefaultFuchsiaResourceDialect,
1047 0x51cc85eb4e769ee,
1048 >(_buf?)?;
1049 Ok(_response.map(|x| x))
1050 }
1051 self.client.send_query_and_decode::<DeviceSetReportRequest, DeviceSetReportResult>(
1052 (type_, id, report),
1053 0x51cc85eb4e769ee,
1054 fidl::encoding::DynamicFlags::empty(),
1055 _decode,
1056 )
1057 }
1058
1059 fn r#set_trace_id(&self, mut id: u32) -> Result<(), fidl::Error> {
1060 self.client.send::<DeviceSetTraceIdRequest>(
1061 (id,),
1062 0x7fe8815219c66700,
1063 fidl::encoding::DynamicFlags::empty(),
1064 )
1065 }
1066}
1067
1068pub struct DeviceEventStream {
1069 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1070}
1071
1072impl std::marker::Unpin for DeviceEventStream {}
1073
1074impl futures::stream::FusedStream for DeviceEventStream {
1075 fn is_terminated(&self) -> bool {
1076 self.event_receiver.is_terminated()
1077 }
1078}
1079
1080impl futures::Stream for DeviceEventStream {
1081 type Item = Result<DeviceEvent, fidl::Error>;
1082
1083 fn poll_next(
1084 mut self: std::pin::Pin<&mut Self>,
1085 cx: &mut std::task::Context<'_>,
1086 ) -> std::task::Poll<Option<Self::Item>> {
1087 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1088 &mut self.event_receiver,
1089 cx
1090 )?) {
1091 Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
1092 None => std::task::Poll::Ready(None),
1093 }
1094 }
1095}
1096
1097#[derive(Debug)]
1098pub enum DeviceEvent {}
1099
1100impl DeviceEvent {
1101 fn decode(
1103 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1104 ) -> Result<DeviceEvent, fidl::Error> {
1105 let (bytes, _handles) = buf.split_mut();
1106 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1107 debug_assert_eq!(tx_header.tx_id, 0);
1108 match tx_header.ordinal {
1109 _ => Err(fidl::Error::UnknownOrdinal {
1110 ordinal: tx_header.ordinal,
1111 protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1112 }),
1113 }
1114 }
1115}
1116
1117pub struct DeviceRequestStream {
1119 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1120 is_terminated: bool,
1121}
1122
1123impl std::marker::Unpin for DeviceRequestStream {}
1124
1125impl futures::stream::FusedStream for DeviceRequestStream {
1126 fn is_terminated(&self) -> bool {
1127 self.is_terminated
1128 }
1129}
1130
1131impl fidl::endpoints::RequestStream for DeviceRequestStream {
1132 type Protocol = DeviceMarker;
1133 type ControlHandle = DeviceControlHandle;
1134
1135 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1136 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1137 }
1138
1139 fn control_handle(&self) -> Self::ControlHandle {
1140 DeviceControlHandle { inner: self.inner.clone() }
1141 }
1142
1143 fn into_inner(
1144 self,
1145 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1146 {
1147 (self.inner, self.is_terminated)
1148 }
1149
1150 fn from_inner(
1151 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1152 is_terminated: bool,
1153 ) -> Self {
1154 Self { inner, is_terminated }
1155 }
1156}
1157
1158impl futures::Stream for DeviceRequestStream {
1159 type Item = Result<DeviceRequest, fidl::Error>;
1160
1161 fn poll_next(
1162 mut self: std::pin::Pin<&mut Self>,
1163 cx: &mut std::task::Context<'_>,
1164 ) -> std::task::Poll<Option<Self::Item>> {
1165 let this = &mut *self;
1166 if this.inner.check_shutdown(cx) {
1167 this.is_terminated = true;
1168 return std::task::Poll::Ready(None);
1169 }
1170 if this.is_terminated {
1171 panic!("polled DeviceRequestStream after completion");
1172 }
1173 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1174 |bytes, handles| {
1175 match this.inner.channel().read_etc(cx, bytes, handles) {
1176 std::task::Poll::Ready(Ok(())) => {}
1177 std::task::Poll::Pending => return std::task::Poll::Pending,
1178 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1179 this.is_terminated = true;
1180 return std::task::Poll::Ready(None);
1181 }
1182 std::task::Poll::Ready(Err(e)) => {
1183 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1184 e.into(),
1185 ))))
1186 }
1187 }
1188
1189 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1191
1192 std::task::Poll::Ready(Some(match header.ordinal {
1193 0x6d1d90313259dae3 => {
1194 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1195 let mut req = fidl::new_empty!(
1196 fidl::encoding::EmptyPayload,
1197 fidl::encoding::DefaultFuchsiaResourceDialect
1198 );
1199 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1200 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1201 Ok(DeviceRequest::Query {
1202 responder: DeviceQueryResponder {
1203 control_handle: std::mem::ManuallyDrop::new(control_handle),
1204 tx_id: header.tx_id,
1205 },
1206 })
1207 }
1208 0x7fe4aff57d9019f8 => {
1209 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1210 let mut req = fidl::new_empty!(
1211 fidl::encoding::EmptyPayload,
1212 fidl::encoding::DefaultFuchsiaResourceDialect
1213 );
1214 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1215 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1216 Ok(DeviceRequest::GetReportDesc {
1217 responder: DeviceGetReportDescResponder {
1218 control_handle: std::mem::ManuallyDrop::new(control_handle),
1219 tx_id: header.tx_id,
1220 },
1221 })
1222 }
1223 0x67aee4993bb823ee => {
1224 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1225 let mut req = fidl::new_empty!(
1226 DeviceGetDeviceReportsReaderRequest,
1227 fidl::encoding::DefaultFuchsiaResourceDialect
1228 );
1229 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetDeviceReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
1230 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1231 Ok(DeviceRequest::GetDeviceReportsReader {
1232 reader: req.reader,
1233
1234 responder: DeviceGetDeviceReportsReaderResponder {
1235 control_handle: std::mem::ManuallyDrop::new(control_handle),
1236 tx_id: header.tx_id,
1237 },
1238 })
1239 }
1240 0x69871e1e2b75e46f => {
1241 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1242 let mut req = fidl::new_empty!(
1243 fidl::encoding::EmptyPayload,
1244 fidl::encoding::DefaultFuchsiaResourceDialect
1245 );
1246 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1247 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1248 Ok(DeviceRequest::ReadReport {
1249 responder: DeviceReadReportResponder {
1250 control_handle: std::mem::ManuallyDrop::new(control_handle),
1251 tx_id: header.tx_id,
1252 },
1253 })
1254 }
1255 0x6e20cf64707a4ee4 => {
1256 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1257 let mut req = fidl::new_empty!(
1258 fidl::encoding::EmptyPayload,
1259 fidl::encoding::DefaultFuchsiaResourceDialect
1260 );
1261 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1262 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1263 Ok(DeviceRequest::ReadReports {
1264 responder: DeviceReadReportsResponder {
1265 control_handle: std::mem::ManuallyDrop::new(control_handle),
1266 tx_id: header.tx_id,
1267 },
1268 })
1269 }
1270 0x6198970f9308041c => {
1271 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1272 let mut req = fidl::new_empty!(
1273 fidl::encoding::EmptyPayload,
1274 fidl::encoding::DefaultFuchsiaResourceDialect
1275 );
1276 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1277 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1278 Ok(DeviceRequest::GetReportsEvent {
1279 responder: DeviceGetReportsEventResponder {
1280 control_handle: std::mem::ManuallyDrop::new(control_handle),
1281 tx_id: header.tx_id,
1282 },
1283 })
1284 }
1285 0x5b2a44555defd970 => {
1286 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1287 let mut req = fidl::new_empty!(
1288 DeviceGetReportRequest,
1289 fidl::encoding::DefaultFuchsiaResourceDialect
1290 );
1291 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceGetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1292 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1293 Ok(DeviceRequest::GetReport {
1294 type_: req.type_,
1295 id: req.id,
1296
1297 responder: DeviceGetReportResponder {
1298 control_handle: std::mem::ManuallyDrop::new(control_handle),
1299 tx_id: header.tx_id,
1300 },
1301 })
1302 }
1303 0x51cc85eb4e769ee => {
1304 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1305 let mut req = fidl::new_empty!(
1306 DeviceSetReportRequest,
1307 fidl::encoding::DefaultFuchsiaResourceDialect
1308 );
1309 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1310 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1311 Ok(DeviceRequest::SetReport {
1312 type_: req.type_,
1313 id: req.id,
1314 report: req.report,
1315
1316 responder: DeviceSetReportResponder {
1317 control_handle: std::mem::ManuallyDrop::new(control_handle),
1318 tx_id: header.tx_id,
1319 },
1320 })
1321 }
1322 0x7fe8815219c66700 => {
1323 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1324 let mut req = fidl::new_empty!(
1325 DeviceSetTraceIdRequest,
1326 fidl::encoding::DefaultFuchsiaResourceDialect
1327 );
1328 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceSetTraceIdRequest>(&header, _body_bytes, handles, &mut req)?;
1329 let control_handle = DeviceControlHandle { inner: this.inner.clone() };
1330 Ok(DeviceRequest::SetTraceId { id: req.id, control_handle })
1331 }
1332 _ => Err(fidl::Error::UnknownOrdinal {
1333 ordinal: header.ordinal,
1334 protocol_name:
1335 <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1336 }),
1337 }))
1338 },
1339 )
1340 }
1341}
1342
1343#[derive(Debug)]
1344pub enum DeviceRequest {
1345 Query { responder: DeviceQueryResponder },
1347 GetReportDesc { responder: DeviceGetReportDescResponder },
1349 GetDeviceReportsReader {
1352 reader: fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
1353 responder: DeviceGetDeviceReportsReaderResponder,
1354 },
1355 ReadReport { responder: DeviceReadReportResponder },
1361 ReadReports { responder: DeviceReadReportsResponder },
1369 GetReportsEvent { responder: DeviceGetReportsEventResponder },
1374 GetReport {
1378 type_: fidl_fuchsia_hardware_hidbus::ReportType,
1379 id: u8,
1380 responder: DeviceGetReportResponder,
1381 },
1382 SetReport {
1384 type_: fidl_fuchsia_hardware_hidbus::ReportType,
1385 id: u8,
1386 report: Vec<u8>,
1387 responder: DeviceSetReportResponder,
1388 },
1389 SetTraceId { id: u32, control_handle: DeviceControlHandle },
1391}
1392
1393impl DeviceRequest {
1394 #[allow(irrefutable_let_patterns)]
1395 pub fn into_query(self) -> Option<(DeviceQueryResponder)> {
1396 if let DeviceRequest::Query { responder } = self {
1397 Some((responder))
1398 } else {
1399 None
1400 }
1401 }
1402
1403 #[allow(irrefutable_let_patterns)]
1404 pub fn into_get_report_desc(self) -> Option<(DeviceGetReportDescResponder)> {
1405 if let DeviceRequest::GetReportDesc { responder } = self {
1406 Some((responder))
1407 } else {
1408 None
1409 }
1410 }
1411
1412 #[allow(irrefutable_let_patterns)]
1413 pub fn into_get_device_reports_reader(
1414 self,
1415 ) -> Option<(
1416 fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>,
1417 DeviceGetDeviceReportsReaderResponder,
1418 )> {
1419 if let DeviceRequest::GetDeviceReportsReader { reader, responder } = self {
1420 Some((reader, responder))
1421 } else {
1422 None
1423 }
1424 }
1425
1426 #[allow(irrefutable_let_patterns)]
1427 pub fn into_read_report(self) -> Option<(DeviceReadReportResponder)> {
1428 if let DeviceRequest::ReadReport { responder } = self {
1429 Some((responder))
1430 } else {
1431 None
1432 }
1433 }
1434
1435 #[allow(irrefutable_let_patterns)]
1436 pub fn into_read_reports(self) -> Option<(DeviceReadReportsResponder)> {
1437 if let DeviceRequest::ReadReports { responder } = self {
1438 Some((responder))
1439 } else {
1440 None
1441 }
1442 }
1443
1444 #[allow(irrefutable_let_patterns)]
1445 pub fn into_get_reports_event(self) -> Option<(DeviceGetReportsEventResponder)> {
1446 if let DeviceRequest::GetReportsEvent { responder } = self {
1447 Some((responder))
1448 } else {
1449 None
1450 }
1451 }
1452
1453 #[allow(irrefutable_let_patterns)]
1454 pub fn into_get_report(
1455 self,
1456 ) -> Option<(fidl_fuchsia_hardware_hidbus::ReportType, u8, DeviceGetReportResponder)> {
1457 if let DeviceRequest::GetReport { type_, id, responder } = self {
1458 Some((type_, id, responder))
1459 } else {
1460 None
1461 }
1462 }
1463
1464 #[allow(irrefutable_let_patterns)]
1465 pub fn into_set_report(
1466 self,
1467 ) -> Option<(fidl_fuchsia_hardware_hidbus::ReportType, u8, Vec<u8>, DeviceSetReportResponder)>
1468 {
1469 if let DeviceRequest::SetReport { type_, id, report, responder } = self {
1470 Some((type_, id, report, responder))
1471 } else {
1472 None
1473 }
1474 }
1475
1476 #[allow(irrefutable_let_patterns)]
1477 pub fn into_set_trace_id(self) -> Option<(u32, DeviceControlHandle)> {
1478 if let DeviceRequest::SetTraceId { id, control_handle } = self {
1479 Some((id, control_handle))
1480 } else {
1481 None
1482 }
1483 }
1484
1485 pub fn method_name(&self) -> &'static str {
1487 match *self {
1488 DeviceRequest::Query { .. } => "query",
1489 DeviceRequest::GetReportDesc { .. } => "get_report_desc",
1490 DeviceRequest::GetDeviceReportsReader { .. } => "get_device_reports_reader",
1491 DeviceRequest::ReadReport { .. } => "read_report",
1492 DeviceRequest::ReadReports { .. } => "read_reports",
1493 DeviceRequest::GetReportsEvent { .. } => "get_reports_event",
1494 DeviceRequest::GetReport { .. } => "get_report",
1495 DeviceRequest::SetReport { .. } => "set_report",
1496 DeviceRequest::SetTraceId { .. } => "set_trace_id",
1497 }
1498 }
1499}
1500
1501#[derive(Debug, Clone)]
1502pub struct DeviceControlHandle {
1503 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1504}
1505
1506impl fidl::endpoints::ControlHandle for DeviceControlHandle {
1507 fn shutdown(&self) {
1508 self.inner.shutdown()
1509 }
1510 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1511 self.inner.shutdown_with_epitaph(status)
1512 }
1513
1514 fn is_closed(&self) -> bool {
1515 self.inner.channel().is_closed()
1516 }
1517 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1518 self.inner.channel().on_closed()
1519 }
1520
1521 #[cfg(target_os = "fuchsia")]
1522 fn signal_peer(
1523 &self,
1524 clear_mask: zx::Signals,
1525 set_mask: zx::Signals,
1526 ) -> Result<(), zx_status::Status> {
1527 use fidl::Peered;
1528 self.inner.channel().signal_peer(clear_mask, set_mask)
1529 }
1530}
1531
1532impl DeviceControlHandle {}
1533
1534#[must_use = "FIDL methods require a response to be sent"]
1535#[derive(Debug)]
1536pub struct DeviceQueryResponder {
1537 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1538 tx_id: u32,
1539}
1540
1541impl std::ops::Drop for DeviceQueryResponder {
1545 fn drop(&mut self) {
1546 self.control_handle.shutdown();
1547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1549 }
1550}
1551
1552impl fidl::endpoints::Responder for DeviceQueryResponder {
1553 type ControlHandle = DeviceControlHandle;
1554
1555 fn control_handle(&self) -> &DeviceControlHandle {
1556 &self.control_handle
1557 }
1558
1559 fn drop_without_shutdown(mut self) {
1560 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1562 std::mem::forget(self);
1564 }
1565}
1566
1567impl DeviceQueryResponder {
1568 pub fn send(
1572 self,
1573 mut result: Result<&fidl_fuchsia_hardware_hidbus::HidInfo, i32>,
1574 ) -> Result<(), fidl::Error> {
1575 let _result = self.send_raw(result);
1576 if _result.is_err() {
1577 self.control_handle.shutdown();
1578 }
1579 self.drop_without_shutdown();
1580 _result
1581 }
1582
1583 pub fn send_no_shutdown_on_err(
1585 self,
1586 mut result: Result<&fidl_fuchsia_hardware_hidbus::HidInfo, i32>,
1587 ) -> Result<(), fidl::Error> {
1588 let _result = self.send_raw(result);
1589 self.drop_without_shutdown();
1590 _result
1591 }
1592
1593 fn send_raw(
1594 &self,
1595 mut result: Result<&fidl_fuchsia_hardware_hidbus::HidInfo, i32>,
1596 ) -> Result<(), fidl::Error> {
1597 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceQueryResponse, i32>>(
1598 result.map(|info| (info,)),
1599 self.tx_id,
1600 0x6d1d90313259dae3,
1601 fidl::encoding::DynamicFlags::empty(),
1602 )
1603 }
1604}
1605
1606#[must_use = "FIDL methods require a response to be sent"]
1607#[derive(Debug)]
1608pub struct DeviceGetReportDescResponder {
1609 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1610 tx_id: u32,
1611}
1612
1613impl std::ops::Drop for DeviceGetReportDescResponder {
1617 fn drop(&mut self) {
1618 self.control_handle.shutdown();
1619 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1621 }
1622}
1623
1624impl fidl::endpoints::Responder for DeviceGetReportDescResponder {
1625 type ControlHandle = DeviceControlHandle;
1626
1627 fn control_handle(&self) -> &DeviceControlHandle {
1628 &self.control_handle
1629 }
1630
1631 fn drop_without_shutdown(mut self) {
1632 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1634 std::mem::forget(self);
1636 }
1637}
1638
1639impl DeviceGetReportDescResponder {
1640 pub fn send(self, mut desc: &[u8]) -> Result<(), fidl::Error> {
1644 let _result = self.send_raw(desc);
1645 if _result.is_err() {
1646 self.control_handle.shutdown();
1647 }
1648 self.drop_without_shutdown();
1649 _result
1650 }
1651
1652 pub fn send_no_shutdown_on_err(self, mut desc: &[u8]) -> Result<(), fidl::Error> {
1654 let _result = self.send_raw(desc);
1655 self.drop_without_shutdown();
1656 _result
1657 }
1658
1659 fn send_raw(&self, mut desc: &[u8]) -> Result<(), fidl::Error> {
1660 self.control_handle.inner.send::<DeviceGetReportDescResponse>(
1661 (desc,),
1662 self.tx_id,
1663 0x7fe4aff57d9019f8,
1664 fidl::encoding::DynamicFlags::empty(),
1665 )
1666 }
1667}
1668
1669#[must_use = "FIDL methods require a response to be sent"]
1670#[derive(Debug)]
1671pub struct DeviceGetDeviceReportsReaderResponder {
1672 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1673 tx_id: u32,
1674}
1675
1676impl std::ops::Drop for DeviceGetDeviceReportsReaderResponder {
1680 fn drop(&mut self) {
1681 self.control_handle.shutdown();
1682 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1684 }
1685}
1686
1687impl fidl::endpoints::Responder for DeviceGetDeviceReportsReaderResponder {
1688 type ControlHandle = DeviceControlHandle;
1689
1690 fn control_handle(&self) -> &DeviceControlHandle {
1691 &self.control_handle
1692 }
1693
1694 fn drop_without_shutdown(mut self) {
1695 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1697 std::mem::forget(self);
1699 }
1700}
1701
1702impl DeviceGetDeviceReportsReaderResponder {
1703 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1707 let _result = self.send_raw(result);
1708 if _result.is_err() {
1709 self.control_handle.shutdown();
1710 }
1711 self.drop_without_shutdown();
1712 _result
1713 }
1714
1715 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1717 let _result = self.send_raw(result);
1718 self.drop_without_shutdown();
1719 _result
1720 }
1721
1722 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1723 self.control_handle
1724 .inner
1725 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1726 result,
1727 self.tx_id,
1728 0x67aee4993bb823ee,
1729 fidl::encoding::DynamicFlags::empty(),
1730 )
1731 }
1732}
1733
1734#[must_use = "FIDL methods require a response to be sent"]
1735#[derive(Debug)]
1736pub struct DeviceReadReportResponder {
1737 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1738 tx_id: u32,
1739}
1740
1741impl std::ops::Drop for DeviceReadReportResponder {
1745 fn drop(&mut self) {
1746 self.control_handle.shutdown();
1747 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1749 }
1750}
1751
1752impl fidl::endpoints::Responder for DeviceReadReportResponder {
1753 type ControlHandle = DeviceControlHandle;
1754
1755 fn control_handle(&self) -> &DeviceControlHandle {
1756 &self.control_handle
1757 }
1758
1759 fn drop_without_shutdown(mut self) {
1760 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1762 std::mem::forget(self);
1764 }
1765}
1766
1767impl DeviceReadReportResponder {
1768 pub fn send(
1772 self,
1773 mut result: Result<fidl_fuchsia_hardware_hidbus::Report, i32>,
1774 ) -> Result<(), fidl::Error> {
1775 let _result = self.send_raw(result);
1776 if _result.is_err() {
1777 self.control_handle.shutdown();
1778 }
1779 self.drop_without_shutdown();
1780 _result
1781 }
1782
1783 pub fn send_no_shutdown_on_err(
1785 self,
1786 mut result: Result<fidl_fuchsia_hardware_hidbus::Report, i32>,
1787 ) -> Result<(), fidl::Error> {
1788 let _result = self.send_raw(result);
1789 self.drop_without_shutdown();
1790 _result
1791 }
1792
1793 fn send_raw(
1794 &self,
1795 mut result: Result<fidl_fuchsia_hardware_hidbus::Report, i32>,
1796 ) -> Result<(), fidl::Error> {
1797 self.control_handle.inner.send::<fidl::encoding::ResultType<
1798 fidl_fuchsia_hardware_hidbus::Report,
1799 i32,
1800 >>(
1801 result.as_mut().map_err(|e| *e),
1802 self.tx_id,
1803 0x69871e1e2b75e46f,
1804 fidl::encoding::DynamicFlags::empty(),
1805 )
1806 }
1807}
1808
1809#[must_use = "FIDL methods require a response to be sent"]
1810#[derive(Debug)]
1811pub struct DeviceReadReportsResponder {
1812 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1813 tx_id: u32,
1814}
1815
1816impl std::ops::Drop for DeviceReadReportsResponder {
1820 fn drop(&mut self) {
1821 self.control_handle.shutdown();
1822 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1824 }
1825}
1826
1827impl fidl::endpoints::Responder for DeviceReadReportsResponder {
1828 type ControlHandle = DeviceControlHandle;
1829
1830 fn control_handle(&self) -> &DeviceControlHandle {
1831 &self.control_handle
1832 }
1833
1834 fn drop_without_shutdown(mut self) {
1835 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1837 std::mem::forget(self);
1839 }
1840}
1841
1842impl DeviceReadReportsResponder {
1843 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1847 let _result = self.send_raw(result);
1848 if _result.is_err() {
1849 self.control_handle.shutdown();
1850 }
1851 self.drop_without_shutdown();
1852 _result
1853 }
1854
1855 pub fn send_no_shutdown_on_err(
1857 self,
1858 mut result: Result<&[u8], i32>,
1859 ) -> Result<(), fidl::Error> {
1860 let _result = self.send_raw(result);
1861 self.drop_without_shutdown();
1862 _result
1863 }
1864
1865 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1866 self.control_handle
1867 .inner
1868 .send::<fidl::encoding::ResultType<DeviceReadReportsResponse, i32>>(
1869 result.map(|data| (data,)),
1870 self.tx_id,
1871 0x6e20cf64707a4ee4,
1872 fidl::encoding::DynamicFlags::empty(),
1873 )
1874 }
1875}
1876
1877#[must_use = "FIDL methods require a response to be sent"]
1878#[derive(Debug)]
1879pub struct DeviceGetReportsEventResponder {
1880 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1881 tx_id: u32,
1882}
1883
1884impl std::ops::Drop for DeviceGetReportsEventResponder {
1888 fn drop(&mut self) {
1889 self.control_handle.shutdown();
1890 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1892 }
1893}
1894
1895impl fidl::endpoints::Responder for DeviceGetReportsEventResponder {
1896 type ControlHandle = DeviceControlHandle;
1897
1898 fn control_handle(&self) -> &DeviceControlHandle {
1899 &self.control_handle
1900 }
1901
1902 fn drop_without_shutdown(mut self) {
1903 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1905 std::mem::forget(self);
1907 }
1908}
1909
1910impl DeviceGetReportsEventResponder {
1911 pub fn send(self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
1915 let _result = self.send_raw(result);
1916 if _result.is_err() {
1917 self.control_handle.shutdown();
1918 }
1919 self.drop_without_shutdown();
1920 _result
1921 }
1922
1923 pub fn send_no_shutdown_on_err(
1925 self,
1926 mut result: Result<fidl::Event, i32>,
1927 ) -> Result<(), fidl::Error> {
1928 let _result = self.send_raw(result);
1929 self.drop_without_shutdown();
1930 _result
1931 }
1932
1933 fn send_raw(&self, mut result: Result<fidl::Event, i32>) -> Result<(), fidl::Error> {
1934 self.control_handle
1935 .inner
1936 .send::<fidl::encoding::ResultType<DeviceGetReportsEventResponse, i32>>(
1937 result.map(|event| (event,)),
1938 self.tx_id,
1939 0x6198970f9308041c,
1940 fidl::encoding::DynamicFlags::empty(),
1941 )
1942 }
1943}
1944
1945#[must_use = "FIDL methods require a response to be sent"]
1946#[derive(Debug)]
1947pub struct DeviceGetReportResponder {
1948 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
1949 tx_id: u32,
1950}
1951
1952impl std::ops::Drop for DeviceGetReportResponder {
1956 fn drop(&mut self) {
1957 self.control_handle.shutdown();
1958 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1960 }
1961}
1962
1963impl fidl::endpoints::Responder for DeviceGetReportResponder {
1964 type ControlHandle = DeviceControlHandle;
1965
1966 fn control_handle(&self) -> &DeviceControlHandle {
1967 &self.control_handle
1968 }
1969
1970 fn drop_without_shutdown(mut self) {
1971 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1973 std::mem::forget(self);
1975 }
1976}
1977
1978impl DeviceGetReportResponder {
1979 pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1983 let _result = self.send_raw(result);
1984 if _result.is_err() {
1985 self.control_handle.shutdown();
1986 }
1987 self.drop_without_shutdown();
1988 _result
1989 }
1990
1991 pub fn send_no_shutdown_on_err(
1993 self,
1994 mut result: Result<&[u8], i32>,
1995 ) -> Result<(), fidl::Error> {
1996 let _result = self.send_raw(result);
1997 self.drop_without_shutdown();
1998 _result
1999 }
2000
2001 fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2002 self.control_handle.inner.send::<fidl::encoding::ResultType<DeviceGetReportResponse, i32>>(
2003 result.map(|report| (report,)),
2004 self.tx_id,
2005 0x5b2a44555defd970,
2006 fidl::encoding::DynamicFlags::empty(),
2007 )
2008 }
2009}
2010
2011#[must_use = "FIDL methods require a response to be sent"]
2012#[derive(Debug)]
2013pub struct DeviceSetReportResponder {
2014 control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
2015 tx_id: u32,
2016}
2017
2018impl std::ops::Drop for DeviceSetReportResponder {
2022 fn drop(&mut self) {
2023 self.control_handle.shutdown();
2024 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2026 }
2027}
2028
2029impl fidl::endpoints::Responder for DeviceSetReportResponder {
2030 type ControlHandle = DeviceControlHandle;
2031
2032 fn control_handle(&self) -> &DeviceControlHandle {
2033 &self.control_handle
2034 }
2035
2036 fn drop_without_shutdown(mut self) {
2037 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2039 std::mem::forget(self);
2041 }
2042}
2043
2044impl DeviceSetReportResponder {
2045 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2049 let _result = self.send_raw(result);
2050 if _result.is_err() {
2051 self.control_handle.shutdown();
2052 }
2053 self.drop_without_shutdown();
2054 _result
2055 }
2056
2057 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2059 let _result = self.send_raw(result);
2060 self.drop_without_shutdown();
2061 _result
2062 }
2063
2064 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2065 self.control_handle
2066 .inner
2067 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2068 result,
2069 self.tx_id,
2070 0x51cc85eb4e769ee,
2071 fidl::encoding::DynamicFlags::empty(),
2072 )
2073 }
2074}
2075
2076#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2077pub struct DeviceReportsReaderMarker;
2078
2079impl fidl::endpoints::ProtocolMarker for DeviceReportsReaderMarker {
2080 type Proxy = DeviceReportsReaderProxy;
2081 type RequestStream = DeviceReportsReaderRequestStream;
2082 #[cfg(target_os = "fuchsia")]
2083 type SynchronousProxy = DeviceReportsReaderSynchronousProxy;
2084
2085 const DEBUG_NAME: &'static str = "(anonymous) DeviceReportsReader";
2086}
2087pub type DeviceReportsReaderReadReportsResult =
2088 Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>;
2089
2090pub trait DeviceReportsReaderProxyInterface: Send + Sync {
2091 type ReadReportsResponseFut: std::future::Future<Output = Result<DeviceReportsReaderReadReportsResult, fidl::Error>>
2092 + Send;
2093 fn r#read_reports(&self) -> Self::ReadReportsResponseFut;
2094}
2095#[derive(Debug)]
2096#[cfg(target_os = "fuchsia")]
2097pub struct DeviceReportsReaderSynchronousProxy {
2098 client: fidl::client::sync::Client,
2099}
2100
2101#[cfg(target_os = "fuchsia")]
2102impl fidl::endpoints::SynchronousProxy for DeviceReportsReaderSynchronousProxy {
2103 type Proxy = DeviceReportsReaderProxy;
2104 type Protocol = DeviceReportsReaderMarker;
2105
2106 fn from_channel(inner: fidl::Channel) -> Self {
2107 Self::new(inner)
2108 }
2109
2110 fn into_channel(self) -> fidl::Channel {
2111 self.client.into_channel()
2112 }
2113
2114 fn as_channel(&self) -> &fidl::Channel {
2115 self.client.as_channel()
2116 }
2117}
2118
2119#[cfg(target_os = "fuchsia")]
2120impl DeviceReportsReaderSynchronousProxy {
2121 pub fn new(channel: fidl::Channel) -> Self {
2122 let protocol_name =
2123 <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2124 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2125 }
2126
2127 pub fn into_channel(self) -> fidl::Channel {
2128 self.client.into_channel()
2129 }
2130
2131 pub fn wait_for_event(
2134 &self,
2135 deadline: zx::MonotonicInstant,
2136 ) -> Result<DeviceReportsReaderEvent, fidl::Error> {
2137 DeviceReportsReaderEvent::decode(self.client.wait_for_event(deadline)?)
2138 }
2139
2140 pub fn r#read_reports(
2145 &self,
2146 ___deadline: zx::MonotonicInstant,
2147 ) -> Result<DeviceReportsReaderReadReportsResult, fidl::Error> {
2148 let _response = self.client.send_query::<
2149 fidl::encoding::EmptyPayload,
2150 fidl::encoding::ResultType<DeviceReportsReaderReadReportsResponse, i32>,
2151 >(
2152 (),
2153 0x36077c1b177d4291,
2154 fidl::encoding::DynamicFlags::empty(),
2155 ___deadline,
2156 )?;
2157 Ok(_response.map(|x| x.reports))
2158 }
2159}
2160
2161#[derive(Debug, Clone)]
2162pub struct DeviceReportsReaderProxy {
2163 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2164}
2165
2166impl fidl::endpoints::Proxy for DeviceReportsReaderProxy {
2167 type Protocol = DeviceReportsReaderMarker;
2168
2169 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2170 Self::new(inner)
2171 }
2172
2173 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2174 self.client.into_channel().map_err(|client| Self { client })
2175 }
2176
2177 fn as_channel(&self) -> &::fidl::AsyncChannel {
2178 self.client.as_channel()
2179 }
2180}
2181
2182impl DeviceReportsReaderProxy {
2183 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2185 let protocol_name =
2186 <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2187 Self { client: fidl::client::Client::new(channel, protocol_name) }
2188 }
2189
2190 pub fn take_event_stream(&self) -> DeviceReportsReaderEventStream {
2196 DeviceReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
2197 }
2198
2199 pub fn r#read_reports(
2204 &self,
2205 ) -> fidl::client::QueryResponseFut<
2206 DeviceReportsReaderReadReportsResult,
2207 fidl::encoding::DefaultFuchsiaResourceDialect,
2208 > {
2209 DeviceReportsReaderProxyInterface::r#read_reports(self)
2210 }
2211}
2212
2213impl DeviceReportsReaderProxyInterface for DeviceReportsReaderProxy {
2214 type ReadReportsResponseFut = fidl::client::QueryResponseFut<
2215 DeviceReportsReaderReadReportsResult,
2216 fidl::encoding::DefaultFuchsiaResourceDialect,
2217 >;
2218 fn r#read_reports(&self) -> Self::ReadReportsResponseFut {
2219 fn _decode(
2220 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2221 ) -> Result<DeviceReportsReaderReadReportsResult, fidl::Error> {
2222 let _response = fidl::client::decode_transaction_body::<
2223 fidl::encoding::ResultType<DeviceReportsReaderReadReportsResponse, i32>,
2224 fidl::encoding::DefaultFuchsiaResourceDialect,
2225 0x36077c1b177d4291,
2226 >(_buf?)?;
2227 Ok(_response.map(|x| x.reports))
2228 }
2229 self.client.send_query_and_decode::<
2230 fidl::encoding::EmptyPayload,
2231 DeviceReportsReaderReadReportsResult,
2232 >(
2233 (),
2234 0x36077c1b177d4291,
2235 fidl::encoding::DynamicFlags::empty(),
2236 _decode,
2237 )
2238 }
2239}
2240
2241pub struct DeviceReportsReaderEventStream {
2242 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2243}
2244
2245impl std::marker::Unpin for DeviceReportsReaderEventStream {}
2246
2247impl futures::stream::FusedStream for DeviceReportsReaderEventStream {
2248 fn is_terminated(&self) -> bool {
2249 self.event_receiver.is_terminated()
2250 }
2251}
2252
2253impl futures::Stream for DeviceReportsReaderEventStream {
2254 type Item = Result<DeviceReportsReaderEvent, fidl::Error>;
2255
2256 fn poll_next(
2257 mut self: std::pin::Pin<&mut Self>,
2258 cx: &mut std::task::Context<'_>,
2259 ) -> std::task::Poll<Option<Self::Item>> {
2260 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2261 &mut self.event_receiver,
2262 cx
2263 )?) {
2264 Some(buf) => std::task::Poll::Ready(Some(DeviceReportsReaderEvent::decode(buf))),
2265 None => std::task::Poll::Ready(None),
2266 }
2267 }
2268}
2269
2270#[derive(Debug)]
2271pub enum DeviceReportsReaderEvent {}
2272
2273impl DeviceReportsReaderEvent {
2274 fn decode(
2276 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2277 ) -> Result<DeviceReportsReaderEvent, fidl::Error> {
2278 let (bytes, _handles) = buf.split_mut();
2279 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2280 debug_assert_eq!(tx_header.tx_id, 0);
2281 match tx_header.ordinal {
2282 _ => Err(fidl::Error::UnknownOrdinal {
2283 ordinal: tx_header.ordinal,
2284 protocol_name:
2285 <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2286 }),
2287 }
2288 }
2289}
2290
2291pub struct DeviceReportsReaderRequestStream {
2293 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2294 is_terminated: bool,
2295}
2296
2297impl std::marker::Unpin for DeviceReportsReaderRequestStream {}
2298
2299impl futures::stream::FusedStream for DeviceReportsReaderRequestStream {
2300 fn is_terminated(&self) -> bool {
2301 self.is_terminated
2302 }
2303}
2304
2305impl fidl::endpoints::RequestStream for DeviceReportsReaderRequestStream {
2306 type Protocol = DeviceReportsReaderMarker;
2307 type ControlHandle = DeviceReportsReaderControlHandle;
2308
2309 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2310 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2311 }
2312
2313 fn control_handle(&self) -> Self::ControlHandle {
2314 DeviceReportsReaderControlHandle { inner: self.inner.clone() }
2315 }
2316
2317 fn into_inner(
2318 self,
2319 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2320 {
2321 (self.inner, self.is_terminated)
2322 }
2323
2324 fn from_inner(
2325 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2326 is_terminated: bool,
2327 ) -> Self {
2328 Self { inner, is_terminated }
2329 }
2330}
2331
2332impl futures::Stream for DeviceReportsReaderRequestStream {
2333 type Item = Result<DeviceReportsReaderRequest, fidl::Error>;
2334
2335 fn poll_next(
2336 mut self: std::pin::Pin<&mut Self>,
2337 cx: &mut std::task::Context<'_>,
2338 ) -> std::task::Poll<Option<Self::Item>> {
2339 let this = &mut *self;
2340 if this.inner.check_shutdown(cx) {
2341 this.is_terminated = true;
2342 return std::task::Poll::Ready(None);
2343 }
2344 if this.is_terminated {
2345 panic!("polled DeviceReportsReaderRequestStream after completion");
2346 }
2347 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2348 |bytes, handles| {
2349 match this.inner.channel().read_etc(cx, bytes, handles) {
2350 std::task::Poll::Ready(Ok(())) => {}
2351 std::task::Poll::Pending => return std::task::Poll::Pending,
2352 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2353 this.is_terminated = true;
2354 return std::task::Poll::Ready(None);
2355 }
2356 std::task::Poll::Ready(Err(e)) => {
2357 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2358 e.into(),
2359 ))))
2360 }
2361 }
2362
2363 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2365
2366 std::task::Poll::Ready(Some(match header.ordinal {
2367 0x36077c1b177d4291 => {
2368 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2369 let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2370 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2371 let control_handle = DeviceReportsReaderControlHandle {
2372 inner: this.inner.clone(),
2373 };
2374 Ok(DeviceReportsReaderRequest::ReadReports {
2375 responder: DeviceReportsReaderReadReportsResponder {
2376 control_handle: std::mem::ManuallyDrop::new(control_handle),
2377 tx_id: header.tx_id,
2378 },
2379 })
2380 }
2381 _ => Err(fidl::Error::UnknownOrdinal {
2382 ordinal: header.ordinal,
2383 protocol_name: <DeviceReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2384 }),
2385 }))
2386 },
2387 )
2388 }
2389}
2390
2391#[derive(Debug)]
2395pub enum DeviceReportsReaderRequest {
2396 ReadReports { responder: DeviceReportsReaderReadReportsResponder },
2401}
2402
2403impl DeviceReportsReaderRequest {
2404 #[allow(irrefutable_let_patterns)]
2405 pub fn into_read_reports(self) -> Option<(DeviceReportsReaderReadReportsResponder)> {
2406 if let DeviceReportsReaderRequest::ReadReports { responder } = self {
2407 Some((responder))
2408 } else {
2409 None
2410 }
2411 }
2412
2413 pub fn method_name(&self) -> &'static str {
2415 match *self {
2416 DeviceReportsReaderRequest::ReadReports { .. } => "read_reports",
2417 }
2418 }
2419}
2420
2421#[derive(Debug, Clone)]
2422pub struct DeviceReportsReaderControlHandle {
2423 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2424}
2425
2426impl fidl::endpoints::ControlHandle for DeviceReportsReaderControlHandle {
2427 fn shutdown(&self) {
2428 self.inner.shutdown()
2429 }
2430 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2431 self.inner.shutdown_with_epitaph(status)
2432 }
2433
2434 fn is_closed(&self) -> bool {
2435 self.inner.channel().is_closed()
2436 }
2437 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2438 self.inner.channel().on_closed()
2439 }
2440
2441 #[cfg(target_os = "fuchsia")]
2442 fn signal_peer(
2443 &self,
2444 clear_mask: zx::Signals,
2445 set_mask: zx::Signals,
2446 ) -> Result<(), zx_status::Status> {
2447 use fidl::Peered;
2448 self.inner.channel().signal_peer(clear_mask, set_mask)
2449 }
2450}
2451
2452impl DeviceReportsReaderControlHandle {}
2453
2454#[must_use = "FIDL methods require a response to be sent"]
2455#[derive(Debug)]
2456pub struct DeviceReportsReaderReadReportsResponder {
2457 control_handle: std::mem::ManuallyDrop<DeviceReportsReaderControlHandle>,
2458 tx_id: u32,
2459}
2460
2461impl std::ops::Drop for DeviceReportsReaderReadReportsResponder {
2465 fn drop(&mut self) {
2466 self.control_handle.shutdown();
2467 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2469 }
2470}
2471
2472impl fidl::endpoints::Responder for DeviceReportsReaderReadReportsResponder {
2473 type ControlHandle = DeviceReportsReaderControlHandle;
2474
2475 fn control_handle(&self) -> &DeviceReportsReaderControlHandle {
2476 &self.control_handle
2477 }
2478
2479 fn drop_without_shutdown(mut self) {
2480 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2482 std::mem::forget(self);
2484 }
2485}
2486
2487impl DeviceReportsReaderReadReportsResponder {
2488 pub fn send(
2492 self,
2493 mut result: Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>,
2494 ) -> Result<(), fidl::Error> {
2495 let _result = self.send_raw(result);
2496 if _result.is_err() {
2497 self.control_handle.shutdown();
2498 }
2499 self.drop_without_shutdown();
2500 _result
2501 }
2502
2503 pub fn send_no_shutdown_on_err(
2505 self,
2506 mut result: Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>,
2507 ) -> Result<(), fidl::Error> {
2508 let _result = self.send_raw(result);
2509 self.drop_without_shutdown();
2510 _result
2511 }
2512
2513 fn send_raw(
2514 &self,
2515 mut result: Result<Vec<fidl_fuchsia_hardware_hidbus::Report>, i32>,
2516 ) -> Result<(), fidl::Error> {
2517 self.control_handle.inner.send::<fidl::encoding::ResultType<
2518 DeviceReportsReaderReadReportsResponse,
2519 i32,
2520 >>(
2521 result.as_mut().map_err(|e| *e).map(|reports| (reports.as_mut_slice(),)),
2522 self.tx_id,
2523 0x36077c1b177d4291,
2524 fidl::encoding::DynamicFlags::empty(),
2525 )
2526 }
2527}
2528
2529#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2530pub struct ServiceMarker;
2531
2532#[cfg(target_os = "fuchsia")]
2533impl fidl::endpoints::ServiceMarker for ServiceMarker {
2534 type Proxy = ServiceProxy;
2535 type Request = ServiceRequest;
2536 const SERVICE_NAME: &'static str = "fuchsia.hardware.input.Service";
2537}
2538
2539#[cfg(target_os = "fuchsia")]
2542pub enum ServiceRequest {
2543 Controller(ControllerRequestStream),
2544}
2545
2546#[cfg(target_os = "fuchsia")]
2547impl fidl::endpoints::ServiceRequest for ServiceRequest {
2548 type Service = ServiceMarker;
2549
2550 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2551 match name {
2552 "controller" => Self::Controller(
2553 <ControllerRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2554 ),
2555 _ => panic!("no such member protocol name for service Service"),
2556 }
2557 }
2558
2559 fn member_names() -> &'static [&'static str] {
2560 &["controller"]
2561 }
2562}
2563#[cfg(target_os = "fuchsia")]
2564pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2565
2566#[cfg(target_os = "fuchsia")]
2567impl fidl::endpoints::ServiceProxy for ServiceProxy {
2568 type Service = ServiceMarker;
2569
2570 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2571 Self(opener)
2572 }
2573}
2574
2575#[cfg(target_os = "fuchsia")]
2576impl ServiceProxy {
2577 pub fn connect_to_controller(&self) -> Result<ControllerProxy, fidl::Error> {
2578 let (proxy, server_end) = fidl::endpoints::create_proxy::<ControllerMarker>();
2579 self.connect_channel_to_controller(server_end)?;
2580 Ok(proxy)
2581 }
2582
2583 pub fn connect_to_controller_sync(&self) -> Result<ControllerSynchronousProxy, fidl::Error> {
2586 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ControllerMarker>();
2587 self.connect_channel_to_controller(server_end)?;
2588 Ok(proxy)
2589 }
2590
2591 pub fn connect_channel_to_controller(
2594 &self,
2595 server_end: fidl::endpoints::ServerEnd<ControllerMarker>,
2596 ) -> Result<(), fidl::Error> {
2597 self.0.open_member("controller", server_end.into_channel())
2598 }
2599
2600 pub fn instance_name(&self) -> &str {
2601 self.0.instance_name()
2602 }
2603}
2604
2605mod internal {
2606 use super::*;
2607
2608 impl fidl::encoding::ResourceTypeMarker for ControllerOpenSessionRequest {
2609 type Borrowed<'a> = &'a mut Self;
2610 fn take_or_borrow<'a>(
2611 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2612 ) -> Self::Borrowed<'a> {
2613 value
2614 }
2615 }
2616
2617 unsafe impl fidl::encoding::TypeMarker for ControllerOpenSessionRequest {
2618 type Owned = Self;
2619
2620 #[inline(always)]
2621 fn inline_align(_context: fidl::encoding::Context) -> usize {
2622 4
2623 }
2624
2625 #[inline(always)]
2626 fn inline_size(_context: fidl::encoding::Context) -> usize {
2627 4
2628 }
2629 }
2630
2631 unsafe impl
2632 fidl::encoding::Encode<
2633 ControllerOpenSessionRequest,
2634 fidl::encoding::DefaultFuchsiaResourceDialect,
2635 > for &mut ControllerOpenSessionRequest
2636 {
2637 #[inline]
2638 unsafe fn encode(
2639 self,
2640 encoder: &mut fidl::encoding::Encoder<
2641 '_,
2642 fidl::encoding::DefaultFuchsiaResourceDialect,
2643 >,
2644 offset: usize,
2645 _depth: fidl::encoding::Depth,
2646 ) -> fidl::Result<()> {
2647 encoder.debug_check_bounds::<ControllerOpenSessionRequest>(offset);
2648 fidl::encoding::Encode::<ControllerOpenSessionRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2650 (
2651 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.session),
2652 ),
2653 encoder, offset, _depth
2654 )
2655 }
2656 }
2657 unsafe impl<
2658 T0: fidl::encoding::Encode<
2659 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2660 fidl::encoding::DefaultFuchsiaResourceDialect,
2661 >,
2662 >
2663 fidl::encoding::Encode<
2664 ControllerOpenSessionRequest,
2665 fidl::encoding::DefaultFuchsiaResourceDialect,
2666 > for (T0,)
2667 {
2668 #[inline]
2669 unsafe fn encode(
2670 self,
2671 encoder: &mut fidl::encoding::Encoder<
2672 '_,
2673 fidl::encoding::DefaultFuchsiaResourceDialect,
2674 >,
2675 offset: usize,
2676 depth: fidl::encoding::Depth,
2677 ) -> fidl::Result<()> {
2678 encoder.debug_check_bounds::<ControllerOpenSessionRequest>(offset);
2679 self.0.encode(encoder, offset + 0, depth)?;
2683 Ok(())
2684 }
2685 }
2686
2687 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2688 for ControllerOpenSessionRequest
2689 {
2690 #[inline(always)]
2691 fn new_empty() -> Self {
2692 Self {
2693 session: fidl::new_empty!(
2694 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2695 fidl::encoding::DefaultFuchsiaResourceDialect
2696 ),
2697 }
2698 }
2699
2700 #[inline]
2701 unsafe fn decode(
2702 &mut self,
2703 decoder: &mut fidl::encoding::Decoder<
2704 '_,
2705 fidl::encoding::DefaultFuchsiaResourceDialect,
2706 >,
2707 offset: usize,
2708 _depth: fidl::encoding::Depth,
2709 ) -> fidl::Result<()> {
2710 decoder.debug_check_bounds::<Self>(offset);
2711 fidl::decode!(
2713 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
2714 fidl::encoding::DefaultFuchsiaResourceDialect,
2715 &mut self.session,
2716 decoder,
2717 offset + 0,
2718 _depth
2719 )?;
2720 Ok(())
2721 }
2722 }
2723
2724 impl fidl::encoding::ResourceTypeMarker for DeviceGetDeviceReportsReaderRequest {
2725 type Borrowed<'a> = &'a mut Self;
2726 fn take_or_borrow<'a>(
2727 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2728 ) -> Self::Borrowed<'a> {
2729 value
2730 }
2731 }
2732
2733 unsafe impl fidl::encoding::TypeMarker for DeviceGetDeviceReportsReaderRequest {
2734 type Owned = Self;
2735
2736 #[inline(always)]
2737 fn inline_align(_context: fidl::encoding::Context) -> usize {
2738 4
2739 }
2740
2741 #[inline(always)]
2742 fn inline_size(_context: fidl::encoding::Context) -> usize {
2743 4
2744 }
2745 }
2746
2747 unsafe impl
2748 fidl::encoding::Encode<
2749 DeviceGetDeviceReportsReaderRequest,
2750 fidl::encoding::DefaultFuchsiaResourceDialect,
2751 > for &mut DeviceGetDeviceReportsReaderRequest
2752 {
2753 #[inline]
2754 unsafe fn encode(
2755 self,
2756 encoder: &mut fidl::encoding::Encoder<
2757 '_,
2758 fidl::encoding::DefaultFuchsiaResourceDialect,
2759 >,
2760 offset: usize,
2761 _depth: fidl::encoding::Depth,
2762 ) -> fidl::Result<()> {
2763 encoder.debug_check_bounds::<DeviceGetDeviceReportsReaderRequest>(offset);
2764 fidl::encoding::Encode::<DeviceGetDeviceReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2766 (
2767 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
2768 ),
2769 encoder, offset, _depth
2770 )
2771 }
2772 }
2773 unsafe impl<
2774 T0: fidl::encoding::Encode<
2775 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>>,
2776 fidl::encoding::DefaultFuchsiaResourceDialect,
2777 >,
2778 >
2779 fidl::encoding::Encode<
2780 DeviceGetDeviceReportsReaderRequest,
2781 fidl::encoding::DefaultFuchsiaResourceDialect,
2782 > for (T0,)
2783 {
2784 #[inline]
2785 unsafe fn encode(
2786 self,
2787 encoder: &mut fidl::encoding::Encoder<
2788 '_,
2789 fidl::encoding::DefaultFuchsiaResourceDialect,
2790 >,
2791 offset: usize,
2792 depth: fidl::encoding::Depth,
2793 ) -> fidl::Result<()> {
2794 encoder.debug_check_bounds::<DeviceGetDeviceReportsReaderRequest>(offset);
2795 self.0.encode(encoder, offset + 0, depth)?;
2799 Ok(())
2800 }
2801 }
2802
2803 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2804 for DeviceGetDeviceReportsReaderRequest
2805 {
2806 #[inline(always)]
2807 fn new_empty() -> Self {
2808 Self {
2809 reader: fidl::new_empty!(
2810 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>>,
2811 fidl::encoding::DefaultFuchsiaResourceDialect
2812 ),
2813 }
2814 }
2815
2816 #[inline]
2817 unsafe fn decode(
2818 &mut self,
2819 decoder: &mut fidl::encoding::Decoder<
2820 '_,
2821 fidl::encoding::DefaultFuchsiaResourceDialect,
2822 >,
2823 offset: usize,
2824 _depth: fidl::encoding::Depth,
2825 ) -> fidl::Result<()> {
2826 decoder.debug_check_bounds::<Self>(offset);
2827 fidl::decode!(
2829 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceReportsReaderMarker>>,
2830 fidl::encoding::DefaultFuchsiaResourceDialect,
2831 &mut self.reader,
2832 decoder,
2833 offset + 0,
2834 _depth
2835 )?;
2836 Ok(())
2837 }
2838 }
2839
2840 impl fidl::encoding::ValueTypeMarker for DeviceGetReportDescResponse {
2841 type Borrowed<'a> = &'a Self;
2842 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2843 value
2844 }
2845 }
2846
2847 unsafe impl fidl::encoding::TypeMarker for DeviceGetReportDescResponse {
2848 type Owned = Self;
2849
2850 #[inline(always)]
2851 fn inline_align(_context: fidl::encoding::Context) -> usize {
2852 8
2853 }
2854
2855 #[inline(always)]
2856 fn inline_size(_context: fidl::encoding::Context) -> usize {
2857 16
2858 }
2859 }
2860
2861 unsafe impl<D: fidl::encoding::ResourceDialect>
2862 fidl::encoding::Encode<DeviceGetReportDescResponse, D> for &DeviceGetReportDescResponse
2863 {
2864 #[inline]
2865 unsafe fn encode(
2866 self,
2867 encoder: &mut fidl::encoding::Encoder<'_, D>,
2868 offset: usize,
2869 _depth: fidl::encoding::Depth,
2870 ) -> fidl::Result<()> {
2871 encoder.debug_check_bounds::<DeviceGetReportDescResponse>(offset);
2872 fidl::encoding::Encode::<DeviceGetReportDescResponse, D>::encode(
2874 (<fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
2875 &self.desc,
2876 ),),
2877 encoder,
2878 offset,
2879 _depth,
2880 )
2881 }
2882 }
2883 unsafe impl<
2884 D: fidl::encoding::ResourceDialect,
2885 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8192>, D>,
2886 > fidl::encoding::Encode<DeviceGetReportDescResponse, D> for (T0,)
2887 {
2888 #[inline]
2889 unsafe fn encode(
2890 self,
2891 encoder: &mut fidl::encoding::Encoder<'_, D>,
2892 offset: usize,
2893 depth: fidl::encoding::Depth,
2894 ) -> fidl::Result<()> {
2895 encoder.debug_check_bounds::<DeviceGetReportDescResponse>(offset);
2896 self.0.encode(encoder, offset + 0, depth)?;
2900 Ok(())
2901 }
2902 }
2903
2904 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2905 for DeviceGetReportDescResponse
2906 {
2907 #[inline(always)]
2908 fn new_empty() -> Self {
2909 Self { desc: fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D) }
2910 }
2911
2912 #[inline]
2913 unsafe fn decode(
2914 &mut self,
2915 decoder: &mut fidl::encoding::Decoder<'_, D>,
2916 offset: usize,
2917 _depth: fidl::encoding::Depth,
2918 ) -> fidl::Result<()> {
2919 decoder.debug_check_bounds::<Self>(offset);
2920 fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, &mut self.desc, decoder, offset + 0, _depth)?;
2922 Ok(())
2923 }
2924 }
2925
2926 impl fidl::encoding::ValueTypeMarker for DeviceGetReportRequest {
2927 type Borrowed<'a> = &'a Self;
2928 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2929 value
2930 }
2931 }
2932
2933 unsafe impl fidl::encoding::TypeMarker for DeviceGetReportRequest {
2934 type Owned = Self;
2935
2936 #[inline(always)]
2937 fn inline_align(_context: fidl::encoding::Context) -> usize {
2938 1
2939 }
2940
2941 #[inline(always)]
2942 fn inline_size(_context: fidl::encoding::Context) -> usize {
2943 2
2944 }
2945 }
2946
2947 unsafe impl<D: fidl::encoding::ResourceDialect>
2948 fidl::encoding::Encode<DeviceGetReportRequest, D> for &DeviceGetReportRequest
2949 {
2950 #[inline]
2951 unsafe fn encode(
2952 self,
2953 encoder: &mut fidl::encoding::Encoder<'_, D>,
2954 offset: usize,
2955 _depth: fidl::encoding::Depth,
2956 ) -> fidl::Result<()> {
2957 encoder.debug_check_bounds::<DeviceGetReportRequest>(offset);
2958 fidl::encoding::Encode::<DeviceGetReportRequest, D>::encode(
2960 (
2961 <fidl_fuchsia_hardware_hidbus::ReportType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
2962 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2963 ),
2964 encoder, offset, _depth
2965 )
2966 }
2967 }
2968 unsafe impl<
2969 D: fidl::encoding::ResourceDialect,
2970 T0: fidl::encoding::Encode<fidl_fuchsia_hardware_hidbus::ReportType, D>,
2971 T1: fidl::encoding::Encode<u8, D>,
2972 > fidl::encoding::Encode<DeviceGetReportRequest, D> for (T0, T1)
2973 {
2974 #[inline]
2975 unsafe fn encode(
2976 self,
2977 encoder: &mut fidl::encoding::Encoder<'_, D>,
2978 offset: usize,
2979 depth: fidl::encoding::Depth,
2980 ) -> fidl::Result<()> {
2981 encoder.debug_check_bounds::<DeviceGetReportRequest>(offset);
2982 self.0.encode(encoder, offset + 0, depth)?;
2986 self.1.encode(encoder, offset + 1, depth)?;
2987 Ok(())
2988 }
2989 }
2990
2991 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2992 for DeviceGetReportRequest
2993 {
2994 #[inline(always)]
2995 fn new_empty() -> Self {
2996 Self {
2997 type_: fidl::new_empty!(fidl_fuchsia_hardware_hidbus::ReportType, D),
2998 id: fidl::new_empty!(u8, D),
2999 }
3000 }
3001
3002 #[inline]
3003 unsafe fn decode(
3004 &mut self,
3005 decoder: &mut fidl::encoding::Decoder<'_, D>,
3006 offset: usize,
3007 _depth: fidl::encoding::Depth,
3008 ) -> fidl::Result<()> {
3009 decoder.debug_check_bounds::<Self>(offset);
3010 fidl::decode!(
3012 fidl_fuchsia_hardware_hidbus::ReportType,
3013 D,
3014 &mut self.type_,
3015 decoder,
3016 offset + 0,
3017 _depth
3018 )?;
3019 fidl::decode!(u8, D, &mut self.id, decoder, offset + 1, _depth)?;
3020 Ok(())
3021 }
3022 }
3023
3024 impl fidl::encoding::ResourceTypeMarker for DeviceReportsReaderReadReportsResponse {
3025 type Borrowed<'a> = &'a mut Self;
3026 fn take_or_borrow<'a>(
3027 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3028 ) -> Self::Borrowed<'a> {
3029 value
3030 }
3031 }
3032
3033 unsafe impl fidl::encoding::TypeMarker for DeviceReportsReaderReadReportsResponse {
3034 type Owned = Self;
3035
3036 #[inline(always)]
3037 fn inline_align(_context: fidl::encoding::Context) -> usize {
3038 8
3039 }
3040
3041 #[inline(always)]
3042 fn inline_size(_context: fidl::encoding::Context) -> usize {
3043 16
3044 }
3045 }
3046
3047 unsafe impl
3048 fidl::encoding::Encode<
3049 DeviceReportsReaderReadReportsResponse,
3050 fidl::encoding::DefaultFuchsiaResourceDialect,
3051 > for &mut DeviceReportsReaderReadReportsResponse
3052 {
3053 #[inline]
3054 unsafe fn encode(
3055 self,
3056 encoder: &mut fidl::encoding::Encoder<
3057 '_,
3058 fidl::encoding::DefaultFuchsiaResourceDialect,
3059 >,
3060 offset: usize,
3061 _depth: fidl::encoding::Depth,
3062 ) -> fidl::Result<()> {
3063 encoder.debug_check_bounds::<DeviceReportsReaderReadReportsResponse>(offset);
3064 fidl::encoding::Encode::<DeviceReportsReaderReadReportsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3066 (
3067 <fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
3068 ),
3069 encoder, offset, _depth
3070 )
3071 }
3072 }
3073 unsafe impl<
3074 T0: fidl::encoding::Encode<
3075 fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50>,
3076 fidl::encoding::DefaultFuchsiaResourceDialect,
3077 >,
3078 >
3079 fidl::encoding::Encode<
3080 DeviceReportsReaderReadReportsResponse,
3081 fidl::encoding::DefaultFuchsiaResourceDialect,
3082 > for (T0,)
3083 {
3084 #[inline]
3085 unsafe fn encode(
3086 self,
3087 encoder: &mut fidl::encoding::Encoder<
3088 '_,
3089 fidl::encoding::DefaultFuchsiaResourceDialect,
3090 >,
3091 offset: usize,
3092 depth: fidl::encoding::Depth,
3093 ) -> fidl::Result<()> {
3094 encoder.debug_check_bounds::<DeviceReportsReaderReadReportsResponse>(offset);
3095 self.0.encode(encoder, offset + 0, depth)?;
3099 Ok(())
3100 }
3101 }
3102
3103 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3104 for DeviceReportsReaderReadReportsResponse
3105 {
3106 #[inline(always)]
3107 fn new_empty() -> Self {
3108 Self {
3109 reports: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
3110 }
3111 }
3112
3113 #[inline]
3114 unsafe fn decode(
3115 &mut self,
3116 decoder: &mut fidl::encoding::Decoder<
3117 '_,
3118 fidl::encoding::DefaultFuchsiaResourceDialect,
3119 >,
3120 offset: usize,
3121 _depth: fidl::encoding::Depth,
3122 ) -> fidl::Result<()> {
3123 decoder.debug_check_bounds::<Self>(offset);
3124 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_hardware_hidbus::Report, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
3126 Ok(())
3127 }
3128 }
3129
3130 impl fidl::encoding::ValueTypeMarker for DeviceSetReportRequest {
3131 type Borrowed<'a> = &'a Self;
3132 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3133 value
3134 }
3135 }
3136
3137 unsafe impl fidl::encoding::TypeMarker for DeviceSetReportRequest {
3138 type Owned = Self;
3139
3140 #[inline(always)]
3141 fn inline_align(_context: fidl::encoding::Context) -> usize {
3142 8
3143 }
3144
3145 #[inline(always)]
3146 fn inline_size(_context: fidl::encoding::Context) -> usize {
3147 24
3148 }
3149 }
3150
3151 unsafe impl<D: fidl::encoding::ResourceDialect>
3152 fidl::encoding::Encode<DeviceSetReportRequest, D> for &DeviceSetReportRequest
3153 {
3154 #[inline]
3155 unsafe fn encode(
3156 self,
3157 encoder: &mut fidl::encoding::Encoder<'_, D>,
3158 offset: usize,
3159 _depth: fidl::encoding::Depth,
3160 ) -> fidl::Result<()> {
3161 encoder.debug_check_bounds::<DeviceSetReportRequest>(offset);
3162 fidl::encoding::Encode::<DeviceSetReportRequest, D>::encode(
3164 (
3165 <fidl_fuchsia_hardware_hidbus::ReportType as fidl::encoding::ValueTypeMarker>::borrow(&self.type_),
3166 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3167 <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(&self.report),
3168 ),
3169 encoder, offset, _depth
3170 )
3171 }
3172 }
3173 unsafe impl<
3174 D: fidl::encoding::ResourceDialect,
3175 T0: fidl::encoding::Encode<fidl_fuchsia_hardware_hidbus::ReportType, D>,
3176 T1: fidl::encoding::Encode<u8, D>,
3177 T2: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8192>, D>,
3178 > fidl::encoding::Encode<DeviceSetReportRequest, D> for (T0, T1, T2)
3179 {
3180 #[inline]
3181 unsafe fn encode(
3182 self,
3183 encoder: &mut fidl::encoding::Encoder<'_, D>,
3184 offset: usize,
3185 depth: fidl::encoding::Depth,
3186 ) -> fidl::Result<()> {
3187 encoder.debug_check_bounds::<DeviceSetReportRequest>(offset);
3188 unsafe {
3191 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3192 (ptr as *mut u64).write_unaligned(0);
3193 }
3194 self.0.encode(encoder, offset + 0, depth)?;
3196 self.1.encode(encoder, offset + 1, depth)?;
3197 self.2.encode(encoder, offset + 8, depth)?;
3198 Ok(())
3199 }
3200 }
3201
3202 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3203 for DeviceSetReportRequest
3204 {
3205 #[inline(always)]
3206 fn new_empty() -> Self {
3207 Self {
3208 type_: fidl::new_empty!(fidl_fuchsia_hardware_hidbus::ReportType, D),
3209 id: fidl::new_empty!(u8, D),
3210 report: fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D),
3211 }
3212 }
3213
3214 #[inline]
3215 unsafe fn decode(
3216 &mut self,
3217 decoder: &mut fidl::encoding::Decoder<'_, D>,
3218 offset: usize,
3219 _depth: fidl::encoding::Depth,
3220 ) -> fidl::Result<()> {
3221 decoder.debug_check_bounds::<Self>(offset);
3222 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3224 let padval = unsafe { (ptr as *const u64).read_unaligned() };
3225 let mask = 0xffffffffffff0000u64;
3226 let maskedval = padval & mask;
3227 if maskedval != 0 {
3228 return Err(fidl::Error::NonZeroPadding {
3229 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3230 });
3231 }
3232 fidl::decode!(
3233 fidl_fuchsia_hardware_hidbus::ReportType,
3234 D,
3235 &mut self.type_,
3236 decoder,
3237 offset + 0,
3238 _depth
3239 )?;
3240 fidl::decode!(u8, D, &mut self.id, decoder, offset + 1, _depth)?;
3241 fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, &mut self.report, decoder, offset + 8, _depth)?;
3242 Ok(())
3243 }
3244 }
3245
3246 impl fidl::encoding::ValueTypeMarker for DeviceSetTraceIdRequest {
3247 type Borrowed<'a> = &'a Self;
3248 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3249 value
3250 }
3251 }
3252
3253 unsafe impl fidl::encoding::TypeMarker for DeviceSetTraceIdRequest {
3254 type Owned = Self;
3255
3256 #[inline(always)]
3257 fn inline_align(_context: fidl::encoding::Context) -> usize {
3258 4
3259 }
3260
3261 #[inline(always)]
3262 fn inline_size(_context: fidl::encoding::Context) -> usize {
3263 4
3264 }
3265 #[inline(always)]
3266 fn encode_is_copy() -> bool {
3267 true
3268 }
3269
3270 #[inline(always)]
3271 fn decode_is_copy() -> bool {
3272 true
3273 }
3274 }
3275
3276 unsafe impl<D: fidl::encoding::ResourceDialect>
3277 fidl::encoding::Encode<DeviceSetTraceIdRequest, D> for &DeviceSetTraceIdRequest
3278 {
3279 #[inline]
3280 unsafe fn encode(
3281 self,
3282 encoder: &mut fidl::encoding::Encoder<'_, D>,
3283 offset: usize,
3284 _depth: fidl::encoding::Depth,
3285 ) -> fidl::Result<()> {
3286 encoder.debug_check_bounds::<DeviceSetTraceIdRequest>(offset);
3287 unsafe {
3288 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3290 (buf_ptr as *mut DeviceSetTraceIdRequest)
3291 .write_unaligned((self as *const DeviceSetTraceIdRequest).read());
3292 }
3295 Ok(())
3296 }
3297 }
3298 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
3299 fidl::encoding::Encode<DeviceSetTraceIdRequest, D> for (T0,)
3300 {
3301 #[inline]
3302 unsafe fn encode(
3303 self,
3304 encoder: &mut fidl::encoding::Encoder<'_, D>,
3305 offset: usize,
3306 depth: fidl::encoding::Depth,
3307 ) -> fidl::Result<()> {
3308 encoder.debug_check_bounds::<DeviceSetTraceIdRequest>(offset);
3309 self.0.encode(encoder, offset + 0, depth)?;
3313 Ok(())
3314 }
3315 }
3316
3317 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3318 for DeviceSetTraceIdRequest
3319 {
3320 #[inline(always)]
3321 fn new_empty() -> Self {
3322 Self { id: fidl::new_empty!(u32, D) }
3323 }
3324
3325 #[inline]
3326 unsafe fn decode(
3327 &mut self,
3328 decoder: &mut fidl::encoding::Decoder<'_, D>,
3329 offset: usize,
3330 _depth: fidl::encoding::Depth,
3331 ) -> fidl::Result<()> {
3332 decoder.debug_check_bounds::<Self>(offset);
3333 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3334 unsafe {
3337 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3338 }
3339 Ok(())
3340 }
3341 }
3342
3343 impl fidl::encoding::ValueTypeMarker for DeviceGetReportResponse {
3344 type Borrowed<'a> = &'a Self;
3345 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3346 value
3347 }
3348 }
3349
3350 unsafe impl fidl::encoding::TypeMarker for DeviceGetReportResponse {
3351 type Owned = Self;
3352
3353 #[inline(always)]
3354 fn inline_align(_context: fidl::encoding::Context) -> usize {
3355 8
3356 }
3357
3358 #[inline(always)]
3359 fn inline_size(_context: fidl::encoding::Context) -> usize {
3360 16
3361 }
3362 }
3363
3364 unsafe impl<D: fidl::encoding::ResourceDialect>
3365 fidl::encoding::Encode<DeviceGetReportResponse, D> for &DeviceGetReportResponse
3366 {
3367 #[inline]
3368 unsafe fn encode(
3369 self,
3370 encoder: &mut fidl::encoding::Encoder<'_, D>,
3371 offset: usize,
3372 _depth: fidl::encoding::Depth,
3373 ) -> fidl::Result<()> {
3374 encoder.debug_check_bounds::<DeviceGetReportResponse>(offset);
3375 fidl::encoding::Encode::<DeviceGetReportResponse, D>::encode(
3377 (<fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
3378 &self.report,
3379 ),),
3380 encoder,
3381 offset,
3382 _depth,
3383 )
3384 }
3385 }
3386 unsafe impl<
3387 D: fidl::encoding::ResourceDialect,
3388 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8192>, D>,
3389 > fidl::encoding::Encode<DeviceGetReportResponse, D> for (T0,)
3390 {
3391 #[inline]
3392 unsafe fn encode(
3393 self,
3394 encoder: &mut fidl::encoding::Encoder<'_, D>,
3395 offset: usize,
3396 depth: fidl::encoding::Depth,
3397 ) -> fidl::Result<()> {
3398 encoder.debug_check_bounds::<DeviceGetReportResponse>(offset);
3399 self.0.encode(encoder, offset + 0, depth)?;
3403 Ok(())
3404 }
3405 }
3406
3407 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3408 for DeviceGetReportResponse
3409 {
3410 #[inline(always)]
3411 fn new_empty() -> Self {
3412 Self { report: fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D) }
3413 }
3414
3415 #[inline]
3416 unsafe fn decode(
3417 &mut self,
3418 decoder: &mut fidl::encoding::Decoder<'_, D>,
3419 offset: usize,
3420 _depth: fidl::encoding::Depth,
3421 ) -> fidl::Result<()> {
3422 decoder.debug_check_bounds::<Self>(offset);
3423 fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, &mut self.report, decoder, offset + 0, _depth)?;
3425 Ok(())
3426 }
3427 }
3428
3429 impl fidl::encoding::ResourceTypeMarker for DeviceGetReportsEventResponse {
3430 type Borrowed<'a> = &'a mut Self;
3431 fn take_or_borrow<'a>(
3432 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3433 ) -> Self::Borrowed<'a> {
3434 value
3435 }
3436 }
3437
3438 unsafe impl fidl::encoding::TypeMarker for DeviceGetReportsEventResponse {
3439 type Owned = Self;
3440
3441 #[inline(always)]
3442 fn inline_align(_context: fidl::encoding::Context) -> usize {
3443 4
3444 }
3445
3446 #[inline(always)]
3447 fn inline_size(_context: fidl::encoding::Context) -> usize {
3448 4
3449 }
3450 }
3451
3452 unsafe impl
3453 fidl::encoding::Encode<
3454 DeviceGetReportsEventResponse,
3455 fidl::encoding::DefaultFuchsiaResourceDialect,
3456 > for &mut DeviceGetReportsEventResponse
3457 {
3458 #[inline]
3459 unsafe fn encode(
3460 self,
3461 encoder: &mut fidl::encoding::Encoder<
3462 '_,
3463 fidl::encoding::DefaultFuchsiaResourceDialect,
3464 >,
3465 offset: usize,
3466 _depth: fidl::encoding::Depth,
3467 ) -> fidl::Result<()> {
3468 encoder.debug_check_bounds::<DeviceGetReportsEventResponse>(offset);
3469 fidl::encoding::Encode::<
3471 DeviceGetReportsEventResponse,
3472 fidl::encoding::DefaultFuchsiaResourceDialect,
3473 >::encode(
3474 (<fidl::encoding::HandleType<
3475 fidl::Event,
3476 { fidl::ObjectType::EVENT.into_raw() },
3477 2147483648,
3478 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3479 &mut self.event
3480 ),),
3481 encoder,
3482 offset,
3483 _depth,
3484 )
3485 }
3486 }
3487 unsafe impl<
3488 T0: fidl::encoding::Encode<
3489 fidl::encoding::HandleType<
3490 fidl::Event,
3491 { fidl::ObjectType::EVENT.into_raw() },
3492 2147483648,
3493 >,
3494 fidl::encoding::DefaultFuchsiaResourceDialect,
3495 >,
3496 >
3497 fidl::encoding::Encode<
3498 DeviceGetReportsEventResponse,
3499 fidl::encoding::DefaultFuchsiaResourceDialect,
3500 > for (T0,)
3501 {
3502 #[inline]
3503 unsafe fn encode(
3504 self,
3505 encoder: &mut fidl::encoding::Encoder<
3506 '_,
3507 fidl::encoding::DefaultFuchsiaResourceDialect,
3508 >,
3509 offset: usize,
3510 depth: fidl::encoding::Depth,
3511 ) -> fidl::Result<()> {
3512 encoder.debug_check_bounds::<DeviceGetReportsEventResponse>(offset);
3513 self.0.encode(encoder, offset + 0, depth)?;
3517 Ok(())
3518 }
3519 }
3520
3521 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3522 for DeviceGetReportsEventResponse
3523 {
3524 #[inline(always)]
3525 fn new_empty() -> Self {
3526 Self {
3527 event: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
3528 }
3529 }
3530
3531 #[inline]
3532 unsafe fn decode(
3533 &mut self,
3534 decoder: &mut fidl::encoding::Decoder<
3535 '_,
3536 fidl::encoding::DefaultFuchsiaResourceDialect,
3537 >,
3538 offset: usize,
3539 _depth: fidl::encoding::Depth,
3540 ) -> fidl::Result<()> {
3541 decoder.debug_check_bounds::<Self>(offset);
3542 fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.event, decoder, offset + 0, _depth)?;
3544 Ok(())
3545 }
3546 }
3547
3548 impl fidl::encoding::ValueTypeMarker for DeviceQueryResponse {
3549 type Borrowed<'a> = &'a Self;
3550 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3551 value
3552 }
3553 }
3554
3555 unsafe impl fidl::encoding::TypeMarker for DeviceQueryResponse {
3556 type Owned = Self;
3557
3558 #[inline(always)]
3559 fn inline_align(_context: fidl::encoding::Context) -> usize {
3560 8
3561 }
3562
3563 #[inline(always)]
3564 fn inline_size(_context: fidl::encoding::Context) -> usize {
3565 16
3566 }
3567 }
3568
3569 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DeviceQueryResponse, D>
3570 for &DeviceQueryResponse
3571 {
3572 #[inline]
3573 unsafe fn encode(
3574 self,
3575 encoder: &mut fidl::encoding::Encoder<'_, D>,
3576 offset: usize,
3577 _depth: fidl::encoding::Depth,
3578 ) -> fidl::Result<()> {
3579 encoder.debug_check_bounds::<DeviceQueryResponse>(offset);
3580 fidl::encoding::Encode::<DeviceQueryResponse, D>::encode(
3582 (
3583 <fidl_fuchsia_hardware_hidbus::HidInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
3584 ),
3585 encoder, offset, _depth
3586 )
3587 }
3588 }
3589 unsafe impl<
3590 D: fidl::encoding::ResourceDialect,
3591 T0: fidl::encoding::Encode<fidl_fuchsia_hardware_hidbus::HidInfo, D>,
3592 > fidl::encoding::Encode<DeviceQueryResponse, D> for (T0,)
3593 {
3594 #[inline]
3595 unsafe fn encode(
3596 self,
3597 encoder: &mut fidl::encoding::Encoder<'_, D>,
3598 offset: usize,
3599 depth: fidl::encoding::Depth,
3600 ) -> fidl::Result<()> {
3601 encoder.debug_check_bounds::<DeviceQueryResponse>(offset);
3602 self.0.encode(encoder, offset + 0, depth)?;
3606 Ok(())
3607 }
3608 }
3609
3610 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DeviceQueryResponse {
3611 #[inline(always)]
3612 fn new_empty() -> Self {
3613 Self { info: fidl::new_empty!(fidl_fuchsia_hardware_hidbus::HidInfo, D) }
3614 }
3615
3616 #[inline]
3617 unsafe fn decode(
3618 &mut self,
3619 decoder: &mut fidl::encoding::Decoder<'_, D>,
3620 offset: usize,
3621 _depth: fidl::encoding::Depth,
3622 ) -> fidl::Result<()> {
3623 decoder.debug_check_bounds::<Self>(offset);
3624 fidl::decode!(
3626 fidl_fuchsia_hardware_hidbus::HidInfo,
3627 D,
3628 &mut self.info,
3629 decoder,
3630 offset + 0,
3631 _depth
3632 )?;
3633 Ok(())
3634 }
3635 }
3636
3637 impl fidl::encoding::ValueTypeMarker for DeviceReadReportsResponse {
3638 type Borrowed<'a> = &'a Self;
3639 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3640 value
3641 }
3642 }
3643
3644 unsafe impl fidl::encoding::TypeMarker for DeviceReadReportsResponse {
3645 type Owned = Self;
3646
3647 #[inline(always)]
3648 fn inline_align(_context: fidl::encoding::Context) -> usize {
3649 8
3650 }
3651
3652 #[inline(always)]
3653 fn inline_size(_context: fidl::encoding::Context) -> usize {
3654 16
3655 }
3656 }
3657
3658 unsafe impl<D: fidl::encoding::ResourceDialect>
3659 fidl::encoding::Encode<DeviceReadReportsResponse, D> for &DeviceReadReportsResponse
3660 {
3661 #[inline]
3662 unsafe fn encode(
3663 self,
3664 encoder: &mut fidl::encoding::Encoder<'_, D>,
3665 offset: usize,
3666 _depth: fidl::encoding::Depth,
3667 ) -> fidl::Result<()> {
3668 encoder.debug_check_bounds::<DeviceReadReportsResponse>(offset);
3669 fidl::encoding::Encode::<DeviceReadReportsResponse, D>::encode(
3671 (<fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(
3672 &self.data,
3673 ),),
3674 encoder,
3675 offset,
3676 _depth,
3677 )
3678 }
3679 }
3680 unsafe impl<
3681 D: fidl::encoding::ResourceDialect,
3682 T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 8192>, D>,
3683 > fidl::encoding::Encode<DeviceReadReportsResponse, D> for (T0,)
3684 {
3685 #[inline]
3686 unsafe fn encode(
3687 self,
3688 encoder: &mut fidl::encoding::Encoder<'_, D>,
3689 offset: usize,
3690 depth: fidl::encoding::Depth,
3691 ) -> fidl::Result<()> {
3692 encoder.debug_check_bounds::<DeviceReadReportsResponse>(offset);
3693 self.0.encode(encoder, offset + 0, depth)?;
3697 Ok(())
3698 }
3699 }
3700
3701 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3702 for DeviceReadReportsResponse
3703 {
3704 #[inline(always)]
3705 fn new_empty() -> Self {
3706 Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D) }
3707 }
3708
3709 #[inline]
3710 unsafe fn decode(
3711 &mut self,
3712 decoder: &mut fidl::encoding::Decoder<'_, D>,
3713 offset: usize,
3714 _depth: fidl::encoding::Depth,
3715 ) -> fidl::Result<()> {
3716 decoder.debug_check_bounds::<Self>(offset);
3717 fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, &mut self.data, decoder, offset + 0, _depth)?;
3719 Ok(())
3720 }
3721 }
3722}