Skip to main content

fidl_fuchsia_input_report/
fidl_fuchsia_input_report.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_input_report_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct InputDeviceGetInputReportsReaderRequest {
16    pub reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for InputDeviceGetInputReportsReaderRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct InputDeviceGetInputReportsReaderV2Request {
26    pub reader: fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
27    /// The maximum number of unacknowledged `OnInputReports` events that the client
28    /// requests the device to allow in flight simultaneously.
29    ///
30    /// The client should determine this value based on product configuration and
31    /// processing capabilities. The device uses this limit as an upper bound when
32    /// deciding the effective `max_unacknowledged_reports` returned in the response.
33    pub max_unacknowledged_reports_limit: u16,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
37    for InputDeviceGetInputReportsReaderV2Request
38{
39}
40
41#[derive(Debug, PartialEq)]
42pub struct InputDeviceGetInputReportResponse {
43    pub report: InputReport,
44}
45
46impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
47    for InputDeviceGetInputReportResponse
48{
49}
50
51#[derive(Debug, PartialEq)]
52pub struct InputReportsReaderV2OnInputReportsRequest {
53    pub reports: Vec<InputReport>,
54    /// Each report is associated with a strictly monotonic numerical report
55    /// stamp. This field contains the report stamp for the last element in
56    /// `reports`.
57    pub last_report_stamp: u64,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for InputReportsReaderV2OnInputReportsRequest
62{
63}
64
65#[derive(Debug, PartialEq)]
66pub struct InputReportsReaderReadInputReportsResponse {
67    pub reports: Vec<InputReport>,
68}
69
70impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
71    for InputReportsReaderReadInputReportsResponse
72{
73}
74
75/// An `InputReport` is a single report that is created by an input device.
76/// An `InputReport` can contain one of many different report types. The report
77/// types are not mutually exclusive. The `event_time` is the time in
78/// nanoseconds when the report was generated.
79#[derive(Debug, Default, PartialEq)]
80pub struct InputReport {
81    /// The monotonic time when the event was generated.
82    ///
83    /// Required.
84    pub event_time: Option<i64>,
85    /// Optional. Present iff the device reports mouse input.
86    pub mouse: Option<MouseInputReport>,
87    /// Unique ID to connect trace async begin/end events.
88    ///
89    /// Optional.
90    pub trace_id: Option<u64>,
91    /// Optional. Present iff the device reports sensor input.
92    pub sensor: Option<SensorInputReport>,
93    /// Optional. Present iff the device reports touch input.
94    pub touch: Option<TouchInputReport>,
95    /// Optional. Present iff the device reports keyboard input.
96    pub keyboard: Option<KeyboardInputReport>,
97    /// Optional. Present iff the device reports consumer control input.
98    pub consumer_control: Option<ConsumerControlInputReport>,
99    /// A device may have multiple input descriptors of the same type. This
100    /// field specifies which descriptor this InputReport corresponds to.
101    /// Omitted if the device has no more than one descriptor for each type.
102    ///
103    /// Optional.
104    pub report_id: Option<u8>,
105    /// Optional wake lease for power baton passing.
106    pub wake_lease: Option<fidl::EventPair>,
107    #[doc(hidden)]
108    pub __source_breaking: fidl::marker::SourceBreaking,
109}
110
111impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {}
112
113#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
114pub struct InputDeviceMarker;
115
116impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
117    type Proxy = InputDeviceProxy;
118    type RequestStream = InputDeviceRequestStream;
119    #[cfg(target_os = "fuchsia")]
120    type SynchronousProxy = InputDeviceSynchronousProxy;
121
122    const DEBUG_NAME: &'static str = "fuchsia.input.report.InputDevice";
123}
124impl fidl::endpoints::DiscoverableProtocolMarker for InputDeviceMarker {}
125pub type InputDeviceSendOutputReportResult = Result<(), i32>;
126pub type InputDeviceGetFeatureReportResult = Result<FeatureReport, i32>;
127pub type InputDeviceSetFeatureReportResult = Result<(), i32>;
128pub type InputDeviceGetInputReportResult = Result<InputReport, i32>;
129
130pub trait InputDeviceProxyInterface: Send + Sync {
131    fn r#get_input_reports_reader(
132        &self,
133        reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
134    ) -> Result<(), fidl::Error>;
135    type GetInputReportsReaderV2ResponseFut: std::future::Future<Output = Result<u16, fidl::Error>>
136        + Send;
137    fn r#get_input_reports_reader_v2(
138        &self,
139        reader: fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
140        max_unacknowledged_reports_limit: u16,
141    ) -> Self::GetInputReportsReaderV2ResponseFut;
142    type GetDescriptorResponseFut: std::future::Future<Output = Result<DeviceDescriptor, fidl::Error>>
143        + Send;
144    fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut;
145    type SendOutputReportResponseFut: std::future::Future<Output = Result<InputDeviceSendOutputReportResult, fidl::Error>>
146        + Send;
147    fn r#send_output_report(&self, report: &OutputReport) -> Self::SendOutputReportResponseFut;
148    type GetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceGetFeatureReportResult, fidl::Error>>
149        + Send;
150    fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut;
151    type SetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceSetFeatureReportResult, fidl::Error>>
152        + Send;
153    fn r#set_feature_report(&self, report: &FeatureReport) -> Self::SetFeatureReportResponseFut;
154    type GetInputReportResponseFut: std::future::Future<Output = Result<InputDeviceGetInputReportResult, fidl::Error>>
155        + Send;
156    fn r#get_input_report(&self, device_type: DeviceType) -> Self::GetInputReportResponseFut;
157}
158#[derive(Debug)]
159#[cfg(target_os = "fuchsia")]
160pub struct InputDeviceSynchronousProxy {
161    client: fidl::client::sync::Client,
162}
163
164#[cfg(target_os = "fuchsia")]
165impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
166    type Proxy = InputDeviceProxy;
167    type Protocol = InputDeviceMarker;
168
169    fn from_channel(inner: fidl::Channel) -> Self {
170        Self::new(inner)
171    }
172
173    fn into_channel(self) -> fidl::Channel {
174        self.client.into_channel()
175    }
176
177    fn as_channel(&self) -> &fidl::Channel {
178        self.client.as_channel()
179    }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl InputDeviceSynchronousProxy {
184    pub fn new(channel: fidl::Channel) -> Self {
185        Self { client: fidl::client::sync::Client::new(channel) }
186    }
187
188    pub fn into_channel(self) -> fidl::Channel {
189        self.client.into_channel()
190    }
191
192    /// Waits until an event arrives and returns it. It is safe for other
193    /// threads to make concurrent requests while waiting for an event.
194    pub fn wait_for_event(
195        &self,
196        deadline: zx::MonotonicInstant,
197    ) -> Result<InputDeviceEvent, fidl::Error> {
198        InputDeviceEvent::decode(self.client.wait_for_event::<InputDeviceMarker>(deadline)?)
199    }
200
201    /// Open a new InputReportsReader on this device. Each reader receives
202    /// their own reports.
203    pub fn r#get_input_reports_reader(
204        &self,
205        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
206    ) -> Result<(), fidl::Error> {
207        self.client.send::<InputDeviceGetInputReportsReaderRequest>(
208            (reader,),
209            0x68d9cf83e397ab41,
210            fidl::encoding::DynamicFlags::empty(),
211        )
212    }
213
214    /// Open a new InputReportsReaderV2 on this device. Each reader receives
215    /// the full stream of event reports.
216    pub fn r#get_input_reports_reader_v2(
217        &self,
218        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
219        mut max_unacknowledged_reports_limit: u16,
220        ___deadline: zx::MonotonicInstant,
221    ) -> Result<u16, fidl::Error> {
222        let _response = self.client.send_query::<
223            InputDeviceGetInputReportsReaderV2Request,
224            InputDeviceGetInputReportsReaderV2Response,
225            InputDeviceMarker,
226        >(
227            (reader, max_unacknowledged_reports_limit,),
228            0x67184c2f21c9051,
229            fidl::encoding::DynamicFlags::empty(),
230            ___deadline,
231        )?;
232        Ok(_response.max_unacknowledged_reports)
233    }
234
235    /// Gets the device descriptor for this device.
236    pub fn r#get_descriptor(
237        &self,
238        ___deadline: zx::MonotonicInstant,
239    ) -> Result<DeviceDescriptor, fidl::Error> {
240        let _response = self.client.send_query::<
241            fidl::encoding::EmptyPayload,
242            InputDeviceGetDescriptorResponse,
243            InputDeviceMarker,
244        >(
245            (),
246            0x3d76420f2ff8ad32,
247            fidl::encoding::DynamicFlags::empty(),
248            ___deadline,
249        )?;
250        Ok(_response.descriptor)
251    }
252
253    /// Send a single output report to the device. This will throw an error
254    /// if the output report does not follow the OutputDescriptor.
255    pub fn r#send_output_report(
256        &self,
257        mut report: &OutputReport,
258        ___deadline: zx::MonotonicInstant,
259    ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
260        let _response = self.client.send_query::<
261            InputDeviceSendOutputReportRequest,
262            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
263            InputDeviceMarker,
264        >(
265            (report,),
266            0x67a4888774e6f3a,
267            fidl::encoding::DynamicFlags::empty(),
268            ___deadline,
269        )?;
270        Ok(_response.map(|x| x))
271    }
272
273    /// Get the feature report for a given device. This requests the state of
274    /// the device's features.
275    pub fn r#get_feature_report(
276        &self,
277        ___deadline: zx::MonotonicInstant,
278    ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
279        let _response = self.client.send_query::<
280            fidl::encoding::EmptyPayload,
281            fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
282            InputDeviceMarker,
283        >(
284            (),
285            0x497a7d98d9391f16,
286            fidl::encoding::DynamicFlags::empty(),
287            ___deadline,
288        )?;
289        Ok(_response.map(|x| x.report))
290    }
291
292    /// Set the feature report for a given device. This sets the state of
293    /// the device's features.
294    pub fn r#set_feature_report(
295        &self,
296        mut report: &FeatureReport,
297        ___deadline: zx::MonotonicInstant,
298    ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
299        let _response = self.client.send_query::<
300            InputDeviceSetFeatureReportRequest,
301            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
302            InputDeviceMarker,
303        >(
304            (report,),
305            0x7679a2f5a42842ef,
306            fidl::encoding::DynamicFlags::empty(),
307            ___deadline,
308        )?;
309        Ok(_response.map(|x| x))
310    }
311
312    /// For general cases, InputReportReader is the preferred way of getting
313    /// InputReports. For devices that don't send InputReports naturally, this
314    /// method can be used to request a report from the device type indicated.
315    /// Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or
316    /// `device_type` are not supported.
317    pub fn r#get_input_report(
318        &self,
319        mut device_type: DeviceType,
320        ___deadline: zx::MonotonicInstant,
321    ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
322        let _response = self.client.send_query::<
323            InputDeviceGetInputReportRequest,
324            fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
325            InputDeviceMarker,
326        >(
327            (device_type,),
328            0x4752ccab96c10248,
329            fidl::encoding::DynamicFlags::empty(),
330            ___deadline,
331        )?;
332        Ok(_response.map(|x| x.report))
333    }
334}
335
336#[cfg(target_os = "fuchsia")]
337impl From<InputDeviceSynchronousProxy> for zx::NullableHandle {
338    fn from(value: InputDeviceSynchronousProxy) -> Self {
339        value.into_channel().into()
340    }
341}
342
343#[cfg(target_os = "fuchsia")]
344impl From<fidl::Channel> for InputDeviceSynchronousProxy {
345    fn from(value: fidl::Channel) -> Self {
346        Self::new(value)
347    }
348}
349
350#[cfg(target_os = "fuchsia")]
351impl fidl::endpoints::FromClient for InputDeviceSynchronousProxy {
352    type Protocol = InputDeviceMarker;
353
354    fn from_client(value: fidl::endpoints::ClientEnd<InputDeviceMarker>) -> Self {
355        Self::new(value.into_channel())
356    }
357}
358
359#[derive(Debug, Clone)]
360pub struct InputDeviceProxy {
361    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
362}
363
364impl fidl::endpoints::Proxy for InputDeviceProxy {
365    type Protocol = InputDeviceMarker;
366
367    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
368        Self::new(inner)
369    }
370
371    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
372        self.client.into_channel().map_err(|client| Self { client })
373    }
374
375    fn as_channel(&self) -> &::fidl::AsyncChannel {
376        self.client.as_channel()
377    }
378}
379
380impl InputDeviceProxy {
381    /// Create a new Proxy for fuchsia.input.report/InputDevice.
382    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
383        let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
384        Self { client: fidl::client::Client::new(channel, protocol_name) }
385    }
386
387    /// Get a Stream of events from the remote end of the protocol.
388    ///
389    /// # Panics
390    ///
391    /// Panics if the event stream was already taken.
392    pub fn take_event_stream(&self) -> InputDeviceEventStream {
393        InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
394    }
395
396    /// Open a new InputReportsReader on this device. Each reader receives
397    /// their own reports.
398    pub fn r#get_input_reports_reader(
399        &self,
400        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
401    ) -> Result<(), fidl::Error> {
402        InputDeviceProxyInterface::r#get_input_reports_reader(self, reader)
403    }
404
405    /// Open a new InputReportsReaderV2 on this device. Each reader receives
406    /// the full stream of event reports.
407    pub fn r#get_input_reports_reader_v2(
408        &self,
409        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
410        mut max_unacknowledged_reports_limit: u16,
411    ) -> fidl::client::QueryResponseFut<u16, fidl::encoding::DefaultFuchsiaResourceDialect> {
412        InputDeviceProxyInterface::r#get_input_reports_reader_v2(
413            self,
414            reader,
415            max_unacknowledged_reports_limit,
416        )
417    }
418
419    /// Gets the device descriptor for this device.
420    pub fn r#get_descriptor(
421        &self,
422    ) -> fidl::client::QueryResponseFut<
423        DeviceDescriptor,
424        fidl::encoding::DefaultFuchsiaResourceDialect,
425    > {
426        InputDeviceProxyInterface::r#get_descriptor(self)
427    }
428
429    /// Send a single output report to the device. This will throw an error
430    /// if the output report does not follow the OutputDescriptor.
431    pub fn r#send_output_report(
432        &self,
433        mut report: &OutputReport,
434    ) -> fidl::client::QueryResponseFut<
435        InputDeviceSendOutputReportResult,
436        fidl::encoding::DefaultFuchsiaResourceDialect,
437    > {
438        InputDeviceProxyInterface::r#send_output_report(self, report)
439    }
440
441    /// Get the feature report for a given device. This requests the state of
442    /// the device's features.
443    pub fn r#get_feature_report(
444        &self,
445    ) -> fidl::client::QueryResponseFut<
446        InputDeviceGetFeatureReportResult,
447        fidl::encoding::DefaultFuchsiaResourceDialect,
448    > {
449        InputDeviceProxyInterface::r#get_feature_report(self)
450    }
451
452    /// Set the feature report for a given device. This sets the state of
453    /// the device's features.
454    pub fn r#set_feature_report(
455        &self,
456        mut report: &FeatureReport,
457    ) -> fidl::client::QueryResponseFut<
458        InputDeviceSetFeatureReportResult,
459        fidl::encoding::DefaultFuchsiaResourceDialect,
460    > {
461        InputDeviceProxyInterface::r#set_feature_report(self, report)
462    }
463
464    /// For general cases, InputReportReader is the preferred way of getting
465    /// InputReports. For devices that don't send InputReports naturally, this
466    /// method can be used to request a report from the device type indicated.
467    /// Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or
468    /// `device_type` are not supported.
469    pub fn r#get_input_report(
470        &self,
471        mut device_type: DeviceType,
472    ) -> fidl::client::QueryResponseFut<
473        InputDeviceGetInputReportResult,
474        fidl::encoding::DefaultFuchsiaResourceDialect,
475    > {
476        InputDeviceProxyInterface::r#get_input_report(self, device_type)
477    }
478}
479
480impl InputDeviceProxyInterface for InputDeviceProxy {
481    fn r#get_input_reports_reader(
482        &self,
483        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
484    ) -> Result<(), fidl::Error> {
485        self.client.send::<InputDeviceGetInputReportsReaderRequest>(
486            (reader,),
487            0x68d9cf83e397ab41,
488            fidl::encoding::DynamicFlags::empty(),
489        )
490    }
491
492    type GetInputReportsReaderV2ResponseFut =
493        fidl::client::QueryResponseFut<u16, fidl::encoding::DefaultFuchsiaResourceDialect>;
494    fn r#get_input_reports_reader_v2(
495        &self,
496        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
497        mut max_unacknowledged_reports_limit: u16,
498    ) -> Self::GetInputReportsReaderV2ResponseFut {
499        fn _decode(
500            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
501        ) -> Result<u16, fidl::Error> {
502            let _response = fidl::client::decode_transaction_body::<
503                InputDeviceGetInputReportsReaderV2Response,
504                fidl::encoding::DefaultFuchsiaResourceDialect,
505                0x67184c2f21c9051,
506            >(_buf?)?;
507            Ok(_response.max_unacknowledged_reports)
508        }
509        self.client.send_query_and_decode::<InputDeviceGetInputReportsReaderV2Request, u16>(
510            (reader, max_unacknowledged_reports_limit),
511            0x67184c2f21c9051,
512            fidl::encoding::DynamicFlags::empty(),
513            _decode,
514        )
515    }
516
517    type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
518        DeviceDescriptor,
519        fidl::encoding::DefaultFuchsiaResourceDialect,
520    >;
521    fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut {
522        fn _decode(
523            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
524        ) -> Result<DeviceDescriptor, fidl::Error> {
525            let _response = fidl::client::decode_transaction_body::<
526                InputDeviceGetDescriptorResponse,
527                fidl::encoding::DefaultFuchsiaResourceDialect,
528                0x3d76420f2ff8ad32,
529            >(_buf?)?;
530            Ok(_response.descriptor)
531        }
532        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescriptor>(
533            (),
534            0x3d76420f2ff8ad32,
535            fidl::encoding::DynamicFlags::empty(),
536            _decode,
537        )
538    }
539
540    type SendOutputReportResponseFut = fidl::client::QueryResponseFut<
541        InputDeviceSendOutputReportResult,
542        fidl::encoding::DefaultFuchsiaResourceDialect,
543    >;
544    fn r#send_output_report(&self, mut report: &OutputReport) -> Self::SendOutputReportResponseFut {
545        fn _decode(
546            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
547        ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
548            let _response = fidl::client::decode_transaction_body::<
549                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
550                fidl::encoding::DefaultFuchsiaResourceDialect,
551                0x67a4888774e6f3a,
552            >(_buf?)?;
553            Ok(_response.map(|x| x))
554        }
555        self.client.send_query_and_decode::<
556            InputDeviceSendOutputReportRequest,
557            InputDeviceSendOutputReportResult,
558        >(
559            (report,),
560            0x67a4888774e6f3a,
561            fidl::encoding::DynamicFlags::empty(),
562            _decode,
563        )
564    }
565
566    type GetFeatureReportResponseFut = fidl::client::QueryResponseFut<
567        InputDeviceGetFeatureReportResult,
568        fidl::encoding::DefaultFuchsiaResourceDialect,
569    >;
570    fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut {
571        fn _decode(
572            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
573        ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
574            let _response = fidl::client::decode_transaction_body::<
575                fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
576                fidl::encoding::DefaultFuchsiaResourceDialect,
577                0x497a7d98d9391f16,
578            >(_buf?)?;
579            Ok(_response.map(|x| x.report))
580        }
581        self.client.send_query_and_decode::<
582            fidl::encoding::EmptyPayload,
583            InputDeviceGetFeatureReportResult,
584        >(
585            (),
586            0x497a7d98d9391f16,
587            fidl::encoding::DynamicFlags::empty(),
588            _decode,
589        )
590    }
591
592    type SetFeatureReportResponseFut = fidl::client::QueryResponseFut<
593        InputDeviceSetFeatureReportResult,
594        fidl::encoding::DefaultFuchsiaResourceDialect,
595    >;
596    fn r#set_feature_report(
597        &self,
598        mut report: &FeatureReport,
599    ) -> Self::SetFeatureReportResponseFut {
600        fn _decode(
601            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
602        ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
603            let _response = fidl::client::decode_transaction_body::<
604                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
605                fidl::encoding::DefaultFuchsiaResourceDialect,
606                0x7679a2f5a42842ef,
607            >(_buf?)?;
608            Ok(_response.map(|x| x))
609        }
610        self.client.send_query_and_decode::<
611            InputDeviceSetFeatureReportRequest,
612            InputDeviceSetFeatureReportResult,
613        >(
614            (report,),
615            0x7679a2f5a42842ef,
616            fidl::encoding::DynamicFlags::empty(),
617            _decode,
618        )
619    }
620
621    type GetInputReportResponseFut = fidl::client::QueryResponseFut<
622        InputDeviceGetInputReportResult,
623        fidl::encoding::DefaultFuchsiaResourceDialect,
624    >;
625    fn r#get_input_report(&self, mut device_type: DeviceType) -> Self::GetInputReportResponseFut {
626        fn _decode(
627            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
628        ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
629            let _response = fidl::client::decode_transaction_body::<
630                fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
631                fidl::encoding::DefaultFuchsiaResourceDialect,
632                0x4752ccab96c10248,
633            >(_buf?)?;
634            Ok(_response.map(|x| x.report))
635        }
636        self.client.send_query_and_decode::<
637            InputDeviceGetInputReportRequest,
638            InputDeviceGetInputReportResult,
639        >(
640            (device_type,),
641            0x4752ccab96c10248,
642            fidl::encoding::DynamicFlags::empty(),
643            _decode,
644        )
645    }
646}
647
648pub struct InputDeviceEventStream {
649    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
650}
651
652impl std::marker::Unpin for InputDeviceEventStream {}
653
654impl futures::stream::FusedStream for InputDeviceEventStream {
655    fn is_terminated(&self) -> bool {
656        self.event_receiver.is_terminated()
657    }
658}
659
660impl futures::Stream for InputDeviceEventStream {
661    type Item = Result<InputDeviceEvent, fidl::Error>;
662
663    fn poll_next(
664        mut self: std::pin::Pin<&mut Self>,
665        cx: &mut std::task::Context<'_>,
666    ) -> std::task::Poll<Option<Self::Item>> {
667        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
668            &mut self.event_receiver,
669            cx
670        )?) {
671            Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
672            None => std::task::Poll::Ready(None),
673        }
674    }
675}
676
677#[derive(Debug)]
678pub enum InputDeviceEvent {
679    #[non_exhaustive]
680    _UnknownEvent {
681        /// Ordinal of the event that was sent.
682        ordinal: u64,
683    },
684}
685
686impl InputDeviceEvent {
687    /// Decodes a message buffer as a [`InputDeviceEvent`].
688    fn decode(
689        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
690    ) -> Result<InputDeviceEvent, fidl::Error> {
691        let (bytes, _handles) = buf.split_mut();
692        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
693        debug_assert_eq!(tx_header.tx_id, 0);
694        match tx_header.ordinal {
695            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
696                Ok(InputDeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
697            }
698            _ => Err(fidl::Error::UnknownOrdinal {
699                ordinal: tx_header.ordinal,
700                protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
701            }),
702        }
703    }
704}
705
706/// A Stream of incoming requests for fuchsia.input.report/InputDevice.
707pub struct InputDeviceRequestStream {
708    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
709    is_terminated: bool,
710}
711
712impl std::marker::Unpin for InputDeviceRequestStream {}
713
714impl futures::stream::FusedStream for InputDeviceRequestStream {
715    fn is_terminated(&self) -> bool {
716        self.is_terminated
717    }
718}
719
720impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
721    type Protocol = InputDeviceMarker;
722    type ControlHandle = InputDeviceControlHandle;
723
724    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
725        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
726    }
727
728    fn control_handle(&self) -> Self::ControlHandle {
729        InputDeviceControlHandle { inner: self.inner.clone() }
730    }
731
732    fn into_inner(
733        self,
734    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
735    {
736        (self.inner, self.is_terminated)
737    }
738
739    fn from_inner(
740        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
741        is_terminated: bool,
742    ) -> Self {
743        Self { inner, is_terminated }
744    }
745}
746
747impl futures::Stream for InputDeviceRequestStream {
748    type Item = Result<InputDeviceRequest, fidl::Error>;
749
750    fn poll_next(
751        mut self: std::pin::Pin<&mut Self>,
752        cx: &mut std::task::Context<'_>,
753    ) -> std::task::Poll<Option<Self::Item>> {
754        let this = &mut *self;
755        if this.inner.check_shutdown(cx) {
756            this.is_terminated = true;
757            return std::task::Poll::Ready(None);
758        }
759        if this.is_terminated {
760            panic!("polled InputDeviceRequestStream after completion");
761        }
762        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
763            |bytes, handles| {
764                match this.inner.channel().read_etc(cx, bytes, handles) {
765                    std::task::Poll::Ready(Ok(())) => {}
766                    std::task::Poll::Pending => return std::task::Poll::Pending,
767                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
768                        this.is_terminated = true;
769                        return std::task::Poll::Ready(None);
770                    }
771                    std::task::Poll::Ready(Err(e)) => {
772                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
773                            e.into(),
774                        ))));
775                    }
776                }
777
778                // A message has been received from the channel
779                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
780
781                std::task::Poll::Ready(Some(match header.ordinal {
782                    0x68d9cf83e397ab41 => {
783                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
784                        let mut req = fidl::new_empty!(
785                            InputDeviceGetInputReportsReaderRequest,
786                            fidl::encoding::DefaultFuchsiaResourceDialect
787                        );
788                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
789                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
790                        Ok(InputDeviceRequest::GetInputReportsReader {
791                            reader: req.reader,
792
793                            control_handle,
794                        })
795                    }
796                    0x67184c2f21c9051 => {
797                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
798                        let mut req = fidl::new_empty!(
799                            InputDeviceGetInputReportsReaderV2Request,
800                            fidl::encoding::DefaultFuchsiaResourceDialect
801                        );
802                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportsReaderV2Request>(&header, _body_bytes, handles, &mut req)?;
803                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
804                        Ok(InputDeviceRequest::GetInputReportsReaderV2 {
805                            reader: req.reader,
806                            max_unacknowledged_reports_limit: req.max_unacknowledged_reports_limit,
807
808                            responder: InputDeviceGetInputReportsReaderV2Responder {
809                                control_handle: std::mem::ManuallyDrop::new(control_handle),
810                                tx_id: header.tx_id,
811                            },
812                        })
813                    }
814                    0x3d76420f2ff8ad32 => {
815                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
816                        let mut req = fidl::new_empty!(
817                            fidl::encoding::EmptyPayload,
818                            fidl::encoding::DefaultFuchsiaResourceDialect
819                        );
820                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
821                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
822                        Ok(InputDeviceRequest::GetDescriptor {
823                            responder: InputDeviceGetDescriptorResponder {
824                                control_handle: std::mem::ManuallyDrop::new(control_handle),
825                                tx_id: header.tx_id,
826                            },
827                        })
828                    }
829                    0x67a4888774e6f3a => {
830                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
831                        let mut req = fidl::new_empty!(
832                            InputDeviceSendOutputReportRequest,
833                            fidl::encoding::DefaultFuchsiaResourceDialect
834                        );
835                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSendOutputReportRequest>(&header, _body_bytes, handles, &mut req)?;
836                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
837                        Ok(InputDeviceRequest::SendOutputReport {
838                            report: req.report,
839
840                            responder: InputDeviceSendOutputReportResponder {
841                                control_handle: std::mem::ManuallyDrop::new(control_handle),
842                                tx_id: header.tx_id,
843                            },
844                        })
845                    }
846                    0x497a7d98d9391f16 => {
847                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
848                        let mut req = fidl::new_empty!(
849                            fidl::encoding::EmptyPayload,
850                            fidl::encoding::DefaultFuchsiaResourceDialect
851                        );
852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
853                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
854                        Ok(InputDeviceRequest::GetFeatureReport {
855                            responder: InputDeviceGetFeatureReportResponder {
856                                control_handle: std::mem::ManuallyDrop::new(control_handle),
857                                tx_id: header.tx_id,
858                            },
859                        })
860                    }
861                    0x7679a2f5a42842ef => {
862                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
863                        let mut req = fidl::new_empty!(
864                            InputDeviceSetFeatureReportRequest,
865                            fidl::encoding::DefaultFuchsiaResourceDialect
866                        );
867                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSetFeatureReportRequest>(&header, _body_bytes, handles, &mut req)?;
868                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
869                        Ok(InputDeviceRequest::SetFeatureReport {
870                            report: req.report,
871
872                            responder: InputDeviceSetFeatureReportResponder {
873                                control_handle: std::mem::ManuallyDrop::new(control_handle),
874                                tx_id: header.tx_id,
875                            },
876                        })
877                    }
878                    0x4752ccab96c10248 => {
879                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
880                        let mut req = fidl::new_empty!(
881                            InputDeviceGetInputReportRequest,
882                            fidl::encoding::DefaultFuchsiaResourceDialect
883                        );
884                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportRequest>(&header, _body_bytes, handles, &mut req)?;
885                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
886                        Ok(InputDeviceRequest::GetInputReport {
887                            device_type: req.device_type,
888
889                            responder: InputDeviceGetInputReportResponder {
890                                control_handle: std::mem::ManuallyDrop::new(control_handle),
891                                tx_id: header.tx_id,
892                            },
893                        })
894                    }
895                    _ if header.tx_id == 0
896                        && header
897                            .dynamic_flags()
898                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
899                    {
900                        Ok(InputDeviceRequest::_UnknownMethod {
901                            ordinal: header.ordinal,
902                            control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
903                            method_type: fidl::MethodType::OneWay,
904                        })
905                    }
906                    _ if header
907                        .dynamic_flags()
908                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
909                    {
910                        this.inner.send_framework_err(
911                            fidl::encoding::FrameworkErr::UnknownMethod,
912                            header.tx_id,
913                            header.ordinal,
914                            header.dynamic_flags(),
915                            (bytes, handles),
916                        )?;
917                        Ok(InputDeviceRequest::_UnknownMethod {
918                            ordinal: header.ordinal,
919                            control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
920                            method_type: fidl::MethodType::TwoWay,
921                        })
922                    }
923                    _ => Err(fidl::Error::UnknownOrdinal {
924                        ordinal: header.ordinal,
925                        protocol_name:
926                            <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
927                    }),
928                }))
929            },
930        )
931    }
932}
933
934/// An `InputDevice` driver represents a single physical input device.
935/// The InputDevice maintains an internal FIFO of `MAX_DEVICE_REPORT_COUNT`
936/// reports for each client that connects. Reports are removed from the FIFO
937/// once they are read by the client. If the FIFO is full, it will drop the
938/// oldest report to make room for an incoming report.
939#[derive(Debug)]
940pub enum InputDeviceRequest {
941    /// Open a new InputReportsReader on this device. Each reader receives
942    /// their own reports.
943    GetInputReportsReader {
944        reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
945        control_handle: InputDeviceControlHandle,
946    },
947    /// Open a new InputReportsReaderV2 on this device. Each reader receives
948    /// the full stream of event reports.
949    GetInputReportsReaderV2 {
950        reader: fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
951        max_unacknowledged_reports_limit: u16,
952        responder: InputDeviceGetInputReportsReaderV2Responder,
953    },
954    /// Gets the device descriptor for this device.
955    GetDescriptor { responder: InputDeviceGetDescriptorResponder },
956    /// Send a single output report to the device. This will throw an error
957    /// if the output report does not follow the OutputDescriptor.
958    SendOutputReport { report: OutputReport, responder: InputDeviceSendOutputReportResponder },
959    /// Get the feature report for a given device. This requests the state of
960    /// the device's features.
961    GetFeatureReport { responder: InputDeviceGetFeatureReportResponder },
962    /// Set the feature report for a given device. This sets the state of
963    /// the device's features.
964    SetFeatureReport { report: FeatureReport, responder: InputDeviceSetFeatureReportResponder },
965    /// For general cases, InputReportReader is the preferred way of getting
966    /// InputReports. For devices that don't send InputReports naturally, this
967    /// method can be used to request a report from the device type indicated.
968    /// Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or
969    /// `device_type` are not supported.
970    GetInputReport { device_type: DeviceType, responder: InputDeviceGetInputReportResponder },
971    /// An interaction was received which does not match any known method.
972    #[non_exhaustive]
973    _UnknownMethod {
974        /// Ordinal of the method that was called.
975        ordinal: u64,
976        control_handle: InputDeviceControlHandle,
977        method_type: fidl::MethodType,
978    },
979}
980
981impl InputDeviceRequest {
982    #[allow(irrefutable_let_patterns)]
983    pub fn into_get_input_reports_reader(
984        self,
985    ) -> Option<(fidl::endpoints::ServerEnd<InputReportsReaderMarker>, InputDeviceControlHandle)>
986    {
987        if let InputDeviceRequest::GetInputReportsReader { reader, control_handle } = self {
988            Some((reader, control_handle))
989        } else {
990            None
991        }
992    }
993
994    #[allow(irrefutable_let_patterns)]
995    pub fn into_get_input_reports_reader_v2(
996        self,
997    ) -> Option<(
998        fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
999        u16,
1000        InputDeviceGetInputReportsReaderV2Responder,
1001    )> {
1002        if let InputDeviceRequest::GetInputReportsReaderV2 {
1003            reader,
1004            max_unacknowledged_reports_limit,
1005            responder,
1006        } = self
1007        {
1008            Some((reader, max_unacknowledged_reports_limit, responder))
1009        } else {
1010            None
1011        }
1012    }
1013
1014    #[allow(irrefutable_let_patterns)]
1015    pub fn into_get_descriptor(self) -> Option<(InputDeviceGetDescriptorResponder)> {
1016        if let InputDeviceRequest::GetDescriptor { responder } = self {
1017            Some((responder))
1018        } else {
1019            None
1020        }
1021    }
1022
1023    #[allow(irrefutable_let_patterns)]
1024    pub fn into_send_output_report(
1025        self,
1026    ) -> Option<(OutputReport, InputDeviceSendOutputReportResponder)> {
1027        if let InputDeviceRequest::SendOutputReport { report, responder } = self {
1028            Some((report, responder))
1029        } else {
1030            None
1031        }
1032    }
1033
1034    #[allow(irrefutable_let_patterns)]
1035    pub fn into_get_feature_report(self) -> Option<(InputDeviceGetFeatureReportResponder)> {
1036        if let InputDeviceRequest::GetFeatureReport { responder } = self {
1037            Some((responder))
1038        } else {
1039            None
1040        }
1041    }
1042
1043    #[allow(irrefutable_let_patterns)]
1044    pub fn into_set_feature_report(
1045        self,
1046    ) -> Option<(FeatureReport, InputDeviceSetFeatureReportResponder)> {
1047        if let InputDeviceRequest::SetFeatureReport { report, responder } = self {
1048            Some((report, responder))
1049        } else {
1050            None
1051        }
1052    }
1053
1054    #[allow(irrefutable_let_patterns)]
1055    pub fn into_get_input_report(self) -> Option<(DeviceType, InputDeviceGetInputReportResponder)> {
1056        if let InputDeviceRequest::GetInputReport { device_type, responder } = self {
1057            Some((device_type, responder))
1058        } else {
1059            None
1060        }
1061    }
1062
1063    /// Name of the method defined in FIDL
1064    pub fn method_name(&self) -> &'static str {
1065        match *self {
1066            InputDeviceRequest::GetInputReportsReader { .. } => "get_input_reports_reader",
1067            InputDeviceRequest::GetInputReportsReaderV2 { .. } => "get_input_reports_reader_v2",
1068            InputDeviceRequest::GetDescriptor { .. } => "get_descriptor",
1069            InputDeviceRequest::SendOutputReport { .. } => "send_output_report",
1070            InputDeviceRequest::GetFeatureReport { .. } => "get_feature_report",
1071            InputDeviceRequest::SetFeatureReport { .. } => "set_feature_report",
1072            InputDeviceRequest::GetInputReport { .. } => "get_input_report",
1073            InputDeviceRequest::_UnknownMethod {
1074                method_type: fidl::MethodType::OneWay, ..
1075            } => "unknown one-way method",
1076            InputDeviceRequest::_UnknownMethod {
1077                method_type: fidl::MethodType::TwoWay, ..
1078            } => "unknown two-way method",
1079        }
1080    }
1081}
1082
1083#[derive(Debug, Clone)]
1084pub struct InputDeviceControlHandle {
1085    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1086}
1087
1088impl InputDeviceControlHandle {
1089    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1090        self.inner.shutdown_with_epitaph(status.into())
1091    }
1092}
1093
1094impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
1095    fn shutdown(&self) {
1096        self.inner.shutdown()
1097    }
1098
1099    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1100        self.inner.shutdown_with_epitaph(status)
1101    }
1102
1103    fn is_closed(&self) -> bool {
1104        self.inner.channel().is_closed()
1105    }
1106    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1107        self.inner.channel().on_closed()
1108    }
1109
1110    #[cfg(target_os = "fuchsia")]
1111    fn signal_peer(
1112        &self,
1113        clear_mask: zx::Signals,
1114        set_mask: zx::Signals,
1115    ) -> Result<(), zx_status::Status> {
1116        use fidl::Peered;
1117        self.inner.channel().signal_peer(clear_mask, set_mask)
1118    }
1119}
1120
1121impl InputDeviceControlHandle {}
1122
1123#[must_use = "FIDL methods require a response to be sent"]
1124#[derive(Debug)]
1125pub struct InputDeviceGetInputReportsReaderV2Responder {
1126    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1127    tx_id: u32,
1128}
1129
1130/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1131/// if the responder is dropped without sending a response, so that the client
1132/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1133impl std::ops::Drop for InputDeviceGetInputReportsReaderV2Responder {
1134    fn drop(&mut self) {
1135        self.control_handle.shutdown();
1136        // Safety: drops once, never accessed again
1137        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1138    }
1139}
1140
1141impl fidl::endpoints::Responder for InputDeviceGetInputReportsReaderV2Responder {
1142    type ControlHandle = InputDeviceControlHandle;
1143
1144    fn control_handle(&self) -> &InputDeviceControlHandle {
1145        &self.control_handle
1146    }
1147
1148    fn drop_without_shutdown(mut self) {
1149        // Safety: drops once, never accessed again due to mem::forget
1150        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1151        // Prevent Drop from running (which would shut down the channel)
1152        std::mem::forget(self);
1153    }
1154}
1155
1156impl InputDeviceGetInputReportsReaderV2Responder {
1157    /// Sends a response to the FIDL transaction.
1158    ///
1159    /// Sets the channel to shutdown if an error occurs.
1160    pub fn send(self, mut max_unacknowledged_reports: u16) -> Result<(), fidl::Error> {
1161        let _result = self.send_raw(max_unacknowledged_reports);
1162        if _result.is_err() {
1163            self.control_handle.shutdown();
1164        }
1165        self.drop_without_shutdown();
1166        _result
1167    }
1168
1169    /// Similar to "send" but does not shutdown the channel if an error occurs.
1170    pub fn send_no_shutdown_on_err(
1171        self,
1172        mut max_unacknowledged_reports: u16,
1173    ) -> Result<(), fidl::Error> {
1174        let _result = self.send_raw(max_unacknowledged_reports);
1175        self.drop_without_shutdown();
1176        _result
1177    }
1178
1179    fn send_raw(&self, mut max_unacknowledged_reports: u16) -> Result<(), fidl::Error> {
1180        self.control_handle.inner.send::<InputDeviceGetInputReportsReaderV2Response>(
1181            (max_unacknowledged_reports,),
1182            self.tx_id,
1183            0x67184c2f21c9051,
1184            fidl::encoding::DynamicFlags::empty(),
1185        )
1186    }
1187}
1188
1189#[must_use = "FIDL methods require a response to be sent"]
1190#[derive(Debug)]
1191pub struct InputDeviceGetDescriptorResponder {
1192    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1193    tx_id: u32,
1194}
1195
1196/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1197/// if the responder is dropped without sending a response, so that the client
1198/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1199impl std::ops::Drop for InputDeviceGetDescriptorResponder {
1200    fn drop(&mut self) {
1201        self.control_handle.shutdown();
1202        // Safety: drops once, never accessed again
1203        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1204    }
1205}
1206
1207impl fidl::endpoints::Responder for InputDeviceGetDescriptorResponder {
1208    type ControlHandle = InputDeviceControlHandle;
1209
1210    fn control_handle(&self) -> &InputDeviceControlHandle {
1211        &self.control_handle
1212    }
1213
1214    fn drop_without_shutdown(mut self) {
1215        // Safety: drops once, never accessed again due to mem::forget
1216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1217        // Prevent Drop from running (which would shut down the channel)
1218        std::mem::forget(self);
1219    }
1220}
1221
1222impl InputDeviceGetDescriptorResponder {
1223    /// Sends a response to the FIDL transaction.
1224    ///
1225    /// Sets the channel to shutdown if an error occurs.
1226    pub fn send(self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1227        let _result = self.send_raw(descriptor);
1228        if _result.is_err() {
1229            self.control_handle.shutdown();
1230        }
1231        self.drop_without_shutdown();
1232        _result
1233    }
1234
1235    /// Similar to "send" but does not shutdown the channel if an error occurs.
1236    pub fn send_no_shutdown_on_err(
1237        self,
1238        mut descriptor: &DeviceDescriptor,
1239    ) -> Result<(), fidl::Error> {
1240        let _result = self.send_raw(descriptor);
1241        self.drop_without_shutdown();
1242        _result
1243    }
1244
1245    fn send_raw(&self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1246        self.control_handle.inner.send::<InputDeviceGetDescriptorResponse>(
1247            (descriptor,),
1248            self.tx_id,
1249            0x3d76420f2ff8ad32,
1250            fidl::encoding::DynamicFlags::empty(),
1251        )
1252    }
1253}
1254
1255#[must_use = "FIDL methods require a response to be sent"]
1256#[derive(Debug)]
1257pub struct InputDeviceSendOutputReportResponder {
1258    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1259    tx_id: u32,
1260}
1261
1262/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1263/// if the responder is dropped without sending a response, so that the client
1264/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1265impl std::ops::Drop for InputDeviceSendOutputReportResponder {
1266    fn drop(&mut self) {
1267        self.control_handle.shutdown();
1268        // Safety: drops once, never accessed again
1269        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1270    }
1271}
1272
1273impl fidl::endpoints::Responder for InputDeviceSendOutputReportResponder {
1274    type ControlHandle = InputDeviceControlHandle;
1275
1276    fn control_handle(&self) -> &InputDeviceControlHandle {
1277        &self.control_handle
1278    }
1279
1280    fn drop_without_shutdown(mut self) {
1281        // Safety: drops once, never accessed again due to mem::forget
1282        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1283        // Prevent Drop from running (which would shut down the channel)
1284        std::mem::forget(self);
1285    }
1286}
1287
1288impl InputDeviceSendOutputReportResponder {
1289    /// Sends a response to the FIDL transaction.
1290    ///
1291    /// Sets the channel to shutdown if an error occurs.
1292    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1293        let _result = self.send_raw(result);
1294        if _result.is_err() {
1295            self.control_handle.shutdown();
1296        }
1297        self.drop_without_shutdown();
1298        _result
1299    }
1300
1301    /// Similar to "send" but does not shutdown the channel if an error occurs.
1302    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1303        let _result = self.send_raw(result);
1304        self.drop_without_shutdown();
1305        _result
1306    }
1307
1308    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1309        self.control_handle
1310            .inner
1311            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1312                result,
1313                self.tx_id,
1314                0x67a4888774e6f3a,
1315                fidl::encoding::DynamicFlags::empty(),
1316            )
1317    }
1318}
1319
1320#[must_use = "FIDL methods require a response to be sent"]
1321#[derive(Debug)]
1322pub struct InputDeviceGetFeatureReportResponder {
1323    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1324    tx_id: u32,
1325}
1326
1327/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1328/// if the responder is dropped without sending a response, so that the client
1329/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1330impl std::ops::Drop for InputDeviceGetFeatureReportResponder {
1331    fn drop(&mut self) {
1332        self.control_handle.shutdown();
1333        // Safety: drops once, never accessed again
1334        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1335    }
1336}
1337
1338impl fidl::endpoints::Responder for InputDeviceGetFeatureReportResponder {
1339    type ControlHandle = InputDeviceControlHandle;
1340
1341    fn control_handle(&self) -> &InputDeviceControlHandle {
1342        &self.control_handle
1343    }
1344
1345    fn drop_without_shutdown(mut self) {
1346        // Safety: drops once, never accessed again due to mem::forget
1347        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1348        // Prevent Drop from running (which would shut down the channel)
1349        std::mem::forget(self);
1350    }
1351}
1352
1353impl InputDeviceGetFeatureReportResponder {
1354    /// Sends a response to the FIDL transaction.
1355    ///
1356    /// Sets the channel to shutdown if an error occurs.
1357    pub fn send(self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1358        let _result = self.send_raw(result);
1359        if _result.is_err() {
1360            self.control_handle.shutdown();
1361        }
1362        self.drop_without_shutdown();
1363        _result
1364    }
1365
1366    /// Similar to "send" but does not shutdown the channel if an error occurs.
1367    pub fn send_no_shutdown_on_err(
1368        self,
1369        mut result: Result<&FeatureReport, i32>,
1370    ) -> Result<(), fidl::Error> {
1371        let _result = self.send_raw(result);
1372        self.drop_without_shutdown();
1373        _result
1374    }
1375
1376    fn send_raw(&self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1377        self.control_handle.inner.send::<fidl::encoding::ResultType<
1378            InputDeviceGetFeatureReportResponse,
1379            i32,
1380        >>(
1381            result.map(|report| (report,)),
1382            self.tx_id,
1383            0x497a7d98d9391f16,
1384            fidl::encoding::DynamicFlags::empty(),
1385        )
1386    }
1387}
1388
1389#[must_use = "FIDL methods require a response to be sent"]
1390#[derive(Debug)]
1391pub struct InputDeviceSetFeatureReportResponder {
1392    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1393    tx_id: u32,
1394}
1395
1396/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1397/// if the responder is dropped without sending a response, so that the client
1398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1399impl std::ops::Drop for InputDeviceSetFeatureReportResponder {
1400    fn drop(&mut self) {
1401        self.control_handle.shutdown();
1402        // Safety: drops once, never accessed again
1403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1404    }
1405}
1406
1407impl fidl::endpoints::Responder for InputDeviceSetFeatureReportResponder {
1408    type ControlHandle = InputDeviceControlHandle;
1409
1410    fn control_handle(&self) -> &InputDeviceControlHandle {
1411        &self.control_handle
1412    }
1413
1414    fn drop_without_shutdown(mut self) {
1415        // Safety: drops once, never accessed again due to mem::forget
1416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1417        // Prevent Drop from running (which would shut down the channel)
1418        std::mem::forget(self);
1419    }
1420}
1421
1422impl InputDeviceSetFeatureReportResponder {
1423    /// Sends a response to the FIDL transaction.
1424    ///
1425    /// Sets the channel to shutdown if an error occurs.
1426    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1427        let _result = self.send_raw(result);
1428        if _result.is_err() {
1429            self.control_handle.shutdown();
1430        }
1431        self.drop_without_shutdown();
1432        _result
1433    }
1434
1435    /// Similar to "send" but does not shutdown the channel if an error occurs.
1436    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1437        let _result = self.send_raw(result);
1438        self.drop_without_shutdown();
1439        _result
1440    }
1441
1442    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1443        self.control_handle
1444            .inner
1445            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1446                result,
1447                self.tx_id,
1448                0x7679a2f5a42842ef,
1449                fidl::encoding::DynamicFlags::empty(),
1450            )
1451    }
1452}
1453
1454#[must_use = "FIDL methods require a response to be sent"]
1455#[derive(Debug)]
1456pub struct InputDeviceGetInputReportResponder {
1457    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1458    tx_id: u32,
1459}
1460
1461/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1462/// if the responder is dropped without sending a response, so that the client
1463/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1464impl std::ops::Drop for InputDeviceGetInputReportResponder {
1465    fn drop(&mut self) {
1466        self.control_handle.shutdown();
1467        // Safety: drops once, never accessed again
1468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1469    }
1470}
1471
1472impl fidl::endpoints::Responder for InputDeviceGetInputReportResponder {
1473    type ControlHandle = InputDeviceControlHandle;
1474
1475    fn control_handle(&self) -> &InputDeviceControlHandle {
1476        &self.control_handle
1477    }
1478
1479    fn drop_without_shutdown(mut self) {
1480        // Safety: drops once, never accessed again due to mem::forget
1481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1482        // Prevent Drop from running (which would shut down the channel)
1483        std::mem::forget(self);
1484    }
1485}
1486
1487impl InputDeviceGetInputReportResponder {
1488    /// Sends a response to the FIDL transaction.
1489    ///
1490    /// Sets the channel to shutdown if an error occurs.
1491    pub fn send(self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1492        let _result = self.send_raw(result);
1493        if _result.is_err() {
1494            self.control_handle.shutdown();
1495        }
1496        self.drop_without_shutdown();
1497        _result
1498    }
1499
1500    /// Similar to "send" but does not shutdown the channel if an error occurs.
1501    pub fn send_no_shutdown_on_err(
1502        self,
1503        mut result: Result<InputReport, i32>,
1504    ) -> Result<(), fidl::Error> {
1505        let _result = self.send_raw(result);
1506        self.drop_without_shutdown();
1507        _result
1508    }
1509
1510    fn send_raw(&self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1511        self.control_handle
1512            .inner
1513            .send::<fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>>(
1514                result.as_mut().map_err(|e| *e).map(|report| (report,)),
1515                self.tx_id,
1516                0x4752ccab96c10248,
1517                fidl::encoding::DynamicFlags::empty(),
1518            )
1519    }
1520}
1521
1522#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1523pub struct InputReportsReaderMarker;
1524
1525impl fidl::endpoints::ProtocolMarker for InputReportsReaderMarker {
1526    type Proxy = InputReportsReaderProxy;
1527    type RequestStream = InputReportsReaderRequestStream;
1528    #[cfg(target_os = "fuchsia")]
1529    type SynchronousProxy = InputReportsReaderSynchronousProxy;
1530
1531    const DEBUG_NAME: &'static str = "(anonymous) InputReportsReader";
1532}
1533pub type InputReportsReaderReadInputReportsResult = Result<Vec<InputReport>, i32>;
1534
1535pub trait InputReportsReaderProxyInterface: Send + Sync {
1536    type ReadInputReportsResponseFut: std::future::Future<Output = Result<InputReportsReaderReadInputReportsResult, fidl::Error>>
1537        + Send;
1538    fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut;
1539}
1540#[derive(Debug)]
1541#[cfg(target_os = "fuchsia")]
1542pub struct InputReportsReaderSynchronousProxy {
1543    client: fidl::client::sync::Client,
1544}
1545
1546#[cfg(target_os = "fuchsia")]
1547impl fidl::endpoints::SynchronousProxy for InputReportsReaderSynchronousProxy {
1548    type Proxy = InputReportsReaderProxy;
1549    type Protocol = InputReportsReaderMarker;
1550
1551    fn from_channel(inner: fidl::Channel) -> Self {
1552        Self::new(inner)
1553    }
1554
1555    fn into_channel(self) -> fidl::Channel {
1556        self.client.into_channel()
1557    }
1558
1559    fn as_channel(&self) -> &fidl::Channel {
1560        self.client.as_channel()
1561    }
1562}
1563
1564#[cfg(target_os = "fuchsia")]
1565impl InputReportsReaderSynchronousProxy {
1566    pub fn new(channel: fidl::Channel) -> Self {
1567        Self { client: fidl::client::sync::Client::new(channel) }
1568    }
1569
1570    pub fn into_channel(self) -> fidl::Channel {
1571        self.client.into_channel()
1572    }
1573
1574    /// Waits until an event arrives and returns it. It is safe for other
1575    /// threads to make concurrent requests while waiting for an event.
1576    pub fn wait_for_event(
1577        &self,
1578        deadline: zx::MonotonicInstant,
1579    ) -> Result<InputReportsReaderEvent, fidl::Error> {
1580        InputReportsReaderEvent::decode(
1581            self.client.wait_for_event::<InputReportsReaderMarker>(deadline)?,
1582        )
1583    }
1584
1585    /// This is a Hanging-Get function to read the reports in the
1586    /// InputReport FIFO. This will not reply until there is at least one
1587    /// report available.
1588    /// If there is already one outstanding Hanging-Get, calling this
1589    /// again will return ZX_ERR_ALREADY_BOUND.
1590    pub fn r#read_input_reports(
1591        &self,
1592        ___deadline: zx::MonotonicInstant,
1593    ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1594        let _response =
1595            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1596                InputReportsReaderReadInputReportsResponse,
1597                i32,
1598            >, InputReportsReaderMarker>(
1599                (),
1600                0x3595efdc88842559,
1601                fidl::encoding::DynamicFlags::empty(),
1602                ___deadline,
1603            )?;
1604        Ok(_response.map(|x| x.reports))
1605    }
1606}
1607
1608#[cfg(target_os = "fuchsia")]
1609impl From<InputReportsReaderSynchronousProxy> for zx::NullableHandle {
1610    fn from(value: InputReportsReaderSynchronousProxy) -> Self {
1611        value.into_channel().into()
1612    }
1613}
1614
1615#[cfg(target_os = "fuchsia")]
1616impl From<fidl::Channel> for InputReportsReaderSynchronousProxy {
1617    fn from(value: fidl::Channel) -> Self {
1618        Self::new(value)
1619    }
1620}
1621
1622#[cfg(target_os = "fuchsia")]
1623impl fidl::endpoints::FromClient for InputReportsReaderSynchronousProxy {
1624    type Protocol = InputReportsReaderMarker;
1625
1626    fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderMarker>) -> Self {
1627        Self::new(value.into_channel())
1628    }
1629}
1630
1631#[derive(Debug, Clone)]
1632pub struct InputReportsReaderProxy {
1633    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1634}
1635
1636impl fidl::endpoints::Proxy for InputReportsReaderProxy {
1637    type Protocol = InputReportsReaderMarker;
1638
1639    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1640        Self::new(inner)
1641    }
1642
1643    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1644        self.client.into_channel().map_err(|client| Self { client })
1645    }
1646
1647    fn as_channel(&self) -> &::fidl::AsyncChannel {
1648        self.client.as_channel()
1649    }
1650}
1651
1652impl InputReportsReaderProxy {
1653    /// Create a new Proxy for fuchsia.input.report/InputReportsReader.
1654    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1655        let protocol_name =
1656            <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1657        Self { client: fidl::client::Client::new(channel, protocol_name) }
1658    }
1659
1660    /// Get a Stream of events from the remote end of the protocol.
1661    ///
1662    /// # Panics
1663    ///
1664    /// Panics if the event stream was already taken.
1665    pub fn take_event_stream(&self) -> InputReportsReaderEventStream {
1666        InputReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
1667    }
1668
1669    /// This is a Hanging-Get function to read the reports in the
1670    /// InputReport FIFO. This will not reply until there is at least one
1671    /// report available.
1672    /// If there is already one outstanding Hanging-Get, calling this
1673    /// again will return ZX_ERR_ALREADY_BOUND.
1674    pub fn r#read_input_reports(
1675        &self,
1676    ) -> fidl::client::QueryResponseFut<
1677        InputReportsReaderReadInputReportsResult,
1678        fidl::encoding::DefaultFuchsiaResourceDialect,
1679    > {
1680        InputReportsReaderProxyInterface::r#read_input_reports(self)
1681    }
1682}
1683
1684impl InputReportsReaderProxyInterface for InputReportsReaderProxy {
1685    type ReadInputReportsResponseFut = fidl::client::QueryResponseFut<
1686        InputReportsReaderReadInputReportsResult,
1687        fidl::encoding::DefaultFuchsiaResourceDialect,
1688    >;
1689    fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut {
1690        fn _decode(
1691            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1692        ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1693            let _response = fidl::client::decode_transaction_body::<
1694                fidl::encoding::ResultType<InputReportsReaderReadInputReportsResponse, i32>,
1695                fidl::encoding::DefaultFuchsiaResourceDialect,
1696                0x3595efdc88842559,
1697            >(_buf?)?;
1698            Ok(_response.map(|x| x.reports))
1699        }
1700        self.client.send_query_and_decode::<
1701            fidl::encoding::EmptyPayload,
1702            InputReportsReaderReadInputReportsResult,
1703        >(
1704            (),
1705            0x3595efdc88842559,
1706            fidl::encoding::DynamicFlags::empty(),
1707            _decode,
1708        )
1709    }
1710}
1711
1712pub struct InputReportsReaderEventStream {
1713    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1714}
1715
1716impl std::marker::Unpin for InputReportsReaderEventStream {}
1717
1718impl futures::stream::FusedStream for InputReportsReaderEventStream {
1719    fn is_terminated(&self) -> bool {
1720        self.event_receiver.is_terminated()
1721    }
1722}
1723
1724impl futures::Stream for InputReportsReaderEventStream {
1725    type Item = Result<InputReportsReaderEvent, fidl::Error>;
1726
1727    fn poll_next(
1728        mut self: std::pin::Pin<&mut Self>,
1729        cx: &mut std::task::Context<'_>,
1730    ) -> std::task::Poll<Option<Self::Item>> {
1731        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1732            &mut self.event_receiver,
1733            cx
1734        )?) {
1735            Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderEvent::decode(buf))),
1736            None => std::task::Poll::Ready(None),
1737        }
1738    }
1739}
1740
1741#[derive(Debug)]
1742pub enum InputReportsReaderEvent {}
1743
1744impl InputReportsReaderEvent {
1745    /// Decodes a message buffer as a [`InputReportsReaderEvent`].
1746    fn decode(
1747        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1748    ) -> Result<InputReportsReaderEvent, fidl::Error> {
1749        let (bytes, _handles) = buf.split_mut();
1750        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1751        debug_assert_eq!(tx_header.tx_id, 0);
1752        match tx_header.ordinal {
1753            _ => Err(fidl::Error::UnknownOrdinal {
1754                ordinal: tx_header.ordinal,
1755                protocol_name:
1756                    <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1757            }),
1758        }
1759    }
1760}
1761
1762/// A Stream of incoming requests for fuchsia.input.report/InputReportsReader.
1763pub struct InputReportsReaderRequestStream {
1764    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1765    is_terminated: bool,
1766}
1767
1768impl std::marker::Unpin for InputReportsReaderRequestStream {}
1769
1770impl futures::stream::FusedStream for InputReportsReaderRequestStream {
1771    fn is_terminated(&self) -> bool {
1772        self.is_terminated
1773    }
1774}
1775
1776impl fidl::endpoints::RequestStream for InputReportsReaderRequestStream {
1777    type Protocol = InputReportsReaderMarker;
1778    type ControlHandle = InputReportsReaderControlHandle;
1779
1780    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1781        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1782    }
1783
1784    fn control_handle(&self) -> Self::ControlHandle {
1785        InputReportsReaderControlHandle { inner: self.inner.clone() }
1786    }
1787
1788    fn into_inner(
1789        self,
1790    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1791    {
1792        (self.inner, self.is_terminated)
1793    }
1794
1795    fn from_inner(
1796        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1797        is_terminated: bool,
1798    ) -> Self {
1799        Self { inner, is_terminated }
1800    }
1801}
1802
1803impl futures::Stream for InputReportsReaderRequestStream {
1804    type Item = Result<InputReportsReaderRequest, fidl::Error>;
1805
1806    fn poll_next(
1807        mut self: std::pin::Pin<&mut Self>,
1808        cx: &mut std::task::Context<'_>,
1809    ) -> std::task::Poll<Option<Self::Item>> {
1810        let this = &mut *self;
1811        if this.inner.check_shutdown(cx) {
1812            this.is_terminated = true;
1813            return std::task::Poll::Ready(None);
1814        }
1815        if this.is_terminated {
1816            panic!("polled InputReportsReaderRequestStream after completion");
1817        }
1818        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1819            |bytes, handles| {
1820                match this.inner.channel().read_etc(cx, bytes, handles) {
1821                    std::task::Poll::Ready(Ok(())) => {}
1822                    std::task::Poll::Pending => return std::task::Poll::Pending,
1823                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1824                        this.is_terminated = true;
1825                        return std::task::Poll::Ready(None);
1826                    }
1827                    std::task::Poll::Ready(Err(e)) => {
1828                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1829                            e.into(),
1830                        ))));
1831                    }
1832                }
1833
1834                // A message has been received from the channel
1835                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1836
1837                std::task::Poll::Ready(Some(match header.ordinal {
1838                0x3595efdc88842559 => {
1839                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1840                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1841                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1842                    let control_handle = InputReportsReaderControlHandle {
1843                        inner: this.inner.clone(),
1844                    };
1845                    Ok(InputReportsReaderRequest::ReadInputReports {
1846                        responder: InputReportsReaderReadInputReportsResponder {
1847                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1848                            tx_id: header.tx_id,
1849                        },
1850                    })
1851                }
1852                _ => Err(fidl::Error::UnknownOrdinal {
1853                    ordinal: header.ordinal,
1854                    protocol_name: <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1855                }),
1856            }))
1857            },
1858        )
1859    }
1860}
1861
1862/// Each `InputReportsReader` has its own FIFO of InputReports that it maintains.
1863/// When ReadInputReports is called it drains the InputReports FIFO.
1864/// If too many InputReports are created before the FIFO is drained, then
1865/// the oldest InputReport will be silently discarded.
1866#[derive(Debug)]
1867pub enum InputReportsReaderRequest {
1868    /// This is a Hanging-Get function to read the reports in the
1869    /// InputReport FIFO. This will not reply until there is at least one
1870    /// report available.
1871    /// If there is already one outstanding Hanging-Get, calling this
1872    /// again will return ZX_ERR_ALREADY_BOUND.
1873    ReadInputReports { responder: InputReportsReaderReadInputReportsResponder },
1874}
1875
1876impl InputReportsReaderRequest {
1877    #[allow(irrefutable_let_patterns)]
1878    pub fn into_read_input_reports(self) -> Option<(InputReportsReaderReadInputReportsResponder)> {
1879        if let InputReportsReaderRequest::ReadInputReports { responder } = self {
1880            Some((responder))
1881        } else {
1882            None
1883        }
1884    }
1885
1886    /// Name of the method defined in FIDL
1887    pub fn method_name(&self) -> &'static str {
1888        match *self {
1889            InputReportsReaderRequest::ReadInputReports { .. } => "read_input_reports",
1890        }
1891    }
1892}
1893
1894#[derive(Debug, Clone)]
1895pub struct InputReportsReaderControlHandle {
1896    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1897}
1898
1899impl InputReportsReaderControlHandle {
1900    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1901        self.inner.shutdown_with_epitaph(status.into())
1902    }
1903}
1904
1905impl fidl::endpoints::ControlHandle for InputReportsReaderControlHandle {
1906    fn shutdown(&self) {
1907        self.inner.shutdown()
1908    }
1909
1910    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1911        self.inner.shutdown_with_epitaph(status)
1912    }
1913
1914    fn is_closed(&self) -> bool {
1915        self.inner.channel().is_closed()
1916    }
1917    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1918        self.inner.channel().on_closed()
1919    }
1920
1921    #[cfg(target_os = "fuchsia")]
1922    fn signal_peer(
1923        &self,
1924        clear_mask: zx::Signals,
1925        set_mask: zx::Signals,
1926    ) -> Result<(), zx_status::Status> {
1927        use fidl::Peered;
1928        self.inner.channel().signal_peer(clear_mask, set_mask)
1929    }
1930}
1931
1932impl InputReportsReaderControlHandle {}
1933
1934#[must_use = "FIDL methods require a response to be sent"]
1935#[derive(Debug)]
1936pub struct InputReportsReaderReadInputReportsResponder {
1937    control_handle: std::mem::ManuallyDrop<InputReportsReaderControlHandle>,
1938    tx_id: u32,
1939}
1940
1941/// Set the the channel to be shutdown (see [`InputReportsReaderControlHandle::shutdown`])
1942/// if the responder is dropped without sending a response, so that the client
1943/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1944impl std::ops::Drop for InputReportsReaderReadInputReportsResponder {
1945    fn drop(&mut self) {
1946        self.control_handle.shutdown();
1947        // Safety: drops once, never accessed again
1948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1949    }
1950}
1951
1952impl fidl::endpoints::Responder for InputReportsReaderReadInputReportsResponder {
1953    type ControlHandle = InputReportsReaderControlHandle;
1954
1955    fn control_handle(&self) -> &InputReportsReaderControlHandle {
1956        &self.control_handle
1957    }
1958
1959    fn drop_without_shutdown(mut self) {
1960        // Safety: drops once, never accessed again due to mem::forget
1961        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1962        // Prevent Drop from running (which would shut down the channel)
1963        std::mem::forget(self);
1964    }
1965}
1966
1967impl InputReportsReaderReadInputReportsResponder {
1968    /// Sends a response to the FIDL transaction.
1969    ///
1970    /// Sets the channel to shutdown if an error occurs.
1971    pub fn send(self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1972        let _result = self.send_raw(result);
1973        if _result.is_err() {
1974            self.control_handle.shutdown();
1975        }
1976        self.drop_without_shutdown();
1977        _result
1978    }
1979
1980    /// Similar to "send" but does not shutdown the channel if an error occurs.
1981    pub fn send_no_shutdown_on_err(
1982        self,
1983        mut result: Result<Vec<InputReport>, i32>,
1984    ) -> Result<(), fidl::Error> {
1985        let _result = self.send_raw(result);
1986        self.drop_without_shutdown();
1987        _result
1988    }
1989
1990    fn send_raw(&self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1991        self.control_handle.inner.send::<fidl::encoding::ResultType<
1992            InputReportsReaderReadInputReportsResponse,
1993            i32,
1994        >>(
1995            result.as_mut().map_err(|e| *e).map(|reports| (reports.as_mut_slice(),)),
1996            self.tx_id,
1997            0x3595efdc88842559,
1998            fidl::encoding::DynamicFlags::empty(),
1999        )
2000    }
2001}
2002
2003#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2004pub struct InputReportsReaderV2Marker;
2005
2006impl fidl::endpoints::ProtocolMarker for InputReportsReaderV2Marker {
2007    type Proxy = InputReportsReaderV2Proxy;
2008    type RequestStream = InputReportsReaderV2RequestStream;
2009    #[cfg(target_os = "fuchsia")]
2010    type SynchronousProxy = InputReportsReaderV2SynchronousProxy;
2011
2012    const DEBUG_NAME: &'static str = "(anonymous) InputReportsReaderV2";
2013}
2014
2015pub trait InputReportsReaderV2ProxyInterface: Send + Sync {
2016    fn r#acknowledge_reports(&self, last_acknowledged_report_stamp: u64)
2017    -> Result<(), fidl::Error>;
2018}
2019#[derive(Debug)]
2020#[cfg(target_os = "fuchsia")]
2021pub struct InputReportsReaderV2SynchronousProxy {
2022    client: fidl::client::sync::Client,
2023}
2024
2025#[cfg(target_os = "fuchsia")]
2026impl fidl::endpoints::SynchronousProxy for InputReportsReaderV2SynchronousProxy {
2027    type Proxy = InputReportsReaderV2Proxy;
2028    type Protocol = InputReportsReaderV2Marker;
2029
2030    fn from_channel(inner: fidl::Channel) -> Self {
2031        Self::new(inner)
2032    }
2033
2034    fn into_channel(self) -> fidl::Channel {
2035        self.client.into_channel()
2036    }
2037
2038    fn as_channel(&self) -> &fidl::Channel {
2039        self.client.as_channel()
2040    }
2041}
2042
2043#[cfg(target_os = "fuchsia")]
2044impl InputReportsReaderV2SynchronousProxy {
2045    pub fn new(channel: fidl::Channel) -> Self {
2046        Self { client: fidl::client::sync::Client::new(channel) }
2047    }
2048
2049    pub fn into_channel(self) -> fidl::Channel {
2050        self.client.into_channel()
2051    }
2052
2053    /// Waits until an event arrives and returns it. It is safe for other
2054    /// threads to make concurrent requests while waiting for an event.
2055    pub fn wait_for_event(
2056        &self,
2057        deadline: zx::MonotonicInstant,
2058    ) -> Result<InputReportsReaderV2Event, fidl::Error> {
2059        InputReportsReaderV2Event::decode(
2060            self.client.wait_for_event::<InputReportsReaderV2Marker>(deadline)?,
2061        )
2062    }
2063
2064    /// The client has processed events up to `last_acknowledged_report_stamp`.
2065    /// All reports sent with a `last_report_stamp` less than or equal to
2066    /// `last_acknowledged_report_stamp` will be considered acknowledged, and therefore
2067    /// will not count towards the `max_unacknowledged_reports` limit.
2068    pub fn r#acknowledge_reports(
2069        &self,
2070        mut last_acknowledged_report_stamp: u64,
2071    ) -> Result<(), fidl::Error> {
2072        self.client.send::<InputReportsReaderV2AcknowledgeReportsRequest>(
2073            (last_acknowledged_report_stamp,),
2074            0x727aef411a2fe309,
2075            fidl::encoding::DynamicFlags::FLEXIBLE,
2076        )
2077    }
2078}
2079
2080#[cfg(target_os = "fuchsia")]
2081impl From<InputReportsReaderV2SynchronousProxy> for zx::NullableHandle {
2082    fn from(value: InputReportsReaderV2SynchronousProxy) -> Self {
2083        value.into_channel().into()
2084    }
2085}
2086
2087#[cfg(target_os = "fuchsia")]
2088impl From<fidl::Channel> for InputReportsReaderV2SynchronousProxy {
2089    fn from(value: fidl::Channel) -> Self {
2090        Self::new(value)
2091    }
2092}
2093
2094#[cfg(target_os = "fuchsia")]
2095impl fidl::endpoints::FromClient for InputReportsReaderV2SynchronousProxy {
2096    type Protocol = InputReportsReaderV2Marker;
2097
2098    fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderV2Marker>) -> Self {
2099        Self::new(value.into_channel())
2100    }
2101}
2102
2103#[derive(Debug, Clone)]
2104pub struct InputReportsReaderV2Proxy {
2105    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2106}
2107
2108impl fidl::endpoints::Proxy for InputReportsReaderV2Proxy {
2109    type Protocol = InputReportsReaderV2Marker;
2110
2111    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2112        Self::new(inner)
2113    }
2114
2115    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2116        self.client.into_channel().map_err(|client| Self { client })
2117    }
2118
2119    fn as_channel(&self) -> &::fidl::AsyncChannel {
2120        self.client.as_channel()
2121    }
2122}
2123
2124impl InputReportsReaderV2Proxy {
2125    /// Create a new Proxy for fuchsia.input.report/InputReportsReaderV2.
2126    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2127        let protocol_name =
2128            <InputReportsReaderV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2129        Self { client: fidl::client::Client::new(channel, protocol_name) }
2130    }
2131
2132    /// Get a Stream of events from the remote end of the protocol.
2133    ///
2134    /// # Panics
2135    ///
2136    /// Panics if the event stream was already taken.
2137    pub fn take_event_stream(&self) -> InputReportsReaderV2EventStream {
2138        InputReportsReaderV2EventStream { event_receiver: self.client.take_event_receiver() }
2139    }
2140
2141    /// The client has processed events up to `last_acknowledged_report_stamp`.
2142    /// All reports sent with a `last_report_stamp` less than or equal to
2143    /// `last_acknowledged_report_stamp` will be considered acknowledged, and therefore
2144    /// will not count towards the `max_unacknowledged_reports` limit.
2145    pub fn r#acknowledge_reports(
2146        &self,
2147        mut last_acknowledged_report_stamp: u64,
2148    ) -> Result<(), fidl::Error> {
2149        InputReportsReaderV2ProxyInterface::r#acknowledge_reports(
2150            self,
2151            last_acknowledged_report_stamp,
2152        )
2153    }
2154}
2155
2156impl InputReportsReaderV2ProxyInterface for InputReportsReaderV2Proxy {
2157    fn r#acknowledge_reports(
2158        &self,
2159        mut last_acknowledged_report_stamp: u64,
2160    ) -> Result<(), fidl::Error> {
2161        self.client.send::<InputReportsReaderV2AcknowledgeReportsRequest>(
2162            (last_acknowledged_report_stamp,),
2163            0x727aef411a2fe309,
2164            fidl::encoding::DynamicFlags::FLEXIBLE,
2165        )
2166    }
2167}
2168
2169pub struct InputReportsReaderV2EventStream {
2170    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2171}
2172
2173impl std::marker::Unpin for InputReportsReaderV2EventStream {}
2174
2175impl futures::stream::FusedStream for InputReportsReaderV2EventStream {
2176    fn is_terminated(&self) -> bool {
2177        self.event_receiver.is_terminated()
2178    }
2179}
2180
2181impl futures::Stream for InputReportsReaderV2EventStream {
2182    type Item = Result<InputReportsReaderV2Event, fidl::Error>;
2183
2184    fn poll_next(
2185        mut self: std::pin::Pin<&mut Self>,
2186        cx: &mut std::task::Context<'_>,
2187    ) -> std::task::Poll<Option<Self::Item>> {
2188        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2189            &mut self.event_receiver,
2190            cx
2191        )?) {
2192            Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderV2Event::decode(buf))),
2193            None => std::task::Poll::Ready(None),
2194        }
2195    }
2196}
2197
2198#[derive(Debug)]
2199pub enum InputReportsReaderV2Event {
2200    OnInputReports {
2201        reports: Vec<InputReport>,
2202        last_report_stamp: u64,
2203    },
2204    #[non_exhaustive]
2205    _UnknownEvent {
2206        /// Ordinal of the event that was sent.
2207        ordinal: u64,
2208    },
2209}
2210
2211impl InputReportsReaderV2Event {
2212    #[allow(irrefutable_let_patterns)]
2213    pub fn into_on_input_reports(self) -> Option<(Vec<InputReport>, u64)> {
2214        if let InputReportsReaderV2Event::OnInputReports { reports, last_report_stamp } = self {
2215            Some((reports, last_report_stamp))
2216        } else {
2217            None
2218        }
2219    }
2220
2221    /// Decodes a message buffer as a [`InputReportsReaderV2Event`].
2222    fn decode(
2223        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2224    ) -> Result<InputReportsReaderV2Event, fidl::Error> {
2225        let (bytes, _handles) = buf.split_mut();
2226        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2227        debug_assert_eq!(tx_header.tx_id, 0);
2228        match tx_header.ordinal {
2229            0x582edad00fe8e3b9 => {
2230                let mut out = fidl::new_empty!(
2231                    InputReportsReaderV2OnInputReportsRequest,
2232                    fidl::encoding::DefaultFuchsiaResourceDialect
2233                );
2234                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputReportsReaderV2OnInputReportsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2235                Ok((InputReportsReaderV2Event::OnInputReports {
2236                    reports: out.reports,
2237                    last_report_stamp: out.last_report_stamp,
2238                }))
2239            }
2240            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2241                Ok(InputReportsReaderV2Event::_UnknownEvent { ordinal: tx_header.ordinal })
2242            }
2243            _ => Err(fidl::Error::UnknownOrdinal {
2244                ordinal: tx_header.ordinal,
2245                protocol_name:
2246                    <InputReportsReaderV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2247            }),
2248        }
2249    }
2250}
2251
2252/// A Stream of incoming requests for fuchsia.input.report/InputReportsReaderV2.
2253pub struct InputReportsReaderV2RequestStream {
2254    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2255    is_terminated: bool,
2256}
2257
2258impl std::marker::Unpin for InputReportsReaderV2RequestStream {}
2259
2260impl futures::stream::FusedStream for InputReportsReaderV2RequestStream {
2261    fn is_terminated(&self) -> bool {
2262        self.is_terminated
2263    }
2264}
2265
2266impl fidl::endpoints::RequestStream for InputReportsReaderV2RequestStream {
2267    type Protocol = InputReportsReaderV2Marker;
2268    type ControlHandle = InputReportsReaderV2ControlHandle;
2269
2270    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2271        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2272    }
2273
2274    fn control_handle(&self) -> Self::ControlHandle {
2275        InputReportsReaderV2ControlHandle { inner: self.inner.clone() }
2276    }
2277
2278    fn into_inner(
2279        self,
2280    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2281    {
2282        (self.inner, self.is_terminated)
2283    }
2284
2285    fn from_inner(
2286        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2287        is_terminated: bool,
2288    ) -> Self {
2289        Self { inner, is_terminated }
2290    }
2291}
2292
2293impl futures::Stream for InputReportsReaderV2RequestStream {
2294    type Item = Result<InputReportsReaderV2Request, fidl::Error>;
2295
2296    fn poll_next(
2297        mut self: std::pin::Pin<&mut Self>,
2298        cx: &mut std::task::Context<'_>,
2299    ) -> std::task::Poll<Option<Self::Item>> {
2300        let this = &mut *self;
2301        if this.inner.check_shutdown(cx) {
2302            this.is_terminated = true;
2303            return std::task::Poll::Ready(None);
2304        }
2305        if this.is_terminated {
2306            panic!("polled InputReportsReaderV2RequestStream after completion");
2307        }
2308        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2309            |bytes, handles| {
2310                match this.inner.channel().read_etc(cx, bytes, handles) {
2311                    std::task::Poll::Ready(Ok(())) => {}
2312                    std::task::Poll::Pending => return std::task::Poll::Pending,
2313                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2314                        this.is_terminated = true;
2315                        return std::task::Poll::Ready(None);
2316                    }
2317                    std::task::Poll::Ready(Err(e)) => {
2318                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2319                            e.into(),
2320                        ))));
2321                    }
2322                }
2323
2324                // A message has been received from the channel
2325                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2326
2327                std::task::Poll::Ready(Some(match header.ordinal {
2328                0x727aef411a2fe309 => {
2329                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2330                    let mut req = fidl::new_empty!(InputReportsReaderV2AcknowledgeReportsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2331                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputReportsReaderV2AcknowledgeReportsRequest>(&header, _body_bytes, handles, &mut req)?;
2332                    let control_handle = InputReportsReaderV2ControlHandle {
2333                        inner: this.inner.clone(),
2334                    };
2335                    Ok(InputReportsReaderV2Request::AcknowledgeReports {last_acknowledged_report_stamp: req.last_acknowledged_report_stamp,
2336
2337                        control_handle,
2338                    })
2339                }
2340                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2341                    Ok(InputReportsReaderV2Request::_UnknownMethod {
2342                        ordinal: header.ordinal,
2343                        control_handle: InputReportsReaderV2ControlHandle { inner: this.inner.clone() },
2344                        method_type: fidl::MethodType::OneWay,
2345                    })
2346                }
2347                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2348                    this.inner.send_framework_err(
2349                        fidl::encoding::FrameworkErr::UnknownMethod,
2350                        header.tx_id,
2351                        header.ordinal,
2352                        header.dynamic_flags(),
2353                        (bytes, handles),
2354                    )?;
2355                    Ok(InputReportsReaderV2Request::_UnknownMethod {
2356                        ordinal: header.ordinal,
2357                        control_handle: InputReportsReaderV2ControlHandle { inner: this.inner.clone() },
2358                        method_type: fidl::MethodType::TwoWay,
2359                    })
2360                }
2361                _ => Err(fidl::Error::UnknownOrdinal {
2362                    ordinal: header.ordinal,
2363                    protocol_name: <InputReportsReaderV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2364                }),
2365            }))
2366            },
2367        )
2368    }
2369}
2370
2371/// A reader protocol that reports input events.
2372#[derive(Debug)]
2373pub enum InputReportsReaderV2Request {
2374    /// The client has processed events up to `last_acknowledged_report_stamp`.
2375    /// All reports sent with a `last_report_stamp` less than or equal to
2376    /// `last_acknowledged_report_stamp` will be considered acknowledged, and therefore
2377    /// will not count towards the `max_unacknowledged_reports` limit.
2378    AcknowledgeReports {
2379        last_acknowledged_report_stamp: u64,
2380        control_handle: InputReportsReaderV2ControlHandle,
2381    },
2382    /// An interaction was received which does not match any known method.
2383    #[non_exhaustive]
2384    _UnknownMethod {
2385        /// Ordinal of the method that was called.
2386        ordinal: u64,
2387        control_handle: InputReportsReaderV2ControlHandle,
2388        method_type: fidl::MethodType,
2389    },
2390}
2391
2392impl InputReportsReaderV2Request {
2393    #[allow(irrefutable_let_patterns)]
2394    pub fn into_acknowledge_reports(self) -> Option<(u64, InputReportsReaderV2ControlHandle)> {
2395        if let InputReportsReaderV2Request::AcknowledgeReports {
2396            last_acknowledged_report_stamp,
2397            control_handle,
2398        } = self
2399        {
2400            Some((last_acknowledged_report_stamp, control_handle))
2401        } else {
2402            None
2403        }
2404    }
2405
2406    /// Name of the method defined in FIDL
2407    pub fn method_name(&self) -> &'static str {
2408        match *self {
2409            InputReportsReaderV2Request::AcknowledgeReports { .. } => "acknowledge_reports",
2410            InputReportsReaderV2Request::_UnknownMethod {
2411                method_type: fidl::MethodType::OneWay,
2412                ..
2413            } => "unknown one-way method",
2414            InputReportsReaderV2Request::_UnknownMethod {
2415                method_type: fidl::MethodType::TwoWay,
2416                ..
2417            } => "unknown two-way method",
2418        }
2419    }
2420}
2421
2422#[derive(Debug, Clone)]
2423pub struct InputReportsReaderV2ControlHandle {
2424    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2425}
2426
2427impl InputReportsReaderV2ControlHandle {
2428    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2429        self.inner.shutdown_with_epitaph(status.into())
2430    }
2431}
2432
2433impl fidl::endpoints::ControlHandle for InputReportsReaderV2ControlHandle {
2434    fn shutdown(&self) {
2435        self.inner.shutdown()
2436    }
2437
2438    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2439        self.inner.shutdown_with_epitaph(status)
2440    }
2441
2442    fn is_closed(&self) -> bool {
2443        self.inner.channel().is_closed()
2444    }
2445    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2446        self.inner.channel().on_closed()
2447    }
2448
2449    #[cfg(target_os = "fuchsia")]
2450    fn signal_peer(
2451        &self,
2452        clear_mask: zx::Signals,
2453        set_mask: zx::Signals,
2454    ) -> Result<(), zx_status::Status> {
2455        use fidl::Peered;
2456        self.inner.channel().signal_peer(clear_mask, set_mask)
2457    }
2458}
2459
2460impl InputReportsReaderV2ControlHandle {
2461    pub fn send_on_input_reports(
2462        &self,
2463        mut reports: Vec<InputReport>,
2464        mut last_report_stamp: u64,
2465    ) -> Result<(), fidl::Error> {
2466        self.inner.send::<InputReportsReaderV2OnInputReportsRequest>(
2467            (reports.as_mut(), last_report_stamp),
2468            0,
2469            0x582edad00fe8e3b9,
2470            fidl::encoding::DynamicFlags::FLEXIBLE,
2471        )
2472    }
2473}
2474
2475#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2476pub struct ServiceMarker;
2477
2478#[cfg(target_os = "fuchsia")]
2479impl fidl::endpoints::ServiceMarker for ServiceMarker {
2480    type Proxy = ServiceProxy;
2481    type Request = ServiceRequest;
2482    const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
2483}
2484
2485/// A request for one of the member protocols of Service.
2486///
2487#[cfg(target_os = "fuchsia")]
2488pub enum ServiceRequest {
2489    InputDevice(InputDeviceRequestStream),
2490}
2491
2492#[cfg(target_os = "fuchsia")]
2493impl fidl::endpoints::ServiceRequest for ServiceRequest {
2494    type Service = ServiceMarker;
2495
2496    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2497        match name {
2498            "input_device" => Self::InputDevice(
2499                <InputDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
2500                    _channel,
2501                ),
2502            ),
2503            _ => panic!("no such member protocol name for service Service"),
2504        }
2505    }
2506
2507    fn member_names() -> &'static [&'static str] {
2508        &["input_device"]
2509    }
2510}
2511#[cfg(target_os = "fuchsia")]
2512pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2513
2514#[cfg(target_os = "fuchsia")]
2515impl fidl::endpoints::ServiceProxy for ServiceProxy {
2516    type Service = ServiceMarker;
2517
2518    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2519        Self(opener)
2520    }
2521}
2522
2523#[cfg(target_os = "fuchsia")]
2524impl ServiceProxy {
2525    pub fn connect_to_input_device(&self) -> Result<InputDeviceProxy, fidl::Error> {
2526        let (proxy, server_end) = fidl::endpoints::create_proxy::<InputDeviceMarker>();
2527        self.connect_channel_to_input_device(server_end)?;
2528        Ok(proxy)
2529    }
2530
2531    /// Like `connect_to_input_device`, but returns a sync proxy.
2532    /// See [`Self::connect_to_input_device`] for more details.
2533    pub fn connect_to_input_device_sync(&self) -> Result<InputDeviceSynchronousProxy, fidl::Error> {
2534        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<InputDeviceMarker>();
2535        self.connect_channel_to_input_device(server_end)?;
2536        Ok(proxy)
2537    }
2538
2539    /// Like `connect_to_input_device`, but accepts a server end.
2540    /// See [`Self::connect_to_input_device`] for more details.
2541    pub fn connect_channel_to_input_device(
2542        &self,
2543        server_end: fidl::endpoints::ServerEnd<InputDeviceMarker>,
2544    ) -> Result<(), fidl::Error> {
2545        self.0.open_member("input_device", server_end.into_channel())
2546    }
2547
2548    pub fn instance_name(&self) -> &str {
2549        self.0.instance_name()
2550    }
2551}
2552
2553mod internal {
2554    use super::*;
2555
2556    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderRequest {
2557        type Borrowed<'a> = &'a mut Self;
2558        fn take_or_borrow<'a>(
2559            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2560        ) -> Self::Borrowed<'a> {
2561            value
2562        }
2563    }
2564
2565    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderRequest {
2566        type Owned = Self;
2567
2568        #[inline(always)]
2569        fn inline_align(_context: fidl::encoding::Context) -> usize {
2570            4
2571        }
2572
2573        #[inline(always)]
2574        fn inline_size(_context: fidl::encoding::Context) -> usize {
2575            4
2576        }
2577    }
2578
2579    unsafe impl
2580        fidl::encoding::Encode<
2581            InputDeviceGetInputReportsReaderRequest,
2582            fidl::encoding::DefaultFuchsiaResourceDialect,
2583        > for &mut InputDeviceGetInputReportsReaderRequest
2584    {
2585        #[inline]
2586        unsafe fn encode(
2587            self,
2588            encoder: &mut fidl::encoding::Encoder<
2589                '_,
2590                fidl::encoding::DefaultFuchsiaResourceDialect,
2591            >,
2592            offset: usize,
2593            _depth: fidl::encoding::Depth,
2594        ) -> fidl::Result<()> {
2595            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
2596            // Delegate to tuple encoding.
2597            fidl::encoding::Encode::<InputDeviceGetInputReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2598                (
2599                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
2600                ),
2601                encoder, offset, _depth
2602            )
2603        }
2604    }
2605    unsafe impl<
2606        T0: fidl::encoding::Encode<
2607                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
2608                fidl::encoding::DefaultFuchsiaResourceDialect,
2609            >,
2610    >
2611        fidl::encoding::Encode<
2612            InputDeviceGetInputReportsReaderRequest,
2613            fidl::encoding::DefaultFuchsiaResourceDialect,
2614        > for (T0,)
2615    {
2616        #[inline]
2617        unsafe fn encode(
2618            self,
2619            encoder: &mut fidl::encoding::Encoder<
2620                '_,
2621                fidl::encoding::DefaultFuchsiaResourceDialect,
2622            >,
2623            offset: usize,
2624            depth: fidl::encoding::Depth,
2625        ) -> fidl::Result<()> {
2626            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
2627            // Zero out padding regions. There's no need to apply masks
2628            // because the unmasked parts will be overwritten by fields.
2629            // Write the fields.
2630            self.0.encode(encoder, offset + 0, depth)?;
2631            Ok(())
2632        }
2633    }
2634
2635    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2636        for InputDeviceGetInputReportsReaderRequest
2637    {
2638        #[inline(always)]
2639        fn new_empty() -> Self {
2640            Self {
2641                reader: fidl::new_empty!(
2642                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
2643                    fidl::encoding::DefaultFuchsiaResourceDialect
2644                ),
2645            }
2646        }
2647
2648        #[inline]
2649        unsafe fn decode(
2650            &mut self,
2651            decoder: &mut fidl::encoding::Decoder<
2652                '_,
2653                fidl::encoding::DefaultFuchsiaResourceDialect,
2654            >,
2655            offset: usize,
2656            _depth: fidl::encoding::Depth,
2657        ) -> fidl::Result<()> {
2658            decoder.debug_check_bounds::<Self>(offset);
2659            // Verify that padding bytes are zero.
2660            fidl::decode!(
2661                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
2662                fidl::encoding::DefaultFuchsiaResourceDialect,
2663                &mut self.reader,
2664                decoder,
2665                offset + 0,
2666                _depth
2667            )?;
2668            Ok(())
2669        }
2670    }
2671
2672    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderV2Request {
2673        type Borrowed<'a> = &'a mut Self;
2674        fn take_or_borrow<'a>(
2675            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2676        ) -> Self::Borrowed<'a> {
2677            value
2678        }
2679    }
2680
2681    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderV2Request {
2682        type Owned = Self;
2683
2684        #[inline(always)]
2685        fn inline_align(_context: fidl::encoding::Context) -> usize {
2686            4
2687        }
2688
2689        #[inline(always)]
2690        fn inline_size(_context: fidl::encoding::Context) -> usize {
2691            8
2692        }
2693    }
2694
2695    unsafe impl
2696        fidl::encoding::Encode<
2697            InputDeviceGetInputReportsReaderV2Request,
2698            fidl::encoding::DefaultFuchsiaResourceDialect,
2699        > for &mut InputDeviceGetInputReportsReaderV2Request
2700    {
2701        #[inline]
2702        unsafe fn encode(
2703            self,
2704            encoder: &mut fidl::encoding::Encoder<
2705                '_,
2706                fidl::encoding::DefaultFuchsiaResourceDialect,
2707            >,
2708            offset: usize,
2709            _depth: fidl::encoding::Depth,
2710        ) -> fidl::Result<()> {
2711            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderV2Request>(offset);
2712            // Delegate to tuple encoding.
2713            fidl::encoding::Encode::<
2714                InputDeviceGetInputReportsReaderV2Request,
2715                fidl::encoding::DefaultFuchsiaResourceDialect,
2716            >::encode(
2717                (
2718                    <fidl::encoding::Endpoint<
2719                        fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
2720                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2721                        &mut self.reader
2722                    ),
2723                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(
2724                        &self.max_unacknowledged_reports_limit,
2725                    ),
2726                ),
2727                encoder,
2728                offset,
2729                _depth,
2730            )
2731        }
2732    }
2733    unsafe impl<
2734        T0: fidl::encoding::Encode<
2735                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>>,
2736                fidl::encoding::DefaultFuchsiaResourceDialect,
2737            >,
2738        T1: fidl::encoding::Encode<u16, fidl::encoding::DefaultFuchsiaResourceDialect>,
2739    >
2740        fidl::encoding::Encode<
2741            InputDeviceGetInputReportsReaderV2Request,
2742            fidl::encoding::DefaultFuchsiaResourceDialect,
2743        > for (T0, T1)
2744    {
2745        #[inline]
2746        unsafe fn encode(
2747            self,
2748            encoder: &mut fidl::encoding::Encoder<
2749                '_,
2750                fidl::encoding::DefaultFuchsiaResourceDialect,
2751            >,
2752            offset: usize,
2753            depth: fidl::encoding::Depth,
2754        ) -> fidl::Result<()> {
2755            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderV2Request>(offset);
2756            // Zero out padding regions. There's no need to apply masks
2757            // because the unmasked parts will be overwritten by fields.
2758            unsafe {
2759                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
2760                (ptr as *mut u32).write_unaligned(0);
2761            }
2762            // Write the fields.
2763            self.0.encode(encoder, offset + 0, depth)?;
2764            self.1.encode(encoder, offset + 4, depth)?;
2765            Ok(())
2766        }
2767    }
2768
2769    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2770        for InputDeviceGetInputReportsReaderV2Request
2771    {
2772        #[inline(always)]
2773        fn new_empty() -> Self {
2774            Self {
2775                reader: fidl::new_empty!(
2776                    fidl::encoding::Endpoint<
2777                        fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
2778                    >,
2779                    fidl::encoding::DefaultFuchsiaResourceDialect
2780                ),
2781                max_unacknowledged_reports_limit: fidl::new_empty!(
2782                    u16,
2783                    fidl::encoding::DefaultFuchsiaResourceDialect
2784                ),
2785            }
2786        }
2787
2788        #[inline]
2789        unsafe fn decode(
2790            &mut self,
2791            decoder: &mut fidl::encoding::Decoder<
2792                '_,
2793                fidl::encoding::DefaultFuchsiaResourceDialect,
2794            >,
2795            offset: usize,
2796            _depth: fidl::encoding::Depth,
2797        ) -> fidl::Result<()> {
2798            decoder.debug_check_bounds::<Self>(offset);
2799            // Verify that padding bytes are zero.
2800            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
2801            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2802            let mask = 0xffff0000u32;
2803            let maskedval = padval & mask;
2804            if maskedval != 0 {
2805                return Err(fidl::Error::NonZeroPadding {
2806                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
2807                });
2808            }
2809            fidl::decode!(
2810                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>>,
2811                fidl::encoding::DefaultFuchsiaResourceDialect,
2812                &mut self.reader,
2813                decoder,
2814                offset + 0,
2815                _depth
2816            )?;
2817            fidl::decode!(
2818                u16,
2819                fidl::encoding::DefaultFuchsiaResourceDialect,
2820                &mut self.max_unacknowledged_reports_limit,
2821                decoder,
2822                offset + 4,
2823                _depth
2824            )?;
2825            Ok(())
2826        }
2827    }
2828
2829    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportResponse {
2830        type Borrowed<'a> = &'a mut Self;
2831        fn take_or_borrow<'a>(
2832            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2833        ) -> Self::Borrowed<'a> {
2834            value
2835        }
2836    }
2837
2838    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2839        type Owned = Self;
2840
2841        #[inline(always)]
2842        fn inline_align(_context: fidl::encoding::Context) -> usize {
2843            8
2844        }
2845
2846        #[inline(always)]
2847        fn inline_size(_context: fidl::encoding::Context) -> usize {
2848            16
2849        }
2850    }
2851
2852    unsafe impl
2853        fidl::encoding::Encode<
2854            InputDeviceGetInputReportResponse,
2855            fidl::encoding::DefaultFuchsiaResourceDialect,
2856        > for &mut InputDeviceGetInputReportResponse
2857    {
2858        #[inline]
2859        unsafe fn encode(
2860            self,
2861            encoder: &mut fidl::encoding::Encoder<
2862                '_,
2863                fidl::encoding::DefaultFuchsiaResourceDialect,
2864            >,
2865            offset: usize,
2866            _depth: fidl::encoding::Depth,
2867        ) -> fidl::Result<()> {
2868            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2869            // Delegate to tuple encoding.
2870            fidl::encoding::Encode::<
2871                InputDeviceGetInputReportResponse,
2872                fidl::encoding::DefaultFuchsiaResourceDialect,
2873            >::encode(
2874                (<InputReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2875                    &mut self.report,
2876                ),),
2877                encoder,
2878                offset,
2879                _depth,
2880            )
2881        }
2882    }
2883    unsafe impl<
2884        T0: fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>,
2885    >
2886        fidl::encoding::Encode<
2887            InputDeviceGetInputReportResponse,
2888            fidl::encoding::DefaultFuchsiaResourceDialect,
2889        > for (T0,)
2890    {
2891        #[inline]
2892        unsafe fn encode(
2893            self,
2894            encoder: &mut fidl::encoding::Encoder<
2895                '_,
2896                fidl::encoding::DefaultFuchsiaResourceDialect,
2897            >,
2898            offset: usize,
2899            depth: fidl::encoding::Depth,
2900        ) -> fidl::Result<()> {
2901            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2902            // Zero out padding regions. There's no need to apply masks
2903            // because the unmasked parts will be overwritten by fields.
2904            // Write the fields.
2905            self.0.encode(encoder, offset + 0, depth)?;
2906            Ok(())
2907        }
2908    }
2909
2910    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2911        for InputDeviceGetInputReportResponse
2912    {
2913        #[inline(always)]
2914        fn new_empty() -> Self {
2915            Self {
2916                report: fidl::new_empty!(
2917                    InputReport,
2918                    fidl::encoding::DefaultFuchsiaResourceDialect
2919                ),
2920            }
2921        }
2922
2923        #[inline]
2924        unsafe fn decode(
2925            &mut self,
2926            decoder: &mut fidl::encoding::Decoder<
2927                '_,
2928                fidl::encoding::DefaultFuchsiaResourceDialect,
2929            >,
2930            offset: usize,
2931            _depth: fidl::encoding::Depth,
2932        ) -> fidl::Result<()> {
2933            decoder.debug_check_bounds::<Self>(offset);
2934            // Verify that padding bytes are zero.
2935            fidl::decode!(
2936                InputReport,
2937                fidl::encoding::DefaultFuchsiaResourceDialect,
2938                &mut self.report,
2939                decoder,
2940                offset + 0,
2941                _depth
2942            )?;
2943            Ok(())
2944        }
2945    }
2946
2947    impl fidl::encoding::ResourceTypeMarker for InputReportsReaderV2OnInputReportsRequest {
2948        type Borrowed<'a> = &'a mut Self;
2949        fn take_or_borrow<'a>(
2950            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2951        ) -> Self::Borrowed<'a> {
2952            value
2953        }
2954    }
2955
2956    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderV2OnInputReportsRequest {
2957        type Owned = Self;
2958
2959        #[inline(always)]
2960        fn inline_align(_context: fidl::encoding::Context) -> usize {
2961            8
2962        }
2963
2964        #[inline(always)]
2965        fn inline_size(_context: fidl::encoding::Context) -> usize {
2966            24
2967        }
2968    }
2969
2970    unsafe impl
2971        fidl::encoding::Encode<
2972            InputReportsReaderV2OnInputReportsRequest,
2973            fidl::encoding::DefaultFuchsiaResourceDialect,
2974        > for &mut InputReportsReaderV2OnInputReportsRequest
2975    {
2976        #[inline]
2977        unsafe fn encode(
2978            self,
2979            encoder: &mut fidl::encoding::Encoder<
2980                '_,
2981                fidl::encoding::DefaultFuchsiaResourceDialect,
2982            >,
2983            offset: usize,
2984            _depth: fidl::encoding::Depth,
2985        ) -> fidl::Result<()> {
2986            encoder.debug_check_bounds::<InputReportsReaderV2OnInputReportsRequest>(offset);
2987            // Delegate to tuple encoding.
2988            fidl::encoding::Encode::<InputReportsReaderV2OnInputReportsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2989                (
2990                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
2991                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.last_report_stamp),
2992                ),
2993                encoder, offset, _depth
2994            )
2995        }
2996    }
2997    unsafe impl<
2998        T0: fidl::encoding::Encode<
2999                fidl::encoding::Vector<InputReport, 50>,
3000                fidl::encoding::DefaultFuchsiaResourceDialect,
3001            >,
3002        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3003    >
3004        fidl::encoding::Encode<
3005            InputReportsReaderV2OnInputReportsRequest,
3006            fidl::encoding::DefaultFuchsiaResourceDialect,
3007        > for (T0, T1)
3008    {
3009        #[inline]
3010        unsafe fn encode(
3011            self,
3012            encoder: &mut fidl::encoding::Encoder<
3013                '_,
3014                fidl::encoding::DefaultFuchsiaResourceDialect,
3015            >,
3016            offset: usize,
3017            depth: fidl::encoding::Depth,
3018        ) -> fidl::Result<()> {
3019            encoder.debug_check_bounds::<InputReportsReaderV2OnInputReportsRequest>(offset);
3020            // Zero out padding regions. There's no need to apply masks
3021            // because the unmasked parts will be overwritten by fields.
3022            // Write the fields.
3023            self.0.encode(encoder, offset + 0, depth)?;
3024            self.1.encode(encoder, offset + 16, depth)?;
3025            Ok(())
3026        }
3027    }
3028
3029    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3030        for InputReportsReaderV2OnInputReportsRequest
3031    {
3032        #[inline(always)]
3033        fn new_empty() -> Self {
3034            Self {
3035                reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
3036                last_report_stamp: fidl::new_empty!(
3037                    u64,
3038                    fidl::encoding::DefaultFuchsiaResourceDialect
3039                ),
3040            }
3041        }
3042
3043        #[inline]
3044        unsafe fn decode(
3045            &mut self,
3046            decoder: &mut fidl::encoding::Decoder<
3047                '_,
3048                fidl::encoding::DefaultFuchsiaResourceDialect,
3049            >,
3050            offset: usize,
3051            _depth: fidl::encoding::Depth,
3052        ) -> fidl::Result<()> {
3053            decoder.debug_check_bounds::<Self>(offset);
3054            // Verify that padding bytes are zero.
3055            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
3056            fidl::decode!(
3057                u64,
3058                fidl::encoding::DefaultFuchsiaResourceDialect,
3059                &mut self.last_report_stamp,
3060                decoder,
3061                offset + 16,
3062                _depth
3063            )?;
3064            Ok(())
3065        }
3066    }
3067
3068    impl fidl::encoding::ResourceTypeMarker for InputReportsReaderReadInputReportsResponse {
3069        type Borrowed<'a> = &'a mut Self;
3070        fn take_or_borrow<'a>(
3071            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3072        ) -> Self::Borrowed<'a> {
3073            value
3074        }
3075    }
3076
3077    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
3078        type Owned = Self;
3079
3080        #[inline(always)]
3081        fn inline_align(_context: fidl::encoding::Context) -> usize {
3082            8
3083        }
3084
3085        #[inline(always)]
3086        fn inline_size(_context: fidl::encoding::Context) -> usize {
3087            16
3088        }
3089    }
3090
3091    unsafe impl
3092        fidl::encoding::Encode<
3093            InputReportsReaderReadInputReportsResponse,
3094            fidl::encoding::DefaultFuchsiaResourceDialect,
3095        > for &mut InputReportsReaderReadInputReportsResponse
3096    {
3097        #[inline]
3098        unsafe fn encode(
3099            self,
3100            encoder: &mut fidl::encoding::Encoder<
3101                '_,
3102                fidl::encoding::DefaultFuchsiaResourceDialect,
3103            >,
3104            offset: usize,
3105            _depth: fidl::encoding::Depth,
3106        ) -> fidl::Result<()> {
3107            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
3108            // Delegate to tuple encoding.
3109            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3110                (
3111                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
3112                ),
3113                encoder, offset, _depth
3114            )
3115        }
3116    }
3117    unsafe impl<
3118        T0: fidl::encoding::Encode<
3119                fidl::encoding::Vector<InputReport, 50>,
3120                fidl::encoding::DefaultFuchsiaResourceDialect,
3121            >,
3122    >
3123        fidl::encoding::Encode<
3124            InputReportsReaderReadInputReportsResponse,
3125            fidl::encoding::DefaultFuchsiaResourceDialect,
3126        > for (T0,)
3127    {
3128        #[inline]
3129        unsafe fn encode(
3130            self,
3131            encoder: &mut fidl::encoding::Encoder<
3132                '_,
3133                fidl::encoding::DefaultFuchsiaResourceDialect,
3134            >,
3135            offset: usize,
3136            depth: fidl::encoding::Depth,
3137        ) -> fidl::Result<()> {
3138            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
3139            // Zero out padding regions. There's no need to apply masks
3140            // because the unmasked parts will be overwritten by fields.
3141            // Write the fields.
3142            self.0.encode(encoder, offset + 0, depth)?;
3143            Ok(())
3144        }
3145    }
3146
3147    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3148        for InputReportsReaderReadInputReportsResponse
3149    {
3150        #[inline(always)]
3151        fn new_empty() -> Self {
3152            Self {
3153                reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
3154            }
3155        }
3156
3157        #[inline]
3158        unsafe fn decode(
3159            &mut self,
3160            decoder: &mut fidl::encoding::Decoder<
3161                '_,
3162                fidl::encoding::DefaultFuchsiaResourceDialect,
3163            >,
3164            offset: usize,
3165            _depth: fidl::encoding::Depth,
3166        ) -> fidl::Result<()> {
3167            decoder.debug_check_bounds::<Self>(offset);
3168            // Verify that padding bytes are zero.
3169            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
3170            Ok(())
3171        }
3172    }
3173
3174    impl InputReport {
3175        #[inline(always)]
3176        fn max_ordinal_present(&self) -> u64 {
3177            if let Some(_) = self.wake_lease {
3178                return 9;
3179            }
3180            if let Some(_) = self.report_id {
3181                return 8;
3182            }
3183            if let Some(_) = self.consumer_control {
3184                return 7;
3185            }
3186            if let Some(_) = self.keyboard {
3187                return 6;
3188            }
3189            if let Some(_) = self.touch {
3190                return 5;
3191            }
3192            if let Some(_) = self.sensor {
3193                return 4;
3194            }
3195            if let Some(_) = self.trace_id {
3196                return 3;
3197            }
3198            if let Some(_) = self.mouse {
3199                return 2;
3200            }
3201            if let Some(_) = self.event_time {
3202                return 1;
3203            }
3204            0
3205        }
3206    }
3207
3208    impl fidl::encoding::ResourceTypeMarker for InputReport {
3209        type Borrowed<'a> = &'a mut Self;
3210        fn take_or_borrow<'a>(
3211            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3212        ) -> Self::Borrowed<'a> {
3213            value
3214        }
3215    }
3216
3217    unsafe impl fidl::encoding::TypeMarker for InputReport {
3218        type Owned = Self;
3219
3220        #[inline(always)]
3221        fn inline_align(_context: fidl::encoding::Context) -> usize {
3222            8
3223        }
3224
3225        #[inline(always)]
3226        fn inline_size(_context: fidl::encoding::Context) -> usize {
3227            16
3228        }
3229    }
3230
3231    unsafe impl fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>
3232        for &mut InputReport
3233    {
3234        unsafe fn encode(
3235            self,
3236            encoder: &mut fidl::encoding::Encoder<
3237                '_,
3238                fidl::encoding::DefaultFuchsiaResourceDialect,
3239            >,
3240            offset: usize,
3241            mut depth: fidl::encoding::Depth,
3242        ) -> fidl::Result<()> {
3243            encoder.debug_check_bounds::<InputReport>(offset);
3244            // Vector header
3245            let max_ordinal: u64 = self.max_ordinal_present();
3246            encoder.write_num(max_ordinal, offset);
3247            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3248            // Calling encoder.out_of_line_offset(0) is not allowed.
3249            if max_ordinal == 0 {
3250                return Ok(());
3251            }
3252            depth.increment()?;
3253            let envelope_size = 8;
3254            let bytes_len = max_ordinal as usize * envelope_size;
3255            #[allow(unused_variables)]
3256            let offset = encoder.out_of_line_offset(bytes_len);
3257            let mut _prev_end_offset: usize = 0;
3258            if 1 > max_ordinal {
3259                return Ok(());
3260            }
3261
3262            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3263            // are envelope_size bytes.
3264            let cur_offset: usize = (1 - 1) * envelope_size;
3265
3266            // Zero reserved fields.
3267            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3268
3269            // Safety:
3270            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3271            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3272            //   envelope_size bytes, there is always sufficient room.
3273            fidl::encoding::encode_in_envelope_optional::<
3274                i64,
3275                fidl::encoding::DefaultFuchsiaResourceDialect,
3276            >(
3277                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3278                encoder,
3279                offset + cur_offset,
3280                depth,
3281            )?;
3282
3283            _prev_end_offset = cur_offset + envelope_size;
3284            if 2 > max_ordinal {
3285                return Ok(());
3286            }
3287
3288            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3289            // are envelope_size bytes.
3290            let cur_offset: usize = (2 - 1) * envelope_size;
3291
3292            // Zero reserved fields.
3293            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3294
3295            // Safety:
3296            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3297            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3298            //   envelope_size bytes, there is always sufficient room.
3299            fidl::encoding::encode_in_envelope_optional::<
3300                MouseInputReport,
3301                fidl::encoding::DefaultFuchsiaResourceDialect,
3302            >(
3303                self.mouse
3304                    .as_ref()
3305                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3306                encoder,
3307                offset + cur_offset,
3308                depth,
3309            )?;
3310
3311            _prev_end_offset = cur_offset + envelope_size;
3312            if 3 > max_ordinal {
3313                return Ok(());
3314            }
3315
3316            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3317            // are envelope_size bytes.
3318            let cur_offset: usize = (3 - 1) * envelope_size;
3319
3320            // Zero reserved fields.
3321            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3322
3323            // Safety:
3324            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3325            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3326            //   envelope_size bytes, there is always sufficient room.
3327            fidl::encoding::encode_in_envelope_optional::<
3328                u64,
3329                fidl::encoding::DefaultFuchsiaResourceDialect,
3330            >(
3331                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3332                encoder,
3333                offset + cur_offset,
3334                depth,
3335            )?;
3336
3337            _prev_end_offset = cur_offset + envelope_size;
3338            if 4 > max_ordinal {
3339                return Ok(());
3340            }
3341
3342            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3343            // are envelope_size bytes.
3344            let cur_offset: usize = (4 - 1) * envelope_size;
3345
3346            // Zero reserved fields.
3347            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3348
3349            // Safety:
3350            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3351            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3352            //   envelope_size bytes, there is always sufficient room.
3353            fidl::encoding::encode_in_envelope_optional::<
3354                SensorInputReport,
3355                fidl::encoding::DefaultFuchsiaResourceDialect,
3356            >(
3357                self.sensor
3358                    .as_ref()
3359                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3360                encoder,
3361                offset + cur_offset,
3362                depth,
3363            )?;
3364
3365            _prev_end_offset = cur_offset + envelope_size;
3366            if 5 > max_ordinal {
3367                return Ok(());
3368            }
3369
3370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3371            // are envelope_size bytes.
3372            let cur_offset: usize = (5 - 1) * envelope_size;
3373
3374            // Zero reserved fields.
3375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3376
3377            // Safety:
3378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3380            //   envelope_size bytes, there is always sufficient room.
3381            fidl::encoding::encode_in_envelope_optional::<
3382                TouchInputReport,
3383                fidl::encoding::DefaultFuchsiaResourceDialect,
3384            >(
3385                self.touch
3386                    .as_ref()
3387                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3388                encoder,
3389                offset + cur_offset,
3390                depth,
3391            )?;
3392
3393            _prev_end_offset = cur_offset + envelope_size;
3394            if 6 > max_ordinal {
3395                return Ok(());
3396            }
3397
3398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3399            // are envelope_size bytes.
3400            let cur_offset: usize = (6 - 1) * envelope_size;
3401
3402            // Zero reserved fields.
3403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3404
3405            // Safety:
3406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3408            //   envelope_size bytes, there is always sufficient room.
3409            fidl::encoding::encode_in_envelope_optional::<
3410                KeyboardInputReport,
3411                fidl::encoding::DefaultFuchsiaResourceDialect,
3412            >(
3413                self.keyboard
3414                    .as_ref()
3415                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3416                encoder,
3417                offset + cur_offset,
3418                depth,
3419            )?;
3420
3421            _prev_end_offset = cur_offset + envelope_size;
3422            if 7 > max_ordinal {
3423                return Ok(());
3424            }
3425
3426            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3427            // are envelope_size bytes.
3428            let cur_offset: usize = (7 - 1) * envelope_size;
3429
3430            // Zero reserved fields.
3431            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3432
3433            // Safety:
3434            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3435            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3436            //   envelope_size bytes, there is always sufficient room.
3437            fidl::encoding::encode_in_envelope_optional::<
3438                ConsumerControlInputReport,
3439                fidl::encoding::DefaultFuchsiaResourceDialect,
3440            >(
3441                self.consumer_control
3442                    .as_ref()
3443                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3444                encoder,
3445                offset + cur_offset,
3446                depth,
3447            )?;
3448
3449            _prev_end_offset = cur_offset + envelope_size;
3450            if 8 > max_ordinal {
3451                return Ok(());
3452            }
3453
3454            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3455            // are envelope_size bytes.
3456            let cur_offset: usize = (8 - 1) * envelope_size;
3457
3458            // Zero reserved fields.
3459            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3460
3461            // Safety:
3462            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3463            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3464            //   envelope_size bytes, there is always sufficient room.
3465            fidl::encoding::encode_in_envelope_optional::<
3466                u8,
3467                fidl::encoding::DefaultFuchsiaResourceDialect,
3468            >(
3469                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3470                encoder,
3471                offset + cur_offset,
3472                depth,
3473            )?;
3474
3475            _prev_end_offset = cur_offset + envelope_size;
3476            if 9 > max_ordinal {
3477                return Ok(());
3478            }
3479
3480            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3481            // are envelope_size bytes.
3482            let cur_offset: usize = (9 - 1) * envelope_size;
3483
3484            // Zero reserved fields.
3485            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3486
3487            // Safety:
3488            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3489            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3490            //   envelope_size bytes, there is always sufficient room.
3491            fidl::encoding::encode_in_envelope_optional::<
3492                fidl::encoding::HandleType<
3493                    fidl::EventPair,
3494                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3495                    2147483648,
3496                >,
3497                fidl::encoding::DefaultFuchsiaResourceDialect,
3498            >(
3499                self.wake_lease.as_mut().map(
3500                    <fidl::encoding::HandleType<
3501                        fidl::EventPair,
3502                        { fidl::ObjectType::EVENTPAIR.into_raw() },
3503                        2147483648,
3504                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3505                ),
3506                encoder,
3507                offset + cur_offset,
3508                depth,
3509            )?;
3510
3511            _prev_end_offset = cur_offset + envelope_size;
3512
3513            Ok(())
3514        }
3515    }
3516
3517    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {
3518        #[inline(always)]
3519        fn new_empty() -> Self {
3520            Self::default()
3521        }
3522
3523        unsafe fn decode(
3524            &mut self,
3525            decoder: &mut fidl::encoding::Decoder<
3526                '_,
3527                fidl::encoding::DefaultFuchsiaResourceDialect,
3528            >,
3529            offset: usize,
3530            mut depth: fidl::encoding::Depth,
3531        ) -> fidl::Result<()> {
3532            decoder.debug_check_bounds::<Self>(offset);
3533            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3534                None => return Err(fidl::Error::NotNullable),
3535                Some(len) => len,
3536            };
3537            // Calling decoder.out_of_line_offset(0) is not allowed.
3538            if len == 0 {
3539                return Ok(());
3540            };
3541            depth.increment()?;
3542            let envelope_size = 8;
3543            let bytes_len = len * envelope_size;
3544            let offset = decoder.out_of_line_offset(bytes_len)?;
3545            // Decode the envelope for each type.
3546            let mut _next_ordinal_to_read = 0;
3547            let mut next_offset = offset;
3548            let end_offset = offset + bytes_len;
3549            _next_ordinal_to_read += 1;
3550            if next_offset >= end_offset {
3551                return Ok(());
3552            }
3553
3554            // Decode unknown envelopes for gaps in ordinals.
3555            while _next_ordinal_to_read < 1 {
3556                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3557                _next_ordinal_to_read += 1;
3558                next_offset += envelope_size;
3559            }
3560
3561            let next_out_of_line = decoder.next_out_of_line();
3562            let handles_before = decoder.remaining_handles();
3563            if let Some((inlined, num_bytes, num_handles)) =
3564                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3565            {
3566                let member_inline_size =
3567                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3568                if inlined != (member_inline_size <= 4) {
3569                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3570                }
3571                let inner_offset;
3572                let mut inner_depth = depth.clone();
3573                if inlined {
3574                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3575                    inner_offset = next_offset;
3576                } else {
3577                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3578                    inner_depth.increment()?;
3579                }
3580                let val_ref = self.event_time.get_or_insert_with(|| {
3581                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
3582                });
3583                fidl::decode!(
3584                    i64,
3585                    fidl::encoding::DefaultFuchsiaResourceDialect,
3586                    val_ref,
3587                    decoder,
3588                    inner_offset,
3589                    inner_depth
3590                )?;
3591                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3592                {
3593                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3594                }
3595                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3596                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3597                }
3598            }
3599
3600            next_offset += envelope_size;
3601            _next_ordinal_to_read += 1;
3602            if next_offset >= end_offset {
3603                return Ok(());
3604            }
3605
3606            // Decode unknown envelopes for gaps in ordinals.
3607            while _next_ordinal_to_read < 2 {
3608                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3609                _next_ordinal_to_read += 1;
3610                next_offset += envelope_size;
3611            }
3612
3613            let next_out_of_line = decoder.next_out_of_line();
3614            let handles_before = decoder.remaining_handles();
3615            if let Some((inlined, num_bytes, num_handles)) =
3616                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3617            {
3618                let member_inline_size =
3619                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3620                if inlined != (member_inline_size <= 4) {
3621                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3622                }
3623                let inner_offset;
3624                let mut inner_depth = depth.clone();
3625                if inlined {
3626                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3627                    inner_offset = next_offset;
3628                } else {
3629                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3630                    inner_depth.increment()?;
3631                }
3632                let val_ref = self.mouse.get_or_insert_with(|| {
3633                    fidl::new_empty!(
3634                        MouseInputReport,
3635                        fidl::encoding::DefaultFuchsiaResourceDialect
3636                    )
3637                });
3638                fidl::decode!(
3639                    MouseInputReport,
3640                    fidl::encoding::DefaultFuchsiaResourceDialect,
3641                    val_ref,
3642                    decoder,
3643                    inner_offset,
3644                    inner_depth
3645                )?;
3646                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3647                {
3648                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3649                }
3650                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3651                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3652                }
3653            }
3654
3655            next_offset += envelope_size;
3656            _next_ordinal_to_read += 1;
3657            if next_offset >= end_offset {
3658                return Ok(());
3659            }
3660
3661            // Decode unknown envelopes for gaps in ordinals.
3662            while _next_ordinal_to_read < 3 {
3663                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3664                _next_ordinal_to_read += 1;
3665                next_offset += envelope_size;
3666            }
3667
3668            let next_out_of_line = decoder.next_out_of_line();
3669            let handles_before = decoder.remaining_handles();
3670            if let Some((inlined, num_bytes, num_handles)) =
3671                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3672            {
3673                let member_inline_size =
3674                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3675                if inlined != (member_inline_size <= 4) {
3676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3677                }
3678                let inner_offset;
3679                let mut inner_depth = depth.clone();
3680                if inlined {
3681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3682                    inner_offset = next_offset;
3683                } else {
3684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3685                    inner_depth.increment()?;
3686                }
3687                let val_ref = self.trace_id.get_or_insert_with(|| {
3688                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3689                });
3690                fidl::decode!(
3691                    u64,
3692                    fidl::encoding::DefaultFuchsiaResourceDialect,
3693                    val_ref,
3694                    decoder,
3695                    inner_offset,
3696                    inner_depth
3697                )?;
3698                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3699                {
3700                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3701                }
3702                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3703                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3704                }
3705            }
3706
3707            next_offset += envelope_size;
3708            _next_ordinal_to_read += 1;
3709            if next_offset >= end_offset {
3710                return Ok(());
3711            }
3712
3713            // Decode unknown envelopes for gaps in ordinals.
3714            while _next_ordinal_to_read < 4 {
3715                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3716                _next_ordinal_to_read += 1;
3717                next_offset += envelope_size;
3718            }
3719
3720            let next_out_of_line = decoder.next_out_of_line();
3721            let handles_before = decoder.remaining_handles();
3722            if let Some((inlined, num_bytes, num_handles)) =
3723                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3724            {
3725                let member_inline_size =
3726                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3727                if inlined != (member_inline_size <= 4) {
3728                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3729                }
3730                let inner_offset;
3731                let mut inner_depth = depth.clone();
3732                if inlined {
3733                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3734                    inner_offset = next_offset;
3735                } else {
3736                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3737                    inner_depth.increment()?;
3738                }
3739                let val_ref = self.sensor.get_or_insert_with(|| {
3740                    fidl::new_empty!(
3741                        SensorInputReport,
3742                        fidl::encoding::DefaultFuchsiaResourceDialect
3743                    )
3744                });
3745                fidl::decode!(
3746                    SensorInputReport,
3747                    fidl::encoding::DefaultFuchsiaResourceDialect,
3748                    val_ref,
3749                    decoder,
3750                    inner_offset,
3751                    inner_depth
3752                )?;
3753                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3754                {
3755                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3756                }
3757                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3758                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3759                }
3760            }
3761
3762            next_offset += envelope_size;
3763            _next_ordinal_to_read += 1;
3764            if next_offset >= end_offset {
3765                return Ok(());
3766            }
3767
3768            // Decode unknown envelopes for gaps in ordinals.
3769            while _next_ordinal_to_read < 5 {
3770                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3771                _next_ordinal_to_read += 1;
3772                next_offset += envelope_size;
3773            }
3774
3775            let next_out_of_line = decoder.next_out_of_line();
3776            let handles_before = decoder.remaining_handles();
3777            if let Some((inlined, num_bytes, num_handles)) =
3778                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3779            {
3780                let member_inline_size =
3781                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3782                if inlined != (member_inline_size <= 4) {
3783                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3784                }
3785                let inner_offset;
3786                let mut inner_depth = depth.clone();
3787                if inlined {
3788                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3789                    inner_offset = next_offset;
3790                } else {
3791                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3792                    inner_depth.increment()?;
3793                }
3794                let val_ref = self.touch.get_or_insert_with(|| {
3795                    fidl::new_empty!(
3796                        TouchInputReport,
3797                        fidl::encoding::DefaultFuchsiaResourceDialect
3798                    )
3799                });
3800                fidl::decode!(
3801                    TouchInputReport,
3802                    fidl::encoding::DefaultFuchsiaResourceDialect,
3803                    val_ref,
3804                    decoder,
3805                    inner_offset,
3806                    inner_depth
3807                )?;
3808                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3809                {
3810                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3811                }
3812                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3813                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3814                }
3815            }
3816
3817            next_offset += envelope_size;
3818            _next_ordinal_to_read += 1;
3819            if next_offset >= end_offset {
3820                return Ok(());
3821            }
3822
3823            // Decode unknown envelopes for gaps in ordinals.
3824            while _next_ordinal_to_read < 6 {
3825                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3826                _next_ordinal_to_read += 1;
3827                next_offset += envelope_size;
3828            }
3829
3830            let next_out_of_line = decoder.next_out_of_line();
3831            let handles_before = decoder.remaining_handles();
3832            if let Some((inlined, num_bytes, num_handles)) =
3833                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3834            {
3835                let member_inline_size =
3836                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
3837                        decoder.context,
3838                    );
3839                if inlined != (member_inline_size <= 4) {
3840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3841                }
3842                let inner_offset;
3843                let mut inner_depth = depth.clone();
3844                if inlined {
3845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3846                    inner_offset = next_offset;
3847                } else {
3848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3849                    inner_depth.increment()?;
3850                }
3851                let val_ref = self.keyboard.get_or_insert_with(|| {
3852                    fidl::new_empty!(
3853                        KeyboardInputReport,
3854                        fidl::encoding::DefaultFuchsiaResourceDialect
3855                    )
3856                });
3857                fidl::decode!(
3858                    KeyboardInputReport,
3859                    fidl::encoding::DefaultFuchsiaResourceDialect,
3860                    val_ref,
3861                    decoder,
3862                    inner_offset,
3863                    inner_depth
3864                )?;
3865                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3866                {
3867                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3868                }
3869                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3870                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3871                }
3872            }
3873
3874            next_offset += envelope_size;
3875            _next_ordinal_to_read += 1;
3876            if next_offset >= end_offset {
3877                return Ok(());
3878            }
3879
3880            // Decode unknown envelopes for gaps in ordinals.
3881            while _next_ordinal_to_read < 7 {
3882                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3883                _next_ordinal_to_read += 1;
3884                next_offset += envelope_size;
3885            }
3886
3887            let next_out_of_line = decoder.next_out_of_line();
3888            let handles_before = decoder.remaining_handles();
3889            if let Some((inlined, num_bytes, num_handles)) =
3890                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3891            {
3892                let member_inline_size =
3893                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
3894                        decoder.context,
3895                    );
3896                if inlined != (member_inline_size <= 4) {
3897                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3898                }
3899                let inner_offset;
3900                let mut inner_depth = depth.clone();
3901                if inlined {
3902                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3903                    inner_offset = next_offset;
3904                } else {
3905                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3906                    inner_depth.increment()?;
3907                }
3908                let val_ref = self.consumer_control.get_or_insert_with(|| {
3909                    fidl::new_empty!(
3910                        ConsumerControlInputReport,
3911                        fidl::encoding::DefaultFuchsiaResourceDialect
3912                    )
3913                });
3914                fidl::decode!(
3915                    ConsumerControlInputReport,
3916                    fidl::encoding::DefaultFuchsiaResourceDialect,
3917                    val_ref,
3918                    decoder,
3919                    inner_offset,
3920                    inner_depth
3921                )?;
3922                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3923                {
3924                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3925                }
3926                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3927                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3928                }
3929            }
3930
3931            next_offset += envelope_size;
3932            _next_ordinal_to_read += 1;
3933            if next_offset >= end_offset {
3934                return Ok(());
3935            }
3936
3937            // Decode unknown envelopes for gaps in ordinals.
3938            while _next_ordinal_to_read < 8 {
3939                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3940                _next_ordinal_to_read += 1;
3941                next_offset += envelope_size;
3942            }
3943
3944            let next_out_of_line = decoder.next_out_of_line();
3945            let handles_before = decoder.remaining_handles();
3946            if let Some((inlined, num_bytes, num_handles)) =
3947                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3948            {
3949                let member_inline_size =
3950                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3951                if inlined != (member_inline_size <= 4) {
3952                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3953                }
3954                let inner_offset;
3955                let mut inner_depth = depth.clone();
3956                if inlined {
3957                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3958                    inner_offset = next_offset;
3959                } else {
3960                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3961                    inner_depth.increment()?;
3962                }
3963                let val_ref = self.report_id.get_or_insert_with(|| {
3964                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
3965                });
3966                fidl::decode!(
3967                    u8,
3968                    fidl::encoding::DefaultFuchsiaResourceDialect,
3969                    val_ref,
3970                    decoder,
3971                    inner_offset,
3972                    inner_depth
3973                )?;
3974                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3975                {
3976                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3977                }
3978                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3979                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3980                }
3981            }
3982
3983            next_offset += envelope_size;
3984            _next_ordinal_to_read += 1;
3985            if next_offset >= end_offset {
3986                return Ok(());
3987            }
3988
3989            // Decode unknown envelopes for gaps in ordinals.
3990            while _next_ordinal_to_read < 9 {
3991                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3992                _next_ordinal_to_read += 1;
3993                next_offset += envelope_size;
3994            }
3995
3996            let next_out_of_line = decoder.next_out_of_line();
3997            let handles_before = decoder.remaining_handles();
3998            if let Some((inlined, num_bytes, num_handles)) =
3999                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4000            {
4001                let member_inline_size = <fidl::encoding::HandleType<
4002                    fidl::EventPair,
4003                    { fidl::ObjectType::EVENTPAIR.into_raw() },
4004                    2147483648,
4005                > as fidl::encoding::TypeMarker>::inline_size(
4006                    decoder.context
4007                );
4008                if inlined != (member_inline_size <= 4) {
4009                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4010                }
4011                let inner_offset;
4012                let mut inner_depth = depth.clone();
4013                if inlined {
4014                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4015                    inner_offset = next_offset;
4016                } else {
4017                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4018                    inner_depth.increment()?;
4019                }
4020                let val_ref =
4021                self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4022                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4023                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4024                {
4025                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4026                }
4027                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4028                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4029                }
4030            }
4031
4032            next_offset += envelope_size;
4033
4034            // Decode the remaining unknown envelopes.
4035            while next_offset < end_offset {
4036                _next_ordinal_to_read += 1;
4037                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4038                next_offset += envelope_size;
4039            }
4040
4041            Ok(())
4042        }
4043    }
4044}