fidl_fuchsia_hardware_hidbus/
fidl_fuchsia_hardware_hidbus.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_hardware_hidbus_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct Report {
16    pub buf: Option<Vec<u8>>,
17    pub timestamp: Option<i64>,
18    pub wake_lease: Option<fidl::EventPair>,
19    #[doc(hidden)]
20    pub __source_breaking: fidl::marker::SourceBreaking,
21}
22
23impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Report {}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct HidbusMarker;
27
28impl fidl::endpoints::ProtocolMarker for HidbusMarker {
29    type Proxy = HidbusProxy;
30    type RequestStream = HidbusRequestStream;
31    #[cfg(target_os = "fuchsia")]
32    type SynchronousProxy = HidbusSynchronousProxy;
33
34    const DEBUG_NAME: &'static str = "(anonymous) Hidbus";
35}
36pub type HidbusQueryResult = Result<HidInfo, i32>;
37pub type HidbusStartResult = Result<(), i32>;
38pub type HidbusGetDescriptorResult = Result<Vec<u8>, i32>;
39pub type HidbusSetDescriptorResult = Result<(), i32>;
40pub type HidbusGetReportResult = Result<Vec<u8>, i32>;
41pub type HidbusSetReportResult = Result<(), i32>;
42pub type HidbusGetIdleResult = Result<i64, i32>;
43pub type HidbusSetIdleResult = Result<(), i32>;
44pub type HidbusGetProtocolResult = Result<HidProtocol, i32>;
45pub type HidbusSetProtocolResult = Result<(), i32>;
46
47pub trait HidbusProxyInterface: Send + Sync {
48    type QueryResponseFut: std::future::Future<Output = Result<HidbusQueryResult, fidl::Error>>
49        + Send;
50    fn r#query(&self) -> Self::QueryResponseFut;
51    type StartResponseFut: std::future::Future<Output = Result<HidbusStartResult, fidl::Error>>
52        + Send;
53    fn r#start(&self) -> Self::StartResponseFut;
54    type StopResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
55    fn r#stop(&self) -> Self::StopResponseFut;
56    type GetDescriptorResponseFut: std::future::Future<Output = Result<HidbusGetDescriptorResult, fidl::Error>>
57        + Send;
58    fn r#get_descriptor(&self, desc_type: HidDescriptorType) -> Self::GetDescriptorResponseFut;
59    type SetDescriptorResponseFut: std::future::Future<Output = Result<HidbusSetDescriptorResult, fidl::Error>>
60        + Send;
61    fn r#set_descriptor(
62        &self,
63        desc_type: HidDescriptorType,
64        data: &[u8],
65    ) -> Self::SetDescriptorResponseFut;
66    type GetReportResponseFut: std::future::Future<Output = Result<HidbusGetReportResult, fidl::Error>>
67        + Send;
68    fn r#get_report(
69        &self,
70        rpt_type: ReportType,
71        rpt_id: u8,
72        len: u64,
73    ) -> Self::GetReportResponseFut;
74    type SetReportResponseFut: std::future::Future<Output = Result<HidbusSetReportResult, fidl::Error>>
75        + Send;
76    fn r#set_report(
77        &self,
78        rpt_type: ReportType,
79        rpt_id: u8,
80        data: &[u8],
81    ) -> Self::SetReportResponseFut;
82    type GetIdleResponseFut: std::future::Future<Output = Result<HidbusGetIdleResult, fidl::Error>>
83        + Send;
84    fn r#get_idle(&self, rpt_id: u8) -> Self::GetIdleResponseFut;
85    type SetIdleResponseFut: std::future::Future<Output = Result<HidbusSetIdleResult, fidl::Error>>
86        + Send;
87    fn r#set_idle(&self, rpt_id: u8, duration: i64) -> Self::SetIdleResponseFut;
88    type GetProtocolResponseFut: std::future::Future<Output = Result<HidbusGetProtocolResult, fidl::Error>>
89        + Send;
90    fn r#get_protocol(&self) -> Self::GetProtocolResponseFut;
91    type SetProtocolResponseFut: std::future::Future<Output = Result<HidbusSetProtocolResult, fidl::Error>>
92        + Send;
93    fn r#set_protocol(&self, protocol: HidProtocol) -> Self::SetProtocolResponseFut;
94}
95#[derive(Debug)]
96#[cfg(target_os = "fuchsia")]
97pub struct HidbusSynchronousProxy {
98    client: fidl::client::sync::Client,
99}
100
101#[cfg(target_os = "fuchsia")]
102impl fidl::endpoints::SynchronousProxy for HidbusSynchronousProxy {
103    type Proxy = HidbusProxy;
104    type Protocol = HidbusMarker;
105
106    fn from_channel(inner: fidl::Channel) -> Self {
107        Self::new(inner)
108    }
109
110    fn into_channel(self) -> fidl::Channel {
111        self.client.into_channel()
112    }
113
114    fn as_channel(&self) -> &fidl::Channel {
115        self.client.as_channel()
116    }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl HidbusSynchronousProxy {
121    pub fn new(channel: fidl::Channel) -> Self {
122        let protocol_name = <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
123        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
124    }
125
126    pub fn into_channel(self) -> fidl::Channel {
127        self.client.into_channel()
128    }
129
130    /// Waits until an event arrives and returns it. It is safe for other
131    /// threads to make concurrent requests while waiting for an event.
132    pub fn wait_for_event(
133        &self,
134        deadline: zx::MonotonicInstant,
135    ) -> Result<HidbusEvent, fidl::Error> {
136        HidbusEvent::decode(self.client.wait_for_event(deadline)?)
137    }
138
139    /// Obtain information about the hidbus device and supported features.
140    /// Safe to call at any time.
141    pub fn r#query(
142        &self,
143        ___deadline: zx::MonotonicInstant,
144    ) -> Result<HidbusQueryResult, fidl::Error> {
145        let _response = self.client.send_query::<
146            fidl::encoding::EmptyPayload,
147            fidl::encoding::ResultType<HidbusQueryResponse, i32>,
148        >(
149            (),
150            0x23eb61f83d06efa9,
151            fidl::encoding::DynamicFlags::empty(),
152            ___deadline,
153        )?;
154        Ok(_response.map(|x| x.info))
155    }
156
157    /// Start the hidbus device. The device may begin queueing hid reports via
158    /// OnReportReceived before this function returns. The hidbus device will
159    /// keep track of the number of times Start has been called and will only
160    /// be stopped when Stop has been called for each Start that has been
161    /// called. Theoretically, Start should not be called again by the same
162    /// client unless it has called Stop.
163    pub fn r#start(
164        &self,
165        ___deadline: zx::MonotonicInstant,
166    ) -> Result<HidbusStartResult, fidl::Error> {
167        let _response = self.client.send_query::<
168            fidl::encoding::EmptyPayload,
169            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
170        >(
171            (),
172            0x1ba15adf96bade4a,
173            fidl::encoding::DynamicFlags::empty(),
174            ___deadline,
175        )?;
176        Ok(_response.map(|x| x))
177    }
178
179    /// Stop the hidbus device.
180    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
181        let _response =
182            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
183                (),
184                0x61b973ecd69cfff8,
185                fidl::encoding::DynamicFlags::empty(),
186                ___deadline,
187            )?;
188        Ok(_response)
189    }
190
191    /// Methods matching HID spec 1.11 Chapter 7 Requests
192    /// 7.1.1 Get_Descriptor
193    pub fn r#get_descriptor(
194        &self,
195        mut desc_type: HidDescriptorType,
196        ___deadline: zx::MonotonicInstant,
197    ) -> Result<HidbusGetDescriptorResult, fidl::Error> {
198        let _response = self.client.send_query::<
199            HidbusGetDescriptorRequest,
200            fidl::encoding::ResultType<HidbusGetDescriptorResponse, i32>,
201        >(
202            (desc_type,),
203            0x29343a1289ceb2e5,
204            fidl::encoding::DynamicFlags::empty(),
205            ___deadline,
206        )?;
207        Ok(_response.map(|x| x.data))
208    }
209
210    /// 7.1.2 Set_Descriptor (optional)
211    pub fn r#set_descriptor(
212        &self,
213        mut desc_type: HidDescriptorType,
214        mut data: &[u8],
215        ___deadline: zx::MonotonicInstant,
216    ) -> Result<HidbusSetDescriptorResult, fidl::Error> {
217        let _response = self.client.send_query::<
218            HidbusSetDescriptorRequest,
219            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
220        >(
221            (desc_type, data,),
222            0x7567278eba076777,
223            fidl::encoding::DynamicFlags::empty(),
224            ___deadline,
225        )?;
226        Ok(_response.map(|x| x))
227    }
228
229    /// 7.2.1 Get_Report
230    pub fn r#get_report(
231        &self,
232        mut rpt_type: ReportType,
233        mut rpt_id: u8,
234        mut len: u64,
235        ___deadline: zx::MonotonicInstant,
236    ) -> Result<HidbusGetReportResult, fidl::Error> {
237        let _response = self.client.send_query::<
238            HidbusGetReportRequest,
239            fidl::encoding::ResultType<HidbusGetReportResponse, i32>,
240        >(
241            (rpt_type, rpt_id, len,),
242            0x69b5538a28dc472c,
243            fidl::encoding::DynamicFlags::empty(),
244            ___deadline,
245        )?;
246        Ok(_response.map(|x| x.data))
247    }
248
249    /// 7.2.2 Set_Report
250    pub fn r#set_report(
251        &self,
252        mut rpt_type: ReportType,
253        mut rpt_id: u8,
254        mut data: &[u8],
255        ___deadline: zx::MonotonicInstant,
256    ) -> Result<HidbusSetReportResult, fidl::Error> {
257        let _response = self.client.send_query::<
258            HidbusSetReportRequest,
259            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
260        >(
261            (rpt_type, rpt_id, data,),
262            0x1172863081673c55,
263            fidl::encoding::DynamicFlags::empty(),
264            ___deadline,
265        )?;
266        Ok(_response.map(|x| x))
267    }
268
269    /// 7.2.3 Get_Idle
270    pub fn r#get_idle(
271        &self,
272        mut rpt_id: u8,
273        ___deadline: zx::MonotonicInstant,
274    ) -> Result<HidbusGetIdleResult, fidl::Error> {
275        let _response = self.client.send_query::<
276            HidbusGetIdleRequest,
277            fidl::encoding::ResultType<HidbusGetIdleResponse, i32>,
278        >(
279            (rpt_id,),
280            0xa95c2c504d9aa0b,
281            fidl::encoding::DynamicFlags::empty(),
282            ___deadline,
283        )?;
284        Ok(_response.map(|x| x.duration))
285    }
286
287    /// 7.2.4 Set_Idle
288    pub fn r#set_idle(
289        &self,
290        mut rpt_id: u8,
291        mut duration: i64,
292        ___deadline: zx::MonotonicInstant,
293    ) -> Result<HidbusSetIdleResult, fidl::Error> {
294        let _response = self.client.send_query::<
295            HidbusSetIdleRequest,
296            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
297        >(
298            (rpt_id, duration,),
299            0x7c387cbaa4c09b3c,
300            fidl::encoding::DynamicFlags::empty(),
301            ___deadline,
302        )?;
303        Ok(_response.map(|x| x))
304    }
305
306    /// 7.2.5 Get_Protocol
307    pub fn r#get_protocol(
308        &self,
309        ___deadline: zx::MonotonicInstant,
310    ) -> Result<HidbusGetProtocolResult, fidl::Error> {
311        let _response = self.client.send_query::<
312            fidl::encoding::EmptyPayload,
313            fidl::encoding::ResultType<HidbusGetProtocolResponse, i32>,
314        >(
315            (),
316            0x3ec61a9b2d5c50eb,
317            fidl::encoding::DynamicFlags::empty(),
318            ___deadline,
319        )?;
320        Ok(_response.map(|x| x.protocol))
321    }
322
323    /// 7.2.6 Set_Protocol
324    pub fn r#set_protocol(
325        &self,
326        mut protocol: HidProtocol,
327        ___deadline: zx::MonotonicInstant,
328    ) -> Result<HidbusSetProtocolResult, fidl::Error> {
329        let _response = self.client.send_query::<
330            HidbusSetProtocolRequest,
331            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
332        >(
333            (protocol,),
334            0x1655cdfd0f316b0b,
335            fidl::encoding::DynamicFlags::empty(),
336            ___deadline,
337        )?;
338        Ok(_response.map(|x| x))
339    }
340}
341
342#[derive(Debug, Clone)]
343pub struct HidbusProxy {
344    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
345}
346
347impl fidl::endpoints::Proxy for HidbusProxy {
348    type Protocol = HidbusMarker;
349
350    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
351        Self::new(inner)
352    }
353
354    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
355        self.client.into_channel().map_err(|client| Self { client })
356    }
357
358    fn as_channel(&self) -> &::fidl::AsyncChannel {
359        self.client.as_channel()
360    }
361}
362
363impl HidbusProxy {
364    /// Create a new Proxy for fuchsia.hardware.hidbus/Hidbus.
365    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
366        let protocol_name = <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
367        Self { client: fidl::client::Client::new(channel, protocol_name) }
368    }
369
370    /// Get a Stream of events from the remote end of the protocol.
371    ///
372    /// # Panics
373    ///
374    /// Panics if the event stream was already taken.
375    pub fn take_event_stream(&self) -> HidbusEventStream {
376        HidbusEventStream { event_receiver: self.client.take_event_receiver() }
377    }
378
379    /// Obtain information about the hidbus device and supported features.
380    /// Safe to call at any time.
381    pub fn r#query(
382        &self,
383    ) -> fidl::client::QueryResponseFut<
384        HidbusQueryResult,
385        fidl::encoding::DefaultFuchsiaResourceDialect,
386    > {
387        HidbusProxyInterface::r#query(self)
388    }
389
390    /// Start the hidbus device. The device may begin queueing hid reports via
391    /// OnReportReceived before this function returns. The hidbus device will
392    /// keep track of the number of times Start has been called and will only
393    /// be stopped when Stop has been called for each Start that has been
394    /// called. Theoretically, Start should not be called again by the same
395    /// client unless it has called Stop.
396    pub fn r#start(
397        &self,
398    ) -> fidl::client::QueryResponseFut<
399        HidbusStartResult,
400        fidl::encoding::DefaultFuchsiaResourceDialect,
401    > {
402        HidbusProxyInterface::r#start(self)
403    }
404
405    /// Stop the hidbus device.
406    pub fn r#stop(
407        &self,
408    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
409        HidbusProxyInterface::r#stop(self)
410    }
411
412    /// Methods matching HID spec 1.11 Chapter 7 Requests
413    /// 7.1.1 Get_Descriptor
414    pub fn r#get_descriptor(
415        &self,
416        mut desc_type: HidDescriptorType,
417    ) -> fidl::client::QueryResponseFut<
418        HidbusGetDescriptorResult,
419        fidl::encoding::DefaultFuchsiaResourceDialect,
420    > {
421        HidbusProxyInterface::r#get_descriptor(self, desc_type)
422    }
423
424    /// 7.1.2 Set_Descriptor (optional)
425    pub fn r#set_descriptor(
426        &self,
427        mut desc_type: HidDescriptorType,
428        mut data: &[u8],
429    ) -> fidl::client::QueryResponseFut<
430        HidbusSetDescriptorResult,
431        fidl::encoding::DefaultFuchsiaResourceDialect,
432    > {
433        HidbusProxyInterface::r#set_descriptor(self, desc_type, data)
434    }
435
436    /// 7.2.1 Get_Report
437    pub fn r#get_report(
438        &self,
439        mut rpt_type: ReportType,
440        mut rpt_id: u8,
441        mut len: u64,
442    ) -> fidl::client::QueryResponseFut<
443        HidbusGetReportResult,
444        fidl::encoding::DefaultFuchsiaResourceDialect,
445    > {
446        HidbusProxyInterface::r#get_report(self, rpt_type, rpt_id, len)
447    }
448
449    /// 7.2.2 Set_Report
450    pub fn r#set_report(
451        &self,
452        mut rpt_type: ReportType,
453        mut rpt_id: u8,
454        mut data: &[u8],
455    ) -> fidl::client::QueryResponseFut<
456        HidbusSetReportResult,
457        fidl::encoding::DefaultFuchsiaResourceDialect,
458    > {
459        HidbusProxyInterface::r#set_report(self, rpt_type, rpt_id, data)
460    }
461
462    /// 7.2.3 Get_Idle
463    pub fn r#get_idle(
464        &self,
465        mut rpt_id: u8,
466    ) -> fidl::client::QueryResponseFut<
467        HidbusGetIdleResult,
468        fidl::encoding::DefaultFuchsiaResourceDialect,
469    > {
470        HidbusProxyInterface::r#get_idle(self, rpt_id)
471    }
472
473    /// 7.2.4 Set_Idle
474    pub fn r#set_idle(
475        &self,
476        mut rpt_id: u8,
477        mut duration: i64,
478    ) -> fidl::client::QueryResponseFut<
479        HidbusSetIdleResult,
480        fidl::encoding::DefaultFuchsiaResourceDialect,
481    > {
482        HidbusProxyInterface::r#set_idle(self, rpt_id, duration)
483    }
484
485    /// 7.2.5 Get_Protocol
486    pub fn r#get_protocol(
487        &self,
488    ) -> fidl::client::QueryResponseFut<
489        HidbusGetProtocolResult,
490        fidl::encoding::DefaultFuchsiaResourceDialect,
491    > {
492        HidbusProxyInterface::r#get_protocol(self)
493    }
494
495    /// 7.2.6 Set_Protocol
496    pub fn r#set_protocol(
497        &self,
498        mut protocol: HidProtocol,
499    ) -> fidl::client::QueryResponseFut<
500        HidbusSetProtocolResult,
501        fidl::encoding::DefaultFuchsiaResourceDialect,
502    > {
503        HidbusProxyInterface::r#set_protocol(self, protocol)
504    }
505}
506
507impl HidbusProxyInterface for HidbusProxy {
508    type QueryResponseFut = fidl::client::QueryResponseFut<
509        HidbusQueryResult,
510        fidl::encoding::DefaultFuchsiaResourceDialect,
511    >;
512    fn r#query(&self) -> Self::QueryResponseFut {
513        fn _decode(
514            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
515        ) -> Result<HidbusQueryResult, fidl::Error> {
516            let _response = fidl::client::decode_transaction_body::<
517                fidl::encoding::ResultType<HidbusQueryResponse, i32>,
518                fidl::encoding::DefaultFuchsiaResourceDialect,
519                0x23eb61f83d06efa9,
520            >(_buf?)?;
521            Ok(_response.map(|x| x.info))
522        }
523        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HidbusQueryResult>(
524            (),
525            0x23eb61f83d06efa9,
526            fidl::encoding::DynamicFlags::empty(),
527            _decode,
528        )
529    }
530
531    type StartResponseFut = fidl::client::QueryResponseFut<
532        HidbusStartResult,
533        fidl::encoding::DefaultFuchsiaResourceDialect,
534    >;
535    fn r#start(&self) -> Self::StartResponseFut {
536        fn _decode(
537            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
538        ) -> Result<HidbusStartResult, fidl::Error> {
539            let _response = fidl::client::decode_transaction_body::<
540                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
541                fidl::encoding::DefaultFuchsiaResourceDialect,
542                0x1ba15adf96bade4a,
543            >(_buf?)?;
544            Ok(_response.map(|x| x))
545        }
546        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HidbusStartResult>(
547            (),
548            0x1ba15adf96bade4a,
549            fidl::encoding::DynamicFlags::empty(),
550            _decode,
551        )
552    }
553
554    type StopResponseFut =
555        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
556    fn r#stop(&self) -> Self::StopResponseFut {
557        fn _decode(
558            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
559        ) -> Result<(), fidl::Error> {
560            let _response = fidl::client::decode_transaction_body::<
561                fidl::encoding::EmptyPayload,
562                fidl::encoding::DefaultFuchsiaResourceDialect,
563                0x61b973ecd69cfff8,
564            >(_buf?)?;
565            Ok(_response)
566        }
567        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
568            (),
569            0x61b973ecd69cfff8,
570            fidl::encoding::DynamicFlags::empty(),
571            _decode,
572        )
573    }
574
575    type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
576        HidbusGetDescriptorResult,
577        fidl::encoding::DefaultFuchsiaResourceDialect,
578    >;
579    fn r#get_descriptor(&self, mut desc_type: HidDescriptorType) -> Self::GetDescriptorResponseFut {
580        fn _decode(
581            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
582        ) -> Result<HidbusGetDescriptorResult, fidl::Error> {
583            let _response = fidl::client::decode_transaction_body::<
584                fidl::encoding::ResultType<HidbusGetDescriptorResponse, i32>,
585                fidl::encoding::DefaultFuchsiaResourceDialect,
586                0x29343a1289ceb2e5,
587            >(_buf?)?;
588            Ok(_response.map(|x| x.data))
589        }
590        self.client.send_query_and_decode::<HidbusGetDescriptorRequest, HidbusGetDescriptorResult>(
591            (desc_type,),
592            0x29343a1289ceb2e5,
593            fidl::encoding::DynamicFlags::empty(),
594            _decode,
595        )
596    }
597
598    type SetDescriptorResponseFut = fidl::client::QueryResponseFut<
599        HidbusSetDescriptorResult,
600        fidl::encoding::DefaultFuchsiaResourceDialect,
601    >;
602    fn r#set_descriptor(
603        &self,
604        mut desc_type: HidDescriptorType,
605        mut data: &[u8],
606    ) -> Self::SetDescriptorResponseFut {
607        fn _decode(
608            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
609        ) -> Result<HidbusSetDescriptorResult, fidl::Error> {
610            let _response = fidl::client::decode_transaction_body::<
611                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
612                fidl::encoding::DefaultFuchsiaResourceDialect,
613                0x7567278eba076777,
614            >(_buf?)?;
615            Ok(_response.map(|x| x))
616        }
617        self.client.send_query_and_decode::<HidbusSetDescriptorRequest, HidbusSetDescriptorResult>(
618            (desc_type, data),
619            0x7567278eba076777,
620            fidl::encoding::DynamicFlags::empty(),
621            _decode,
622        )
623    }
624
625    type GetReportResponseFut = fidl::client::QueryResponseFut<
626        HidbusGetReportResult,
627        fidl::encoding::DefaultFuchsiaResourceDialect,
628    >;
629    fn r#get_report(
630        &self,
631        mut rpt_type: ReportType,
632        mut rpt_id: u8,
633        mut len: u64,
634    ) -> Self::GetReportResponseFut {
635        fn _decode(
636            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
637        ) -> Result<HidbusGetReportResult, fidl::Error> {
638            let _response = fidl::client::decode_transaction_body::<
639                fidl::encoding::ResultType<HidbusGetReportResponse, i32>,
640                fidl::encoding::DefaultFuchsiaResourceDialect,
641                0x69b5538a28dc472c,
642            >(_buf?)?;
643            Ok(_response.map(|x| x.data))
644        }
645        self.client.send_query_and_decode::<HidbusGetReportRequest, HidbusGetReportResult>(
646            (rpt_type, rpt_id, len),
647            0x69b5538a28dc472c,
648            fidl::encoding::DynamicFlags::empty(),
649            _decode,
650        )
651    }
652
653    type SetReportResponseFut = fidl::client::QueryResponseFut<
654        HidbusSetReportResult,
655        fidl::encoding::DefaultFuchsiaResourceDialect,
656    >;
657    fn r#set_report(
658        &self,
659        mut rpt_type: ReportType,
660        mut rpt_id: u8,
661        mut data: &[u8],
662    ) -> Self::SetReportResponseFut {
663        fn _decode(
664            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
665        ) -> Result<HidbusSetReportResult, fidl::Error> {
666            let _response = fidl::client::decode_transaction_body::<
667                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
668                fidl::encoding::DefaultFuchsiaResourceDialect,
669                0x1172863081673c55,
670            >(_buf?)?;
671            Ok(_response.map(|x| x))
672        }
673        self.client.send_query_and_decode::<HidbusSetReportRequest, HidbusSetReportResult>(
674            (rpt_type, rpt_id, data),
675            0x1172863081673c55,
676            fidl::encoding::DynamicFlags::empty(),
677            _decode,
678        )
679    }
680
681    type GetIdleResponseFut = fidl::client::QueryResponseFut<
682        HidbusGetIdleResult,
683        fidl::encoding::DefaultFuchsiaResourceDialect,
684    >;
685    fn r#get_idle(&self, mut rpt_id: u8) -> Self::GetIdleResponseFut {
686        fn _decode(
687            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
688        ) -> Result<HidbusGetIdleResult, fidl::Error> {
689            let _response = fidl::client::decode_transaction_body::<
690                fidl::encoding::ResultType<HidbusGetIdleResponse, i32>,
691                fidl::encoding::DefaultFuchsiaResourceDialect,
692                0xa95c2c504d9aa0b,
693            >(_buf?)?;
694            Ok(_response.map(|x| x.duration))
695        }
696        self.client.send_query_and_decode::<HidbusGetIdleRequest, HidbusGetIdleResult>(
697            (rpt_id,),
698            0xa95c2c504d9aa0b,
699            fidl::encoding::DynamicFlags::empty(),
700            _decode,
701        )
702    }
703
704    type SetIdleResponseFut = fidl::client::QueryResponseFut<
705        HidbusSetIdleResult,
706        fidl::encoding::DefaultFuchsiaResourceDialect,
707    >;
708    fn r#set_idle(&self, mut rpt_id: u8, mut duration: i64) -> Self::SetIdleResponseFut {
709        fn _decode(
710            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
711        ) -> Result<HidbusSetIdleResult, fidl::Error> {
712            let _response = fidl::client::decode_transaction_body::<
713                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
714                fidl::encoding::DefaultFuchsiaResourceDialect,
715                0x7c387cbaa4c09b3c,
716            >(_buf?)?;
717            Ok(_response.map(|x| x))
718        }
719        self.client.send_query_and_decode::<HidbusSetIdleRequest, HidbusSetIdleResult>(
720            (rpt_id, duration),
721            0x7c387cbaa4c09b3c,
722            fidl::encoding::DynamicFlags::empty(),
723            _decode,
724        )
725    }
726
727    type GetProtocolResponseFut = fidl::client::QueryResponseFut<
728        HidbusGetProtocolResult,
729        fidl::encoding::DefaultFuchsiaResourceDialect,
730    >;
731    fn r#get_protocol(&self) -> Self::GetProtocolResponseFut {
732        fn _decode(
733            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
734        ) -> Result<HidbusGetProtocolResult, fidl::Error> {
735            let _response = fidl::client::decode_transaction_body::<
736                fidl::encoding::ResultType<HidbusGetProtocolResponse, i32>,
737                fidl::encoding::DefaultFuchsiaResourceDialect,
738                0x3ec61a9b2d5c50eb,
739            >(_buf?)?;
740            Ok(_response.map(|x| x.protocol))
741        }
742        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, HidbusGetProtocolResult>(
743            (),
744            0x3ec61a9b2d5c50eb,
745            fidl::encoding::DynamicFlags::empty(),
746            _decode,
747        )
748    }
749
750    type SetProtocolResponseFut = fidl::client::QueryResponseFut<
751        HidbusSetProtocolResult,
752        fidl::encoding::DefaultFuchsiaResourceDialect,
753    >;
754    fn r#set_protocol(&self, mut protocol: HidProtocol) -> Self::SetProtocolResponseFut {
755        fn _decode(
756            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
757        ) -> Result<HidbusSetProtocolResult, fidl::Error> {
758            let _response = fidl::client::decode_transaction_body::<
759                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
760                fidl::encoding::DefaultFuchsiaResourceDialect,
761                0x1655cdfd0f316b0b,
762            >(_buf?)?;
763            Ok(_response.map(|x| x))
764        }
765        self.client.send_query_and_decode::<HidbusSetProtocolRequest, HidbusSetProtocolResult>(
766            (protocol,),
767            0x1655cdfd0f316b0b,
768            fidl::encoding::DynamicFlags::empty(),
769            _decode,
770        )
771    }
772}
773
774pub struct HidbusEventStream {
775    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
776}
777
778impl std::marker::Unpin for HidbusEventStream {}
779
780impl futures::stream::FusedStream for HidbusEventStream {
781    fn is_terminated(&self) -> bool {
782        self.event_receiver.is_terminated()
783    }
784}
785
786impl futures::Stream for HidbusEventStream {
787    type Item = Result<HidbusEvent, fidl::Error>;
788
789    fn poll_next(
790        mut self: std::pin::Pin<&mut Self>,
791        cx: &mut std::task::Context<'_>,
792    ) -> std::task::Poll<Option<Self::Item>> {
793        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
794            &mut self.event_receiver,
795            cx
796        )?) {
797            Some(buf) => std::task::Poll::Ready(Some(HidbusEvent::decode(buf))),
798            None => std::task::Poll::Ready(None),
799        }
800    }
801}
802
803#[derive(Debug)]
804pub enum HidbusEvent {
805    OnReportReceived { payload: Report },
806}
807
808impl HidbusEvent {
809    #[allow(irrefutable_let_patterns)]
810    pub fn into_on_report_received(self) -> Option<Report> {
811        if let HidbusEvent::OnReportReceived { payload } = self {
812            Some((payload))
813        } else {
814            None
815        }
816    }
817
818    /// Decodes a message buffer as a [`HidbusEvent`].
819    fn decode(
820        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
821    ) -> Result<HidbusEvent, fidl::Error> {
822        let (bytes, _handles) = buf.split_mut();
823        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
824        debug_assert_eq!(tx_header.tx_id, 0);
825        match tx_header.ordinal {
826            0x6093963f2efe1e56 => {
827                let mut out =
828                    fidl::new_empty!(Report, fidl::encoding::DefaultFuchsiaResourceDialect);
829                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Report>(&tx_header, _body_bytes, _handles, &mut out)?;
830                Ok((HidbusEvent::OnReportReceived { payload: out }))
831            }
832            _ => Err(fidl::Error::UnknownOrdinal {
833                ordinal: tx_header.ordinal,
834                protocol_name: <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
835            }),
836        }
837    }
838}
839
840/// A Stream of incoming requests for fuchsia.hardware.hidbus/Hidbus.
841pub struct HidbusRequestStream {
842    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
843    is_terminated: bool,
844}
845
846impl std::marker::Unpin for HidbusRequestStream {}
847
848impl futures::stream::FusedStream for HidbusRequestStream {
849    fn is_terminated(&self) -> bool {
850        self.is_terminated
851    }
852}
853
854impl fidl::endpoints::RequestStream for HidbusRequestStream {
855    type Protocol = HidbusMarker;
856    type ControlHandle = HidbusControlHandle;
857
858    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
859        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
860    }
861
862    fn control_handle(&self) -> Self::ControlHandle {
863        HidbusControlHandle { inner: self.inner.clone() }
864    }
865
866    fn into_inner(
867        self,
868    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
869    {
870        (self.inner, self.is_terminated)
871    }
872
873    fn from_inner(
874        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
875        is_terminated: bool,
876    ) -> Self {
877        Self { inner, is_terminated }
878    }
879}
880
881impl futures::Stream for HidbusRequestStream {
882    type Item = Result<HidbusRequest, fidl::Error>;
883
884    fn poll_next(
885        mut self: std::pin::Pin<&mut Self>,
886        cx: &mut std::task::Context<'_>,
887    ) -> std::task::Poll<Option<Self::Item>> {
888        let this = &mut *self;
889        if this.inner.check_shutdown(cx) {
890            this.is_terminated = true;
891            return std::task::Poll::Ready(None);
892        }
893        if this.is_terminated {
894            panic!("polled HidbusRequestStream after completion");
895        }
896        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
897            |bytes, handles| {
898                match this.inner.channel().read_etc(cx, bytes, handles) {
899                    std::task::Poll::Ready(Ok(())) => {}
900                    std::task::Poll::Pending => return std::task::Poll::Pending,
901                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
902                        this.is_terminated = true;
903                        return std::task::Poll::Ready(None);
904                    }
905                    std::task::Poll::Ready(Err(e)) => {
906                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
907                            e.into(),
908                        ))))
909                    }
910                }
911
912                // A message has been received from the channel
913                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
914
915                std::task::Poll::Ready(Some(match header.ordinal {
916                    0x23eb61f83d06efa9 => {
917                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
918                        let mut req = fidl::new_empty!(
919                            fidl::encoding::EmptyPayload,
920                            fidl::encoding::DefaultFuchsiaResourceDialect
921                        );
922                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
923                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
924                        Ok(HidbusRequest::Query {
925                            responder: HidbusQueryResponder {
926                                control_handle: std::mem::ManuallyDrop::new(control_handle),
927                                tx_id: header.tx_id,
928                            },
929                        })
930                    }
931                    0x1ba15adf96bade4a => {
932                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
933                        let mut req = fidl::new_empty!(
934                            fidl::encoding::EmptyPayload,
935                            fidl::encoding::DefaultFuchsiaResourceDialect
936                        );
937                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
938                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
939                        Ok(HidbusRequest::Start {
940                            responder: HidbusStartResponder {
941                                control_handle: std::mem::ManuallyDrop::new(control_handle),
942                                tx_id: header.tx_id,
943                            },
944                        })
945                    }
946                    0x61b973ecd69cfff8 => {
947                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
948                        let mut req = fidl::new_empty!(
949                            fidl::encoding::EmptyPayload,
950                            fidl::encoding::DefaultFuchsiaResourceDialect
951                        );
952                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
953                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
954                        Ok(HidbusRequest::Stop {
955                            responder: HidbusStopResponder {
956                                control_handle: std::mem::ManuallyDrop::new(control_handle),
957                                tx_id: header.tx_id,
958                            },
959                        })
960                    }
961                    0x29343a1289ceb2e5 => {
962                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
963                        let mut req = fidl::new_empty!(
964                            HidbusGetDescriptorRequest,
965                            fidl::encoding::DefaultFuchsiaResourceDialect
966                        );
967                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusGetDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
968                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
969                        Ok(HidbusRequest::GetDescriptor {
970                            desc_type: req.desc_type,
971
972                            responder: HidbusGetDescriptorResponder {
973                                control_handle: std::mem::ManuallyDrop::new(control_handle),
974                                tx_id: header.tx_id,
975                            },
976                        })
977                    }
978                    0x7567278eba076777 => {
979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
980                        let mut req = fidl::new_empty!(
981                            HidbusSetDescriptorRequest,
982                            fidl::encoding::DefaultFuchsiaResourceDialect
983                        );
984                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetDescriptorRequest>(&header, _body_bytes, handles, &mut req)?;
985                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
986                        Ok(HidbusRequest::SetDescriptor {
987                            desc_type: req.desc_type,
988                            data: req.data,
989
990                            responder: HidbusSetDescriptorResponder {
991                                control_handle: std::mem::ManuallyDrop::new(control_handle),
992                                tx_id: header.tx_id,
993                            },
994                        })
995                    }
996                    0x69b5538a28dc472c => {
997                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
998                        let mut req = fidl::new_empty!(
999                            HidbusGetReportRequest,
1000                            fidl::encoding::DefaultFuchsiaResourceDialect
1001                        );
1002                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusGetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1003                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1004                        Ok(HidbusRequest::GetReport {
1005                            rpt_type: req.rpt_type,
1006                            rpt_id: req.rpt_id,
1007                            len: req.len,
1008
1009                            responder: HidbusGetReportResponder {
1010                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1011                                tx_id: header.tx_id,
1012                            },
1013                        })
1014                    }
1015                    0x1172863081673c55 => {
1016                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1017                        let mut req = fidl::new_empty!(
1018                            HidbusSetReportRequest,
1019                            fidl::encoding::DefaultFuchsiaResourceDialect
1020                        );
1021                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetReportRequest>(&header, _body_bytes, handles, &mut req)?;
1022                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1023                        Ok(HidbusRequest::SetReport {
1024                            rpt_type: req.rpt_type,
1025                            rpt_id: req.rpt_id,
1026                            data: req.data,
1027
1028                            responder: HidbusSetReportResponder {
1029                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1030                                tx_id: header.tx_id,
1031                            },
1032                        })
1033                    }
1034                    0xa95c2c504d9aa0b => {
1035                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1036                        let mut req = fidl::new_empty!(
1037                            HidbusGetIdleRequest,
1038                            fidl::encoding::DefaultFuchsiaResourceDialect
1039                        );
1040                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusGetIdleRequest>(&header, _body_bytes, handles, &mut req)?;
1041                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1042                        Ok(HidbusRequest::GetIdle {
1043                            rpt_id: req.rpt_id,
1044
1045                            responder: HidbusGetIdleResponder {
1046                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1047                                tx_id: header.tx_id,
1048                            },
1049                        })
1050                    }
1051                    0x7c387cbaa4c09b3c => {
1052                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1053                        let mut req = fidl::new_empty!(
1054                            HidbusSetIdleRequest,
1055                            fidl::encoding::DefaultFuchsiaResourceDialect
1056                        );
1057                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetIdleRequest>(&header, _body_bytes, handles, &mut req)?;
1058                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1059                        Ok(HidbusRequest::SetIdle {
1060                            rpt_id: req.rpt_id,
1061                            duration: req.duration,
1062
1063                            responder: HidbusSetIdleResponder {
1064                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1065                                tx_id: header.tx_id,
1066                            },
1067                        })
1068                    }
1069                    0x3ec61a9b2d5c50eb => {
1070                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1071                        let mut req = fidl::new_empty!(
1072                            fidl::encoding::EmptyPayload,
1073                            fidl::encoding::DefaultFuchsiaResourceDialect
1074                        );
1075                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1076                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1077                        Ok(HidbusRequest::GetProtocol {
1078                            responder: HidbusGetProtocolResponder {
1079                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1080                                tx_id: header.tx_id,
1081                            },
1082                        })
1083                    }
1084                    0x1655cdfd0f316b0b => {
1085                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1086                        let mut req = fidl::new_empty!(
1087                            HidbusSetProtocolRequest,
1088                            fidl::encoding::DefaultFuchsiaResourceDialect
1089                        );
1090                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HidbusSetProtocolRequest>(&header, _body_bytes, handles, &mut req)?;
1091                        let control_handle = HidbusControlHandle { inner: this.inner.clone() };
1092                        Ok(HidbusRequest::SetProtocol {
1093                            protocol: req.protocol,
1094
1095                            responder: HidbusSetProtocolResponder {
1096                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1097                                tx_id: header.tx_id,
1098                            },
1099                        })
1100                    }
1101                    _ => Err(fidl::Error::UnknownOrdinal {
1102                        ordinal: header.ordinal,
1103                        protocol_name:
1104                            <HidbusMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1105                    }),
1106                }))
1107            },
1108        )
1109    }
1110}
1111
1112#[derive(Debug)]
1113pub enum HidbusRequest {
1114    /// Obtain information about the hidbus device and supported features.
1115    /// Safe to call at any time.
1116    Query { responder: HidbusQueryResponder },
1117    /// Start the hidbus device. The device may begin queueing hid reports via
1118    /// OnReportReceived before this function returns. The hidbus device will
1119    /// keep track of the number of times Start has been called and will only
1120    /// be stopped when Stop has been called for each Start that has been
1121    /// called. Theoretically, Start should not be called again by the same
1122    /// client unless it has called Stop.
1123    Start { responder: HidbusStartResponder },
1124    /// Stop the hidbus device.
1125    Stop { responder: HidbusStopResponder },
1126    /// Methods matching HID spec 1.11 Chapter 7 Requests
1127    /// 7.1.1 Get_Descriptor
1128    GetDescriptor { desc_type: HidDescriptorType, responder: HidbusGetDescriptorResponder },
1129    /// 7.1.2 Set_Descriptor (optional)
1130    SetDescriptor {
1131        desc_type: HidDescriptorType,
1132        data: Vec<u8>,
1133        responder: HidbusSetDescriptorResponder,
1134    },
1135    /// 7.2.1 Get_Report
1136    GetReport { rpt_type: ReportType, rpt_id: u8, len: u64, responder: HidbusGetReportResponder },
1137    /// 7.2.2 Set_Report
1138    SetReport {
1139        rpt_type: ReportType,
1140        rpt_id: u8,
1141        data: Vec<u8>,
1142        responder: HidbusSetReportResponder,
1143    },
1144    /// 7.2.3 Get_Idle
1145    GetIdle { rpt_id: u8, responder: HidbusGetIdleResponder },
1146    /// 7.2.4 Set_Idle
1147    SetIdle { rpt_id: u8, duration: i64, responder: HidbusSetIdleResponder },
1148    /// 7.2.5 Get_Protocol
1149    GetProtocol { responder: HidbusGetProtocolResponder },
1150    /// 7.2.6 Set_Protocol
1151    SetProtocol { protocol: HidProtocol, responder: HidbusSetProtocolResponder },
1152}
1153
1154impl HidbusRequest {
1155    #[allow(irrefutable_let_patterns)]
1156    pub fn into_query(self) -> Option<(HidbusQueryResponder)> {
1157        if let HidbusRequest::Query { responder } = self {
1158            Some((responder))
1159        } else {
1160            None
1161        }
1162    }
1163
1164    #[allow(irrefutable_let_patterns)]
1165    pub fn into_start(self) -> Option<(HidbusStartResponder)> {
1166        if let HidbusRequest::Start { responder } = self {
1167            Some((responder))
1168        } else {
1169            None
1170        }
1171    }
1172
1173    #[allow(irrefutable_let_patterns)]
1174    pub fn into_stop(self) -> Option<(HidbusStopResponder)> {
1175        if let HidbusRequest::Stop { responder } = self {
1176            Some((responder))
1177        } else {
1178            None
1179        }
1180    }
1181
1182    #[allow(irrefutable_let_patterns)]
1183    pub fn into_get_descriptor(self) -> Option<(HidDescriptorType, HidbusGetDescriptorResponder)> {
1184        if let HidbusRequest::GetDescriptor { desc_type, responder } = self {
1185            Some((desc_type, responder))
1186        } else {
1187            None
1188        }
1189    }
1190
1191    #[allow(irrefutable_let_patterns)]
1192    pub fn into_set_descriptor(
1193        self,
1194    ) -> Option<(HidDescriptorType, Vec<u8>, HidbusSetDescriptorResponder)> {
1195        if let HidbusRequest::SetDescriptor { desc_type, data, responder } = self {
1196            Some((desc_type, data, responder))
1197        } else {
1198            None
1199        }
1200    }
1201
1202    #[allow(irrefutable_let_patterns)]
1203    pub fn into_get_report(self) -> Option<(ReportType, u8, u64, HidbusGetReportResponder)> {
1204        if let HidbusRequest::GetReport { rpt_type, rpt_id, len, responder } = self {
1205            Some((rpt_type, rpt_id, len, responder))
1206        } else {
1207            None
1208        }
1209    }
1210
1211    #[allow(irrefutable_let_patterns)]
1212    pub fn into_set_report(self) -> Option<(ReportType, u8, Vec<u8>, HidbusSetReportResponder)> {
1213        if let HidbusRequest::SetReport { rpt_type, rpt_id, data, responder } = self {
1214            Some((rpt_type, rpt_id, data, responder))
1215        } else {
1216            None
1217        }
1218    }
1219
1220    #[allow(irrefutable_let_patterns)]
1221    pub fn into_get_idle(self) -> Option<(u8, HidbusGetIdleResponder)> {
1222        if let HidbusRequest::GetIdle { rpt_id, responder } = self {
1223            Some((rpt_id, responder))
1224        } else {
1225            None
1226        }
1227    }
1228
1229    #[allow(irrefutable_let_patterns)]
1230    pub fn into_set_idle(self) -> Option<(u8, i64, HidbusSetIdleResponder)> {
1231        if let HidbusRequest::SetIdle { rpt_id, duration, responder } = self {
1232            Some((rpt_id, duration, responder))
1233        } else {
1234            None
1235        }
1236    }
1237
1238    #[allow(irrefutable_let_patterns)]
1239    pub fn into_get_protocol(self) -> Option<(HidbusGetProtocolResponder)> {
1240        if let HidbusRequest::GetProtocol { responder } = self {
1241            Some((responder))
1242        } else {
1243            None
1244        }
1245    }
1246
1247    #[allow(irrefutable_let_patterns)]
1248    pub fn into_set_protocol(self) -> Option<(HidProtocol, HidbusSetProtocolResponder)> {
1249        if let HidbusRequest::SetProtocol { protocol, responder } = self {
1250            Some((protocol, responder))
1251        } else {
1252            None
1253        }
1254    }
1255
1256    /// Name of the method defined in FIDL
1257    pub fn method_name(&self) -> &'static str {
1258        match *self {
1259            HidbusRequest::Query { .. } => "query",
1260            HidbusRequest::Start { .. } => "start",
1261            HidbusRequest::Stop { .. } => "stop",
1262            HidbusRequest::GetDescriptor { .. } => "get_descriptor",
1263            HidbusRequest::SetDescriptor { .. } => "set_descriptor",
1264            HidbusRequest::GetReport { .. } => "get_report",
1265            HidbusRequest::SetReport { .. } => "set_report",
1266            HidbusRequest::GetIdle { .. } => "get_idle",
1267            HidbusRequest::SetIdle { .. } => "set_idle",
1268            HidbusRequest::GetProtocol { .. } => "get_protocol",
1269            HidbusRequest::SetProtocol { .. } => "set_protocol",
1270        }
1271    }
1272}
1273
1274#[derive(Debug, Clone)]
1275pub struct HidbusControlHandle {
1276    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1277}
1278
1279impl fidl::endpoints::ControlHandle for HidbusControlHandle {
1280    fn shutdown(&self) {
1281        self.inner.shutdown()
1282    }
1283    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1284        self.inner.shutdown_with_epitaph(status)
1285    }
1286
1287    fn is_closed(&self) -> bool {
1288        self.inner.channel().is_closed()
1289    }
1290    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1291        self.inner.channel().on_closed()
1292    }
1293
1294    #[cfg(target_os = "fuchsia")]
1295    fn signal_peer(
1296        &self,
1297        clear_mask: zx::Signals,
1298        set_mask: zx::Signals,
1299    ) -> Result<(), zx_status::Status> {
1300        use fidl::Peered;
1301        self.inner.channel().signal_peer(clear_mask, set_mask)
1302    }
1303}
1304
1305impl HidbusControlHandle {
1306    pub fn send_on_report_received(&self, mut payload: Report) -> Result<(), fidl::Error> {
1307        self.inner.send::<Report>(
1308            &mut payload,
1309            0,
1310            0x6093963f2efe1e56,
1311            fidl::encoding::DynamicFlags::empty(),
1312        )
1313    }
1314}
1315
1316#[must_use = "FIDL methods require a response to be sent"]
1317#[derive(Debug)]
1318pub struct HidbusQueryResponder {
1319    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1320    tx_id: u32,
1321}
1322
1323/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1324/// if the responder is dropped without sending a response, so that the client
1325/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1326impl std::ops::Drop for HidbusQueryResponder {
1327    fn drop(&mut self) {
1328        self.control_handle.shutdown();
1329        // Safety: drops once, never accessed again
1330        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1331    }
1332}
1333
1334impl fidl::endpoints::Responder for HidbusQueryResponder {
1335    type ControlHandle = HidbusControlHandle;
1336
1337    fn control_handle(&self) -> &HidbusControlHandle {
1338        &self.control_handle
1339    }
1340
1341    fn drop_without_shutdown(mut self) {
1342        // Safety: drops once, never accessed again due to mem::forget
1343        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1344        // Prevent Drop from running (which would shut down the channel)
1345        std::mem::forget(self);
1346    }
1347}
1348
1349impl HidbusQueryResponder {
1350    /// Sends a response to the FIDL transaction.
1351    ///
1352    /// Sets the channel to shutdown if an error occurs.
1353    pub fn send(self, mut result: Result<&HidInfo, i32>) -> Result<(), fidl::Error> {
1354        let _result = self.send_raw(result);
1355        if _result.is_err() {
1356            self.control_handle.shutdown();
1357        }
1358        self.drop_without_shutdown();
1359        _result
1360    }
1361
1362    /// Similar to "send" but does not shutdown the channel if an error occurs.
1363    pub fn send_no_shutdown_on_err(
1364        self,
1365        mut result: Result<&HidInfo, i32>,
1366    ) -> Result<(), fidl::Error> {
1367        let _result = self.send_raw(result);
1368        self.drop_without_shutdown();
1369        _result
1370    }
1371
1372    fn send_raw(&self, mut result: Result<&HidInfo, i32>) -> Result<(), fidl::Error> {
1373        self.control_handle.inner.send::<fidl::encoding::ResultType<HidbusQueryResponse, i32>>(
1374            result.map(|info| (info,)),
1375            self.tx_id,
1376            0x23eb61f83d06efa9,
1377            fidl::encoding::DynamicFlags::empty(),
1378        )
1379    }
1380}
1381
1382#[must_use = "FIDL methods require a response to be sent"]
1383#[derive(Debug)]
1384pub struct HidbusStartResponder {
1385    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1386    tx_id: u32,
1387}
1388
1389/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1390/// if the responder is dropped without sending a response, so that the client
1391/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1392impl std::ops::Drop for HidbusStartResponder {
1393    fn drop(&mut self) {
1394        self.control_handle.shutdown();
1395        // Safety: drops once, never accessed again
1396        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1397    }
1398}
1399
1400impl fidl::endpoints::Responder for HidbusStartResponder {
1401    type ControlHandle = HidbusControlHandle;
1402
1403    fn control_handle(&self) -> &HidbusControlHandle {
1404        &self.control_handle
1405    }
1406
1407    fn drop_without_shutdown(mut self) {
1408        // Safety: drops once, never accessed again due to mem::forget
1409        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1410        // Prevent Drop from running (which would shut down the channel)
1411        std::mem::forget(self);
1412    }
1413}
1414
1415impl HidbusStartResponder {
1416    /// Sends a response to the FIDL transaction.
1417    ///
1418    /// Sets the channel to shutdown if an error occurs.
1419    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1420        let _result = self.send_raw(result);
1421        if _result.is_err() {
1422            self.control_handle.shutdown();
1423        }
1424        self.drop_without_shutdown();
1425        _result
1426    }
1427
1428    /// Similar to "send" but does not shutdown the channel if an error occurs.
1429    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1430        let _result = self.send_raw(result);
1431        self.drop_without_shutdown();
1432        _result
1433    }
1434
1435    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1436        self.control_handle
1437            .inner
1438            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1439                result,
1440                self.tx_id,
1441                0x1ba15adf96bade4a,
1442                fidl::encoding::DynamicFlags::empty(),
1443            )
1444    }
1445}
1446
1447#[must_use = "FIDL methods require a response to be sent"]
1448#[derive(Debug)]
1449pub struct HidbusStopResponder {
1450    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1451    tx_id: u32,
1452}
1453
1454/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1455/// if the responder is dropped without sending a response, so that the client
1456/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1457impl std::ops::Drop for HidbusStopResponder {
1458    fn drop(&mut self) {
1459        self.control_handle.shutdown();
1460        // Safety: drops once, never accessed again
1461        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1462    }
1463}
1464
1465impl fidl::endpoints::Responder for HidbusStopResponder {
1466    type ControlHandle = HidbusControlHandle;
1467
1468    fn control_handle(&self) -> &HidbusControlHandle {
1469        &self.control_handle
1470    }
1471
1472    fn drop_without_shutdown(mut self) {
1473        // Safety: drops once, never accessed again due to mem::forget
1474        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1475        // Prevent Drop from running (which would shut down the channel)
1476        std::mem::forget(self);
1477    }
1478}
1479
1480impl HidbusStopResponder {
1481    /// Sends a response to the FIDL transaction.
1482    ///
1483    /// Sets the channel to shutdown if an error occurs.
1484    pub fn send(self) -> Result<(), fidl::Error> {
1485        let _result = self.send_raw();
1486        if _result.is_err() {
1487            self.control_handle.shutdown();
1488        }
1489        self.drop_without_shutdown();
1490        _result
1491    }
1492
1493    /// Similar to "send" but does not shutdown the channel if an error occurs.
1494    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1495        let _result = self.send_raw();
1496        self.drop_without_shutdown();
1497        _result
1498    }
1499
1500    fn send_raw(&self) -> Result<(), fidl::Error> {
1501        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1502            (),
1503            self.tx_id,
1504            0x61b973ecd69cfff8,
1505            fidl::encoding::DynamicFlags::empty(),
1506        )
1507    }
1508}
1509
1510#[must_use = "FIDL methods require a response to be sent"]
1511#[derive(Debug)]
1512pub struct HidbusGetDescriptorResponder {
1513    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1514    tx_id: u32,
1515}
1516
1517/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1518/// if the responder is dropped without sending a response, so that the client
1519/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1520impl std::ops::Drop for HidbusGetDescriptorResponder {
1521    fn drop(&mut self) {
1522        self.control_handle.shutdown();
1523        // Safety: drops once, never accessed again
1524        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1525    }
1526}
1527
1528impl fidl::endpoints::Responder for HidbusGetDescriptorResponder {
1529    type ControlHandle = HidbusControlHandle;
1530
1531    fn control_handle(&self) -> &HidbusControlHandle {
1532        &self.control_handle
1533    }
1534
1535    fn drop_without_shutdown(mut self) {
1536        // Safety: drops once, never accessed again due to mem::forget
1537        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1538        // Prevent Drop from running (which would shut down the channel)
1539        std::mem::forget(self);
1540    }
1541}
1542
1543impl HidbusGetDescriptorResponder {
1544    /// Sends a response to the FIDL transaction.
1545    ///
1546    /// Sets the channel to shutdown if an error occurs.
1547    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1548        let _result = self.send_raw(result);
1549        if _result.is_err() {
1550            self.control_handle.shutdown();
1551        }
1552        self.drop_without_shutdown();
1553        _result
1554    }
1555
1556    /// Similar to "send" but does not shutdown the channel if an error occurs.
1557    pub fn send_no_shutdown_on_err(
1558        self,
1559        mut result: Result<&[u8], i32>,
1560    ) -> Result<(), fidl::Error> {
1561        let _result = self.send_raw(result);
1562        self.drop_without_shutdown();
1563        _result
1564    }
1565
1566    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1567        self.control_handle
1568            .inner
1569            .send::<fidl::encoding::ResultType<HidbusGetDescriptorResponse, i32>>(
1570                result.map(|data| (data,)),
1571                self.tx_id,
1572                0x29343a1289ceb2e5,
1573                fidl::encoding::DynamicFlags::empty(),
1574            )
1575    }
1576}
1577
1578#[must_use = "FIDL methods require a response to be sent"]
1579#[derive(Debug)]
1580pub struct HidbusSetDescriptorResponder {
1581    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1582    tx_id: u32,
1583}
1584
1585/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1586/// if the responder is dropped without sending a response, so that the client
1587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1588impl std::ops::Drop for HidbusSetDescriptorResponder {
1589    fn drop(&mut self) {
1590        self.control_handle.shutdown();
1591        // Safety: drops once, never accessed again
1592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1593    }
1594}
1595
1596impl fidl::endpoints::Responder for HidbusSetDescriptorResponder {
1597    type ControlHandle = HidbusControlHandle;
1598
1599    fn control_handle(&self) -> &HidbusControlHandle {
1600        &self.control_handle
1601    }
1602
1603    fn drop_without_shutdown(mut self) {
1604        // Safety: drops once, never accessed again due to mem::forget
1605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1606        // Prevent Drop from running (which would shut down the channel)
1607        std::mem::forget(self);
1608    }
1609}
1610
1611impl HidbusSetDescriptorResponder {
1612    /// Sends a response to the FIDL transaction.
1613    ///
1614    /// Sets the channel to shutdown if an error occurs.
1615    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1616        let _result = self.send_raw(result);
1617        if _result.is_err() {
1618            self.control_handle.shutdown();
1619        }
1620        self.drop_without_shutdown();
1621        _result
1622    }
1623
1624    /// Similar to "send" but does not shutdown the channel if an error occurs.
1625    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1626        let _result = self.send_raw(result);
1627        self.drop_without_shutdown();
1628        _result
1629    }
1630
1631    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1632        self.control_handle
1633            .inner
1634            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1635                result,
1636                self.tx_id,
1637                0x7567278eba076777,
1638                fidl::encoding::DynamicFlags::empty(),
1639            )
1640    }
1641}
1642
1643#[must_use = "FIDL methods require a response to be sent"]
1644#[derive(Debug)]
1645pub struct HidbusGetReportResponder {
1646    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1647    tx_id: u32,
1648}
1649
1650/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1651/// if the responder is dropped without sending a response, so that the client
1652/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1653impl std::ops::Drop for HidbusGetReportResponder {
1654    fn drop(&mut self) {
1655        self.control_handle.shutdown();
1656        // Safety: drops once, never accessed again
1657        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1658    }
1659}
1660
1661impl fidl::endpoints::Responder for HidbusGetReportResponder {
1662    type ControlHandle = HidbusControlHandle;
1663
1664    fn control_handle(&self) -> &HidbusControlHandle {
1665        &self.control_handle
1666    }
1667
1668    fn drop_without_shutdown(mut self) {
1669        // Safety: drops once, never accessed again due to mem::forget
1670        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1671        // Prevent Drop from running (which would shut down the channel)
1672        std::mem::forget(self);
1673    }
1674}
1675
1676impl HidbusGetReportResponder {
1677    /// Sends a response to the FIDL transaction.
1678    ///
1679    /// Sets the channel to shutdown if an error occurs.
1680    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1681        let _result = self.send_raw(result);
1682        if _result.is_err() {
1683            self.control_handle.shutdown();
1684        }
1685        self.drop_without_shutdown();
1686        _result
1687    }
1688
1689    /// Similar to "send" but does not shutdown the channel if an error occurs.
1690    pub fn send_no_shutdown_on_err(
1691        self,
1692        mut result: Result<&[u8], i32>,
1693    ) -> Result<(), fidl::Error> {
1694        let _result = self.send_raw(result);
1695        self.drop_without_shutdown();
1696        _result
1697    }
1698
1699    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
1700        self.control_handle.inner.send::<fidl::encoding::ResultType<HidbusGetReportResponse, i32>>(
1701            result.map(|data| (data,)),
1702            self.tx_id,
1703            0x69b5538a28dc472c,
1704            fidl::encoding::DynamicFlags::empty(),
1705        )
1706    }
1707}
1708
1709#[must_use = "FIDL methods require a response to be sent"]
1710#[derive(Debug)]
1711pub struct HidbusSetReportResponder {
1712    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1713    tx_id: u32,
1714}
1715
1716/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1717/// if the responder is dropped without sending a response, so that the client
1718/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1719impl std::ops::Drop for HidbusSetReportResponder {
1720    fn drop(&mut self) {
1721        self.control_handle.shutdown();
1722        // Safety: drops once, never accessed again
1723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1724    }
1725}
1726
1727impl fidl::endpoints::Responder for HidbusSetReportResponder {
1728    type ControlHandle = HidbusControlHandle;
1729
1730    fn control_handle(&self) -> &HidbusControlHandle {
1731        &self.control_handle
1732    }
1733
1734    fn drop_without_shutdown(mut self) {
1735        // Safety: drops once, never accessed again due to mem::forget
1736        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1737        // Prevent Drop from running (which would shut down the channel)
1738        std::mem::forget(self);
1739    }
1740}
1741
1742impl HidbusSetReportResponder {
1743    /// Sends a response to the FIDL transaction.
1744    ///
1745    /// Sets the channel to shutdown if an error occurs.
1746    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1747        let _result = self.send_raw(result);
1748        if _result.is_err() {
1749            self.control_handle.shutdown();
1750        }
1751        self.drop_without_shutdown();
1752        _result
1753    }
1754
1755    /// Similar to "send" but does not shutdown the channel if an error occurs.
1756    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1757        let _result = self.send_raw(result);
1758        self.drop_without_shutdown();
1759        _result
1760    }
1761
1762    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1763        self.control_handle
1764            .inner
1765            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1766                result,
1767                self.tx_id,
1768                0x1172863081673c55,
1769                fidl::encoding::DynamicFlags::empty(),
1770            )
1771    }
1772}
1773
1774#[must_use = "FIDL methods require a response to be sent"]
1775#[derive(Debug)]
1776pub struct HidbusGetIdleResponder {
1777    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1778    tx_id: u32,
1779}
1780
1781/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1782/// if the responder is dropped without sending a response, so that the client
1783/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1784impl std::ops::Drop for HidbusGetIdleResponder {
1785    fn drop(&mut self) {
1786        self.control_handle.shutdown();
1787        // Safety: drops once, never accessed again
1788        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1789    }
1790}
1791
1792impl fidl::endpoints::Responder for HidbusGetIdleResponder {
1793    type ControlHandle = HidbusControlHandle;
1794
1795    fn control_handle(&self) -> &HidbusControlHandle {
1796        &self.control_handle
1797    }
1798
1799    fn drop_without_shutdown(mut self) {
1800        // Safety: drops once, never accessed again due to mem::forget
1801        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1802        // Prevent Drop from running (which would shut down the channel)
1803        std::mem::forget(self);
1804    }
1805}
1806
1807impl HidbusGetIdleResponder {
1808    /// Sends a response to the FIDL transaction.
1809    ///
1810    /// Sets the channel to shutdown if an error occurs.
1811    pub fn send(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
1812        let _result = self.send_raw(result);
1813        if _result.is_err() {
1814            self.control_handle.shutdown();
1815        }
1816        self.drop_without_shutdown();
1817        _result
1818    }
1819
1820    /// Similar to "send" but does not shutdown the channel if an error occurs.
1821    pub fn send_no_shutdown_on_err(self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
1822        let _result = self.send_raw(result);
1823        self.drop_without_shutdown();
1824        _result
1825    }
1826
1827    fn send_raw(&self, mut result: Result<i64, i32>) -> Result<(), fidl::Error> {
1828        self.control_handle.inner.send::<fidl::encoding::ResultType<HidbusGetIdleResponse, i32>>(
1829            result.map(|duration| (duration,)),
1830            self.tx_id,
1831            0xa95c2c504d9aa0b,
1832            fidl::encoding::DynamicFlags::empty(),
1833        )
1834    }
1835}
1836
1837#[must_use = "FIDL methods require a response to be sent"]
1838#[derive(Debug)]
1839pub struct HidbusSetIdleResponder {
1840    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1841    tx_id: u32,
1842}
1843
1844/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1845/// if the responder is dropped without sending a response, so that the client
1846/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1847impl std::ops::Drop for HidbusSetIdleResponder {
1848    fn drop(&mut self) {
1849        self.control_handle.shutdown();
1850        // Safety: drops once, never accessed again
1851        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1852    }
1853}
1854
1855impl fidl::endpoints::Responder for HidbusSetIdleResponder {
1856    type ControlHandle = HidbusControlHandle;
1857
1858    fn control_handle(&self) -> &HidbusControlHandle {
1859        &self.control_handle
1860    }
1861
1862    fn drop_without_shutdown(mut self) {
1863        // Safety: drops once, never accessed again due to mem::forget
1864        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1865        // Prevent Drop from running (which would shut down the channel)
1866        std::mem::forget(self);
1867    }
1868}
1869
1870impl HidbusSetIdleResponder {
1871    /// Sends a response to the FIDL transaction.
1872    ///
1873    /// Sets the channel to shutdown if an error occurs.
1874    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1875        let _result = self.send_raw(result);
1876        if _result.is_err() {
1877            self.control_handle.shutdown();
1878        }
1879        self.drop_without_shutdown();
1880        _result
1881    }
1882
1883    /// Similar to "send" but does not shutdown the channel if an error occurs.
1884    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1885        let _result = self.send_raw(result);
1886        self.drop_without_shutdown();
1887        _result
1888    }
1889
1890    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1891        self.control_handle
1892            .inner
1893            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1894                result,
1895                self.tx_id,
1896                0x7c387cbaa4c09b3c,
1897                fidl::encoding::DynamicFlags::empty(),
1898            )
1899    }
1900}
1901
1902#[must_use = "FIDL methods require a response to be sent"]
1903#[derive(Debug)]
1904pub struct HidbusGetProtocolResponder {
1905    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1906    tx_id: u32,
1907}
1908
1909/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1910/// if the responder is dropped without sending a response, so that the client
1911/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1912impl std::ops::Drop for HidbusGetProtocolResponder {
1913    fn drop(&mut self) {
1914        self.control_handle.shutdown();
1915        // Safety: drops once, never accessed again
1916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1917    }
1918}
1919
1920impl fidl::endpoints::Responder for HidbusGetProtocolResponder {
1921    type ControlHandle = HidbusControlHandle;
1922
1923    fn control_handle(&self) -> &HidbusControlHandle {
1924        &self.control_handle
1925    }
1926
1927    fn drop_without_shutdown(mut self) {
1928        // Safety: drops once, never accessed again due to mem::forget
1929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1930        // Prevent Drop from running (which would shut down the channel)
1931        std::mem::forget(self);
1932    }
1933}
1934
1935impl HidbusGetProtocolResponder {
1936    /// Sends a response to the FIDL transaction.
1937    ///
1938    /// Sets the channel to shutdown if an error occurs.
1939    pub fn send(self, mut result: Result<HidProtocol, i32>) -> Result<(), fidl::Error> {
1940        let _result = self.send_raw(result);
1941        if _result.is_err() {
1942            self.control_handle.shutdown();
1943        }
1944        self.drop_without_shutdown();
1945        _result
1946    }
1947
1948    /// Similar to "send" but does not shutdown the channel if an error occurs.
1949    pub fn send_no_shutdown_on_err(
1950        self,
1951        mut result: Result<HidProtocol, i32>,
1952    ) -> Result<(), fidl::Error> {
1953        let _result = self.send_raw(result);
1954        self.drop_without_shutdown();
1955        _result
1956    }
1957
1958    fn send_raw(&self, mut result: Result<HidProtocol, i32>) -> Result<(), fidl::Error> {
1959        self.control_handle
1960            .inner
1961            .send::<fidl::encoding::ResultType<HidbusGetProtocolResponse, i32>>(
1962                result.map(|protocol| (protocol,)),
1963                self.tx_id,
1964                0x3ec61a9b2d5c50eb,
1965                fidl::encoding::DynamicFlags::empty(),
1966            )
1967    }
1968}
1969
1970#[must_use = "FIDL methods require a response to be sent"]
1971#[derive(Debug)]
1972pub struct HidbusSetProtocolResponder {
1973    control_handle: std::mem::ManuallyDrop<HidbusControlHandle>,
1974    tx_id: u32,
1975}
1976
1977/// Set the the channel to be shutdown (see [`HidbusControlHandle::shutdown`])
1978/// if the responder is dropped without sending a response, so that the client
1979/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1980impl std::ops::Drop for HidbusSetProtocolResponder {
1981    fn drop(&mut self) {
1982        self.control_handle.shutdown();
1983        // Safety: drops once, never accessed again
1984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1985    }
1986}
1987
1988impl fidl::endpoints::Responder for HidbusSetProtocolResponder {
1989    type ControlHandle = HidbusControlHandle;
1990
1991    fn control_handle(&self) -> &HidbusControlHandle {
1992        &self.control_handle
1993    }
1994
1995    fn drop_without_shutdown(mut self) {
1996        // Safety: drops once, never accessed again due to mem::forget
1997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1998        // Prevent Drop from running (which would shut down the channel)
1999        std::mem::forget(self);
2000    }
2001}
2002
2003impl HidbusSetProtocolResponder {
2004    /// Sends a response to the FIDL transaction.
2005    ///
2006    /// Sets the channel to shutdown if an error occurs.
2007    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2008        let _result = self.send_raw(result);
2009        if _result.is_err() {
2010            self.control_handle.shutdown();
2011        }
2012        self.drop_without_shutdown();
2013        _result
2014    }
2015
2016    /// Similar to "send" but does not shutdown the channel if an error occurs.
2017    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2018        let _result = self.send_raw(result);
2019        self.drop_without_shutdown();
2020        _result
2021    }
2022
2023    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2024        self.control_handle
2025            .inner
2026            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2027                result,
2028                self.tx_id,
2029                0x1655cdfd0f316b0b,
2030                fidl::encoding::DynamicFlags::empty(),
2031            )
2032    }
2033}
2034
2035#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2036pub struct ServiceMarker;
2037
2038#[cfg(target_os = "fuchsia")]
2039impl fidl::endpoints::ServiceMarker for ServiceMarker {
2040    type Proxy = ServiceProxy;
2041    type Request = ServiceRequest;
2042    const SERVICE_NAME: &'static str = "fuchsia.hardware.hidbus.Service";
2043}
2044
2045/// A request for one of the member protocols of Service.
2046///
2047#[cfg(target_os = "fuchsia")]
2048pub enum ServiceRequest {
2049    Device(HidbusRequestStream),
2050}
2051
2052#[cfg(target_os = "fuchsia")]
2053impl fidl::endpoints::ServiceRequest for ServiceRequest {
2054    type Service = ServiceMarker;
2055
2056    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2057        match name {
2058            "device" => Self::Device(
2059                <HidbusRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2060            ),
2061            _ => panic!("no such member protocol name for service Service"),
2062        }
2063    }
2064
2065    fn member_names() -> &'static [&'static str] {
2066        &["device"]
2067    }
2068}
2069#[cfg(target_os = "fuchsia")]
2070pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2071
2072#[cfg(target_os = "fuchsia")]
2073impl fidl::endpoints::ServiceProxy for ServiceProxy {
2074    type Service = ServiceMarker;
2075
2076    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2077        Self(opener)
2078    }
2079}
2080
2081#[cfg(target_os = "fuchsia")]
2082impl ServiceProxy {
2083    pub fn connect_to_device(&self) -> Result<HidbusProxy, fidl::Error> {
2084        let (proxy, server_end) = fidl::endpoints::create_proxy::<HidbusMarker>();
2085        self.connect_channel_to_device(server_end)?;
2086        Ok(proxy)
2087    }
2088
2089    /// Like `connect_to_device`, but returns a sync proxy.
2090    /// See [`Self::connect_to_device`] for more details.
2091    pub fn connect_to_device_sync(&self) -> Result<HidbusSynchronousProxy, fidl::Error> {
2092        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HidbusMarker>();
2093        self.connect_channel_to_device(server_end)?;
2094        Ok(proxy)
2095    }
2096
2097    /// Like `connect_to_device`, but accepts a server end.
2098    /// See [`Self::connect_to_device`] for more details.
2099    pub fn connect_channel_to_device(
2100        &self,
2101        server_end: fidl::endpoints::ServerEnd<HidbusMarker>,
2102    ) -> Result<(), fidl::Error> {
2103        self.0.open_member("device", server_end.into_channel())
2104    }
2105
2106    pub fn instance_name(&self) -> &str {
2107        self.0.instance_name()
2108    }
2109}
2110
2111mod internal {
2112    use super::*;
2113
2114    impl Report {
2115        #[inline(always)]
2116        fn max_ordinal_present(&self) -> u64 {
2117            if let Some(_) = self.wake_lease {
2118                return 3;
2119            }
2120            if let Some(_) = self.timestamp {
2121                return 2;
2122            }
2123            if let Some(_) = self.buf {
2124                return 1;
2125            }
2126            0
2127        }
2128    }
2129
2130    impl fidl::encoding::ResourceTypeMarker for Report {
2131        type Borrowed<'a> = &'a mut Self;
2132        fn take_or_borrow<'a>(
2133            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2134        ) -> Self::Borrowed<'a> {
2135            value
2136        }
2137    }
2138
2139    unsafe impl fidl::encoding::TypeMarker for Report {
2140        type Owned = Self;
2141
2142        #[inline(always)]
2143        fn inline_align(_context: fidl::encoding::Context) -> usize {
2144            8
2145        }
2146
2147        #[inline(always)]
2148        fn inline_size(_context: fidl::encoding::Context) -> usize {
2149            16
2150        }
2151    }
2152
2153    unsafe impl fidl::encoding::Encode<Report, fidl::encoding::DefaultFuchsiaResourceDialect>
2154        for &mut Report
2155    {
2156        unsafe fn encode(
2157            self,
2158            encoder: &mut fidl::encoding::Encoder<
2159                '_,
2160                fidl::encoding::DefaultFuchsiaResourceDialect,
2161            >,
2162            offset: usize,
2163            mut depth: fidl::encoding::Depth,
2164        ) -> fidl::Result<()> {
2165            encoder.debug_check_bounds::<Report>(offset);
2166            // Vector header
2167            let max_ordinal: u64 = self.max_ordinal_present();
2168            encoder.write_num(max_ordinal, offset);
2169            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2170            // Calling encoder.out_of_line_offset(0) is not allowed.
2171            if max_ordinal == 0 {
2172                return Ok(());
2173            }
2174            depth.increment()?;
2175            let envelope_size = 8;
2176            let bytes_len = max_ordinal as usize * envelope_size;
2177            #[allow(unused_variables)]
2178            let offset = encoder.out_of_line_offset(bytes_len);
2179            let mut _prev_end_offset: usize = 0;
2180            if 1 > max_ordinal {
2181                return Ok(());
2182            }
2183
2184            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2185            // are envelope_size bytes.
2186            let cur_offset: usize = (1 - 1) * envelope_size;
2187
2188            // Zero reserved fields.
2189            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2190
2191            // Safety:
2192            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2193            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2194            //   envelope_size bytes, there is always sufficient room.
2195            fidl::encoding::encode_in_envelope_optional::<
2196                fidl::encoding::Vector<u8, 8192>,
2197                fidl::encoding::DefaultFuchsiaResourceDialect,
2198            >(
2199                self.buf.as_ref().map(
2200                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow,
2201                ),
2202                encoder,
2203                offset + cur_offset,
2204                depth,
2205            )?;
2206
2207            _prev_end_offset = cur_offset + envelope_size;
2208            if 2 > max_ordinal {
2209                return Ok(());
2210            }
2211
2212            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2213            // are envelope_size bytes.
2214            let cur_offset: usize = (2 - 1) * envelope_size;
2215
2216            // Zero reserved fields.
2217            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2218
2219            // Safety:
2220            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2221            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2222            //   envelope_size bytes, there is always sufficient room.
2223            fidl::encoding::encode_in_envelope_optional::<
2224                i64,
2225                fidl::encoding::DefaultFuchsiaResourceDialect,
2226            >(
2227                self.timestamp.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2228                encoder,
2229                offset + cur_offset,
2230                depth,
2231            )?;
2232
2233            _prev_end_offset = cur_offset + envelope_size;
2234            if 3 > max_ordinal {
2235                return Ok(());
2236            }
2237
2238            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2239            // are envelope_size bytes.
2240            let cur_offset: usize = (3 - 1) * envelope_size;
2241
2242            // Zero reserved fields.
2243            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2244
2245            // Safety:
2246            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2247            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2248            //   envelope_size bytes, there is always sufficient room.
2249            fidl::encoding::encode_in_envelope_optional::<
2250                fidl::encoding::HandleType<
2251                    fidl::EventPair,
2252                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2253                    2147483648,
2254                >,
2255                fidl::encoding::DefaultFuchsiaResourceDialect,
2256            >(
2257                self.wake_lease.as_mut().map(
2258                    <fidl::encoding::HandleType<
2259                        fidl::EventPair,
2260                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2261                        2147483648,
2262                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2263                ),
2264                encoder,
2265                offset + cur_offset,
2266                depth,
2267            )?;
2268
2269            _prev_end_offset = cur_offset + envelope_size;
2270
2271            Ok(())
2272        }
2273    }
2274
2275    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Report {
2276        #[inline(always)]
2277        fn new_empty() -> Self {
2278            Self::default()
2279        }
2280
2281        unsafe fn decode(
2282            &mut self,
2283            decoder: &mut fidl::encoding::Decoder<
2284                '_,
2285                fidl::encoding::DefaultFuchsiaResourceDialect,
2286            >,
2287            offset: usize,
2288            mut depth: fidl::encoding::Depth,
2289        ) -> fidl::Result<()> {
2290            decoder.debug_check_bounds::<Self>(offset);
2291            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2292                None => return Err(fidl::Error::NotNullable),
2293                Some(len) => len,
2294            };
2295            // Calling decoder.out_of_line_offset(0) is not allowed.
2296            if len == 0 {
2297                return Ok(());
2298            };
2299            depth.increment()?;
2300            let envelope_size = 8;
2301            let bytes_len = len * envelope_size;
2302            let offset = decoder.out_of_line_offset(bytes_len)?;
2303            // Decode the envelope for each type.
2304            let mut _next_ordinal_to_read = 0;
2305            let mut next_offset = offset;
2306            let end_offset = offset + bytes_len;
2307            _next_ordinal_to_read += 1;
2308            if next_offset >= end_offset {
2309                return Ok(());
2310            }
2311
2312            // Decode unknown envelopes for gaps in ordinals.
2313            while _next_ordinal_to_read < 1 {
2314                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2315                _next_ordinal_to_read += 1;
2316                next_offset += envelope_size;
2317            }
2318
2319            let next_out_of_line = decoder.next_out_of_line();
2320            let handles_before = decoder.remaining_handles();
2321            if let Some((inlined, num_bytes, num_handles)) =
2322                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2323            {
2324                let member_inline_size =
2325                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
2326                        decoder.context,
2327                    );
2328                if inlined != (member_inline_size <= 4) {
2329                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2330                }
2331                let inner_offset;
2332                let mut inner_depth = depth.clone();
2333                if inlined {
2334                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2335                    inner_offset = next_offset;
2336                } else {
2337                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2338                    inner_depth.increment()?;
2339                }
2340                let val_ref =
2341                self.buf.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect));
2342                fidl::decode!(fidl::encoding::Vector<u8, 8192>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2343                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2344                {
2345                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2346                }
2347                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2348                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2349                }
2350            }
2351
2352            next_offset += envelope_size;
2353            _next_ordinal_to_read += 1;
2354            if next_offset >= end_offset {
2355                return Ok(());
2356            }
2357
2358            // Decode unknown envelopes for gaps in ordinals.
2359            while _next_ordinal_to_read < 2 {
2360                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2361                _next_ordinal_to_read += 1;
2362                next_offset += envelope_size;
2363            }
2364
2365            let next_out_of_line = decoder.next_out_of_line();
2366            let handles_before = decoder.remaining_handles();
2367            if let Some((inlined, num_bytes, num_handles)) =
2368                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2369            {
2370                let member_inline_size =
2371                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2372                if inlined != (member_inline_size <= 4) {
2373                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2374                }
2375                let inner_offset;
2376                let mut inner_depth = depth.clone();
2377                if inlined {
2378                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2379                    inner_offset = next_offset;
2380                } else {
2381                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2382                    inner_depth.increment()?;
2383                }
2384                let val_ref = self.timestamp.get_or_insert_with(|| {
2385                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
2386                });
2387                fidl::decode!(
2388                    i64,
2389                    fidl::encoding::DefaultFuchsiaResourceDialect,
2390                    val_ref,
2391                    decoder,
2392                    inner_offset,
2393                    inner_depth
2394                )?;
2395                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2396                {
2397                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2398                }
2399                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2400                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2401                }
2402            }
2403
2404            next_offset += envelope_size;
2405            _next_ordinal_to_read += 1;
2406            if next_offset >= end_offset {
2407                return Ok(());
2408            }
2409
2410            // Decode unknown envelopes for gaps in ordinals.
2411            while _next_ordinal_to_read < 3 {
2412                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2413                _next_ordinal_to_read += 1;
2414                next_offset += envelope_size;
2415            }
2416
2417            let next_out_of_line = decoder.next_out_of_line();
2418            let handles_before = decoder.remaining_handles();
2419            if let Some((inlined, num_bytes, num_handles)) =
2420                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2421            {
2422                let member_inline_size = <fidl::encoding::HandleType<
2423                    fidl::EventPair,
2424                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2425                    2147483648,
2426                > as fidl::encoding::TypeMarker>::inline_size(
2427                    decoder.context
2428                );
2429                if inlined != (member_inline_size <= 4) {
2430                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2431                }
2432                let inner_offset;
2433                let mut inner_depth = depth.clone();
2434                if inlined {
2435                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2436                    inner_offset = next_offset;
2437                } else {
2438                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2439                    inner_depth.increment()?;
2440                }
2441                let val_ref =
2442                self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
2443                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
2444                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2445                {
2446                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2447                }
2448                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2449                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2450                }
2451            }
2452
2453            next_offset += envelope_size;
2454
2455            // Decode the remaining unknown envelopes.
2456            while next_offset < end_offset {
2457                _next_ordinal_to_read += 1;
2458                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2459                next_offset += envelope_size;
2460            }
2461
2462            Ok(())
2463        }
2464    }
2465}