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, PartialEq)]
25pub struct InputDeviceGetInputReportResponse {
26    pub report: InputReport,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
30    for InputDeviceGetInputReportResponse
31{
32}
33
34#[derive(Debug, PartialEq)]
35pub struct InputReportsReaderReadInputReportsResponse {
36    pub reports: Vec<InputReport>,
37}
38
39impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
40    for InputReportsReaderReadInputReportsResponse
41{
42}
43
44/// An `InputReport` is a single report that is created by an input device.
45/// An `InputReport` can contain one of many different report types. The report
46/// types are not mutually exclusive. The `event_time` is the time in
47/// nanoseconds when the report was generated.
48#[derive(Debug, Default, PartialEq)]
49pub struct InputReport {
50    /// The monotonic time when the event was generated.
51    ///
52    /// Required.
53    pub event_time: Option<i64>,
54    /// Optional. Present iff the device reports mouse input.
55    pub mouse: Option<MouseInputReport>,
56    /// Unique ID to connect trace async begin/end events.
57    ///
58    /// Optional.
59    pub trace_id: Option<u64>,
60    /// Optional. Present iff the device reports sensor input.
61    pub sensor: Option<SensorInputReport>,
62    /// Optional. Present iff the device reports touch input.
63    pub touch: Option<TouchInputReport>,
64    /// Optional. Present iff the device reports keyboard input.
65    pub keyboard: Option<KeyboardInputReport>,
66    /// Optional. Present iff the device reports consumer control input.
67    pub consumer_control: Option<ConsumerControlInputReport>,
68    /// A device may have multiple input descriptors of the same type. This
69    /// field specifies which descriptor this InputReport corresponds to.
70    /// Omitted if the device has no more than one descriptor for each type.
71    ///
72    /// Optional.
73    pub report_id: Option<u8>,
74    /// Optional wake lease for power baton passing.
75    pub wake_lease: Option<fidl::EventPair>,
76    #[doc(hidden)]
77    pub __source_breaking: fidl::marker::SourceBreaking,
78}
79
80impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {}
81
82#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
83pub struct InputDeviceMarker;
84
85impl fidl::endpoints::ProtocolMarker for InputDeviceMarker {
86    type Proxy = InputDeviceProxy;
87    type RequestStream = InputDeviceRequestStream;
88    #[cfg(target_os = "fuchsia")]
89    type SynchronousProxy = InputDeviceSynchronousProxy;
90
91    const DEBUG_NAME: &'static str = "fuchsia.input.report.InputDevice";
92}
93impl fidl::endpoints::DiscoverableProtocolMarker for InputDeviceMarker {}
94pub type InputDeviceSendOutputReportResult = Result<(), i32>;
95pub type InputDeviceGetFeatureReportResult = Result<FeatureReport, i32>;
96pub type InputDeviceSetFeatureReportResult = Result<(), i32>;
97pub type InputDeviceGetInputReportResult = Result<InputReport, i32>;
98
99pub trait InputDeviceProxyInterface: Send + Sync {
100    fn r#get_input_reports_reader(
101        &self,
102        reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
103    ) -> Result<(), fidl::Error>;
104    type GetDescriptorResponseFut: std::future::Future<Output = Result<DeviceDescriptor, fidl::Error>>
105        + Send;
106    fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut;
107    type SendOutputReportResponseFut: std::future::Future<Output = Result<InputDeviceSendOutputReportResult, fidl::Error>>
108        + Send;
109    fn r#send_output_report(&self, report: &OutputReport) -> Self::SendOutputReportResponseFut;
110    type GetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceGetFeatureReportResult, fidl::Error>>
111        + Send;
112    fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut;
113    type SetFeatureReportResponseFut: std::future::Future<Output = Result<InputDeviceSetFeatureReportResult, fidl::Error>>
114        + Send;
115    fn r#set_feature_report(&self, report: &FeatureReport) -> Self::SetFeatureReportResponseFut;
116    type GetInputReportResponseFut: std::future::Future<Output = Result<InputDeviceGetInputReportResult, fidl::Error>>
117        + Send;
118    fn r#get_input_report(&self, device_type: DeviceType) -> Self::GetInputReportResponseFut;
119}
120#[derive(Debug)]
121#[cfg(target_os = "fuchsia")]
122pub struct InputDeviceSynchronousProxy {
123    client: fidl::client::sync::Client,
124}
125
126#[cfg(target_os = "fuchsia")]
127impl fidl::endpoints::SynchronousProxy for InputDeviceSynchronousProxy {
128    type Proxy = InputDeviceProxy;
129    type Protocol = InputDeviceMarker;
130
131    fn from_channel(inner: fidl::Channel) -> Self {
132        Self::new(inner)
133    }
134
135    fn into_channel(self) -> fidl::Channel {
136        self.client.into_channel()
137    }
138
139    fn as_channel(&self) -> &fidl::Channel {
140        self.client.as_channel()
141    }
142}
143
144#[cfg(target_os = "fuchsia")]
145impl InputDeviceSynchronousProxy {
146    pub fn new(channel: fidl::Channel) -> Self {
147        Self { client: fidl::client::sync::Client::new(channel) }
148    }
149
150    pub fn into_channel(self) -> fidl::Channel {
151        self.client.into_channel()
152    }
153
154    /// Waits until an event arrives and returns it. It is safe for other
155    /// threads to make concurrent requests while waiting for an event.
156    pub fn wait_for_event(
157        &self,
158        deadline: zx::MonotonicInstant,
159    ) -> Result<InputDeviceEvent, fidl::Error> {
160        InputDeviceEvent::decode(self.client.wait_for_event::<InputDeviceMarker>(deadline)?)
161    }
162
163    /// Open a new InputReportsReader on this device. Each reader receives
164    /// their own reports.
165    pub fn r#get_input_reports_reader(
166        &self,
167        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
168    ) -> Result<(), fidl::Error> {
169        self.client.send::<InputDeviceGetInputReportsReaderRequest>(
170            (reader,),
171            0x68d9cf83e397ab41,
172            fidl::encoding::DynamicFlags::empty(),
173        )
174    }
175
176    /// Gets the device descriptor for this device.
177    pub fn r#get_descriptor(
178        &self,
179        ___deadline: zx::MonotonicInstant,
180    ) -> Result<DeviceDescriptor, fidl::Error> {
181        let _response = self.client.send_query::<
182            fidl::encoding::EmptyPayload,
183            InputDeviceGetDescriptorResponse,
184            InputDeviceMarker,
185        >(
186            (),
187            0x3d76420f2ff8ad32,
188            fidl::encoding::DynamicFlags::empty(),
189            ___deadline,
190        )?;
191        Ok(_response.descriptor)
192    }
193
194    /// Send a single output report to the device. This will throw an error
195    /// if the output report does not follow the OutputDescriptor.
196    pub fn r#send_output_report(
197        &self,
198        mut report: &OutputReport,
199        ___deadline: zx::MonotonicInstant,
200    ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
201        let _response = self.client.send_query::<
202            InputDeviceSendOutputReportRequest,
203            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
204            InputDeviceMarker,
205        >(
206            (report,),
207            0x67a4888774e6f3a,
208            fidl::encoding::DynamicFlags::empty(),
209            ___deadline,
210        )?;
211        Ok(_response.map(|x| x))
212    }
213
214    /// Get the feature report for a given device. This requests the state of
215    /// the device's features.
216    pub fn r#get_feature_report(
217        &self,
218        ___deadline: zx::MonotonicInstant,
219    ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
220        let _response = self.client.send_query::<
221            fidl::encoding::EmptyPayload,
222            fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
223            InputDeviceMarker,
224        >(
225            (),
226            0x497a7d98d9391f16,
227            fidl::encoding::DynamicFlags::empty(),
228            ___deadline,
229        )?;
230        Ok(_response.map(|x| x.report))
231    }
232
233    /// Set the feature report for a given device. This sets the state of
234    /// the device's features.
235    pub fn r#set_feature_report(
236        &self,
237        mut report: &FeatureReport,
238        ___deadline: zx::MonotonicInstant,
239    ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
240        let _response = self.client.send_query::<
241            InputDeviceSetFeatureReportRequest,
242            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
243            InputDeviceMarker,
244        >(
245            (report,),
246            0x7679a2f5a42842ef,
247            fidl::encoding::DynamicFlags::empty(),
248            ___deadline,
249        )?;
250        Ok(_response.map(|x| x))
251    }
252
253    /// For general cases, InputReportReader is the preferred way of getting
254    /// InputReports. For devices that don't send InputReports naturally, this
255    /// method can be used to request a report from the device type indicated.
256    /// Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or
257    /// `device_type` are not supported.
258    pub fn r#get_input_report(
259        &self,
260        mut device_type: DeviceType,
261        ___deadline: zx::MonotonicInstant,
262    ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
263        let _response = self.client.send_query::<
264            InputDeviceGetInputReportRequest,
265            fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
266            InputDeviceMarker,
267        >(
268            (device_type,),
269            0x4752ccab96c10248,
270            fidl::encoding::DynamicFlags::empty(),
271            ___deadline,
272        )?;
273        Ok(_response.map(|x| x.report))
274    }
275}
276
277#[cfg(target_os = "fuchsia")]
278impl From<InputDeviceSynchronousProxy> for zx::NullableHandle {
279    fn from(value: InputDeviceSynchronousProxy) -> Self {
280        value.into_channel().into()
281    }
282}
283
284#[cfg(target_os = "fuchsia")]
285impl From<fidl::Channel> for InputDeviceSynchronousProxy {
286    fn from(value: fidl::Channel) -> Self {
287        Self::new(value)
288    }
289}
290
291#[cfg(target_os = "fuchsia")]
292impl fidl::endpoints::FromClient for InputDeviceSynchronousProxy {
293    type Protocol = InputDeviceMarker;
294
295    fn from_client(value: fidl::endpoints::ClientEnd<InputDeviceMarker>) -> Self {
296        Self::new(value.into_channel())
297    }
298}
299
300#[derive(Debug, Clone)]
301pub struct InputDeviceProxy {
302    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
303}
304
305impl fidl::endpoints::Proxy for InputDeviceProxy {
306    type Protocol = InputDeviceMarker;
307
308    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
309        Self::new(inner)
310    }
311
312    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
313        self.client.into_channel().map_err(|client| Self { client })
314    }
315
316    fn as_channel(&self) -> &::fidl::AsyncChannel {
317        self.client.as_channel()
318    }
319}
320
321impl InputDeviceProxy {
322    /// Create a new Proxy for fuchsia.input.report/InputDevice.
323    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
324        let protocol_name = <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
325        Self { client: fidl::client::Client::new(channel, protocol_name) }
326    }
327
328    /// Get a Stream of events from the remote end of the protocol.
329    ///
330    /// # Panics
331    ///
332    /// Panics if the event stream was already taken.
333    pub fn take_event_stream(&self) -> InputDeviceEventStream {
334        InputDeviceEventStream { event_receiver: self.client.take_event_receiver() }
335    }
336
337    /// Open a new InputReportsReader on this device. Each reader receives
338    /// their own reports.
339    pub fn r#get_input_reports_reader(
340        &self,
341        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
342    ) -> Result<(), fidl::Error> {
343        InputDeviceProxyInterface::r#get_input_reports_reader(self, reader)
344    }
345
346    /// Gets the device descriptor for this device.
347    pub fn r#get_descriptor(
348        &self,
349    ) -> fidl::client::QueryResponseFut<
350        DeviceDescriptor,
351        fidl::encoding::DefaultFuchsiaResourceDialect,
352    > {
353        InputDeviceProxyInterface::r#get_descriptor(self)
354    }
355
356    /// Send a single output report to the device. This will throw an error
357    /// if the output report does not follow the OutputDescriptor.
358    pub fn r#send_output_report(
359        &self,
360        mut report: &OutputReport,
361    ) -> fidl::client::QueryResponseFut<
362        InputDeviceSendOutputReportResult,
363        fidl::encoding::DefaultFuchsiaResourceDialect,
364    > {
365        InputDeviceProxyInterface::r#send_output_report(self, report)
366    }
367
368    /// Get the feature report for a given device. This requests the state of
369    /// the device's features.
370    pub fn r#get_feature_report(
371        &self,
372    ) -> fidl::client::QueryResponseFut<
373        InputDeviceGetFeatureReportResult,
374        fidl::encoding::DefaultFuchsiaResourceDialect,
375    > {
376        InputDeviceProxyInterface::r#get_feature_report(self)
377    }
378
379    /// Set the feature report for a given device. This sets the state of
380    /// the device's features.
381    pub fn r#set_feature_report(
382        &self,
383        mut report: &FeatureReport,
384    ) -> fidl::client::QueryResponseFut<
385        InputDeviceSetFeatureReportResult,
386        fidl::encoding::DefaultFuchsiaResourceDialect,
387    > {
388        InputDeviceProxyInterface::r#set_feature_report(self, report)
389    }
390
391    /// For general cases, InputReportReader is the preferred way of getting
392    /// InputReports. For devices that don't send InputReports naturally, this
393    /// method can be used to request a report from the device type indicated.
394    /// Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or
395    /// `device_type` are not supported.
396    pub fn r#get_input_report(
397        &self,
398        mut device_type: DeviceType,
399    ) -> fidl::client::QueryResponseFut<
400        InputDeviceGetInputReportResult,
401        fidl::encoding::DefaultFuchsiaResourceDialect,
402    > {
403        InputDeviceProxyInterface::r#get_input_report(self, device_type)
404    }
405}
406
407impl InputDeviceProxyInterface for InputDeviceProxy {
408    fn r#get_input_reports_reader(
409        &self,
410        mut reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
411    ) -> Result<(), fidl::Error> {
412        self.client.send::<InputDeviceGetInputReportsReaderRequest>(
413            (reader,),
414            0x68d9cf83e397ab41,
415            fidl::encoding::DynamicFlags::empty(),
416        )
417    }
418
419    type GetDescriptorResponseFut = fidl::client::QueryResponseFut<
420        DeviceDescriptor,
421        fidl::encoding::DefaultFuchsiaResourceDialect,
422    >;
423    fn r#get_descriptor(&self) -> Self::GetDescriptorResponseFut {
424        fn _decode(
425            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
426        ) -> Result<DeviceDescriptor, fidl::Error> {
427            let _response = fidl::client::decode_transaction_body::<
428                InputDeviceGetDescriptorResponse,
429                fidl::encoding::DefaultFuchsiaResourceDialect,
430                0x3d76420f2ff8ad32,
431            >(_buf?)?;
432            Ok(_response.descriptor)
433        }
434        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, DeviceDescriptor>(
435            (),
436            0x3d76420f2ff8ad32,
437            fidl::encoding::DynamicFlags::empty(),
438            _decode,
439        )
440    }
441
442    type SendOutputReportResponseFut = fidl::client::QueryResponseFut<
443        InputDeviceSendOutputReportResult,
444        fidl::encoding::DefaultFuchsiaResourceDialect,
445    >;
446    fn r#send_output_report(&self, mut report: &OutputReport) -> Self::SendOutputReportResponseFut {
447        fn _decode(
448            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
449        ) -> Result<InputDeviceSendOutputReportResult, fidl::Error> {
450            let _response = fidl::client::decode_transaction_body::<
451                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
452                fidl::encoding::DefaultFuchsiaResourceDialect,
453                0x67a4888774e6f3a,
454            >(_buf?)?;
455            Ok(_response.map(|x| x))
456        }
457        self.client.send_query_and_decode::<
458            InputDeviceSendOutputReportRequest,
459            InputDeviceSendOutputReportResult,
460        >(
461            (report,),
462            0x67a4888774e6f3a,
463            fidl::encoding::DynamicFlags::empty(),
464            _decode,
465        )
466    }
467
468    type GetFeatureReportResponseFut = fidl::client::QueryResponseFut<
469        InputDeviceGetFeatureReportResult,
470        fidl::encoding::DefaultFuchsiaResourceDialect,
471    >;
472    fn r#get_feature_report(&self) -> Self::GetFeatureReportResponseFut {
473        fn _decode(
474            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
475        ) -> Result<InputDeviceGetFeatureReportResult, fidl::Error> {
476            let _response = fidl::client::decode_transaction_body::<
477                fidl::encoding::ResultType<InputDeviceGetFeatureReportResponse, i32>,
478                fidl::encoding::DefaultFuchsiaResourceDialect,
479                0x497a7d98d9391f16,
480            >(_buf?)?;
481            Ok(_response.map(|x| x.report))
482        }
483        self.client.send_query_and_decode::<
484            fidl::encoding::EmptyPayload,
485            InputDeviceGetFeatureReportResult,
486        >(
487            (),
488            0x497a7d98d9391f16,
489            fidl::encoding::DynamicFlags::empty(),
490            _decode,
491        )
492    }
493
494    type SetFeatureReportResponseFut = fidl::client::QueryResponseFut<
495        InputDeviceSetFeatureReportResult,
496        fidl::encoding::DefaultFuchsiaResourceDialect,
497    >;
498    fn r#set_feature_report(
499        &self,
500        mut report: &FeatureReport,
501    ) -> Self::SetFeatureReportResponseFut {
502        fn _decode(
503            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
504        ) -> Result<InputDeviceSetFeatureReportResult, fidl::Error> {
505            let _response = fidl::client::decode_transaction_body::<
506                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
507                fidl::encoding::DefaultFuchsiaResourceDialect,
508                0x7679a2f5a42842ef,
509            >(_buf?)?;
510            Ok(_response.map(|x| x))
511        }
512        self.client.send_query_and_decode::<
513            InputDeviceSetFeatureReportRequest,
514            InputDeviceSetFeatureReportResult,
515        >(
516            (report,),
517            0x7679a2f5a42842ef,
518            fidl::encoding::DynamicFlags::empty(),
519            _decode,
520        )
521    }
522
523    type GetInputReportResponseFut = fidl::client::QueryResponseFut<
524        InputDeviceGetInputReportResult,
525        fidl::encoding::DefaultFuchsiaResourceDialect,
526    >;
527    fn r#get_input_report(&self, mut device_type: DeviceType) -> Self::GetInputReportResponseFut {
528        fn _decode(
529            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
530        ) -> Result<InputDeviceGetInputReportResult, fidl::Error> {
531            let _response = fidl::client::decode_transaction_body::<
532                fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>,
533                fidl::encoding::DefaultFuchsiaResourceDialect,
534                0x4752ccab96c10248,
535            >(_buf?)?;
536            Ok(_response.map(|x| x.report))
537        }
538        self.client.send_query_and_decode::<
539            InputDeviceGetInputReportRequest,
540            InputDeviceGetInputReportResult,
541        >(
542            (device_type,),
543            0x4752ccab96c10248,
544            fidl::encoding::DynamicFlags::empty(),
545            _decode,
546        )
547    }
548}
549
550pub struct InputDeviceEventStream {
551    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
552}
553
554impl std::marker::Unpin for InputDeviceEventStream {}
555
556impl futures::stream::FusedStream for InputDeviceEventStream {
557    fn is_terminated(&self) -> bool {
558        self.event_receiver.is_terminated()
559    }
560}
561
562impl futures::Stream for InputDeviceEventStream {
563    type Item = Result<InputDeviceEvent, fidl::Error>;
564
565    fn poll_next(
566        mut self: std::pin::Pin<&mut Self>,
567        cx: &mut std::task::Context<'_>,
568    ) -> std::task::Poll<Option<Self::Item>> {
569        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
570            &mut self.event_receiver,
571            cx
572        )?) {
573            Some(buf) => std::task::Poll::Ready(Some(InputDeviceEvent::decode(buf))),
574            None => std::task::Poll::Ready(None),
575        }
576    }
577}
578
579#[derive(Debug)]
580pub enum InputDeviceEvent {
581    #[non_exhaustive]
582    _UnknownEvent {
583        /// Ordinal of the event that was sent.
584        ordinal: u64,
585    },
586}
587
588impl InputDeviceEvent {
589    /// Decodes a message buffer as a [`InputDeviceEvent`].
590    fn decode(
591        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
592    ) -> Result<InputDeviceEvent, fidl::Error> {
593        let (bytes, _handles) = buf.split_mut();
594        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
595        debug_assert_eq!(tx_header.tx_id, 0);
596        match tx_header.ordinal {
597            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
598                Ok(InputDeviceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
599            }
600            _ => Err(fidl::Error::UnknownOrdinal {
601                ordinal: tx_header.ordinal,
602                protocol_name: <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
603            }),
604        }
605    }
606}
607
608/// A Stream of incoming requests for fuchsia.input.report/InputDevice.
609pub struct InputDeviceRequestStream {
610    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
611    is_terminated: bool,
612}
613
614impl std::marker::Unpin for InputDeviceRequestStream {}
615
616impl futures::stream::FusedStream for InputDeviceRequestStream {
617    fn is_terminated(&self) -> bool {
618        self.is_terminated
619    }
620}
621
622impl fidl::endpoints::RequestStream for InputDeviceRequestStream {
623    type Protocol = InputDeviceMarker;
624    type ControlHandle = InputDeviceControlHandle;
625
626    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
627        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
628    }
629
630    fn control_handle(&self) -> Self::ControlHandle {
631        InputDeviceControlHandle { inner: self.inner.clone() }
632    }
633
634    fn into_inner(
635        self,
636    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
637    {
638        (self.inner, self.is_terminated)
639    }
640
641    fn from_inner(
642        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
643        is_terminated: bool,
644    ) -> Self {
645        Self { inner, is_terminated }
646    }
647}
648
649impl futures::Stream for InputDeviceRequestStream {
650    type Item = Result<InputDeviceRequest, fidl::Error>;
651
652    fn poll_next(
653        mut self: std::pin::Pin<&mut Self>,
654        cx: &mut std::task::Context<'_>,
655    ) -> std::task::Poll<Option<Self::Item>> {
656        let this = &mut *self;
657        if this.inner.check_shutdown(cx) {
658            this.is_terminated = true;
659            return std::task::Poll::Ready(None);
660        }
661        if this.is_terminated {
662            panic!("polled InputDeviceRequestStream after completion");
663        }
664        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
665            |bytes, handles| {
666                match this.inner.channel().read_etc(cx, bytes, handles) {
667                    std::task::Poll::Ready(Ok(())) => {}
668                    std::task::Poll::Pending => return std::task::Poll::Pending,
669                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
670                        this.is_terminated = true;
671                        return std::task::Poll::Ready(None);
672                    }
673                    std::task::Poll::Ready(Err(e)) => {
674                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
675                            e.into(),
676                        ))));
677                    }
678                }
679
680                // A message has been received from the channel
681                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
682
683                std::task::Poll::Ready(Some(match header.ordinal {
684                    0x68d9cf83e397ab41 => {
685                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
686                        let mut req = fidl::new_empty!(
687                            InputDeviceGetInputReportsReaderRequest,
688                            fidl::encoding::DefaultFuchsiaResourceDialect
689                        );
690                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportsReaderRequest>(&header, _body_bytes, handles, &mut req)?;
691                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
692                        Ok(InputDeviceRequest::GetInputReportsReader {
693                            reader: req.reader,
694
695                            control_handle,
696                        })
697                    }
698                    0x3d76420f2ff8ad32 => {
699                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
700                        let mut req = fidl::new_empty!(
701                            fidl::encoding::EmptyPayload,
702                            fidl::encoding::DefaultFuchsiaResourceDialect
703                        );
704                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
705                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
706                        Ok(InputDeviceRequest::GetDescriptor {
707                            responder: InputDeviceGetDescriptorResponder {
708                                control_handle: std::mem::ManuallyDrop::new(control_handle),
709                                tx_id: header.tx_id,
710                            },
711                        })
712                    }
713                    0x67a4888774e6f3a => {
714                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
715                        let mut req = fidl::new_empty!(
716                            InputDeviceSendOutputReportRequest,
717                            fidl::encoding::DefaultFuchsiaResourceDialect
718                        );
719                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSendOutputReportRequest>(&header, _body_bytes, handles, &mut req)?;
720                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
721                        Ok(InputDeviceRequest::SendOutputReport {
722                            report: req.report,
723
724                            responder: InputDeviceSendOutputReportResponder {
725                                control_handle: std::mem::ManuallyDrop::new(control_handle),
726                                tx_id: header.tx_id,
727                            },
728                        })
729                    }
730                    0x497a7d98d9391f16 => {
731                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
732                        let mut req = fidl::new_empty!(
733                            fidl::encoding::EmptyPayload,
734                            fidl::encoding::DefaultFuchsiaResourceDialect
735                        );
736                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
737                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
738                        Ok(InputDeviceRequest::GetFeatureReport {
739                            responder: InputDeviceGetFeatureReportResponder {
740                                control_handle: std::mem::ManuallyDrop::new(control_handle),
741                                tx_id: header.tx_id,
742                            },
743                        })
744                    }
745                    0x7679a2f5a42842ef => {
746                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
747                        let mut req = fidl::new_empty!(
748                            InputDeviceSetFeatureReportRequest,
749                            fidl::encoding::DefaultFuchsiaResourceDialect
750                        );
751                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceSetFeatureReportRequest>(&header, _body_bytes, handles, &mut req)?;
752                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
753                        Ok(InputDeviceRequest::SetFeatureReport {
754                            report: req.report,
755
756                            responder: InputDeviceSetFeatureReportResponder {
757                                control_handle: std::mem::ManuallyDrop::new(control_handle),
758                                tx_id: header.tx_id,
759                            },
760                        })
761                    }
762                    0x4752ccab96c10248 => {
763                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
764                        let mut req = fidl::new_empty!(
765                            InputDeviceGetInputReportRequest,
766                            fidl::encoding::DefaultFuchsiaResourceDialect
767                        );
768                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InputDeviceGetInputReportRequest>(&header, _body_bytes, handles, &mut req)?;
769                        let control_handle = InputDeviceControlHandle { inner: this.inner.clone() };
770                        Ok(InputDeviceRequest::GetInputReport {
771                            device_type: req.device_type,
772
773                            responder: InputDeviceGetInputReportResponder {
774                                control_handle: std::mem::ManuallyDrop::new(control_handle),
775                                tx_id: header.tx_id,
776                            },
777                        })
778                    }
779                    _ if header.tx_id == 0
780                        && header
781                            .dynamic_flags()
782                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
783                    {
784                        Ok(InputDeviceRequest::_UnknownMethod {
785                            ordinal: header.ordinal,
786                            control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
787                            method_type: fidl::MethodType::OneWay,
788                        })
789                    }
790                    _ if header
791                        .dynamic_flags()
792                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
793                    {
794                        this.inner.send_framework_err(
795                            fidl::encoding::FrameworkErr::UnknownMethod,
796                            header.tx_id,
797                            header.ordinal,
798                            header.dynamic_flags(),
799                            (bytes, handles),
800                        )?;
801                        Ok(InputDeviceRequest::_UnknownMethod {
802                            ordinal: header.ordinal,
803                            control_handle: InputDeviceControlHandle { inner: this.inner.clone() },
804                            method_type: fidl::MethodType::TwoWay,
805                        })
806                    }
807                    _ => Err(fidl::Error::UnknownOrdinal {
808                        ordinal: header.ordinal,
809                        protocol_name:
810                            <InputDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
811                    }),
812                }))
813            },
814        )
815    }
816}
817
818/// An `InputDevice` driver represents a single physical input device.
819/// The InputDevice maintains an internal FIFO of `MAX_DEVICE_REPORT_COUNT`
820/// reports for each client that connects. Reports are removed from the FIFO
821/// once they are read by the client. If the FIFO is full, it will drop the
822/// oldest report to make room for an incoming report.
823#[derive(Debug)]
824pub enum InputDeviceRequest {
825    /// Open a new InputReportsReader on this device. Each reader receives
826    /// their own reports.
827    GetInputReportsReader {
828        reader: fidl::endpoints::ServerEnd<InputReportsReaderMarker>,
829        control_handle: InputDeviceControlHandle,
830    },
831    /// Gets the device descriptor for this device.
832    GetDescriptor { responder: InputDeviceGetDescriptorResponder },
833    /// Send a single output report to the device. This will throw an error
834    /// if the output report does not follow the OutputDescriptor.
835    SendOutputReport { report: OutputReport, responder: InputDeviceSendOutputReportResponder },
836    /// Get the feature report for a given device. This requests the state of
837    /// the device's features.
838    GetFeatureReport { responder: InputDeviceGetFeatureReportResponder },
839    /// Set the feature report for a given device. This sets the state of
840    /// the device's features.
841    SetFeatureReport { report: FeatureReport, responder: InputDeviceSetFeatureReportResponder },
842    /// For general cases, InputReportReader is the preferred way of getting
843    /// InputReports. For devices that don't send InputReports naturally, this
844    /// method can be used to request a report from the device type indicated.
845    /// Does not block, and returns ZX_ERR_NOT_SUPPORTED if `GetInputReport` or
846    /// `device_type` are not supported.
847    GetInputReport { device_type: DeviceType, responder: InputDeviceGetInputReportResponder },
848    /// An interaction was received which does not match any known method.
849    #[non_exhaustive]
850    _UnknownMethod {
851        /// Ordinal of the method that was called.
852        ordinal: u64,
853        control_handle: InputDeviceControlHandle,
854        method_type: fidl::MethodType,
855    },
856}
857
858impl InputDeviceRequest {
859    #[allow(irrefutable_let_patterns)]
860    pub fn into_get_input_reports_reader(
861        self,
862    ) -> Option<(fidl::endpoints::ServerEnd<InputReportsReaderMarker>, InputDeviceControlHandle)>
863    {
864        if let InputDeviceRequest::GetInputReportsReader { reader, control_handle } = self {
865            Some((reader, control_handle))
866        } else {
867            None
868        }
869    }
870
871    #[allow(irrefutable_let_patterns)]
872    pub fn into_get_descriptor(self) -> Option<(InputDeviceGetDescriptorResponder)> {
873        if let InputDeviceRequest::GetDescriptor { responder } = self {
874            Some((responder))
875        } else {
876            None
877        }
878    }
879
880    #[allow(irrefutable_let_patterns)]
881    pub fn into_send_output_report(
882        self,
883    ) -> Option<(OutputReport, InputDeviceSendOutputReportResponder)> {
884        if let InputDeviceRequest::SendOutputReport { report, responder } = self {
885            Some((report, responder))
886        } else {
887            None
888        }
889    }
890
891    #[allow(irrefutable_let_patterns)]
892    pub fn into_get_feature_report(self) -> Option<(InputDeviceGetFeatureReportResponder)> {
893        if let InputDeviceRequest::GetFeatureReport { responder } = self {
894            Some((responder))
895        } else {
896            None
897        }
898    }
899
900    #[allow(irrefutable_let_patterns)]
901    pub fn into_set_feature_report(
902        self,
903    ) -> Option<(FeatureReport, InputDeviceSetFeatureReportResponder)> {
904        if let InputDeviceRequest::SetFeatureReport { report, responder } = self {
905            Some((report, responder))
906        } else {
907            None
908        }
909    }
910
911    #[allow(irrefutable_let_patterns)]
912    pub fn into_get_input_report(self) -> Option<(DeviceType, InputDeviceGetInputReportResponder)> {
913        if let InputDeviceRequest::GetInputReport { device_type, responder } = self {
914            Some((device_type, responder))
915        } else {
916            None
917        }
918    }
919
920    /// Name of the method defined in FIDL
921    pub fn method_name(&self) -> &'static str {
922        match *self {
923            InputDeviceRequest::GetInputReportsReader { .. } => "get_input_reports_reader",
924            InputDeviceRequest::GetDescriptor { .. } => "get_descriptor",
925            InputDeviceRequest::SendOutputReport { .. } => "send_output_report",
926            InputDeviceRequest::GetFeatureReport { .. } => "get_feature_report",
927            InputDeviceRequest::SetFeatureReport { .. } => "set_feature_report",
928            InputDeviceRequest::GetInputReport { .. } => "get_input_report",
929            InputDeviceRequest::_UnknownMethod {
930                method_type: fidl::MethodType::OneWay, ..
931            } => "unknown one-way method",
932            InputDeviceRequest::_UnknownMethod {
933                method_type: fidl::MethodType::TwoWay, ..
934            } => "unknown two-way method",
935        }
936    }
937}
938
939#[derive(Debug, Clone)]
940pub struct InputDeviceControlHandle {
941    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
942}
943
944impl fidl::endpoints::ControlHandle for InputDeviceControlHandle {
945    fn shutdown(&self) {
946        self.inner.shutdown()
947    }
948
949    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
950        self.inner.shutdown_with_epitaph(status)
951    }
952
953    fn is_closed(&self) -> bool {
954        self.inner.channel().is_closed()
955    }
956    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
957        self.inner.channel().on_closed()
958    }
959
960    #[cfg(target_os = "fuchsia")]
961    fn signal_peer(
962        &self,
963        clear_mask: zx::Signals,
964        set_mask: zx::Signals,
965    ) -> Result<(), zx_status::Status> {
966        use fidl::Peered;
967        self.inner.channel().signal_peer(clear_mask, set_mask)
968    }
969}
970
971impl InputDeviceControlHandle {}
972
973#[must_use = "FIDL methods require a response to be sent"]
974#[derive(Debug)]
975pub struct InputDeviceGetDescriptorResponder {
976    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
977    tx_id: u32,
978}
979
980/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
981/// if the responder is dropped without sending a response, so that the client
982/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
983impl std::ops::Drop for InputDeviceGetDescriptorResponder {
984    fn drop(&mut self) {
985        self.control_handle.shutdown();
986        // Safety: drops once, never accessed again
987        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
988    }
989}
990
991impl fidl::endpoints::Responder for InputDeviceGetDescriptorResponder {
992    type ControlHandle = InputDeviceControlHandle;
993
994    fn control_handle(&self) -> &InputDeviceControlHandle {
995        &self.control_handle
996    }
997
998    fn drop_without_shutdown(mut self) {
999        // Safety: drops once, never accessed again due to mem::forget
1000        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1001        // Prevent Drop from running (which would shut down the channel)
1002        std::mem::forget(self);
1003    }
1004}
1005
1006impl InputDeviceGetDescriptorResponder {
1007    /// Sends a response to the FIDL transaction.
1008    ///
1009    /// Sets the channel to shutdown if an error occurs.
1010    pub fn send(self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1011        let _result = self.send_raw(descriptor);
1012        if _result.is_err() {
1013            self.control_handle.shutdown();
1014        }
1015        self.drop_without_shutdown();
1016        _result
1017    }
1018
1019    /// Similar to "send" but does not shutdown the channel if an error occurs.
1020    pub fn send_no_shutdown_on_err(
1021        self,
1022        mut descriptor: &DeviceDescriptor,
1023    ) -> Result<(), fidl::Error> {
1024        let _result = self.send_raw(descriptor);
1025        self.drop_without_shutdown();
1026        _result
1027    }
1028
1029    fn send_raw(&self, mut descriptor: &DeviceDescriptor) -> Result<(), fidl::Error> {
1030        self.control_handle.inner.send::<InputDeviceGetDescriptorResponse>(
1031            (descriptor,),
1032            self.tx_id,
1033            0x3d76420f2ff8ad32,
1034            fidl::encoding::DynamicFlags::empty(),
1035        )
1036    }
1037}
1038
1039#[must_use = "FIDL methods require a response to be sent"]
1040#[derive(Debug)]
1041pub struct InputDeviceSendOutputReportResponder {
1042    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1043    tx_id: u32,
1044}
1045
1046/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1047/// if the responder is dropped without sending a response, so that the client
1048/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1049impl std::ops::Drop for InputDeviceSendOutputReportResponder {
1050    fn drop(&mut self) {
1051        self.control_handle.shutdown();
1052        // Safety: drops once, never accessed again
1053        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1054    }
1055}
1056
1057impl fidl::endpoints::Responder for InputDeviceSendOutputReportResponder {
1058    type ControlHandle = InputDeviceControlHandle;
1059
1060    fn control_handle(&self) -> &InputDeviceControlHandle {
1061        &self.control_handle
1062    }
1063
1064    fn drop_without_shutdown(mut self) {
1065        // Safety: drops once, never accessed again due to mem::forget
1066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1067        // Prevent Drop from running (which would shut down the channel)
1068        std::mem::forget(self);
1069    }
1070}
1071
1072impl InputDeviceSendOutputReportResponder {
1073    /// Sends a response to the FIDL transaction.
1074    ///
1075    /// Sets the channel to shutdown if an error occurs.
1076    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1077        let _result = self.send_raw(result);
1078        if _result.is_err() {
1079            self.control_handle.shutdown();
1080        }
1081        self.drop_without_shutdown();
1082        _result
1083    }
1084
1085    /// Similar to "send" but does not shutdown the channel if an error occurs.
1086    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1087        let _result = self.send_raw(result);
1088        self.drop_without_shutdown();
1089        _result
1090    }
1091
1092    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1093        self.control_handle
1094            .inner
1095            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1096                result,
1097                self.tx_id,
1098                0x67a4888774e6f3a,
1099                fidl::encoding::DynamicFlags::empty(),
1100            )
1101    }
1102}
1103
1104#[must_use = "FIDL methods require a response to be sent"]
1105#[derive(Debug)]
1106pub struct InputDeviceGetFeatureReportResponder {
1107    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1108    tx_id: u32,
1109}
1110
1111/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1112/// if the responder is dropped without sending a response, so that the client
1113/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1114impl std::ops::Drop for InputDeviceGetFeatureReportResponder {
1115    fn drop(&mut self) {
1116        self.control_handle.shutdown();
1117        // Safety: drops once, never accessed again
1118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1119    }
1120}
1121
1122impl fidl::endpoints::Responder for InputDeviceGetFeatureReportResponder {
1123    type ControlHandle = InputDeviceControlHandle;
1124
1125    fn control_handle(&self) -> &InputDeviceControlHandle {
1126        &self.control_handle
1127    }
1128
1129    fn drop_without_shutdown(mut self) {
1130        // Safety: drops once, never accessed again due to mem::forget
1131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132        // Prevent Drop from running (which would shut down the channel)
1133        std::mem::forget(self);
1134    }
1135}
1136
1137impl InputDeviceGetFeatureReportResponder {
1138    /// Sends a response to the FIDL transaction.
1139    ///
1140    /// Sets the channel to shutdown if an error occurs.
1141    pub fn send(self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1142        let _result = self.send_raw(result);
1143        if _result.is_err() {
1144            self.control_handle.shutdown();
1145        }
1146        self.drop_without_shutdown();
1147        _result
1148    }
1149
1150    /// Similar to "send" but does not shutdown the channel if an error occurs.
1151    pub fn send_no_shutdown_on_err(
1152        self,
1153        mut result: Result<&FeatureReport, i32>,
1154    ) -> Result<(), fidl::Error> {
1155        let _result = self.send_raw(result);
1156        self.drop_without_shutdown();
1157        _result
1158    }
1159
1160    fn send_raw(&self, mut result: Result<&FeatureReport, i32>) -> Result<(), fidl::Error> {
1161        self.control_handle.inner.send::<fidl::encoding::ResultType<
1162            InputDeviceGetFeatureReportResponse,
1163            i32,
1164        >>(
1165            result.map(|report| (report,)),
1166            self.tx_id,
1167            0x497a7d98d9391f16,
1168            fidl::encoding::DynamicFlags::empty(),
1169        )
1170    }
1171}
1172
1173#[must_use = "FIDL methods require a response to be sent"]
1174#[derive(Debug)]
1175pub struct InputDeviceSetFeatureReportResponder {
1176    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1177    tx_id: u32,
1178}
1179
1180/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1181/// if the responder is dropped without sending a response, so that the client
1182/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1183impl std::ops::Drop for InputDeviceSetFeatureReportResponder {
1184    fn drop(&mut self) {
1185        self.control_handle.shutdown();
1186        // Safety: drops once, never accessed again
1187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1188    }
1189}
1190
1191impl fidl::endpoints::Responder for InputDeviceSetFeatureReportResponder {
1192    type ControlHandle = InputDeviceControlHandle;
1193
1194    fn control_handle(&self) -> &InputDeviceControlHandle {
1195        &self.control_handle
1196    }
1197
1198    fn drop_without_shutdown(mut self) {
1199        // Safety: drops once, never accessed again due to mem::forget
1200        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1201        // Prevent Drop from running (which would shut down the channel)
1202        std::mem::forget(self);
1203    }
1204}
1205
1206impl InputDeviceSetFeatureReportResponder {
1207    /// Sends a response to the FIDL transaction.
1208    ///
1209    /// Sets the channel to shutdown if an error occurs.
1210    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1211        let _result = self.send_raw(result);
1212        if _result.is_err() {
1213            self.control_handle.shutdown();
1214        }
1215        self.drop_without_shutdown();
1216        _result
1217    }
1218
1219    /// Similar to "send" but does not shutdown the channel if an error occurs.
1220    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1221        let _result = self.send_raw(result);
1222        self.drop_without_shutdown();
1223        _result
1224    }
1225
1226    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1227        self.control_handle
1228            .inner
1229            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1230                result,
1231                self.tx_id,
1232                0x7679a2f5a42842ef,
1233                fidl::encoding::DynamicFlags::empty(),
1234            )
1235    }
1236}
1237
1238#[must_use = "FIDL methods require a response to be sent"]
1239#[derive(Debug)]
1240pub struct InputDeviceGetInputReportResponder {
1241    control_handle: std::mem::ManuallyDrop<InputDeviceControlHandle>,
1242    tx_id: u32,
1243}
1244
1245/// Set the the channel to be shutdown (see [`InputDeviceControlHandle::shutdown`])
1246/// if the responder is dropped without sending a response, so that the client
1247/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1248impl std::ops::Drop for InputDeviceGetInputReportResponder {
1249    fn drop(&mut self) {
1250        self.control_handle.shutdown();
1251        // Safety: drops once, never accessed again
1252        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1253    }
1254}
1255
1256impl fidl::endpoints::Responder for InputDeviceGetInputReportResponder {
1257    type ControlHandle = InputDeviceControlHandle;
1258
1259    fn control_handle(&self) -> &InputDeviceControlHandle {
1260        &self.control_handle
1261    }
1262
1263    fn drop_without_shutdown(mut self) {
1264        // Safety: drops once, never accessed again due to mem::forget
1265        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1266        // Prevent Drop from running (which would shut down the channel)
1267        std::mem::forget(self);
1268    }
1269}
1270
1271impl InputDeviceGetInputReportResponder {
1272    /// Sends a response to the FIDL transaction.
1273    ///
1274    /// Sets the channel to shutdown if an error occurs.
1275    pub fn send(self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1276        let _result = self.send_raw(result);
1277        if _result.is_err() {
1278            self.control_handle.shutdown();
1279        }
1280        self.drop_without_shutdown();
1281        _result
1282    }
1283
1284    /// Similar to "send" but does not shutdown the channel if an error occurs.
1285    pub fn send_no_shutdown_on_err(
1286        self,
1287        mut result: Result<InputReport, i32>,
1288    ) -> Result<(), fidl::Error> {
1289        let _result = self.send_raw(result);
1290        self.drop_without_shutdown();
1291        _result
1292    }
1293
1294    fn send_raw(&self, mut result: Result<InputReport, i32>) -> Result<(), fidl::Error> {
1295        self.control_handle
1296            .inner
1297            .send::<fidl::encoding::ResultType<InputDeviceGetInputReportResponse, i32>>(
1298                result.as_mut().map_err(|e| *e).map(|report| (report,)),
1299                self.tx_id,
1300                0x4752ccab96c10248,
1301                fidl::encoding::DynamicFlags::empty(),
1302            )
1303    }
1304}
1305
1306#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1307pub struct InputReportsReaderMarker;
1308
1309impl fidl::endpoints::ProtocolMarker for InputReportsReaderMarker {
1310    type Proxy = InputReportsReaderProxy;
1311    type RequestStream = InputReportsReaderRequestStream;
1312    #[cfg(target_os = "fuchsia")]
1313    type SynchronousProxy = InputReportsReaderSynchronousProxy;
1314
1315    const DEBUG_NAME: &'static str = "(anonymous) InputReportsReader";
1316}
1317pub type InputReportsReaderReadInputReportsResult = Result<Vec<InputReport>, i32>;
1318
1319pub trait InputReportsReaderProxyInterface: Send + Sync {
1320    type ReadInputReportsResponseFut: std::future::Future<Output = Result<InputReportsReaderReadInputReportsResult, fidl::Error>>
1321        + Send;
1322    fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut;
1323}
1324#[derive(Debug)]
1325#[cfg(target_os = "fuchsia")]
1326pub struct InputReportsReaderSynchronousProxy {
1327    client: fidl::client::sync::Client,
1328}
1329
1330#[cfg(target_os = "fuchsia")]
1331impl fidl::endpoints::SynchronousProxy for InputReportsReaderSynchronousProxy {
1332    type Proxy = InputReportsReaderProxy;
1333    type Protocol = InputReportsReaderMarker;
1334
1335    fn from_channel(inner: fidl::Channel) -> Self {
1336        Self::new(inner)
1337    }
1338
1339    fn into_channel(self) -> fidl::Channel {
1340        self.client.into_channel()
1341    }
1342
1343    fn as_channel(&self) -> &fidl::Channel {
1344        self.client.as_channel()
1345    }
1346}
1347
1348#[cfg(target_os = "fuchsia")]
1349impl InputReportsReaderSynchronousProxy {
1350    pub fn new(channel: fidl::Channel) -> Self {
1351        Self { client: fidl::client::sync::Client::new(channel) }
1352    }
1353
1354    pub fn into_channel(self) -> fidl::Channel {
1355        self.client.into_channel()
1356    }
1357
1358    /// Waits until an event arrives and returns it. It is safe for other
1359    /// threads to make concurrent requests while waiting for an event.
1360    pub fn wait_for_event(
1361        &self,
1362        deadline: zx::MonotonicInstant,
1363    ) -> Result<InputReportsReaderEvent, fidl::Error> {
1364        InputReportsReaderEvent::decode(
1365            self.client.wait_for_event::<InputReportsReaderMarker>(deadline)?,
1366        )
1367    }
1368
1369    /// This is a Hanging-Get function to read the reports in the
1370    /// InputReport FIFO. This will not reply until there is at least one
1371    /// report available.
1372    /// If there is already one outstanding Hanging-Get, calling this
1373    /// again will return ZX_ERR_ALREADY_BOUND.
1374    pub fn r#read_input_reports(
1375        &self,
1376        ___deadline: zx::MonotonicInstant,
1377    ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1378        let _response =
1379            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1380                InputReportsReaderReadInputReportsResponse,
1381                i32,
1382            >, InputReportsReaderMarker>(
1383                (),
1384                0x3595efdc88842559,
1385                fidl::encoding::DynamicFlags::empty(),
1386                ___deadline,
1387            )?;
1388        Ok(_response.map(|x| x.reports))
1389    }
1390}
1391
1392#[cfg(target_os = "fuchsia")]
1393impl From<InputReportsReaderSynchronousProxy> for zx::NullableHandle {
1394    fn from(value: InputReportsReaderSynchronousProxy) -> Self {
1395        value.into_channel().into()
1396    }
1397}
1398
1399#[cfg(target_os = "fuchsia")]
1400impl From<fidl::Channel> for InputReportsReaderSynchronousProxy {
1401    fn from(value: fidl::Channel) -> Self {
1402        Self::new(value)
1403    }
1404}
1405
1406#[cfg(target_os = "fuchsia")]
1407impl fidl::endpoints::FromClient for InputReportsReaderSynchronousProxy {
1408    type Protocol = InputReportsReaderMarker;
1409
1410    fn from_client(value: fidl::endpoints::ClientEnd<InputReportsReaderMarker>) -> Self {
1411        Self::new(value.into_channel())
1412    }
1413}
1414
1415#[derive(Debug, Clone)]
1416pub struct InputReportsReaderProxy {
1417    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1418}
1419
1420impl fidl::endpoints::Proxy for InputReportsReaderProxy {
1421    type Protocol = InputReportsReaderMarker;
1422
1423    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1424        Self::new(inner)
1425    }
1426
1427    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1428        self.client.into_channel().map_err(|client| Self { client })
1429    }
1430
1431    fn as_channel(&self) -> &::fidl::AsyncChannel {
1432        self.client.as_channel()
1433    }
1434}
1435
1436impl InputReportsReaderProxy {
1437    /// Create a new Proxy for fuchsia.input.report/InputReportsReader.
1438    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1439        let protocol_name =
1440            <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1441        Self { client: fidl::client::Client::new(channel, protocol_name) }
1442    }
1443
1444    /// Get a Stream of events from the remote end of the protocol.
1445    ///
1446    /// # Panics
1447    ///
1448    /// Panics if the event stream was already taken.
1449    pub fn take_event_stream(&self) -> InputReportsReaderEventStream {
1450        InputReportsReaderEventStream { event_receiver: self.client.take_event_receiver() }
1451    }
1452
1453    /// This is a Hanging-Get function to read the reports in the
1454    /// InputReport FIFO. This will not reply until there is at least one
1455    /// report available.
1456    /// If there is already one outstanding Hanging-Get, calling this
1457    /// again will return ZX_ERR_ALREADY_BOUND.
1458    pub fn r#read_input_reports(
1459        &self,
1460    ) -> fidl::client::QueryResponseFut<
1461        InputReportsReaderReadInputReportsResult,
1462        fidl::encoding::DefaultFuchsiaResourceDialect,
1463    > {
1464        InputReportsReaderProxyInterface::r#read_input_reports(self)
1465    }
1466}
1467
1468impl InputReportsReaderProxyInterface for InputReportsReaderProxy {
1469    type ReadInputReportsResponseFut = fidl::client::QueryResponseFut<
1470        InputReportsReaderReadInputReportsResult,
1471        fidl::encoding::DefaultFuchsiaResourceDialect,
1472    >;
1473    fn r#read_input_reports(&self) -> Self::ReadInputReportsResponseFut {
1474        fn _decode(
1475            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1476        ) -> Result<InputReportsReaderReadInputReportsResult, fidl::Error> {
1477            let _response = fidl::client::decode_transaction_body::<
1478                fidl::encoding::ResultType<InputReportsReaderReadInputReportsResponse, i32>,
1479                fidl::encoding::DefaultFuchsiaResourceDialect,
1480                0x3595efdc88842559,
1481            >(_buf?)?;
1482            Ok(_response.map(|x| x.reports))
1483        }
1484        self.client.send_query_and_decode::<
1485            fidl::encoding::EmptyPayload,
1486            InputReportsReaderReadInputReportsResult,
1487        >(
1488            (),
1489            0x3595efdc88842559,
1490            fidl::encoding::DynamicFlags::empty(),
1491            _decode,
1492        )
1493    }
1494}
1495
1496pub struct InputReportsReaderEventStream {
1497    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1498}
1499
1500impl std::marker::Unpin for InputReportsReaderEventStream {}
1501
1502impl futures::stream::FusedStream for InputReportsReaderEventStream {
1503    fn is_terminated(&self) -> bool {
1504        self.event_receiver.is_terminated()
1505    }
1506}
1507
1508impl futures::Stream for InputReportsReaderEventStream {
1509    type Item = Result<InputReportsReaderEvent, fidl::Error>;
1510
1511    fn poll_next(
1512        mut self: std::pin::Pin<&mut Self>,
1513        cx: &mut std::task::Context<'_>,
1514    ) -> std::task::Poll<Option<Self::Item>> {
1515        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1516            &mut self.event_receiver,
1517            cx
1518        )?) {
1519            Some(buf) => std::task::Poll::Ready(Some(InputReportsReaderEvent::decode(buf))),
1520            None => std::task::Poll::Ready(None),
1521        }
1522    }
1523}
1524
1525#[derive(Debug)]
1526pub enum InputReportsReaderEvent {}
1527
1528impl InputReportsReaderEvent {
1529    /// Decodes a message buffer as a [`InputReportsReaderEvent`].
1530    fn decode(
1531        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1532    ) -> Result<InputReportsReaderEvent, fidl::Error> {
1533        let (bytes, _handles) = buf.split_mut();
1534        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1535        debug_assert_eq!(tx_header.tx_id, 0);
1536        match tx_header.ordinal {
1537            _ => Err(fidl::Error::UnknownOrdinal {
1538                ordinal: tx_header.ordinal,
1539                protocol_name:
1540                    <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1541            }),
1542        }
1543    }
1544}
1545
1546/// A Stream of incoming requests for fuchsia.input.report/InputReportsReader.
1547pub struct InputReportsReaderRequestStream {
1548    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1549    is_terminated: bool,
1550}
1551
1552impl std::marker::Unpin for InputReportsReaderRequestStream {}
1553
1554impl futures::stream::FusedStream for InputReportsReaderRequestStream {
1555    fn is_terminated(&self) -> bool {
1556        self.is_terminated
1557    }
1558}
1559
1560impl fidl::endpoints::RequestStream for InputReportsReaderRequestStream {
1561    type Protocol = InputReportsReaderMarker;
1562    type ControlHandle = InputReportsReaderControlHandle;
1563
1564    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1565        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1566    }
1567
1568    fn control_handle(&self) -> Self::ControlHandle {
1569        InputReportsReaderControlHandle { inner: self.inner.clone() }
1570    }
1571
1572    fn into_inner(
1573        self,
1574    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1575    {
1576        (self.inner, self.is_terminated)
1577    }
1578
1579    fn from_inner(
1580        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1581        is_terminated: bool,
1582    ) -> Self {
1583        Self { inner, is_terminated }
1584    }
1585}
1586
1587impl futures::Stream for InputReportsReaderRequestStream {
1588    type Item = Result<InputReportsReaderRequest, fidl::Error>;
1589
1590    fn poll_next(
1591        mut self: std::pin::Pin<&mut Self>,
1592        cx: &mut std::task::Context<'_>,
1593    ) -> std::task::Poll<Option<Self::Item>> {
1594        let this = &mut *self;
1595        if this.inner.check_shutdown(cx) {
1596            this.is_terminated = true;
1597            return std::task::Poll::Ready(None);
1598        }
1599        if this.is_terminated {
1600            panic!("polled InputReportsReaderRequestStream after completion");
1601        }
1602        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1603            |bytes, handles| {
1604                match this.inner.channel().read_etc(cx, bytes, handles) {
1605                    std::task::Poll::Ready(Ok(())) => {}
1606                    std::task::Poll::Pending => return std::task::Poll::Pending,
1607                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1608                        this.is_terminated = true;
1609                        return std::task::Poll::Ready(None);
1610                    }
1611                    std::task::Poll::Ready(Err(e)) => {
1612                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1613                            e.into(),
1614                        ))));
1615                    }
1616                }
1617
1618                // A message has been received from the channel
1619                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1620
1621                std::task::Poll::Ready(Some(match header.ordinal {
1622                0x3595efdc88842559 => {
1623                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1624                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1625                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1626                    let control_handle = InputReportsReaderControlHandle {
1627                        inner: this.inner.clone(),
1628                    };
1629                    Ok(InputReportsReaderRequest::ReadInputReports {
1630                        responder: InputReportsReaderReadInputReportsResponder {
1631                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1632                            tx_id: header.tx_id,
1633                        },
1634                    })
1635                }
1636                _ => Err(fidl::Error::UnknownOrdinal {
1637                    ordinal: header.ordinal,
1638                    protocol_name: <InputReportsReaderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1639                }),
1640            }))
1641            },
1642        )
1643    }
1644}
1645
1646/// Each `InputReportsReader` has its own FIFO of InputReports that it maintains.
1647/// When ReadInputReports is called it drains the InputReports FIFO.
1648/// If too many InputReports are created before the FIFO is drained, then
1649/// the oldest InputReport will be silently discarded.
1650#[derive(Debug)]
1651pub enum InputReportsReaderRequest {
1652    /// This is a Hanging-Get function to read the reports in the
1653    /// InputReport FIFO. This will not reply until there is at least one
1654    /// report available.
1655    /// If there is already one outstanding Hanging-Get, calling this
1656    /// again will return ZX_ERR_ALREADY_BOUND.
1657    ReadInputReports { responder: InputReportsReaderReadInputReportsResponder },
1658}
1659
1660impl InputReportsReaderRequest {
1661    #[allow(irrefutable_let_patterns)]
1662    pub fn into_read_input_reports(self) -> Option<(InputReportsReaderReadInputReportsResponder)> {
1663        if let InputReportsReaderRequest::ReadInputReports { responder } = self {
1664            Some((responder))
1665        } else {
1666            None
1667        }
1668    }
1669
1670    /// Name of the method defined in FIDL
1671    pub fn method_name(&self) -> &'static str {
1672        match *self {
1673            InputReportsReaderRequest::ReadInputReports { .. } => "read_input_reports",
1674        }
1675    }
1676}
1677
1678#[derive(Debug, Clone)]
1679pub struct InputReportsReaderControlHandle {
1680    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1681}
1682
1683impl fidl::endpoints::ControlHandle for InputReportsReaderControlHandle {
1684    fn shutdown(&self) {
1685        self.inner.shutdown()
1686    }
1687
1688    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1689        self.inner.shutdown_with_epitaph(status)
1690    }
1691
1692    fn is_closed(&self) -> bool {
1693        self.inner.channel().is_closed()
1694    }
1695    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1696        self.inner.channel().on_closed()
1697    }
1698
1699    #[cfg(target_os = "fuchsia")]
1700    fn signal_peer(
1701        &self,
1702        clear_mask: zx::Signals,
1703        set_mask: zx::Signals,
1704    ) -> Result<(), zx_status::Status> {
1705        use fidl::Peered;
1706        self.inner.channel().signal_peer(clear_mask, set_mask)
1707    }
1708}
1709
1710impl InputReportsReaderControlHandle {}
1711
1712#[must_use = "FIDL methods require a response to be sent"]
1713#[derive(Debug)]
1714pub struct InputReportsReaderReadInputReportsResponder {
1715    control_handle: std::mem::ManuallyDrop<InputReportsReaderControlHandle>,
1716    tx_id: u32,
1717}
1718
1719/// Set the the channel to be shutdown (see [`InputReportsReaderControlHandle::shutdown`])
1720/// if the responder is dropped without sending a response, so that the client
1721/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1722impl std::ops::Drop for InputReportsReaderReadInputReportsResponder {
1723    fn drop(&mut self) {
1724        self.control_handle.shutdown();
1725        // Safety: drops once, never accessed again
1726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1727    }
1728}
1729
1730impl fidl::endpoints::Responder for InputReportsReaderReadInputReportsResponder {
1731    type ControlHandle = InputReportsReaderControlHandle;
1732
1733    fn control_handle(&self) -> &InputReportsReaderControlHandle {
1734        &self.control_handle
1735    }
1736
1737    fn drop_without_shutdown(mut self) {
1738        // Safety: drops once, never accessed again due to mem::forget
1739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1740        // Prevent Drop from running (which would shut down the channel)
1741        std::mem::forget(self);
1742    }
1743}
1744
1745impl InputReportsReaderReadInputReportsResponder {
1746    /// Sends a response to the FIDL transaction.
1747    ///
1748    /// Sets the channel to shutdown if an error occurs.
1749    pub fn send(self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1750        let _result = self.send_raw(result);
1751        if _result.is_err() {
1752            self.control_handle.shutdown();
1753        }
1754        self.drop_without_shutdown();
1755        _result
1756    }
1757
1758    /// Similar to "send" but does not shutdown the channel if an error occurs.
1759    pub fn send_no_shutdown_on_err(
1760        self,
1761        mut result: Result<Vec<InputReport>, i32>,
1762    ) -> Result<(), fidl::Error> {
1763        let _result = self.send_raw(result);
1764        self.drop_without_shutdown();
1765        _result
1766    }
1767
1768    fn send_raw(&self, mut result: Result<Vec<InputReport>, i32>) -> Result<(), fidl::Error> {
1769        self.control_handle.inner.send::<fidl::encoding::ResultType<
1770            InputReportsReaderReadInputReportsResponse,
1771            i32,
1772        >>(
1773            result.as_mut().map_err(|e| *e).map(|reports| (reports.as_mut_slice(),)),
1774            self.tx_id,
1775            0x3595efdc88842559,
1776            fidl::encoding::DynamicFlags::empty(),
1777        )
1778    }
1779}
1780
1781#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1782pub struct ServiceMarker;
1783
1784#[cfg(target_os = "fuchsia")]
1785impl fidl::endpoints::ServiceMarker for ServiceMarker {
1786    type Proxy = ServiceProxy;
1787    type Request = ServiceRequest;
1788    const SERVICE_NAME: &'static str = "fuchsia.input.report.Service";
1789}
1790
1791/// A request for one of the member protocols of Service.
1792///
1793#[cfg(target_os = "fuchsia")]
1794pub enum ServiceRequest {
1795    InputDevice(InputDeviceRequestStream),
1796}
1797
1798#[cfg(target_os = "fuchsia")]
1799impl fidl::endpoints::ServiceRequest for ServiceRequest {
1800    type Service = ServiceMarker;
1801
1802    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1803        match name {
1804            "input_device" => Self::InputDevice(
1805                <InputDeviceRequestStream as fidl::endpoints::RequestStream>::from_channel(
1806                    _channel,
1807                ),
1808            ),
1809            _ => panic!("no such member protocol name for service Service"),
1810        }
1811    }
1812
1813    fn member_names() -> &'static [&'static str] {
1814        &["input_device"]
1815    }
1816}
1817#[cfg(target_os = "fuchsia")]
1818pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1819
1820#[cfg(target_os = "fuchsia")]
1821impl fidl::endpoints::ServiceProxy for ServiceProxy {
1822    type Service = ServiceMarker;
1823
1824    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1825        Self(opener)
1826    }
1827}
1828
1829#[cfg(target_os = "fuchsia")]
1830impl ServiceProxy {
1831    pub fn connect_to_input_device(&self) -> Result<InputDeviceProxy, fidl::Error> {
1832        let (proxy, server_end) = fidl::endpoints::create_proxy::<InputDeviceMarker>();
1833        self.connect_channel_to_input_device(server_end)?;
1834        Ok(proxy)
1835    }
1836
1837    /// Like `connect_to_input_device`, but returns a sync proxy.
1838    /// See [`Self::connect_to_input_device`] for more details.
1839    pub fn connect_to_input_device_sync(&self) -> Result<InputDeviceSynchronousProxy, fidl::Error> {
1840        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<InputDeviceMarker>();
1841        self.connect_channel_to_input_device(server_end)?;
1842        Ok(proxy)
1843    }
1844
1845    /// Like `connect_to_input_device`, but accepts a server end.
1846    /// See [`Self::connect_to_input_device`] for more details.
1847    pub fn connect_channel_to_input_device(
1848        &self,
1849        server_end: fidl::endpoints::ServerEnd<InputDeviceMarker>,
1850    ) -> Result<(), fidl::Error> {
1851        self.0.open_member("input_device", server_end.into_channel())
1852    }
1853
1854    pub fn instance_name(&self) -> &str {
1855        self.0.instance_name()
1856    }
1857}
1858
1859mod internal {
1860    use super::*;
1861
1862    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportsReaderRequest {
1863        type Borrowed<'a> = &'a mut Self;
1864        fn take_or_borrow<'a>(
1865            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1866        ) -> Self::Borrowed<'a> {
1867            value
1868        }
1869    }
1870
1871    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportsReaderRequest {
1872        type Owned = Self;
1873
1874        #[inline(always)]
1875        fn inline_align(_context: fidl::encoding::Context) -> usize {
1876            4
1877        }
1878
1879        #[inline(always)]
1880        fn inline_size(_context: fidl::encoding::Context) -> usize {
1881            4
1882        }
1883    }
1884
1885    unsafe impl
1886        fidl::encoding::Encode<
1887            InputDeviceGetInputReportsReaderRequest,
1888            fidl::encoding::DefaultFuchsiaResourceDialect,
1889        > for &mut InputDeviceGetInputReportsReaderRequest
1890    {
1891        #[inline]
1892        unsafe fn encode(
1893            self,
1894            encoder: &mut fidl::encoding::Encoder<
1895                '_,
1896                fidl::encoding::DefaultFuchsiaResourceDialect,
1897            >,
1898            offset: usize,
1899            _depth: fidl::encoding::Depth,
1900        ) -> fidl::Result<()> {
1901            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1902            // Delegate to tuple encoding.
1903            fidl::encoding::Encode::<InputDeviceGetInputReportsReaderRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1904                (
1905                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reader),
1906                ),
1907                encoder, offset, _depth
1908            )
1909        }
1910    }
1911    unsafe impl<
1912        T0: fidl::encoding::Encode<
1913                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1914                fidl::encoding::DefaultFuchsiaResourceDialect,
1915            >,
1916    >
1917        fidl::encoding::Encode<
1918            InputDeviceGetInputReportsReaderRequest,
1919            fidl::encoding::DefaultFuchsiaResourceDialect,
1920        > for (T0,)
1921    {
1922        #[inline]
1923        unsafe fn encode(
1924            self,
1925            encoder: &mut fidl::encoding::Encoder<
1926                '_,
1927                fidl::encoding::DefaultFuchsiaResourceDialect,
1928            >,
1929            offset: usize,
1930            depth: fidl::encoding::Depth,
1931        ) -> fidl::Result<()> {
1932            encoder.debug_check_bounds::<InputDeviceGetInputReportsReaderRequest>(offset);
1933            // Zero out padding regions. There's no need to apply masks
1934            // because the unmasked parts will be overwritten by fields.
1935            // Write the fields.
1936            self.0.encode(encoder, offset + 0, depth)?;
1937            Ok(())
1938        }
1939    }
1940
1941    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1942        for InputDeviceGetInputReportsReaderRequest
1943    {
1944        #[inline(always)]
1945        fn new_empty() -> Self {
1946            Self {
1947                reader: fidl::new_empty!(
1948                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1949                    fidl::encoding::DefaultFuchsiaResourceDialect
1950                ),
1951            }
1952        }
1953
1954        #[inline]
1955        unsafe fn decode(
1956            &mut self,
1957            decoder: &mut fidl::encoding::Decoder<
1958                '_,
1959                fidl::encoding::DefaultFuchsiaResourceDialect,
1960            >,
1961            offset: usize,
1962            _depth: fidl::encoding::Depth,
1963        ) -> fidl::Result<()> {
1964            decoder.debug_check_bounds::<Self>(offset);
1965            // Verify that padding bytes are zero.
1966            fidl::decode!(
1967                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<InputReportsReaderMarker>>,
1968                fidl::encoding::DefaultFuchsiaResourceDialect,
1969                &mut self.reader,
1970                decoder,
1971                offset + 0,
1972                _depth
1973            )?;
1974            Ok(())
1975        }
1976    }
1977
1978    impl fidl::encoding::ResourceTypeMarker for InputDeviceGetInputReportResponse {
1979        type Borrowed<'a> = &'a mut Self;
1980        fn take_or_borrow<'a>(
1981            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1982        ) -> Self::Borrowed<'a> {
1983            value
1984        }
1985    }
1986
1987    unsafe impl fidl::encoding::TypeMarker for InputDeviceGetInputReportResponse {
1988        type Owned = Self;
1989
1990        #[inline(always)]
1991        fn inline_align(_context: fidl::encoding::Context) -> usize {
1992            8
1993        }
1994
1995        #[inline(always)]
1996        fn inline_size(_context: fidl::encoding::Context) -> usize {
1997            16
1998        }
1999    }
2000
2001    unsafe impl
2002        fidl::encoding::Encode<
2003            InputDeviceGetInputReportResponse,
2004            fidl::encoding::DefaultFuchsiaResourceDialect,
2005        > for &mut InputDeviceGetInputReportResponse
2006    {
2007        #[inline]
2008        unsafe fn encode(
2009            self,
2010            encoder: &mut fidl::encoding::Encoder<
2011                '_,
2012                fidl::encoding::DefaultFuchsiaResourceDialect,
2013            >,
2014            offset: usize,
2015            _depth: fidl::encoding::Depth,
2016        ) -> fidl::Result<()> {
2017            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2018            // Delegate to tuple encoding.
2019            fidl::encoding::Encode::<
2020                InputDeviceGetInputReportResponse,
2021                fidl::encoding::DefaultFuchsiaResourceDialect,
2022            >::encode(
2023                (<InputReport as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2024                    &mut self.report,
2025                ),),
2026                encoder,
2027                offset,
2028                _depth,
2029            )
2030        }
2031    }
2032    unsafe impl<
2033        T0: fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>,
2034    >
2035        fidl::encoding::Encode<
2036            InputDeviceGetInputReportResponse,
2037            fidl::encoding::DefaultFuchsiaResourceDialect,
2038        > for (T0,)
2039    {
2040        #[inline]
2041        unsafe fn encode(
2042            self,
2043            encoder: &mut fidl::encoding::Encoder<
2044                '_,
2045                fidl::encoding::DefaultFuchsiaResourceDialect,
2046            >,
2047            offset: usize,
2048            depth: fidl::encoding::Depth,
2049        ) -> fidl::Result<()> {
2050            encoder.debug_check_bounds::<InputDeviceGetInputReportResponse>(offset);
2051            // Zero out padding regions. There's no need to apply masks
2052            // because the unmasked parts will be overwritten by fields.
2053            // Write the fields.
2054            self.0.encode(encoder, offset + 0, depth)?;
2055            Ok(())
2056        }
2057    }
2058
2059    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2060        for InputDeviceGetInputReportResponse
2061    {
2062        #[inline(always)]
2063        fn new_empty() -> Self {
2064            Self {
2065                report: fidl::new_empty!(
2066                    InputReport,
2067                    fidl::encoding::DefaultFuchsiaResourceDialect
2068                ),
2069            }
2070        }
2071
2072        #[inline]
2073        unsafe fn decode(
2074            &mut self,
2075            decoder: &mut fidl::encoding::Decoder<
2076                '_,
2077                fidl::encoding::DefaultFuchsiaResourceDialect,
2078            >,
2079            offset: usize,
2080            _depth: fidl::encoding::Depth,
2081        ) -> fidl::Result<()> {
2082            decoder.debug_check_bounds::<Self>(offset);
2083            // Verify that padding bytes are zero.
2084            fidl::decode!(
2085                InputReport,
2086                fidl::encoding::DefaultFuchsiaResourceDialect,
2087                &mut self.report,
2088                decoder,
2089                offset + 0,
2090                _depth
2091            )?;
2092            Ok(())
2093        }
2094    }
2095
2096    impl fidl::encoding::ResourceTypeMarker for InputReportsReaderReadInputReportsResponse {
2097        type Borrowed<'a> = &'a mut Self;
2098        fn take_or_borrow<'a>(
2099            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2100        ) -> Self::Borrowed<'a> {
2101            value
2102        }
2103    }
2104
2105    unsafe impl fidl::encoding::TypeMarker for InputReportsReaderReadInputReportsResponse {
2106        type Owned = Self;
2107
2108        #[inline(always)]
2109        fn inline_align(_context: fidl::encoding::Context) -> usize {
2110            8
2111        }
2112
2113        #[inline(always)]
2114        fn inline_size(_context: fidl::encoding::Context) -> usize {
2115            16
2116        }
2117    }
2118
2119    unsafe impl
2120        fidl::encoding::Encode<
2121            InputReportsReaderReadInputReportsResponse,
2122            fidl::encoding::DefaultFuchsiaResourceDialect,
2123        > for &mut InputReportsReaderReadInputReportsResponse
2124    {
2125        #[inline]
2126        unsafe fn encode(
2127            self,
2128            encoder: &mut fidl::encoding::Encoder<
2129                '_,
2130                fidl::encoding::DefaultFuchsiaResourceDialect,
2131            >,
2132            offset: usize,
2133            _depth: fidl::encoding::Depth,
2134        ) -> fidl::Result<()> {
2135            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2136            // Delegate to tuple encoding.
2137            fidl::encoding::Encode::<InputReportsReaderReadInputReportsResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2138                (
2139                    <fidl::encoding::Vector<InputReport, 50> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.reports),
2140                ),
2141                encoder, offset, _depth
2142            )
2143        }
2144    }
2145    unsafe impl<
2146        T0: fidl::encoding::Encode<
2147                fidl::encoding::Vector<InputReport, 50>,
2148                fidl::encoding::DefaultFuchsiaResourceDialect,
2149            >,
2150    >
2151        fidl::encoding::Encode<
2152            InputReportsReaderReadInputReportsResponse,
2153            fidl::encoding::DefaultFuchsiaResourceDialect,
2154        > for (T0,)
2155    {
2156        #[inline]
2157        unsafe fn encode(
2158            self,
2159            encoder: &mut fidl::encoding::Encoder<
2160                '_,
2161                fidl::encoding::DefaultFuchsiaResourceDialect,
2162            >,
2163            offset: usize,
2164            depth: fidl::encoding::Depth,
2165        ) -> fidl::Result<()> {
2166            encoder.debug_check_bounds::<InputReportsReaderReadInputReportsResponse>(offset);
2167            // Zero out padding regions. There's no need to apply masks
2168            // because the unmasked parts will be overwritten by fields.
2169            // Write the fields.
2170            self.0.encode(encoder, offset + 0, depth)?;
2171            Ok(())
2172        }
2173    }
2174
2175    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2176        for InputReportsReaderReadInputReportsResponse
2177    {
2178        #[inline(always)]
2179        fn new_empty() -> Self {
2180            Self {
2181                reports: fidl::new_empty!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect),
2182            }
2183        }
2184
2185        #[inline]
2186        unsafe fn decode(
2187            &mut self,
2188            decoder: &mut fidl::encoding::Decoder<
2189                '_,
2190                fidl::encoding::DefaultFuchsiaResourceDialect,
2191            >,
2192            offset: usize,
2193            _depth: fidl::encoding::Depth,
2194        ) -> fidl::Result<()> {
2195            decoder.debug_check_bounds::<Self>(offset);
2196            // Verify that padding bytes are zero.
2197            fidl::decode!(fidl::encoding::Vector<InputReport, 50>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.reports, decoder, offset + 0, _depth)?;
2198            Ok(())
2199        }
2200    }
2201
2202    impl InputReport {
2203        #[inline(always)]
2204        fn max_ordinal_present(&self) -> u64 {
2205            if let Some(_) = self.wake_lease {
2206                return 9;
2207            }
2208            if let Some(_) = self.report_id {
2209                return 8;
2210            }
2211            if let Some(_) = self.consumer_control {
2212                return 7;
2213            }
2214            if let Some(_) = self.keyboard {
2215                return 6;
2216            }
2217            if let Some(_) = self.touch {
2218                return 5;
2219            }
2220            if let Some(_) = self.sensor {
2221                return 4;
2222            }
2223            if let Some(_) = self.trace_id {
2224                return 3;
2225            }
2226            if let Some(_) = self.mouse {
2227                return 2;
2228            }
2229            if let Some(_) = self.event_time {
2230                return 1;
2231            }
2232            0
2233        }
2234    }
2235
2236    impl fidl::encoding::ResourceTypeMarker for InputReport {
2237        type Borrowed<'a> = &'a mut Self;
2238        fn take_or_borrow<'a>(
2239            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2240        ) -> Self::Borrowed<'a> {
2241            value
2242        }
2243    }
2244
2245    unsafe impl fidl::encoding::TypeMarker for InputReport {
2246        type Owned = Self;
2247
2248        #[inline(always)]
2249        fn inline_align(_context: fidl::encoding::Context) -> usize {
2250            8
2251        }
2252
2253        #[inline(always)]
2254        fn inline_size(_context: fidl::encoding::Context) -> usize {
2255            16
2256        }
2257    }
2258
2259    unsafe impl fidl::encoding::Encode<InputReport, fidl::encoding::DefaultFuchsiaResourceDialect>
2260        for &mut InputReport
2261    {
2262        unsafe fn encode(
2263            self,
2264            encoder: &mut fidl::encoding::Encoder<
2265                '_,
2266                fidl::encoding::DefaultFuchsiaResourceDialect,
2267            >,
2268            offset: usize,
2269            mut depth: fidl::encoding::Depth,
2270        ) -> fidl::Result<()> {
2271            encoder.debug_check_bounds::<InputReport>(offset);
2272            // Vector header
2273            let max_ordinal: u64 = self.max_ordinal_present();
2274            encoder.write_num(max_ordinal, offset);
2275            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2276            // Calling encoder.out_of_line_offset(0) is not allowed.
2277            if max_ordinal == 0 {
2278                return Ok(());
2279            }
2280            depth.increment()?;
2281            let envelope_size = 8;
2282            let bytes_len = max_ordinal as usize * envelope_size;
2283            #[allow(unused_variables)]
2284            let offset = encoder.out_of_line_offset(bytes_len);
2285            let mut _prev_end_offset: usize = 0;
2286            if 1 > max_ordinal {
2287                return Ok(());
2288            }
2289
2290            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2291            // are envelope_size bytes.
2292            let cur_offset: usize = (1 - 1) * envelope_size;
2293
2294            // Zero reserved fields.
2295            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2296
2297            // Safety:
2298            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2299            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2300            //   envelope_size bytes, there is always sufficient room.
2301            fidl::encoding::encode_in_envelope_optional::<
2302                i64,
2303                fidl::encoding::DefaultFuchsiaResourceDialect,
2304            >(
2305                self.event_time.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2306                encoder,
2307                offset + cur_offset,
2308                depth,
2309            )?;
2310
2311            _prev_end_offset = cur_offset + envelope_size;
2312            if 2 > max_ordinal {
2313                return Ok(());
2314            }
2315
2316            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2317            // are envelope_size bytes.
2318            let cur_offset: usize = (2 - 1) * envelope_size;
2319
2320            // Zero reserved fields.
2321            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2322
2323            // Safety:
2324            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2325            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2326            //   envelope_size bytes, there is always sufficient room.
2327            fidl::encoding::encode_in_envelope_optional::<
2328                MouseInputReport,
2329                fidl::encoding::DefaultFuchsiaResourceDialect,
2330            >(
2331                self.mouse
2332                    .as_ref()
2333                    .map(<MouseInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2334                encoder,
2335                offset + cur_offset,
2336                depth,
2337            )?;
2338
2339            _prev_end_offset = cur_offset + envelope_size;
2340            if 3 > max_ordinal {
2341                return Ok(());
2342            }
2343
2344            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2345            // are envelope_size bytes.
2346            let cur_offset: usize = (3 - 1) * envelope_size;
2347
2348            // Zero reserved fields.
2349            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2350
2351            // Safety:
2352            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2353            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2354            //   envelope_size bytes, there is always sufficient room.
2355            fidl::encoding::encode_in_envelope_optional::<
2356                u64,
2357                fidl::encoding::DefaultFuchsiaResourceDialect,
2358            >(
2359                self.trace_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2360                encoder,
2361                offset + cur_offset,
2362                depth,
2363            )?;
2364
2365            _prev_end_offset = cur_offset + envelope_size;
2366            if 4 > max_ordinal {
2367                return Ok(());
2368            }
2369
2370            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2371            // are envelope_size bytes.
2372            let cur_offset: usize = (4 - 1) * envelope_size;
2373
2374            // Zero reserved fields.
2375            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2376
2377            // Safety:
2378            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2379            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2380            //   envelope_size bytes, there is always sufficient room.
2381            fidl::encoding::encode_in_envelope_optional::<
2382                SensorInputReport,
2383                fidl::encoding::DefaultFuchsiaResourceDialect,
2384            >(
2385                self.sensor
2386                    .as_ref()
2387                    .map(<SensorInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2388                encoder,
2389                offset + cur_offset,
2390                depth,
2391            )?;
2392
2393            _prev_end_offset = cur_offset + envelope_size;
2394            if 5 > max_ordinal {
2395                return Ok(());
2396            }
2397
2398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2399            // are envelope_size bytes.
2400            let cur_offset: usize = (5 - 1) * envelope_size;
2401
2402            // Zero reserved fields.
2403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2404
2405            // Safety:
2406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2408            //   envelope_size bytes, there is always sufficient room.
2409            fidl::encoding::encode_in_envelope_optional::<
2410                TouchInputReport,
2411                fidl::encoding::DefaultFuchsiaResourceDialect,
2412            >(
2413                self.touch
2414                    .as_ref()
2415                    .map(<TouchInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2416                encoder,
2417                offset + cur_offset,
2418                depth,
2419            )?;
2420
2421            _prev_end_offset = cur_offset + envelope_size;
2422            if 6 > max_ordinal {
2423                return Ok(());
2424            }
2425
2426            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2427            // are envelope_size bytes.
2428            let cur_offset: usize = (6 - 1) * envelope_size;
2429
2430            // Zero reserved fields.
2431            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2432
2433            // Safety:
2434            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2435            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2436            //   envelope_size bytes, there is always sufficient room.
2437            fidl::encoding::encode_in_envelope_optional::<
2438                KeyboardInputReport,
2439                fidl::encoding::DefaultFuchsiaResourceDialect,
2440            >(
2441                self.keyboard
2442                    .as_ref()
2443                    .map(<KeyboardInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2444                encoder,
2445                offset + cur_offset,
2446                depth,
2447            )?;
2448
2449            _prev_end_offset = cur_offset + envelope_size;
2450            if 7 > max_ordinal {
2451                return Ok(());
2452            }
2453
2454            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2455            // are envelope_size bytes.
2456            let cur_offset: usize = (7 - 1) * envelope_size;
2457
2458            // Zero reserved fields.
2459            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2460
2461            // Safety:
2462            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2463            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2464            //   envelope_size bytes, there is always sufficient room.
2465            fidl::encoding::encode_in_envelope_optional::<
2466                ConsumerControlInputReport,
2467                fidl::encoding::DefaultFuchsiaResourceDialect,
2468            >(
2469                self.consumer_control
2470                    .as_ref()
2471                    .map(<ConsumerControlInputReport as fidl::encoding::ValueTypeMarker>::borrow),
2472                encoder,
2473                offset + cur_offset,
2474                depth,
2475            )?;
2476
2477            _prev_end_offset = cur_offset + envelope_size;
2478            if 8 > max_ordinal {
2479                return Ok(());
2480            }
2481
2482            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2483            // are envelope_size bytes.
2484            let cur_offset: usize = (8 - 1) * envelope_size;
2485
2486            // Zero reserved fields.
2487            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2488
2489            // Safety:
2490            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2491            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2492            //   envelope_size bytes, there is always sufficient room.
2493            fidl::encoding::encode_in_envelope_optional::<
2494                u8,
2495                fidl::encoding::DefaultFuchsiaResourceDialect,
2496            >(
2497                self.report_id.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
2498                encoder,
2499                offset + cur_offset,
2500                depth,
2501            )?;
2502
2503            _prev_end_offset = cur_offset + envelope_size;
2504            if 9 > max_ordinal {
2505                return Ok(());
2506            }
2507
2508            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2509            // are envelope_size bytes.
2510            let cur_offset: usize = (9 - 1) * envelope_size;
2511
2512            // Zero reserved fields.
2513            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2514
2515            // Safety:
2516            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2517            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2518            //   envelope_size bytes, there is always sufficient room.
2519            fidl::encoding::encode_in_envelope_optional::<
2520                fidl::encoding::HandleType<
2521                    fidl::EventPair,
2522                    { fidl::ObjectType::EVENTPAIR.into_raw() },
2523                    2147483648,
2524                >,
2525                fidl::encoding::DefaultFuchsiaResourceDialect,
2526            >(
2527                self.wake_lease.as_mut().map(
2528                    <fidl::encoding::HandleType<
2529                        fidl::EventPair,
2530                        { fidl::ObjectType::EVENTPAIR.into_raw() },
2531                        2147483648,
2532                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
2533                ),
2534                encoder,
2535                offset + cur_offset,
2536                depth,
2537            )?;
2538
2539            _prev_end_offset = cur_offset + envelope_size;
2540
2541            Ok(())
2542        }
2543    }
2544
2545    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for InputReport {
2546        #[inline(always)]
2547        fn new_empty() -> Self {
2548            Self::default()
2549        }
2550
2551        unsafe fn decode(
2552            &mut self,
2553            decoder: &mut fidl::encoding::Decoder<
2554                '_,
2555                fidl::encoding::DefaultFuchsiaResourceDialect,
2556            >,
2557            offset: usize,
2558            mut depth: fidl::encoding::Depth,
2559        ) -> fidl::Result<()> {
2560            decoder.debug_check_bounds::<Self>(offset);
2561            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2562                None => return Err(fidl::Error::NotNullable),
2563                Some(len) => len,
2564            };
2565            // Calling decoder.out_of_line_offset(0) is not allowed.
2566            if len == 0 {
2567                return Ok(());
2568            };
2569            depth.increment()?;
2570            let envelope_size = 8;
2571            let bytes_len = len * envelope_size;
2572            let offset = decoder.out_of_line_offset(bytes_len)?;
2573            // Decode the envelope for each type.
2574            let mut _next_ordinal_to_read = 0;
2575            let mut next_offset = offset;
2576            let end_offset = offset + bytes_len;
2577            _next_ordinal_to_read += 1;
2578            if next_offset >= end_offset {
2579                return Ok(());
2580            }
2581
2582            // Decode unknown envelopes for gaps in ordinals.
2583            while _next_ordinal_to_read < 1 {
2584                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2585                _next_ordinal_to_read += 1;
2586                next_offset += envelope_size;
2587            }
2588
2589            let next_out_of_line = decoder.next_out_of_line();
2590            let handles_before = decoder.remaining_handles();
2591            if let Some((inlined, num_bytes, num_handles)) =
2592                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2593            {
2594                let member_inline_size =
2595                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2596                if inlined != (member_inline_size <= 4) {
2597                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2598                }
2599                let inner_offset;
2600                let mut inner_depth = depth.clone();
2601                if inlined {
2602                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2603                    inner_offset = next_offset;
2604                } else {
2605                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2606                    inner_depth.increment()?;
2607                }
2608                let val_ref = self.event_time.get_or_insert_with(|| {
2609                    fidl::new_empty!(i64, fidl::encoding::DefaultFuchsiaResourceDialect)
2610                });
2611                fidl::decode!(
2612                    i64,
2613                    fidl::encoding::DefaultFuchsiaResourceDialect,
2614                    val_ref,
2615                    decoder,
2616                    inner_offset,
2617                    inner_depth
2618                )?;
2619                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2620                {
2621                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2622                }
2623                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2624                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2625                }
2626            }
2627
2628            next_offset += envelope_size;
2629            _next_ordinal_to_read += 1;
2630            if next_offset >= end_offset {
2631                return Ok(());
2632            }
2633
2634            // Decode unknown envelopes for gaps in ordinals.
2635            while _next_ordinal_to_read < 2 {
2636                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2637                _next_ordinal_to_read += 1;
2638                next_offset += envelope_size;
2639            }
2640
2641            let next_out_of_line = decoder.next_out_of_line();
2642            let handles_before = decoder.remaining_handles();
2643            if let Some((inlined, num_bytes, num_handles)) =
2644                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2645            {
2646                let member_inline_size =
2647                    <MouseInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2648                if inlined != (member_inline_size <= 4) {
2649                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2650                }
2651                let inner_offset;
2652                let mut inner_depth = depth.clone();
2653                if inlined {
2654                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2655                    inner_offset = next_offset;
2656                } else {
2657                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2658                    inner_depth.increment()?;
2659                }
2660                let val_ref = self.mouse.get_or_insert_with(|| {
2661                    fidl::new_empty!(
2662                        MouseInputReport,
2663                        fidl::encoding::DefaultFuchsiaResourceDialect
2664                    )
2665                });
2666                fidl::decode!(
2667                    MouseInputReport,
2668                    fidl::encoding::DefaultFuchsiaResourceDialect,
2669                    val_ref,
2670                    decoder,
2671                    inner_offset,
2672                    inner_depth
2673                )?;
2674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2675                {
2676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2677                }
2678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2680                }
2681            }
2682
2683            next_offset += envelope_size;
2684            _next_ordinal_to_read += 1;
2685            if next_offset >= end_offset {
2686                return Ok(());
2687            }
2688
2689            // Decode unknown envelopes for gaps in ordinals.
2690            while _next_ordinal_to_read < 3 {
2691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2692                _next_ordinal_to_read += 1;
2693                next_offset += envelope_size;
2694            }
2695
2696            let next_out_of_line = decoder.next_out_of_line();
2697            let handles_before = decoder.remaining_handles();
2698            if let Some((inlined, num_bytes, num_handles)) =
2699                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2700            {
2701                let member_inline_size =
2702                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2703                if inlined != (member_inline_size <= 4) {
2704                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2705                }
2706                let inner_offset;
2707                let mut inner_depth = depth.clone();
2708                if inlined {
2709                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2710                    inner_offset = next_offset;
2711                } else {
2712                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2713                    inner_depth.increment()?;
2714                }
2715                let val_ref = self.trace_id.get_or_insert_with(|| {
2716                    fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect)
2717                });
2718                fidl::decode!(
2719                    u64,
2720                    fidl::encoding::DefaultFuchsiaResourceDialect,
2721                    val_ref,
2722                    decoder,
2723                    inner_offset,
2724                    inner_depth
2725                )?;
2726                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2727                {
2728                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2729                }
2730                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2731                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2732                }
2733            }
2734
2735            next_offset += envelope_size;
2736            _next_ordinal_to_read += 1;
2737            if next_offset >= end_offset {
2738                return Ok(());
2739            }
2740
2741            // Decode unknown envelopes for gaps in ordinals.
2742            while _next_ordinal_to_read < 4 {
2743                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2744                _next_ordinal_to_read += 1;
2745                next_offset += envelope_size;
2746            }
2747
2748            let next_out_of_line = decoder.next_out_of_line();
2749            let handles_before = decoder.remaining_handles();
2750            if let Some((inlined, num_bytes, num_handles)) =
2751                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2752            {
2753                let member_inline_size =
2754                    <SensorInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2755                if inlined != (member_inline_size <= 4) {
2756                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2757                }
2758                let inner_offset;
2759                let mut inner_depth = depth.clone();
2760                if inlined {
2761                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2762                    inner_offset = next_offset;
2763                } else {
2764                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2765                    inner_depth.increment()?;
2766                }
2767                let val_ref = self.sensor.get_or_insert_with(|| {
2768                    fidl::new_empty!(
2769                        SensorInputReport,
2770                        fidl::encoding::DefaultFuchsiaResourceDialect
2771                    )
2772                });
2773                fidl::decode!(
2774                    SensorInputReport,
2775                    fidl::encoding::DefaultFuchsiaResourceDialect,
2776                    val_ref,
2777                    decoder,
2778                    inner_offset,
2779                    inner_depth
2780                )?;
2781                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2782                {
2783                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2784                }
2785                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2786                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2787                }
2788            }
2789
2790            next_offset += envelope_size;
2791            _next_ordinal_to_read += 1;
2792            if next_offset >= end_offset {
2793                return Ok(());
2794            }
2795
2796            // Decode unknown envelopes for gaps in ordinals.
2797            while _next_ordinal_to_read < 5 {
2798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2799                _next_ordinal_to_read += 1;
2800                next_offset += envelope_size;
2801            }
2802
2803            let next_out_of_line = decoder.next_out_of_line();
2804            let handles_before = decoder.remaining_handles();
2805            if let Some((inlined, num_bytes, num_handles)) =
2806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2807            {
2808                let member_inline_size =
2809                    <TouchInputReport as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2810                if inlined != (member_inline_size <= 4) {
2811                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2812                }
2813                let inner_offset;
2814                let mut inner_depth = depth.clone();
2815                if inlined {
2816                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2817                    inner_offset = next_offset;
2818                } else {
2819                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2820                    inner_depth.increment()?;
2821                }
2822                let val_ref = self.touch.get_or_insert_with(|| {
2823                    fidl::new_empty!(
2824                        TouchInputReport,
2825                        fidl::encoding::DefaultFuchsiaResourceDialect
2826                    )
2827                });
2828                fidl::decode!(
2829                    TouchInputReport,
2830                    fidl::encoding::DefaultFuchsiaResourceDialect,
2831                    val_ref,
2832                    decoder,
2833                    inner_offset,
2834                    inner_depth
2835                )?;
2836                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2837                {
2838                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2839                }
2840                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2841                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2842                }
2843            }
2844
2845            next_offset += envelope_size;
2846            _next_ordinal_to_read += 1;
2847            if next_offset >= end_offset {
2848                return Ok(());
2849            }
2850
2851            // Decode unknown envelopes for gaps in ordinals.
2852            while _next_ordinal_to_read < 6 {
2853                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2854                _next_ordinal_to_read += 1;
2855                next_offset += envelope_size;
2856            }
2857
2858            let next_out_of_line = decoder.next_out_of_line();
2859            let handles_before = decoder.remaining_handles();
2860            if let Some((inlined, num_bytes, num_handles)) =
2861                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2862            {
2863                let member_inline_size =
2864                    <KeyboardInputReport as fidl::encoding::TypeMarker>::inline_size(
2865                        decoder.context,
2866                    );
2867                if inlined != (member_inline_size <= 4) {
2868                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2869                }
2870                let inner_offset;
2871                let mut inner_depth = depth.clone();
2872                if inlined {
2873                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2874                    inner_offset = next_offset;
2875                } else {
2876                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2877                    inner_depth.increment()?;
2878                }
2879                let val_ref = self.keyboard.get_or_insert_with(|| {
2880                    fidl::new_empty!(
2881                        KeyboardInputReport,
2882                        fidl::encoding::DefaultFuchsiaResourceDialect
2883                    )
2884                });
2885                fidl::decode!(
2886                    KeyboardInputReport,
2887                    fidl::encoding::DefaultFuchsiaResourceDialect,
2888                    val_ref,
2889                    decoder,
2890                    inner_offset,
2891                    inner_depth
2892                )?;
2893                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2894                {
2895                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2896                }
2897                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2898                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2899                }
2900            }
2901
2902            next_offset += envelope_size;
2903            _next_ordinal_to_read += 1;
2904            if next_offset >= end_offset {
2905                return Ok(());
2906            }
2907
2908            // Decode unknown envelopes for gaps in ordinals.
2909            while _next_ordinal_to_read < 7 {
2910                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2911                _next_ordinal_to_read += 1;
2912                next_offset += envelope_size;
2913            }
2914
2915            let next_out_of_line = decoder.next_out_of_line();
2916            let handles_before = decoder.remaining_handles();
2917            if let Some((inlined, num_bytes, num_handles)) =
2918                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2919            {
2920                let member_inline_size =
2921                    <ConsumerControlInputReport as fidl::encoding::TypeMarker>::inline_size(
2922                        decoder.context,
2923                    );
2924                if inlined != (member_inline_size <= 4) {
2925                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2926                }
2927                let inner_offset;
2928                let mut inner_depth = depth.clone();
2929                if inlined {
2930                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2931                    inner_offset = next_offset;
2932                } else {
2933                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2934                    inner_depth.increment()?;
2935                }
2936                let val_ref = self.consumer_control.get_or_insert_with(|| {
2937                    fidl::new_empty!(
2938                        ConsumerControlInputReport,
2939                        fidl::encoding::DefaultFuchsiaResourceDialect
2940                    )
2941                });
2942                fidl::decode!(
2943                    ConsumerControlInputReport,
2944                    fidl::encoding::DefaultFuchsiaResourceDialect,
2945                    val_ref,
2946                    decoder,
2947                    inner_offset,
2948                    inner_depth
2949                )?;
2950                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2951                {
2952                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2953                }
2954                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2955                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2956                }
2957            }
2958
2959            next_offset += envelope_size;
2960            _next_ordinal_to_read += 1;
2961            if next_offset >= end_offset {
2962                return Ok(());
2963            }
2964
2965            // Decode unknown envelopes for gaps in ordinals.
2966            while _next_ordinal_to_read < 8 {
2967                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2968                _next_ordinal_to_read += 1;
2969                next_offset += envelope_size;
2970            }
2971
2972            let next_out_of_line = decoder.next_out_of_line();
2973            let handles_before = decoder.remaining_handles();
2974            if let Some((inlined, num_bytes, num_handles)) =
2975                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2976            {
2977                let member_inline_size =
2978                    <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2979                if inlined != (member_inline_size <= 4) {
2980                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2981                }
2982                let inner_offset;
2983                let mut inner_depth = depth.clone();
2984                if inlined {
2985                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2986                    inner_offset = next_offset;
2987                } else {
2988                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2989                    inner_depth.increment()?;
2990                }
2991                let val_ref = self.report_id.get_or_insert_with(|| {
2992                    fidl::new_empty!(u8, fidl::encoding::DefaultFuchsiaResourceDialect)
2993                });
2994                fidl::decode!(
2995                    u8,
2996                    fidl::encoding::DefaultFuchsiaResourceDialect,
2997                    val_ref,
2998                    decoder,
2999                    inner_offset,
3000                    inner_depth
3001                )?;
3002                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3003                {
3004                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3005                }
3006                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3007                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3008                }
3009            }
3010
3011            next_offset += envelope_size;
3012            _next_ordinal_to_read += 1;
3013            if next_offset >= end_offset {
3014                return Ok(());
3015            }
3016
3017            // Decode unknown envelopes for gaps in ordinals.
3018            while _next_ordinal_to_read < 9 {
3019                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3020                _next_ordinal_to_read += 1;
3021                next_offset += envelope_size;
3022            }
3023
3024            let next_out_of_line = decoder.next_out_of_line();
3025            let handles_before = decoder.remaining_handles();
3026            if let Some((inlined, num_bytes, num_handles)) =
3027                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3028            {
3029                let member_inline_size = <fidl::encoding::HandleType<
3030                    fidl::EventPair,
3031                    { fidl::ObjectType::EVENTPAIR.into_raw() },
3032                    2147483648,
3033                > as fidl::encoding::TypeMarker>::inline_size(
3034                    decoder.context
3035                );
3036                if inlined != (member_inline_size <= 4) {
3037                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3038                }
3039                let inner_offset;
3040                let mut inner_depth = depth.clone();
3041                if inlined {
3042                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3043                    inner_offset = next_offset;
3044                } else {
3045                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3046                    inner_depth.increment()?;
3047                }
3048                let val_ref =
3049                self.wake_lease.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect));
3050                fidl::decode!(fidl::encoding::HandleType<fidl::EventPair, { fidl::ObjectType::EVENTPAIR.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
3051                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3052                {
3053                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3054                }
3055                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3056                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3057                }
3058            }
3059
3060            next_offset += envelope_size;
3061
3062            // Decode the remaining unknown envelopes.
3063            while next_offset < end_offset {
3064                _next_ordinal_to_read += 1;
3065                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3066                next_offset += envelope_size;
3067            }
3068
3069            Ok(())
3070        }
3071    }
3072}