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 fidl::endpoints::ControlHandle for InputDeviceControlHandle {
1089    fn shutdown(&self) {
1090        self.inner.shutdown()
1091    }
1092
1093    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1094        self.inner.shutdown_with_epitaph(status)
1095    }
1096
1097    fn is_closed(&self) -> bool {
1098        self.inner.channel().is_closed()
1099    }
1100    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1101        self.inner.channel().on_closed()
1102    }
1103
1104    #[cfg(target_os = "fuchsia")]
1105    fn signal_peer(
1106        &self,
1107        clear_mask: zx::Signals,
1108        set_mask: zx::Signals,
1109    ) -> Result<(), zx_status::Status> {
1110        use fidl::Peered;
1111        self.inner.channel().signal_peer(clear_mask, set_mask)
1112    }
1113}
1114
1115impl InputDeviceControlHandle {}
1116
1117#[must_use = "FIDL methods require a response to be sent"]
1118#[derive(Debug)]
1119pub struct InputDeviceGetInputReportsReaderV2Responder {
1120    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1121    tx_id: u32,
1122}
1123
1124/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1125/// if the responder is dropped without sending a response, so that the client
1126/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1127impl std::ops::Drop for InputDeviceGetInputReportsReaderV2Responder {
1128    fn drop(&mut self) {
1129        self.control_handle.shutdown();
1130        // Safety: drops once, never accessed again
1131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132    }
1133}
1134
1135impl fidl::endpoints::Responder for InputDeviceGetInputReportsReaderV2Responder {
1136    type ControlHandle = InputDeviceControlHandle;
1137
1138    fn control_handle(&self) -> &InputDeviceControlHandle {
1139        &self.control_handle
1140    }
1141
1142    fn drop_without_shutdown(mut self) {
1143        // Safety: drops once, never accessed again due to mem::forget
1144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1145        // Prevent Drop from running (which would shut down the channel)
1146        std::mem::forget(self);
1147    }
1148}
1149
1150impl InputDeviceGetInputReportsReaderV2Responder {
1151    /// Sends a response to the FIDL transaction.
1152    ///
1153    /// Sets the channel to shutdown if an error occurs.
1154    pub fn send(self, mut max_unacknowledged_reports: u16) -> Result<(), fidl::Error> {
1155        let _result = self.send_raw(max_unacknowledged_reports);
1156        if _result.is_err() {
1157            self.control_handle.shutdown();
1158        }
1159        self.drop_without_shutdown();
1160        _result
1161    }
1162
1163    /// Similar to "send" but does not shutdown the channel if an error occurs.
1164    pub fn send_no_shutdown_on_err(
1165        self,
1166        mut max_unacknowledged_reports: u16,
1167    ) -> Result<(), fidl::Error> {
1168        let _result = self.send_raw(max_unacknowledged_reports);
1169        self.drop_without_shutdown();
1170        _result
1171    }
1172
1173    fn send_raw(&self, mut max_unacknowledged_reports: u16) -> Result<(), fidl::Error> {
1174        self.control_handle.inner.send::<InputDeviceGetInputReportsReaderV2Response>(
1175            (max_unacknowledged_reports,),
1176            self.tx_id,
1177            0x67184c2f21c9051,
1178            fidl::encoding::DynamicFlags::empty(),
1179        )
1180    }
1181}
1182
1183#[must_use = "FIDL methods require a response to be sent"]
1184#[derive(Debug)]
1185pub struct InputDeviceGetDescriptorResponder {
1186    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1187    tx_id: u32,
1188}
1189
1190/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1191/// if the responder is dropped without sending a response, so that the client
1192/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1193impl std::ops::Drop for InputDeviceGetDescriptorResponder {
1194    fn drop(&mut self) {
1195        self.control_handle.shutdown();
1196        // Safety: drops once, never accessed again
1197        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1198    }
1199}
1200
1201impl fidl::endpoints::Responder for InputDeviceGetDescriptorResponder {
1202    type ControlHandle = InputDeviceControlHandle;
1203
1204    fn control_handle(&self) -> &InputDeviceControlHandle {
1205        &self.control_handle
1206    }
1207
1208    fn drop_without_shutdown(mut self) {
1209        // Safety: drops once, never accessed again due to mem::forget
1210        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1211        // Prevent Drop from running (which would shut down the channel)
1212        std::mem::forget(self);
1213    }
1214}
1215
1216impl InputDeviceGetDescriptorResponder {
1217    /// Sends a response to the FIDL transaction.
1218    ///
1219    /// Sets the channel to shutdown if an error occurs.
1220    pub fn send(self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1221        let _result = self.send_raw(descriptor);
1222        if _result.is_err() {
1223            self.control_handle.shutdown();
1224        }
1225        self.drop_without_shutdown();
1226        _result
1227    }
1228
1229    /// Similar to "send" but does not shutdown the channel if an error occurs.
1230    pub fn send_no_shutdown_on_err(
1231        self,
1232        mut descriptor: &DeviceDescriptor,
1233    ) -> Result<(), fidl::Error> {
1234        let _result = self.send_raw(descriptor);
1235        self.drop_without_shutdown();
1236        _result
1237    }
1238
1239    fn send_raw(&self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1240        self.control_handle.inner.send::<InputDeviceGetDescriptorResponse>(
1241            (descriptor,),
1242            self.tx_id,
1243            0x3d76420f2ff8ad32,
1244            fidl::encoding::DynamicFlags::empty(),
1245        )
1246    }
1247}
1248
1249#[must_use = "FIDL methods require a response to be sent"]
1250#[derive(Debug)]
1251pub struct InputDeviceSendOutputReportResponder {
1252    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1253    tx_id: u32,
1254}
1255
1256/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1257/// if the responder is dropped without sending a response, so that the client
1258/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1259impl std::ops::Drop for InputDeviceSendOutputReportResponder {
1260    fn drop(&mut self) {
1261        self.control_handle.shutdown();
1262        // Safety: drops once, never accessed again
1263        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1264    }
1265}
1266
1267impl fidl::endpoints::Responder for InputDeviceSendOutputReportResponder {
1268    type ControlHandle = InputDeviceControlHandle;
1269
1270    fn control_handle(&self) -> &InputDeviceControlHandle {
1271        &self.control_handle
1272    }
1273
1274    fn drop_without_shutdown(mut self) {
1275        // Safety: drops once, never accessed again due to mem::forget
1276        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1277        // Prevent Drop from running (which would shut down the channel)
1278        std::mem::forget(self);
1279    }
1280}
1281
1282impl InputDeviceSendOutputReportResponder {
1283    /// Sends a response to the FIDL transaction.
1284    ///
1285    /// Sets the channel to shutdown if an error occurs.
1286    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1287        let _result = self.send_raw(result);
1288        if _result.is_err() {
1289            self.control_handle.shutdown();
1290        }
1291        self.drop_without_shutdown();
1292        _result
1293    }
1294
1295    /// Similar to "send" but does not shutdown the channel if an error occurs.
1296    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1297        let _result = self.send_raw(result);
1298        self.drop_without_shutdown();
1299        _result
1300    }
1301
1302    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1303        self.control_handle
1304            .inner
1305            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1306                result,
1307                self.tx_id,
1308                0x67a4888774e6f3a,
1309                fidl::encoding::DynamicFlags::empty(),
1310            )
1311    }
1312}
1313
1314#[must_use = "FIDL methods require a response to be sent"]
1315#[derive(Debug)]
1316pub struct InputDeviceGetFeatureReportResponder {
1317    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1318    tx_id: u32,
1319}
1320
1321/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1322/// if the responder is dropped without sending a response, so that the client
1323/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1324impl std::ops::Drop for InputDeviceGetFeatureReportResponder {
1325    fn drop(&mut self) {
1326        self.control_handle.shutdown();
1327        // Safety: drops once, never accessed again
1328        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1329    }
1330}
1331
1332impl fidl::endpoints::Responder for InputDeviceGetFeatureReportResponder {
1333    type ControlHandle = InputDeviceControlHandle;
1334
1335    fn control_handle(&self) -> &InputDeviceControlHandle {
1336        &self.control_handle
1337    }
1338
1339    fn drop_without_shutdown(mut self) {
1340        // Safety: drops once, never accessed again due to mem::forget
1341        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1342        // Prevent Drop from running (which would shut down the channel)
1343        std::mem::forget(self);
1344    }
1345}
1346
1347impl InputDeviceGetFeatureReportResponder {
1348    /// Sends a response to the FIDL transaction.
1349    ///
1350    /// Sets the channel to shutdown if an error occurs.
1351    pub fn send(self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1352        let _result = self.send_raw(result);
1353        if _result.is_err() {
1354            self.control_handle.shutdown();
1355        }
1356        self.drop_without_shutdown();
1357        _result
1358    }
1359
1360    /// Similar to "send" but does not shutdown the channel if an error occurs.
1361    pub fn send_no_shutdown_on_err(
1362        self,
1363        mut result: Result<&FeatureReport, i32>,
1364    ) -> Result<(), fidl::Error> {
1365        let _result = self.send_raw(result);
1366        self.drop_without_shutdown();
1367        _result
1368    }
1369
1370    fn send_raw(&self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1371        self.control_handle.inner.send::<fidl::encoding::ResultType<
1372            InputDeviceGetFeatureReportResponse,
1373            i32,
1374        >>(
1375            result.map(|report| (report,)),
1376            self.tx_id,
1377            0x497a7d98d9391f16,
1378            fidl::encoding::DynamicFlags::empty(),
1379        )
1380    }
1381}
1382
1383#[must_use = "FIDL methods require a response to be sent"]
1384#[derive(Debug)]
1385pub struct InputDeviceSetFeatureReportResponder {
1386    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1387    tx_id: u32,
1388}
1389
1390/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1391/// if the responder is dropped without sending a response, so that the client
1392/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1393impl std::ops::Drop for InputDeviceSetFeatureReportResponder {
1394    fn drop(&mut self) {
1395        self.control_handle.shutdown();
1396        // Safety: drops once, never accessed again
1397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1398    }
1399}
1400
1401impl fidl::endpoints::Responder for InputDeviceSetFeatureReportResponder {
1402    type ControlHandle = InputDeviceControlHandle;
1403
1404    fn control_handle(&self) -> &InputDeviceControlHandle {
1405        &self.control_handle
1406    }
1407
1408    fn drop_without_shutdown(mut self) {
1409        // Safety: drops once, never accessed again due to mem::forget
1410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1411        // Prevent Drop from running (which would shut down the channel)
1412        std::mem::forget(self);
1413    }
1414}
1415
1416impl InputDeviceSetFeatureReportResponder {
1417    /// Sends a response to the FIDL transaction.
1418    ///
1419    /// Sets the channel to shutdown if an error occurs.
1420    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1421        let _result = self.send_raw(result);
1422        if _result.is_err() {
1423            self.control_handle.shutdown();
1424        }
1425        self.drop_without_shutdown();
1426        _result
1427    }
1428
1429    /// Similar to "send" but does not shutdown the channel if an error occurs.
1430    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1431        let _result = self.send_raw(result);
1432        self.drop_without_shutdown();
1433        _result
1434    }
1435
1436    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1437        self.control_handle
1438            .inner
1439            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1440                result,
1441                self.tx_id,
1442                0x7679a2f5a42842ef,
1443                fidl::encoding::DynamicFlags::empty(),
1444            )
1445    }
1446}
1447
1448#[must_use = "FIDL methods require a response to be sent"]
1449#[derive(Debug)]
1450pub struct InputDeviceGetInputReportResponder {
1451    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1452    tx_id: u32,
1453}
1454
1455/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1456/// if the responder is dropped without sending a response, so that the client
1457/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1458impl std::ops::Drop for InputDeviceGetInputReportResponder {
1459    fn drop(&mut self) {
1460        self.control_handle.shutdown();
1461        // Safety: drops once, never accessed again
1462        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1463    }
1464}
1465
1466impl fidl::endpoints::Responder for InputDeviceGetInputReportResponder {
1467    type ControlHandle = InputDeviceControlHandle;
1468
1469    fn control_handle(&self) -> &InputDeviceControlHandle {
1470        &self.control_handle
1471    }
1472
1473    fn drop_without_shutdown(mut self) {
1474        // Safety: drops once, never accessed again due to mem::forget
1475        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1476        // Prevent Drop from running (which would shut down the channel)
1477        std::mem::forget(self);
1478    }
1479}
1480
1481impl InputDeviceGetInputReportResponder {
1482    /// Sends a response to the FIDL transaction.
1483    ///
1484    /// Sets the channel to shutdown if an error occurs.
1485    pub fn send(self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1486        let _result = self.send_raw(result);
1487        if _result.is_err() {
1488            self.control_handle.shutdown();
1489        }
1490        self.drop_without_shutdown();
1491        _result
1492    }
1493
1494    /// Similar to "send" but does not shutdown the channel if an error occurs.
1495    pub fn send_no_shutdown_on_err(
1496        self,
1497        mut result: Result<InputReport, i32>,
1498    ) -> Result<(), fidl::Error> {
1499        let _result = self.send_raw(result);
1500        self.drop_without_shutdown();
1501        _result
1502    }
1503
1504    fn send_raw(&self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1505        self.control_handle
1506            .inner
1507            .send::<fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>>(
1508                result.as_mut().map_err(|e| *e).map(|report| (report,)),
1509                self.tx_id,
1510                0x4752ccab96c10248,
1511                fidl::encoding::DynamicFlags::empty(),
1512            )
1513    }
1514}
1515
1516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1517pub struct InputReportsReaderMarker;
1518
1519impl fidl::endpoints::ProtocolMarker for InputReportsReaderMarker {
1520    type Proxy = InputReportsReaderProxy;
1521    type RequestStream = InputReportsReaderRequestStream;
1522    #[cfg(target_os = "fuchsia")]
1523    type SynchronousProxy = InputReportsReaderSynchronousProxy;
1524
1525    const DEBUG_NAME: &'static str = "(anonymous) InputReportsReader";
1526}
1527pub type InputReportsReaderReadInputReportsResult = Result<Vec<InputReport>, i32>;
1528
1529pub trait InputReportsReaderProxyInterface: Send + Sync {
1530    type ReadInputReportsResponseFut: std::future::Future<Output = Result<InputReportsReaderReadInputReportsResult, fidl::Error>>
1531        + Send;
1532    fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut;
1533}
1534#[derive(Debug)]
1535#[cfg(target_os = "fuchsia")]
1536pub struct InputReportsReaderSynchronousProxy {
1537    client: fidl::client::sync::Client,
1538}
1539
1540#[cfg(target_os = "fuchsia")]
1541impl fidl::endpoints::SynchronousProxy for InputReportsReaderSynchronousProxy {
1542    type Proxy = InputReportsReaderProxy;
1543    type Protocol = InputReportsReaderMarker;
1544
1545    fn from_channel(inner: fidl::Channel) -> Self {
1546        Self::new(inner)
1547    }
1548
1549    fn into_channel(self) -> fidl::Channel {
1550        self.client.into_channel()
1551    }
1552
1553    fn as_channel(&self) -> &fidl::Channel {
1554        self.client.as_channel()
1555    }
1556}
1557
1558#[cfg(target_os = "fuchsia")]
1559impl InputReportsReaderSynchronousProxy {
1560    pub fn new(channel: fidl::Channel) -> Self {
1561        Self { client: fidl::client::sync::Client::new(channel) }
1562    }
1563
1564    pub fn into_channel(self) -> fidl::Channel {
1565        self.client.into_channel()
1566    }
1567
1568    /// Waits until an event arrives and returns it. It is safe for other
1569    /// threads to make concurrent requests while waiting for an event.
1570    pub fn wait_for_event(
1571        &self,
1572        deadline: zx::MonotonicInstant,
1573    ) -> Result<InputReportsReaderEvent, fidl::Error> {
1574        InputReportsReaderEvent::decode(
1575            self.client.wait_for_event::<InputReportsReaderMarker>(deadline)?,
1576        )
1577    }
1578
1579    /// This is a Hanging-Get function to read the reports in the
1580    /// InputReport FIFO. This will not reply until there is at least one
1581    /// report available.
1582    /// If there is already one outstanding Hanging-Get, calling this
1583    /// again will return ZX_ERR_ALREADY_BOUND.
1584    pub fn r#read_input_reports(
1585        &self,
1586        ___deadline: zx::MonotonicInstant,
1587    ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1588        let _response =
1589            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1590                InputReportsReaderReadInputReportsResponse,
1591                i32,
1592            >, InputReportsReaderMarker>(
1593                (),
1594                0x3595efdc88842559,
1595                fidl::encoding::DynamicFlags::empty(),
1596                ___deadline,
1597            )?;
1598        Ok(_response.map(|x| x.reports))
1599    }
1600}
1601
1602#[cfg(target_os = "fuchsia")]
1603impl From<InputReportsReaderSynchronousProxy> for zx::NullableHandle {
1604    fn from(value: InputReportsReaderSynchronousProxy) -> Self {
1605        value.into_channel().into()
1606    }
1607}
1608
1609#[cfg(target_os = "fuchsia")]
1610impl From<fidl::Channel> for InputReportsReaderSynchronousProxy {
1611    fn from(value: fidl::Channel) -> Self {
1612        Self::new(value)
1613    }
1614}
1615
1616#[cfg(target_os = "fuchsia")]
1617impl fidl::endpoints::FromClient for InputReportsReaderSynchronousProxy {
1618    type Protocol = InputReportsReaderMarker;
1619
1620    fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderMarker>) -> Self {
1621        Self::new(value.into_channel())
1622    }
1623}
1624
1625#[derive(Debug, Clone)]
1626pub struct InputReportsReaderProxy {
1627    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1628}
1629
1630impl fidl::endpoints::Proxy for InputReportsReaderProxy {
1631    type Protocol = InputReportsReaderMarker;
1632
1633    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1634        Self::new(inner)
1635    }
1636
1637    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1638        self.client.into_channel().map_err(|client| Self { client })
1639    }
1640
1641    fn as_channel(&self) -> &::fidl::AsyncChannel {
1642        self.client.as_channel()
1643    }
1644}
1645
1646impl InputReportsReaderProxy {
1647    /// Create a new Proxy for fuchsia.input.report/InputReportsReader.
1648    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1649        let protocol_name =
1650            <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1651        Self { client: fidl::client::Client::new(channel, protocol_name) }
1652    }
1653
1654    /// Get a Stream of events from the remote end of the protocol.
1655    ///
1656    /// # Panics
1657    ///
1658    /// Panics if the event stream was already taken.
1659    pub fn take_event_stream(&self) -> InputReportsReaderEventStream {
1660        InputReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
1661    }
1662
1663    /// This is a Hanging-Get function to read the reports in the
1664    /// InputReport FIFO. This will not reply until there is at least one
1665    /// report available.
1666    /// If there is already one outstanding Hanging-Get, calling this
1667    /// again will return ZX_ERR_ALREADY_BOUND.
1668    pub fn r#read_input_reports(
1669        &self,
1670    ) -> fidl::client::QueryResponseFut<
1671        InputReportsReaderReadInputReportsResult,
1672        fidl::encoding::DefaultFuchsiaResourceDialect,
1673    > {
1674        InputReportsReaderProxyInterface::r#read_input_reports(self)
1675    }
1676}
1677
1678impl InputReportsReaderProxyInterface for InputReportsReaderProxy {
1679    type ReadInputReportsResponseFut = fidl::client::QueryResponseFut<
1680        InputReportsReaderReadInputReportsResult,
1681        fidl::encoding::DefaultFuchsiaResourceDialect,
1682    >;
1683    fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut {
1684        fn _decode(
1685            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1686        ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1687            let _response = fidl::client::decode_transaction_body::<
1688                fidl::encoding::ResultType<InputReportsReaderReadInputReportsResponse, i32>,
1689                fidl::encoding::DefaultFuchsiaResourceDialect,
1690                0x3595efdc88842559,
1691            >(_buf?)?;
1692            Ok(_response.map(|x| x.reports))
1693        }
1694        self.client.send_query_and_decode::<
1695            fidl::encoding::EmptyPayload,
1696            InputReportsReaderReadInputReportsResult,
1697        >(
1698            (),
1699            0x3595efdc88842559,
1700            fidl::encoding::DynamicFlags::empty(),
1701            _decode,
1702        )
1703    }
1704}
1705
1706pub struct InputReportsReaderEventStream {
1707    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1708}
1709
1710impl std::marker::Unpin for InputReportsReaderEventStream {}
1711
1712impl futures::stream::FusedStream for InputReportsReaderEventStream {
1713    fn is_terminated(&self) -> bool {
1714        self.event_receiver.is_terminated()
1715    }
1716}
1717
1718impl futures::Stream for InputReportsReaderEventStream {
1719    type Item = Result<InputReportsReaderEvent, fidl::Error>;
1720
1721    fn poll_next(
1722        mut self: std::pin::Pin<&mut Self>,
1723        cx: &mut std::task::Context<'_>,
1724    ) -> std::task::Poll<Option<Self::Item>> {
1725        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1726            &mut self.event_receiver,
1727            cx
1728        )?) {
1729            Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderEvent::decode(buf))),
1730            None => std::task::Poll::Ready(None),
1731        }
1732    }
1733}
1734
1735#[derive(Debug)]
1736pub enum InputReportsReaderEvent {}
1737
1738impl InputReportsReaderEvent {
1739    /// Decodes a message buffer as a [`InputReportsReaderEvent`].
1740    fn decode(
1741        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1742    ) -> Result<InputReportsReaderEvent, fidl::Error> {
1743        let (bytes, _handles) = buf.split_mut();
1744        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1745        debug_assert_eq!(tx_header.tx_id, 0);
1746        match tx_header.ordinal {
1747            _ => Err(fidl::Error::UnknownOrdinal {
1748                ordinal: tx_header.ordinal,
1749                protocol_name:
1750                    <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1751            }),
1752        }
1753    }
1754}
1755
1756/// A Stream of incoming requests for fuchsia.input.report/InputReportsReader.
1757pub struct InputReportsReaderRequestStream {
1758    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1759    is_terminated: bool,
1760}
1761
1762impl std::marker::Unpin for InputReportsReaderRequestStream {}
1763
1764impl futures::stream::FusedStream for InputReportsReaderRequestStream {
1765    fn is_terminated(&self) -> bool {
1766        self.is_terminated
1767    }
1768}
1769
1770impl fidl::endpoints::RequestStream for InputReportsReaderRequestStream {
1771    type Protocol = InputReportsReaderMarker;
1772    type ControlHandle = InputReportsReaderControlHandle;
1773
1774    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1775        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1776    }
1777
1778    fn control_handle(&self) -> Self::ControlHandle {
1779        InputReportsReaderControlHandle { inner: self.inner.clone() }
1780    }
1781
1782    fn into_inner(
1783        self,
1784    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1785    {
1786        (self.inner, self.is_terminated)
1787    }
1788
1789    fn from_inner(
1790        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1791        is_terminated: bool,
1792    ) -> Self {
1793        Self { inner, is_terminated }
1794    }
1795}
1796
1797impl futures::Stream for InputReportsReaderRequestStream {
1798    type Item = Result<InputReportsReaderRequest, fidl::Error>;
1799
1800    fn poll_next(
1801        mut self: std::pin::Pin<&mut Self>,
1802        cx: &mut std::task::Context<'_>,
1803    ) -> std::task::Poll<Option<Self::Item>> {
1804        let this = &mut *self;
1805        if this.inner.check_shutdown(cx) {
1806            this.is_terminated = true;
1807            return std::task::Poll::Ready(None);
1808        }
1809        if this.is_terminated {
1810            panic!("polled InputReportsReaderRequestStream after completion");
1811        }
1812        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1813            |bytes, handles| {
1814                match this.inner.channel().read_etc(cx, bytes, handles) {
1815                    std::task::Poll::Ready(Ok(())) => {}
1816                    std::task::Poll::Pending => return std::task::Poll::Pending,
1817                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1818                        this.is_terminated = true;
1819                        return std::task::Poll::Ready(None);
1820                    }
1821                    std::task::Poll::Ready(Err(e)) => {
1822                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1823                            e.into(),
1824                        ))));
1825                    }
1826                }
1827
1828                // A message has been received from the channel
1829                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1830
1831                std::task::Poll::Ready(Some(match header.ordinal {
1832                0x3595efdc88842559 => {
1833                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1834                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1835                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1836                    let control_handle = InputReportsReaderControlHandle {
1837                        inner: this.inner.clone(),
1838                    };
1839                    Ok(InputReportsReaderRequest::ReadInputReports {
1840                        responder: InputReportsReaderReadInputReportsResponder {
1841                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1842                            tx_id: header.tx_id,
1843                        },
1844                    })
1845                }
1846                _ => Err(fidl::Error::UnknownOrdinal {
1847                    ordinal: header.ordinal,
1848                    protocol_name: <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1849                }),
1850            }))
1851            },
1852        )
1853    }
1854}
1855
1856/// Each `InputReportsReader` has its own FIFO of InputReports that it maintains.
1857/// When ReadInputReports is called it drains the InputReports FIFO.
1858/// If too many InputReports are created before the FIFO is drained, then
1859/// the oldest InputReport will be silently discarded.
1860#[derive(Debug)]
1861pub enum InputReportsReaderRequest {
1862    /// This is a Hanging-Get function to read the reports in the
1863    /// InputReport FIFO. This will not reply until there is at least one
1864    /// report available.
1865    /// If there is already one outstanding Hanging-Get, calling this
1866    /// again will return ZX_ERR_ALREADY_BOUND.
1867    ReadInputReports { responder: InputReportsReaderReadInputReportsResponder },
1868}
1869
1870impl InputReportsReaderRequest {
1871    #[allow(irrefutable_let_patterns)]
1872    pub fn into_read_input_reports(self) -> Option<(InputReportsReaderReadInputReportsResponder)> {
1873        if let InputReportsReaderRequest::ReadInputReports { responder } = self {
1874            Some((responder))
1875        } else {
1876            None
1877        }
1878    }
1879
1880    /// Name of the method defined in FIDL
1881    pub fn method_name(&self) -> &'static str {
1882        match *self {
1883            InputReportsReaderRequest::ReadInputReports { .. } => "read_input_reports",
1884        }
1885    }
1886}
1887
1888#[derive(Debug, Clone)]
1889pub struct InputReportsReaderControlHandle {
1890    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1891}
1892
1893impl fidl::endpoints::ControlHandle for InputReportsReaderControlHandle {
1894    fn shutdown(&self) {
1895        self.inner.shutdown()
1896    }
1897
1898    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1899        self.inner.shutdown_with_epitaph(status)
1900    }
1901
1902    fn is_closed(&self) -> bool {
1903        self.inner.channel().is_closed()
1904    }
1905    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1906        self.inner.channel().on_closed()
1907    }
1908
1909    #[cfg(target_os = "fuchsia")]
1910    fn signal_peer(
1911        &self,
1912        clear_mask: zx::Signals,
1913        set_mask: zx::Signals,
1914    ) -> Result<(), zx_status::Status> {
1915        use fidl::Peered;
1916        self.inner.channel().signal_peer(clear_mask, set_mask)
1917    }
1918}
1919
1920impl InputReportsReaderControlHandle {}
1921
1922#[must_use = "FIDL methods require a response to be sent"]
1923#[derive(Debug)]
1924pub struct InputReportsReaderReadInputReportsResponder {
1925    control_handle: std::mem::ManuallyDrop<InputReportsReaderControlHandle>,
1926    tx_id: u32,
1927}
1928
1929/// Set the the channel to be shutdown (see [`InputReportsReaderControlHandle::shutdown`])
1930/// if the responder is dropped without sending a response, so that the client
1931/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1932impl std::ops::Drop for InputReportsReaderReadInputReportsResponder {
1933    fn drop(&mut self) {
1934        self.control_handle.shutdown();
1935        // Safety: drops once, never accessed again
1936        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1937    }
1938}
1939
1940impl fidl::endpoints::Responder for InputReportsReaderReadInputReportsResponder {
1941    type ControlHandle = InputReportsReaderControlHandle;
1942
1943    fn control_handle(&self) -> &InputReportsReaderControlHandle {
1944        &self.control_handle
1945    }
1946
1947    fn drop_without_shutdown(mut self) {
1948        // Safety: drops once, never accessed again due to mem::forget
1949        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1950        // Prevent Drop from running (which would shut down the channel)
1951        std::mem::forget(self);
1952    }
1953}
1954
1955impl InputReportsReaderReadInputReportsResponder {
1956    /// Sends a response to the FIDL transaction.
1957    ///
1958    /// Sets the channel to shutdown if an error occurs.
1959    pub fn send(self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1960        let _result = self.send_raw(result);
1961        if _result.is_err() {
1962            self.control_handle.shutdown();
1963        }
1964        self.drop_without_shutdown();
1965        _result
1966    }
1967
1968    /// Similar to "send" but does not shutdown the channel if an error occurs.
1969    pub fn send_no_shutdown_on_err(
1970        self,
1971        mut result: Result<Vec<InputReport>, i32>,
1972    ) -> Result<(), fidl::Error> {
1973        let _result = self.send_raw(result);
1974        self.drop_without_shutdown();
1975        _result
1976    }
1977
1978    fn send_raw(&self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1979        self.control_handle.inner.send::<fidl::encoding::ResultType<
1980            InputReportsReaderReadInputReportsResponse,
1981            i32,
1982        >>(
1983            result.as_mut().map_err(|e| *e).map(|reports| (reports.as_mut_slice(),)),
1984            self.tx_id,
1985            0x3595efdc88842559,
1986            fidl::encoding::DynamicFlags::empty(),
1987        )
1988    }
1989}
1990
1991#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1992pub struct InputReportsReaderV2Marker;
1993
1994impl fidl::endpoints::ProtocolMarker for InputReportsReaderV2Marker {
1995    type Proxy = InputReportsReaderV2Proxy;
1996    type RequestStream = InputReportsReaderV2RequestStream;
1997    #[cfg(target_os = "fuchsia")]
1998    type SynchronousProxy = InputReportsReaderV2SynchronousProxy;
1999
2000    const DEBUG_NAME: &'static str = "(anonymous) InputReportsReaderV2";
2001}
2002
2003pub trait InputReportsReaderV2ProxyInterface: Send + Sync {
2004    fn r#acknowledge_reports(&self, last_acknowledged_report_stamp: u64)
2005    -> Result<(), fidl::Error>;
2006}
2007#[derive(Debug)]
2008#[cfg(target_os = "fuchsia")]
2009pub struct InputReportsReaderV2SynchronousProxy {
2010    client: fidl::client::sync::Client,
2011}
2012
2013#[cfg(target_os = "fuchsia")]
2014impl fidl::endpoints::SynchronousProxy for InputReportsReaderV2SynchronousProxy {
2015    type Proxy = InputReportsReaderV2Proxy;
2016    type Protocol = InputReportsReaderV2Marker;
2017
2018    fn from_channel(inner: fidl::Channel) -> Self {
2019        Self::new(inner)
2020    }
2021
2022    fn into_channel(self) -> fidl::Channel {
2023        self.client.into_channel()
2024    }
2025
2026    fn as_channel(&self) -> &fidl::Channel {
2027        self.client.as_channel()
2028    }
2029}
2030
2031#[cfg(target_os = "fuchsia")]
2032impl InputReportsReaderV2SynchronousProxy {
2033    pub fn new(channel: fidl::Channel) -> Self {
2034        Self { client: fidl::client::sync::Client::new(channel) }
2035    }
2036
2037    pub fn into_channel(self) -> fidl::Channel {
2038        self.client.into_channel()
2039    }
2040
2041    /// Waits until an event arrives and returns it. It is safe for other
2042    /// threads to make concurrent requests while waiting for an event.
2043    pub fn wait_for_event(
2044        &self,
2045        deadline: zx::MonotonicInstant,
2046    ) -> Result<InputReportsReaderV2Event, fidl::Error> {
2047        InputReportsReaderV2Event::decode(
2048            self.client.wait_for_event::<InputReportsReaderV2Marker>(deadline)?,
2049        )
2050    }
2051
2052    /// The client has processed events up to `last_acknowledged_report_stamp`.
2053    /// All reports sent with a `last_report_stamp` less than or equal to
2054    /// `last_acknowledged_report_stamp` will be considered acknowledged, and therefore
2055    /// will not count towards the `max_unacknowledged_reports` limit.
2056    pub fn r#acknowledge_reports(
2057        &self,
2058        mut last_acknowledged_report_stamp: u64,
2059    ) -> Result<(), fidl::Error> {
2060        self.client.send::<InputReportsReaderV2AcknowledgeReportsRequest>(
2061            (last_acknowledged_report_stamp,),
2062            0x727aef411a2fe309,
2063            fidl::encoding::DynamicFlags::FLEXIBLE,
2064        )
2065    }
2066}
2067
2068#[cfg(target_os = "fuchsia")]
2069impl From<InputReportsReaderV2SynchronousProxy> for zx::NullableHandle {
2070    fn from(value: InputReportsReaderV2SynchronousProxy) -> Self {
2071        value.into_channel().into()
2072    }
2073}
2074
2075#[cfg(target_os = "fuchsia")]
2076impl From<fidl::Channel> for InputReportsReaderV2SynchronousProxy {
2077    fn from(value: fidl::Channel) -> Self {
2078        Self::new(value)
2079    }
2080}
2081
2082#[cfg(target_os = "fuchsia")]
2083impl fidl::endpoints::FromClient for InputReportsReaderV2SynchronousProxy {
2084    type Protocol = InputReportsReaderV2Marker;
2085
2086    fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderV2Marker>) -> Self {
2087        Self::new(value.into_channel())
2088    }
2089}
2090
2091#[derive(Debug, Clone)]
2092pub struct InputReportsReaderV2Proxy {
2093    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2094}
2095
2096impl fidl::endpoints::Proxy for InputReportsReaderV2Proxy {
2097    type Protocol = InputReportsReaderV2Marker;
2098
2099    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2100        Self::new(inner)
2101    }
2102
2103    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2104        self.client.into_channel().map_err(|client| Self { client })
2105    }
2106
2107    fn as_channel(&self) -> &::fidl::AsyncChannel {
2108        self.client.as_channel()
2109    }
2110}
2111
2112impl InputReportsReaderV2Proxy {
2113    /// Create a new Proxy for fuchsia.input.report/InputReportsReaderV2.
2114    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2115        let protocol_name =
2116            <InputReportsReaderV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2117        Self { client: fidl::client::Client::new(channel, protocol_name) }
2118    }
2119
2120    /// Get a Stream of events from the remote end of the protocol.
2121    ///
2122    /// # Panics
2123    ///
2124    /// Panics if the event stream was already taken.
2125    pub fn take_event_stream(&self) -> InputReportsReaderV2EventStream {
2126        InputReportsReaderV2EventStream { event_receiver: self.client.take_event_receiver() }
2127    }
2128
2129    /// The client has processed events up to `last_acknowledged_report_stamp`.
2130    /// All reports sent with a `last_report_stamp` less than or equal to
2131    /// `last_acknowledged_report_stamp` will be considered acknowledged, and therefore
2132    /// will not count towards the `max_unacknowledged_reports` limit.
2133    pub fn r#acknowledge_reports(
2134        &self,
2135        mut last_acknowledged_report_stamp: u64,
2136    ) -> Result<(), fidl::Error> {
2137        InputReportsReaderV2ProxyInterface::r#acknowledge_reports(
2138            self,
2139            last_acknowledged_report_stamp,
2140        )
2141    }
2142}
2143
2144impl InputReportsReaderV2ProxyInterface for InputReportsReaderV2Proxy {
2145    fn r#acknowledge_reports(
2146        &self,
2147        mut last_acknowledged_report_stamp: u64,
2148    ) -> Result<(), fidl::Error> {
2149        self.client.send::<InputReportsReaderV2AcknowledgeReportsRequest>(
2150            (last_acknowledged_report_stamp,),
2151            0x727aef411a2fe309,
2152            fidl::encoding::DynamicFlags::FLEXIBLE,
2153        )
2154    }
2155}
2156
2157pub struct InputReportsReaderV2EventStream {
2158    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2159}
2160
2161impl std::marker::Unpin for InputReportsReaderV2EventStream {}
2162
2163impl futures::stream::FusedStream for InputReportsReaderV2EventStream {
2164    fn is_terminated(&self) -> bool {
2165        self.event_receiver.is_terminated()
2166    }
2167}
2168
2169impl futures::Stream for InputReportsReaderV2EventStream {
2170    type Item = Result<InputReportsReaderV2Event, fidl::Error>;
2171
2172    fn poll_next(
2173        mut self: std::pin::Pin<&mut Self>,
2174        cx: &mut std::task::Context<'_>,
2175    ) -> std::task::Poll<Option<Self::Item>> {
2176        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2177            &mut self.event_receiver,
2178            cx
2179        )?) {
2180            Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderV2Event::decode(buf))),
2181            None => std::task::Poll::Ready(None),
2182        }
2183    }
2184}
2185
2186#[derive(Debug)]
2187pub enum InputReportsReaderV2Event {
2188    OnInputReports {
2189        reports: Vec<InputReport>,
2190        last_report_stamp: u64,
2191    },
2192    #[non_exhaustive]
2193    _UnknownEvent {
2194        /// Ordinal of the event that was sent.
2195        ordinal: u64,
2196    },
2197}
2198
2199impl InputReportsReaderV2Event {
2200    #[allow(irrefutable_let_patterns)]
2201    pub fn into_on_input_reports(self) -> Option<(Vec<InputReport>, u64)> {
2202        if let InputReportsReaderV2Event::OnInputReports { reports, last_report_stamp } = self {
2203            Some((reports, last_report_stamp))
2204        } else {
2205            None
2206        }
2207    }
2208
2209    /// Decodes a message buffer as a [`InputReportsReaderV2Event`].
2210    fn decode(
2211        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2212    ) -> Result<InputReportsReaderV2Event, fidl::Error> {
2213        let (bytes, _handles) = buf.split_mut();
2214        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2215        debug_assert_eq!(tx_header.tx_id, 0);
2216        match tx_header.ordinal {
2217            0x582edad00fe8e3b9 => {
2218                let mut out = fidl::new_empty!(
2219                    InputReportsReaderV2OnInputReportsRequest,
2220                    fidl::encoding::DefaultFuchsiaResourceDialect
2221                );
2222                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputReportsReaderV2OnInputReportsRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2223                Ok((InputReportsReaderV2Event::OnInputReports {
2224                    reports: out.reports,
2225                    last_report_stamp: out.last_report_stamp,
2226                }))
2227            }
2228            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2229                Ok(InputReportsReaderV2Event::_UnknownEvent { ordinal: tx_header.ordinal })
2230            }
2231            _ => Err(fidl::Error::UnknownOrdinal {
2232                ordinal: tx_header.ordinal,
2233                protocol_name:
2234                    <InputReportsReaderV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2235            }),
2236        }
2237    }
2238}
2239
2240/// A Stream of incoming requests for fuchsia.input.report/InputReportsReaderV2.
2241pub struct InputReportsReaderV2RequestStream {
2242    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2243    is_terminated: bool,
2244}
2245
2246impl std::marker::Unpin for InputReportsReaderV2RequestStream {}
2247
2248impl futures::stream::FusedStream for InputReportsReaderV2RequestStream {
2249    fn is_terminated(&self) -> bool {
2250        self.is_terminated
2251    }
2252}
2253
2254impl fidl::endpoints::RequestStream for InputReportsReaderV2RequestStream {
2255    type Protocol = InputReportsReaderV2Marker;
2256    type ControlHandle = InputReportsReaderV2ControlHandle;
2257
2258    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2259        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2260    }
2261
2262    fn control_handle(&self) -> Self::ControlHandle {
2263        InputReportsReaderV2ControlHandle { inner: self.inner.clone() }
2264    }
2265
2266    fn into_inner(
2267        self,
2268    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2269    {
2270        (self.inner, self.is_terminated)
2271    }
2272
2273    fn from_inner(
2274        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2275        is_terminated: bool,
2276    ) -> Self {
2277        Self { inner, is_terminated }
2278    }
2279}
2280
2281impl futures::Stream for InputReportsReaderV2RequestStream {
2282    type Item = Result<InputReportsReaderV2Request, fidl::Error>;
2283
2284    fn poll_next(
2285        mut self: std::pin::Pin<&mut Self>,
2286        cx: &mut std::task::Context<'_>,
2287    ) -> std::task::Poll<Option<Self::Item>> {
2288        let this = &mut *self;
2289        if this.inner.check_shutdown(cx) {
2290            this.is_terminated = true;
2291            return std::task::Poll::Ready(None);
2292        }
2293        if this.is_terminated {
2294            panic!("polled InputReportsReaderV2RequestStream after completion");
2295        }
2296        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2297            |bytes, handles| {
2298                match this.inner.channel().read_etc(cx, bytes, handles) {
2299                    std::task::Poll::Ready(Ok(())) => {}
2300                    std::task::Poll::Pending => return std::task::Poll::Pending,
2301                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2302                        this.is_terminated = true;
2303                        return std::task::Poll::Ready(None);
2304                    }
2305                    std::task::Poll::Ready(Err(e)) => {
2306                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2307                            e.into(),
2308                        ))));
2309                    }
2310                }
2311
2312                // A message has been received from the channel
2313                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2314
2315                std::task::Poll::Ready(Some(match header.ordinal {
2316                0x727aef411a2fe309 => {
2317                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2318                    let mut req = fidl::new_empty!(InputReportsReaderV2AcknowledgeReportsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2319                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputReportsReaderV2AcknowledgeReportsRequest>(&header, _body_bytes, handles, &mut req)?;
2320                    let control_handle = InputReportsReaderV2ControlHandle {
2321                        inner: this.inner.clone(),
2322                    };
2323                    Ok(InputReportsReaderV2Request::AcknowledgeReports {last_acknowledged_report_stamp: req.last_acknowledged_report_stamp,
2324
2325                        control_handle,
2326                    })
2327                }
2328                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2329                    Ok(InputReportsReaderV2Request::_UnknownMethod {
2330                        ordinal: header.ordinal,
2331                        control_handle: InputReportsReaderV2ControlHandle { inner: this.inner.clone() },
2332                        method_type: fidl::MethodType::OneWay,
2333                    })
2334                }
2335                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2336                    this.inner.send_framework_err(
2337                        fidl::encoding::FrameworkErr::UnknownMethod,
2338                        header.tx_id,
2339                        header.ordinal,
2340                        header.dynamic_flags(),
2341                        (bytes, handles),
2342                    )?;
2343                    Ok(InputReportsReaderV2Request::_UnknownMethod {
2344                        ordinal: header.ordinal,
2345                        control_handle: InputReportsReaderV2ControlHandle { inner: this.inner.clone() },
2346                        method_type: fidl::MethodType::TwoWay,
2347                    })
2348                }
2349                _ => Err(fidl::Error::UnknownOrdinal {
2350                    ordinal: header.ordinal,
2351                    protocol_name: <InputReportsReaderV2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2352                }),
2353            }))
2354            },
2355        )
2356    }
2357}
2358
2359/// A reader protocol that reports input events.
2360#[derive(Debug)]
2361pub enum InputReportsReaderV2Request {
2362    /// The client has processed events up to `last_acknowledged_report_stamp`.
2363    /// All reports sent with a `last_report_stamp` less than or equal to
2364    /// `last_acknowledged_report_stamp` will be considered acknowledged, and therefore
2365    /// will not count towards the `max_unacknowledged_reports` limit.
2366    AcknowledgeReports {
2367        last_acknowledged_report_stamp: u64,
2368        control_handle: InputReportsReaderV2ControlHandle,
2369    },
2370    /// An interaction was received which does not match any known method.
2371    #[non_exhaustive]
2372    _UnknownMethod {
2373        /// Ordinal of the method that was called.
2374        ordinal: u64,
2375        control_handle: InputReportsReaderV2ControlHandle,
2376        method_type: fidl::MethodType,
2377    },
2378}
2379
2380impl InputReportsReaderV2Request {
2381    #[allow(irrefutable_let_patterns)]
2382    pub fn into_acknowledge_reports(self) -> Option<(u64, InputReportsReaderV2ControlHandle)> {
2383        if let InputReportsReaderV2Request::AcknowledgeReports {
2384            last_acknowledged_report_stamp,
2385            control_handle,
2386        } = self
2387        {
2388            Some((last_acknowledged_report_stamp, control_handle))
2389        } else {
2390            None
2391        }
2392    }
2393
2394    /// Name of the method defined in FIDL
2395    pub fn method_name(&self) -> &'static str {
2396        match *self {
2397            InputReportsReaderV2Request::AcknowledgeReports { .. } => "acknowledge_reports",
2398            InputReportsReaderV2Request::_UnknownMethod {
2399                method_type: fidl::MethodType::OneWay,
2400                ..
2401            } => "unknown one-way method",
2402            InputReportsReaderV2Request::_UnknownMethod {
2403                method_type: fidl::MethodType::TwoWay,
2404                ..
2405            } => "unknown two-way method",
2406        }
2407    }
2408}
2409
2410#[derive(Debug, Clone)]
2411pub struct InputReportsReaderV2ControlHandle {
2412    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2413}
2414
2415impl fidl::endpoints::ControlHandle for InputReportsReaderV2ControlHandle {
2416    fn shutdown(&self) {
2417        self.inner.shutdown()
2418    }
2419
2420    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2421        self.inner.shutdown_with_epitaph(status)
2422    }
2423
2424    fn is_closed(&self) -> bool {
2425        self.inner.channel().is_closed()
2426    }
2427    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2428        self.inner.channel().on_closed()
2429    }
2430
2431    #[cfg(target_os = "fuchsia")]
2432    fn signal_peer(
2433        &self,
2434        clear_mask: zx::Signals,
2435        set_mask: zx::Signals,
2436    ) -> Result<(), zx_status::Status> {
2437        use fidl::Peered;
2438        self.inner.channel().signal_peer(clear_mask, set_mask)
2439    }
2440}
2441
2442impl InputReportsReaderV2ControlHandle {
2443    pub fn send_on_input_reports(
2444        &self,
2445        mut reports: Vec<InputReport>,
2446        mut last_report_stamp: u64,
2447    ) -> Result<(), fidl::Error> {
2448        self.inner.send::<InputReportsReaderV2OnInputReportsRequest>(
2449            (reports.as_mut(), last_report_stamp),
2450            0,
2451            0x582edad00fe8e3b9,
2452            fidl::encoding::DynamicFlags::FLEXIBLE,
2453        )
2454    }
2455}
2456
2457#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2458pub struct ServiceMarker;
2459
2460#[cfg(target_os = "fuchsia")]
2461impl fidl::endpoints::ServiceMarker for ServiceMarker {
2462    type Proxy = ServiceProxy;
2463    type Request = ServiceRequest;
2464    const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
2465}
2466
2467/// A request for one of the member protocols of Service.
2468///
2469#[cfg(target_os = "fuchsia")]
2470pub enum ServiceRequest {
2471    InputDevice(InputDeviceRequestStream),
2472}
2473
2474#[cfg(target_os = "fuchsia")]
2475impl fidl::endpoints::ServiceRequest for ServiceRequest {
2476    type Service = ServiceMarker;
2477
2478    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2479        match name {
2480            "input_device" => Self::InputDevice(
2481                <InputDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
2482                    _channel,
2483                ),
2484            ),
2485            _ => panic!("no such member protocol name for service Service"),
2486        }
2487    }
2488
2489    fn member_names() -> &'static [&'static str] {
2490        &["input_device"]
2491    }
2492}
2493#[cfg(target_os = "fuchsia")]
2494pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2495
2496#[cfg(target_os = "fuchsia")]
2497impl fidl::endpoints::ServiceProxy for ServiceProxy {
2498    type Service = ServiceMarker;
2499
2500    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2501        Self(opener)
2502    }
2503}
2504
2505#[cfg(target_os = "fuchsia")]
2506impl ServiceProxy {
2507    pub fn connect_to_input_device(&self) -> Result<InputDeviceProxy, fidl::Error> {
2508        let (proxy, server_end) = fidl::endpoints::create_proxy::<InputDeviceMarker>();
2509        self.connect_channel_to_input_device(server_end)?;
2510        Ok(proxy)
2511    }
2512
2513    /// Like `connect_to_input_device`, but returns a sync proxy.
2514    /// See [`Self::connect_to_input_device`] for more details.
2515    pub fn connect_to_input_device_sync(&self) -> Result<InputDeviceSynchronousProxy, fidl::Error> {
2516        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<InputDeviceMarker>();
2517        self.connect_channel_to_input_device(server_end)?;
2518        Ok(proxy)
2519    }
2520
2521    /// Like `connect_to_input_device`, but accepts a server end.
2522    /// See [`Self::connect_to_input_device`] for more details.
2523    pub fn connect_channel_to_input_device(
2524        &self,
2525        server_end: fidl::endpoints::ServerEnd<InputDeviceMarker>,
2526    ) -> Result<(), fidl::Error> {
2527        self.0.open_member("input_device", server_end.into_channel())
2528    }
2529
2530    pub fn instance_name(&self) -> &str {
2531        self.0.instance_name()
2532    }
2533}
2534
2535mod internal {
2536    use super::*;
2537
2538    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderRequest {
2539        type Borrowed<'a> = &'a mut Self;
2540        fn take_or_borrow<'a>(
2541            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2542        ) -> Self::Borrowed<'a> {
2543            value
2544        }
2545    }
2546
2547    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderRequest {
2548        type Owned = Self;
2549
2550        #[inline(always)]
2551        fn inline_align(_context: fidl::encoding::Context) -> usize {
2552            4
2553        }
2554
2555        #[inline(always)]
2556        fn inline_size(_context: fidl::encoding::Context) -> usize {
2557            4
2558        }
2559    }
2560
2561    unsafe impl
2562        fidl::encoding::Encode<
2563            InputDeviceGetInputReportsReaderRequest,
2564            fidl::encoding::DefaultFuchsiaResourceDialect,
2565        > for &mut InputDeviceGetInputReportsReaderRequest
2566    {
2567        #[inline]
2568        unsafe fn encode(
2569            self,
2570            encoder: &mut fidl::encoding::Encoder<
2571                '_,
2572                fidl::encoding::DefaultFuchsiaResourceDialect,
2573            >,
2574            offset: usize,
2575            _depth: fidl::encoding::Depth,
2576        ) -> fidl::Result<()> {
2577            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
2578            // Delegate to tuple encoding.
2579            fidl::encoding::Encode::<InputDeviceGetInputReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2580                (
2581                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
2582                ),
2583                encoder, offset, _depth
2584            )
2585        }
2586    }
2587    unsafe impl<
2588        T0: fidl::encoding::Encode<
2589                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
2590                fidl::encoding::DefaultFuchsiaResourceDialect,
2591            >,
2592    >
2593        fidl::encoding::Encode<
2594            InputDeviceGetInputReportsReaderRequest,
2595            fidl::encoding::DefaultFuchsiaResourceDialect,
2596        > for (T0,)
2597    {
2598        #[inline]
2599        unsafe fn encode(
2600            self,
2601            encoder: &mut fidl::encoding::Encoder<
2602                '_,
2603                fidl::encoding::DefaultFuchsiaResourceDialect,
2604            >,
2605            offset: usize,
2606            depth: fidl::encoding::Depth,
2607        ) -> fidl::Result<()> {
2608            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
2609            // Zero out padding regions. There's no need to apply masks
2610            // because the unmasked parts will be overwritten by fields.
2611            // Write the fields.
2612            self.0.encode(encoder, offset + 0, depth)?;
2613            Ok(())
2614        }
2615    }
2616
2617    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2618        for InputDeviceGetInputReportsReaderRequest
2619    {
2620        #[inline(always)]
2621        fn new_empty() -> Self {
2622            Self {
2623                reader: fidl::new_empty!(
2624                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
2625                    fidl::encoding::DefaultFuchsiaResourceDialect
2626                ),
2627            }
2628        }
2629
2630        #[inline]
2631        unsafe fn decode(
2632            &mut self,
2633            decoder: &mut fidl::encoding::Decoder<
2634                '_,
2635                fidl::encoding::DefaultFuchsiaResourceDialect,
2636            >,
2637            offset: usize,
2638            _depth: fidl::encoding::Depth,
2639        ) -> fidl::Result<()> {
2640            decoder.debug_check_bounds::<Self>(offset);
2641            // Verify that padding bytes are zero.
2642            fidl::decode!(
2643                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
2644                fidl::encoding::DefaultFuchsiaResourceDialect,
2645                &mut self.reader,
2646                decoder,
2647                offset + 0,
2648                _depth
2649            )?;
2650            Ok(())
2651        }
2652    }
2653
2654    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderV2Request {
2655        type Borrowed<'a> = &'a mut Self;
2656        fn take_or_borrow<'a>(
2657            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2658        ) -> Self::Borrowed<'a> {
2659            value
2660        }
2661    }
2662
2663    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderV2Request {
2664        type Owned = Self;
2665
2666        #[inline(always)]
2667        fn inline_align(_context: fidl::encoding::Context) -> usize {
2668            4
2669        }
2670
2671        #[inline(always)]
2672        fn inline_size(_context: fidl::encoding::Context) -> usize {
2673            8
2674        }
2675    }
2676
2677    unsafe impl
2678        fidl::encoding::Encode<
2679            InputDeviceGetInputReportsReaderV2Request,
2680            fidl::encoding::DefaultFuchsiaResourceDialect,
2681        > for &mut InputDeviceGetInputReportsReaderV2Request
2682    {
2683        #[inline]
2684        unsafe fn encode(
2685            self,
2686            encoder: &mut fidl::encoding::Encoder<
2687                '_,
2688                fidl::encoding::DefaultFuchsiaResourceDialect,
2689            >,
2690            offset: usize,
2691            _depth: fidl::encoding::Depth,
2692        ) -> fidl::Result<()> {
2693            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderV2Request>(offset);
2694            // Delegate to tuple encoding.
2695            fidl::encoding::Encode::<
2696                InputDeviceGetInputReportsReaderV2Request,
2697                fidl::encoding::DefaultFuchsiaResourceDialect,
2698            >::encode(
2699                (
2700                    <fidl::encoding::Endpoint<
2701                        fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
2702                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2703                        &mut self.reader
2704                    ),
2705                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(
2706                        &self.max_unacknowledged_reports_limit,
2707                    ),
2708                ),
2709                encoder,
2710                offset,
2711                _depth,
2712            )
2713        }
2714    }
2715    unsafe impl<
2716        T0: fidl::encoding::Encode<
2717                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>>,
2718                fidl::encoding::DefaultFuchsiaResourceDialect,
2719            >,
2720        T1: fidl::encoding::Encode<u16, fidl::encoding::DefaultFuchsiaResourceDialect>,
2721    >
2722        fidl::encoding::Encode<
2723            InputDeviceGetInputReportsReaderV2Request,
2724            fidl::encoding::DefaultFuchsiaResourceDialect,
2725        > for (T0, T1)
2726    {
2727        #[inline]
2728        unsafe fn encode(
2729            self,
2730            encoder: &mut fidl::encoding::Encoder<
2731                '_,
2732                fidl::encoding::DefaultFuchsiaResourceDialect,
2733            >,
2734            offset: usize,
2735            depth: fidl::encoding::Depth,
2736        ) -> fidl::Result<()> {
2737            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderV2Request>(offset);
2738            // Zero out padding regions. There's no need to apply masks
2739            // because the unmasked parts will be overwritten by fields.
2740            unsafe {
2741                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
2742                (ptr as *mut u32).write_unaligned(0);
2743            }
2744            // Write the fields.
2745            self.0.encode(encoder, offset + 0, depth)?;
2746            self.1.encode(encoder, offset + 4, depth)?;
2747            Ok(())
2748        }
2749    }
2750
2751    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2752        for InputDeviceGetInputReportsReaderV2Request
2753    {
2754        #[inline(always)]
2755        fn new_empty() -> Self {
2756            Self {
2757                reader: fidl::new_empty!(
2758                    fidl::encoding::Endpoint<
2759                        fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>,
2760                    >,
2761                    fidl::encoding::DefaultFuchsiaResourceDialect
2762                ),
2763                max_unacknowledged_reports_limit: fidl::new_empty!(
2764                    u16,
2765                    fidl::encoding::DefaultFuchsiaResourceDialect
2766                ),
2767            }
2768        }
2769
2770        #[inline]
2771        unsafe fn decode(
2772            &mut self,
2773            decoder: &mut fidl::encoding::Decoder<
2774                '_,
2775                fidl::encoding::DefaultFuchsiaResourceDialect,
2776            >,
2777            offset: usize,
2778            _depth: fidl::encoding::Depth,
2779        ) -> fidl::Result<()> {
2780            decoder.debug_check_bounds::<Self>(offset);
2781            // Verify that padding bytes are zero.
2782            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(4) };
2783            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2784            let mask = 0xffff0000u32;
2785            let maskedval = padval & mask;
2786            if maskedval != 0 {
2787                return Err(fidl::Error::NonZeroPadding {
2788                    padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
2789                });
2790            }
2791            fidl::decode!(
2792                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderV2Marker>>,
2793                fidl::encoding::DefaultFuchsiaResourceDialect,
2794                &mut self.reader,
2795                decoder,
2796                offset + 0,
2797                _depth
2798            )?;
2799            fidl::decode!(
2800                u16,
2801                fidl::encoding::DefaultFuchsiaResourceDialect,
2802                &mut self.max_unacknowledged_reports_limit,
2803                decoder,
2804                offset + 4,
2805                _depth
2806            )?;
2807            Ok(())
2808        }
2809    }
2810
2811    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportResponse {
2812        type Borrowed<'a> = &'a mut Self;
2813        fn take_or_borrow<'a>(
2814            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2815        ) -> Self::Borrowed<'a> {
2816            value
2817        }
2818    }
2819
2820    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
2821        type Owned = Self;
2822
2823        #[inline(always)]
2824        fn inline_align(_context: fidl::encoding::Context) -> usize {
2825            8
2826        }
2827
2828        #[inline(always)]
2829        fn inline_size(_context: fidl::encoding::Context) -> usize {
2830            16
2831        }
2832    }
2833
2834    unsafe impl
2835        fidl::encoding::Encode<
2836            InputDeviceGetInputReportResponse,
2837            fidl::encoding::DefaultFuchsiaResourceDialect,
2838        > for &mut InputDeviceGetInputReportResponse
2839    {
2840        #[inline]
2841        unsafe fn encode(
2842            self,
2843            encoder: &mut fidl::encoding::Encoder<
2844                '_,
2845                fidl::encoding::DefaultFuchsiaResourceDialect,
2846            >,
2847            offset: usize,
2848            _depth: fidl::encoding::Depth,
2849        ) -> fidl::Result<()> {
2850            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2851            // Delegate to tuple encoding.
2852            fidl::encoding::Encode::<
2853                InputDeviceGetInputReportResponse,
2854                fidl::encoding::DefaultFuchsiaResourceDialect,
2855            >::encode(
2856                (<InputReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2857                    &mut self.report,
2858                ),),
2859                encoder,
2860                offset,
2861                _depth,
2862            )
2863        }
2864    }
2865    unsafe impl<
2866        T0: fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>,
2867    >
2868        fidl::encoding::Encode<
2869            InputDeviceGetInputReportResponse,
2870            fidl::encoding::DefaultFuchsiaResourceDialect,
2871        > for (T0,)
2872    {
2873        #[inline]
2874        unsafe fn encode(
2875            self,
2876            encoder: &mut fidl::encoding::Encoder<
2877                '_,
2878                fidl::encoding::DefaultFuchsiaResourceDialect,
2879            >,
2880            offset: usize,
2881            depth: fidl::encoding::Depth,
2882        ) -> fidl::Result<()> {
2883            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2884            // Zero out padding regions. There's no need to apply masks
2885            // because the unmasked parts will be overwritten by fields.
2886            // Write the fields.
2887            self.0.encode(encoder, offset + 0, depth)?;
2888            Ok(())
2889        }
2890    }
2891
2892    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2893        for InputDeviceGetInputReportResponse
2894    {
2895        #[inline(always)]
2896        fn new_empty() -> Self {
2897            Self {
2898                report: fidl::new_empty!(
2899                    InputReport,
2900                    fidl::encoding::DefaultFuchsiaResourceDialect
2901                ),
2902            }
2903        }
2904
2905        #[inline]
2906        unsafe fn decode(
2907            &mut self,
2908            decoder: &mut fidl::encoding::Decoder<
2909                '_,
2910                fidl::encoding::DefaultFuchsiaResourceDialect,
2911            >,
2912            offset: usize,
2913            _depth: fidl::encoding::Depth,
2914        ) -> fidl::Result<()> {
2915            decoder.debug_check_bounds::<Self>(offset);
2916            // Verify that padding bytes are zero.
2917            fidl::decode!(
2918                InputReport,
2919                fidl::encoding::DefaultFuchsiaResourceDialect,
2920                &mut self.report,
2921                decoder,
2922                offset + 0,
2923                _depth
2924            )?;
2925            Ok(())
2926        }
2927    }
2928
2929    impl fidl::encoding::ResourceTypeMarker for InputReportsReaderV2OnInputReportsRequest {
2930        type Borrowed<'a> = &'a mut Self;
2931        fn take_or_borrow<'a>(
2932            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2933        ) -> Self::Borrowed<'a> {
2934            value
2935        }
2936    }
2937
2938    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderV2OnInputReportsRequest {
2939        type Owned = Self;
2940
2941        #[inline(always)]
2942        fn inline_align(_context: fidl::encoding::Context) -> usize {
2943            8
2944        }
2945
2946        #[inline(always)]
2947        fn inline_size(_context: fidl::encoding::Context) -> usize {
2948            24
2949        }
2950    }
2951
2952    unsafe impl
2953        fidl::encoding::Encode<
2954            InputReportsReaderV2OnInputReportsRequest,
2955            fidl::encoding::DefaultFuchsiaResourceDialect,
2956        > for &mut InputReportsReaderV2OnInputReportsRequest
2957    {
2958        #[inline]
2959        unsafe fn encode(
2960            self,
2961            encoder: &mut fidl::encoding::Encoder<
2962                '_,
2963                fidl::encoding::DefaultFuchsiaResourceDialect,
2964            >,
2965            offset: usize,
2966            _depth: fidl::encoding::Depth,
2967        ) -> fidl::Result<()> {
2968            encoder.debug_check_bounds::<InputReportsReaderV2OnInputReportsRequest>(offset);
2969            // Delegate to tuple encoding.
2970            fidl::encoding::Encode::<InputReportsReaderV2OnInputReportsRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2971                (
2972                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
2973                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.last_report_stamp),
2974                ),
2975                encoder, offset, _depth
2976            )
2977        }
2978    }
2979    unsafe impl<
2980        T0: fidl::encoding::Encode<
2981                fidl::encoding::Vector<InputReport, 50>,
2982                fidl::encoding::DefaultFuchsiaResourceDialect,
2983            >,
2984        T1: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2985    >
2986        fidl::encoding::Encode<
2987            InputReportsReaderV2OnInputReportsRequest,
2988            fidl::encoding::DefaultFuchsiaResourceDialect,
2989        > for (T0, T1)
2990    {
2991        #[inline]
2992        unsafe fn encode(
2993            self,
2994            encoder: &mut fidl::encoding::Encoder<
2995                '_,
2996                fidl::encoding::DefaultFuchsiaResourceDialect,
2997            >,
2998            offset: usize,
2999            depth: fidl::encoding::Depth,
3000        ) -> fidl::Result<()> {
3001            encoder.debug_check_bounds::<InputReportsReaderV2OnInputReportsRequest>(offset);
3002            // Zero out padding regions. There's no need to apply masks
3003            // because the unmasked parts will be overwritten by fields.
3004            // Write the fields.
3005            self.0.encode(encoder, offset + 0, depth)?;
3006            self.1.encode(encoder, offset + 16, depth)?;
3007            Ok(())
3008        }
3009    }
3010
3011    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3012        for InputReportsReaderV2OnInputReportsRequest
3013    {
3014        #[inline(always)]
3015        fn new_empty() -> Self {
3016            Self {
3017                reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
3018                last_report_stamp: fidl::new_empty!(
3019                    u64,
3020                    fidl::encoding::DefaultFuchsiaResourceDialect
3021                ),
3022            }
3023        }
3024
3025        #[inline]
3026        unsafe fn decode(
3027            &mut self,
3028            decoder: &mut fidl::encoding::Decoder<
3029                '_,
3030                fidl::encoding::DefaultFuchsiaResourceDialect,
3031            >,
3032            offset: usize,
3033            _depth: fidl::encoding::Depth,
3034        ) -> fidl::Result<()> {
3035            decoder.debug_check_bounds::<Self>(offset);
3036            // Verify that padding bytes are zero.
3037            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
3038            fidl::decode!(
3039                u64,
3040                fidl::encoding::DefaultFuchsiaResourceDialect,
3041                &mut self.last_report_stamp,
3042                decoder,
3043                offset + 16,
3044                _depth
3045            )?;
3046            Ok(())
3047        }
3048    }
3049
3050    impl fidl::encoding::ResourceTypeMarker for InputReportsReaderReadInputReportsResponse {
3051        type Borrowed<'a> = &'a mut Self;
3052        fn take_or_borrow<'a>(
3053            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3054        ) -> Self::Borrowed<'a> {
3055            value
3056        }
3057    }
3058
3059    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
3060        type Owned = Self;
3061
3062        #[inline(always)]
3063        fn inline_align(_context: fidl::encoding::Context) -> usize {
3064            8
3065        }
3066
3067        #[inline(always)]
3068        fn inline_size(_context: fidl::encoding::Context) -> usize {
3069            16
3070        }
3071    }
3072
3073    unsafe impl
3074        fidl::encoding::Encode<
3075            InputReportsReaderReadInputReportsResponse,
3076            fidl::encoding::DefaultFuchsiaResourceDialect,
3077        > for &mut InputReportsReaderReadInputReportsResponse
3078    {
3079        #[inline]
3080        unsafe fn encode(
3081            self,
3082            encoder: &mut fidl::encoding::Encoder<
3083                '_,
3084                fidl::encoding::DefaultFuchsiaResourceDialect,
3085            >,
3086            offset: usize,
3087            _depth: fidl::encoding::Depth,
3088        ) -> fidl::Result<()> {
3089            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
3090            // Delegate to tuple encoding.
3091            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3092                (
3093                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
3094                ),
3095                encoder, offset, _depth
3096            )
3097        }
3098    }
3099    unsafe impl<
3100        T0: fidl::encoding::Encode<
3101                fidl::encoding::Vector<InputReport, 50>,
3102                fidl::encoding::DefaultFuchsiaResourceDialect,
3103            >,
3104    >
3105        fidl::encoding::Encode<
3106            InputReportsReaderReadInputReportsResponse,
3107            fidl::encoding::DefaultFuchsiaResourceDialect,
3108        > for (T0,)
3109    {
3110        #[inline]
3111        unsafe fn encode(
3112            self,
3113            encoder: &mut fidl::encoding::Encoder<
3114                '_,
3115                fidl::encoding::DefaultFuchsiaResourceDialect,
3116            >,
3117            offset: usize,
3118            depth: fidl::encoding::Depth,
3119        ) -> fidl::Result<()> {
3120            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
3121            // Zero out padding regions. There's no need to apply masks
3122            // because the unmasked parts will be overwritten by fields.
3123            // Write the fields.
3124            self.0.encode(encoder, offset + 0, depth)?;
3125            Ok(())
3126        }
3127    }
3128
3129    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3130        for InputReportsReaderReadInputReportsResponse
3131    {
3132        #[inline(always)]
3133        fn new_empty() -> Self {
3134            Self {
3135                reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
3136            }
3137        }
3138
3139        #[inline]
3140        unsafe fn decode(
3141            &mut self,
3142            decoder: &mut fidl::encoding::Decoder<
3143                '_,
3144                fidl::encoding::DefaultFuchsiaResourceDialect,
3145            >,
3146            offset: usize,
3147            _depth: fidl::encoding::Depth,
3148        ) -> fidl::Result<()> {
3149            decoder.debug_check_bounds::<Self>(offset);
3150            // Verify that padding bytes are zero.
3151            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
3152            Ok(())
3153        }
3154    }
3155
3156    impl InputReport {
3157        #[inline(always)]
3158        fn max_ordinal_present(&self) -> u64 {
3159            if let Some(_) = self.wake_lease {
3160                return 9;
3161            }
3162            if let Some(_) = self.report_id {
3163                return 8;
3164            }
3165            if let Some(_) = self.consumer_control {
3166                return 7;
3167            }
3168            if let Some(_) = self.keyboard {
3169                return 6;
3170            }
3171            if let Some(_) = self.touch {
3172                return 5;
3173            }
3174            if let Some(_) = self.sensor {
3175                return 4;
3176            }
3177            if let Some(_) = self.trace_id {
3178                return 3;
3179            }
3180            if let Some(_) = self.mouse {
3181                return 2;
3182            }
3183            if let Some(_) = self.event_time {
3184                return 1;
3185            }
3186            0
3187        }
3188    }
3189
3190    impl fidl::encoding::ResourceTypeMarker for InputReport {
3191        type Borrowed<'a> = &'a mut Self;
3192        fn take_or_borrow<'a>(
3193            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3194        ) -> Self::Borrowed<'a> {
3195            value
3196        }
3197    }
3198
3199    unsafe impl fidl::encoding::TypeMarker for InputReport {
3200        type Owned = Self;
3201
3202        #[inline(always)]
3203        fn inline_align(_context: fidl::encoding::Context) -> usize {
3204            8
3205        }
3206
3207        #[inline(always)]
3208        fn inline_size(_context: fidl::encoding::Context) -> usize {
3209            16
3210        }
3211    }
3212
3213    unsafe impl fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>
3214        for &mut InputReport
3215    {
3216        unsafe fn encode(
3217            self,
3218            encoder: &mut fidl::encoding::Encoder<
3219                '_,
3220                fidl::encoding::DefaultFuchsiaResourceDialect,
3221            >,
3222            offset: usize,
3223            mut depth: fidl::encoding::Depth,
3224        ) -> fidl::Result<()> {
3225            encoder.debug_check_bounds::<InputReport>(offset);
3226            // Vector header
3227            let max_ordinal: u64 = self.max_ordinal_present();
3228            encoder.write_num(max_ordinal, offset);
3229            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3230            // Calling encoder.out_of_line_offset(0) is not allowed.
3231            if max_ordinal == 0 {
3232                return Ok(());
3233            }
3234            depth.increment()?;
3235            let envelope_size = 8;
3236            let bytes_len = max_ordinal as usize * envelope_size;
3237            #[allow(unused_variables)]
3238            let offset = encoder.out_of_line_offset(bytes_len);
3239            let mut _prev_end_offset: usize = 0;
3240            if 1 > max_ordinal {
3241                return Ok(());
3242            }
3243
3244            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3245            // are envelope_size bytes.
3246            let cur_offset: usize = (1 - 1) * envelope_size;
3247
3248            // Zero reserved fields.
3249            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3250
3251            // Safety:
3252            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3253            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3254            //   envelope_size bytes, there is always sufficient room.
3255            fidl::encoding::encode_in_envelope_optional::<
3256                i64,
3257                fidl::encoding::DefaultFuchsiaResourceDialect,
3258            >(
3259                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
3260                encoder,
3261                offset + cur_offset,
3262                depth,
3263            )?;
3264
3265            _prev_end_offset = cur_offset + envelope_size;
3266            if 2 > max_ordinal {
3267                return Ok(());
3268            }
3269
3270            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3271            // are envelope_size bytes.
3272            let cur_offset: usize = (2 - 1) * envelope_size;
3273
3274            // Zero reserved fields.
3275            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3276
3277            // Safety:
3278            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3279            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3280            //   envelope_size bytes, there is always sufficient room.
3281            fidl::encoding::encode_in_envelope_optional::<
3282                MouseInputReport,
3283                fidl::encoding::DefaultFuchsiaResourceDialect,
3284            >(
3285                self.mouse
3286                    .as_ref()
3287                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3288                encoder,
3289                offset + cur_offset,
3290                depth,
3291            )?;
3292
3293            _prev_end_offset = cur_offset + envelope_size;
3294            if 3 > max_ordinal {
3295                return Ok(());
3296            }
3297
3298            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3299            // are envelope_size bytes.
3300            let cur_offset: usize = (3 - 1) * envelope_size;
3301
3302            // Zero reserved fields.
3303            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3304
3305            // Safety:
3306            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3307            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3308            //   envelope_size bytes, there is always sufficient room.
3309            fidl::encoding::encode_in_envelope_optional::<
3310                u64,
3311                fidl::encoding::DefaultFuchsiaResourceDialect,
3312            >(
3313                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3314                encoder,
3315                offset + cur_offset,
3316                depth,
3317            )?;
3318
3319            _prev_end_offset = cur_offset + envelope_size;
3320            if 4 > max_ordinal {
3321                return Ok(());
3322            }
3323
3324            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3325            // are envelope_size bytes.
3326            let cur_offset: usize = (4 - 1) * envelope_size;
3327
3328            // Zero reserved fields.
3329            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3330
3331            // Safety:
3332            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3333            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3334            //   envelope_size bytes, there is always sufficient room.
3335            fidl::encoding::encode_in_envelope_optional::<
3336                SensorInputReport,
3337                fidl::encoding::DefaultFuchsiaResourceDialect,
3338            >(
3339                self.sensor
3340                    .as_ref()
3341                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3342                encoder,
3343                offset + cur_offset,
3344                depth,
3345            )?;
3346
3347            _prev_end_offset = cur_offset + envelope_size;
3348            if 5 > max_ordinal {
3349                return Ok(());
3350            }
3351
3352            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3353            // are envelope_size bytes.
3354            let cur_offset: usize = (5 - 1) * envelope_size;
3355
3356            // Zero reserved fields.
3357            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3358
3359            // Safety:
3360            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3361            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3362            //   envelope_size bytes, there is always sufficient room.
3363            fidl::encoding::encode_in_envelope_optional::<
3364                TouchInputReport,
3365                fidl::encoding::DefaultFuchsiaResourceDialect,
3366            >(
3367                self.touch
3368                    .as_ref()
3369                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3370                encoder,
3371                offset + cur_offset,
3372                depth,
3373            )?;
3374
3375            _prev_end_offset = cur_offset + envelope_size;
3376            if 6 > max_ordinal {
3377                return Ok(());
3378            }
3379
3380            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3381            // are envelope_size bytes.
3382            let cur_offset: usize = (6 - 1) * envelope_size;
3383
3384            // Zero reserved fields.
3385            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3386
3387            // Safety:
3388            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3389            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3390            //   envelope_size bytes, there is always sufficient room.
3391            fidl::encoding::encode_in_envelope_optional::<
3392                KeyboardInputReport,
3393                fidl::encoding::DefaultFuchsiaResourceDialect,
3394            >(
3395                self.keyboard
3396                    .as_ref()
3397                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3398                encoder,
3399                offset + cur_offset,
3400                depth,
3401            )?;
3402
3403            _prev_end_offset = cur_offset + envelope_size;
3404            if 7 > max_ordinal {
3405                return Ok(());
3406            }
3407
3408            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3409            // are envelope_size bytes.
3410            let cur_offset: usize = (7 - 1) * envelope_size;
3411
3412            // Zero reserved fields.
3413            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3414
3415            // Safety:
3416            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3417            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3418            //   envelope_size bytes, there is always sufficient room.
3419            fidl::encoding::encode_in_envelope_optional::<
3420                ConsumerControlInputReport,
3421                fidl::encoding::DefaultFuchsiaResourceDialect,
3422            >(
3423                self.consumer_control
3424                    .as_ref()
3425                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
3426                encoder,
3427                offset + cur_offset,
3428                depth,
3429            )?;
3430
3431            _prev_end_offset = cur_offset + envelope_size;
3432            if 8 > max_ordinal {
3433                return Ok(());
3434            }
3435
3436            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3437            // are envelope_size bytes.
3438            let cur_offset: usize = (8 - 1) * envelope_size;
3439
3440            // Zero reserved fields.
3441            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3442
3443            // Safety:
3444            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3445            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3446            //   envelope_size bytes, there is always sufficient room.
3447            fidl::encoding::encode_in_envelope_optional::<
3448                u8,
3449                fidl::encoding::DefaultFuchsiaResourceDialect,
3450            >(
3451                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
3452                encoder,
3453                offset + cur_offset,
3454                depth,
3455            )?;
3456
3457            _prev_end_offset = cur_offset + envelope_size;
3458            if 9 > max_ordinal {
3459                return Ok(());
3460            }
3461
3462            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3463            // are envelope_size bytes.
3464            let cur_offset: usize = (9 - 1) * envelope_size;
3465
3466            // Zero reserved fields.
3467            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3468
3469            // Safety:
3470            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3471            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3472            //   envelope_size bytes, there is always sufficient room.
3473            fidl::encoding::encode_in_envelope_optional::<
3474                fidl::encoding::HandleType<
3475                    fidl::EventPair,
3476                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3477                    2147483648,
3478                >,
3479                fidl::encoding::DefaultFuchsiaResourceDialect,
3480            >(
3481                self.wake_lease.as_mut().map(
3482                    <fidl::encoding::HandleType<
3483                        fidl::EventPair,
3484                        { fidl::ObjectType::EVENTPAIR.into_raw() },
3485                        2147483648,
3486                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3487                ),
3488                encoder,
3489                offset + cur_offset,
3490                depth,
3491            )?;
3492
3493            _prev_end_offset = cur_offset + envelope_size;
3494
3495            Ok(())
3496        }
3497    }
3498
3499    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {
3500        #[inline(always)]
3501        fn new_empty() -> Self {
3502            Self::default()
3503        }
3504
3505        unsafe fn decode(
3506            &mut self,
3507            decoder: &mut fidl::encoding::Decoder<
3508                '_,
3509                fidl::encoding::DefaultFuchsiaResourceDialect,
3510            >,
3511            offset: usize,
3512            mut depth: fidl::encoding::Depth,
3513        ) -> fidl::Result<()> {
3514            decoder.debug_check_bounds::<Self>(offset);
3515            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3516                None => return Err(fidl::Error::NotNullable),
3517                Some(len) => len,
3518            };
3519            // Calling decoder.out_of_line_offset(0) is not allowed.
3520            if len == 0 {
3521                return Ok(());
3522            };
3523            depth.increment()?;
3524            let envelope_size = 8;
3525            let bytes_len = len * envelope_size;
3526            let offset = decoder.out_of_line_offset(bytes_len)?;
3527            // Decode the envelope for each type.
3528            let mut _next_ordinal_to_read = 0;
3529            let mut next_offset = offset;
3530            let end_offset = offset + bytes_len;
3531            _next_ordinal_to_read += 1;
3532            if next_offset >= end_offset {
3533                return Ok(());
3534            }
3535
3536            // Decode unknown envelopes for gaps in ordinals.
3537            while _next_ordinal_to_read < 1 {
3538                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3539                _next_ordinal_to_read += 1;
3540                next_offset += envelope_size;
3541            }
3542
3543            let next_out_of_line = decoder.next_out_of_line();
3544            let handles_before = decoder.remaining_handles();
3545            if let Some((inlined, num_bytes, num_handles)) =
3546                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3547            {
3548                let member_inline_size =
3549                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3550                if inlined != (member_inline_size <= 4) {
3551                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3552                }
3553                let inner_offset;
3554                let mut inner_depth = depth.clone();
3555                if inlined {
3556                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3557                    inner_offset = next_offset;
3558                } else {
3559                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3560                    inner_depth.increment()?;
3561                }
3562                let val_ref = self.event_time.get_or_insert_with(|| {
3563                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
3564                });
3565                fidl::decode!(
3566                    i64,
3567                    fidl::encoding::DefaultFuchsiaResourceDialect,
3568                    val_ref,
3569                    decoder,
3570                    inner_offset,
3571                    inner_depth
3572                )?;
3573                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3574                {
3575                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3576                }
3577                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3578                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3579                }
3580            }
3581
3582            next_offset += envelope_size;
3583            _next_ordinal_to_read += 1;
3584            if next_offset >= end_offset {
3585                return Ok(());
3586            }
3587
3588            // Decode unknown envelopes for gaps in ordinals.
3589            while _next_ordinal_to_read < 2 {
3590                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3591                _next_ordinal_to_read += 1;
3592                next_offset += envelope_size;
3593            }
3594
3595            let next_out_of_line = decoder.next_out_of_line();
3596            let handles_before = decoder.remaining_handles();
3597            if let Some((inlined, num_bytes, num_handles)) =
3598                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3599            {
3600                let member_inline_size =
3601                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3602                if inlined != (member_inline_size <= 4) {
3603                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3604                }
3605                let inner_offset;
3606                let mut inner_depth = depth.clone();
3607                if inlined {
3608                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3609                    inner_offset = next_offset;
3610                } else {
3611                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3612                    inner_depth.increment()?;
3613                }
3614                let val_ref = self.mouse.get_or_insert_with(|| {
3615                    fidl::new_empty!(
3616                        MouseInputReport,
3617                        fidl::encoding::DefaultFuchsiaResourceDialect
3618                    )
3619                });
3620                fidl::decode!(
3621                    MouseInputReport,
3622                    fidl::encoding::DefaultFuchsiaResourceDialect,
3623                    val_ref,
3624                    decoder,
3625                    inner_offset,
3626                    inner_depth
3627                )?;
3628                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3629                {
3630                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3631                }
3632                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3633                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3634                }
3635            }
3636
3637            next_offset += envelope_size;
3638            _next_ordinal_to_read += 1;
3639            if next_offset >= end_offset {
3640                return Ok(());
3641            }
3642
3643            // Decode unknown envelopes for gaps in ordinals.
3644            while _next_ordinal_to_read < 3 {
3645                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3646                _next_ordinal_to_read += 1;
3647                next_offset += envelope_size;
3648            }
3649
3650            let next_out_of_line = decoder.next_out_of_line();
3651            let handles_before = decoder.remaining_handles();
3652            if let Some((inlined, num_bytes, num_handles)) =
3653                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3654            {
3655                let member_inline_size =
3656                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3657                if inlined != (member_inline_size <= 4) {
3658                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3659                }
3660                let inner_offset;
3661                let mut inner_depth = depth.clone();
3662                if inlined {
3663                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3664                    inner_offset = next_offset;
3665                } else {
3666                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3667                    inner_depth.increment()?;
3668                }
3669                let val_ref = self.trace_id.get_or_insert_with(|| {
3670                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
3671                });
3672                fidl::decode!(
3673                    u64,
3674                    fidl::encoding::DefaultFuchsiaResourceDialect,
3675                    val_ref,
3676                    decoder,
3677                    inner_offset,
3678                    inner_depth
3679                )?;
3680                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3681                {
3682                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3683                }
3684                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3685                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3686                }
3687            }
3688
3689            next_offset += envelope_size;
3690            _next_ordinal_to_read += 1;
3691            if next_offset >= end_offset {
3692                return Ok(());
3693            }
3694
3695            // Decode unknown envelopes for gaps in ordinals.
3696            while _next_ordinal_to_read < 4 {
3697                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3698                _next_ordinal_to_read += 1;
3699                next_offset += envelope_size;
3700            }
3701
3702            let next_out_of_line = decoder.next_out_of_line();
3703            let handles_before = decoder.remaining_handles();
3704            if let Some((inlined, num_bytes, num_handles)) =
3705                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3706            {
3707                let member_inline_size =
3708                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3709                if inlined != (member_inline_size <= 4) {
3710                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3711                }
3712                let inner_offset;
3713                let mut inner_depth = depth.clone();
3714                if inlined {
3715                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3716                    inner_offset = next_offset;
3717                } else {
3718                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3719                    inner_depth.increment()?;
3720                }
3721                let val_ref = self.sensor.get_or_insert_with(|| {
3722                    fidl::new_empty!(
3723                        SensorInputReport,
3724                        fidl::encoding::DefaultFuchsiaResourceDialect
3725                    )
3726                });
3727                fidl::decode!(
3728                    SensorInputReport,
3729                    fidl::encoding::DefaultFuchsiaResourceDialect,
3730                    val_ref,
3731                    decoder,
3732                    inner_offset,
3733                    inner_depth
3734                )?;
3735                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3736                {
3737                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3738                }
3739                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3740                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3741                }
3742            }
3743
3744            next_offset += envelope_size;
3745            _next_ordinal_to_read += 1;
3746            if next_offset >= end_offset {
3747                return Ok(());
3748            }
3749
3750            // Decode unknown envelopes for gaps in ordinals.
3751            while _next_ordinal_to_read < 5 {
3752                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3753                _next_ordinal_to_read += 1;
3754                next_offset += envelope_size;
3755            }
3756
3757            let next_out_of_line = decoder.next_out_of_line();
3758            let handles_before = decoder.remaining_handles();
3759            if let Some((inlined, num_bytes, num_handles)) =
3760                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3761            {
3762                let member_inline_size =
3763                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3764                if inlined != (member_inline_size <= 4) {
3765                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3766                }
3767                let inner_offset;
3768                let mut inner_depth = depth.clone();
3769                if inlined {
3770                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3771                    inner_offset = next_offset;
3772                } else {
3773                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3774                    inner_depth.increment()?;
3775                }
3776                let val_ref = self.touch.get_or_insert_with(|| {
3777                    fidl::new_empty!(
3778                        TouchInputReport,
3779                        fidl::encoding::DefaultFuchsiaResourceDialect
3780                    )
3781                });
3782                fidl::decode!(
3783                    TouchInputReport,
3784                    fidl::encoding::DefaultFuchsiaResourceDialect,
3785                    val_ref,
3786                    decoder,
3787                    inner_offset,
3788                    inner_depth
3789                )?;
3790                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3791                {
3792                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3793                }
3794                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3795                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3796                }
3797            }
3798
3799            next_offset += envelope_size;
3800            _next_ordinal_to_read += 1;
3801            if next_offset >= end_offset {
3802                return Ok(());
3803            }
3804
3805            // Decode unknown envelopes for gaps in ordinals.
3806            while _next_ordinal_to_read < 6 {
3807                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3808                _next_ordinal_to_read += 1;
3809                next_offset += envelope_size;
3810            }
3811
3812            let next_out_of_line = decoder.next_out_of_line();
3813            let handles_before = decoder.remaining_handles();
3814            if let Some((inlined, num_bytes, num_handles)) =
3815                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3816            {
3817                let member_inline_size =
3818                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
3819                        decoder.context,
3820                    );
3821                if inlined != (member_inline_size <= 4) {
3822                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3823                }
3824                let inner_offset;
3825                let mut inner_depth = depth.clone();
3826                if inlined {
3827                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3828                    inner_offset = next_offset;
3829                } else {
3830                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3831                    inner_depth.increment()?;
3832                }
3833                let val_ref = self.keyboard.get_or_insert_with(|| {
3834                    fidl::new_empty!(
3835                        KeyboardInputReport,
3836                        fidl::encoding::DefaultFuchsiaResourceDialect
3837                    )
3838                });
3839                fidl::decode!(
3840                    KeyboardInputReport,
3841                    fidl::encoding::DefaultFuchsiaResourceDialect,
3842                    val_ref,
3843                    decoder,
3844                    inner_offset,
3845                    inner_depth
3846                )?;
3847                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3848                {
3849                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3850                }
3851                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3852                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3853                }
3854            }
3855
3856            next_offset += envelope_size;
3857            _next_ordinal_to_read += 1;
3858            if next_offset >= end_offset {
3859                return Ok(());
3860            }
3861
3862            // Decode unknown envelopes for gaps in ordinals.
3863            while _next_ordinal_to_read < 7 {
3864                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3865                _next_ordinal_to_read += 1;
3866                next_offset += envelope_size;
3867            }
3868
3869            let next_out_of_line = decoder.next_out_of_line();
3870            let handles_before = decoder.remaining_handles();
3871            if let Some((inlined, num_bytes, num_handles)) =
3872                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3873            {
3874                let member_inline_size =
3875                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
3876                        decoder.context,
3877                    );
3878                if inlined != (member_inline_size <= 4) {
3879                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3880                }
3881                let inner_offset;
3882                let mut inner_depth = depth.clone();
3883                if inlined {
3884                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3885                    inner_offset = next_offset;
3886                } else {
3887                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3888                    inner_depth.increment()?;
3889                }
3890                let val_ref = self.consumer_control.get_or_insert_with(|| {
3891                    fidl::new_empty!(
3892                        ConsumerControlInputReport,
3893                        fidl::encoding::DefaultFuchsiaResourceDialect
3894                    )
3895                });
3896                fidl::decode!(
3897                    ConsumerControlInputReport,
3898                    fidl::encoding::DefaultFuchsiaResourceDialect,
3899                    val_ref,
3900                    decoder,
3901                    inner_offset,
3902                    inner_depth
3903                )?;
3904                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3905                {
3906                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3907                }
3908                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3909                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3910                }
3911            }
3912
3913            next_offset += envelope_size;
3914            _next_ordinal_to_read += 1;
3915            if next_offset >= end_offset {
3916                return Ok(());
3917            }
3918
3919            // Decode unknown envelopes for gaps in ordinals.
3920            while _next_ordinal_to_read < 8 {
3921                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3922                _next_ordinal_to_read += 1;
3923                next_offset += envelope_size;
3924            }
3925
3926            let next_out_of_line = decoder.next_out_of_line();
3927            let handles_before = decoder.remaining_handles();
3928            if let Some((inlined, num_bytes, num_handles)) =
3929                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3930            {
3931                let member_inline_size =
3932                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3933                if inlined != (member_inline_size <= 4) {
3934                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3935                }
3936                let inner_offset;
3937                let mut inner_depth = depth.clone();
3938                if inlined {
3939                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3940                    inner_offset = next_offset;
3941                } else {
3942                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3943                    inner_depth.increment()?;
3944                }
3945                let val_ref = self.report_id.get_or_insert_with(|| {
3946                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
3947                });
3948                fidl::decode!(
3949                    u8,
3950                    fidl::encoding::DefaultFuchsiaResourceDialect,
3951                    val_ref,
3952                    decoder,
3953                    inner_offset,
3954                    inner_depth
3955                )?;
3956                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3957                {
3958                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3959                }
3960                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3961                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3962                }
3963            }
3964
3965            next_offset += envelope_size;
3966            _next_ordinal_to_read += 1;
3967            if next_offset >= end_offset {
3968                return Ok(());
3969            }
3970
3971            // Decode unknown envelopes for gaps in ordinals.
3972            while _next_ordinal_to_read < 9 {
3973                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3974                _next_ordinal_to_read += 1;
3975                next_offset += envelope_size;
3976            }
3977
3978            let next_out_of_line = decoder.next_out_of_line();
3979            let handles_before = decoder.remaining_handles();
3980            if let Some((inlined, num_bytes, num_handles)) =
3981                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3982            {
3983                let member_inline_size = <fidl::encoding::HandleType<
3984                    fidl::EventPair,
3985                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3986                    2147483648,
3987                > as fidl::encoding::TypeMarker>::inline_size(
3988                    decoder.context
3989                );
3990                if inlined != (member_inline_size <= 4) {
3991                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3992                }
3993                let inner_offset;
3994                let mut inner_depth = depth.clone();
3995                if inlined {
3996                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3997                    inner_offset = next_offset;
3998                } else {
3999                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4000                    inner_depth.increment()?;
4001                }
4002                let val_ref =
4003                self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
4004                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4005                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4006                {
4007                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4008                }
4009                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4010                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4011                }
4012            }
4013
4014            next_offset += envelope_size;
4015
4016            // Decode the remaining unknown envelopes.
4017            while next_offset < end_offset {
4018                _next_ordinal_to_read += 1;
4019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4020                next_offset += envelope_size;
4021            }
4022
4023            Ok(())
4024        }
4025    }
4026}