Skip to main content

fidl_fuchsia_ui_test_input/
fidl_fuchsia_ui_test_input.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_ui_test_input_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Default, PartialEq)]
15pub struct RegistryRegisterKeyboardAndGetDeviceInfoRequest {
16    pub device: Option<fidl::endpoints::ServerEnd<KeyboardMarker>>,
17    #[doc(hidden)]
18    pub __source_breaking: fidl::marker::SourceBreaking,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for RegistryRegisterKeyboardAndGetDeviceInfoRequest
23{
24}
25
26#[derive(Debug, Default, PartialEq)]
27pub struct RegistryRegisterKeyboardAndGetDeviceInfoResponse {
28    pub device_id: Option<u32>,
29    #[doc(hidden)]
30    pub __source_breaking: fidl::marker::SourceBreaking,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34    for RegistryRegisterKeyboardAndGetDeviceInfoResponse
35{
36}
37
38#[derive(Debug, Default, PartialEq)]
39pub struct RegistryRegisterKeyboardRequest {
40    pub device: Option<fidl::endpoints::ServerEnd<KeyboardMarker>>,
41    #[doc(hidden)]
42    pub __source_breaking: fidl::marker::SourceBreaking,
43}
44
45impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
46    for RegistryRegisterKeyboardRequest
47{
48}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest {
52    pub device: Option<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>>,
53    #[doc(hidden)]
54    pub __source_breaking: fidl::marker::SourceBreaking,
55}
56
57impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
58    for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest
59{
60}
61
62#[derive(Debug, Default, PartialEq)]
63pub struct RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse {
64    pub device_id: Option<u32>,
65    #[doc(hidden)]
66    pub __source_breaking: fidl::marker::SourceBreaking,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
70    for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse
71{
72}
73
74#[derive(Debug, Default, PartialEq)]
75pub struct RegistryRegisterMediaButtonsDeviceRequest {
76    pub device: Option<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>>,
77    #[doc(hidden)]
78    pub __source_breaking: fidl::marker::SourceBreaking,
79}
80
81impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
82    for RegistryRegisterMediaButtonsDeviceRequest
83{
84}
85
86#[derive(Debug, Default, PartialEq)]
87pub struct RegistryRegisterMouseAndGetDeviceInfoRequest {
88    pub device: Option<fidl::endpoints::ServerEnd<MouseMarker>>,
89    #[doc(hidden)]
90    pub __source_breaking: fidl::marker::SourceBreaking,
91}
92
93impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
94    for RegistryRegisterMouseAndGetDeviceInfoRequest
95{
96}
97
98#[derive(Debug, Default, PartialEq)]
99pub struct RegistryRegisterMouseAndGetDeviceInfoResponse {
100    pub device_id: Option<u32>,
101    #[doc(hidden)]
102    pub __source_breaking: fidl::marker::SourceBreaking,
103}
104
105impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
106    for RegistryRegisterMouseAndGetDeviceInfoResponse
107{
108}
109
110#[derive(Debug, Default, PartialEq)]
111pub struct RegistryRegisterMouseRequest {
112    pub device: Option<fidl::endpoints::ServerEnd<MouseMarker>>,
113    #[doc(hidden)]
114    pub __source_breaking: fidl::marker::SourceBreaking,
115}
116
117impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
118    for RegistryRegisterMouseRequest
119{
120}
121
122#[derive(Debug, Default, PartialEq)]
123pub struct RegistryRegisterTouchScreenAndGetDeviceInfoRequest {
124    pub device: Option<fidl::endpoints::ServerEnd<TouchScreenMarker>>,
125    /// Indicates the coordinate space in which to describe touch events.
126    pub coordinate_unit: Option<CoordinateUnit>,
127    /// the dimensions of the display, only used when coordinate_unit is
128    /// `REGISTERED_DIMENSIONS`.
129    pub display_dimensions: Option<DisplayDimensions>,
130    #[doc(hidden)]
131    pub __source_breaking: fidl::marker::SourceBreaking,
132}
133
134impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
135    for RegistryRegisterTouchScreenAndGetDeviceInfoRequest
136{
137}
138
139#[derive(Debug, Default, PartialEq)]
140pub struct RegistryRegisterTouchScreenAndGetDeviceInfoResponse {
141    pub device_id: Option<u32>,
142    #[doc(hidden)]
143    pub __source_breaking: fidl::marker::SourceBreaking,
144}
145
146impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
147    for RegistryRegisterTouchScreenAndGetDeviceInfoResponse
148{
149}
150
151#[derive(Debug, Default, PartialEq)]
152pub struct RegistryRegisterTouchScreenRequest {
153    pub device: Option<fidl::endpoints::ServerEnd<TouchScreenMarker>>,
154    /// Indicates the coordinate space in which to describe touch events.
155    pub coordinate_unit: Option<CoordinateUnit>,
156    /// the dimensions of the display, only used when coordinate_unit is
157    /// `REGISTERED_DIMENSIONS`.
158    pub display_dimensions: Option<DisplayDimensions>,
159    #[doc(hidden)]
160    pub __source_breaking: fidl::marker::SourceBreaking,
161}
162
163impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
164    for RegistryRegisterTouchScreenRequest
165{
166}
167
168#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
169pub struct KeyboardMarker;
170
171impl fidl::endpoints::ProtocolMarker for KeyboardMarker {
172    type Proxy = KeyboardProxy;
173    type RequestStream = KeyboardRequestStream;
174    #[cfg(target_os = "fuchsia")]
175    type SynchronousProxy = KeyboardSynchronousProxy;
176
177    const DEBUG_NAME: &'static str = "(anonymous) Keyboard";
178}
179
180pub trait KeyboardProxyInterface: Send + Sync {
181    type SimulateUsAsciiTextEntryResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
182        + Send;
183    fn r#simulate_us_ascii_text_entry(
184        &self,
185        payload: &KeyboardSimulateUsAsciiTextEntryRequest,
186    ) -> Self::SimulateUsAsciiTextEntryResponseFut;
187    type SimulateKeyEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
188    fn r#simulate_key_event(
189        &self,
190        payload: &KeyboardSimulateKeyEventRequest,
191    ) -> Self::SimulateKeyEventResponseFut;
192    type SimulateKeyPressResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
193    fn r#simulate_key_press(
194        &self,
195        payload: &KeyboardSimulateKeyPressRequest,
196    ) -> Self::SimulateKeyPressResponseFut;
197}
198#[derive(Debug)]
199#[cfg(target_os = "fuchsia")]
200pub struct KeyboardSynchronousProxy {
201    client: fidl::client::sync::Client,
202}
203
204#[cfg(target_os = "fuchsia")]
205impl fidl::endpoints::SynchronousProxy for KeyboardSynchronousProxy {
206    type Proxy = KeyboardProxy;
207    type Protocol = KeyboardMarker;
208
209    fn from_channel(inner: fidl::Channel) -> Self {
210        Self::new(inner)
211    }
212
213    fn into_channel(self) -> fidl::Channel {
214        self.client.into_channel()
215    }
216
217    fn as_channel(&self) -> &fidl::Channel {
218        self.client.as_channel()
219    }
220}
221
222#[cfg(target_os = "fuchsia")]
223impl KeyboardSynchronousProxy {
224    pub fn new(channel: fidl::Channel) -> Self {
225        Self { client: fidl::client::sync::Client::new(channel) }
226    }
227
228    pub fn into_channel(self) -> fidl::Channel {
229        self.client.into_channel()
230    }
231
232    /// Waits until an event arrives and returns it. It is safe for other
233    /// threads to make concurrent requests while waiting for an event.
234    pub fn wait_for_event(
235        &self,
236        deadline: zx::MonotonicInstant,
237    ) -> Result<KeyboardEvent, fidl::Error> {
238        KeyboardEvent::decode(self.client.wait_for_event::<KeyboardMarker>(deadline)?)
239    }
240
241    /// Simulates input of the set of keystrokes required to type `text`,
242    /// as if on a US QWERTY keyboard.
243    ///
244    /// US ASCII text get mapped to the corresponding key presses.
245    /// For example `a` gets mapped into a press and
246    /// a followup release of the key `a` on the US QWERTY keyboard.  Also,
247    /// `A` gets mapped into a press of the `Shift` key, followed by a press
248    /// and release of `a`.
249    ///
250    /// For convenience, the `\n` and `\t` get converted into `Enter` and `Tab`
251    /// keys respectively.
252    pub fn r#simulate_us_ascii_text_entry(
253        &self,
254        mut payload: &KeyboardSimulateUsAsciiTextEntryRequest,
255        ___deadline: zx::MonotonicInstant,
256    ) -> Result<(), fidl::Error> {
257        let _response = self.client.send_query::<
258            KeyboardSimulateUsAsciiTextEntryRequest,
259            fidl::encoding::EmptyPayload,
260            KeyboardMarker,
261        >(
262            payload,
263            0x7111724d25453cfb,
264            fidl::encoding::DynamicFlags::empty(),
265            ___deadline,
266        )?;
267        Ok(_response)
268    }
269
270    pub fn r#simulate_key_event(
271        &self,
272        mut payload: &KeyboardSimulateKeyEventRequest,
273        ___deadline: zx::MonotonicInstant,
274    ) -> Result<(), fidl::Error> {
275        let _response = self.client.send_query::<
276            KeyboardSimulateKeyEventRequest,
277            fidl::encoding::EmptyPayload,
278            KeyboardMarker,
279        >(
280            payload,
281            0x23e0ae9874a68211,
282            fidl::encoding::DynamicFlags::empty(),
283            ___deadline,
284        )?;
285        Ok(_response)
286    }
287
288    /// Simulate one key press includes down and up event.
289    pub fn r#simulate_key_press(
290        &self,
291        mut payload: &KeyboardSimulateKeyPressRequest,
292        ___deadline: zx::MonotonicInstant,
293    ) -> Result<(), fidl::Error> {
294        let _response = self.client.send_query::<
295            KeyboardSimulateKeyPressRequest,
296            fidl::encoding::EmptyPayload,
297            KeyboardMarker,
298        >(
299            payload,
300            0xb3ba0ef4996ebaf,
301            fidl::encoding::DynamicFlags::empty(),
302            ___deadline,
303        )?;
304        Ok(_response)
305    }
306}
307
308#[cfg(target_os = "fuchsia")]
309impl From<KeyboardSynchronousProxy> for zx::NullableHandle {
310    fn from(value: KeyboardSynchronousProxy) -> Self {
311        value.into_channel().into()
312    }
313}
314
315#[cfg(target_os = "fuchsia")]
316impl From<fidl::Channel> for KeyboardSynchronousProxy {
317    fn from(value: fidl::Channel) -> Self {
318        Self::new(value)
319    }
320}
321
322#[cfg(target_os = "fuchsia")]
323impl fidl::endpoints::FromClient for KeyboardSynchronousProxy {
324    type Protocol = KeyboardMarker;
325
326    fn from_client(value: fidl::endpoints::ClientEnd<KeyboardMarker>) -> Self {
327        Self::new(value.into_channel())
328    }
329}
330
331#[derive(Debug, Clone)]
332pub struct KeyboardProxy {
333    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
334}
335
336impl fidl::endpoints::Proxy for KeyboardProxy {
337    type Protocol = KeyboardMarker;
338
339    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
340        Self::new(inner)
341    }
342
343    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
344        self.client.into_channel().map_err(|client| Self { client })
345    }
346
347    fn as_channel(&self) -> &::fidl::AsyncChannel {
348        self.client.as_channel()
349    }
350}
351
352impl KeyboardProxy {
353    /// Create a new Proxy for fuchsia.ui.test.input/Keyboard.
354    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
355        let protocol_name = <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
356        Self { client: fidl::client::Client::new(channel, protocol_name) }
357    }
358
359    /// Get a Stream of events from the remote end of the protocol.
360    ///
361    /// # Panics
362    ///
363    /// Panics if the event stream was already taken.
364    pub fn take_event_stream(&self) -> KeyboardEventStream {
365        KeyboardEventStream { event_receiver: self.client.take_event_receiver() }
366    }
367
368    /// Simulates input of the set of keystrokes required to type `text`,
369    /// as if on a US QWERTY keyboard.
370    ///
371    /// US ASCII text get mapped to the corresponding key presses.
372    /// For example `a` gets mapped into a press and
373    /// a followup release of the key `a` on the US QWERTY keyboard.  Also,
374    /// `A` gets mapped into a press of the `Shift` key, followed by a press
375    /// and release of `a`.
376    ///
377    /// For convenience, the `\n` and `\t` get converted into `Enter` and `Tab`
378    /// keys respectively.
379    pub fn r#simulate_us_ascii_text_entry(
380        &self,
381        mut payload: &KeyboardSimulateUsAsciiTextEntryRequest,
382    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
383        KeyboardProxyInterface::r#simulate_us_ascii_text_entry(self, payload)
384    }
385
386    pub fn r#simulate_key_event(
387        &self,
388        mut payload: &KeyboardSimulateKeyEventRequest,
389    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
390        KeyboardProxyInterface::r#simulate_key_event(self, payload)
391    }
392
393    /// Simulate one key press includes down and up event.
394    pub fn r#simulate_key_press(
395        &self,
396        mut payload: &KeyboardSimulateKeyPressRequest,
397    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
398        KeyboardProxyInterface::r#simulate_key_press(self, payload)
399    }
400}
401
402impl KeyboardProxyInterface for KeyboardProxy {
403    type SimulateUsAsciiTextEntryResponseFut =
404        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
405    fn r#simulate_us_ascii_text_entry(
406        &self,
407        mut payload: &KeyboardSimulateUsAsciiTextEntryRequest,
408    ) -> Self::SimulateUsAsciiTextEntryResponseFut {
409        fn _decode(
410            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
411        ) -> Result<(), fidl::Error> {
412            let _response = fidl::client::decode_transaction_body::<
413                fidl::encoding::EmptyPayload,
414                fidl::encoding::DefaultFuchsiaResourceDialect,
415                0x7111724d25453cfb,
416            >(_buf?)?;
417            Ok(_response)
418        }
419        self.client.send_query_and_decode::<KeyboardSimulateUsAsciiTextEntryRequest, ()>(
420            payload,
421            0x7111724d25453cfb,
422            fidl::encoding::DynamicFlags::empty(),
423            _decode,
424        )
425    }
426
427    type SimulateKeyEventResponseFut =
428        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
429    fn r#simulate_key_event(
430        &self,
431        mut payload: &KeyboardSimulateKeyEventRequest,
432    ) -> Self::SimulateKeyEventResponseFut {
433        fn _decode(
434            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
435        ) -> Result<(), fidl::Error> {
436            let _response = fidl::client::decode_transaction_body::<
437                fidl::encoding::EmptyPayload,
438                fidl::encoding::DefaultFuchsiaResourceDialect,
439                0x23e0ae9874a68211,
440            >(_buf?)?;
441            Ok(_response)
442        }
443        self.client.send_query_and_decode::<KeyboardSimulateKeyEventRequest, ()>(
444            payload,
445            0x23e0ae9874a68211,
446            fidl::encoding::DynamicFlags::empty(),
447            _decode,
448        )
449    }
450
451    type SimulateKeyPressResponseFut =
452        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
453    fn r#simulate_key_press(
454        &self,
455        mut payload: &KeyboardSimulateKeyPressRequest,
456    ) -> Self::SimulateKeyPressResponseFut {
457        fn _decode(
458            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
459        ) -> Result<(), fidl::Error> {
460            let _response = fidl::client::decode_transaction_body::<
461                fidl::encoding::EmptyPayload,
462                fidl::encoding::DefaultFuchsiaResourceDialect,
463                0xb3ba0ef4996ebaf,
464            >(_buf?)?;
465            Ok(_response)
466        }
467        self.client.send_query_and_decode::<KeyboardSimulateKeyPressRequest, ()>(
468            payload,
469            0xb3ba0ef4996ebaf,
470            fidl::encoding::DynamicFlags::empty(),
471            _decode,
472        )
473    }
474}
475
476pub struct KeyboardEventStream {
477    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
478}
479
480impl std::marker::Unpin for KeyboardEventStream {}
481
482impl futures::stream::FusedStream for KeyboardEventStream {
483    fn is_terminated(&self) -> bool {
484        self.event_receiver.is_terminated()
485    }
486}
487
488impl futures::Stream for KeyboardEventStream {
489    type Item = Result<KeyboardEvent, fidl::Error>;
490
491    fn poll_next(
492        mut self: std::pin::Pin<&mut Self>,
493        cx: &mut std::task::Context<'_>,
494    ) -> std::task::Poll<Option<Self::Item>> {
495        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
496            &mut self.event_receiver,
497            cx
498        )?) {
499            Some(buf) => std::task::Poll::Ready(Some(KeyboardEvent::decode(buf))),
500            None => std::task::Poll::Ready(None),
501        }
502    }
503}
504
505#[derive(Debug)]
506pub enum KeyboardEvent {}
507
508impl KeyboardEvent {
509    /// Decodes a message buffer as a [`KeyboardEvent`].
510    fn decode(
511        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
512    ) -> Result<KeyboardEvent, fidl::Error> {
513        let (bytes, _handles) = buf.split_mut();
514        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
515        debug_assert_eq!(tx_header.tx_id, 0);
516        match tx_header.ordinal {
517            _ => Err(fidl::Error::UnknownOrdinal {
518                ordinal: tx_header.ordinal,
519                protocol_name: <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
520            }),
521        }
522    }
523}
524
525/// A Stream of incoming requests for fuchsia.ui.test.input/Keyboard.
526pub struct KeyboardRequestStream {
527    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
528    is_terminated: bool,
529}
530
531impl std::marker::Unpin for KeyboardRequestStream {}
532
533impl futures::stream::FusedStream for KeyboardRequestStream {
534    fn is_terminated(&self) -> bool {
535        self.is_terminated
536    }
537}
538
539impl fidl::endpoints::RequestStream for KeyboardRequestStream {
540    type Protocol = KeyboardMarker;
541    type ControlHandle = KeyboardControlHandle;
542
543    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
544        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
545    }
546
547    fn control_handle(&self) -> Self::ControlHandle {
548        KeyboardControlHandle { inner: self.inner.clone() }
549    }
550
551    fn into_inner(
552        self,
553    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
554    {
555        (self.inner, self.is_terminated)
556    }
557
558    fn from_inner(
559        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
560        is_terminated: bool,
561    ) -> Self {
562        Self { inner, is_terminated }
563    }
564}
565
566impl futures::Stream for KeyboardRequestStream {
567    type Item = Result<KeyboardRequest, fidl::Error>;
568
569    fn poll_next(
570        mut self: std::pin::Pin<&mut Self>,
571        cx: &mut std::task::Context<'_>,
572    ) -> std::task::Poll<Option<Self::Item>> {
573        let this = &mut *self;
574        if this.inner.check_shutdown(cx) {
575            this.is_terminated = true;
576            return std::task::Poll::Ready(None);
577        }
578        if this.is_terminated {
579            panic!("polled KeyboardRequestStream after completion");
580        }
581        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
582            |bytes, handles| {
583                match this.inner.channel().read_etc(cx, bytes, handles) {
584                    std::task::Poll::Ready(Ok(())) => {}
585                    std::task::Poll::Pending => return std::task::Poll::Pending,
586                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
587                        this.is_terminated = true;
588                        return std::task::Poll::Ready(None);
589                    }
590                    std::task::Poll::Ready(Err(e)) => {
591                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
592                            e.into(),
593                        ))));
594                    }
595                }
596
597                // A message has been received from the channel
598                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
599
600                std::task::Poll::Ready(Some(match header.ordinal {
601                    0x7111724d25453cfb => {
602                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
603                        let mut req = fidl::new_empty!(
604                            KeyboardSimulateUsAsciiTextEntryRequest,
605                            fidl::encoding::DefaultFuchsiaResourceDialect
606                        );
607                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSimulateUsAsciiTextEntryRequest>(&header, _body_bytes, handles, &mut req)?;
608                        let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
609                        Ok(KeyboardRequest::SimulateUsAsciiTextEntry {
610                            payload: req,
611                            responder: KeyboardSimulateUsAsciiTextEntryResponder {
612                                control_handle: std::mem::ManuallyDrop::new(control_handle),
613                                tx_id: header.tx_id,
614                            },
615                        })
616                    }
617                    0x23e0ae9874a68211 => {
618                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
619                        let mut req = fidl::new_empty!(
620                            KeyboardSimulateKeyEventRequest,
621                            fidl::encoding::DefaultFuchsiaResourceDialect
622                        );
623                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSimulateKeyEventRequest>(&header, _body_bytes, handles, &mut req)?;
624                        let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
625                        Ok(KeyboardRequest::SimulateKeyEvent {
626                            payload: req,
627                            responder: KeyboardSimulateKeyEventResponder {
628                                control_handle: std::mem::ManuallyDrop::new(control_handle),
629                                tx_id: header.tx_id,
630                            },
631                        })
632                    }
633                    0xb3ba0ef4996ebaf => {
634                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
635                        let mut req = fidl::new_empty!(
636                            KeyboardSimulateKeyPressRequest,
637                            fidl::encoding::DefaultFuchsiaResourceDialect
638                        );
639                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardSimulateKeyPressRequest>(&header, _body_bytes, handles, &mut req)?;
640                        let control_handle = KeyboardControlHandle { inner: this.inner.clone() };
641                        Ok(KeyboardRequest::SimulateKeyPress {
642                            payload: req,
643                            responder: KeyboardSimulateKeyPressResponder {
644                                control_handle: std::mem::ManuallyDrop::new(control_handle),
645                                tx_id: header.tx_id,
646                            },
647                        })
648                    }
649                    _ => Err(fidl::Error::UnknownOrdinal {
650                        ordinal: header.ordinal,
651                        protocol_name:
652                            <KeyboardMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
653                    }),
654                }))
655            },
656        )
657    }
658}
659
660/// A tool to inject keyboard events into Input Pipeline.
661///
662/// Please extend as necessary.
663#[derive(Debug)]
664pub enum KeyboardRequest {
665    /// Simulates input of the set of keystrokes required to type `text`,
666    /// as if on a US QWERTY keyboard.
667    ///
668    /// US ASCII text get mapped to the corresponding key presses.
669    /// For example `a` gets mapped into a press and
670    /// a followup release of the key `a` on the US QWERTY keyboard.  Also,
671    /// `A` gets mapped into a press of the `Shift` key, followed by a press
672    /// and release of `a`.
673    ///
674    /// For convenience, the `\n` and `\t` get converted into `Enter` and `Tab`
675    /// keys respectively.
676    SimulateUsAsciiTextEntry {
677        payload: KeyboardSimulateUsAsciiTextEntryRequest,
678        responder: KeyboardSimulateUsAsciiTextEntryResponder,
679    },
680    SimulateKeyEvent {
681        payload: KeyboardSimulateKeyEventRequest,
682        responder: KeyboardSimulateKeyEventResponder,
683    },
684    /// Simulate one key press includes down and up event.
685    SimulateKeyPress {
686        payload: KeyboardSimulateKeyPressRequest,
687        responder: KeyboardSimulateKeyPressResponder,
688    },
689}
690
691impl KeyboardRequest {
692    #[allow(irrefutable_let_patterns)]
693    pub fn into_simulate_us_ascii_text_entry(
694        self,
695    ) -> Option<(KeyboardSimulateUsAsciiTextEntryRequest, KeyboardSimulateUsAsciiTextEntryResponder)>
696    {
697        if let KeyboardRequest::SimulateUsAsciiTextEntry { payload, responder } = self {
698            Some((payload, responder))
699        } else {
700            None
701        }
702    }
703
704    #[allow(irrefutable_let_patterns)]
705    pub fn into_simulate_key_event(
706        self,
707    ) -> Option<(KeyboardSimulateKeyEventRequest, KeyboardSimulateKeyEventResponder)> {
708        if let KeyboardRequest::SimulateKeyEvent { payload, responder } = self {
709            Some((payload, responder))
710        } else {
711            None
712        }
713    }
714
715    #[allow(irrefutable_let_patterns)]
716    pub fn into_simulate_key_press(
717        self,
718    ) -> Option<(KeyboardSimulateKeyPressRequest, KeyboardSimulateKeyPressResponder)> {
719        if let KeyboardRequest::SimulateKeyPress { payload, responder } = self {
720            Some((payload, responder))
721        } else {
722            None
723        }
724    }
725
726    /// Name of the method defined in FIDL
727    pub fn method_name(&self) -> &'static str {
728        match *self {
729            KeyboardRequest::SimulateUsAsciiTextEntry { .. } => "simulate_us_ascii_text_entry",
730            KeyboardRequest::SimulateKeyEvent { .. } => "simulate_key_event",
731            KeyboardRequest::SimulateKeyPress { .. } => "simulate_key_press",
732        }
733    }
734}
735
736#[derive(Debug, Clone)]
737pub struct KeyboardControlHandle {
738    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
739}
740
741impl fidl::endpoints::ControlHandle for KeyboardControlHandle {
742    fn shutdown(&self) {
743        self.inner.shutdown()
744    }
745
746    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
747        self.inner.shutdown_with_epitaph(status)
748    }
749
750    fn is_closed(&self) -> bool {
751        self.inner.channel().is_closed()
752    }
753    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
754        self.inner.channel().on_closed()
755    }
756
757    #[cfg(target_os = "fuchsia")]
758    fn signal_peer(
759        &self,
760        clear_mask: zx::Signals,
761        set_mask: zx::Signals,
762    ) -> Result<(), zx_status::Status> {
763        use fidl::Peered;
764        self.inner.channel().signal_peer(clear_mask, set_mask)
765    }
766}
767
768impl KeyboardControlHandle {}
769
770#[must_use = "FIDL methods require a response to be sent"]
771#[derive(Debug)]
772pub struct KeyboardSimulateUsAsciiTextEntryResponder {
773    control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
774    tx_id: u32,
775}
776
777/// Set the the channel to be shutdown (see [`KeyboardControlHandle::shutdown`])
778/// if the responder is dropped without sending a response, so that the client
779/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
780impl std::ops::Drop for KeyboardSimulateUsAsciiTextEntryResponder {
781    fn drop(&mut self) {
782        self.control_handle.shutdown();
783        // Safety: drops once, never accessed again
784        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
785    }
786}
787
788impl fidl::endpoints::Responder for KeyboardSimulateUsAsciiTextEntryResponder {
789    type ControlHandle = KeyboardControlHandle;
790
791    fn control_handle(&self) -> &KeyboardControlHandle {
792        &self.control_handle
793    }
794
795    fn drop_without_shutdown(mut self) {
796        // Safety: drops once, never accessed again due to mem::forget
797        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
798        // Prevent Drop from running (which would shut down the channel)
799        std::mem::forget(self);
800    }
801}
802
803impl KeyboardSimulateUsAsciiTextEntryResponder {
804    /// Sends a response to the FIDL transaction.
805    ///
806    /// Sets the channel to shutdown if an error occurs.
807    pub fn send(self) -> Result<(), fidl::Error> {
808        let _result = self.send_raw();
809        if _result.is_err() {
810            self.control_handle.shutdown();
811        }
812        self.drop_without_shutdown();
813        _result
814    }
815
816    /// Similar to "send" but does not shutdown the channel if an error occurs.
817    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
818        let _result = self.send_raw();
819        self.drop_without_shutdown();
820        _result
821    }
822
823    fn send_raw(&self) -> Result<(), fidl::Error> {
824        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
825            (),
826            self.tx_id,
827            0x7111724d25453cfb,
828            fidl::encoding::DynamicFlags::empty(),
829        )
830    }
831}
832
833#[must_use = "FIDL methods require a response to be sent"]
834#[derive(Debug)]
835pub struct KeyboardSimulateKeyEventResponder {
836    control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
837    tx_id: u32,
838}
839
840/// Set the the channel to be shutdown (see [`KeyboardControlHandle::shutdown`])
841/// if the responder is dropped without sending a response, so that the client
842/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
843impl std::ops::Drop for KeyboardSimulateKeyEventResponder {
844    fn drop(&mut self) {
845        self.control_handle.shutdown();
846        // Safety: drops once, never accessed again
847        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
848    }
849}
850
851impl fidl::endpoints::Responder for KeyboardSimulateKeyEventResponder {
852    type ControlHandle = KeyboardControlHandle;
853
854    fn control_handle(&self) -> &KeyboardControlHandle {
855        &self.control_handle
856    }
857
858    fn drop_without_shutdown(mut self) {
859        // Safety: drops once, never accessed again due to mem::forget
860        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
861        // Prevent Drop from running (which would shut down the channel)
862        std::mem::forget(self);
863    }
864}
865
866impl KeyboardSimulateKeyEventResponder {
867    /// Sends a response to the FIDL transaction.
868    ///
869    /// Sets the channel to shutdown if an error occurs.
870    pub fn send(self) -> Result<(), fidl::Error> {
871        let _result = self.send_raw();
872        if _result.is_err() {
873            self.control_handle.shutdown();
874        }
875        self.drop_without_shutdown();
876        _result
877    }
878
879    /// Similar to "send" but does not shutdown the channel if an error occurs.
880    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
881        let _result = self.send_raw();
882        self.drop_without_shutdown();
883        _result
884    }
885
886    fn send_raw(&self) -> Result<(), fidl::Error> {
887        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
888            (),
889            self.tx_id,
890            0x23e0ae9874a68211,
891            fidl::encoding::DynamicFlags::empty(),
892        )
893    }
894}
895
896#[must_use = "FIDL methods require a response to be sent"]
897#[derive(Debug)]
898pub struct KeyboardSimulateKeyPressResponder {
899    control_handle: std::mem::ManuallyDrop<KeyboardControlHandle>,
900    tx_id: u32,
901}
902
903/// Set the the channel to be shutdown (see [`KeyboardControlHandle::shutdown`])
904/// if the responder is dropped without sending a response, so that the client
905/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
906impl std::ops::Drop for KeyboardSimulateKeyPressResponder {
907    fn drop(&mut self) {
908        self.control_handle.shutdown();
909        // Safety: drops once, never accessed again
910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
911    }
912}
913
914impl fidl::endpoints::Responder for KeyboardSimulateKeyPressResponder {
915    type ControlHandle = KeyboardControlHandle;
916
917    fn control_handle(&self) -> &KeyboardControlHandle {
918        &self.control_handle
919    }
920
921    fn drop_without_shutdown(mut self) {
922        // Safety: drops once, never accessed again due to mem::forget
923        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
924        // Prevent Drop from running (which would shut down the channel)
925        std::mem::forget(self);
926    }
927}
928
929impl KeyboardSimulateKeyPressResponder {
930    /// Sends a response to the FIDL transaction.
931    ///
932    /// Sets the channel to shutdown if an error occurs.
933    pub fn send(self) -> Result<(), fidl::Error> {
934        let _result = self.send_raw();
935        if _result.is_err() {
936            self.control_handle.shutdown();
937        }
938        self.drop_without_shutdown();
939        _result
940    }
941
942    /// Similar to "send" but does not shutdown the channel if an error occurs.
943    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
944        let _result = self.send_raw();
945        self.drop_without_shutdown();
946        _result
947    }
948
949    fn send_raw(&self) -> Result<(), fidl::Error> {
950        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
951            (),
952            self.tx_id,
953            0xb3ba0ef4996ebaf,
954            fidl::encoding::DynamicFlags::empty(),
955        )
956    }
957}
958
959#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
960pub struct KeyboardInputListenerMarker;
961
962impl fidl::endpoints::ProtocolMarker for KeyboardInputListenerMarker {
963    type Proxy = KeyboardInputListenerProxy;
964    type RequestStream = KeyboardInputListenerRequestStream;
965    #[cfg(target_os = "fuchsia")]
966    type SynchronousProxy = KeyboardInputListenerSynchronousProxy;
967
968    const DEBUG_NAME: &'static str = "fuchsia.ui.test.input.KeyboardInputListener";
969}
970impl fidl::endpoints::DiscoverableProtocolMarker for KeyboardInputListenerMarker {}
971
972pub trait KeyboardInputListenerProxyInterface: Send + Sync {
973    type ReportReadyResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
974    fn r#report_ready(&self) -> Self::ReportReadyResponseFut;
975    fn r#report_text_input(
976        &self,
977        payload: &KeyboardInputListenerReportTextInputRequest,
978    ) -> Result<(), fidl::Error>;
979}
980#[derive(Debug)]
981#[cfg(target_os = "fuchsia")]
982pub struct KeyboardInputListenerSynchronousProxy {
983    client: fidl::client::sync::Client,
984}
985
986#[cfg(target_os = "fuchsia")]
987impl fidl::endpoints::SynchronousProxy for KeyboardInputListenerSynchronousProxy {
988    type Proxy = KeyboardInputListenerProxy;
989    type Protocol = KeyboardInputListenerMarker;
990
991    fn from_channel(inner: fidl::Channel) -> Self {
992        Self::new(inner)
993    }
994
995    fn into_channel(self) -> fidl::Channel {
996        self.client.into_channel()
997    }
998
999    fn as_channel(&self) -> &fidl::Channel {
1000        self.client.as_channel()
1001    }
1002}
1003
1004#[cfg(target_os = "fuchsia")]
1005impl KeyboardInputListenerSynchronousProxy {
1006    pub fn new(channel: fidl::Channel) -> Self {
1007        Self { client: fidl::client::sync::Client::new(channel) }
1008    }
1009
1010    pub fn into_channel(self) -> fidl::Channel {
1011        self.client.into_channel()
1012    }
1013
1014    /// Waits until an event arrives and returns it. It is safe for other
1015    /// threads to make concurrent requests while waiting for an event.
1016    pub fn wait_for_event(
1017        &self,
1018        deadline: zx::MonotonicInstant,
1019    ) -> Result<KeyboardInputListenerEvent, fidl::Error> {
1020        KeyboardInputListenerEvent::decode(
1021            self.client.wait_for_event::<KeyboardInputListenerMarker>(deadline)?,
1022        )
1023    }
1024
1025    /// Notify that the client is ready to receive text input. Clients that need
1026    /// to complete their setup to be able to continue with testing should call
1027    /// this method, so that the listener can wait until they are ready to
1028    /// proceed with testing.
1029    pub fn r#report_ready(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1030        let _response = self.client.send_query::<
1031            fidl::encoding::EmptyPayload,
1032            fidl::encoding::EmptyPayload,
1033            KeyboardInputListenerMarker,
1034        >(
1035            (),
1036            0x4b7f18cd3570971b,
1037            fidl::encoding::DynamicFlags::empty(),
1038            ___deadline,
1039        )?;
1040        Ok(_response)
1041    }
1042
1043    /// Notify the listener of the text string generated by the set of key events
1044    /// received by the application.
1045    pub fn r#report_text_input(
1046        &self,
1047        mut payload: &KeyboardInputListenerReportTextInputRequest,
1048    ) -> Result<(), fidl::Error> {
1049        self.client.send::<KeyboardInputListenerReportTextInputRequest>(
1050            payload,
1051            0x4d53b1fe481185d1,
1052            fidl::encoding::DynamicFlags::empty(),
1053        )
1054    }
1055}
1056
1057#[cfg(target_os = "fuchsia")]
1058impl From<KeyboardInputListenerSynchronousProxy> for zx::NullableHandle {
1059    fn from(value: KeyboardInputListenerSynchronousProxy) -> Self {
1060        value.into_channel().into()
1061    }
1062}
1063
1064#[cfg(target_os = "fuchsia")]
1065impl From<fidl::Channel> for KeyboardInputListenerSynchronousProxy {
1066    fn from(value: fidl::Channel) -> Self {
1067        Self::new(value)
1068    }
1069}
1070
1071#[cfg(target_os = "fuchsia")]
1072impl fidl::endpoints::FromClient for KeyboardInputListenerSynchronousProxy {
1073    type Protocol = KeyboardInputListenerMarker;
1074
1075    fn from_client(value: fidl::endpoints::ClientEnd<KeyboardInputListenerMarker>) -> Self {
1076        Self::new(value.into_channel())
1077    }
1078}
1079
1080#[derive(Debug, Clone)]
1081pub struct KeyboardInputListenerProxy {
1082    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1083}
1084
1085impl fidl::endpoints::Proxy for KeyboardInputListenerProxy {
1086    type Protocol = KeyboardInputListenerMarker;
1087
1088    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1089        Self::new(inner)
1090    }
1091
1092    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1093        self.client.into_channel().map_err(|client| Self { client })
1094    }
1095
1096    fn as_channel(&self) -> &::fidl::AsyncChannel {
1097        self.client.as_channel()
1098    }
1099}
1100
1101impl KeyboardInputListenerProxy {
1102    /// Create a new Proxy for fuchsia.ui.test.input/KeyboardInputListener.
1103    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1104        let protocol_name =
1105            <KeyboardInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1106        Self { client: fidl::client::Client::new(channel, protocol_name) }
1107    }
1108
1109    /// Get a Stream of events from the remote end of the protocol.
1110    ///
1111    /// # Panics
1112    ///
1113    /// Panics if the event stream was already taken.
1114    pub fn take_event_stream(&self) -> KeyboardInputListenerEventStream {
1115        KeyboardInputListenerEventStream { event_receiver: self.client.take_event_receiver() }
1116    }
1117
1118    /// Notify that the client is ready to receive text input. Clients that need
1119    /// to complete their setup to be able to continue with testing should call
1120    /// this method, so that the listener can wait until they are ready to
1121    /// proceed with testing.
1122    pub fn r#report_ready(
1123        &self,
1124    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1125        KeyboardInputListenerProxyInterface::r#report_ready(self)
1126    }
1127
1128    /// Notify the listener of the text string generated by the set of key events
1129    /// received by the application.
1130    pub fn r#report_text_input(
1131        &self,
1132        mut payload: &KeyboardInputListenerReportTextInputRequest,
1133    ) -> Result<(), fidl::Error> {
1134        KeyboardInputListenerProxyInterface::r#report_text_input(self, payload)
1135    }
1136}
1137
1138impl KeyboardInputListenerProxyInterface for KeyboardInputListenerProxy {
1139    type ReportReadyResponseFut =
1140        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1141    fn r#report_ready(&self) -> Self::ReportReadyResponseFut {
1142        fn _decode(
1143            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1144        ) -> Result<(), fidl::Error> {
1145            let _response = fidl::client::decode_transaction_body::<
1146                fidl::encoding::EmptyPayload,
1147                fidl::encoding::DefaultFuchsiaResourceDialect,
1148                0x4b7f18cd3570971b,
1149            >(_buf?)?;
1150            Ok(_response)
1151        }
1152        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1153            (),
1154            0x4b7f18cd3570971b,
1155            fidl::encoding::DynamicFlags::empty(),
1156            _decode,
1157        )
1158    }
1159
1160    fn r#report_text_input(
1161        &self,
1162        mut payload: &KeyboardInputListenerReportTextInputRequest,
1163    ) -> Result<(), fidl::Error> {
1164        self.client.send::<KeyboardInputListenerReportTextInputRequest>(
1165            payload,
1166            0x4d53b1fe481185d1,
1167            fidl::encoding::DynamicFlags::empty(),
1168        )
1169    }
1170}
1171
1172pub struct KeyboardInputListenerEventStream {
1173    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1174}
1175
1176impl std::marker::Unpin for KeyboardInputListenerEventStream {}
1177
1178impl futures::stream::FusedStream for KeyboardInputListenerEventStream {
1179    fn is_terminated(&self) -> bool {
1180        self.event_receiver.is_terminated()
1181    }
1182}
1183
1184impl futures::Stream for KeyboardInputListenerEventStream {
1185    type Item = Result<KeyboardInputListenerEvent, fidl::Error>;
1186
1187    fn poll_next(
1188        mut self: std::pin::Pin<&mut Self>,
1189        cx: &mut std::task::Context<'_>,
1190    ) -> std::task::Poll<Option<Self::Item>> {
1191        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1192            &mut self.event_receiver,
1193            cx
1194        )?) {
1195            Some(buf) => std::task::Poll::Ready(Some(KeyboardInputListenerEvent::decode(buf))),
1196            None => std::task::Poll::Ready(None),
1197        }
1198    }
1199}
1200
1201#[derive(Debug)]
1202pub enum KeyboardInputListenerEvent {}
1203
1204impl KeyboardInputListenerEvent {
1205    /// Decodes a message buffer as a [`KeyboardInputListenerEvent`].
1206    fn decode(
1207        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1208    ) -> Result<KeyboardInputListenerEvent, fidl::Error> {
1209        let (bytes, _handles) = buf.split_mut();
1210        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1211        debug_assert_eq!(tx_header.tx_id, 0);
1212        match tx_header.ordinal {
1213            _ => Err(fidl::Error::UnknownOrdinal {
1214                ordinal: tx_header.ordinal,
1215                protocol_name:
1216                    <KeyboardInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1217            }),
1218        }
1219    }
1220}
1221
1222/// A Stream of incoming requests for fuchsia.ui.test.input/KeyboardInputListener.
1223pub struct KeyboardInputListenerRequestStream {
1224    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1225    is_terminated: bool,
1226}
1227
1228impl std::marker::Unpin for KeyboardInputListenerRequestStream {}
1229
1230impl futures::stream::FusedStream for KeyboardInputListenerRequestStream {
1231    fn is_terminated(&self) -> bool {
1232        self.is_terminated
1233    }
1234}
1235
1236impl fidl::endpoints::RequestStream for KeyboardInputListenerRequestStream {
1237    type Protocol = KeyboardInputListenerMarker;
1238    type ControlHandle = KeyboardInputListenerControlHandle;
1239
1240    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1241        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1242    }
1243
1244    fn control_handle(&self) -> Self::ControlHandle {
1245        KeyboardInputListenerControlHandle { inner: self.inner.clone() }
1246    }
1247
1248    fn into_inner(
1249        self,
1250    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1251    {
1252        (self.inner, self.is_terminated)
1253    }
1254
1255    fn from_inner(
1256        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1257        is_terminated: bool,
1258    ) -> Self {
1259        Self { inner, is_terminated }
1260    }
1261}
1262
1263impl futures::Stream for KeyboardInputListenerRequestStream {
1264    type Item = Result<KeyboardInputListenerRequest, fidl::Error>;
1265
1266    fn poll_next(
1267        mut self: std::pin::Pin<&mut Self>,
1268        cx: &mut std::task::Context<'_>,
1269    ) -> std::task::Poll<Option<Self::Item>> {
1270        let this = &mut *self;
1271        if this.inner.check_shutdown(cx) {
1272            this.is_terminated = true;
1273            return std::task::Poll::Ready(None);
1274        }
1275        if this.is_terminated {
1276            panic!("polled KeyboardInputListenerRequestStream after completion");
1277        }
1278        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1279            |bytes, handles| {
1280                match this.inner.channel().read_etc(cx, bytes, handles) {
1281                    std::task::Poll::Ready(Ok(())) => {}
1282                    std::task::Poll::Pending => return std::task::Poll::Pending,
1283                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1284                        this.is_terminated = true;
1285                        return std::task::Poll::Ready(None);
1286                    }
1287                    std::task::Poll::Ready(Err(e)) => {
1288                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1289                            e.into(),
1290                        ))));
1291                    }
1292                }
1293
1294                // A message has been received from the channel
1295                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1296
1297                std::task::Poll::Ready(Some(match header.ordinal {
1298                0x4b7f18cd3570971b => {
1299                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1300                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1301                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1302                    let control_handle = KeyboardInputListenerControlHandle {
1303                        inner: this.inner.clone(),
1304                    };
1305                    Ok(KeyboardInputListenerRequest::ReportReady {
1306                        responder: KeyboardInputListenerReportReadyResponder {
1307                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1308                            tx_id: header.tx_id,
1309                        },
1310                    })
1311                }
1312                0x4d53b1fe481185d1 => {
1313                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1314                    let mut req = fidl::new_empty!(KeyboardInputListenerReportTextInputRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1315                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<KeyboardInputListenerReportTextInputRequest>(&header, _body_bytes, handles, &mut req)?;
1316                    let control_handle = KeyboardInputListenerControlHandle {
1317                        inner: this.inner.clone(),
1318                    };
1319                    Ok(KeyboardInputListenerRequest::ReportTextInput {payload: req,
1320                        control_handle,
1321                    })
1322                }
1323                _ => Err(fidl::Error::UnknownOrdinal {
1324                    ordinal: header.ordinal,
1325                    protocol_name: <KeyboardInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1326                }),
1327            }))
1328            },
1329        )
1330    }
1331}
1332
1333/// A tool for client applications to report text input to interested parties
1334/// (e.g. a test fixture).
1335///
1336/// NOTE: The reporter is the *client* of this service.
1337///
1338/// Canonical usage is for a test to inject text via fuchsia.ui.test.input.Keyboad,
1339/// and wait for the client under test to report back that it received the injected
1340/// text via fuchsia.ui.test.input.KeyboardInputListener.
1341///
1342/// NOTE: This protocol is implemented by OOT code. Use versioning to make changes
1343/// to this protocol.
1344#[derive(Debug)]
1345pub enum KeyboardInputListenerRequest {
1346    /// Notify that the client is ready to receive text input. Clients that need
1347    /// to complete their setup to be able to continue with testing should call
1348    /// this method, so that the listener can wait until they are ready to
1349    /// proceed with testing.
1350    ReportReady { responder: KeyboardInputListenerReportReadyResponder },
1351    /// Notify the listener of the text string generated by the set of key events
1352    /// received by the application.
1353    ReportTextInput {
1354        payload: KeyboardInputListenerReportTextInputRequest,
1355        control_handle: KeyboardInputListenerControlHandle,
1356    },
1357}
1358
1359impl KeyboardInputListenerRequest {
1360    #[allow(irrefutable_let_patterns)]
1361    pub fn into_report_ready(self) -> Option<(KeyboardInputListenerReportReadyResponder)> {
1362        if let KeyboardInputListenerRequest::ReportReady { responder } = self {
1363            Some((responder))
1364        } else {
1365            None
1366        }
1367    }
1368
1369    #[allow(irrefutable_let_patterns)]
1370    pub fn into_report_text_input(
1371        self,
1372    ) -> Option<(KeyboardInputListenerReportTextInputRequest, KeyboardInputListenerControlHandle)>
1373    {
1374        if let KeyboardInputListenerRequest::ReportTextInput { payload, control_handle } = self {
1375            Some((payload, control_handle))
1376        } else {
1377            None
1378        }
1379    }
1380
1381    /// Name of the method defined in FIDL
1382    pub fn method_name(&self) -> &'static str {
1383        match *self {
1384            KeyboardInputListenerRequest::ReportReady { .. } => "report_ready",
1385            KeyboardInputListenerRequest::ReportTextInput { .. } => "report_text_input",
1386        }
1387    }
1388}
1389
1390#[derive(Debug, Clone)]
1391pub struct KeyboardInputListenerControlHandle {
1392    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1393}
1394
1395impl fidl::endpoints::ControlHandle for KeyboardInputListenerControlHandle {
1396    fn shutdown(&self) {
1397        self.inner.shutdown()
1398    }
1399
1400    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1401        self.inner.shutdown_with_epitaph(status)
1402    }
1403
1404    fn is_closed(&self) -> bool {
1405        self.inner.channel().is_closed()
1406    }
1407    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1408        self.inner.channel().on_closed()
1409    }
1410
1411    #[cfg(target_os = "fuchsia")]
1412    fn signal_peer(
1413        &self,
1414        clear_mask: zx::Signals,
1415        set_mask: zx::Signals,
1416    ) -> Result<(), zx_status::Status> {
1417        use fidl::Peered;
1418        self.inner.channel().signal_peer(clear_mask, set_mask)
1419    }
1420}
1421
1422impl KeyboardInputListenerControlHandle {}
1423
1424#[must_use = "FIDL methods require a response to be sent"]
1425#[derive(Debug)]
1426pub struct KeyboardInputListenerReportReadyResponder {
1427    control_handle: std::mem::ManuallyDrop<KeyboardInputListenerControlHandle>,
1428    tx_id: u32,
1429}
1430
1431/// Set the the channel to be shutdown (see [`KeyboardInputListenerControlHandle::shutdown`])
1432/// if the responder is dropped without sending a response, so that the client
1433/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1434impl std::ops::Drop for KeyboardInputListenerReportReadyResponder {
1435    fn drop(&mut self) {
1436        self.control_handle.shutdown();
1437        // Safety: drops once, never accessed again
1438        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1439    }
1440}
1441
1442impl fidl::endpoints::Responder for KeyboardInputListenerReportReadyResponder {
1443    type ControlHandle = KeyboardInputListenerControlHandle;
1444
1445    fn control_handle(&self) -> &KeyboardInputListenerControlHandle {
1446        &self.control_handle
1447    }
1448
1449    fn drop_without_shutdown(mut self) {
1450        // Safety: drops once, never accessed again due to mem::forget
1451        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1452        // Prevent Drop from running (which would shut down the channel)
1453        std::mem::forget(self);
1454    }
1455}
1456
1457impl KeyboardInputListenerReportReadyResponder {
1458    /// Sends a response to the FIDL transaction.
1459    ///
1460    /// Sets the channel to shutdown if an error occurs.
1461    pub fn send(self) -> Result<(), fidl::Error> {
1462        let _result = self.send_raw();
1463        if _result.is_err() {
1464            self.control_handle.shutdown();
1465        }
1466        self.drop_without_shutdown();
1467        _result
1468    }
1469
1470    /// Similar to "send" but does not shutdown the channel if an error occurs.
1471    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1472        let _result = self.send_raw();
1473        self.drop_without_shutdown();
1474        _result
1475    }
1476
1477    fn send_raw(&self) -> Result<(), fidl::Error> {
1478        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1479            (),
1480            self.tx_id,
1481            0x4b7f18cd3570971b,
1482            fidl::encoding::DynamicFlags::empty(),
1483        )
1484    }
1485}
1486
1487#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1488pub struct MediaButtonsDeviceMarker;
1489
1490impl fidl::endpoints::ProtocolMarker for MediaButtonsDeviceMarker {
1491    type Proxy = MediaButtonsDeviceProxy;
1492    type RequestStream = MediaButtonsDeviceRequestStream;
1493    #[cfg(target_os = "fuchsia")]
1494    type SynchronousProxy = MediaButtonsDeviceSynchronousProxy;
1495
1496    const DEBUG_NAME: &'static str = "(anonymous) MediaButtonsDevice";
1497}
1498
1499pub trait MediaButtonsDeviceProxyInterface: Send + Sync {
1500    type SimulateButtonPressResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1501        + Send;
1502    fn r#simulate_button_press(
1503        &self,
1504        payload: &MediaButtonsDeviceSimulateButtonPressRequest,
1505    ) -> Self::SimulateButtonPressResponseFut;
1506    type SendButtonsStateResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1507    fn r#send_buttons_state(
1508        &self,
1509        payload: &MediaButtonsDeviceSendButtonsStateRequest,
1510    ) -> Self::SendButtonsStateResponseFut;
1511    type ScheduleSimulateButtonPressResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1512        + Send;
1513    fn r#schedule_simulate_button_press(
1514        &self,
1515        payload: &MediaButtonsDeviceScheduleSimulateButtonPressRequest,
1516    ) -> Self::ScheduleSimulateButtonPressResponseFut;
1517}
1518#[derive(Debug)]
1519#[cfg(target_os = "fuchsia")]
1520pub struct MediaButtonsDeviceSynchronousProxy {
1521    client: fidl::client::sync::Client,
1522}
1523
1524#[cfg(target_os = "fuchsia")]
1525impl fidl::endpoints::SynchronousProxy for MediaButtonsDeviceSynchronousProxy {
1526    type Proxy = MediaButtonsDeviceProxy;
1527    type Protocol = MediaButtonsDeviceMarker;
1528
1529    fn from_channel(inner: fidl::Channel) -> Self {
1530        Self::new(inner)
1531    }
1532
1533    fn into_channel(self) -> fidl::Channel {
1534        self.client.into_channel()
1535    }
1536
1537    fn as_channel(&self) -> &fidl::Channel {
1538        self.client.as_channel()
1539    }
1540}
1541
1542#[cfg(target_os = "fuchsia")]
1543impl MediaButtonsDeviceSynchronousProxy {
1544    pub fn new(channel: fidl::Channel) -> Self {
1545        Self { client: fidl::client::sync::Client::new(channel) }
1546    }
1547
1548    pub fn into_channel(self) -> fidl::Channel {
1549        self.client.into_channel()
1550    }
1551
1552    /// Waits until an event arrives and returns it. It is safe for other
1553    /// threads to make concurrent requests while waiting for an event.
1554    pub fn wait_for_event(
1555        &self,
1556        deadline: zx::MonotonicInstant,
1557    ) -> Result<MediaButtonsDeviceEvent, fidl::Error> {
1558        MediaButtonsDeviceEvent::decode(
1559            self.client.wait_for_event::<MediaButtonsDeviceMarker>(deadline)?,
1560        )
1561    }
1562
1563    /// Simulates a button press and release on the requested button on the
1564    /// device.
1565    pub fn r#simulate_button_press(
1566        &self,
1567        mut payload: &MediaButtonsDeviceSimulateButtonPressRequest,
1568        ___deadline: zx::MonotonicInstant,
1569    ) -> Result<(), fidl::Error> {
1570        let _response = self.client.send_query::<
1571            MediaButtonsDeviceSimulateButtonPressRequest,
1572            fidl::encoding::EmptyPayload,
1573            MediaButtonsDeviceMarker,
1574        >(
1575            payload,
1576            0x256d8b895296c5b2,
1577            fidl::encoding::DynamicFlags::empty(),
1578            ___deadline,
1579        )?;
1580        Ok(_response)
1581    }
1582
1583    /// Send a vector of pressing button on the requested button on the
1584    /// device. Passing empty vector will release all pressing buttons.
1585    pub fn r#send_buttons_state(
1586        &self,
1587        mut payload: &MediaButtonsDeviceSendButtonsStateRequest,
1588        ___deadline: zx::MonotonicInstant,
1589    ) -> Result<(), fidl::Error> {
1590        let _response = self.client.send_query::<
1591            MediaButtonsDeviceSendButtonsStateRequest,
1592            fidl::encoding::EmptyPayload,
1593            MediaButtonsDeviceMarker,
1594        >(
1595            payload,
1596            0x254fc23643cdef6b,
1597            fidl::encoding::DynamicFlags::empty(),
1598            ___deadline,
1599        )?;
1600        Ok(_response)
1601    }
1602
1603    /// Schedules a button press and release of the requested button at a
1604    /// specific duration from now. "Now" is defined as the time when the request is processed by the
1605    /// device, so there is some latency.
1606    pub fn r#schedule_simulate_button_press(
1607        &self,
1608        mut payload: &MediaButtonsDeviceScheduleSimulateButtonPressRequest,
1609        ___deadline: zx::MonotonicInstant,
1610    ) -> Result<(), fidl::Error> {
1611        let _response = self.client.send_query::<
1612            MediaButtonsDeviceScheduleSimulateButtonPressRequest,
1613            fidl::encoding::EmptyPayload,
1614            MediaButtonsDeviceMarker,
1615        >(
1616            payload,
1617            0x6ea3a2530301eca,
1618            fidl::encoding::DynamicFlags::empty(),
1619            ___deadline,
1620        )?;
1621        Ok(_response)
1622    }
1623}
1624
1625#[cfg(target_os = "fuchsia")]
1626impl From<MediaButtonsDeviceSynchronousProxy> for zx::NullableHandle {
1627    fn from(value: MediaButtonsDeviceSynchronousProxy) -> Self {
1628        value.into_channel().into()
1629    }
1630}
1631
1632#[cfg(target_os = "fuchsia")]
1633impl From<fidl::Channel> for MediaButtonsDeviceSynchronousProxy {
1634    fn from(value: fidl::Channel) -> Self {
1635        Self::new(value)
1636    }
1637}
1638
1639#[cfg(target_os = "fuchsia")]
1640impl fidl::endpoints::FromClient for MediaButtonsDeviceSynchronousProxy {
1641    type Protocol = MediaButtonsDeviceMarker;
1642
1643    fn from_client(value: fidl::endpoints::ClientEnd<MediaButtonsDeviceMarker>) -> Self {
1644        Self::new(value.into_channel())
1645    }
1646}
1647
1648#[derive(Debug, Clone)]
1649pub struct MediaButtonsDeviceProxy {
1650    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1651}
1652
1653impl fidl::endpoints::Proxy for MediaButtonsDeviceProxy {
1654    type Protocol = MediaButtonsDeviceMarker;
1655
1656    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1657        Self::new(inner)
1658    }
1659
1660    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1661        self.client.into_channel().map_err(|client| Self { client })
1662    }
1663
1664    fn as_channel(&self) -> &::fidl::AsyncChannel {
1665        self.client.as_channel()
1666    }
1667}
1668
1669impl MediaButtonsDeviceProxy {
1670    /// Create a new Proxy for fuchsia.ui.test.input/MediaButtonsDevice.
1671    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1672        let protocol_name =
1673            <MediaButtonsDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1674        Self { client: fidl::client::Client::new(channel, protocol_name) }
1675    }
1676
1677    /// Get a Stream of events from the remote end of the protocol.
1678    ///
1679    /// # Panics
1680    ///
1681    /// Panics if the event stream was already taken.
1682    pub fn take_event_stream(&self) -> MediaButtonsDeviceEventStream {
1683        MediaButtonsDeviceEventStream { event_receiver: self.client.take_event_receiver() }
1684    }
1685
1686    /// Simulates a button press and release on the requested button on the
1687    /// device.
1688    pub fn r#simulate_button_press(
1689        &self,
1690        mut payload: &MediaButtonsDeviceSimulateButtonPressRequest,
1691    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1692        MediaButtonsDeviceProxyInterface::r#simulate_button_press(self, payload)
1693    }
1694
1695    /// Send a vector of pressing button on the requested button on the
1696    /// device. Passing empty vector will release all pressing buttons.
1697    pub fn r#send_buttons_state(
1698        &self,
1699        mut payload: &MediaButtonsDeviceSendButtonsStateRequest,
1700    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1701        MediaButtonsDeviceProxyInterface::r#send_buttons_state(self, payload)
1702    }
1703
1704    /// Schedules a button press and release of the requested button at a
1705    /// specific duration from now. "Now" is defined as the time when the request is processed by the
1706    /// device, so there is some latency.
1707    pub fn r#schedule_simulate_button_press(
1708        &self,
1709        mut payload: &MediaButtonsDeviceScheduleSimulateButtonPressRequest,
1710    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1711        MediaButtonsDeviceProxyInterface::r#schedule_simulate_button_press(self, payload)
1712    }
1713}
1714
1715impl MediaButtonsDeviceProxyInterface for MediaButtonsDeviceProxy {
1716    type SimulateButtonPressResponseFut =
1717        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1718    fn r#simulate_button_press(
1719        &self,
1720        mut payload: &MediaButtonsDeviceSimulateButtonPressRequest,
1721    ) -> Self::SimulateButtonPressResponseFut {
1722        fn _decode(
1723            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1724        ) -> Result<(), fidl::Error> {
1725            let _response = fidl::client::decode_transaction_body::<
1726                fidl::encoding::EmptyPayload,
1727                fidl::encoding::DefaultFuchsiaResourceDialect,
1728                0x256d8b895296c5b2,
1729            >(_buf?)?;
1730            Ok(_response)
1731        }
1732        self.client.send_query_and_decode::<MediaButtonsDeviceSimulateButtonPressRequest, ()>(
1733            payload,
1734            0x256d8b895296c5b2,
1735            fidl::encoding::DynamicFlags::empty(),
1736            _decode,
1737        )
1738    }
1739
1740    type SendButtonsStateResponseFut =
1741        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1742    fn r#send_buttons_state(
1743        &self,
1744        mut payload: &MediaButtonsDeviceSendButtonsStateRequest,
1745    ) -> Self::SendButtonsStateResponseFut {
1746        fn _decode(
1747            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1748        ) -> Result<(), fidl::Error> {
1749            let _response = fidl::client::decode_transaction_body::<
1750                fidl::encoding::EmptyPayload,
1751                fidl::encoding::DefaultFuchsiaResourceDialect,
1752                0x254fc23643cdef6b,
1753            >(_buf?)?;
1754            Ok(_response)
1755        }
1756        self.client.send_query_and_decode::<MediaButtonsDeviceSendButtonsStateRequest, ()>(
1757            payload,
1758            0x254fc23643cdef6b,
1759            fidl::encoding::DynamicFlags::empty(),
1760            _decode,
1761        )
1762    }
1763
1764    type ScheduleSimulateButtonPressResponseFut =
1765        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1766    fn r#schedule_simulate_button_press(
1767        &self,
1768        mut payload: &MediaButtonsDeviceScheduleSimulateButtonPressRequest,
1769    ) -> Self::ScheduleSimulateButtonPressResponseFut {
1770        fn _decode(
1771            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1772        ) -> Result<(), fidl::Error> {
1773            let _response = fidl::client::decode_transaction_body::<
1774                fidl::encoding::EmptyPayload,
1775                fidl::encoding::DefaultFuchsiaResourceDialect,
1776                0x6ea3a2530301eca,
1777            >(_buf?)?;
1778            Ok(_response)
1779        }
1780        self.client
1781            .send_query_and_decode::<MediaButtonsDeviceScheduleSimulateButtonPressRequest, ()>(
1782                payload,
1783                0x6ea3a2530301eca,
1784                fidl::encoding::DynamicFlags::empty(),
1785                _decode,
1786            )
1787    }
1788}
1789
1790pub struct MediaButtonsDeviceEventStream {
1791    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1792}
1793
1794impl std::marker::Unpin for MediaButtonsDeviceEventStream {}
1795
1796impl futures::stream::FusedStream for MediaButtonsDeviceEventStream {
1797    fn is_terminated(&self) -> bool {
1798        self.event_receiver.is_terminated()
1799    }
1800}
1801
1802impl futures::Stream for MediaButtonsDeviceEventStream {
1803    type Item = Result<MediaButtonsDeviceEvent, fidl::Error>;
1804
1805    fn poll_next(
1806        mut self: std::pin::Pin<&mut Self>,
1807        cx: &mut std::task::Context<'_>,
1808    ) -> std::task::Poll<Option<Self::Item>> {
1809        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1810            &mut self.event_receiver,
1811            cx
1812        )?) {
1813            Some(buf) => std::task::Poll::Ready(Some(MediaButtonsDeviceEvent::decode(buf))),
1814            None => std::task::Poll::Ready(None),
1815        }
1816    }
1817}
1818
1819#[derive(Debug)]
1820pub enum MediaButtonsDeviceEvent {}
1821
1822impl MediaButtonsDeviceEvent {
1823    /// Decodes a message buffer as a [`MediaButtonsDeviceEvent`].
1824    fn decode(
1825        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1826    ) -> Result<MediaButtonsDeviceEvent, fidl::Error> {
1827        let (bytes, _handles) = buf.split_mut();
1828        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1829        debug_assert_eq!(tx_header.tx_id, 0);
1830        match tx_header.ordinal {
1831            _ => Err(fidl::Error::UnknownOrdinal {
1832                ordinal: tx_header.ordinal,
1833                protocol_name:
1834                    <MediaButtonsDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1835            }),
1836        }
1837    }
1838}
1839
1840/// A Stream of incoming requests for fuchsia.ui.test.input/MediaButtonsDevice.
1841pub struct MediaButtonsDeviceRequestStream {
1842    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1843    is_terminated: bool,
1844}
1845
1846impl std::marker::Unpin for MediaButtonsDeviceRequestStream {}
1847
1848impl futures::stream::FusedStream for MediaButtonsDeviceRequestStream {
1849    fn is_terminated(&self) -> bool {
1850        self.is_terminated
1851    }
1852}
1853
1854impl fidl::endpoints::RequestStream for MediaButtonsDeviceRequestStream {
1855    type Protocol = MediaButtonsDeviceMarker;
1856    type ControlHandle = MediaButtonsDeviceControlHandle;
1857
1858    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1859        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1860    }
1861
1862    fn control_handle(&self) -> Self::ControlHandle {
1863        MediaButtonsDeviceControlHandle { inner: self.inner.clone() }
1864    }
1865
1866    fn into_inner(
1867        self,
1868    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1869    {
1870        (self.inner, self.is_terminated)
1871    }
1872
1873    fn from_inner(
1874        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1875        is_terminated: bool,
1876    ) -> Self {
1877        Self { inner, is_terminated }
1878    }
1879}
1880
1881impl futures::Stream for MediaButtonsDeviceRequestStream {
1882    type Item = Result<MediaButtonsDeviceRequest, fidl::Error>;
1883
1884    fn poll_next(
1885        mut self: std::pin::Pin<&mut Self>,
1886        cx: &mut std::task::Context<'_>,
1887    ) -> std::task::Poll<Option<Self::Item>> {
1888        let this = &mut *self;
1889        if this.inner.check_shutdown(cx) {
1890            this.is_terminated = true;
1891            return std::task::Poll::Ready(None);
1892        }
1893        if this.is_terminated {
1894            panic!("polled MediaButtonsDeviceRequestStream after completion");
1895        }
1896        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1897            |bytes, handles| {
1898                match this.inner.channel().read_etc(cx, bytes, handles) {
1899                    std::task::Poll::Ready(Ok(())) => {}
1900                    std::task::Poll::Pending => return std::task::Poll::Pending,
1901                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1902                        this.is_terminated = true;
1903                        return std::task::Poll::Ready(None);
1904                    }
1905                    std::task::Poll::Ready(Err(e)) => {
1906                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1907                            e.into(),
1908                        ))));
1909                    }
1910                }
1911
1912                // A message has been received from the channel
1913                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1914
1915                std::task::Poll::Ready(Some(match header.ordinal {
1916                0x256d8b895296c5b2 => {
1917                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1918                    let mut req = fidl::new_empty!(MediaButtonsDeviceSimulateButtonPressRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1919                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsDeviceSimulateButtonPressRequest>(&header, _body_bytes, handles, &mut req)?;
1920                    let control_handle = MediaButtonsDeviceControlHandle {
1921                        inner: this.inner.clone(),
1922                    };
1923                    Ok(MediaButtonsDeviceRequest::SimulateButtonPress {payload: req,
1924                        responder: MediaButtonsDeviceSimulateButtonPressResponder {
1925                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1926                            tx_id: header.tx_id,
1927                        },
1928                    })
1929                }
1930                0x254fc23643cdef6b => {
1931                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1932                    let mut req = fidl::new_empty!(MediaButtonsDeviceSendButtonsStateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1933                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsDeviceSendButtonsStateRequest>(&header, _body_bytes, handles, &mut req)?;
1934                    let control_handle = MediaButtonsDeviceControlHandle {
1935                        inner: this.inner.clone(),
1936                    };
1937                    Ok(MediaButtonsDeviceRequest::SendButtonsState {payload: req,
1938                        responder: MediaButtonsDeviceSendButtonsStateResponder {
1939                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1940                            tx_id: header.tx_id,
1941                        },
1942                    })
1943                }
1944                0x6ea3a2530301eca => {
1945                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1946                    let mut req = fidl::new_empty!(MediaButtonsDeviceScheduleSimulateButtonPressRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1947                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MediaButtonsDeviceScheduleSimulateButtonPressRequest>(&header, _body_bytes, handles, &mut req)?;
1948                    let control_handle = MediaButtonsDeviceControlHandle {
1949                        inner: this.inner.clone(),
1950                    };
1951                    Ok(MediaButtonsDeviceRequest::ScheduleSimulateButtonPress {payload: req,
1952                        responder: MediaButtonsDeviceScheduleSimulateButtonPressResponder {
1953                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1954                            tx_id: header.tx_id,
1955                        },
1956                    })
1957                }
1958                _ => Err(fidl::Error::UnknownOrdinal {
1959                    ordinal: header.ordinal,
1960                    protocol_name: <MediaButtonsDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1961                }),
1962            }))
1963            },
1964        )
1965    }
1966}
1967
1968/// A tool to inject media button events into Input Pipeline.
1969///
1970/// Please extend as necessary.
1971#[derive(Debug)]
1972pub enum MediaButtonsDeviceRequest {
1973    /// Simulates a button press and release on the requested button on the
1974    /// device.
1975    SimulateButtonPress {
1976        payload: MediaButtonsDeviceSimulateButtonPressRequest,
1977        responder: MediaButtonsDeviceSimulateButtonPressResponder,
1978    },
1979    /// Send a vector of pressing button on the requested button on the
1980    /// device. Passing empty vector will release all pressing buttons.
1981    SendButtonsState {
1982        payload: MediaButtonsDeviceSendButtonsStateRequest,
1983        responder: MediaButtonsDeviceSendButtonsStateResponder,
1984    },
1985    /// Schedules a button press and release of the requested button at a
1986    /// specific duration from now. "Now" is defined as the time when the request is processed by the
1987    /// device, so there is some latency.
1988    ScheduleSimulateButtonPress {
1989        payload: MediaButtonsDeviceScheduleSimulateButtonPressRequest,
1990        responder: MediaButtonsDeviceScheduleSimulateButtonPressResponder,
1991    },
1992}
1993
1994impl MediaButtonsDeviceRequest {
1995    #[allow(irrefutable_let_patterns)]
1996    pub fn into_simulate_button_press(
1997        self,
1998    ) -> Option<(
1999        MediaButtonsDeviceSimulateButtonPressRequest,
2000        MediaButtonsDeviceSimulateButtonPressResponder,
2001    )> {
2002        if let MediaButtonsDeviceRequest::SimulateButtonPress { payload, responder } = self {
2003            Some((payload, responder))
2004        } else {
2005            None
2006        }
2007    }
2008
2009    #[allow(irrefutable_let_patterns)]
2010    pub fn into_send_buttons_state(
2011        self,
2012    ) -> Option<(
2013        MediaButtonsDeviceSendButtonsStateRequest,
2014        MediaButtonsDeviceSendButtonsStateResponder,
2015    )> {
2016        if let MediaButtonsDeviceRequest::SendButtonsState { payload, responder } = self {
2017            Some((payload, responder))
2018        } else {
2019            None
2020        }
2021    }
2022
2023    #[allow(irrefutable_let_patterns)]
2024    pub fn into_schedule_simulate_button_press(
2025        self,
2026    ) -> Option<(
2027        MediaButtonsDeviceScheduleSimulateButtonPressRequest,
2028        MediaButtonsDeviceScheduleSimulateButtonPressResponder,
2029    )> {
2030        if let MediaButtonsDeviceRequest::ScheduleSimulateButtonPress { payload, responder } = self
2031        {
2032            Some((payload, responder))
2033        } else {
2034            None
2035        }
2036    }
2037
2038    /// Name of the method defined in FIDL
2039    pub fn method_name(&self) -> &'static str {
2040        match *self {
2041            MediaButtonsDeviceRequest::SimulateButtonPress { .. } => "simulate_button_press",
2042            MediaButtonsDeviceRequest::SendButtonsState { .. } => "send_buttons_state",
2043            MediaButtonsDeviceRequest::ScheduleSimulateButtonPress { .. } => {
2044                "schedule_simulate_button_press"
2045            }
2046        }
2047    }
2048}
2049
2050#[derive(Debug, Clone)]
2051pub struct MediaButtonsDeviceControlHandle {
2052    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2053}
2054
2055impl fidl::endpoints::ControlHandle for MediaButtonsDeviceControlHandle {
2056    fn shutdown(&self) {
2057        self.inner.shutdown()
2058    }
2059
2060    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2061        self.inner.shutdown_with_epitaph(status)
2062    }
2063
2064    fn is_closed(&self) -> bool {
2065        self.inner.channel().is_closed()
2066    }
2067    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2068        self.inner.channel().on_closed()
2069    }
2070
2071    #[cfg(target_os = "fuchsia")]
2072    fn signal_peer(
2073        &self,
2074        clear_mask: zx::Signals,
2075        set_mask: zx::Signals,
2076    ) -> Result<(), zx_status::Status> {
2077        use fidl::Peered;
2078        self.inner.channel().signal_peer(clear_mask, set_mask)
2079    }
2080}
2081
2082impl MediaButtonsDeviceControlHandle {}
2083
2084#[must_use = "FIDL methods require a response to be sent"]
2085#[derive(Debug)]
2086pub struct MediaButtonsDeviceSimulateButtonPressResponder {
2087    control_handle: std::mem::ManuallyDrop<MediaButtonsDeviceControlHandle>,
2088    tx_id: u32,
2089}
2090
2091/// Set the the channel to be shutdown (see [`MediaButtonsDeviceControlHandle::shutdown`])
2092/// if the responder is dropped without sending a response, so that the client
2093/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2094impl std::ops::Drop for MediaButtonsDeviceSimulateButtonPressResponder {
2095    fn drop(&mut self) {
2096        self.control_handle.shutdown();
2097        // Safety: drops once, never accessed again
2098        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2099    }
2100}
2101
2102impl fidl::endpoints::Responder for MediaButtonsDeviceSimulateButtonPressResponder {
2103    type ControlHandle = MediaButtonsDeviceControlHandle;
2104
2105    fn control_handle(&self) -> &MediaButtonsDeviceControlHandle {
2106        &self.control_handle
2107    }
2108
2109    fn drop_without_shutdown(mut self) {
2110        // Safety: drops once, never accessed again due to mem::forget
2111        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2112        // Prevent Drop from running (which would shut down the channel)
2113        std::mem::forget(self);
2114    }
2115}
2116
2117impl MediaButtonsDeviceSimulateButtonPressResponder {
2118    /// Sends a response to the FIDL transaction.
2119    ///
2120    /// Sets the channel to shutdown if an error occurs.
2121    pub fn send(self) -> Result<(), fidl::Error> {
2122        let _result = self.send_raw();
2123        if _result.is_err() {
2124            self.control_handle.shutdown();
2125        }
2126        self.drop_without_shutdown();
2127        _result
2128    }
2129
2130    /// Similar to "send" but does not shutdown the channel if an error occurs.
2131    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2132        let _result = self.send_raw();
2133        self.drop_without_shutdown();
2134        _result
2135    }
2136
2137    fn send_raw(&self) -> Result<(), fidl::Error> {
2138        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2139            (),
2140            self.tx_id,
2141            0x256d8b895296c5b2,
2142            fidl::encoding::DynamicFlags::empty(),
2143        )
2144    }
2145}
2146
2147#[must_use = "FIDL methods require a response to be sent"]
2148#[derive(Debug)]
2149pub struct MediaButtonsDeviceSendButtonsStateResponder {
2150    control_handle: std::mem::ManuallyDrop<MediaButtonsDeviceControlHandle>,
2151    tx_id: u32,
2152}
2153
2154/// Set the the channel to be shutdown (see [`MediaButtonsDeviceControlHandle::shutdown`])
2155/// if the responder is dropped without sending a response, so that the client
2156/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2157impl std::ops::Drop for MediaButtonsDeviceSendButtonsStateResponder {
2158    fn drop(&mut self) {
2159        self.control_handle.shutdown();
2160        // Safety: drops once, never accessed again
2161        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2162    }
2163}
2164
2165impl fidl::endpoints::Responder for MediaButtonsDeviceSendButtonsStateResponder {
2166    type ControlHandle = MediaButtonsDeviceControlHandle;
2167
2168    fn control_handle(&self) -> &MediaButtonsDeviceControlHandle {
2169        &self.control_handle
2170    }
2171
2172    fn drop_without_shutdown(mut self) {
2173        // Safety: drops once, never accessed again due to mem::forget
2174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2175        // Prevent Drop from running (which would shut down the channel)
2176        std::mem::forget(self);
2177    }
2178}
2179
2180impl MediaButtonsDeviceSendButtonsStateResponder {
2181    /// Sends a response to the FIDL transaction.
2182    ///
2183    /// Sets the channel to shutdown if an error occurs.
2184    pub fn send(self) -> Result<(), fidl::Error> {
2185        let _result = self.send_raw();
2186        if _result.is_err() {
2187            self.control_handle.shutdown();
2188        }
2189        self.drop_without_shutdown();
2190        _result
2191    }
2192
2193    /// Similar to "send" but does not shutdown the channel if an error occurs.
2194    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2195        let _result = self.send_raw();
2196        self.drop_without_shutdown();
2197        _result
2198    }
2199
2200    fn send_raw(&self) -> Result<(), fidl::Error> {
2201        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2202            (),
2203            self.tx_id,
2204            0x254fc23643cdef6b,
2205            fidl::encoding::DynamicFlags::empty(),
2206        )
2207    }
2208}
2209
2210#[must_use = "FIDL methods require a response to be sent"]
2211#[derive(Debug)]
2212pub struct MediaButtonsDeviceScheduleSimulateButtonPressResponder {
2213    control_handle: std::mem::ManuallyDrop<MediaButtonsDeviceControlHandle>,
2214    tx_id: u32,
2215}
2216
2217/// Set the the channel to be shutdown (see [`MediaButtonsDeviceControlHandle::shutdown`])
2218/// if the responder is dropped without sending a response, so that the client
2219/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2220impl std::ops::Drop for MediaButtonsDeviceScheduleSimulateButtonPressResponder {
2221    fn drop(&mut self) {
2222        self.control_handle.shutdown();
2223        // Safety: drops once, never accessed again
2224        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2225    }
2226}
2227
2228impl fidl::endpoints::Responder for MediaButtonsDeviceScheduleSimulateButtonPressResponder {
2229    type ControlHandle = MediaButtonsDeviceControlHandle;
2230
2231    fn control_handle(&self) -> &MediaButtonsDeviceControlHandle {
2232        &self.control_handle
2233    }
2234
2235    fn drop_without_shutdown(mut self) {
2236        // Safety: drops once, never accessed again due to mem::forget
2237        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2238        // Prevent Drop from running (which would shut down the channel)
2239        std::mem::forget(self);
2240    }
2241}
2242
2243impl MediaButtonsDeviceScheduleSimulateButtonPressResponder {
2244    /// Sends a response to the FIDL transaction.
2245    ///
2246    /// Sets the channel to shutdown if an error occurs.
2247    pub fn send(self) -> Result<(), fidl::Error> {
2248        let _result = self.send_raw();
2249        if _result.is_err() {
2250            self.control_handle.shutdown();
2251        }
2252        self.drop_without_shutdown();
2253        _result
2254    }
2255
2256    /// Similar to "send" but does not shutdown the channel if an error occurs.
2257    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2258        let _result = self.send_raw();
2259        self.drop_without_shutdown();
2260        _result
2261    }
2262
2263    fn send_raw(&self) -> Result<(), fidl::Error> {
2264        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2265            (),
2266            self.tx_id,
2267            0x6ea3a2530301eca,
2268            fidl::encoding::DynamicFlags::empty(),
2269        )
2270    }
2271}
2272
2273#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2274pub struct MouseMarker;
2275
2276impl fidl::endpoints::ProtocolMarker for MouseMarker {
2277    type Proxy = MouseProxy;
2278    type RequestStream = MouseRequestStream;
2279    #[cfg(target_os = "fuchsia")]
2280    type SynchronousProxy = MouseSynchronousProxy;
2281
2282    const DEBUG_NAME: &'static str = "fuchsia.ui.test.input.Mouse";
2283}
2284impl fidl::endpoints::DiscoverableProtocolMarker for MouseMarker {}
2285
2286pub trait MouseProxyInterface: Send + Sync {
2287    type SimulateMouseEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2288    fn r#simulate_mouse_event(
2289        &self,
2290        payload: &MouseSimulateMouseEventRequest,
2291    ) -> Self::SimulateMouseEventResponseFut;
2292}
2293#[derive(Debug)]
2294#[cfg(target_os = "fuchsia")]
2295pub struct MouseSynchronousProxy {
2296    client: fidl::client::sync::Client,
2297}
2298
2299#[cfg(target_os = "fuchsia")]
2300impl fidl::endpoints::SynchronousProxy for MouseSynchronousProxy {
2301    type Proxy = MouseProxy;
2302    type Protocol = MouseMarker;
2303
2304    fn from_channel(inner: fidl::Channel) -> Self {
2305        Self::new(inner)
2306    }
2307
2308    fn into_channel(self) -> fidl::Channel {
2309        self.client.into_channel()
2310    }
2311
2312    fn as_channel(&self) -> &fidl::Channel {
2313        self.client.as_channel()
2314    }
2315}
2316
2317#[cfg(target_os = "fuchsia")]
2318impl MouseSynchronousProxy {
2319    pub fn new(channel: fidl::Channel) -> Self {
2320        Self { client: fidl::client::sync::Client::new(channel) }
2321    }
2322
2323    pub fn into_channel(self) -> fidl::Channel {
2324        self.client.into_channel()
2325    }
2326
2327    /// Waits until an event arrives and returns it. It is safe for other
2328    /// threads to make concurrent requests while waiting for an event.
2329    pub fn wait_for_event(
2330        &self,
2331        deadline: zx::MonotonicInstant,
2332    ) -> Result<MouseEvent, fidl::Error> {
2333        MouseEvent::decode(self.client.wait_for_event::<MouseMarker>(deadline)?)
2334    }
2335
2336    /// Injects an input report corresponding to the event specified.
2337    ///
2338    /// NOTE: the `movement` parameters have a range of [-1000, 1000],
2339    /// and the `scroll` parameters have a range of [-100, 100].
2340    pub fn r#simulate_mouse_event(
2341        &self,
2342        mut payload: &MouseSimulateMouseEventRequest,
2343        ___deadline: zx::MonotonicInstant,
2344    ) -> Result<(), fidl::Error> {
2345        let _response = self.client.send_query::<
2346            MouseSimulateMouseEventRequest,
2347            fidl::encoding::EmptyPayload,
2348            MouseMarker,
2349        >(
2350            payload,
2351            0x55c55dcd35c8768f,
2352            fidl::encoding::DynamicFlags::empty(),
2353            ___deadline,
2354        )?;
2355        Ok(_response)
2356    }
2357}
2358
2359#[cfg(target_os = "fuchsia")]
2360impl From<MouseSynchronousProxy> for zx::NullableHandle {
2361    fn from(value: MouseSynchronousProxy) -> Self {
2362        value.into_channel().into()
2363    }
2364}
2365
2366#[cfg(target_os = "fuchsia")]
2367impl From<fidl::Channel> for MouseSynchronousProxy {
2368    fn from(value: fidl::Channel) -> Self {
2369        Self::new(value)
2370    }
2371}
2372
2373#[cfg(target_os = "fuchsia")]
2374impl fidl::endpoints::FromClient for MouseSynchronousProxy {
2375    type Protocol = MouseMarker;
2376
2377    fn from_client(value: fidl::endpoints::ClientEnd<MouseMarker>) -> Self {
2378        Self::new(value.into_channel())
2379    }
2380}
2381
2382#[derive(Debug, Clone)]
2383pub struct MouseProxy {
2384    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2385}
2386
2387impl fidl::endpoints::Proxy for MouseProxy {
2388    type Protocol = MouseMarker;
2389
2390    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2391        Self::new(inner)
2392    }
2393
2394    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2395        self.client.into_channel().map_err(|client| Self { client })
2396    }
2397
2398    fn as_channel(&self) -> &::fidl::AsyncChannel {
2399        self.client.as_channel()
2400    }
2401}
2402
2403impl MouseProxy {
2404    /// Create a new Proxy for fuchsia.ui.test.input/Mouse.
2405    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2406        let protocol_name = <MouseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2407        Self { client: fidl::client::Client::new(channel, protocol_name) }
2408    }
2409
2410    /// Get a Stream of events from the remote end of the protocol.
2411    ///
2412    /// # Panics
2413    ///
2414    /// Panics if the event stream was already taken.
2415    pub fn take_event_stream(&self) -> MouseEventStream {
2416        MouseEventStream { event_receiver: self.client.take_event_receiver() }
2417    }
2418
2419    /// Injects an input report corresponding to the event specified.
2420    ///
2421    /// NOTE: the `movement` parameters have a range of [-1000, 1000],
2422    /// and the `scroll` parameters have a range of [-100, 100].
2423    pub fn r#simulate_mouse_event(
2424        &self,
2425        mut payload: &MouseSimulateMouseEventRequest,
2426    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2427        MouseProxyInterface::r#simulate_mouse_event(self, payload)
2428    }
2429}
2430
2431impl MouseProxyInterface for MouseProxy {
2432    type SimulateMouseEventResponseFut =
2433        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2434    fn r#simulate_mouse_event(
2435        &self,
2436        mut payload: &MouseSimulateMouseEventRequest,
2437    ) -> Self::SimulateMouseEventResponseFut {
2438        fn _decode(
2439            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2440        ) -> Result<(), fidl::Error> {
2441            let _response = fidl::client::decode_transaction_body::<
2442                fidl::encoding::EmptyPayload,
2443                fidl::encoding::DefaultFuchsiaResourceDialect,
2444                0x55c55dcd35c8768f,
2445            >(_buf?)?;
2446            Ok(_response)
2447        }
2448        self.client.send_query_and_decode::<MouseSimulateMouseEventRequest, ()>(
2449            payload,
2450            0x55c55dcd35c8768f,
2451            fidl::encoding::DynamicFlags::empty(),
2452            _decode,
2453        )
2454    }
2455}
2456
2457pub struct MouseEventStream {
2458    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2459}
2460
2461impl std::marker::Unpin for MouseEventStream {}
2462
2463impl futures::stream::FusedStream for MouseEventStream {
2464    fn is_terminated(&self) -> bool {
2465        self.event_receiver.is_terminated()
2466    }
2467}
2468
2469impl futures::Stream for MouseEventStream {
2470    type Item = Result<MouseEvent, fidl::Error>;
2471
2472    fn poll_next(
2473        mut self: std::pin::Pin<&mut Self>,
2474        cx: &mut std::task::Context<'_>,
2475    ) -> std::task::Poll<Option<Self::Item>> {
2476        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2477            &mut self.event_receiver,
2478            cx
2479        )?) {
2480            Some(buf) => std::task::Poll::Ready(Some(MouseEvent::decode(buf))),
2481            None => std::task::Poll::Ready(None),
2482        }
2483    }
2484}
2485
2486#[derive(Debug)]
2487pub enum MouseEvent {}
2488
2489impl MouseEvent {
2490    /// Decodes a message buffer as a [`MouseEvent`].
2491    fn decode(
2492        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2493    ) -> Result<MouseEvent, fidl::Error> {
2494        let (bytes, _handles) = buf.split_mut();
2495        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2496        debug_assert_eq!(tx_header.tx_id, 0);
2497        match tx_header.ordinal {
2498            _ => Err(fidl::Error::UnknownOrdinal {
2499                ordinal: tx_header.ordinal,
2500                protocol_name: <MouseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2501            }),
2502        }
2503    }
2504}
2505
2506/// A Stream of incoming requests for fuchsia.ui.test.input/Mouse.
2507pub struct MouseRequestStream {
2508    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2509    is_terminated: bool,
2510}
2511
2512impl std::marker::Unpin for MouseRequestStream {}
2513
2514impl futures::stream::FusedStream for MouseRequestStream {
2515    fn is_terminated(&self) -> bool {
2516        self.is_terminated
2517    }
2518}
2519
2520impl fidl::endpoints::RequestStream for MouseRequestStream {
2521    type Protocol = MouseMarker;
2522    type ControlHandle = MouseControlHandle;
2523
2524    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2525        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2526    }
2527
2528    fn control_handle(&self) -> Self::ControlHandle {
2529        MouseControlHandle { inner: self.inner.clone() }
2530    }
2531
2532    fn into_inner(
2533        self,
2534    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2535    {
2536        (self.inner, self.is_terminated)
2537    }
2538
2539    fn from_inner(
2540        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2541        is_terminated: bool,
2542    ) -> Self {
2543        Self { inner, is_terminated }
2544    }
2545}
2546
2547impl futures::Stream for MouseRequestStream {
2548    type Item = Result<MouseRequest, fidl::Error>;
2549
2550    fn poll_next(
2551        mut self: std::pin::Pin<&mut Self>,
2552        cx: &mut std::task::Context<'_>,
2553    ) -> std::task::Poll<Option<Self::Item>> {
2554        let this = &mut *self;
2555        if this.inner.check_shutdown(cx) {
2556            this.is_terminated = true;
2557            return std::task::Poll::Ready(None);
2558        }
2559        if this.is_terminated {
2560            panic!("polled MouseRequestStream after completion");
2561        }
2562        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2563            |bytes, handles| {
2564                match this.inner.channel().read_etc(cx, bytes, handles) {
2565                    std::task::Poll::Ready(Ok(())) => {}
2566                    std::task::Poll::Pending => return std::task::Poll::Pending,
2567                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2568                        this.is_terminated = true;
2569                        return std::task::Poll::Ready(None);
2570                    }
2571                    std::task::Poll::Ready(Err(e)) => {
2572                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2573                            e.into(),
2574                        ))));
2575                    }
2576                }
2577
2578                // A message has been received from the channel
2579                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2580
2581                std::task::Poll::Ready(Some(match header.ordinal {
2582                    0x55c55dcd35c8768f => {
2583                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2584                        let mut req = fidl::new_empty!(
2585                            MouseSimulateMouseEventRequest,
2586                            fidl::encoding::DefaultFuchsiaResourceDialect
2587                        );
2588                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MouseSimulateMouseEventRequest>(&header, _body_bytes, handles, &mut req)?;
2589                        let control_handle = MouseControlHandle { inner: this.inner.clone() };
2590                        Ok(MouseRequest::SimulateMouseEvent {
2591                            payload: req,
2592                            responder: MouseSimulateMouseEventResponder {
2593                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2594                                tx_id: header.tx_id,
2595                            },
2596                        })
2597                    }
2598                    _ => Err(fidl::Error::UnknownOrdinal {
2599                        ordinal: header.ordinal,
2600                        protocol_name: <MouseMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2601                    }),
2602                }))
2603            },
2604        )
2605    }
2606}
2607
2608/// A tool to inject mouse events into Input Pipeline.
2609///
2610/// Please extend as necessary.
2611#[derive(Debug)]
2612pub enum MouseRequest {
2613    /// Injects an input report corresponding to the event specified.
2614    ///
2615    /// NOTE: the `movement` parameters have a range of [-1000, 1000],
2616    /// and the `scroll` parameters have a range of [-100, 100].
2617    SimulateMouseEvent {
2618        payload: MouseSimulateMouseEventRequest,
2619        responder: MouseSimulateMouseEventResponder,
2620    },
2621}
2622
2623impl MouseRequest {
2624    #[allow(irrefutable_let_patterns)]
2625    pub fn into_simulate_mouse_event(
2626        self,
2627    ) -> Option<(MouseSimulateMouseEventRequest, MouseSimulateMouseEventResponder)> {
2628        if let MouseRequest::SimulateMouseEvent { payload, responder } = self {
2629            Some((payload, responder))
2630        } else {
2631            None
2632        }
2633    }
2634
2635    /// Name of the method defined in FIDL
2636    pub fn method_name(&self) -> &'static str {
2637        match *self {
2638            MouseRequest::SimulateMouseEvent { .. } => "simulate_mouse_event",
2639        }
2640    }
2641}
2642
2643#[derive(Debug, Clone)]
2644pub struct MouseControlHandle {
2645    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2646}
2647
2648impl fidl::endpoints::ControlHandle for MouseControlHandle {
2649    fn shutdown(&self) {
2650        self.inner.shutdown()
2651    }
2652
2653    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2654        self.inner.shutdown_with_epitaph(status)
2655    }
2656
2657    fn is_closed(&self) -> bool {
2658        self.inner.channel().is_closed()
2659    }
2660    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2661        self.inner.channel().on_closed()
2662    }
2663
2664    #[cfg(target_os = "fuchsia")]
2665    fn signal_peer(
2666        &self,
2667        clear_mask: zx::Signals,
2668        set_mask: zx::Signals,
2669    ) -> Result<(), zx_status::Status> {
2670        use fidl::Peered;
2671        self.inner.channel().signal_peer(clear_mask, set_mask)
2672    }
2673}
2674
2675impl MouseControlHandle {}
2676
2677#[must_use = "FIDL methods require a response to be sent"]
2678#[derive(Debug)]
2679pub struct MouseSimulateMouseEventResponder {
2680    control_handle: std::mem::ManuallyDrop<MouseControlHandle>,
2681    tx_id: u32,
2682}
2683
2684/// Set the the channel to be shutdown (see [`MouseControlHandle::shutdown`])
2685/// if the responder is dropped without sending a response, so that the client
2686/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2687impl std::ops::Drop for MouseSimulateMouseEventResponder {
2688    fn drop(&mut self) {
2689        self.control_handle.shutdown();
2690        // Safety: drops once, never accessed again
2691        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2692    }
2693}
2694
2695impl fidl::endpoints::Responder for MouseSimulateMouseEventResponder {
2696    type ControlHandle = MouseControlHandle;
2697
2698    fn control_handle(&self) -> &MouseControlHandle {
2699        &self.control_handle
2700    }
2701
2702    fn drop_without_shutdown(mut self) {
2703        // Safety: drops once, never accessed again due to mem::forget
2704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2705        // Prevent Drop from running (which would shut down the channel)
2706        std::mem::forget(self);
2707    }
2708}
2709
2710impl MouseSimulateMouseEventResponder {
2711    /// Sends a response to the FIDL transaction.
2712    ///
2713    /// Sets the channel to shutdown if an error occurs.
2714    pub fn send(self) -> Result<(), fidl::Error> {
2715        let _result = self.send_raw();
2716        if _result.is_err() {
2717            self.control_handle.shutdown();
2718        }
2719        self.drop_without_shutdown();
2720        _result
2721    }
2722
2723    /// Similar to "send" but does not shutdown the channel if an error occurs.
2724    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2725        let _result = self.send_raw();
2726        self.drop_without_shutdown();
2727        _result
2728    }
2729
2730    fn send_raw(&self) -> Result<(), fidl::Error> {
2731        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2732            (),
2733            self.tx_id,
2734            0x55c55dcd35c8768f,
2735            fidl::encoding::DynamicFlags::empty(),
2736        )
2737    }
2738}
2739
2740#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2741pub struct MouseInputListenerMarker;
2742
2743impl fidl::endpoints::ProtocolMarker for MouseInputListenerMarker {
2744    type Proxy = MouseInputListenerProxy;
2745    type RequestStream = MouseInputListenerRequestStream;
2746    #[cfg(target_os = "fuchsia")]
2747    type SynchronousProxy = MouseInputListenerSynchronousProxy;
2748
2749    const DEBUG_NAME: &'static str = "fuchsia.ui.test.input.MouseInputListener";
2750}
2751impl fidl::endpoints::DiscoverableProtocolMarker for MouseInputListenerMarker {}
2752
2753pub trait MouseInputListenerProxyInterface: Send + Sync {
2754    fn r#report_mouse_input(
2755        &self,
2756        payload: &MouseInputListenerReportMouseInputRequest,
2757    ) -> Result<(), fidl::Error>;
2758}
2759#[derive(Debug)]
2760#[cfg(target_os = "fuchsia")]
2761pub struct MouseInputListenerSynchronousProxy {
2762    client: fidl::client::sync::Client,
2763}
2764
2765#[cfg(target_os = "fuchsia")]
2766impl fidl::endpoints::SynchronousProxy for MouseInputListenerSynchronousProxy {
2767    type Proxy = MouseInputListenerProxy;
2768    type Protocol = MouseInputListenerMarker;
2769
2770    fn from_channel(inner: fidl::Channel) -> Self {
2771        Self::new(inner)
2772    }
2773
2774    fn into_channel(self) -> fidl::Channel {
2775        self.client.into_channel()
2776    }
2777
2778    fn as_channel(&self) -> &fidl::Channel {
2779        self.client.as_channel()
2780    }
2781}
2782
2783#[cfg(target_os = "fuchsia")]
2784impl MouseInputListenerSynchronousProxy {
2785    pub fn new(channel: fidl::Channel) -> Self {
2786        Self { client: fidl::client::sync::Client::new(channel) }
2787    }
2788
2789    pub fn into_channel(self) -> fidl::Channel {
2790        self.client.into_channel()
2791    }
2792
2793    /// Waits until an event arrives and returns it. It is safe for other
2794    /// threads to make concurrent requests while waiting for an event.
2795    pub fn wait_for_event(
2796        &self,
2797        deadline: zx::MonotonicInstant,
2798    ) -> Result<MouseInputListenerEvent, fidl::Error> {
2799        MouseInputListenerEvent::decode(
2800            self.client.wait_for_event::<MouseInputListenerMarker>(deadline)?,
2801        )
2802    }
2803
2804    /// Report that component under test has received expected input.
2805    pub fn r#report_mouse_input(
2806        &self,
2807        mut payload: &MouseInputListenerReportMouseInputRequest,
2808    ) -> Result<(), fidl::Error> {
2809        self.client.send::<MouseInputListenerReportMouseInputRequest>(
2810            payload,
2811            0x78182130ca3aff13,
2812            fidl::encoding::DynamicFlags::empty(),
2813        )
2814    }
2815}
2816
2817#[cfg(target_os = "fuchsia")]
2818impl From<MouseInputListenerSynchronousProxy> for zx::NullableHandle {
2819    fn from(value: MouseInputListenerSynchronousProxy) -> Self {
2820        value.into_channel().into()
2821    }
2822}
2823
2824#[cfg(target_os = "fuchsia")]
2825impl From<fidl::Channel> for MouseInputListenerSynchronousProxy {
2826    fn from(value: fidl::Channel) -> Self {
2827        Self::new(value)
2828    }
2829}
2830
2831#[cfg(target_os = "fuchsia")]
2832impl fidl::endpoints::FromClient for MouseInputListenerSynchronousProxy {
2833    type Protocol = MouseInputListenerMarker;
2834
2835    fn from_client(value: fidl::endpoints::ClientEnd<MouseInputListenerMarker>) -> Self {
2836        Self::new(value.into_channel())
2837    }
2838}
2839
2840#[derive(Debug, Clone)]
2841pub struct MouseInputListenerProxy {
2842    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2843}
2844
2845impl fidl::endpoints::Proxy for MouseInputListenerProxy {
2846    type Protocol = MouseInputListenerMarker;
2847
2848    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2849        Self::new(inner)
2850    }
2851
2852    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2853        self.client.into_channel().map_err(|client| Self { client })
2854    }
2855
2856    fn as_channel(&self) -> &::fidl::AsyncChannel {
2857        self.client.as_channel()
2858    }
2859}
2860
2861impl MouseInputListenerProxy {
2862    /// Create a new Proxy for fuchsia.ui.test.input/MouseInputListener.
2863    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2864        let protocol_name =
2865            <MouseInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2866        Self { client: fidl::client::Client::new(channel, protocol_name) }
2867    }
2868
2869    /// Get a Stream of events from the remote end of the protocol.
2870    ///
2871    /// # Panics
2872    ///
2873    /// Panics if the event stream was already taken.
2874    pub fn take_event_stream(&self) -> MouseInputListenerEventStream {
2875        MouseInputListenerEventStream { event_receiver: self.client.take_event_receiver() }
2876    }
2877
2878    /// Report that component under test has received expected input.
2879    pub fn r#report_mouse_input(
2880        &self,
2881        mut payload: &MouseInputListenerReportMouseInputRequest,
2882    ) -> Result<(), fidl::Error> {
2883        MouseInputListenerProxyInterface::r#report_mouse_input(self, payload)
2884    }
2885}
2886
2887impl MouseInputListenerProxyInterface for MouseInputListenerProxy {
2888    fn r#report_mouse_input(
2889        &self,
2890        mut payload: &MouseInputListenerReportMouseInputRequest,
2891    ) -> Result<(), fidl::Error> {
2892        self.client.send::<MouseInputListenerReportMouseInputRequest>(
2893            payload,
2894            0x78182130ca3aff13,
2895            fidl::encoding::DynamicFlags::empty(),
2896        )
2897    }
2898}
2899
2900pub struct MouseInputListenerEventStream {
2901    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2902}
2903
2904impl std::marker::Unpin for MouseInputListenerEventStream {}
2905
2906impl futures::stream::FusedStream for MouseInputListenerEventStream {
2907    fn is_terminated(&self) -> bool {
2908        self.event_receiver.is_terminated()
2909    }
2910}
2911
2912impl futures::Stream for MouseInputListenerEventStream {
2913    type Item = Result<MouseInputListenerEvent, fidl::Error>;
2914
2915    fn poll_next(
2916        mut self: std::pin::Pin<&mut Self>,
2917        cx: &mut std::task::Context<'_>,
2918    ) -> std::task::Poll<Option<Self::Item>> {
2919        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2920            &mut self.event_receiver,
2921            cx
2922        )?) {
2923            Some(buf) => std::task::Poll::Ready(Some(MouseInputListenerEvent::decode(buf))),
2924            None => std::task::Poll::Ready(None),
2925        }
2926    }
2927}
2928
2929#[derive(Debug)]
2930pub enum MouseInputListenerEvent {}
2931
2932impl MouseInputListenerEvent {
2933    /// Decodes a message buffer as a [`MouseInputListenerEvent`].
2934    fn decode(
2935        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2936    ) -> Result<MouseInputListenerEvent, fidl::Error> {
2937        let (bytes, _handles) = buf.split_mut();
2938        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2939        debug_assert_eq!(tx_header.tx_id, 0);
2940        match tx_header.ordinal {
2941            _ => Err(fidl::Error::UnknownOrdinal {
2942                ordinal: tx_header.ordinal,
2943                protocol_name:
2944                    <MouseInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2945            }),
2946        }
2947    }
2948}
2949
2950/// A Stream of incoming requests for fuchsia.ui.test.input/MouseInputListener.
2951pub struct MouseInputListenerRequestStream {
2952    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2953    is_terminated: bool,
2954}
2955
2956impl std::marker::Unpin for MouseInputListenerRequestStream {}
2957
2958impl futures::stream::FusedStream for MouseInputListenerRequestStream {
2959    fn is_terminated(&self) -> bool {
2960        self.is_terminated
2961    }
2962}
2963
2964impl fidl::endpoints::RequestStream for MouseInputListenerRequestStream {
2965    type Protocol = MouseInputListenerMarker;
2966    type ControlHandle = MouseInputListenerControlHandle;
2967
2968    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2969        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2970    }
2971
2972    fn control_handle(&self) -> Self::ControlHandle {
2973        MouseInputListenerControlHandle { inner: self.inner.clone() }
2974    }
2975
2976    fn into_inner(
2977        self,
2978    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2979    {
2980        (self.inner, self.is_terminated)
2981    }
2982
2983    fn from_inner(
2984        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2985        is_terminated: bool,
2986    ) -> Self {
2987        Self { inner, is_terminated }
2988    }
2989}
2990
2991impl futures::Stream for MouseInputListenerRequestStream {
2992    type Item = Result<MouseInputListenerRequest, fidl::Error>;
2993
2994    fn poll_next(
2995        mut self: std::pin::Pin<&mut Self>,
2996        cx: &mut std::task::Context<'_>,
2997    ) -> std::task::Poll<Option<Self::Item>> {
2998        let this = &mut *self;
2999        if this.inner.check_shutdown(cx) {
3000            this.is_terminated = true;
3001            return std::task::Poll::Ready(None);
3002        }
3003        if this.is_terminated {
3004            panic!("polled MouseInputListenerRequestStream after completion");
3005        }
3006        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3007            |bytes, handles| {
3008                match this.inner.channel().read_etc(cx, bytes, handles) {
3009                    std::task::Poll::Ready(Ok(())) => {}
3010                    std::task::Poll::Pending => return std::task::Poll::Pending,
3011                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3012                        this.is_terminated = true;
3013                        return std::task::Poll::Ready(None);
3014                    }
3015                    std::task::Poll::Ready(Err(e)) => {
3016                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3017                            e.into(),
3018                        ))));
3019                    }
3020                }
3021
3022                // A message has been received from the channel
3023                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3024
3025                std::task::Poll::Ready(Some(match header.ordinal {
3026                0x78182130ca3aff13 => {
3027                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3028                    let mut req = fidl::new_empty!(MouseInputListenerReportMouseInputRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3029                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MouseInputListenerReportMouseInputRequest>(&header, _body_bytes, handles, &mut req)?;
3030                    let control_handle = MouseInputListenerControlHandle {
3031                        inner: this.inner.clone(),
3032                    };
3033                    Ok(MouseInputListenerRequest::ReportMouseInput {payload: req,
3034                        control_handle,
3035                    })
3036                }
3037                _ => Err(fidl::Error::UnknownOrdinal {
3038                    ordinal: header.ordinal,
3039                    protocol_name: <MouseInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3040                }),
3041            }))
3042            },
3043        )
3044    }
3045}
3046
3047/// A tool for applications to report touch input to interested parties (e.g. a test
3048/// fixture).
3049#[derive(Debug)]
3050pub enum MouseInputListenerRequest {
3051    /// Report that component under test has received expected input.
3052    ReportMouseInput {
3053        payload: MouseInputListenerReportMouseInputRequest,
3054        control_handle: MouseInputListenerControlHandle,
3055    },
3056}
3057
3058impl MouseInputListenerRequest {
3059    #[allow(irrefutable_let_patterns)]
3060    pub fn into_report_mouse_input(
3061        self,
3062    ) -> Option<(MouseInputListenerReportMouseInputRequest, MouseInputListenerControlHandle)> {
3063        if let MouseInputListenerRequest::ReportMouseInput { payload, control_handle } = self {
3064            Some((payload, control_handle))
3065        } else {
3066            None
3067        }
3068    }
3069
3070    /// Name of the method defined in FIDL
3071    pub fn method_name(&self) -> &'static str {
3072        match *self {
3073            MouseInputListenerRequest::ReportMouseInput { .. } => "report_mouse_input",
3074        }
3075    }
3076}
3077
3078#[derive(Debug, Clone)]
3079pub struct MouseInputListenerControlHandle {
3080    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3081}
3082
3083impl fidl::endpoints::ControlHandle for MouseInputListenerControlHandle {
3084    fn shutdown(&self) {
3085        self.inner.shutdown()
3086    }
3087
3088    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3089        self.inner.shutdown_with_epitaph(status)
3090    }
3091
3092    fn is_closed(&self) -> bool {
3093        self.inner.channel().is_closed()
3094    }
3095    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3096        self.inner.channel().on_closed()
3097    }
3098
3099    #[cfg(target_os = "fuchsia")]
3100    fn signal_peer(
3101        &self,
3102        clear_mask: zx::Signals,
3103        set_mask: zx::Signals,
3104    ) -> Result<(), zx_status::Status> {
3105        use fidl::Peered;
3106        self.inner.channel().signal_peer(clear_mask, set_mask)
3107    }
3108}
3109
3110impl MouseInputListenerControlHandle {}
3111
3112#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3113pub struct RegistryMarker;
3114
3115impl fidl::endpoints::ProtocolMarker for RegistryMarker {
3116    type Proxy = RegistryProxy;
3117    type RequestStream = RegistryRequestStream;
3118    #[cfg(target_os = "fuchsia")]
3119    type SynchronousProxy = RegistrySynchronousProxy;
3120
3121    const DEBUG_NAME: &'static str = "fuchsia.ui.test.input.Registry";
3122}
3123impl fidl::endpoints::DiscoverableProtocolMarker for RegistryMarker {}
3124
3125pub trait RegistryProxyInterface: Send + Sync {
3126    type RegisterTouchScreenResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3127        + Send;
3128    fn r#register_touch_screen(
3129        &self,
3130        payload: RegistryRegisterTouchScreenRequest,
3131    ) -> Self::RegisterTouchScreenResponseFut;
3132    type RegisterTouchScreenAndGetDeviceInfoResponseFut: std::future::Future<
3133            Output = Result<RegistryRegisterTouchScreenAndGetDeviceInfoResponse, fidl::Error>,
3134        > + Send;
3135    fn r#register_touch_screen_and_get_device_info(
3136        &self,
3137        payload: RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
3138    ) -> Self::RegisterTouchScreenAndGetDeviceInfoResponseFut;
3139    type RegisterMediaButtonsDeviceResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3140        + Send;
3141    fn r#register_media_buttons_device(
3142        &self,
3143        payload: RegistryRegisterMediaButtonsDeviceRequest,
3144    ) -> Self::RegisterMediaButtonsDeviceResponseFut;
3145    type RegisterMediaButtonsDeviceAndGetDeviceInfoResponseFut: std::future::Future<
3146            Output = Result<
3147                RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
3148                fidl::Error,
3149            >,
3150        > + Send;
3151    fn r#register_media_buttons_device_and_get_device_info(
3152        &self,
3153        payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
3154    ) -> Self::RegisterMediaButtonsDeviceAndGetDeviceInfoResponseFut;
3155    type RegisterKeyboardResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3156    fn r#register_keyboard(
3157        &self,
3158        payload: RegistryRegisterKeyboardRequest,
3159    ) -> Self::RegisterKeyboardResponseFut;
3160    type RegisterKeyboardAndGetDeviceInfoResponseFut: std::future::Future<
3161            Output = Result<RegistryRegisterKeyboardAndGetDeviceInfoResponse, fidl::Error>,
3162        > + Send;
3163    fn r#register_keyboard_and_get_device_info(
3164        &self,
3165        payload: RegistryRegisterKeyboardAndGetDeviceInfoRequest,
3166    ) -> Self::RegisterKeyboardAndGetDeviceInfoResponseFut;
3167    type RegisterMouseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
3168    fn r#register_mouse(
3169        &self,
3170        payload: RegistryRegisterMouseRequest,
3171    ) -> Self::RegisterMouseResponseFut;
3172    type RegisterMouseAndGetDeviceInfoResponseFut: std::future::Future<
3173            Output = Result<RegistryRegisterMouseAndGetDeviceInfoResponse, fidl::Error>,
3174        > + Send;
3175    fn r#register_mouse_and_get_device_info(
3176        &self,
3177        payload: RegistryRegisterMouseAndGetDeviceInfoRequest,
3178    ) -> Self::RegisterMouseAndGetDeviceInfoResponseFut;
3179}
3180#[derive(Debug)]
3181#[cfg(target_os = "fuchsia")]
3182pub struct RegistrySynchronousProxy {
3183    client: fidl::client::sync::Client,
3184}
3185
3186#[cfg(target_os = "fuchsia")]
3187impl fidl::endpoints::SynchronousProxy for RegistrySynchronousProxy {
3188    type Proxy = RegistryProxy;
3189    type Protocol = RegistryMarker;
3190
3191    fn from_channel(inner: fidl::Channel) -> Self {
3192        Self::new(inner)
3193    }
3194
3195    fn into_channel(self) -> fidl::Channel {
3196        self.client.into_channel()
3197    }
3198
3199    fn as_channel(&self) -> &fidl::Channel {
3200        self.client.as_channel()
3201    }
3202}
3203
3204#[cfg(target_os = "fuchsia")]
3205impl RegistrySynchronousProxy {
3206    pub fn new(channel: fidl::Channel) -> Self {
3207        Self { client: fidl::client::sync::Client::new(channel) }
3208    }
3209
3210    pub fn into_channel(self) -> fidl::Channel {
3211        self.client.into_channel()
3212    }
3213
3214    /// Waits until an event arrives and returns it. It is safe for other
3215    /// threads to make concurrent requests while waiting for an event.
3216    pub fn wait_for_event(
3217        &self,
3218        deadline: zx::MonotonicInstant,
3219    ) -> Result<RegistryEvent, fidl::Error> {
3220        RegistryEvent::decode(self.client.wait_for_event::<RegistryMarker>(deadline)?)
3221    }
3222
3223    /// Enables the client to inject touch events using the corresponding
3224    /// client end to `device`.
3225    ///
3226    /// Clients are allowed at most one in-flight call at a time. Subsequent
3227    /// calls must wait until the acknowledgment returns. Non-compliance
3228    /// results in channel closure.
3229    ///
3230    /// The `fuchsia.ui.test.input.TouchScreen` channel will remain open even
3231    /// if the `Registry` connection closes.
3232    pub fn r#register_touch_screen(
3233        &self,
3234        mut payload: RegistryRegisterTouchScreenRequest,
3235        ___deadline: zx::MonotonicInstant,
3236    ) -> Result<(), fidl::Error> {
3237        let _response = self.client.send_query::<
3238            RegistryRegisterTouchScreenRequest,
3239            fidl::encoding::EmptyPayload,
3240            RegistryMarker,
3241        >(
3242            &mut payload,
3243            0x406fb450685ecb73,
3244            fidl::encoding::DynamicFlags::empty(),
3245            ___deadline,
3246        )?;
3247        Ok(_response)
3248    }
3249
3250    /// Enables the client to inject touch events using the corresponding
3251    /// client end to `device`. Returns device_id of the created device.
3252    ///
3253    /// Clients are allowed at most one in-flight call at a time. Subsequent
3254    /// calls must wait until the acknowledgment returns. Non-compliance
3255    /// results in channel closure.
3256    ///
3257    /// The `fuchsia.ui.test.input.TouchScreen` channel will remain open even
3258    /// if the `Registry` connection closes.
3259    pub fn r#register_touch_screen_and_get_device_info(
3260        &self,
3261        mut payload: RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
3262        ___deadline: zx::MonotonicInstant,
3263    ) -> Result<RegistryRegisterTouchScreenAndGetDeviceInfoResponse, fidl::Error> {
3264        let _response = self.client.send_query::<
3265            RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
3266            RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
3267            RegistryMarker,
3268        >(
3269            &mut payload,
3270            0x2e8df048a411ed2b,
3271            fidl::encoding::DynamicFlags::empty(),
3272            ___deadline,
3273        )?;
3274        Ok(_response)
3275    }
3276
3277    /// Enables the client to inject media buttons events using the
3278    /// corresponding client end to `device`.
3279    ///
3280    /// Clients are allowed at most one in-flight call at a time. Subsequent
3281    /// calls must wait until the acknowledgment returns. Non-compliance
3282    /// results in channel closure.
3283    ///
3284    /// The `fuchsia.ui.test.input.MediaButtonsDevice` channel will remain open
3285    /// even if the `Registry` connection closes.
3286    pub fn r#register_media_buttons_device(
3287        &self,
3288        mut payload: RegistryRegisterMediaButtonsDeviceRequest,
3289        ___deadline: zx::MonotonicInstant,
3290    ) -> Result<(), fidl::Error> {
3291        let _response = self.client.send_query::<
3292            RegistryRegisterMediaButtonsDeviceRequest,
3293            fidl::encoding::EmptyPayload,
3294            RegistryMarker,
3295        >(
3296            &mut payload,
3297            0x3a0b22e6d40e9629,
3298            fidl::encoding::DynamicFlags::empty(),
3299            ___deadline,
3300        )?;
3301        Ok(_response)
3302    }
3303
3304    /// Enables the client to inject media buttons events using the
3305    /// corresponding client end to `device`. Returns device_id of the created device.
3306    ///
3307    /// Clients are allowed at most one in-flight call at a time. Subsequent
3308    /// calls must wait until the acknowledgment returns. Non-compliance
3309    /// results in channel closure.
3310    ///
3311    /// The `fuchsia.ui.test.input.MediaButtonsDevice` channel will remain open
3312    /// even if the `Registry` connection closes.
3313    pub fn r#register_media_buttons_device_and_get_device_info(
3314        &self,
3315        mut payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
3316        ___deadline: zx::MonotonicInstant,
3317    ) -> Result<RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse, fidl::Error> {
3318        let _response = self.client.send_query::<
3319            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
3320            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
3321            RegistryMarker,
3322        >(
3323            &mut payload,
3324            0x15fb627d190ebd73,
3325            fidl::encoding::DynamicFlags::empty(),
3326            ___deadline,
3327        )?;
3328        Ok(_response)
3329    }
3330
3331    /// Enables the client to inject keyboard events using the corresponding
3332    /// client end to `device`.
3333    ///
3334    /// Clients are allowed at most one in-flight call at a time. Subsequent
3335    /// calls must wait until the acknowledgment returns. Non-compliance
3336    /// results in channel closure.
3337    ///
3338    /// The `fuchsia.ui.test.input.Keyboard` channel will remain open even
3339    /// if the `Registry` connection closes.
3340    pub fn r#register_keyboard(
3341        &self,
3342        mut payload: RegistryRegisterKeyboardRequest,
3343        ___deadline: zx::MonotonicInstant,
3344    ) -> Result<(), fidl::Error> {
3345        let _response = self.client.send_query::<
3346            RegistryRegisterKeyboardRequest,
3347            fidl::encoding::EmptyPayload,
3348            RegistryMarker,
3349        >(
3350            &mut payload,
3351            0x291c697601404b38,
3352            fidl::encoding::DynamicFlags::empty(),
3353            ___deadline,
3354        )?;
3355        Ok(_response)
3356    }
3357
3358    /// Enables the client to inject keyboard events using the corresponding
3359    /// client end to `device`. Returns device_id of the created device.
3360    ///
3361    /// Clients are allowed at most one in-flight call at a time. Subsequent
3362    /// calls must wait until the acknowledgment returns. Non-compliance
3363    /// results in channel closure.
3364    ///
3365    /// The `fuchsia.ui.test.input.Keyboard` channel will remain open even
3366    /// if the `Registry` connection closes.
3367    pub fn r#register_keyboard_and_get_device_info(
3368        &self,
3369        mut payload: RegistryRegisterKeyboardAndGetDeviceInfoRequest,
3370        ___deadline: zx::MonotonicInstant,
3371    ) -> Result<RegistryRegisterKeyboardAndGetDeviceInfoResponse, fidl::Error> {
3372        let _response = self.client.send_query::<
3373            RegistryRegisterKeyboardAndGetDeviceInfoRequest,
3374            RegistryRegisterKeyboardAndGetDeviceInfoResponse,
3375            RegistryMarker,
3376        >(
3377            &mut payload,
3378            0x1e4edc6c56d2ac7e,
3379            fidl::encoding::DynamicFlags::empty(),
3380            ___deadline,
3381        )?;
3382        Ok(_response)
3383    }
3384
3385    /// Enables the client to inject mouse events using the corresponding
3386    /// client end to `device`.
3387    ///
3388    /// Clients are allowed at most one in-flight call at a time. Subsequent
3389    /// calls must wait until the acknowledgment returns. Non-compliance
3390    /// results in channel closure.
3391    ///
3392    /// The `fuchsia.ui.test.input.Mouse` channel will remain open even
3393    /// if the `Registry` connection closes.
3394    pub fn r#register_mouse(
3395        &self,
3396        mut payload: RegistryRegisterMouseRequest,
3397        ___deadline: zx::MonotonicInstant,
3398    ) -> Result<(), fidl::Error> {
3399        let _response = self.client.send_query::<
3400            RegistryRegisterMouseRequest,
3401            fidl::encoding::EmptyPayload,
3402            RegistryMarker,
3403        >(
3404            &mut payload,
3405            0xf330169355a1add,
3406            fidl::encoding::DynamicFlags::empty(),
3407            ___deadline,
3408        )?;
3409        Ok(_response)
3410    }
3411
3412    /// Enables the client to inject mouse events using the corresponding
3413    /// client end to `device`. Returns device_id of the created device.
3414    ///
3415    /// Clients are allowed at most one in-flight call at a time. Subsequent
3416    /// calls must wait until the acknowledgment returns. Non-compliance
3417    /// results in channel closure.
3418    ///
3419    /// The `fuchsia.ui.test.input.Mouse` channel will remain open even
3420    /// if the `Registry` connection closes.
3421    pub fn r#register_mouse_and_get_device_info(
3422        &self,
3423        mut payload: RegistryRegisterMouseAndGetDeviceInfoRequest,
3424        ___deadline: zx::MonotonicInstant,
3425    ) -> Result<RegistryRegisterMouseAndGetDeviceInfoResponse, fidl::Error> {
3426        let _response = self.client.send_query::<
3427            RegistryRegisterMouseAndGetDeviceInfoRequest,
3428            RegistryRegisterMouseAndGetDeviceInfoResponse,
3429            RegistryMarker,
3430        >(
3431            &mut payload,
3432            0x34aa807670bbae29,
3433            fidl::encoding::DynamicFlags::empty(),
3434            ___deadline,
3435        )?;
3436        Ok(_response)
3437    }
3438}
3439
3440#[cfg(target_os = "fuchsia")]
3441impl From<RegistrySynchronousProxy> for zx::NullableHandle {
3442    fn from(value: RegistrySynchronousProxy) -> Self {
3443        value.into_channel().into()
3444    }
3445}
3446
3447#[cfg(target_os = "fuchsia")]
3448impl From<fidl::Channel> for RegistrySynchronousProxy {
3449    fn from(value: fidl::Channel) -> Self {
3450        Self::new(value)
3451    }
3452}
3453
3454#[cfg(target_os = "fuchsia")]
3455impl fidl::endpoints::FromClient for RegistrySynchronousProxy {
3456    type Protocol = RegistryMarker;
3457
3458    fn from_client(value: fidl::endpoints::ClientEnd<RegistryMarker>) -> Self {
3459        Self::new(value.into_channel())
3460    }
3461}
3462
3463#[derive(Debug, Clone)]
3464pub struct RegistryProxy {
3465    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3466}
3467
3468impl fidl::endpoints::Proxy for RegistryProxy {
3469    type Protocol = RegistryMarker;
3470
3471    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3472        Self::new(inner)
3473    }
3474
3475    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3476        self.client.into_channel().map_err(|client| Self { client })
3477    }
3478
3479    fn as_channel(&self) -> &::fidl::AsyncChannel {
3480        self.client.as_channel()
3481    }
3482}
3483
3484impl RegistryProxy {
3485    /// Create a new Proxy for fuchsia.ui.test.input/Registry.
3486    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3487        let protocol_name = <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3488        Self { client: fidl::client::Client::new(channel, protocol_name) }
3489    }
3490
3491    /// Get a Stream of events from the remote end of the protocol.
3492    ///
3493    /// # Panics
3494    ///
3495    /// Panics if the event stream was already taken.
3496    pub fn take_event_stream(&self) -> RegistryEventStream {
3497        RegistryEventStream { event_receiver: self.client.take_event_receiver() }
3498    }
3499
3500    /// Enables the client to inject touch events using the corresponding
3501    /// client end to `device`.
3502    ///
3503    /// Clients are allowed at most one in-flight call at a time. Subsequent
3504    /// calls must wait until the acknowledgment returns. Non-compliance
3505    /// results in channel closure.
3506    ///
3507    /// The `fuchsia.ui.test.input.TouchScreen` channel will remain open even
3508    /// if the `Registry` connection closes.
3509    pub fn r#register_touch_screen(
3510        &self,
3511        mut payload: RegistryRegisterTouchScreenRequest,
3512    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3513        RegistryProxyInterface::r#register_touch_screen(self, payload)
3514    }
3515
3516    /// Enables the client to inject touch events using the corresponding
3517    /// client end to `device`. Returns device_id of the created device.
3518    ///
3519    /// Clients are allowed at most one in-flight call at a time. Subsequent
3520    /// calls must wait until the acknowledgment returns. Non-compliance
3521    /// results in channel closure.
3522    ///
3523    /// The `fuchsia.ui.test.input.TouchScreen` channel will remain open even
3524    /// if the `Registry` connection closes.
3525    pub fn r#register_touch_screen_and_get_device_info(
3526        &self,
3527        mut payload: RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
3528    ) -> fidl::client::QueryResponseFut<
3529        RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
3530        fidl::encoding::DefaultFuchsiaResourceDialect,
3531    > {
3532        RegistryProxyInterface::r#register_touch_screen_and_get_device_info(self, payload)
3533    }
3534
3535    /// Enables the client to inject media buttons events using the
3536    /// corresponding client end to `device`.
3537    ///
3538    /// Clients are allowed at most one in-flight call at a time. Subsequent
3539    /// calls must wait until the acknowledgment returns. Non-compliance
3540    /// results in channel closure.
3541    ///
3542    /// The `fuchsia.ui.test.input.MediaButtonsDevice` channel will remain open
3543    /// even if the `Registry` connection closes.
3544    pub fn r#register_media_buttons_device(
3545        &self,
3546        mut payload: RegistryRegisterMediaButtonsDeviceRequest,
3547    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3548        RegistryProxyInterface::r#register_media_buttons_device(self, payload)
3549    }
3550
3551    /// Enables the client to inject media buttons events using the
3552    /// corresponding client end to `device`. Returns device_id of the created device.
3553    ///
3554    /// Clients are allowed at most one in-flight call at a time. Subsequent
3555    /// calls must wait until the acknowledgment returns. Non-compliance
3556    /// results in channel closure.
3557    ///
3558    /// The `fuchsia.ui.test.input.MediaButtonsDevice` channel will remain open
3559    /// even if the `Registry` connection closes.
3560    pub fn r#register_media_buttons_device_and_get_device_info(
3561        &self,
3562        mut payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
3563    ) -> fidl::client::QueryResponseFut<
3564        RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
3565        fidl::encoding::DefaultFuchsiaResourceDialect,
3566    > {
3567        RegistryProxyInterface::r#register_media_buttons_device_and_get_device_info(self, payload)
3568    }
3569
3570    /// Enables the client to inject keyboard events using the corresponding
3571    /// client end to `device`.
3572    ///
3573    /// Clients are allowed at most one in-flight call at a time. Subsequent
3574    /// calls must wait until the acknowledgment returns. Non-compliance
3575    /// results in channel closure.
3576    ///
3577    /// The `fuchsia.ui.test.input.Keyboard` channel will remain open even
3578    /// if the `Registry` connection closes.
3579    pub fn r#register_keyboard(
3580        &self,
3581        mut payload: RegistryRegisterKeyboardRequest,
3582    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3583        RegistryProxyInterface::r#register_keyboard(self, payload)
3584    }
3585
3586    /// Enables the client to inject keyboard events using the corresponding
3587    /// client end to `device`. Returns device_id of the created device.
3588    ///
3589    /// Clients are allowed at most one in-flight call at a time. Subsequent
3590    /// calls must wait until the acknowledgment returns. Non-compliance
3591    /// results in channel closure.
3592    ///
3593    /// The `fuchsia.ui.test.input.Keyboard` channel will remain open even
3594    /// if the `Registry` connection closes.
3595    pub fn r#register_keyboard_and_get_device_info(
3596        &self,
3597        mut payload: RegistryRegisterKeyboardAndGetDeviceInfoRequest,
3598    ) -> fidl::client::QueryResponseFut<
3599        RegistryRegisterKeyboardAndGetDeviceInfoResponse,
3600        fidl::encoding::DefaultFuchsiaResourceDialect,
3601    > {
3602        RegistryProxyInterface::r#register_keyboard_and_get_device_info(self, payload)
3603    }
3604
3605    /// Enables the client to inject mouse events using the corresponding
3606    /// client end to `device`.
3607    ///
3608    /// Clients are allowed at most one in-flight call at a time. Subsequent
3609    /// calls must wait until the acknowledgment returns. Non-compliance
3610    /// results in channel closure.
3611    ///
3612    /// The `fuchsia.ui.test.input.Mouse` channel will remain open even
3613    /// if the `Registry` connection closes.
3614    pub fn r#register_mouse(
3615        &self,
3616        mut payload: RegistryRegisterMouseRequest,
3617    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3618        RegistryProxyInterface::r#register_mouse(self, payload)
3619    }
3620
3621    /// Enables the client to inject mouse events using the corresponding
3622    /// client end to `device`. Returns device_id of the created device.
3623    ///
3624    /// Clients are allowed at most one in-flight call at a time. Subsequent
3625    /// calls must wait until the acknowledgment returns. Non-compliance
3626    /// results in channel closure.
3627    ///
3628    /// The `fuchsia.ui.test.input.Mouse` channel will remain open even
3629    /// if the `Registry` connection closes.
3630    pub fn r#register_mouse_and_get_device_info(
3631        &self,
3632        mut payload: RegistryRegisterMouseAndGetDeviceInfoRequest,
3633    ) -> fidl::client::QueryResponseFut<
3634        RegistryRegisterMouseAndGetDeviceInfoResponse,
3635        fidl::encoding::DefaultFuchsiaResourceDialect,
3636    > {
3637        RegistryProxyInterface::r#register_mouse_and_get_device_info(self, payload)
3638    }
3639}
3640
3641impl RegistryProxyInterface for RegistryProxy {
3642    type RegisterTouchScreenResponseFut =
3643        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3644    fn r#register_touch_screen(
3645        &self,
3646        mut payload: RegistryRegisterTouchScreenRequest,
3647    ) -> Self::RegisterTouchScreenResponseFut {
3648        fn _decode(
3649            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3650        ) -> Result<(), fidl::Error> {
3651            let _response = fidl::client::decode_transaction_body::<
3652                fidl::encoding::EmptyPayload,
3653                fidl::encoding::DefaultFuchsiaResourceDialect,
3654                0x406fb450685ecb73,
3655            >(_buf?)?;
3656            Ok(_response)
3657        }
3658        self.client.send_query_and_decode::<RegistryRegisterTouchScreenRequest, ()>(
3659            &mut payload,
3660            0x406fb450685ecb73,
3661            fidl::encoding::DynamicFlags::empty(),
3662            _decode,
3663        )
3664    }
3665
3666    type RegisterTouchScreenAndGetDeviceInfoResponseFut = fidl::client::QueryResponseFut<
3667        RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
3668        fidl::encoding::DefaultFuchsiaResourceDialect,
3669    >;
3670    fn r#register_touch_screen_and_get_device_info(
3671        &self,
3672        mut payload: RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
3673    ) -> Self::RegisterTouchScreenAndGetDeviceInfoResponseFut {
3674        fn _decode(
3675            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3676        ) -> Result<RegistryRegisterTouchScreenAndGetDeviceInfoResponse, fidl::Error> {
3677            let _response = fidl::client::decode_transaction_body::<
3678                RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
3679                fidl::encoding::DefaultFuchsiaResourceDialect,
3680                0x2e8df048a411ed2b,
3681            >(_buf?)?;
3682            Ok(_response)
3683        }
3684        self.client.send_query_and_decode::<
3685            RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
3686            RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
3687        >(
3688            &mut payload,
3689            0x2e8df048a411ed2b,
3690            fidl::encoding::DynamicFlags::empty(),
3691            _decode,
3692        )
3693    }
3694
3695    type RegisterMediaButtonsDeviceResponseFut =
3696        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3697    fn r#register_media_buttons_device(
3698        &self,
3699        mut payload: RegistryRegisterMediaButtonsDeviceRequest,
3700    ) -> Self::RegisterMediaButtonsDeviceResponseFut {
3701        fn _decode(
3702            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3703        ) -> Result<(), fidl::Error> {
3704            let _response = fidl::client::decode_transaction_body::<
3705                fidl::encoding::EmptyPayload,
3706                fidl::encoding::DefaultFuchsiaResourceDialect,
3707                0x3a0b22e6d40e9629,
3708            >(_buf?)?;
3709            Ok(_response)
3710        }
3711        self.client.send_query_and_decode::<RegistryRegisterMediaButtonsDeviceRequest, ()>(
3712            &mut payload,
3713            0x3a0b22e6d40e9629,
3714            fidl::encoding::DynamicFlags::empty(),
3715            _decode,
3716        )
3717    }
3718
3719    type RegisterMediaButtonsDeviceAndGetDeviceInfoResponseFut = fidl::client::QueryResponseFut<
3720        RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
3721        fidl::encoding::DefaultFuchsiaResourceDialect,
3722    >;
3723    fn r#register_media_buttons_device_and_get_device_info(
3724        &self,
3725        mut payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
3726    ) -> Self::RegisterMediaButtonsDeviceAndGetDeviceInfoResponseFut {
3727        fn _decode(
3728            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3729        ) -> Result<RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse, fidl::Error>
3730        {
3731            let _response = fidl::client::decode_transaction_body::<
3732                RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
3733                fidl::encoding::DefaultFuchsiaResourceDialect,
3734                0x15fb627d190ebd73,
3735            >(_buf?)?;
3736            Ok(_response)
3737        }
3738        self.client.send_query_and_decode::<
3739            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
3740            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
3741        >(
3742            &mut payload,
3743            0x15fb627d190ebd73,
3744            fidl::encoding::DynamicFlags::empty(),
3745            _decode,
3746        )
3747    }
3748
3749    type RegisterKeyboardResponseFut =
3750        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3751    fn r#register_keyboard(
3752        &self,
3753        mut payload: RegistryRegisterKeyboardRequest,
3754    ) -> Self::RegisterKeyboardResponseFut {
3755        fn _decode(
3756            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3757        ) -> Result<(), fidl::Error> {
3758            let _response = fidl::client::decode_transaction_body::<
3759                fidl::encoding::EmptyPayload,
3760                fidl::encoding::DefaultFuchsiaResourceDialect,
3761                0x291c697601404b38,
3762            >(_buf?)?;
3763            Ok(_response)
3764        }
3765        self.client.send_query_and_decode::<RegistryRegisterKeyboardRequest, ()>(
3766            &mut payload,
3767            0x291c697601404b38,
3768            fidl::encoding::DynamicFlags::empty(),
3769            _decode,
3770        )
3771    }
3772
3773    type RegisterKeyboardAndGetDeviceInfoResponseFut = fidl::client::QueryResponseFut<
3774        RegistryRegisterKeyboardAndGetDeviceInfoResponse,
3775        fidl::encoding::DefaultFuchsiaResourceDialect,
3776    >;
3777    fn r#register_keyboard_and_get_device_info(
3778        &self,
3779        mut payload: RegistryRegisterKeyboardAndGetDeviceInfoRequest,
3780    ) -> Self::RegisterKeyboardAndGetDeviceInfoResponseFut {
3781        fn _decode(
3782            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3783        ) -> Result<RegistryRegisterKeyboardAndGetDeviceInfoResponse, fidl::Error> {
3784            let _response = fidl::client::decode_transaction_body::<
3785                RegistryRegisterKeyboardAndGetDeviceInfoResponse,
3786                fidl::encoding::DefaultFuchsiaResourceDialect,
3787                0x1e4edc6c56d2ac7e,
3788            >(_buf?)?;
3789            Ok(_response)
3790        }
3791        self.client.send_query_and_decode::<
3792            RegistryRegisterKeyboardAndGetDeviceInfoRequest,
3793            RegistryRegisterKeyboardAndGetDeviceInfoResponse,
3794        >(
3795            &mut payload,
3796            0x1e4edc6c56d2ac7e,
3797            fidl::encoding::DynamicFlags::empty(),
3798            _decode,
3799        )
3800    }
3801
3802    type RegisterMouseResponseFut =
3803        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3804    fn r#register_mouse(
3805        &self,
3806        mut payload: RegistryRegisterMouseRequest,
3807    ) -> Self::RegisterMouseResponseFut {
3808        fn _decode(
3809            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3810        ) -> Result<(), fidl::Error> {
3811            let _response = fidl::client::decode_transaction_body::<
3812                fidl::encoding::EmptyPayload,
3813                fidl::encoding::DefaultFuchsiaResourceDialect,
3814                0xf330169355a1add,
3815            >(_buf?)?;
3816            Ok(_response)
3817        }
3818        self.client.send_query_and_decode::<RegistryRegisterMouseRequest, ()>(
3819            &mut payload,
3820            0xf330169355a1add,
3821            fidl::encoding::DynamicFlags::empty(),
3822            _decode,
3823        )
3824    }
3825
3826    type RegisterMouseAndGetDeviceInfoResponseFut = fidl::client::QueryResponseFut<
3827        RegistryRegisterMouseAndGetDeviceInfoResponse,
3828        fidl::encoding::DefaultFuchsiaResourceDialect,
3829    >;
3830    fn r#register_mouse_and_get_device_info(
3831        &self,
3832        mut payload: RegistryRegisterMouseAndGetDeviceInfoRequest,
3833    ) -> Self::RegisterMouseAndGetDeviceInfoResponseFut {
3834        fn _decode(
3835            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3836        ) -> Result<RegistryRegisterMouseAndGetDeviceInfoResponse, fidl::Error> {
3837            let _response = fidl::client::decode_transaction_body::<
3838                RegistryRegisterMouseAndGetDeviceInfoResponse,
3839                fidl::encoding::DefaultFuchsiaResourceDialect,
3840                0x34aa807670bbae29,
3841            >(_buf?)?;
3842            Ok(_response)
3843        }
3844        self.client.send_query_and_decode::<
3845            RegistryRegisterMouseAndGetDeviceInfoRequest,
3846            RegistryRegisterMouseAndGetDeviceInfoResponse,
3847        >(
3848            &mut payload,
3849            0x34aa807670bbae29,
3850            fidl::encoding::DynamicFlags::empty(),
3851            _decode,
3852        )
3853    }
3854}
3855
3856pub struct RegistryEventStream {
3857    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3858}
3859
3860impl std::marker::Unpin for RegistryEventStream {}
3861
3862impl futures::stream::FusedStream for RegistryEventStream {
3863    fn is_terminated(&self) -> bool {
3864        self.event_receiver.is_terminated()
3865    }
3866}
3867
3868impl futures::Stream for RegistryEventStream {
3869    type Item = Result<RegistryEvent, fidl::Error>;
3870
3871    fn poll_next(
3872        mut self: std::pin::Pin<&mut Self>,
3873        cx: &mut std::task::Context<'_>,
3874    ) -> std::task::Poll<Option<Self::Item>> {
3875        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3876            &mut self.event_receiver,
3877            cx
3878        )?) {
3879            Some(buf) => std::task::Poll::Ready(Some(RegistryEvent::decode(buf))),
3880            None => std::task::Poll::Ready(None),
3881        }
3882    }
3883}
3884
3885#[derive(Debug)]
3886pub enum RegistryEvent {}
3887
3888impl RegistryEvent {
3889    /// Decodes a message buffer as a [`RegistryEvent`].
3890    fn decode(
3891        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3892    ) -> Result<RegistryEvent, fidl::Error> {
3893        let (bytes, _handles) = buf.split_mut();
3894        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3895        debug_assert_eq!(tx_header.tx_id, 0);
3896        match tx_header.ordinal {
3897            _ => Err(fidl::Error::UnknownOrdinal {
3898                ordinal: tx_header.ordinal,
3899                protocol_name: <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3900            }),
3901        }
3902    }
3903}
3904
3905/// A Stream of incoming requests for fuchsia.ui.test.input/Registry.
3906pub struct RegistryRequestStream {
3907    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3908    is_terminated: bool,
3909}
3910
3911impl std::marker::Unpin for RegistryRequestStream {}
3912
3913impl futures::stream::FusedStream for RegistryRequestStream {
3914    fn is_terminated(&self) -> bool {
3915        self.is_terminated
3916    }
3917}
3918
3919impl fidl::endpoints::RequestStream for RegistryRequestStream {
3920    type Protocol = RegistryMarker;
3921    type ControlHandle = RegistryControlHandle;
3922
3923    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3924        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3925    }
3926
3927    fn control_handle(&self) -> Self::ControlHandle {
3928        RegistryControlHandle { inner: self.inner.clone() }
3929    }
3930
3931    fn into_inner(
3932        self,
3933    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3934    {
3935        (self.inner, self.is_terminated)
3936    }
3937
3938    fn from_inner(
3939        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3940        is_terminated: bool,
3941    ) -> Self {
3942        Self { inner, is_terminated }
3943    }
3944}
3945
3946impl futures::Stream for RegistryRequestStream {
3947    type Item = Result<RegistryRequest, fidl::Error>;
3948
3949    fn poll_next(
3950        mut self: std::pin::Pin<&mut Self>,
3951        cx: &mut std::task::Context<'_>,
3952    ) -> std::task::Poll<Option<Self::Item>> {
3953        let this = &mut *self;
3954        if this.inner.check_shutdown(cx) {
3955            this.is_terminated = true;
3956            return std::task::Poll::Ready(None);
3957        }
3958        if this.is_terminated {
3959            panic!("polled RegistryRequestStream after completion");
3960        }
3961        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3962            |bytes, handles| {
3963                match this.inner.channel().read_etc(cx, bytes, handles) {
3964                    std::task::Poll::Ready(Ok(())) => {}
3965                    std::task::Poll::Pending => return std::task::Poll::Pending,
3966                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3967                        this.is_terminated = true;
3968                        return std::task::Poll::Ready(None);
3969                    }
3970                    std::task::Poll::Ready(Err(e)) => {
3971                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3972                            e.into(),
3973                        ))));
3974                    }
3975                }
3976
3977                // A message has been received from the channel
3978                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3979
3980                std::task::Poll::Ready(Some(match header.ordinal {
3981                    0x406fb450685ecb73 => {
3982                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3983                        let mut req = fidl::new_empty!(
3984                            RegistryRegisterTouchScreenRequest,
3985                            fidl::encoding::DefaultFuchsiaResourceDialect
3986                        );
3987                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterTouchScreenRequest>(&header, _body_bytes, handles, &mut req)?;
3988                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
3989                        Ok(RegistryRequest::RegisterTouchScreen {
3990                            payload: req,
3991                            responder: RegistryRegisterTouchScreenResponder {
3992                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3993                                tx_id: header.tx_id,
3994                            },
3995                        })
3996                    }
3997                    0x2e8df048a411ed2b => {
3998                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3999                        let mut req = fidl::new_empty!(
4000                            RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
4001                            fidl::encoding::DefaultFuchsiaResourceDialect
4002                        );
4003                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterTouchScreenAndGetDeviceInfoRequest>(&header, _body_bytes, handles, &mut req)?;
4004                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4005                        Ok(RegistryRequest::RegisterTouchScreenAndGetDeviceInfo {
4006                            payload: req,
4007                            responder: RegistryRegisterTouchScreenAndGetDeviceInfoResponder {
4008                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4009                                tx_id: header.tx_id,
4010                            },
4011                        })
4012                    }
4013                    0x3a0b22e6d40e9629 => {
4014                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4015                        let mut req = fidl::new_empty!(
4016                            RegistryRegisterMediaButtonsDeviceRequest,
4017                            fidl::encoding::DefaultFuchsiaResourceDialect
4018                        );
4019                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterMediaButtonsDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
4020                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4021                        Ok(RegistryRequest::RegisterMediaButtonsDevice {
4022                            payload: req,
4023                            responder: RegistryRegisterMediaButtonsDeviceResponder {
4024                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4025                                tx_id: header.tx_id,
4026                            },
4027                        })
4028                    }
4029                    0x15fb627d190ebd73 => {
4030                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4031                        let mut req = fidl::new_empty!(
4032                            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
4033                            fidl::encoding::DefaultFuchsiaResourceDialect
4034                        );
4035                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest>(&header, _body_bytes, handles, &mut req)?;
4036                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4037                        Ok(RegistryRequest::RegisterMediaButtonsDeviceAndGetDeviceInfo {
4038                            payload: req,
4039                            responder:
4040                                RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder {
4041                                    control_handle: std::mem::ManuallyDrop::new(control_handle),
4042                                    tx_id: header.tx_id,
4043                                },
4044                        })
4045                    }
4046                    0x291c697601404b38 => {
4047                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4048                        let mut req = fidl::new_empty!(
4049                            RegistryRegisterKeyboardRequest,
4050                            fidl::encoding::DefaultFuchsiaResourceDialect
4051                        );
4052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterKeyboardRequest>(&header, _body_bytes, handles, &mut req)?;
4053                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4054                        Ok(RegistryRequest::RegisterKeyboard {
4055                            payload: req,
4056                            responder: RegistryRegisterKeyboardResponder {
4057                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4058                                tx_id: header.tx_id,
4059                            },
4060                        })
4061                    }
4062                    0x1e4edc6c56d2ac7e => {
4063                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4064                        let mut req = fidl::new_empty!(
4065                            RegistryRegisterKeyboardAndGetDeviceInfoRequest,
4066                            fidl::encoding::DefaultFuchsiaResourceDialect
4067                        );
4068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterKeyboardAndGetDeviceInfoRequest>(&header, _body_bytes, handles, &mut req)?;
4069                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4070                        Ok(RegistryRequest::RegisterKeyboardAndGetDeviceInfo {
4071                            payload: req,
4072                            responder: RegistryRegisterKeyboardAndGetDeviceInfoResponder {
4073                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4074                                tx_id: header.tx_id,
4075                            },
4076                        })
4077                    }
4078                    0xf330169355a1add => {
4079                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4080                        let mut req = fidl::new_empty!(
4081                            RegistryRegisterMouseRequest,
4082                            fidl::encoding::DefaultFuchsiaResourceDialect
4083                        );
4084                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterMouseRequest>(&header, _body_bytes, handles, &mut req)?;
4085                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4086                        Ok(RegistryRequest::RegisterMouse {
4087                            payload: req,
4088                            responder: RegistryRegisterMouseResponder {
4089                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4090                                tx_id: header.tx_id,
4091                            },
4092                        })
4093                    }
4094                    0x34aa807670bbae29 => {
4095                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4096                        let mut req = fidl::new_empty!(
4097                            RegistryRegisterMouseAndGetDeviceInfoRequest,
4098                            fidl::encoding::DefaultFuchsiaResourceDialect
4099                        );
4100                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegistryRegisterMouseAndGetDeviceInfoRequest>(&header, _body_bytes, handles, &mut req)?;
4101                        let control_handle = RegistryControlHandle { inner: this.inner.clone() };
4102                        Ok(RegistryRequest::RegisterMouseAndGetDeviceInfo {
4103                            payload: req,
4104                            responder: RegistryRegisterMouseAndGetDeviceInfoResponder {
4105                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4106                                tx_id: header.tx_id,
4107                            },
4108                        })
4109                    }
4110                    _ => Err(fidl::Error::UnknownOrdinal {
4111                        ordinal: header.ordinal,
4112                        protocol_name:
4113                            <RegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4114                    }),
4115                }))
4116            },
4117        )
4118    }
4119}
4120
4121/// *** This protocol must not be used in production. ***
4122///
4123/// Enables clients to register fake input devices, which can be used to
4124/// inject input events directly into Input Pipeline.
4125#[derive(Debug)]
4126pub enum RegistryRequest {
4127    /// Enables the client to inject touch events using the corresponding
4128    /// client end to `device`.
4129    ///
4130    /// Clients are allowed at most one in-flight call at a time. Subsequent
4131    /// calls must wait until the acknowledgment returns. Non-compliance
4132    /// results in channel closure.
4133    ///
4134    /// The `fuchsia.ui.test.input.TouchScreen` channel will remain open even
4135    /// if the `Registry` connection closes.
4136    RegisterTouchScreen {
4137        payload: RegistryRegisterTouchScreenRequest,
4138        responder: RegistryRegisterTouchScreenResponder,
4139    },
4140    /// Enables the client to inject touch events using the corresponding
4141    /// client end to `device`. Returns device_id of the created device.
4142    ///
4143    /// Clients are allowed at most one in-flight call at a time. Subsequent
4144    /// calls must wait until the acknowledgment returns. Non-compliance
4145    /// results in channel closure.
4146    ///
4147    /// The `fuchsia.ui.test.input.TouchScreen` channel will remain open even
4148    /// if the `Registry` connection closes.
4149    RegisterTouchScreenAndGetDeviceInfo {
4150        payload: RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
4151        responder: RegistryRegisterTouchScreenAndGetDeviceInfoResponder,
4152    },
4153    /// Enables the client to inject media buttons events using the
4154    /// corresponding client end to `device`.
4155    ///
4156    /// Clients are allowed at most one in-flight call at a time. Subsequent
4157    /// calls must wait until the acknowledgment returns. Non-compliance
4158    /// results in channel closure.
4159    ///
4160    /// The `fuchsia.ui.test.input.MediaButtonsDevice` channel will remain open
4161    /// even if the `Registry` connection closes.
4162    RegisterMediaButtonsDevice {
4163        payload: RegistryRegisterMediaButtonsDeviceRequest,
4164        responder: RegistryRegisterMediaButtonsDeviceResponder,
4165    },
4166    /// Enables the client to inject media buttons events using the
4167    /// corresponding client end to `device`. Returns device_id of the created device.
4168    ///
4169    /// Clients are allowed at most one in-flight call at a time. Subsequent
4170    /// calls must wait until the acknowledgment returns. Non-compliance
4171    /// results in channel closure.
4172    ///
4173    /// The `fuchsia.ui.test.input.MediaButtonsDevice` channel will remain open
4174    /// even if the `Registry` connection closes.
4175    RegisterMediaButtonsDeviceAndGetDeviceInfo {
4176        payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
4177        responder: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder,
4178    },
4179    /// Enables the client to inject keyboard events using the corresponding
4180    /// client end to `device`.
4181    ///
4182    /// Clients are allowed at most one in-flight call at a time. Subsequent
4183    /// calls must wait until the acknowledgment returns. Non-compliance
4184    /// results in channel closure.
4185    ///
4186    /// The `fuchsia.ui.test.input.Keyboard` channel will remain open even
4187    /// if the `Registry` connection closes.
4188    RegisterKeyboard {
4189        payload: RegistryRegisterKeyboardRequest,
4190        responder: RegistryRegisterKeyboardResponder,
4191    },
4192    /// Enables the client to inject keyboard events using the corresponding
4193    /// client end to `device`. Returns device_id of the created device.
4194    ///
4195    /// Clients are allowed at most one in-flight call at a time. Subsequent
4196    /// calls must wait until the acknowledgment returns. Non-compliance
4197    /// results in channel closure.
4198    ///
4199    /// The `fuchsia.ui.test.input.Keyboard` channel will remain open even
4200    /// if the `Registry` connection closes.
4201    RegisterKeyboardAndGetDeviceInfo {
4202        payload: RegistryRegisterKeyboardAndGetDeviceInfoRequest,
4203        responder: RegistryRegisterKeyboardAndGetDeviceInfoResponder,
4204    },
4205    /// Enables the client to inject mouse events using the corresponding
4206    /// client end to `device`.
4207    ///
4208    /// Clients are allowed at most one in-flight call at a time. Subsequent
4209    /// calls must wait until the acknowledgment returns. Non-compliance
4210    /// results in channel closure.
4211    ///
4212    /// The `fuchsia.ui.test.input.Mouse` channel will remain open even
4213    /// if the `Registry` connection closes.
4214    RegisterMouse {
4215        payload: RegistryRegisterMouseRequest,
4216        responder: RegistryRegisterMouseResponder,
4217    },
4218    /// Enables the client to inject mouse events using the corresponding
4219    /// client end to `device`. Returns device_id of the created device.
4220    ///
4221    /// Clients are allowed at most one in-flight call at a time. Subsequent
4222    /// calls must wait until the acknowledgment returns. Non-compliance
4223    /// results in channel closure.
4224    ///
4225    /// The `fuchsia.ui.test.input.Mouse` channel will remain open even
4226    /// if the `Registry` connection closes.
4227    RegisterMouseAndGetDeviceInfo {
4228        payload: RegistryRegisterMouseAndGetDeviceInfoRequest,
4229        responder: RegistryRegisterMouseAndGetDeviceInfoResponder,
4230    },
4231}
4232
4233impl RegistryRequest {
4234    #[allow(irrefutable_let_patterns)]
4235    pub fn into_register_touch_screen(
4236        self,
4237    ) -> Option<(RegistryRegisterTouchScreenRequest, RegistryRegisterTouchScreenResponder)> {
4238        if let RegistryRequest::RegisterTouchScreen { payload, responder } = self {
4239            Some((payload, responder))
4240        } else {
4241            None
4242        }
4243    }
4244
4245    #[allow(irrefutable_let_patterns)]
4246    pub fn into_register_touch_screen_and_get_device_info(
4247        self,
4248    ) -> Option<(
4249        RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
4250        RegistryRegisterTouchScreenAndGetDeviceInfoResponder,
4251    )> {
4252        if let RegistryRequest::RegisterTouchScreenAndGetDeviceInfo { payload, responder } = self {
4253            Some((payload, responder))
4254        } else {
4255            None
4256        }
4257    }
4258
4259    #[allow(irrefutable_let_patterns)]
4260    pub fn into_register_media_buttons_device(
4261        self,
4262    ) -> Option<(
4263        RegistryRegisterMediaButtonsDeviceRequest,
4264        RegistryRegisterMediaButtonsDeviceResponder,
4265    )> {
4266        if let RegistryRequest::RegisterMediaButtonsDevice { payload, responder } = self {
4267            Some((payload, responder))
4268        } else {
4269            None
4270        }
4271    }
4272
4273    #[allow(irrefutable_let_patterns)]
4274    pub fn into_register_media_buttons_device_and_get_device_info(
4275        self,
4276    ) -> Option<(
4277        RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
4278        RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder,
4279    )> {
4280        if let RegistryRequest::RegisterMediaButtonsDeviceAndGetDeviceInfo { payload, responder } =
4281            self
4282        {
4283            Some((payload, responder))
4284        } else {
4285            None
4286        }
4287    }
4288
4289    #[allow(irrefutable_let_patterns)]
4290    pub fn into_register_keyboard(
4291        self,
4292    ) -> Option<(RegistryRegisterKeyboardRequest, RegistryRegisterKeyboardResponder)> {
4293        if let RegistryRequest::RegisterKeyboard { payload, responder } = self {
4294            Some((payload, responder))
4295        } else {
4296            None
4297        }
4298    }
4299
4300    #[allow(irrefutable_let_patterns)]
4301    pub fn into_register_keyboard_and_get_device_info(
4302        self,
4303    ) -> Option<(
4304        RegistryRegisterKeyboardAndGetDeviceInfoRequest,
4305        RegistryRegisterKeyboardAndGetDeviceInfoResponder,
4306    )> {
4307        if let RegistryRequest::RegisterKeyboardAndGetDeviceInfo { payload, responder } = self {
4308            Some((payload, responder))
4309        } else {
4310            None
4311        }
4312    }
4313
4314    #[allow(irrefutable_let_patterns)]
4315    pub fn into_register_mouse(
4316        self,
4317    ) -> Option<(RegistryRegisterMouseRequest, RegistryRegisterMouseResponder)> {
4318        if let RegistryRequest::RegisterMouse { payload, responder } = self {
4319            Some((payload, responder))
4320        } else {
4321            None
4322        }
4323    }
4324
4325    #[allow(irrefutable_let_patterns)]
4326    pub fn into_register_mouse_and_get_device_info(
4327        self,
4328    ) -> Option<(
4329        RegistryRegisterMouseAndGetDeviceInfoRequest,
4330        RegistryRegisterMouseAndGetDeviceInfoResponder,
4331    )> {
4332        if let RegistryRequest::RegisterMouseAndGetDeviceInfo { payload, responder } = self {
4333            Some((payload, responder))
4334        } else {
4335            None
4336        }
4337    }
4338
4339    /// Name of the method defined in FIDL
4340    pub fn method_name(&self) -> &'static str {
4341        match *self {
4342            RegistryRequest::RegisterTouchScreen { .. } => "register_touch_screen",
4343            RegistryRequest::RegisterTouchScreenAndGetDeviceInfo { .. } => {
4344                "register_touch_screen_and_get_device_info"
4345            }
4346            RegistryRequest::RegisterMediaButtonsDevice { .. } => "register_media_buttons_device",
4347            RegistryRequest::RegisterMediaButtonsDeviceAndGetDeviceInfo { .. } => {
4348                "register_media_buttons_device_and_get_device_info"
4349            }
4350            RegistryRequest::RegisterKeyboard { .. } => "register_keyboard",
4351            RegistryRequest::RegisterKeyboardAndGetDeviceInfo { .. } => {
4352                "register_keyboard_and_get_device_info"
4353            }
4354            RegistryRequest::RegisterMouse { .. } => "register_mouse",
4355            RegistryRequest::RegisterMouseAndGetDeviceInfo { .. } => {
4356                "register_mouse_and_get_device_info"
4357            }
4358        }
4359    }
4360}
4361
4362#[derive(Debug, Clone)]
4363pub struct RegistryControlHandle {
4364    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4365}
4366
4367impl fidl::endpoints::ControlHandle for RegistryControlHandle {
4368    fn shutdown(&self) {
4369        self.inner.shutdown()
4370    }
4371
4372    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4373        self.inner.shutdown_with_epitaph(status)
4374    }
4375
4376    fn is_closed(&self) -> bool {
4377        self.inner.channel().is_closed()
4378    }
4379    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4380        self.inner.channel().on_closed()
4381    }
4382
4383    #[cfg(target_os = "fuchsia")]
4384    fn signal_peer(
4385        &self,
4386        clear_mask: zx::Signals,
4387        set_mask: zx::Signals,
4388    ) -> Result<(), zx_status::Status> {
4389        use fidl::Peered;
4390        self.inner.channel().signal_peer(clear_mask, set_mask)
4391    }
4392}
4393
4394impl RegistryControlHandle {}
4395
4396#[must_use = "FIDL methods require a response to be sent"]
4397#[derive(Debug)]
4398pub struct RegistryRegisterTouchScreenResponder {
4399    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4400    tx_id: u32,
4401}
4402
4403/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4404/// if the responder is dropped without sending a response, so that the client
4405/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4406impl std::ops::Drop for RegistryRegisterTouchScreenResponder {
4407    fn drop(&mut self) {
4408        self.control_handle.shutdown();
4409        // Safety: drops once, never accessed again
4410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4411    }
4412}
4413
4414impl fidl::endpoints::Responder for RegistryRegisterTouchScreenResponder {
4415    type ControlHandle = RegistryControlHandle;
4416
4417    fn control_handle(&self) -> &RegistryControlHandle {
4418        &self.control_handle
4419    }
4420
4421    fn drop_without_shutdown(mut self) {
4422        // Safety: drops once, never accessed again due to mem::forget
4423        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4424        // Prevent Drop from running (which would shut down the channel)
4425        std::mem::forget(self);
4426    }
4427}
4428
4429impl RegistryRegisterTouchScreenResponder {
4430    /// Sends a response to the FIDL transaction.
4431    ///
4432    /// Sets the channel to shutdown if an error occurs.
4433    pub fn send(self) -> Result<(), fidl::Error> {
4434        let _result = self.send_raw();
4435        if _result.is_err() {
4436            self.control_handle.shutdown();
4437        }
4438        self.drop_without_shutdown();
4439        _result
4440    }
4441
4442    /// Similar to "send" but does not shutdown the channel if an error occurs.
4443    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4444        let _result = self.send_raw();
4445        self.drop_without_shutdown();
4446        _result
4447    }
4448
4449    fn send_raw(&self) -> Result<(), fidl::Error> {
4450        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4451            (),
4452            self.tx_id,
4453            0x406fb450685ecb73,
4454            fidl::encoding::DynamicFlags::empty(),
4455        )
4456    }
4457}
4458
4459#[must_use = "FIDL methods require a response to be sent"]
4460#[derive(Debug)]
4461pub struct RegistryRegisterTouchScreenAndGetDeviceInfoResponder {
4462    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4463    tx_id: u32,
4464}
4465
4466/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4467/// if the responder is dropped without sending a response, so that the client
4468/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4469impl std::ops::Drop for RegistryRegisterTouchScreenAndGetDeviceInfoResponder {
4470    fn drop(&mut self) {
4471        self.control_handle.shutdown();
4472        // Safety: drops once, never accessed again
4473        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4474    }
4475}
4476
4477impl fidl::endpoints::Responder for RegistryRegisterTouchScreenAndGetDeviceInfoResponder {
4478    type ControlHandle = RegistryControlHandle;
4479
4480    fn control_handle(&self) -> &RegistryControlHandle {
4481        &self.control_handle
4482    }
4483
4484    fn drop_without_shutdown(mut self) {
4485        // Safety: drops once, never accessed again due to mem::forget
4486        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4487        // Prevent Drop from running (which would shut down the channel)
4488        std::mem::forget(self);
4489    }
4490}
4491
4492impl RegistryRegisterTouchScreenAndGetDeviceInfoResponder {
4493    /// Sends a response to the FIDL transaction.
4494    ///
4495    /// Sets the channel to shutdown if an error occurs.
4496    pub fn send(
4497        self,
4498        mut payload: RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
4499    ) -> Result<(), fidl::Error> {
4500        let _result = self.send_raw(payload);
4501        if _result.is_err() {
4502            self.control_handle.shutdown();
4503        }
4504        self.drop_without_shutdown();
4505        _result
4506    }
4507
4508    /// Similar to "send" but does not shutdown the channel if an error occurs.
4509    pub fn send_no_shutdown_on_err(
4510        self,
4511        mut payload: RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
4512    ) -> Result<(), fidl::Error> {
4513        let _result = self.send_raw(payload);
4514        self.drop_without_shutdown();
4515        _result
4516    }
4517
4518    fn send_raw(
4519        &self,
4520        mut payload: RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
4521    ) -> Result<(), fidl::Error> {
4522        self.control_handle.inner.send::<RegistryRegisterTouchScreenAndGetDeviceInfoResponse>(
4523            &mut payload,
4524            self.tx_id,
4525            0x2e8df048a411ed2b,
4526            fidl::encoding::DynamicFlags::empty(),
4527        )
4528    }
4529}
4530
4531#[must_use = "FIDL methods require a response to be sent"]
4532#[derive(Debug)]
4533pub struct RegistryRegisterMediaButtonsDeviceResponder {
4534    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4535    tx_id: u32,
4536}
4537
4538/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4539/// if the responder is dropped without sending a response, so that the client
4540/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4541impl std::ops::Drop for RegistryRegisterMediaButtonsDeviceResponder {
4542    fn drop(&mut self) {
4543        self.control_handle.shutdown();
4544        // Safety: drops once, never accessed again
4545        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4546    }
4547}
4548
4549impl fidl::endpoints::Responder for RegistryRegisterMediaButtonsDeviceResponder {
4550    type ControlHandle = RegistryControlHandle;
4551
4552    fn control_handle(&self) -> &RegistryControlHandle {
4553        &self.control_handle
4554    }
4555
4556    fn drop_without_shutdown(mut self) {
4557        // Safety: drops once, never accessed again due to mem::forget
4558        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4559        // Prevent Drop from running (which would shut down the channel)
4560        std::mem::forget(self);
4561    }
4562}
4563
4564impl RegistryRegisterMediaButtonsDeviceResponder {
4565    /// Sends a response to the FIDL transaction.
4566    ///
4567    /// Sets the channel to shutdown if an error occurs.
4568    pub fn send(self) -> Result<(), fidl::Error> {
4569        let _result = self.send_raw();
4570        if _result.is_err() {
4571            self.control_handle.shutdown();
4572        }
4573        self.drop_without_shutdown();
4574        _result
4575    }
4576
4577    /// Similar to "send" but does not shutdown the channel if an error occurs.
4578    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4579        let _result = self.send_raw();
4580        self.drop_without_shutdown();
4581        _result
4582    }
4583
4584    fn send_raw(&self) -> Result<(), fidl::Error> {
4585        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4586            (),
4587            self.tx_id,
4588            0x3a0b22e6d40e9629,
4589            fidl::encoding::DynamicFlags::empty(),
4590        )
4591    }
4592}
4593
4594#[must_use = "FIDL methods require a response to be sent"]
4595#[derive(Debug)]
4596pub struct RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder {
4597    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4598    tx_id: u32,
4599}
4600
4601/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4602/// if the responder is dropped without sending a response, so that the client
4603/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4604impl std::ops::Drop for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder {
4605    fn drop(&mut self) {
4606        self.control_handle.shutdown();
4607        // Safety: drops once, never accessed again
4608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4609    }
4610}
4611
4612impl fidl::endpoints::Responder for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder {
4613    type ControlHandle = RegistryControlHandle;
4614
4615    fn control_handle(&self) -> &RegistryControlHandle {
4616        &self.control_handle
4617    }
4618
4619    fn drop_without_shutdown(mut self) {
4620        // Safety: drops once, never accessed again due to mem::forget
4621        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4622        // Prevent Drop from running (which would shut down the channel)
4623        std::mem::forget(self);
4624    }
4625}
4626
4627impl RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponder {
4628    /// Sends a response to the FIDL transaction.
4629    ///
4630    /// Sets the channel to shutdown if an error occurs.
4631    pub fn send(
4632        self,
4633        mut payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
4634    ) -> Result<(), fidl::Error> {
4635        let _result = self.send_raw(payload);
4636        if _result.is_err() {
4637            self.control_handle.shutdown();
4638        }
4639        self.drop_without_shutdown();
4640        _result
4641    }
4642
4643    /// Similar to "send" but does not shutdown the channel if an error occurs.
4644    pub fn send_no_shutdown_on_err(
4645        self,
4646        mut payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
4647    ) -> Result<(), fidl::Error> {
4648        let _result = self.send_raw(payload);
4649        self.drop_without_shutdown();
4650        _result
4651    }
4652
4653    fn send_raw(
4654        &self,
4655        mut payload: RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
4656    ) -> Result<(), fidl::Error> {
4657        self.control_handle
4658            .inner
4659            .send::<RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse>(
4660                &mut payload,
4661                self.tx_id,
4662                0x15fb627d190ebd73,
4663                fidl::encoding::DynamicFlags::empty(),
4664            )
4665    }
4666}
4667
4668#[must_use = "FIDL methods require a response to be sent"]
4669#[derive(Debug)]
4670pub struct RegistryRegisterKeyboardResponder {
4671    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4672    tx_id: u32,
4673}
4674
4675/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4676/// if the responder is dropped without sending a response, so that the client
4677/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4678impl std::ops::Drop for RegistryRegisterKeyboardResponder {
4679    fn drop(&mut self) {
4680        self.control_handle.shutdown();
4681        // Safety: drops once, never accessed again
4682        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4683    }
4684}
4685
4686impl fidl::endpoints::Responder for RegistryRegisterKeyboardResponder {
4687    type ControlHandle = RegistryControlHandle;
4688
4689    fn control_handle(&self) -> &RegistryControlHandle {
4690        &self.control_handle
4691    }
4692
4693    fn drop_without_shutdown(mut self) {
4694        // Safety: drops once, never accessed again due to mem::forget
4695        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4696        // Prevent Drop from running (which would shut down the channel)
4697        std::mem::forget(self);
4698    }
4699}
4700
4701impl RegistryRegisterKeyboardResponder {
4702    /// Sends a response to the FIDL transaction.
4703    ///
4704    /// Sets the channel to shutdown if an error occurs.
4705    pub fn send(self) -> Result<(), fidl::Error> {
4706        let _result = self.send_raw();
4707        if _result.is_err() {
4708            self.control_handle.shutdown();
4709        }
4710        self.drop_without_shutdown();
4711        _result
4712    }
4713
4714    /// Similar to "send" but does not shutdown the channel if an error occurs.
4715    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4716        let _result = self.send_raw();
4717        self.drop_without_shutdown();
4718        _result
4719    }
4720
4721    fn send_raw(&self) -> Result<(), fidl::Error> {
4722        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4723            (),
4724            self.tx_id,
4725            0x291c697601404b38,
4726            fidl::encoding::DynamicFlags::empty(),
4727        )
4728    }
4729}
4730
4731#[must_use = "FIDL methods require a response to be sent"]
4732#[derive(Debug)]
4733pub struct RegistryRegisterKeyboardAndGetDeviceInfoResponder {
4734    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4735    tx_id: u32,
4736}
4737
4738/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4739/// if the responder is dropped without sending a response, so that the client
4740/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4741impl std::ops::Drop for RegistryRegisterKeyboardAndGetDeviceInfoResponder {
4742    fn drop(&mut self) {
4743        self.control_handle.shutdown();
4744        // Safety: drops once, never accessed again
4745        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4746    }
4747}
4748
4749impl fidl::endpoints::Responder for RegistryRegisterKeyboardAndGetDeviceInfoResponder {
4750    type ControlHandle = RegistryControlHandle;
4751
4752    fn control_handle(&self) -> &RegistryControlHandle {
4753        &self.control_handle
4754    }
4755
4756    fn drop_without_shutdown(mut self) {
4757        // Safety: drops once, never accessed again due to mem::forget
4758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4759        // Prevent Drop from running (which would shut down the channel)
4760        std::mem::forget(self);
4761    }
4762}
4763
4764impl RegistryRegisterKeyboardAndGetDeviceInfoResponder {
4765    /// Sends a response to the FIDL transaction.
4766    ///
4767    /// Sets the channel to shutdown if an error occurs.
4768    pub fn send(
4769        self,
4770        mut payload: RegistryRegisterKeyboardAndGetDeviceInfoResponse,
4771    ) -> Result<(), fidl::Error> {
4772        let _result = self.send_raw(payload);
4773        if _result.is_err() {
4774            self.control_handle.shutdown();
4775        }
4776        self.drop_without_shutdown();
4777        _result
4778    }
4779
4780    /// Similar to "send" but does not shutdown the channel if an error occurs.
4781    pub fn send_no_shutdown_on_err(
4782        self,
4783        mut payload: RegistryRegisterKeyboardAndGetDeviceInfoResponse,
4784    ) -> Result<(), fidl::Error> {
4785        let _result = self.send_raw(payload);
4786        self.drop_without_shutdown();
4787        _result
4788    }
4789
4790    fn send_raw(
4791        &self,
4792        mut payload: RegistryRegisterKeyboardAndGetDeviceInfoResponse,
4793    ) -> Result<(), fidl::Error> {
4794        self.control_handle.inner.send::<RegistryRegisterKeyboardAndGetDeviceInfoResponse>(
4795            &mut payload,
4796            self.tx_id,
4797            0x1e4edc6c56d2ac7e,
4798            fidl::encoding::DynamicFlags::empty(),
4799        )
4800    }
4801}
4802
4803#[must_use = "FIDL methods require a response to be sent"]
4804#[derive(Debug)]
4805pub struct RegistryRegisterMouseResponder {
4806    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4807    tx_id: u32,
4808}
4809
4810/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4811/// if the responder is dropped without sending a response, so that the client
4812/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4813impl std::ops::Drop for RegistryRegisterMouseResponder {
4814    fn drop(&mut self) {
4815        self.control_handle.shutdown();
4816        // Safety: drops once, never accessed again
4817        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4818    }
4819}
4820
4821impl fidl::endpoints::Responder for RegistryRegisterMouseResponder {
4822    type ControlHandle = RegistryControlHandle;
4823
4824    fn control_handle(&self) -> &RegistryControlHandle {
4825        &self.control_handle
4826    }
4827
4828    fn drop_without_shutdown(mut self) {
4829        // Safety: drops once, never accessed again due to mem::forget
4830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4831        // Prevent Drop from running (which would shut down the channel)
4832        std::mem::forget(self);
4833    }
4834}
4835
4836impl RegistryRegisterMouseResponder {
4837    /// Sends a response to the FIDL transaction.
4838    ///
4839    /// Sets the channel to shutdown if an error occurs.
4840    pub fn send(self) -> Result<(), fidl::Error> {
4841        let _result = self.send_raw();
4842        if _result.is_err() {
4843            self.control_handle.shutdown();
4844        }
4845        self.drop_without_shutdown();
4846        _result
4847    }
4848
4849    /// Similar to "send" but does not shutdown the channel if an error occurs.
4850    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4851        let _result = self.send_raw();
4852        self.drop_without_shutdown();
4853        _result
4854    }
4855
4856    fn send_raw(&self) -> Result<(), fidl::Error> {
4857        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4858            (),
4859            self.tx_id,
4860            0xf330169355a1add,
4861            fidl::encoding::DynamicFlags::empty(),
4862        )
4863    }
4864}
4865
4866#[must_use = "FIDL methods require a response to be sent"]
4867#[derive(Debug)]
4868pub struct RegistryRegisterMouseAndGetDeviceInfoResponder {
4869    control_handle: std::mem::ManuallyDrop<RegistryControlHandle>,
4870    tx_id: u32,
4871}
4872
4873/// Set the the channel to be shutdown (see [`RegistryControlHandle::shutdown`])
4874/// if the responder is dropped without sending a response, so that the client
4875/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4876impl std::ops::Drop for RegistryRegisterMouseAndGetDeviceInfoResponder {
4877    fn drop(&mut self) {
4878        self.control_handle.shutdown();
4879        // Safety: drops once, never accessed again
4880        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4881    }
4882}
4883
4884impl fidl::endpoints::Responder for RegistryRegisterMouseAndGetDeviceInfoResponder {
4885    type ControlHandle = RegistryControlHandle;
4886
4887    fn control_handle(&self) -> &RegistryControlHandle {
4888        &self.control_handle
4889    }
4890
4891    fn drop_without_shutdown(mut self) {
4892        // Safety: drops once, never accessed again due to mem::forget
4893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4894        // Prevent Drop from running (which would shut down the channel)
4895        std::mem::forget(self);
4896    }
4897}
4898
4899impl RegistryRegisterMouseAndGetDeviceInfoResponder {
4900    /// Sends a response to the FIDL transaction.
4901    ///
4902    /// Sets the channel to shutdown if an error occurs.
4903    pub fn send(
4904        self,
4905        mut payload: RegistryRegisterMouseAndGetDeviceInfoResponse,
4906    ) -> Result<(), fidl::Error> {
4907        let _result = self.send_raw(payload);
4908        if _result.is_err() {
4909            self.control_handle.shutdown();
4910        }
4911        self.drop_without_shutdown();
4912        _result
4913    }
4914
4915    /// Similar to "send" but does not shutdown the channel if an error occurs.
4916    pub fn send_no_shutdown_on_err(
4917        self,
4918        mut payload: RegistryRegisterMouseAndGetDeviceInfoResponse,
4919    ) -> Result<(), fidl::Error> {
4920        let _result = self.send_raw(payload);
4921        self.drop_without_shutdown();
4922        _result
4923    }
4924
4925    fn send_raw(
4926        &self,
4927        mut payload: RegistryRegisterMouseAndGetDeviceInfoResponse,
4928    ) -> Result<(), fidl::Error> {
4929        self.control_handle.inner.send::<RegistryRegisterMouseAndGetDeviceInfoResponse>(
4930            &mut payload,
4931            self.tx_id,
4932            0x34aa807670bbae29,
4933            fidl::encoding::DynamicFlags::empty(),
4934        )
4935    }
4936}
4937
4938#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4939pub struct TestAppStatusListenerMarker;
4940
4941impl fidl::endpoints::ProtocolMarker for TestAppStatusListenerMarker {
4942    type Proxy = TestAppStatusListenerProxy;
4943    type RequestStream = TestAppStatusListenerRequestStream;
4944    #[cfg(target_os = "fuchsia")]
4945    type SynchronousProxy = TestAppStatusListenerSynchronousProxy;
4946
4947    const DEBUG_NAME: &'static str = "fuchsia.ui.test.input.TestAppStatusListener";
4948}
4949impl fidl::endpoints::DiscoverableProtocolMarker for TestAppStatusListenerMarker {}
4950
4951pub trait TestAppStatusListenerProxyInterface: Send + Sync {
4952    type ReportStatusResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4953    fn r#report_status(&self, status: TestAppStatus) -> Self::ReportStatusResponseFut;
4954}
4955#[derive(Debug)]
4956#[cfg(target_os = "fuchsia")]
4957pub struct TestAppStatusListenerSynchronousProxy {
4958    client: fidl::client::sync::Client,
4959}
4960
4961#[cfg(target_os = "fuchsia")]
4962impl fidl::endpoints::SynchronousProxy for TestAppStatusListenerSynchronousProxy {
4963    type Proxy = TestAppStatusListenerProxy;
4964    type Protocol = TestAppStatusListenerMarker;
4965
4966    fn from_channel(inner: fidl::Channel) -> Self {
4967        Self::new(inner)
4968    }
4969
4970    fn into_channel(self) -> fidl::Channel {
4971        self.client.into_channel()
4972    }
4973
4974    fn as_channel(&self) -> &fidl::Channel {
4975        self.client.as_channel()
4976    }
4977}
4978
4979#[cfg(target_os = "fuchsia")]
4980impl TestAppStatusListenerSynchronousProxy {
4981    pub fn new(channel: fidl::Channel) -> Self {
4982        Self { client: fidl::client::sync::Client::new(channel) }
4983    }
4984
4985    pub fn into_channel(self) -> fidl::Channel {
4986        self.client.into_channel()
4987    }
4988
4989    /// Waits until an event arrives and returns it. It is safe for other
4990    /// threads to make concurrent requests while waiting for an event.
4991    pub fn wait_for_event(
4992        &self,
4993        deadline: zx::MonotonicInstant,
4994    ) -> Result<TestAppStatusListenerEvent, fidl::Error> {
4995        TestAppStatusListenerEvent::decode(
4996            self.client.wait_for_event::<TestAppStatusListenerMarker>(deadline)?,
4997        )
4998    }
4999
5000    /// Notify that the test app is ready to receive input events.
5001    ///
5002    /// Test app authors should call this method when they are ready
5003    /// to process input events.
5004    ///
5005    /// Test suites should wait for this call before injecting input
5006    /// events.
5007    pub fn r#report_status(
5008        &self,
5009        mut status: TestAppStatus,
5010        ___deadline: zx::MonotonicInstant,
5011    ) -> Result<(), fidl::Error> {
5012        let _response = self.client.send_query::<
5013            TestAppStatusListenerReportStatusRequest,
5014            fidl::encoding::EmptyPayload,
5015            TestAppStatusListenerMarker,
5016        >(
5017            (status,),
5018            0x6bde93eb7bb3da54,
5019            fidl::encoding::DynamicFlags::empty(),
5020            ___deadline,
5021        )?;
5022        Ok(_response)
5023    }
5024}
5025
5026#[cfg(target_os = "fuchsia")]
5027impl From<TestAppStatusListenerSynchronousProxy> for zx::NullableHandle {
5028    fn from(value: TestAppStatusListenerSynchronousProxy) -> Self {
5029        value.into_channel().into()
5030    }
5031}
5032
5033#[cfg(target_os = "fuchsia")]
5034impl From<fidl::Channel> for TestAppStatusListenerSynchronousProxy {
5035    fn from(value: fidl::Channel) -> Self {
5036        Self::new(value)
5037    }
5038}
5039
5040#[cfg(target_os = "fuchsia")]
5041impl fidl::endpoints::FromClient for TestAppStatusListenerSynchronousProxy {
5042    type Protocol = TestAppStatusListenerMarker;
5043
5044    fn from_client(value: fidl::endpoints::ClientEnd<TestAppStatusListenerMarker>) -> Self {
5045        Self::new(value.into_channel())
5046    }
5047}
5048
5049#[derive(Debug, Clone)]
5050pub struct TestAppStatusListenerProxy {
5051    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5052}
5053
5054impl fidl::endpoints::Proxy for TestAppStatusListenerProxy {
5055    type Protocol = TestAppStatusListenerMarker;
5056
5057    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5058        Self::new(inner)
5059    }
5060
5061    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5062        self.client.into_channel().map_err(|client| Self { client })
5063    }
5064
5065    fn as_channel(&self) -> &::fidl::AsyncChannel {
5066        self.client.as_channel()
5067    }
5068}
5069
5070impl TestAppStatusListenerProxy {
5071    /// Create a new Proxy for fuchsia.ui.test.input/TestAppStatusListener.
5072    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5073        let protocol_name =
5074            <TestAppStatusListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5075        Self { client: fidl::client::Client::new(channel, protocol_name) }
5076    }
5077
5078    /// Get a Stream of events from the remote end of the protocol.
5079    ///
5080    /// # Panics
5081    ///
5082    /// Panics if the event stream was already taken.
5083    pub fn take_event_stream(&self) -> TestAppStatusListenerEventStream {
5084        TestAppStatusListenerEventStream { event_receiver: self.client.take_event_receiver() }
5085    }
5086
5087    /// Notify that the test app is ready to receive input events.
5088    ///
5089    /// Test app authors should call this method when they are ready
5090    /// to process input events.
5091    ///
5092    /// Test suites should wait for this call before injecting input
5093    /// events.
5094    pub fn r#report_status(
5095        &self,
5096        mut status: TestAppStatus,
5097    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5098        TestAppStatusListenerProxyInterface::r#report_status(self, status)
5099    }
5100}
5101
5102impl TestAppStatusListenerProxyInterface for TestAppStatusListenerProxy {
5103    type ReportStatusResponseFut =
5104        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5105    fn r#report_status(&self, mut status: TestAppStatus) -> Self::ReportStatusResponseFut {
5106        fn _decode(
5107            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5108        ) -> Result<(), fidl::Error> {
5109            let _response = fidl::client::decode_transaction_body::<
5110                fidl::encoding::EmptyPayload,
5111                fidl::encoding::DefaultFuchsiaResourceDialect,
5112                0x6bde93eb7bb3da54,
5113            >(_buf?)?;
5114            Ok(_response)
5115        }
5116        self.client.send_query_and_decode::<TestAppStatusListenerReportStatusRequest, ()>(
5117            (status,),
5118            0x6bde93eb7bb3da54,
5119            fidl::encoding::DynamicFlags::empty(),
5120            _decode,
5121        )
5122    }
5123}
5124
5125pub struct TestAppStatusListenerEventStream {
5126    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5127}
5128
5129impl std::marker::Unpin for TestAppStatusListenerEventStream {}
5130
5131impl futures::stream::FusedStream for TestAppStatusListenerEventStream {
5132    fn is_terminated(&self) -> bool {
5133        self.event_receiver.is_terminated()
5134    }
5135}
5136
5137impl futures::Stream for TestAppStatusListenerEventStream {
5138    type Item = Result<TestAppStatusListenerEvent, fidl::Error>;
5139
5140    fn poll_next(
5141        mut self: std::pin::Pin<&mut Self>,
5142        cx: &mut std::task::Context<'_>,
5143    ) -> std::task::Poll<Option<Self::Item>> {
5144        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5145            &mut self.event_receiver,
5146            cx
5147        )?) {
5148            Some(buf) => std::task::Poll::Ready(Some(TestAppStatusListenerEvent::decode(buf))),
5149            None => std::task::Poll::Ready(None),
5150        }
5151    }
5152}
5153
5154#[derive(Debug)]
5155pub enum TestAppStatusListenerEvent {
5156    #[non_exhaustive]
5157    _UnknownEvent {
5158        /// Ordinal of the event that was sent.
5159        ordinal: u64,
5160    },
5161}
5162
5163impl TestAppStatusListenerEvent {
5164    /// Decodes a message buffer as a [`TestAppStatusListenerEvent`].
5165    fn decode(
5166        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5167    ) -> Result<TestAppStatusListenerEvent, fidl::Error> {
5168        let (bytes, _handles) = buf.split_mut();
5169        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5170        debug_assert_eq!(tx_header.tx_id, 0);
5171        match tx_header.ordinal {
5172            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5173                Ok(TestAppStatusListenerEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5174            }
5175            _ => Err(fidl::Error::UnknownOrdinal {
5176                ordinal: tx_header.ordinal,
5177                protocol_name:
5178                    <TestAppStatusListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5179            }),
5180        }
5181    }
5182}
5183
5184/// A Stream of incoming requests for fuchsia.ui.test.input/TestAppStatusListener.
5185pub struct TestAppStatusListenerRequestStream {
5186    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5187    is_terminated: bool,
5188}
5189
5190impl std::marker::Unpin for TestAppStatusListenerRequestStream {}
5191
5192impl futures::stream::FusedStream for TestAppStatusListenerRequestStream {
5193    fn is_terminated(&self) -> bool {
5194        self.is_terminated
5195    }
5196}
5197
5198impl fidl::endpoints::RequestStream for TestAppStatusListenerRequestStream {
5199    type Protocol = TestAppStatusListenerMarker;
5200    type ControlHandle = TestAppStatusListenerControlHandle;
5201
5202    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5203        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5204    }
5205
5206    fn control_handle(&self) -> Self::ControlHandle {
5207        TestAppStatusListenerControlHandle { inner: self.inner.clone() }
5208    }
5209
5210    fn into_inner(
5211        self,
5212    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5213    {
5214        (self.inner, self.is_terminated)
5215    }
5216
5217    fn from_inner(
5218        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5219        is_terminated: bool,
5220    ) -> Self {
5221        Self { inner, is_terminated }
5222    }
5223}
5224
5225impl futures::Stream for TestAppStatusListenerRequestStream {
5226    type Item = Result<TestAppStatusListenerRequest, fidl::Error>;
5227
5228    fn poll_next(
5229        mut self: std::pin::Pin<&mut Self>,
5230        cx: &mut std::task::Context<'_>,
5231    ) -> std::task::Poll<Option<Self::Item>> {
5232        let this = &mut *self;
5233        if this.inner.check_shutdown(cx) {
5234            this.is_terminated = true;
5235            return std::task::Poll::Ready(None);
5236        }
5237        if this.is_terminated {
5238            panic!("polled TestAppStatusListenerRequestStream after completion");
5239        }
5240        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5241            |bytes, handles| {
5242                match this.inner.channel().read_etc(cx, bytes, handles) {
5243                    std::task::Poll::Ready(Ok(())) => {}
5244                    std::task::Poll::Pending => return std::task::Poll::Pending,
5245                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5246                        this.is_terminated = true;
5247                        return std::task::Poll::Ready(None);
5248                    }
5249                    std::task::Poll::Ready(Err(e)) => {
5250                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5251                            e.into(),
5252                        ))));
5253                    }
5254                }
5255
5256                // A message has been received from the channel
5257                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5258
5259                std::task::Poll::Ready(Some(match header.ordinal {
5260                0x6bde93eb7bb3da54 => {
5261                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5262                    let mut req = fidl::new_empty!(TestAppStatusListenerReportStatusRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5263                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TestAppStatusListenerReportStatusRequest>(&header, _body_bytes, handles, &mut req)?;
5264                    let control_handle = TestAppStatusListenerControlHandle {
5265                        inner: this.inner.clone(),
5266                    };
5267                    Ok(TestAppStatusListenerRequest::ReportStatus {status: req.status,
5268
5269                        responder: TestAppStatusListenerReportStatusResponder {
5270                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5271                            tx_id: header.tx_id,
5272                        },
5273                    })
5274                }
5275                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5276                    Ok(TestAppStatusListenerRequest::_UnknownMethod {
5277                        ordinal: header.ordinal,
5278                        control_handle: TestAppStatusListenerControlHandle { inner: this.inner.clone() },
5279                        method_type: fidl::MethodType::OneWay,
5280                    })
5281                }
5282                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5283                    this.inner.send_framework_err(
5284                        fidl::encoding::FrameworkErr::UnknownMethod,
5285                        header.tx_id,
5286                        header.ordinal,
5287                        header.dynamic_flags(),
5288                        (bytes, handles),
5289                    )?;
5290                    Ok(TestAppStatusListenerRequest::_UnknownMethod {
5291                        ordinal: header.ordinal,
5292                        control_handle: TestAppStatusListenerControlHandle { inner: this.inner.clone() },
5293                        method_type: fidl::MethodType::TwoWay,
5294                    })
5295                }
5296                _ => Err(fidl::Error::UnknownOrdinal {
5297                    ordinal: header.ordinal,
5298                    protocol_name: <TestAppStatusListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5299                }),
5300            }))
5301            },
5302        )
5303    }
5304}
5305
5306/// Test suites depend on test app status can listen to this listener.
5307#[derive(Debug)]
5308pub enum TestAppStatusListenerRequest {
5309    /// Notify that the test app is ready to receive input events.
5310    ///
5311    /// Test app authors should call this method when they are ready
5312    /// to process input events.
5313    ///
5314    /// Test suites should wait for this call before injecting input
5315    /// events.
5316    ReportStatus { status: TestAppStatus, responder: TestAppStatusListenerReportStatusResponder },
5317    /// An interaction was received which does not match any known method.
5318    #[non_exhaustive]
5319    _UnknownMethod {
5320        /// Ordinal of the method that was called.
5321        ordinal: u64,
5322        control_handle: TestAppStatusListenerControlHandle,
5323        method_type: fidl::MethodType,
5324    },
5325}
5326
5327impl TestAppStatusListenerRequest {
5328    #[allow(irrefutable_let_patterns)]
5329    pub fn into_report_status(
5330        self,
5331    ) -> Option<(TestAppStatus, TestAppStatusListenerReportStatusResponder)> {
5332        if let TestAppStatusListenerRequest::ReportStatus { status, responder } = self {
5333            Some((status, responder))
5334        } else {
5335            None
5336        }
5337    }
5338
5339    /// Name of the method defined in FIDL
5340    pub fn method_name(&self) -> &'static str {
5341        match *self {
5342            TestAppStatusListenerRequest::ReportStatus { .. } => "report_status",
5343            TestAppStatusListenerRequest::_UnknownMethod {
5344                method_type: fidl::MethodType::OneWay,
5345                ..
5346            } => "unknown one-way method",
5347            TestAppStatusListenerRequest::_UnknownMethod {
5348                method_type: fidl::MethodType::TwoWay,
5349                ..
5350            } => "unknown two-way method",
5351        }
5352    }
5353}
5354
5355#[derive(Debug, Clone)]
5356pub struct TestAppStatusListenerControlHandle {
5357    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5358}
5359
5360impl fidl::endpoints::ControlHandle for TestAppStatusListenerControlHandle {
5361    fn shutdown(&self) {
5362        self.inner.shutdown()
5363    }
5364
5365    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5366        self.inner.shutdown_with_epitaph(status)
5367    }
5368
5369    fn is_closed(&self) -> bool {
5370        self.inner.channel().is_closed()
5371    }
5372    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5373        self.inner.channel().on_closed()
5374    }
5375
5376    #[cfg(target_os = "fuchsia")]
5377    fn signal_peer(
5378        &self,
5379        clear_mask: zx::Signals,
5380        set_mask: zx::Signals,
5381    ) -> Result<(), zx_status::Status> {
5382        use fidl::Peered;
5383        self.inner.channel().signal_peer(clear_mask, set_mask)
5384    }
5385}
5386
5387impl TestAppStatusListenerControlHandle {}
5388
5389#[must_use = "FIDL methods require a response to be sent"]
5390#[derive(Debug)]
5391pub struct TestAppStatusListenerReportStatusResponder {
5392    control_handle: std::mem::ManuallyDrop<TestAppStatusListenerControlHandle>,
5393    tx_id: u32,
5394}
5395
5396/// Set the the channel to be shutdown (see [`TestAppStatusListenerControlHandle::shutdown`])
5397/// if the responder is dropped without sending a response, so that the client
5398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5399impl std::ops::Drop for TestAppStatusListenerReportStatusResponder {
5400    fn drop(&mut self) {
5401        self.control_handle.shutdown();
5402        // Safety: drops once, never accessed again
5403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5404    }
5405}
5406
5407impl fidl::endpoints::Responder for TestAppStatusListenerReportStatusResponder {
5408    type ControlHandle = TestAppStatusListenerControlHandle;
5409
5410    fn control_handle(&self) -> &TestAppStatusListenerControlHandle {
5411        &self.control_handle
5412    }
5413
5414    fn drop_without_shutdown(mut self) {
5415        // Safety: drops once, never accessed again due to mem::forget
5416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5417        // Prevent Drop from running (which would shut down the channel)
5418        std::mem::forget(self);
5419    }
5420}
5421
5422impl TestAppStatusListenerReportStatusResponder {
5423    /// Sends a response to the FIDL transaction.
5424    ///
5425    /// Sets the channel to shutdown if an error occurs.
5426    pub fn send(self) -> Result<(), fidl::Error> {
5427        let _result = self.send_raw();
5428        if _result.is_err() {
5429            self.control_handle.shutdown();
5430        }
5431        self.drop_without_shutdown();
5432        _result
5433    }
5434
5435    /// Similar to "send" but does not shutdown the channel if an error occurs.
5436    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5437        let _result = self.send_raw();
5438        self.drop_without_shutdown();
5439        _result
5440    }
5441
5442    fn send_raw(&self) -> Result<(), fidl::Error> {
5443        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5444            (),
5445            self.tx_id,
5446            0x6bde93eb7bb3da54,
5447            fidl::encoding::DynamicFlags::empty(),
5448        )
5449    }
5450}
5451
5452#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5453pub struct TouchInputListenerMarker;
5454
5455impl fidl::endpoints::ProtocolMarker for TouchInputListenerMarker {
5456    type Proxy = TouchInputListenerProxy;
5457    type RequestStream = TouchInputListenerRequestStream;
5458    #[cfg(target_os = "fuchsia")]
5459    type SynchronousProxy = TouchInputListenerSynchronousProxy;
5460
5461    const DEBUG_NAME: &'static str = "fuchsia.ui.test.input.TouchInputListener";
5462}
5463impl fidl::endpoints::DiscoverableProtocolMarker for TouchInputListenerMarker {}
5464
5465pub trait TouchInputListenerProxyInterface: Send + Sync {
5466    fn r#report_touch_input(
5467        &self,
5468        payload: &TouchInputListenerReportTouchInputRequest,
5469    ) -> Result<(), fidl::Error>;
5470}
5471#[derive(Debug)]
5472#[cfg(target_os = "fuchsia")]
5473pub struct TouchInputListenerSynchronousProxy {
5474    client: fidl::client::sync::Client,
5475}
5476
5477#[cfg(target_os = "fuchsia")]
5478impl fidl::endpoints::SynchronousProxy for TouchInputListenerSynchronousProxy {
5479    type Proxy = TouchInputListenerProxy;
5480    type Protocol = TouchInputListenerMarker;
5481
5482    fn from_channel(inner: fidl::Channel) -> Self {
5483        Self::new(inner)
5484    }
5485
5486    fn into_channel(self) -> fidl::Channel {
5487        self.client.into_channel()
5488    }
5489
5490    fn as_channel(&self) -> &fidl::Channel {
5491        self.client.as_channel()
5492    }
5493}
5494
5495#[cfg(target_os = "fuchsia")]
5496impl TouchInputListenerSynchronousProxy {
5497    pub fn new(channel: fidl::Channel) -> Self {
5498        Self { client: fidl::client::sync::Client::new(channel) }
5499    }
5500
5501    pub fn into_channel(self) -> fidl::Channel {
5502        self.client.into_channel()
5503    }
5504
5505    /// Waits until an event arrives and returns it. It is safe for other
5506    /// threads to make concurrent requests while waiting for an event.
5507    pub fn wait_for_event(
5508        &self,
5509        deadline: zx::MonotonicInstant,
5510    ) -> Result<TouchInputListenerEvent, fidl::Error> {
5511        TouchInputListenerEvent::decode(
5512            self.client.wait_for_event::<TouchInputListenerMarker>(deadline)?,
5513        )
5514    }
5515
5516    /// Report that component under test has received expected input.
5517    pub fn r#report_touch_input(
5518        &self,
5519        mut payload: &TouchInputListenerReportTouchInputRequest,
5520    ) -> Result<(), fidl::Error> {
5521        self.client.send::<TouchInputListenerReportTouchInputRequest>(
5522            payload,
5523            0x371dcd048ac842aa,
5524            fidl::encoding::DynamicFlags::empty(),
5525        )
5526    }
5527}
5528
5529#[cfg(target_os = "fuchsia")]
5530impl From<TouchInputListenerSynchronousProxy> for zx::NullableHandle {
5531    fn from(value: TouchInputListenerSynchronousProxy) -> Self {
5532        value.into_channel().into()
5533    }
5534}
5535
5536#[cfg(target_os = "fuchsia")]
5537impl From<fidl::Channel> for TouchInputListenerSynchronousProxy {
5538    fn from(value: fidl::Channel) -> Self {
5539        Self::new(value)
5540    }
5541}
5542
5543#[cfg(target_os = "fuchsia")]
5544impl fidl::endpoints::FromClient for TouchInputListenerSynchronousProxy {
5545    type Protocol = TouchInputListenerMarker;
5546
5547    fn from_client(value: fidl::endpoints::ClientEnd<TouchInputListenerMarker>) -> Self {
5548        Self::new(value.into_channel())
5549    }
5550}
5551
5552#[derive(Debug, Clone)]
5553pub struct TouchInputListenerProxy {
5554    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5555}
5556
5557impl fidl::endpoints::Proxy for TouchInputListenerProxy {
5558    type Protocol = TouchInputListenerMarker;
5559
5560    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5561        Self::new(inner)
5562    }
5563
5564    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5565        self.client.into_channel().map_err(|client| Self { client })
5566    }
5567
5568    fn as_channel(&self) -> &::fidl::AsyncChannel {
5569        self.client.as_channel()
5570    }
5571}
5572
5573impl TouchInputListenerProxy {
5574    /// Create a new Proxy for fuchsia.ui.test.input/TouchInputListener.
5575    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5576        let protocol_name =
5577            <TouchInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5578        Self { client: fidl::client::Client::new(channel, protocol_name) }
5579    }
5580
5581    /// Get a Stream of events from the remote end of the protocol.
5582    ///
5583    /// # Panics
5584    ///
5585    /// Panics if the event stream was already taken.
5586    pub fn take_event_stream(&self) -> TouchInputListenerEventStream {
5587        TouchInputListenerEventStream { event_receiver: self.client.take_event_receiver() }
5588    }
5589
5590    /// Report that component under test has received expected input.
5591    pub fn r#report_touch_input(
5592        &self,
5593        mut payload: &TouchInputListenerReportTouchInputRequest,
5594    ) -> Result<(), fidl::Error> {
5595        TouchInputListenerProxyInterface::r#report_touch_input(self, payload)
5596    }
5597}
5598
5599impl TouchInputListenerProxyInterface for TouchInputListenerProxy {
5600    fn r#report_touch_input(
5601        &self,
5602        mut payload: &TouchInputListenerReportTouchInputRequest,
5603    ) -> Result<(), fidl::Error> {
5604        self.client.send::<TouchInputListenerReportTouchInputRequest>(
5605            payload,
5606            0x371dcd048ac842aa,
5607            fidl::encoding::DynamicFlags::empty(),
5608        )
5609    }
5610}
5611
5612pub struct TouchInputListenerEventStream {
5613    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5614}
5615
5616impl std::marker::Unpin for TouchInputListenerEventStream {}
5617
5618impl futures::stream::FusedStream for TouchInputListenerEventStream {
5619    fn is_terminated(&self) -> bool {
5620        self.event_receiver.is_terminated()
5621    }
5622}
5623
5624impl futures::Stream for TouchInputListenerEventStream {
5625    type Item = Result<TouchInputListenerEvent, fidl::Error>;
5626
5627    fn poll_next(
5628        mut self: std::pin::Pin<&mut Self>,
5629        cx: &mut std::task::Context<'_>,
5630    ) -> std::task::Poll<Option<Self::Item>> {
5631        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5632            &mut self.event_receiver,
5633            cx
5634        )?) {
5635            Some(buf) => std::task::Poll::Ready(Some(TouchInputListenerEvent::decode(buf))),
5636            None => std::task::Poll::Ready(None),
5637        }
5638    }
5639}
5640
5641#[derive(Debug)]
5642pub enum TouchInputListenerEvent {}
5643
5644impl TouchInputListenerEvent {
5645    /// Decodes a message buffer as a [`TouchInputListenerEvent`].
5646    fn decode(
5647        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5648    ) -> Result<TouchInputListenerEvent, fidl::Error> {
5649        let (bytes, _handles) = buf.split_mut();
5650        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5651        debug_assert_eq!(tx_header.tx_id, 0);
5652        match tx_header.ordinal {
5653            _ => Err(fidl::Error::UnknownOrdinal {
5654                ordinal: tx_header.ordinal,
5655                protocol_name:
5656                    <TouchInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5657            }),
5658        }
5659    }
5660}
5661
5662/// A Stream of incoming requests for fuchsia.ui.test.input/TouchInputListener.
5663pub struct TouchInputListenerRequestStream {
5664    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5665    is_terminated: bool,
5666}
5667
5668impl std::marker::Unpin for TouchInputListenerRequestStream {}
5669
5670impl futures::stream::FusedStream for TouchInputListenerRequestStream {
5671    fn is_terminated(&self) -> bool {
5672        self.is_terminated
5673    }
5674}
5675
5676impl fidl::endpoints::RequestStream for TouchInputListenerRequestStream {
5677    type Protocol = TouchInputListenerMarker;
5678    type ControlHandle = TouchInputListenerControlHandle;
5679
5680    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5681        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5682    }
5683
5684    fn control_handle(&self) -> Self::ControlHandle {
5685        TouchInputListenerControlHandle { inner: self.inner.clone() }
5686    }
5687
5688    fn into_inner(
5689        self,
5690    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5691    {
5692        (self.inner, self.is_terminated)
5693    }
5694
5695    fn from_inner(
5696        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5697        is_terminated: bool,
5698    ) -> Self {
5699        Self { inner, is_terminated }
5700    }
5701}
5702
5703impl futures::Stream for TouchInputListenerRequestStream {
5704    type Item = Result<TouchInputListenerRequest, fidl::Error>;
5705
5706    fn poll_next(
5707        mut self: std::pin::Pin<&mut Self>,
5708        cx: &mut std::task::Context<'_>,
5709    ) -> std::task::Poll<Option<Self::Item>> {
5710        let this = &mut *self;
5711        if this.inner.check_shutdown(cx) {
5712            this.is_terminated = true;
5713            return std::task::Poll::Ready(None);
5714        }
5715        if this.is_terminated {
5716            panic!("polled TouchInputListenerRequestStream after completion");
5717        }
5718        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5719            |bytes, handles| {
5720                match this.inner.channel().read_etc(cx, bytes, handles) {
5721                    std::task::Poll::Ready(Ok(())) => {}
5722                    std::task::Poll::Pending => return std::task::Poll::Pending,
5723                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5724                        this.is_terminated = true;
5725                        return std::task::Poll::Ready(None);
5726                    }
5727                    std::task::Poll::Ready(Err(e)) => {
5728                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5729                            e.into(),
5730                        ))));
5731                    }
5732                }
5733
5734                // A message has been received from the channel
5735                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5736
5737                std::task::Poll::Ready(Some(match header.ordinal {
5738                0x371dcd048ac842aa => {
5739                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5740                    let mut req = fidl::new_empty!(TouchInputListenerReportTouchInputRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5741                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchInputListenerReportTouchInputRequest>(&header, _body_bytes, handles, &mut req)?;
5742                    let control_handle = TouchInputListenerControlHandle {
5743                        inner: this.inner.clone(),
5744                    };
5745                    Ok(TouchInputListenerRequest::ReportTouchInput {payload: req,
5746                        control_handle,
5747                    })
5748                }
5749                _ => Err(fidl::Error::UnknownOrdinal {
5750                    ordinal: header.ordinal,
5751                    protocol_name: <TouchInputListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5752                }),
5753            }))
5754            },
5755        )
5756    }
5757}
5758
5759/// A tool for applications to report touch input to interested parties (e.g. a test
5760/// fixture).
5761#[derive(Debug)]
5762pub enum TouchInputListenerRequest {
5763    /// Report that component under test has received expected input.
5764    ReportTouchInput {
5765        payload: TouchInputListenerReportTouchInputRequest,
5766        control_handle: TouchInputListenerControlHandle,
5767    },
5768}
5769
5770impl TouchInputListenerRequest {
5771    #[allow(irrefutable_let_patterns)]
5772    pub fn into_report_touch_input(
5773        self,
5774    ) -> Option<(TouchInputListenerReportTouchInputRequest, TouchInputListenerControlHandle)> {
5775        if let TouchInputListenerRequest::ReportTouchInput { payload, control_handle } = self {
5776            Some((payload, control_handle))
5777        } else {
5778            None
5779        }
5780    }
5781
5782    /// Name of the method defined in FIDL
5783    pub fn method_name(&self) -> &'static str {
5784        match *self {
5785            TouchInputListenerRequest::ReportTouchInput { .. } => "report_touch_input",
5786        }
5787    }
5788}
5789
5790#[derive(Debug, Clone)]
5791pub struct TouchInputListenerControlHandle {
5792    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5793}
5794
5795impl fidl::endpoints::ControlHandle for TouchInputListenerControlHandle {
5796    fn shutdown(&self) {
5797        self.inner.shutdown()
5798    }
5799
5800    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5801        self.inner.shutdown_with_epitaph(status)
5802    }
5803
5804    fn is_closed(&self) -> bool {
5805        self.inner.channel().is_closed()
5806    }
5807    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5808        self.inner.channel().on_closed()
5809    }
5810
5811    #[cfg(target_os = "fuchsia")]
5812    fn signal_peer(
5813        &self,
5814        clear_mask: zx::Signals,
5815        set_mask: zx::Signals,
5816    ) -> Result<(), zx_status::Status> {
5817        use fidl::Peered;
5818        self.inner.channel().signal_peer(clear_mask, set_mask)
5819    }
5820}
5821
5822impl TouchInputListenerControlHandle {}
5823
5824#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5825pub struct TouchScreenMarker;
5826
5827impl fidl::endpoints::ProtocolMarker for TouchScreenMarker {
5828    type Proxy = TouchScreenProxy;
5829    type RequestStream = TouchScreenRequestStream;
5830    #[cfg(target_os = "fuchsia")]
5831    type SynchronousProxy = TouchScreenSynchronousProxy;
5832
5833    const DEBUG_NAME: &'static str = "(anonymous) TouchScreen";
5834}
5835
5836pub trait TouchScreenProxyInterface: Send + Sync {
5837    type SimulateTapResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5838    fn r#simulate_tap(
5839        &self,
5840        payload: &TouchScreenSimulateTapRequest,
5841    ) -> Self::SimulateTapResponseFut;
5842    type SimulateMultiTapResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5843    fn r#simulate_multi_tap(
5844        &self,
5845        payload: &TouchScreenSimulateMultiTapRequest,
5846    ) -> Self::SimulateMultiTapResponseFut;
5847    type SimulateSwipeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5848    fn r#simulate_swipe(
5849        &self,
5850        payload: &TouchScreenSimulateSwipeRequest,
5851    ) -> Self::SimulateSwipeResponseFut;
5852    type SimulateMultiFingerGestureResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
5853        + Send;
5854    fn r#simulate_multi_finger_gesture(
5855        &self,
5856        payload: &TouchScreenSimulateMultiFingerGestureRequest,
5857    ) -> Self::SimulateMultiFingerGestureResponseFut;
5858    type SimulateTouchEventResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5859    fn r#simulate_touch_event(
5860        &self,
5861        report: &TouchInputReport,
5862    ) -> Self::SimulateTouchEventResponseFut;
5863}
5864#[derive(Debug)]
5865#[cfg(target_os = "fuchsia")]
5866pub struct TouchScreenSynchronousProxy {
5867    client: fidl::client::sync::Client,
5868}
5869
5870#[cfg(target_os = "fuchsia")]
5871impl fidl::endpoints::SynchronousProxy for TouchScreenSynchronousProxy {
5872    type Proxy = TouchScreenProxy;
5873    type Protocol = TouchScreenMarker;
5874
5875    fn from_channel(inner: fidl::Channel) -> Self {
5876        Self::new(inner)
5877    }
5878
5879    fn into_channel(self) -> fidl::Channel {
5880        self.client.into_channel()
5881    }
5882
5883    fn as_channel(&self) -> &fidl::Channel {
5884        self.client.as_channel()
5885    }
5886}
5887
5888#[cfg(target_os = "fuchsia")]
5889impl TouchScreenSynchronousProxy {
5890    pub fn new(channel: fidl::Channel) -> Self {
5891        Self { client: fidl::client::sync::Client::new(channel) }
5892    }
5893
5894    pub fn into_channel(self) -> fidl::Channel {
5895        self.client.into_channel()
5896    }
5897
5898    /// Waits until an event arrives and returns it. It is safe for other
5899    /// threads to make concurrent requests while waiting for an event.
5900    pub fn wait_for_event(
5901        &self,
5902        deadline: zx::MonotonicInstant,
5903    ) -> Result<TouchScreenEvent, fidl::Error> {
5904        TouchScreenEvent::decode(self.client.wait_for_event::<TouchScreenMarker>(deadline)?)
5905    }
5906
5907    /// Simulates a tap at the requested location.
5908    pub fn r#simulate_tap(
5909        &self,
5910        mut payload: &TouchScreenSimulateTapRequest,
5911        ___deadline: zx::MonotonicInstant,
5912    ) -> Result<(), fidl::Error> {
5913        let _response = self.client.send_query::<
5914            TouchScreenSimulateTapRequest,
5915            fidl::encoding::EmptyPayload,
5916            TouchScreenMarker,
5917        >(
5918            payload,
5919            0x2301a93caf2527fd,
5920            fidl::encoding::DynamicFlags::empty(),
5921            ___deadline,
5922        )?;
5923        Ok(_response)
5924    }
5925
5926    /// Simulates multi finger tap at the requested locations.
5927    pub fn r#simulate_multi_tap(
5928        &self,
5929        mut payload: &TouchScreenSimulateMultiTapRequest,
5930        ___deadline: zx::MonotonicInstant,
5931    ) -> Result<(), fidl::Error> {
5932        let _response = self.client.send_query::<
5933            TouchScreenSimulateMultiTapRequest,
5934            fidl::encoding::EmptyPayload,
5935            TouchScreenMarker,
5936        >(
5937            payload,
5938            0x101f5014bda76352,
5939            fidl::encoding::DynamicFlags::empty(),
5940            ___deadline,
5941        )?;
5942        Ok(_response)
5943    }
5944
5945    /// Simulates a swipe that starts at `start_location` and ends at `end_location`,
5946    /// with a total number of move events equal to `move_event_count`.
5947    ///
5948    /// The generated pointer event stream will be:
5949    ///
5950    /// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
5951    ///
5952    /// Events are injected with no explicit delay in between if `duration` not set.
5953    pub fn r#simulate_swipe(
5954        &self,
5955        mut payload: &TouchScreenSimulateSwipeRequest,
5956        ___deadline: zx::MonotonicInstant,
5957    ) -> Result<(), fidl::Error> {
5958        let _response = self.client.send_query::<
5959            TouchScreenSimulateSwipeRequest,
5960            fidl::encoding::EmptyPayload,
5961            TouchScreenMarker,
5962        >(
5963            payload,
5964            0xcebf566f3f489e4,
5965            fidl::encoding::DynamicFlags::empty(),
5966            ___deadline,
5967        )?;
5968        Ok(_response)
5969    }
5970
5971    /// Simulates a multi fingers linear gesture that starts at `start_locations`
5972    /// and ends at `end_locations`, with a total number of move events equal to
5973    /// `move_event_count`. if the arguments are invalid, the server should close
5974    /// the connection.
5975    ///
5976    /// The generated pointer event stream will be:
5977    ///
5978    /// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
5979    ///
5980    /// Events are injected with a small explicit delay in between.
5981    pub fn r#simulate_multi_finger_gesture(
5982        &self,
5983        mut payload: &TouchScreenSimulateMultiFingerGestureRequest,
5984        ___deadline: zx::MonotonicInstant,
5985    ) -> Result<(), fidl::Error> {
5986        let _response = self.client.send_query::<
5987            TouchScreenSimulateMultiFingerGestureRequest,
5988            fidl::encoding::EmptyPayload,
5989            TouchScreenMarker,
5990        >(
5991            payload,
5992            0x426074401c1f212b,
5993            fidl::encoding::DynamicFlags::empty(),
5994            ___deadline,
5995        )?;
5996        Ok(_response)
5997    }
5998
5999    pub fn r#simulate_touch_event(
6000        &self,
6001        mut report: &TouchInputReport,
6002        ___deadline: zx::MonotonicInstant,
6003    ) -> Result<(), fidl::Error> {
6004        let _response = self.client.send_query::<
6005            TouchScreenSimulateTouchEventRequest,
6006            fidl::encoding::EmptyPayload,
6007            TouchScreenMarker,
6008        >(
6009            (report,),
6010            0x557ab909d22a837d,
6011            fidl::encoding::DynamicFlags::empty(),
6012            ___deadline,
6013        )?;
6014        Ok(_response)
6015    }
6016}
6017
6018#[cfg(target_os = "fuchsia")]
6019impl From<TouchScreenSynchronousProxy> for zx::NullableHandle {
6020    fn from(value: TouchScreenSynchronousProxy) -> Self {
6021        value.into_channel().into()
6022    }
6023}
6024
6025#[cfg(target_os = "fuchsia")]
6026impl From<fidl::Channel> for TouchScreenSynchronousProxy {
6027    fn from(value: fidl::Channel) -> Self {
6028        Self::new(value)
6029    }
6030}
6031
6032#[cfg(target_os = "fuchsia")]
6033impl fidl::endpoints::FromClient for TouchScreenSynchronousProxy {
6034    type Protocol = TouchScreenMarker;
6035
6036    fn from_client(value: fidl::endpoints::ClientEnd<TouchScreenMarker>) -> Self {
6037        Self::new(value.into_channel())
6038    }
6039}
6040
6041#[derive(Debug, Clone)]
6042pub struct TouchScreenProxy {
6043    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6044}
6045
6046impl fidl::endpoints::Proxy for TouchScreenProxy {
6047    type Protocol = TouchScreenMarker;
6048
6049    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6050        Self::new(inner)
6051    }
6052
6053    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6054        self.client.into_channel().map_err(|client| Self { client })
6055    }
6056
6057    fn as_channel(&self) -> &::fidl::AsyncChannel {
6058        self.client.as_channel()
6059    }
6060}
6061
6062impl TouchScreenProxy {
6063    /// Create a new Proxy for fuchsia.ui.test.input/TouchScreen.
6064    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6065        let protocol_name = <TouchScreenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6066        Self { client: fidl::client::Client::new(channel, protocol_name) }
6067    }
6068
6069    /// Get a Stream of events from the remote end of the protocol.
6070    ///
6071    /// # Panics
6072    ///
6073    /// Panics if the event stream was already taken.
6074    pub fn take_event_stream(&self) -> TouchScreenEventStream {
6075        TouchScreenEventStream { event_receiver: self.client.take_event_receiver() }
6076    }
6077
6078    /// Simulates a tap at the requested location.
6079    pub fn r#simulate_tap(
6080        &self,
6081        mut payload: &TouchScreenSimulateTapRequest,
6082    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6083        TouchScreenProxyInterface::r#simulate_tap(self, payload)
6084    }
6085
6086    /// Simulates multi finger tap at the requested locations.
6087    pub fn r#simulate_multi_tap(
6088        &self,
6089        mut payload: &TouchScreenSimulateMultiTapRequest,
6090    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6091        TouchScreenProxyInterface::r#simulate_multi_tap(self, payload)
6092    }
6093
6094    /// Simulates a swipe that starts at `start_location` and ends at `end_location`,
6095    /// with a total number of move events equal to `move_event_count`.
6096    ///
6097    /// The generated pointer event stream will be:
6098    ///
6099    /// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
6100    ///
6101    /// Events are injected with no explicit delay in between if `duration` not set.
6102    pub fn r#simulate_swipe(
6103        &self,
6104        mut payload: &TouchScreenSimulateSwipeRequest,
6105    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6106        TouchScreenProxyInterface::r#simulate_swipe(self, payload)
6107    }
6108
6109    /// Simulates a multi fingers linear gesture that starts at `start_locations`
6110    /// and ends at `end_locations`, with a total number of move events equal to
6111    /// `move_event_count`. if the arguments are invalid, the server should close
6112    /// the connection.
6113    ///
6114    /// The generated pointer event stream will be:
6115    ///
6116    /// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
6117    ///
6118    /// Events are injected with a small explicit delay in between.
6119    pub fn r#simulate_multi_finger_gesture(
6120        &self,
6121        mut payload: &TouchScreenSimulateMultiFingerGestureRequest,
6122    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6123        TouchScreenProxyInterface::r#simulate_multi_finger_gesture(self, payload)
6124    }
6125
6126    pub fn r#simulate_touch_event(
6127        &self,
6128        mut report: &TouchInputReport,
6129    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6130        TouchScreenProxyInterface::r#simulate_touch_event(self, report)
6131    }
6132}
6133
6134impl TouchScreenProxyInterface for TouchScreenProxy {
6135    type SimulateTapResponseFut =
6136        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6137    fn r#simulate_tap(
6138        &self,
6139        mut payload: &TouchScreenSimulateTapRequest,
6140    ) -> Self::SimulateTapResponseFut {
6141        fn _decode(
6142            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6143        ) -> Result<(), fidl::Error> {
6144            let _response = fidl::client::decode_transaction_body::<
6145                fidl::encoding::EmptyPayload,
6146                fidl::encoding::DefaultFuchsiaResourceDialect,
6147                0x2301a93caf2527fd,
6148            >(_buf?)?;
6149            Ok(_response)
6150        }
6151        self.client.send_query_and_decode::<TouchScreenSimulateTapRequest, ()>(
6152            payload,
6153            0x2301a93caf2527fd,
6154            fidl::encoding::DynamicFlags::empty(),
6155            _decode,
6156        )
6157    }
6158
6159    type SimulateMultiTapResponseFut =
6160        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6161    fn r#simulate_multi_tap(
6162        &self,
6163        mut payload: &TouchScreenSimulateMultiTapRequest,
6164    ) -> Self::SimulateMultiTapResponseFut {
6165        fn _decode(
6166            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6167        ) -> Result<(), fidl::Error> {
6168            let _response = fidl::client::decode_transaction_body::<
6169                fidl::encoding::EmptyPayload,
6170                fidl::encoding::DefaultFuchsiaResourceDialect,
6171                0x101f5014bda76352,
6172            >(_buf?)?;
6173            Ok(_response)
6174        }
6175        self.client.send_query_and_decode::<TouchScreenSimulateMultiTapRequest, ()>(
6176            payload,
6177            0x101f5014bda76352,
6178            fidl::encoding::DynamicFlags::empty(),
6179            _decode,
6180        )
6181    }
6182
6183    type SimulateSwipeResponseFut =
6184        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6185    fn r#simulate_swipe(
6186        &self,
6187        mut payload: &TouchScreenSimulateSwipeRequest,
6188    ) -> Self::SimulateSwipeResponseFut {
6189        fn _decode(
6190            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6191        ) -> Result<(), fidl::Error> {
6192            let _response = fidl::client::decode_transaction_body::<
6193                fidl::encoding::EmptyPayload,
6194                fidl::encoding::DefaultFuchsiaResourceDialect,
6195                0xcebf566f3f489e4,
6196            >(_buf?)?;
6197            Ok(_response)
6198        }
6199        self.client.send_query_and_decode::<TouchScreenSimulateSwipeRequest, ()>(
6200            payload,
6201            0xcebf566f3f489e4,
6202            fidl::encoding::DynamicFlags::empty(),
6203            _decode,
6204        )
6205    }
6206
6207    type SimulateMultiFingerGestureResponseFut =
6208        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6209    fn r#simulate_multi_finger_gesture(
6210        &self,
6211        mut payload: &TouchScreenSimulateMultiFingerGestureRequest,
6212    ) -> Self::SimulateMultiFingerGestureResponseFut {
6213        fn _decode(
6214            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6215        ) -> Result<(), fidl::Error> {
6216            let _response = fidl::client::decode_transaction_body::<
6217                fidl::encoding::EmptyPayload,
6218                fidl::encoding::DefaultFuchsiaResourceDialect,
6219                0x426074401c1f212b,
6220            >(_buf?)?;
6221            Ok(_response)
6222        }
6223        self.client.send_query_and_decode::<TouchScreenSimulateMultiFingerGestureRequest, ()>(
6224            payload,
6225            0x426074401c1f212b,
6226            fidl::encoding::DynamicFlags::empty(),
6227            _decode,
6228        )
6229    }
6230
6231    type SimulateTouchEventResponseFut =
6232        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6233    fn r#simulate_touch_event(
6234        &self,
6235        mut report: &TouchInputReport,
6236    ) -> Self::SimulateTouchEventResponseFut {
6237        fn _decode(
6238            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6239        ) -> Result<(), fidl::Error> {
6240            let _response = fidl::client::decode_transaction_body::<
6241                fidl::encoding::EmptyPayload,
6242                fidl::encoding::DefaultFuchsiaResourceDialect,
6243                0x557ab909d22a837d,
6244            >(_buf?)?;
6245            Ok(_response)
6246        }
6247        self.client.send_query_and_decode::<TouchScreenSimulateTouchEventRequest, ()>(
6248            (report,),
6249            0x557ab909d22a837d,
6250            fidl::encoding::DynamicFlags::empty(),
6251            _decode,
6252        )
6253    }
6254}
6255
6256pub struct TouchScreenEventStream {
6257    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6258}
6259
6260impl std::marker::Unpin for TouchScreenEventStream {}
6261
6262impl futures::stream::FusedStream for TouchScreenEventStream {
6263    fn is_terminated(&self) -> bool {
6264        self.event_receiver.is_terminated()
6265    }
6266}
6267
6268impl futures::Stream for TouchScreenEventStream {
6269    type Item = Result<TouchScreenEvent, fidl::Error>;
6270
6271    fn poll_next(
6272        mut self: std::pin::Pin<&mut Self>,
6273        cx: &mut std::task::Context<'_>,
6274    ) -> std::task::Poll<Option<Self::Item>> {
6275        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6276            &mut self.event_receiver,
6277            cx
6278        )?) {
6279            Some(buf) => std::task::Poll::Ready(Some(TouchScreenEvent::decode(buf))),
6280            None => std::task::Poll::Ready(None),
6281        }
6282    }
6283}
6284
6285#[derive(Debug)]
6286pub enum TouchScreenEvent {}
6287
6288impl TouchScreenEvent {
6289    /// Decodes a message buffer as a [`TouchScreenEvent`].
6290    fn decode(
6291        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6292    ) -> Result<TouchScreenEvent, fidl::Error> {
6293        let (bytes, _handles) = buf.split_mut();
6294        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6295        debug_assert_eq!(tx_header.tx_id, 0);
6296        match tx_header.ordinal {
6297            _ => Err(fidl::Error::UnknownOrdinal {
6298                ordinal: tx_header.ordinal,
6299                protocol_name: <TouchScreenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6300            }),
6301        }
6302    }
6303}
6304
6305/// A Stream of incoming requests for fuchsia.ui.test.input/TouchScreen.
6306pub struct TouchScreenRequestStream {
6307    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6308    is_terminated: bool,
6309}
6310
6311impl std::marker::Unpin for TouchScreenRequestStream {}
6312
6313impl futures::stream::FusedStream for TouchScreenRequestStream {
6314    fn is_terminated(&self) -> bool {
6315        self.is_terminated
6316    }
6317}
6318
6319impl fidl::endpoints::RequestStream for TouchScreenRequestStream {
6320    type Protocol = TouchScreenMarker;
6321    type ControlHandle = TouchScreenControlHandle;
6322
6323    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6324        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6325    }
6326
6327    fn control_handle(&self) -> Self::ControlHandle {
6328        TouchScreenControlHandle { inner: self.inner.clone() }
6329    }
6330
6331    fn into_inner(
6332        self,
6333    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6334    {
6335        (self.inner, self.is_terminated)
6336    }
6337
6338    fn from_inner(
6339        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6340        is_terminated: bool,
6341    ) -> Self {
6342        Self { inner, is_terminated }
6343    }
6344}
6345
6346impl futures::Stream for TouchScreenRequestStream {
6347    type Item = Result<TouchScreenRequest, fidl::Error>;
6348
6349    fn poll_next(
6350        mut self: std::pin::Pin<&mut Self>,
6351        cx: &mut std::task::Context<'_>,
6352    ) -> std::task::Poll<Option<Self::Item>> {
6353        let this = &mut *self;
6354        if this.inner.check_shutdown(cx) {
6355            this.is_terminated = true;
6356            return std::task::Poll::Ready(None);
6357        }
6358        if this.is_terminated {
6359            panic!("polled TouchScreenRequestStream after completion");
6360        }
6361        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6362            |bytes, handles| {
6363                match this.inner.channel().read_etc(cx, bytes, handles) {
6364                    std::task::Poll::Ready(Ok(())) => {}
6365                    std::task::Poll::Pending => return std::task::Poll::Pending,
6366                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6367                        this.is_terminated = true;
6368                        return std::task::Poll::Ready(None);
6369                    }
6370                    std::task::Poll::Ready(Err(e)) => {
6371                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6372                            e.into(),
6373                        ))));
6374                    }
6375                }
6376
6377                // A message has been received from the channel
6378                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6379
6380                std::task::Poll::Ready(Some(match header.ordinal {
6381                    0x2301a93caf2527fd => {
6382                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6383                        let mut req = fidl::new_empty!(
6384                            TouchScreenSimulateTapRequest,
6385                            fidl::encoding::DefaultFuchsiaResourceDialect
6386                        );
6387                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchScreenSimulateTapRequest>(&header, _body_bytes, handles, &mut req)?;
6388                        let control_handle = TouchScreenControlHandle { inner: this.inner.clone() };
6389                        Ok(TouchScreenRequest::SimulateTap {
6390                            payload: req,
6391                            responder: TouchScreenSimulateTapResponder {
6392                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6393                                tx_id: header.tx_id,
6394                            },
6395                        })
6396                    }
6397                    0x101f5014bda76352 => {
6398                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6399                        let mut req = fidl::new_empty!(
6400                            TouchScreenSimulateMultiTapRequest,
6401                            fidl::encoding::DefaultFuchsiaResourceDialect
6402                        );
6403                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchScreenSimulateMultiTapRequest>(&header, _body_bytes, handles, &mut req)?;
6404                        let control_handle = TouchScreenControlHandle { inner: this.inner.clone() };
6405                        Ok(TouchScreenRequest::SimulateMultiTap {
6406                            payload: req,
6407                            responder: TouchScreenSimulateMultiTapResponder {
6408                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6409                                tx_id: header.tx_id,
6410                            },
6411                        })
6412                    }
6413                    0xcebf566f3f489e4 => {
6414                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6415                        let mut req = fidl::new_empty!(
6416                            TouchScreenSimulateSwipeRequest,
6417                            fidl::encoding::DefaultFuchsiaResourceDialect
6418                        );
6419                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchScreenSimulateSwipeRequest>(&header, _body_bytes, handles, &mut req)?;
6420                        let control_handle = TouchScreenControlHandle { inner: this.inner.clone() };
6421                        Ok(TouchScreenRequest::SimulateSwipe {
6422                            payload: req,
6423                            responder: TouchScreenSimulateSwipeResponder {
6424                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6425                                tx_id: header.tx_id,
6426                            },
6427                        })
6428                    }
6429                    0x426074401c1f212b => {
6430                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6431                        let mut req = fidl::new_empty!(
6432                            TouchScreenSimulateMultiFingerGestureRequest,
6433                            fidl::encoding::DefaultFuchsiaResourceDialect
6434                        );
6435                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchScreenSimulateMultiFingerGestureRequest>(&header, _body_bytes, handles, &mut req)?;
6436                        let control_handle = TouchScreenControlHandle { inner: this.inner.clone() };
6437                        Ok(TouchScreenRequest::SimulateMultiFingerGesture {
6438                            payload: req,
6439                            responder: TouchScreenSimulateMultiFingerGestureResponder {
6440                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6441                                tx_id: header.tx_id,
6442                            },
6443                        })
6444                    }
6445                    0x557ab909d22a837d => {
6446                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6447                        let mut req = fidl::new_empty!(
6448                            TouchScreenSimulateTouchEventRequest,
6449                            fidl::encoding::DefaultFuchsiaResourceDialect
6450                        );
6451                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchScreenSimulateTouchEventRequest>(&header, _body_bytes, handles, &mut req)?;
6452                        let control_handle = TouchScreenControlHandle { inner: this.inner.clone() };
6453                        Ok(TouchScreenRequest::SimulateTouchEvent {
6454                            report: req.report,
6455
6456                            responder: TouchScreenSimulateTouchEventResponder {
6457                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6458                                tx_id: header.tx_id,
6459                            },
6460                        })
6461                    }
6462                    _ => Err(fidl::Error::UnknownOrdinal {
6463                        ordinal: header.ordinal,
6464                        protocol_name:
6465                            <TouchScreenMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6466                    }),
6467                }))
6468            },
6469        )
6470    }
6471}
6472
6473/// A tool to inject touch events into Input Pipeline.
6474///
6475/// Please extend as necessary.
6476#[derive(Debug)]
6477pub enum TouchScreenRequest {
6478    /// Simulates a tap at the requested location.
6479    SimulateTap {
6480        payload: TouchScreenSimulateTapRequest,
6481        responder: TouchScreenSimulateTapResponder,
6482    },
6483    /// Simulates multi finger tap at the requested locations.
6484    SimulateMultiTap {
6485        payload: TouchScreenSimulateMultiTapRequest,
6486        responder: TouchScreenSimulateMultiTapResponder,
6487    },
6488    /// Simulates a swipe that starts at `start_location` and ends at `end_location`,
6489    /// with a total number of move events equal to `move_event_count`.
6490    ///
6491    /// The generated pointer event stream will be:
6492    ///
6493    /// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
6494    ///
6495    /// Events are injected with no explicit delay in between if `duration` not set.
6496    SimulateSwipe {
6497        payload: TouchScreenSimulateSwipeRequest,
6498        responder: TouchScreenSimulateSwipeResponder,
6499    },
6500    /// Simulates a multi fingers linear gesture that starts at `start_locations`
6501    /// and ends at `end_locations`, with a total number of move events equal to
6502    /// `move_event_count`. if the arguments are invalid, the server should close
6503    /// the connection.
6504    ///
6505    /// The generated pointer event stream will be:
6506    ///
6507    /// DOWN + CHANGE_1 + ... + CHANGE_n + UP, where n == `move_event_count`
6508    ///
6509    /// Events are injected with a small explicit delay in between.
6510    SimulateMultiFingerGesture {
6511        payload: TouchScreenSimulateMultiFingerGestureRequest,
6512        responder: TouchScreenSimulateMultiFingerGestureResponder,
6513    },
6514    SimulateTouchEvent {
6515        report: TouchInputReport,
6516        responder: TouchScreenSimulateTouchEventResponder,
6517    },
6518}
6519
6520impl TouchScreenRequest {
6521    #[allow(irrefutable_let_patterns)]
6522    pub fn into_simulate_tap(
6523        self,
6524    ) -> Option<(TouchScreenSimulateTapRequest, TouchScreenSimulateTapResponder)> {
6525        if let TouchScreenRequest::SimulateTap { payload, responder } = self {
6526            Some((payload, responder))
6527        } else {
6528            None
6529        }
6530    }
6531
6532    #[allow(irrefutable_let_patterns)]
6533    pub fn into_simulate_multi_tap(
6534        self,
6535    ) -> Option<(TouchScreenSimulateMultiTapRequest, TouchScreenSimulateMultiTapResponder)> {
6536        if let TouchScreenRequest::SimulateMultiTap { payload, responder } = self {
6537            Some((payload, responder))
6538        } else {
6539            None
6540        }
6541    }
6542
6543    #[allow(irrefutable_let_patterns)]
6544    pub fn into_simulate_swipe(
6545        self,
6546    ) -> Option<(TouchScreenSimulateSwipeRequest, TouchScreenSimulateSwipeResponder)> {
6547        if let TouchScreenRequest::SimulateSwipe { payload, responder } = self {
6548            Some((payload, responder))
6549        } else {
6550            None
6551        }
6552    }
6553
6554    #[allow(irrefutable_let_patterns)]
6555    pub fn into_simulate_multi_finger_gesture(
6556        self,
6557    ) -> Option<(
6558        TouchScreenSimulateMultiFingerGestureRequest,
6559        TouchScreenSimulateMultiFingerGestureResponder,
6560    )> {
6561        if let TouchScreenRequest::SimulateMultiFingerGesture { payload, responder } = self {
6562            Some((payload, responder))
6563        } else {
6564            None
6565        }
6566    }
6567
6568    #[allow(irrefutable_let_patterns)]
6569    pub fn into_simulate_touch_event(
6570        self,
6571    ) -> Option<(TouchInputReport, TouchScreenSimulateTouchEventResponder)> {
6572        if let TouchScreenRequest::SimulateTouchEvent { report, responder } = self {
6573            Some((report, responder))
6574        } else {
6575            None
6576        }
6577    }
6578
6579    /// Name of the method defined in FIDL
6580    pub fn method_name(&self) -> &'static str {
6581        match *self {
6582            TouchScreenRequest::SimulateTap { .. } => "simulate_tap",
6583            TouchScreenRequest::SimulateMultiTap { .. } => "simulate_multi_tap",
6584            TouchScreenRequest::SimulateSwipe { .. } => "simulate_swipe",
6585            TouchScreenRequest::SimulateMultiFingerGesture { .. } => {
6586                "simulate_multi_finger_gesture"
6587            }
6588            TouchScreenRequest::SimulateTouchEvent { .. } => "simulate_touch_event",
6589        }
6590    }
6591}
6592
6593#[derive(Debug, Clone)]
6594pub struct TouchScreenControlHandle {
6595    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6596}
6597
6598impl fidl::endpoints::ControlHandle for TouchScreenControlHandle {
6599    fn shutdown(&self) {
6600        self.inner.shutdown()
6601    }
6602
6603    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6604        self.inner.shutdown_with_epitaph(status)
6605    }
6606
6607    fn is_closed(&self) -> bool {
6608        self.inner.channel().is_closed()
6609    }
6610    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6611        self.inner.channel().on_closed()
6612    }
6613
6614    #[cfg(target_os = "fuchsia")]
6615    fn signal_peer(
6616        &self,
6617        clear_mask: zx::Signals,
6618        set_mask: zx::Signals,
6619    ) -> Result<(), zx_status::Status> {
6620        use fidl::Peered;
6621        self.inner.channel().signal_peer(clear_mask, set_mask)
6622    }
6623}
6624
6625impl TouchScreenControlHandle {}
6626
6627#[must_use = "FIDL methods require a response to be sent"]
6628#[derive(Debug)]
6629pub struct TouchScreenSimulateTapResponder {
6630    control_handle: std::mem::ManuallyDrop<TouchScreenControlHandle>,
6631    tx_id: u32,
6632}
6633
6634/// Set the the channel to be shutdown (see [`TouchScreenControlHandle::shutdown`])
6635/// if the responder is dropped without sending a response, so that the client
6636/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6637impl std::ops::Drop for TouchScreenSimulateTapResponder {
6638    fn drop(&mut self) {
6639        self.control_handle.shutdown();
6640        // Safety: drops once, never accessed again
6641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6642    }
6643}
6644
6645impl fidl::endpoints::Responder for TouchScreenSimulateTapResponder {
6646    type ControlHandle = TouchScreenControlHandle;
6647
6648    fn control_handle(&self) -> &TouchScreenControlHandle {
6649        &self.control_handle
6650    }
6651
6652    fn drop_without_shutdown(mut self) {
6653        // Safety: drops once, never accessed again due to mem::forget
6654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6655        // Prevent Drop from running (which would shut down the channel)
6656        std::mem::forget(self);
6657    }
6658}
6659
6660impl TouchScreenSimulateTapResponder {
6661    /// Sends a response to the FIDL transaction.
6662    ///
6663    /// Sets the channel to shutdown if an error occurs.
6664    pub fn send(self) -> Result<(), fidl::Error> {
6665        let _result = self.send_raw();
6666        if _result.is_err() {
6667            self.control_handle.shutdown();
6668        }
6669        self.drop_without_shutdown();
6670        _result
6671    }
6672
6673    /// Similar to "send" but does not shutdown the channel if an error occurs.
6674    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6675        let _result = self.send_raw();
6676        self.drop_without_shutdown();
6677        _result
6678    }
6679
6680    fn send_raw(&self) -> Result<(), fidl::Error> {
6681        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6682            (),
6683            self.tx_id,
6684            0x2301a93caf2527fd,
6685            fidl::encoding::DynamicFlags::empty(),
6686        )
6687    }
6688}
6689
6690#[must_use = "FIDL methods require a response to be sent"]
6691#[derive(Debug)]
6692pub struct TouchScreenSimulateMultiTapResponder {
6693    control_handle: std::mem::ManuallyDrop<TouchScreenControlHandle>,
6694    tx_id: u32,
6695}
6696
6697/// Set the the channel to be shutdown (see [`TouchScreenControlHandle::shutdown`])
6698/// if the responder is dropped without sending a response, so that the client
6699/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6700impl std::ops::Drop for TouchScreenSimulateMultiTapResponder {
6701    fn drop(&mut self) {
6702        self.control_handle.shutdown();
6703        // Safety: drops once, never accessed again
6704        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6705    }
6706}
6707
6708impl fidl::endpoints::Responder for TouchScreenSimulateMultiTapResponder {
6709    type ControlHandle = TouchScreenControlHandle;
6710
6711    fn control_handle(&self) -> &TouchScreenControlHandle {
6712        &self.control_handle
6713    }
6714
6715    fn drop_without_shutdown(mut self) {
6716        // Safety: drops once, never accessed again due to mem::forget
6717        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6718        // Prevent Drop from running (which would shut down the channel)
6719        std::mem::forget(self);
6720    }
6721}
6722
6723impl TouchScreenSimulateMultiTapResponder {
6724    /// Sends a response to the FIDL transaction.
6725    ///
6726    /// Sets the channel to shutdown if an error occurs.
6727    pub fn send(self) -> Result<(), fidl::Error> {
6728        let _result = self.send_raw();
6729        if _result.is_err() {
6730            self.control_handle.shutdown();
6731        }
6732        self.drop_without_shutdown();
6733        _result
6734    }
6735
6736    /// Similar to "send" but does not shutdown the channel if an error occurs.
6737    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6738        let _result = self.send_raw();
6739        self.drop_without_shutdown();
6740        _result
6741    }
6742
6743    fn send_raw(&self) -> Result<(), fidl::Error> {
6744        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6745            (),
6746            self.tx_id,
6747            0x101f5014bda76352,
6748            fidl::encoding::DynamicFlags::empty(),
6749        )
6750    }
6751}
6752
6753#[must_use = "FIDL methods require a response to be sent"]
6754#[derive(Debug)]
6755pub struct TouchScreenSimulateSwipeResponder {
6756    control_handle: std::mem::ManuallyDrop<TouchScreenControlHandle>,
6757    tx_id: u32,
6758}
6759
6760/// Set the the channel to be shutdown (see [`TouchScreenControlHandle::shutdown`])
6761/// if the responder is dropped without sending a response, so that the client
6762/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6763impl std::ops::Drop for TouchScreenSimulateSwipeResponder {
6764    fn drop(&mut self) {
6765        self.control_handle.shutdown();
6766        // Safety: drops once, never accessed again
6767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6768    }
6769}
6770
6771impl fidl::endpoints::Responder for TouchScreenSimulateSwipeResponder {
6772    type ControlHandle = TouchScreenControlHandle;
6773
6774    fn control_handle(&self) -> &TouchScreenControlHandle {
6775        &self.control_handle
6776    }
6777
6778    fn drop_without_shutdown(mut self) {
6779        // Safety: drops once, never accessed again due to mem::forget
6780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6781        // Prevent Drop from running (which would shut down the channel)
6782        std::mem::forget(self);
6783    }
6784}
6785
6786impl TouchScreenSimulateSwipeResponder {
6787    /// Sends a response to the FIDL transaction.
6788    ///
6789    /// Sets the channel to shutdown if an error occurs.
6790    pub fn send(self) -> Result<(), fidl::Error> {
6791        let _result = self.send_raw();
6792        if _result.is_err() {
6793            self.control_handle.shutdown();
6794        }
6795        self.drop_without_shutdown();
6796        _result
6797    }
6798
6799    /// Similar to "send" but does not shutdown the channel if an error occurs.
6800    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6801        let _result = self.send_raw();
6802        self.drop_without_shutdown();
6803        _result
6804    }
6805
6806    fn send_raw(&self) -> Result<(), fidl::Error> {
6807        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6808            (),
6809            self.tx_id,
6810            0xcebf566f3f489e4,
6811            fidl::encoding::DynamicFlags::empty(),
6812        )
6813    }
6814}
6815
6816#[must_use = "FIDL methods require a response to be sent"]
6817#[derive(Debug)]
6818pub struct TouchScreenSimulateMultiFingerGestureResponder {
6819    control_handle: std::mem::ManuallyDrop<TouchScreenControlHandle>,
6820    tx_id: u32,
6821}
6822
6823/// Set the the channel to be shutdown (see [`TouchScreenControlHandle::shutdown`])
6824/// if the responder is dropped without sending a response, so that the client
6825/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6826impl std::ops::Drop for TouchScreenSimulateMultiFingerGestureResponder {
6827    fn drop(&mut self) {
6828        self.control_handle.shutdown();
6829        // Safety: drops once, never accessed again
6830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6831    }
6832}
6833
6834impl fidl::endpoints::Responder for TouchScreenSimulateMultiFingerGestureResponder {
6835    type ControlHandle = TouchScreenControlHandle;
6836
6837    fn control_handle(&self) -> &TouchScreenControlHandle {
6838        &self.control_handle
6839    }
6840
6841    fn drop_without_shutdown(mut self) {
6842        // Safety: drops once, never accessed again due to mem::forget
6843        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6844        // Prevent Drop from running (which would shut down the channel)
6845        std::mem::forget(self);
6846    }
6847}
6848
6849impl TouchScreenSimulateMultiFingerGestureResponder {
6850    /// Sends a response to the FIDL transaction.
6851    ///
6852    /// Sets the channel to shutdown if an error occurs.
6853    pub fn send(self) -> Result<(), fidl::Error> {
6854        let _result = self.send_raw();
6855        if _result.is_err() {
6856            self.control_handle.shutdown();
6857        }
6858        self.drop_without_shutdown();
6859        _result
6860    }
6861
6862    /// Similar to "send" but does not shutdown the channel if an error occurs.
6863    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6864        let _result = self.send_raw();
6865        self.drop_without_shutdown();
6866        _result
6867    }
6868
6869    fn send_raw(&self) -> Result<(), fidl::Error> {
6870        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6871            (),
6872            self.tx_id,
6873            0x426074401c1f212b,
6874            fidl::encoding::DynamicFlags::empty(),
6875        )
6876    }
6877}
6878
6879#[must_use = "FIDL methods require a response to be sent"]
6880#[derive(Debug)]
6881pub struct TouchScreenSimulateTouchEventResponder {
6882    control_handle: std::mem::ManuallyDrop<TouchScreenControlHandle>,
6883    tx_id: u32,
6884}
6885
6886/// Set the the channel to be shutdown (see [`TouchScreenControlHandle::shutdown`])
6887/// if the responder is dropped without sending a response, so that the client
6888/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6889impl std::ops::Drop for TouchScreenSimulateTouchEventResponder {
6890    fn drop(&mut self) {
6891        self.control_handle.shutdown();
6892        // Safety: drops once, never accessed again
6893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6894    }
6895}
6896
6897impl fidl::endpoints::Responder for TouchScreenSimulateTouchEventResponder {
6898    type ControlHandle = TouchScreenControlHandle;
6899
6900    fn control_handle(&self) -> &TouchScreenControlHandle {
6901        &self.control_handle
6902    }
6903
6904    fn drop_without_shutdown(mut self) {
6905        // Safety: drops once, never accessed again due to mem::forget
6906        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6907        // Prevent Drop from running (which would shut down the channel)
6908        std::mem::forget(self);
6909    }
6910}
6911
6912impl TouchScreenSimulateTouchEventResponder {
6913    /// Sends a response to the FIDL transaction.
6914    ///
6915    /// Sets the channel to shutdown if an error occurs.
6916    pub fn send(self) -> Result<(), fidl::Error> {
6917        let _result = self.send_raw();
6918        if _result.is_err() {
6919            self.control_handle.shutdown();
6920        }
6921        self.drop_without_shutdown();
6922        _result
6923    }
6924
6925    /// Similar to "send" but does not shutdown the channel if an error occurs.
6926    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6927        let _result = self.send_raw();
6928        self.drop_without_shutdown();
6929        _result
6930    }
6931
6932    fn send_raw(&self) -> Result<(), fidl::Error> {
6933        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6934            (),
6935            self.tx_id,
6936            0x557ab909d22a837d,
6937            fidl::encoding::DynamicFlags::empty(),
6938        )
6939    }
6940}
6941
6942mod internal {
6943    use super::*;
6944
6945    impl RegistryRegisterKeyboardAndGetDeviceInfoRequest {
6946        #[inline(always)]
6947        fn max_ordinal_present(&self) -> u64 {
6948            if let Some(_) = self.device {
6949                return 1;
6950            }
6951            0
6952        }
6953    }
6954
6955    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterKeyboardAndGetDeviceInfoRequest {
6956        type Borrowed<'a> = &'a mut Self;
6957        fn take_or_borrow<'a>(
6958            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6959        ) -> Self::Borrowed<'a> {
6960            value
6961        }
6962    }
6963
6964    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterKeyboardAndGetDeviceInfoRequest {
6965        type Owned = Self;
6966
6967        #[inline(always)]
6968        fn inline_align(_context: fidl::encoding::Context) -> usize {
6969            8
6970        }
6971
6972        #[inline(always)]
6973        fn inline_size(_context: fidl::encoding::Context) -> usize {
6974            16
6975        }
6976    }
6977
6978    unsafe impl
6979        fidl::encoding::Encode<
6980            RegistryRegisterKeyboardAndGetDeviceInfoRequest,
6981            fidl::encoding::DefaultFuchsiaResourceDialect,
6982        > for &mut RegistryRegisterKeyboardAndGetDeviceInfoRequest
6983    {
6984        unsafe fn encode(
6985            self,
6986            encoder: &mut fidl::encoding::Encoder<
6987                '_,
6988                fidl::encoding::DefaultFuchsiaResourceDialect,
6989            >,
6990            offset: usize,
6991            mut depth: fidl::encoding::Depth,
6992        ) -> fidl::Result<()> {
6993            encoder.debug_check_bounds::<RegistryRegisterKeyboardAndGetDeviceInfoRequest>(offset);
6994            // Vector header
6995            let max_ordinal: u64 = self.max_ordinal_present();
6996            encoder.write_num(max_ordinal, offset);
6997            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6998            // Calling encoder.out_of_line_offset(0) is not allowed.
6999            if max_ordinal == 0 {
7000                return Ok(());
7001            }
7002            depth.increment()?;
7003            let envelope_size = 8;
7004            let bytes_len = max_ordinal as usize * envelope_size;
7005            #[allow(unused_variables)]
7006            let offset = encoder.out_of_line_offset(bytes_len);
7007            let mut _prev_end_offset: usize = 0;
7008            if 1 > max_ordinal {
7009                return Ok(());
7010            }
7011
7012            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7013            // are envelope_size bytes.
7014            let cur_offset: usize = (1 - 1) * envelope_size;
7015
7016            // Zero reserved fields.
7017            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7018
7019            // Safety:
7020            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7021            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7022            //   envelope_size bytes, there is always sufficient room.
7023            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7024            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7025            encoder, offset + cur_offset, depth
7026        )?;
7027
7028            _prev_end_offset = cur_offset + envelope_size;
7029
7030            Ok(())
7031        }
7032    }
7033
7034    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7035        for RegistryRegisterKeyboardAndGetDeviceInfoRequest
7036    {
7037        #[inline(always)]
7038        fn new_empty() -> Self {
7039            Self::default()
7040        }
7041
7042        unsafe fn decode(
7043            &mut self,
7044            decoder: &mut fidl::encoding::Decoder<
7045                '_,
7046                fidl::encoding::DefaultFuchsiaResourceDialect,
7047            >,
7048            offset: usize,
7049            mut depth: fidl::encoding::Depth,
7050        ) -> fidl::Result<()> {
7051            decoder.debug_check_bounds::<Self>(offset);
7052            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7053                None => return Err(fidl::Error::NotNullable),
7054                Some(len) => len,
7055            };
7056            // Calling decoder.out_of_line_offset(0) is not allowed.
7057            if len == 0 {
7058                return Ok(());
7059            };
7060            depth.increment()?;
7061            let envelope_size = 8;
7062            let bytes_len = len * envelope_size;
7063            let offset = decoder.out_of_line_offset(bytes_len)?;
7064            // Decode the envelope for each type.
7065            let mut _next_ordinal_to_read = 0;
7066            let mut next_offset = offset;
7067            let end_offset = offset + bytes_len;
7068            _next_ordinal_to_read += 1;
7069            if next_offset >= end_offset {
7070                return Ok(());
7071            }
7072
7073            // Decode unknown envelopes for gaps in ordinals.
7074            while _next_ordinal_to_read < 1 {
7075                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7076                _next_ordinal_to_read += 1;
7077                next_offset += envelope_size;
7078            }
7079
7080            let next_out_of_line = decoder.next_out_of_line();
7081            let handles_before = decoder.remaining_handles();
7082            if let Some((inlined, num_bytes, num_handles)) =
7083                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7084            {
7085                let member_inline_size = <fidl::encoding::Endpoint<
7086                    fidl::endpoints::ServerEnd<KeyboardMarker>,
7087                > as fidl::encoding::TypeMarker>::inline_size(
7088                    decoder.context
7089                );
7090                if inlined != (member_inline_size <= 4) {
7091                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7092                }
7093                let inner_offset;
7094                let mut inner_depth = depth.clone();
7095                if inlined {
7096                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7097                    inner_offset = next_offset;
7098                } else {
7099                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7100                    inner_depth.increment()?;
7101                }
7102                let val_ref = self.device.get_or_insert_with(|| {
7103                    fidl::new_empty!(
7104                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>>,
7105                        fidl::encoding::DefaultFuchsiaResourceDialect
7106                    )
7107                });
7108                fidl::decode!(
7109                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>>,
7110                    fidl::encoding::DefaultFuchsiaResourceDialect,
7111                    val_ref,
7112                    decoder,
7113                    inner_offset,
7114                    inner_depth
7115                )?;
7116                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7117                {
7118                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7119                }
7120                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7121                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7122                }
7123            }
7124
7125            next_offset += envelope_size;
7126
7127            // Decode the remaining unknown envelopes.
7128            while next_offset < end_offset {
7129                _next_ordinal_to_read += 1;
7130                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7131                next_offset += envelope_size;
7132            }
7133
7134            Ok(())
7135        }
7136    }
7137
7138    impl RegistryRegisterKeyboardAndGetDeviceInfoResponse {
7139        #[inline(always)]
7140        fn max_ordinal_present(&self) -> u64 {
7141            if let Some(_) = self.device_id {
7142                return 1;
7143            }
7144            0
7145        }
7146    }
7147
7148    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterKeyboardAndGetDeviceInfoResponse {
7149        type Borrowed<'a> = &'a mut Self;
7150        fn take_or_borrow<'a>(
7151            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7152        ) -> Self::Borrowed<'a> {
7153            value
7154        }
7155    }
7156
7157    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterKeyboardAndGetDeviceInfoResponse {
7158        type Owned = Self;
7159
7160        #[inline(always)]
7161        fn inline_align(_context: fidl::encoding::Context) -> usize {
7162            8
7163        }
7164
7165        #[inline(always)]
7166        fn inline_size(_context: fidl::encoding::Context) -> usize {
7167            16
7168        }
7169    }
7170
7171    unsafe impl
7172        fidl::encoding::Encode<
7173            RegistryRegisterKeyboardAndGetDeviceInfoResponse,
7174            fidl::encoding::DefaultFuchsiaResourceDialect,
7175        > for &mut RegistryRegisterKeyboardAndGetDeviceInfoResponse
7176    {
7177        unsafe fn encode(
7178            self,
7179            encoder: &mut fidl::encoding::Encoder<
7180                '_,
7181                fidl::encoding::DefaultFuchsiaResourceDialect,
7182            >,
7183            offset: usize,
7184            mut depth: fidl::encoding::Depth,
7185        ) -> fidl::Result<()> {
7186            encoder.debug_check_bounds::<RegistryRegisterKeyboardAndGetDeviceInfoResponse>(offset);
7187            // Vector header
7188            let max_ordinal: u64 = self.max_ordinal_present();
7189            encoder.write_num(max_ordinal, offset);
7190            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7191            // Calling encoder.out_of_line_offset(0) is not allowed.
7192            if max_ordinal == 0 {
7193                return Ok(());
7194            }
7195            depth.increment()?;
7196            let envelope_size = 8;
7197            let bytes_len = max_ordinal as usize * envelope_size;
7198            #[allow(unused_variables)]
7199            let offset = encoder.out_of_line_offset(bytes_len);
7200            let mut _prev_end_offset: usize = 0;
7201            if 1 > max_ordinal {
7202                return Ok(());
7203            }
7204
7205            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7206            // are envelope_size bytes.
7207            let cur_offset: usize = (1 - 1) * envelope_size;
7208
7209            // Zero reserved fields.
7210            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7211
7212            // Safety:
7213            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7214            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7215            //   envelope_size bytes, there is always sufficient room.
7216            fidl::encoding::encode_in_envelope_optional::<
7217                u32,
7218                fidl::encoding::DefaultFuchsiaResourceDialect,
7219            >(
7220                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7221                encoder,
7222                offset + cur_offset,
7223                depth,
7224            )?;
7225
7226            _prev_end_offset = cur_offset + envelope_size;
7227
7228            Ok(())
7229        }
7230    }
7231
7232    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7233        for RegistryRegisterKeyboardAndGetDeviceInfoResponse
7234    {
7235        #[inline(always)]
7236        fn new_empty() -> Self {
7237            Self::default()
7238        }
7239
7240        unsafe fn decode(
7241            &mut self,
7242            decoder: &mut fidl::encoding::Decoder<
7243                '_,
7244                fidl::encoding::DefaultFuchsiaResourceDialect,
7245            >,
7246            offset: usize,
7247            mut depth: fidl::encoding::Depth,
7248        ) -> fidl::Result<()> {
7249            decoder.debug_check_bounds::<Self>(offset);
7250            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7251                None => return Err(fidl::Error::NotNullable),
7252                Some(len) => len,
7253            };
7254            // Calling decoder.out_of_line_offset(0) is not allowed.
7255            if len == 0 {
7256                return Ok(());
7257            };
7258            depth.increment()?;
7259            let envelope_size = 8;
7260            let bytes_len = len * envelope_size;
7261            let offset = decoder.out_of_line_offset(bytes_len)?;
7262            // Decode the envelope for each type.
7263            let mut _next_ordinal_to_read = 0;
7264            let mut next_offset = offset;
7265            let end_offset = offset + bytes_len;
7266            _next_ordinal_to_read += 1;
7267            if next_offset >= end_offset {
7268                return Ok(());
7269            }
7270
7271            // Decode unknown envelopes for gaps in ordinals.
7272            while _next_ordinal_to_read < 1 {
7273                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7274                _next_ordinal_to_read += 1;
7275                next_offset += envelope_size;
7276            }
7277
7278            let next_out_of_line = decoder.next_out_of_line();
7279            let handles_before = decoder.remaining_handles();
7280            if let Some((inlined, num_bytes, num_handles)) =
7281                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7282            {
7283                let member_inline_size =
7284                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7285                if inlined != (member_inline_size <= 4) {
7286                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7287                }
7288                let inner_offset;
7289                let mut inner_depth = depth.clone();
7290                if inlined {
7291                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7292                    inner_offset = next_offset;
7293                } else {
7294                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7295                    inner_depth.increment()?;
7296                }
7297                let val_ref = self.device_id.get_or_insert_with(|| {
7298                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
7299                });
7300                fidl::decode!(
7301                    u32,
7302                    fidl::encoding::DefaultFuchsiaResourceDialect,
7303                    val_ref,
7304                    decoder,
7305                    inner_offset,
7306                    inner_depth
7307                )?;
7308                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7309                {
7310                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7311                }
7312                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7313                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7314                }
7315            }
7316
7317            next_offset += envelope_size;
7318
7319            // Decode the remaining unknown envelopes.
7320            while next_offset < end_offset {
7321                _next_ordinal_to_read += 1;
7322                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7323                next_offset += envelope_size;
7324            }
7325
7326            Ok(())
7327        }
7328    }
7329
7330    impl RegistryRegisterKeyboardRequest {
7331        #[inline(always)]
7332        fn max_ordinal_present(&self) -> u64 {
7333            if let Some(_) = self.device {
7334                return 1;
7335            }
7336            0
7337        }
7338    }
7339
7340    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterKeyboardRequest {
7341        type Borrowed<'a> = &'a mut Self;
7342        fn take_or_borrow<'a>(
7343            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7344        ) -> Self::Borrowed<'a> {
7345            value
7346        }
7347    }
7348
7349    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterKeyboardRequest {
7350        type Owned = Self;
7351
7352        #[inline(always)]
7353        fn inline_align(_context: fidl::encoding::Context) -> usize {
7354            8
7355        }
7356
7357        #[inline(always)]
7358        fn inline_size(_context: fidl::encoding::Context) -> usize {
7359            16
7360        }
7361    }
7362
7363    unsafe impl
7364        fidl::encoding::Encode<
7365            RegistryRegisterKeyboardRequest,
7366            fidl::encoding::DefaultFuchsiaResourceDialect,
7367        > for &mut RegistryRegisterKeyboardRequest
7368    {
7369        unsafe fn encode(
7370            self,
7371            encoder: &mut fidl::encoding::Encoder<
7372                '_,
7373                fidl::encoding::DefaultFuchsiaResourceDialect,
7374            >,
7375            offset: usize,
7376            mut depth: fidl::encoding::Depth,
7377        ) -> fidl::Result<()> {
7378            encoder.debug_check_bounds::<RegistryRegisterKeyboardRequest>(offset);
7379            // Vector header
7380            let max_ordinal: u64 = self.max_ordinal_present();
7381            encoder.write_num(max_ordinal, offset);
7382            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7383            // Calling encoder.out_of_line_offset(0) is not allowed.
7384            if max_ordinal == 0 {
7385                return Ok(());
7386            }
7387            depth.increment()?;
7388            let envelope_size = 8;
7389            let bytes_len = max_ordinal as usize * envelope_size;
7390            #[allow(unused_variables)]
7391            let offset = encoder.out_of_line_offset(bytes_len);
7392            let mut _prev_end_offset: usize = 0;
7393            if 1 > max_ordinal {
7394                return Ok(());
7395            }
7396
7397            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7398            // are envelope_size bytes.
7399            let cur_offset: usize = (1 - 1) * envelope_size;
7400
7401            // Zero reserved fields.
7402            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7403
7404            // Safety:
7405            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7406            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7407            //   envelope_size bytes, there is always sufficient room.
7408            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7409            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7410            encoder, offset + cur_offset, depth
7411        )?;
7412
7413            _prev_end_offset = cur_offset + envelope_size;
7414
7415            Ok(())
7416        }
7417    }
7418
7419    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7420        for RegistryRegisterKeyboardRequest
7421    {
7422        #[inline(always)]
7423        fn new_empty() -> Self {
7424            Self::default()
7425        }
7426
7427        unsafe fn decode(
7428            &mut self,
7429            decoder: &mut fidl::encoding::Decoder<
7430                '_,
7431                fidl::encoding::DefaultFuchsiaResourceDialect,
7432            >,
7433            offset: usize,
7434            mut depth: fidl::encoding::Depth,
7435        ) -> fidl::Result<()> {
7436            decoder.debug_check_bounds::<Self>(offset);
7437            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7438                None => return Err(fidl::Error::NotNullable),
7439                Some(len) => len,
7440            };
7441            // Calling decoder.out_of_line_offset(0) is not allowed.
7442            if len == 0 {
7443                return Ok(());
7444            };
7445            depth.increment()?;
7446            let envelope_size = 8;
7447            let bytes_len = len * envelope_size;
7448            let offset = decoder.out_of_line_offset(bytes_len)?;
7449            // Decode the envelope for each type.
7450            let mut _next_ordinal_to_read = 0;
7451            let mut next_offset = offset;
7452            let end_offset = offset + bytes_len;
7453            _next_ordinal_to_read += 1;
7454            if next_offset >= end_offset {
7455                return Ok(());
7456            }
7457
7458            // Decode unknown envelopes for gaps in ordinals.
7459            while _next_ordinal_to_read < 1 {
7460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7461                _next_ordinal_to_read += 1;
7462                next_offset += envelope_size;
7463            }
7464
7465            let next_out_of_line = decoder.next_out_of_line();
7466            let handles_before = decoder.remaining_handles();
7467            if let Some((inlined, num_bytes, num_handles)) =
7468                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7469            {
7470                let member_inline_size = <fidl::encoding::Endpoint<
7471                    fidl::endpoints::ServerEnd<KeyboardMarker>,
7472                > as fidl::encoding::TypeMarker>::inline_size(
7473                    decoder.context
7474                );
7475                if inlined != (member_inline_size <= 4) {
7476                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7477                }
7478                let inner_offset;
7479                let mut inner_depth = depth.clone();
7480                if inlined {
7481                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7482                    inner_offset = next_offset;
7483                } else {
7484                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7485                    inner_depth.increment()?;
7486                }
7487                let val_ref = self.device.get_or_insert_with(|| {
7488                    fidl::new_empty!(
7489                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>>,
7490                        fidl::encoding::DefaultFuchsiaResourceDialect
7491                    )
7492                });
7493                fidl::decode!(
7494                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<KeyboardMarker>>,
7495                    fidl::encoding::DefaultFuchsiaResourceDialect,
7496                    val_ref,
7497                    decoder,
7498                    inner_offset,
7499                    inner_depth
7500                )?;
7501                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7502                {
7503                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7504                }
7505                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7506                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7507                }
7508            }
7509
7510            next_offset += envelope_size;
7511
7512            // Decode the remaining unknown envelopes.
7513            while next_offset < end_offset {
7514                _next_ordinal_to_read += 1;
7515                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7516                next_offset += envelope_size;
7517            }
7518
7519            Ok(())
7520        }
7521    }
7522
7523    impl RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest {
7524        #[inline(always)]
7525        fn max_ordinal_present(&self) -> u64 {
7526            if let Some(_) = self.device {
7527                return 1;
7528            }
7529            0
7530        }
7531    }
7532
7533    impl fidl::encoding::ResourceTypeMarker
7534        for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest
7535    {
7536        type Borrowed<'a> = &'a mut Self;
7537        fn take_or_borrow<'a>(
7538            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7539        ) -> Self::Borrowed<'a> {
7540            value
7541        }
7542    }
7543
7544    unsafe impl fidl::encoding::TypeMarker
7545        for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest
7546    {
7547        type Owned = Self;
7548
7549        #[inline(always)]
7550        fn inline_align(_context: fidl::encoding::Context) -> usize {
7551            8
7552        }
7553
7554        #[inline(always)]
7555        fn inline_size(_context: fidl::encoding::Context) -> usize {
7556            16
7557        }
7558    }
7559
7560    unsafe impl
7561        fidl::encoding::Encode<
7562            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest,
7563            fidl::encoding::DefaultFuchsiaResourceDialect,
7564        > for &mut RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest
7565    {
7566        unsafe fn encode(
7567            self,
7568            encoder: &mut fidl::encoding::Encoder<
7569                '_,
7570                fidl::encoding::DefaultFuchsiaResourceDialect,
7571            >,
7572            offset: usize,
7573            mut depth: fidl::encoding::Depth,
7574        ) -> fidl::Result<()> {
7575            encoder
7576                .debug_check_bounds::<RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest>(
7577                    offset,
7578                );
7579            // Vector header
7580            let max_ordinal: u64 = self.max_ordinal_present();
7581            encoder.write_num(max_ordinal, offset);
7582            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7583            // Calling encoder.out_of_line_offset(0) is not allowed.
7584            if max_ordinal == 0 {
7585                return Ok(());
7586            }
7587            depth.increment()?;
7588            let envelope_size = 8;
7589            let bytes_len = max_ordinal as usize * envelope_size;
7590            #[allow(unused_variables)]
7591            let offset = encoder.out_of_line_offset(bytes_len);
7592            let mut _prev_end_offset: usize = 0;
7593            if 1 > max_ordinal {
7594                return Ok(());
7595            }
7596
7597            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7598            // are envelope_size bytes.
7599            let cur_offset: usize = (1 - 1) * envelope_size;
7600
7601            // Zero reserved fields.
7602            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7603
7604            // Safety:
7605            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7606            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7607            //   envelope_size bytes, there is always sufficient room.
7608            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
7609            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
7610            encoder, offset + cur_offset, depth
7611        )?;
7612
7613            _prev_end_offset = cur_offset + envelope_size;
7614
7615            Ok(())
7616        }
7617    }
7618
7619    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7620        for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoRequest
7621    {
7622        #[inline(always)]
7623        fn new_empty() -> Self {
7624            Self::default()
7625        }
7626
7627        unsafe fn decode(
7628            &mut self,
7629            decoder: &mut fidl::encoding::Decoder<
7630                '_,
7631                fidl::encoding::DefaultFuchsiaResourceDialect,
7632            >,
7633            offset: usize,
7634            mut depth: fidl::encoding::Depth,
7635        ) -> fidl::Result<()> {
7636            decoder.debug_check_bounds::<Self>(offset);
7637            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7638                None => return Err(fidl::Error::NotNullable),
7639                Some(len) => len,
7640            };
7641            // Calling decoder.out_of_line_offset(0) is not allowed.
7642            if len == 0 {
7643                return Ok(());
7644            };
7645            depth.increment()?;
7646            let envelope_size = 8;
7647            let bytes_len = len * envelope_size;
7648            let offset = decoder.out_of_line_offset(bytes_len)?;
7649            // Decode the envelope for each type.
7650            let mut _next_ordinal_to_read = 0;
7651            let mut next_offset = offset;
7652            let end_offset = offset + bytes_len;
7653            _next_ordinal_to_read += 1;
7654            if next_offset >= end_offset {
7655                return Ok(());
7656            }
7657
7658            // Decode unknown envelopes for gaps in ordinals.
7659            while _next_ordinal_to_read < 1 {
7660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7661                _next_ordinal_to_read += 1;
7662                next_offset += envelope_size;
7663            }
7664
7665            let next_out_of_line = decoder.next_out_of_line();
7666            let handles_before = decoder.remaining_handles();
7667            if let Some((inlined, num_bytes, num_handles)) =
7668                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7669            {
7670                let member_inline_size = <fidl::encoding::Endpoint<
7671                    fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>,
7672                > as fidl::encoding::TypeMarker>::inline_size(
7673                    decoder.context
7674                );
7675                if inlined != (member_inline_size <= 4) {
7676                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7677                }
7678                let inner_offset;
7679                let mut inner_depth = depth.clone();
7680                if inlined {
7681                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7682                    inner_offset = next_offset;
7683                } else {
7684                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7685                    inner_depth.increment()?;
7686                }
7687                let val_ref = self.device.get_or_insert_with(|| {
7688                    fidl::new_empty!(
7689                        fidl::encoding::Endpoint<
7690                            fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>,
7691                        >,
7692                        fidl::encoding::DefaultFuchsiaResourceDialect
7693                    )
7694                });
7695                fidl::decode!(
7696                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>>,
7697                    fidl::encoding::DefaultFuchsiaResourceDialect,
7698                    val_ref,
7699                    decoder,
7700                    inner_offset,
7701                    inner_depth
7702                )?;
7703                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7704                {
7705                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7706                }
7707                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7708                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7709                }
7710            }
7711
7712            next_offset += envelope_size;
7713
7714            // Decode the remaining unknown envelopes.
7715            while next_offset < end_offset {
7716                _next_ordinal_to_read += 1;
7717                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7718                next_offset += envelope_size;
7719            }
7720
7721            Ok(())
7722        }
7723    }
7724
7725    impl RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse {
7726        #[inline(always)]
7727        fn max_ordinal_present(&self) -> u64 {
7728            if let Some(_) = self.device_id {
7729                return 1;
7730            }
7731            0
7732        }
7733    }
7734
7735    impl fidl::encoding::ResourceTypeMarker
7736        for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse
7737    {
7738        type Borrowed<'a> = &'a mut Self;
7739        fn take_or_borrow<'a>(
7740            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7741        ) -> Self::Borrowed<'a> {
7742            value
7743        }
7744    }
7745
7746    unsafe impl fidl::encoding::TypeMarker
7747        for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse
7748    {
7749        type Owned = Self;
7750
7751        #[inline(always)]
7752        fn inline_align(_context: fidl::encoding::Context) -> usize {
7753            8
7754        }
7755
7756        #[inline(always)]
7757        fn inline_size(_context: fidl::encoding::Context) -> usize {
7758            16
7759        }
7760    }
7761
7762    unsafe impl
7763        fidl::encoding::Encode<
7764            RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse,
7765            fidl::encoding::DefaultFuchsiaResourceDialect,
7766        > for &mut RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse
7767    {
7768        unsafe fn encode(
7769            self,
7770            encoder: &mut fidl::encoding::Encoder<
7771                '_,
7772                fidl::encoding::DefaultFuchsiaResourceDialect,
7773            >,
7774            offset: usize,
7775            mut depth: fidl::encoding::Depth,
7776        ) -> fidl::Result<()> {
7777            encoder
7778                .debug_check_bounds::<RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse>(
7779                    offset,
7780                );
7781            // Vector header
7782            let max_ordinal: u64 = self.max_ordinal_present();
7783            encoder.write_num(max_ordinal, offset);
7784            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7785            // Calling encoder.out_of_line_offset(0) is not allowed.
7786            if max_ordinal == 0 {
7787                return Ok(());
7788            }
7789            depth.increment()?;
7790            let envelope_size = 8;
7791            let bytes_len = max_ordinal as usize * envelope_size;
7792            #[allow(unused_variables)]
7793            let offset = encoder.out_of_line_offset(bytes_len);
7794            let mut _prev_end_offset: usize = 0;
7795            if 1 > max_ordinal {
7796                return Ok(());
7797            }
7798
7799            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7800            // are envelope_size bytes.
7801            let cur_offset: usize = (1 - 1) * envelope_size;
7802
7803            // Zero reserved fields.
7804            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7805
7806            // Safety:
7807            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
7808            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
7809            //   envelope_size bytes, there is always sufficient room.
7810            fidl::encoding::encode_in_envelope_optional::<
7811                u32,
7812                fidl::encoding::DefaultFuchsiaResourceDialect,
7813            >(
7814                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
7815                encoder,
7816                offset + cur_offset,
7817                depth,
7818            )?;
7819
7820            _prev_end_offset = cur_offset + envelope_size;
7821
7822            Ok(())
7823        }
7824    }
7825
7826    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7827        for RegistryRegisterMediaButtonsDeviceAndGetDeviceInfoResponse
7828    {
7829        #[inline(always)]
7830        fn new_empty() -> Self {
7831            Self::default()
7832        }
7833
7834        unsafe fn decode(
7835            &mut self,
7836            decoder: &mut fidl::encoding::Decoder<
7837                '_,
7838                fidl::encoding::DefaultFuchsiaResourceDialect,
7839            >,
7840            offset: usize,
7841            mut depth: fidl::encoding::Depth,
7842        ) -> fidl::Result<()> {
7843            decoder.debug_check_bounds::<Self>(offset);
7844            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
7845                None => return Err(fidl::Error::NotNullable),
7846                Some(len) => len,
7847            };
7848            // Calling decoder.out_of_line_offset(0) is not allowed.
7849            if len == 0 {
7850                return Ok(());
7851            };
7852            depth.increment()?;
7853            let envelope_size = 8;
7854            let bytes_len = len * envelope_size;
7855            let offset = decoder.out_of_line_offset(bytes_len)?;
7856            // Decode the envelope for each type.
7857            let mut _next_ordinal_to_read = 0;
7858            let mut next_offset = offset;
7859            let end_offset = offset + bytes_len;
7860            _next_ordinal_to_read += 1;
7861            if next_offset >= end_offset {
7862                return Ok(());
7863            }
7864
7865            // Decode unknown envelopes for gaps in ordinals.
7866            while _next_ordinal_to_read < 1 {
7867                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7868                _next_ordinal_to_read += 1;
7869                next_offset += envelope_size;
7870            }
7871
7872            let next_out_of_line = decoder.next_out_of_line();
7873            let handles_before = decoder.remaining_handles();
7874            if let Some((inlined, num_bytes, num_handles)) =
7875                fidl::encoding::decode_envelope_header(decoder, next_offset)?
7876            {
7877                let member_inline_size =
7878                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
7879                if inlined != (member_inline_size <= 4) {
7880                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
7881                }
7882                let inner_offset;
7883                let mut inner_depth = depth.clone();
7884                if inlined {
7885                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
7886                    inner_offset = next_offset;
7887                } else {
7888                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7889                    inner_depth.increment()?;
7890                }
7891                let val_ref = self.device_id.get_or_insert_with(|| {
7892                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
7893                });
7894                fidl::decode!(
7895                    u32,
7896                    fidl::encoding::DefaultFuchsiaResourceDialect,
7897                    val_ref,
7898                    decoder,
7899                    inner_offset,
7900                    inner_depth
7901                )?;
7902                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
7903                {
7904                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
7905                }
7906                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7907                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7908                }
7909            }
7910
7911            next_offset += envelope_size;
7912
7913            // Decode the remaining unknown envelopes.
7914            while next_offset < end_offset {
7915                _next_ordinal_to_read += 1;
7916                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
7917                next_offset += envelope_size;
7918            }
7919
7920            Ok(())
7921        }
7922    }
7923
7924    impl RegistryRegisterMediaButtonsDeviceRequest {
7925        #[inline(always)]
7926        fn max_ordinal_present(&self) -> u64 {
7927            if let Some(_) = self.device {
7928                return 1;
7929            }
7930            0
7931        }
7932    }
7933
7934    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterMediaButtonsDeviceRequest {
7935        type Borrowed<'a> = &'a mut Self;
7936        fn take_or_borrow<'a>(
7937            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7938        ) -> Self::Borrowed<'a> {
7939            value
7940        }
7941    }
7942
7943    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterMediaButtonsDeviceRequest {
7944        type Owned = Self;
7945
7946        #[inline(always)]
7947        fn inline_align(_context: fidl::encoding::Context) -> usize {
7948            8
7949        }
7950
7951        #[inline(always)]
7952        fn inline_size(_context: fidl::encoding::Context) -> usize {
7953            16
7954        }
7955    }
7956
7957    unsafe impl
7958        fidl::encoding::Encode<
7959            RegistryRegisterMediaButtonsDeviceRequest,
7960            fidl::encoding::DefaultFuchsiaResourceDialect,
7961        > for &mut RegistryRegisterMediaButtonsDeviceRequest
7962    {
7963        unsafe fn encode(
7964            self,
7965            encoder: &mut fidl::encoding::Encoder<
7966                '_,
7967                fidl::encoding::DefaultFuchsiaResourceDialect,
7968            >,
7969            offset: usize,
7970            mut depth: fidl::encoding::Depth,
7971        ) -> fidl::Result<()> {
7972            encoder.debug_check_bounds::<RegistryRegisterMediaButtonsDeviceRequest>(offset);
7973            // Vector header
7974            let max_ordinal: u64 = self.max_ordinal_present();
7975            encoder.write_num(max_ordinal, offset);
7976            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
7977            // Calling encoder.out_of_line_offset(0) is not allowed.
7978            if max_ordinal == 0 {
7979                return Ok(());
7980            }
7981            depth.increment()?;
7982            let envelope_size = 8;
7983            let bytes_len = max_ordinal as usize * envelope_size;
7984            #[allow(unused_variables)]
7985            let offset = encoder.out_of_line_offset(bytes_len);
7986            let mut _prev_end_offset: usize = 0;
7987            if 1 > max_ordinal {
7988                return Ok(());
7989            }
7990
7991            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
7992            // are envelope_size bytes.
7993            let cur_offset: usize = (1 - 1) * envelope_size;
7994
7995            // Zero reserved fields.
7996            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
7997
7998            // Safety:
7999            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8000            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8001            //   envelope_size bytes, there is always sufficient room.
8002            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8003            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8004            encoder, offset + cur_offset, depth
8005        )?;
8006
8007            _prev_end_offset = cur_offset + envelope_size;
8008
8009            Ok(())
8010        }
8011    }
8012
8013    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8014        for RegistryRegisterMediaButtonsDeviceRequest
8015    {
8016        #[inline(always)]
8017        fn new_empty() -> Self {
8018            Self::default()
8019        }
8020
8021        unsafe fn decode(
8022            &mut self,
8023            decoder: &mut fidl::encoding::Decoder<
8024                '_,
8025                fidl::encoding::DefaultFuchsiaResourceDialect,
8026            >,
8027            offset: usize,
8028            mut depth: fidl::encoding::Depth,
8029        ) -> fidl::Result<()> {
8030            decoder.debug_check_bounds::<Self>(offset);
8031            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8032                None => return Err(fidl::Error::NotNullable),
8033                Some(len) => len,
8034            };
8035            // Calling decoder.out_of_line_offset(0) is not allowed.
8036            if len == 0 {
8037                return Ok(());
8038            };
8039            depth.increment()?;
8040            let envelope_size = 8;
8041            let bytes_len = len * envelope_size;
8042            let offset = decoder.out_of_line_offset(bytes_len)?;
8043            // Decode the envelope for each type.
8044            let mut _next_ordinal_to_read = 0;
8045            let mut next_offset = offset;
8046            let end_offset = offset + bytes_len;
8047            _next_ordinal_to_read += 1;
8048            if next_offset >= end_offset {
8049                return Ok(());
8050            }
8051
8052            // Decode unknown envelopes for gaps in ordinals.
8053            while _next_ordinal_to_read < 1 {
8054                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8055                _next_ordinal_to_read += 1;
8056                next_offset += envelope_size;
8057            }
8058
8059            let next_out_of_line = decoder.next_out_of_line();
8060            let handles_before = decoder.remaining_handles();
8061            if let Some((inlined, num_bytes, num_handles)) =
8062                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8063            {
8064                let member_inline_size = <fidl::encoding::Endpoint<
8065                    fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>,
8066                > as fidl::encoding::TypeMarker>::inline_size(
8067                    decoder.context
8068                );
8069                if inlined != (member_inline_size <= 4) {
8070                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8071                }
8072                let inner_offset;
8073                let mut inner_depth = depth.clone();
8074                if inlined {
8075                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8076                    inner_offset = next_offset;
8077                } else {
8078                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8079                    inner_depth.increment()?;
8080                }
8081                let val_ref = self.device.get_or_insert_with(|| {
8082                    fidl::new_empty!(
8083                        fidl::encoding::Endpoint<
8084                            fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>,
8085                        >,
8086                        fidl::encoding::DefaultFuchsiaResourceDialect
8087                    )
8088                });
8089                fidl::decode!(
8090                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MediaButtonsDeviceMarker>>,
8091                    fidl::encoding::DefaultFuchsiaResourceDialect,
8092                    val_ref,
8093                    decoder,
8094                    inner_offset,
8095                    inner_depth
8096                )?;
8097                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8098                {
8099                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8100                }
8101                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8102                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8103                }
8104            }
8105
8106            next_offset += envelope_size;
8107
8108            // Decode the remaining unknown envelopes.
8109            while next_offset < end_offset {
8110                _next_ordinal_to_read += 1;
8111                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8112                next_offset += envelope_size;
8113            }
8114
8115            Ok(())
8116        }
8117    }
8118
8119    impl RegistryRegisterMouseAndGetDeviceInfoRequest {
8120        #[inline(always)]
8121        fn max_ordinal_present(&self) -> u64 {
8122            if let Some(_) = self.device {
8123                return 1;
8124            }
8125            0
8126        }
8127    }
8128
8129    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterMouseAndGetDeviceInfoRequest {
8130        type Borrowed<'a> = &'a mut Self;
8131        fn take_or_borrow<'a>(
8132            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8133        ) -> Self::Borrowed<'a> {
8134            value
8135        }
8136    }
8137
8138    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterMouseAndGetDeviceInfoRequest {
8139        type Owned = Self;
8140
8141        #[inline(always)]
8142        fn inline_align(_context: fidl::encoding::Context) -> usize {
8143            8
8144        }
8145
8146        #[inline(always)]
8147        fn inline_size(_context: fidl::encoding::Context) -> usize {
8148            16
8149        }
8150    }
8151
8152    unsafe impl
8153        fidl::encoding::Encode<
8154            RegistryRegisterMouseAndGetDeviceInfoRequest,
8155            fidl::encoding::DefaultFuchsiaResourceDialect,
8156        > for &mut RegistryRegisterMouseAndGetDeviceInfoRequest
8157    {
8158        unsafe fn encode(
8159            self,
8160            encoder: &mut fidl::encoding::Encoder<
8161                '_,
8162                fidl::encoding::DefaultFuchsiaResourceDialect,
8163            >,
8164            offset: usize,
8165            mut depth: fidl::encoding::Depth,
8166        ) -> fidl::Result<()> {
8167            encoder.debug_check_bounds::<RegistryRegisterMouseAndGetDeviceInfoRequest>(offset);
8168            // Vector header
8169            let max_ordinal: u64 = self.max_ordinal_present();
8170            encoder.write_num(max_ordinal, offset);
8171            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8172            // Calling encoder.out_of_line_offset(0) is not allowed.
8173            if max_ordinal == 0 {
8174                return Ok(());
8175            }
8176            depth.increment()?;
8177            let envelope_size = 8;
8178            let bytes_len = max_ordinal as usize * envelope_size;
8179            #[allow(unused_variables)]
8180            let offset = encoder.out_of_line_offset(bytes_len);
8181            let mut _prev_end_offset: usize = 0;
8182            if 1 > max_ordinal {
8183                return Ok(());
8184            }
8185
8186            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8187            // are envelope_size bytes.
8188            let cur_offset: usize = (1 - 1) * envelope_size;
8189
8190            // Zero reserved fields.
8191            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8192
8193            // Safety:
8194            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8195            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8196            //   envelope_size bytes, there is always sufficient room.
8197            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8198            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8199            encoder, offset + cur_offset, depth
8200        )?;
8201
8202            _prev_end_offset = cur_offset + envelope_size;
8203
8204            Ok(())
8205        }
8206    }
8207
8208    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8209        for RegistryRegisterMouseAndGetDeviceInfoRequest
8210    {
8211        #[inline(always)]
8212        fn new_empty() -> Self {
8213            Self::default()
8214        }
8215
8216        unsafe fn decode(
8217            &mut self,
8218            decoder: &mut fidl::encoding::Decoder<
8219                '_,
8220                fidl::encoding::DefaultFuchsiaResourceDialect,
8221            >,
8222            offset: usize,
8223            mut depth: fidl::encoding::Depth,
8224        ) -> fidl::Result<()> {
8225            decoder.debug_check_bounds::<Self>(offset);
8226            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8227                None => return Err(fidl::Error::NotNullable),
8228                Some(len) => len,
8229            };
8230            // Calling decoder.out_of_line_offset(0) is not allowed.
8231            if len == 0 {
8232                return Ok(());
8233            };
8234            depth.increment()?;
8235            let envelope_size = 8;
8236            let bytes_len = len * envelope_size;
8237            let offset = decoder.out_of_line_offset(bytes_len)?;
8238            // Decode the envelope for each type.
8239            let mut _next_ordinal_to_read = 0;
8240            let mut next_offset = offset;
8241            let end_offset = offset + bytes_len;
8242            _next_ordinal_to_read += 1;
8243            if next_offset >= end_offset {
8244                return Ok(());
8245            }
8246
8247            // Decode unknown envelopes for gaps in ordinals.
8248            while _next_ordinal_to_read < 1 {
8249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8250                _next_ordinal_to_read += 1;
8251                next_offset += envelope_size;
8252            }
8253
8254            let next_out_of_line = decoder.next_out_of_line();
8255            let handles_before = decoder.remaining_handles();
8256            if let Some((inlined, num_bytes, num_handles)) =
8257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8258            {
8259                let member_inline_size = <fidl::encoding::Endpoint<
8260                    fidl::endpoints::ServerEnd<MouseMarker>,
8261                > as fidl::encoding::TypeMarker>::inline_size(
8262                    decoder.context
8263                );
8264                if inlined != (member_inline_size <= 4) {
8265                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8266                }
8267                let inner_offset;
8268                let mut inner_depth = depth.clone();
8269                if inlined {
8270                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8271                    inner_offset = next_offset;
8272                } else {
8273                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8274                    inner_depth.increment()?;
8275                }
8276                let val_ref = self.device.get_or_insert_with(|| {
8277                    fidl::new_empty!(
8278                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>>,
8279                        fidl::encoding::DefaultFuchsiaResourceDialect
8280                    )
8281                });
8282                fidl::decode!(
8283                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>>,
8284                    fidl::encoding::DefaultFuchsiaResourceDialect,
8285                    val_ref,
8286                    decoder,
8287                    inner_offset,
8288                    inner_depth
8289                )?;
8290                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8291                {
8292                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8293                }
8294                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8295                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8296                }
8297            }
8298
8299            next_offset += envelope_size;
8300
8301            // Decode the remaining unknown envelopes.
8302            while next_offset < end_offset {
8303                _next_ordinal_to_read += 1;
8304                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8305                next_offset += envelope_size;
8306            }
8307
8308            Ok(())
8309        }
8310    }
8311
8312    impl RegistryRegisterMouseAndGetDeviceInfoResponse {
8313        #[inline(always)]
8314        fn max_ordinal_present(&self) -> u64 {
8315            if let Some(_) = self.device_id {
8316                return 1;
8317            }
8318            0
8319        }
8320    }
8321
8322    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterMouseAndGetDeviceInfoResponse {
8323        type Borrowed<'a> = &'a mut Self;
8324        fn take_or_borrow<'a>(
8325            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8326        ) -> Self::Borrowed<'a> {
8327            value
8328        }
8329    }
8330
8331    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterMouseAndGetDeviceInfoResponse {
8332        type Owned = Self;
8333
8334        #[inline(always)]
8335        fn inline_align(_context: fidl::encoding::Context) -> usize {
8336            8
8337        }
8338
8339        #[inline(always)]
8340        fn inline_size(_context: fidl::encoding::Context) -> usize {
8341            16
8342        }
8343    }
8344
8345    unsafe impl
8346        fidl::encoding::Encode<
8347            RegistryRegisterMouseAndGetDeviceInfoResponse,
8348            fidl::encoding::DefaultFuchsiaResourceDialect,
8349        > for &mut RegistryRegisterMouseAndGetDeviceInfoResponse
8350    {
8351        unsafe fn encode(
8352            self,
8353            encoder: &mut fidl::encoding::Encoder<
8354                '_,
8355                fidl::encoding::DefaultFuchsiaResourceDialect,
8356            >,
8357            offset: usize,
8358            mut depth: fidl::encoding::Depth,
8359        ) -> fidl::Result<()> {
8360            encoder.debug_check_bounds::<RegistryRegisterMouseAndGetDeviceInfoResponse>(offset);
8361            // Vector header
8362            let max_ordinal: u64 = self.max_ordinal_present();
8363            encoder.write_num(max_ordinal, offset);
8364            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8365            // Calling encoder.out_of_line_offset(0) is not allowed.
8366            if max_ordinal == 0 {
8367                return Ok(());
8368            }
8369            depth.increment()?;
8370            let envelope_size = 8;
8371            let bytes_len = max_ordinal as usize * envelope_size;
8372            #[allow(unused_variables)]
8373            let offset = encoder.out_of_line_offset(bytes_len);
8374            let mut _prev_end_offset: usize = 0;
8375            if 1 > max_ordinal {
8376                return Ok(());
8377            }
8378
8379            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8380            // are envelope_size bytes.
8381            let cur_offset: usize = (1 - 1) * envelope_size;
8382
8383            // Zero reserved fields.
8384            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8385
8386            // Safety:
8387            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8388            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8389            //   envelope_size bytes, there is always sufficient room.
8390            fidl::encoding::encode_in_envelope_optional::<
8391                u32,
8392                fidl::encoding::DefaultFuchsiaResourceDialect,
8393            >(
8394                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
8395                encoder,
8396                offset + cur_offset,
8397                depth,
8398            )?;
8399
8400            _prev_end_offset = cur_offset + envelope_size;
8401
8402            Ok(())
8403        }
8404    }
8405
8406    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8407        for RegistryRegisterMouseAndGetDeviceInfoResponse
8408    {
8409        #[inline(always)]
8410        fn new_empty() -> Self {
8411            Self::default()
8412        }
8413
8414        unsafe fn decode(
8415            &mut self,
8416            decoder: &mut fidl::encoding::Decoder<
8417                '_,
8418                fidl::encoding::DefaultFuchsiaResourceDialect,
8419            >,
8420            offset: usize,
8421            mut depth: fidl::encoding::Depth,
8422        ) -> fidl::Result<()> {
8423            decoder.debug_check_bounds::<Self>(offset);
8424            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8425                None => return Err(fidl::Error::NotNullable),
8426                Some(len) => len,
8427            };
8428            // Calling decoder.out_of_line_offset(0) is not allowed.
8429            if len == 0 {
8430                return Ok(());
8431            };
8432            depth.increment()?;
8433            let envelope_size = 8;
8434            let bytes_len = len * envelope_size;
8435            let offset = decoder.out_of_line_offset(bytes_len)?;
8436            // Decode the envelope for each type.
8437            let mut _next_ordinal_to_read = 0;
8438            let mut next_offset = offset;
8439            let end_offset = offset + bytes_len;
8440            _next_ordinal_to_read += 1;
8441            if next_offset >= end_offset {
8442                return Ok(());
8443            }
8444
8445            // Decode unknown envelopes for gaps in ordinals.
8446            while _next_ordinal_to_read < 1 {
8447                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8448                _next_ordinal_to_read += 1;
8449                next_offset += envelope_size;
8450            }
8451
8452            let next_out_of_line = decoder.next_out_of_line();
8453            let handles_before = decoder.remaining_handles();
8454            if let Some((inlined, num_bytes, num_handles)) =
8455                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8456            {
8457                let member_inline_size =
8458                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8459                if inlined != (member_inline_size <= 4) {
8460                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8461                }
8462                let inner_offset;
8463                let mut inner_depth = depth.clone();
8464                if inlined {
8465                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8466                    inner_offset = next_offset;
8467                } else {
8468                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8469                    inner_depth.increment()?;
8470                }
8471                let val_ref = self.device_id.get_or_insert_with(|| {
8472                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
8473                });
8474                fidl::decode!(
8475                    u32,
8476                    fidl::encoding::DefaultFuchsiaResourceDialect,
8477                    val_ref,
8478                    decoder,
8479                    inner_offset,
8480                    inner_depth
8481                )?;
8482                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8483                {
8484                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8485                }
8486                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8487                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8488                }
8489            }
8490
8491            next_offset += envelope_size;
8492
8493            // Decode the remaining unknown envelopes.
8494            while next_offset < end_offset {
8495                _next_ordinal_to_read += 1;
8496                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8497                next_offset += envelope_size;
8498            }
8499
8500            Ok(())
8501        }
8502    }
8503
8504    impl RegistryRegisterMouseRequest {
8505        #[inline(always)]
8506        fn max_ordinal_present(&self) -> u64 {
8507            if let Some(_) = self.device {
8508                return 1;
8509            }
8510            0
8511        }
8512    }
8513
8514    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterMouseRequest {
8515        type Borrowed<'a> = &'a mut Self;
8516        fn take_or_borrow<'a>(
8517            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8518        ) -> Self::Borrowed<'a> {
8519            value
8520        }
8521    }
8522
8523    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterMouseRequest {
8524        type Owned = Self;
8525
8526        #[inline(always)]
8527        fn inline_align(_context: fidl::encoding::Context) -> usize {
8528            8
8529        }
8530
8531        #[inline(always)]
8532        fn inline_size(_context: fidl::encoding::Context) -> usize {
8533            16
8534        }
8535    }
8536
8537    unsafe impl
8538        fidl::encoding::Encode<
8539            RegistryRegisterMouseRequest,
8540            fidl::encoding::DefaultFuchsiaResourceDialect,
8541        > for &mut RegistryRegisterMouseRequest
8542    {
8543        unsafe fn encode(
8544            self,
8545            encoder: &mut fidl::encoding::Encoder<
8546                '_,
8547                fidl::encoding::DefaultFuchsiaResourceDialect,
8548            >,
8549            offset: usize,
8550            mut depth: fidl::encoding::Depth,
8551        ) -> fidl::Result<()> {
8552            encoder.debug_check_bounds::<RegistryRegisterMouseRequest>(offset);
8553            // Vector header
8554            let max_ordinal: u64 = self.max_ordinal_present();
8555            encoder.write_num(max_ordinal, offset);
8556            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8557            // Calling encoder.out_of_line_offset(0) is not allowed.
8558            if max_ordinal == 0 {
8559                return Ok(());
8560            }
8561            depth.increment()?;
8562            let envelope_size = 8;
8563            let bytes_len = max_ordinal as usize * envelope_size;
8564            #[allow(unused_variables)]
8565            let offset = encoder.out_of_line_offset(bytes_len);
8566            let mut _prev_end_offset: usize = 0;
8567            if 1 > max_ordinal {
8568                return Ok(());
8569            }
8570
8571            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8572            // are envelope_size bytes.
8573            let cur_offset: usize = (1 - 1) * envelope_size;
8574
8575            // Zero reserved fields.
8576            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8577
8578            // Safety:
8579            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8580            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8581            //   envelope_size bytes, there is always sufficient room.
8582            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8583            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8584            encoder, offset + cur_offset, depth
8585        )?;
8586
8587            _prev_end_offset = cur_offset + envelope_size;
8588
8589            Ok(())
8590        }
8591    }
8592
8593    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8594        for RegistryRegisterMouseRequest
8595    {
8596        #[inline(always)]
8597        fn new_empty() -> Self {
8598            Self::default()
8599        }
8600
8601        unsafe fn decode(
8602            &mut self,
8603            decoder: &mut fidl::encoding::Decoder<
8604                '_,
8605                fidl::encoding::DefaultFuchsiaResourceDialect,
8606            >,
8607            offset: usize,
8608            mut depth: fidl::encoding::Depth,
8609        ) -> fidl::Result<()> {
8610            decoder.debug_check_bounds::<Self>(offset);
8611            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8612                None => return Err(fidl::Error::NotNullable),
8613                Some(len) => len,
8614            };
8615            // Calling decoder.out_of_line_offset(0) is not allowed.
8616            if len == 0 {
8617                return Ok(());
8618            };
8619            depth.increment()?;
8620            let envelope_size = 8;
8621            let bytes_len = len * envelope_size;
8622            let offset = decoder.out_of_line_offset(bytes_len)?;
8623            // Decode the envelope for each type.
8624            let mut _next_ordinal_to_read = 0;
8625            let mut next_offset = offset;
8626            let end_offset = offset + bytes_len;
8627            _next_ordinal_to_read += 1;
8628            if next_offset >= end_offset {
8629                return Ok(());
8630            }
8631
8632            // Decode unknown envelopes for gaps in ordinals.
8633            while _next_ordinal_to_read < 1 {
8634                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8635                _next_ordinal_to_read += 1;
8636                next_offset += envelope_size;
8637            }
8638
8639            let next_out_of_line = decoder.next_out_of_line();
8640            let handles_before = decoder.remaining_handles();
8641            if let Some((inlined, num_bytes, num_handles)) =
8642                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8643            {
8644                let member_inline_size = <fidl::encoding::Endpoint<
8645                    fidl::endpoints::ServerEnd<MouseMarker>,
8646                > as fidl::encoding::TypeMarker>::inline_size(
8647                    decoder.context
8648                );
8649                if inlined != (member_inline_size <= 4) {
8650                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8651                }
8652                let inner_offset;
8653                let mut inner_depth = depth.clone();
8654                if inlined {
8655                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8656                    inner_offset = next_offset;
8657                } else {
8658                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8659                    inner_depth.increment()?;
8660                }
8661                let val_ref = self.device.get_or_insert_with(|| {
8662                    fidl::new_empty!(
8663                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>>,
8664                        fidl::encoding::DefaultFuchsiaResourceDialect
8665                    )
8666                });
8667                fidl::decode!(
8668                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MouseMarker>>,
8669                    fidl::encoding::DefaultFuchsiaResourceDialect,
8670                    val_ref,
8671                    decoder,
8672                    inner_offset,
8673                    inner_depth
8674                )?;
8675                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8676                {
8677                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8678                }
8679                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8680                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8681                }
8682            }
8683
8684            next_offset += envelope_size;
8685
8686            // Decode the remaining unknown envelopes.
8687            while next_offset < end_offset {
8688                _next_ordinal_to_read += 1;
8689                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8690                next_offset += envelope_size;
8691            }
8692
8693            Ok(())
8694        }
8695    }
8696
8697    impl RegistryRegisterTouchScreenAndGetDeviceInfoRequest {
8698        #[inline(always)]
8699        fn max_ordinal_present(&self) -> u64 {
8700            if let Some(_) = self.display_dimensions {
8701                return 3;
8702            }
8703            if let Some(_) = self.coordinate_unit {
8704                return 2;
8705            }
8706            if let Some(_) = self.device {
8707                return 1;
8708            }
8709            0
8710        }
8711    }
8712
8713    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterTouchScreenAndGetDeviceInfoRequest {
8714        type Borrowed<'a> = &'a mut Self;
8715        fn take_or_borrow<'a>(
8716            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8717        ) -> Self::Borrowed<'a> {
8718            value
8719        }
8720    }
8721
8722    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterTouchScreenAndGetDeviceInfoRequest {
8723        type Owned = Self;
8724
8725        #[inline(always)]
8726        fn inline_align(_context: fidl::encoding::Context) -> usize {
8727            8
8728        }
8729
8730        #[inline(always)]
8731        fn inline_size(_context: fidl::encoding::Context) -> usize {
8732            16
8733        }
8734    }
8735
8736    unsafe impl
8737        fidl::encoding::Encode<
8738            RegistryRegisterTouchScreenAndGetDeviceInfoRequest,
8739            fidl::encoding::DefaultFuchsiaResourceDialect,
8740        > for &mut RegistryRegisterTouchScreenAndGetDeviceInfoRequest
8741    {
8742        unsafe fn encode(
8743            self,
8744            encoder: &mut fidl::encoding::Encoder<
8745                '_,
8746                fidl::encoding::DefaultFuchsiaResourceDialect,
8747            >,
8748            offset: usize,
8749            mut depth: fidl::encoding::Depth,
8750        ) -> fidl::Result<()> {
8751            encoder
8752                .debug_check_bounds::<RegistryRegisterTouchScreenAndGetDeviceInfoRequest>(offset);
8753            // Vector header
8754            let max_ordinal: u64 = self.max_ordinal_present();
8755            encoder.write_num(max_ordinal, offset);
8756            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8757            // Calling encoder.out_of_line_offset(0) is not allowed.
8758            if max_ordinal == 0 {
8759                return Ok(());
8760            }
8761            depth.increment()?;
8762            let envelope_size = 8;
8763            let bytes_len = max_ordinal as usize * envelope_size;
8764            #[allow(unused_variables)]
8765            let offset = encoder.out_of_line_offset(bytes_len);
8766            let mut _prev_end_offset: usize = 0;
8767            if 1 > max_ordinal {
8768                return Ok(());
8769            }
8770
8771            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8772            // are envelope_size bytes.
8773            let cur_offset: usize = (1 - 1) * envelope_size;
8774
8775            // Zero reserved fields.
8776            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8777
8778            // Safety:
8779            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8780            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8781            //   envelope_size bytes, there is always sufficient room.
8782            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8783            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8784            encoder, offset + cur_offset, depth
8785        )?;
8786
8787            _prev_end_offset = cur_offset + envelope_size;
8788            if 2 > max_ordinal {
8789                return Ok(());
8790            }
8791
8792            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8793            // are envelope_size bytes.
8794            let cur_offset: usize = (2 - 1) * envelope_size;
8795
8796            // Zero reserved fields.
8797            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8798
8799            // Safety:
8800            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8801            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8802            //   envelope_size bytes, there is always sufficient room.
8803            fidl::encoding::encode_in_envelope_optional::<
8804                CoordinateUnit,
8805                fidl::encoding::DefaultFuchsiaResourceDialect,
8806            >(
8807                self.coordinate_unit
8808                    .as_ref()
8809                    .map(<CoordinateUnit as fidl::encoding::ValueTypeMarker>::borrow),
8810                encoder,
8811                offset + cur_offset,
8812                depth,
8813            )?;
8814
8815            _prev_end_offset = cur_offset + envelope_size;
8816            if 3 > max_ordinal {
8817                return Ok(());
8818            }
8819
8820            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8821            // are envelope_size bytes.
8822            let cur_offset: usize = (3 - 1) * envelope_size;
8823
8824            // Zero reserved fields.
8825            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8826
8827            // Safety:
8828            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8829            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8830            //   envelope_size bytes, there is always sufficient room.
8831            fidl::encoding::encode_in_envelope_optional::<
8832                DisplayDimensions,
8833                fidl::encoding::DefaultFuchsiaResourceDialect,
8834            >(
8835                self.display_dimensions
8836                    .as_ref()
8837                    .map(<DisplayDimensions as fidl::encoding::ValueTypeMarker>::borrow),
8838                encoder,
8839                offset + cur_offset,
8840                depth,
8841            )?;
8842
8843            _prev_end_offset = cur_offset + envelope_size;
8844
8845            Ok(())
8846        }
8847    }
8848
8849    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8850        for RegistryRegisterTouchScreenAndGetDeviceInfoRequest
8851    {
8852        #[inline(always)]
8853        fn new_empty() -> Self {
8854            Self::default()
8855        }
8856
8857        unsafe fn decode(
8858            &mut self,
8859            decoder: &mut fidl::encoding::Decoder<
8860                '_,
8861                fidl::encoding::DefaultFuchsiaResourceDialect,
8862            >,
8863            offset: usize,
8864            mut depth: fidl::encoding::Depth,
8865        ) -> fidl::Result<()> {
8866            decoder.debug_check_bounds::<Self>(offset);
8867            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8868                None => return Err(fidl::Error::NotNullable),
8869                Some(len) => len,
8870            };
8871            // Calling decoder.out_of_line_offset(0) is not allowed.
8872            if len == 0 {
8873                return Ok(());
8874            };
8875            depth.increment()?;
8876            let envelope_size = 8;
8877            let bytes_len = len * envelope_size;
8878            let offset = decoder.out_of_line_offset(bytes_len)?;
8879            // Decode the envelope for each type.
8880            let mut _next_ordinal_to_read = 0;
8881            let mut next_offset = offset;
8882            let end_offset = offset + bytes_len;
8883            _next_ordinal_to_read += 1;
8884            if next_offset >= end_offset {
8885                return Ok(());
8886            }
8887
8888            // Decode unknown envelopes for gaps in ordinals.
8889            while _next_ordinal_to_read < 1 {
8890                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8891                _next_ordinal_to_read += 1;
8892                next_offset += envelope_size;
8893            }
8894
8895            let next_out_of_line = decoder.next_out_of_line();
8896            let handles_before = decoder.remaining_handles();
8897            if let Some((inlined, num_bytes, num_handles)) =
8898                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8899            {
8900                let member_inline_size = <fidl::encoding::Endpoint<
8901                    fidl::endpoints::ServerEnd<TouchScreenMarker>,
8902                > as fidl::encoding::TypeMarker>::inline_size(
8903                    decoder.context
8904                );
8905                if inlined != (member_inline_size <= 4) {
8906                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8907                }
8908                let inner_offset;
8909                let mut inner_depth = depth.clone();
8910                if inlined {
8911                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8912                    inner_offset = next_offset;
8913                } else {
8914                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8915                    inner_depth.increment()?;
8916                }
8917                let val_ref = self.device.get_or_insert_with(|| {
8918                    fidl::new_empty!(
8919                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>>,
8920                        fidl::encoding::DefaultFuchsiaResourceDialect
8921                    )
8922                });
8923                fidl::decode!(
8924                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>>,
8925                    fidl::encoding::DefaultFuchsiaResourceDialect,
8926                    val_ref,
8927                    decoder,
8928                    inner_offset,
8929                    inner_depth
8930                )?;
8931                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8932                {
8933                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8934                }
8935                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8936                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8937                }
8938            }
8939
8940            next_offset += envelope_size;
8941            _next_ordinal_to_read += 1;
8942            if next_offset >= end_offset {
8943                return Ok(());
8944            }
8945
8946            // Decode unknown envelopes for gaps in ordinals.
8947            while _next_ordinal_to_read < 2 {
8948                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8949                _next_ordinal_to_read += 1;
8950                next_offset += envelope_size;
8951            }
8952
8953            let next_out_of_line = decoder.next_out_of_line();
8954            let handles_before = decoder.remaining_handles();
8955            if let Some((inlined, num_bytes, num_handles)) =
8956                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8957            {
8958                let member_inline_size =
8959                    <CoordinateUnit as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8960                if inlined != (member_inline_size <= 4) {
8961                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8962                }
8963                let inner_offset;
8964                let mut inner_depth = depth.clone();
8965                if inlined {
8966                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8967                    inner_offset = next_offset;
8968                } else {
8969                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8970                    inner_depth.increment()?;
8971                }
8972                let val_ref = self.coordinate_unit.get_or_insert_with(|| {
8973                    fidl::new_empty!(CoordinateUnit, fidl::encoding::DefaultFuchsiaResourceDialect)
8974                });
8975                fidl::decode!(
8976                    CoordinateUnit,
8977                    fidl::encoding::DefaultFuchsiaResourceDialect,
8978                    val_ref,
8979                    decoder,
8980                    inner_offset,
8981                    inner_depth
8982                )?;
8983                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8984                {
8985                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8986                }
8987                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8988                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8989                }
8990            }
8991
8992            next_offset += envelope_size;
8993            _next_ordinal_to_read += 1;
8994            if next_offset >= end_offset {
8995                return Ok(());
8996            }
8997
8998            // Decode unknown envelopes for gaps in ordinals.
8999            while _next_ordinal_to_read < 3 {
9000                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9001                _next_ordinal_to_read += 1;
9002                next_offset += envelope_size;
9003            }
9004
9005            let next_out_of_line = decoder.next_out_of_line();
9006            let handles_before = decoder.remaining_handles();
9007            if let Some((inlined, num_bytes, num_handles)) =
9008                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9009            {
9010                let member_inline_size =
9011                    <DisplayDimensions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9012                if inlined != (member_inline_size <= 4) {
9013                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9014                }
9015                let inner_offset;
9016                let mut inner_depth = depth.clone();
9017                if inlined {
9018                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9019                    inner_offset = next_offset;
9020                } else {
9021                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9022                    inner_depth.increment()?;
9023                }
9024                let val_ref = self.display_dimensions.get_or_insert_with(|| {
9025                    fidl::new_empty!(
9026                        DisplayDimensions,
9027                        fidl::encoding::DefaultFuchsiaResourceDialect
9028                    )
9029                });
9030                fidl::decode!(
9031                    DisplayDimensions,
9032                    fidl::encoding::DefaultFuchsiaResourceDialect,
9033                    val_ref,
9034                    decoder,
9035                    inner_offset,
9036                    inner_depth
9037                )?;
9038                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9039                {
9040                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9041                }
9042                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9043                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9044                }
9045            }
9046
9047            next_offset += envelope_size;
9048
9049            // Decode the remaining unknown envelopes.
9050            while next_offset < end_offset {
9051                _next_ordinal_to_read += 1;
9052                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9053                next_offset += envelope_size;
9054            }
9055
9056            Ok(())
9057        }
9058    }
9059
9060    impl RegistryRegisterTouchScreenAndGetDeviceInfoResponse {
9061        #[inline(always)]
9062        fn max_ordinal_present(&self) -> u64 {
9063            if let Some(_) = self.device_id {
9064                return 1;
9065            }
9066            0
9067        }
9068    }
9069
9070    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterTouchScreenAndGetDeviceInfoResponse {
9071        type Borrowed<'a> = &'a mut Self;
9072        fn take_or_borrow<'a>(
9073            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9074        ) -> Self::Borrowed<'a> {
9075            value
9076        }
9077    }
9078
9079    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterTouchScreenAndGetDeviceInfoResponse {
9080        type Owned = Self;
9081
9082        #[inline(always)]
9083        fn inline_align(_context: fidl::encoding::Context) -> usize {
9084            8
9085        }
9086
9087        #[inline(always)]
9088        fn inline_size(_context: fidl::encoding::Context) -> usize {
9089            16
9090        }
9091    }
9092
9093    unsafe impl
9094        fidl::encoding::Encode<
9095            RegistryRegisterTouchScreenAndGetDeviceInfoResponse,
9096            fidl::encoding::DefaultFuchsiaResourceDialect,
9097        > for &mut RegistryRegisterTouchScreenAndGetDeviceInfoResponse
9098    {
9099        unsafe fn encode(
9100            self,
9101            encoder: &mut fidl::encoding::Encoder<
9102                '_,
9103                fidl::encoding::DefaultFuchsiaResourceDialect,
9104            >,
9105            offset: usize,
9106            mut depth: fidl::encoding::Depth,
9107        ) -> fidl::Result<()> {
9108            encoder
9109                .debug_check_bounds::<RegistryRegisterTouchScreenAndGetDeviceInfoResponse>(offset);
9110            // Vector header
9111            let max_ordinal: u64 = self.max_ordinal_present();
9112            encoder.write_num(max_ordinal, offset);
9113            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9114            // Calling encoder.out_of_line_offset(0) is not allowed.
9115            if max_ordinal == 0 {
9116                return Ok(());
9117            }
9118            depth.increment()?;
9119            let envelope_size = 8;
9120            let bytes_len = max_ordinal as usize * envelope_size;
9121            #[allow(unused_variables)]
9122            let offset = encoder.out_of_line_offset(bytes_len);
9123            let mut _prev_end_offset: usize = 0;
9124            if 1 > max_ordinal {
9125                return Ok(());
9126            }
9127
9128            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9129            // are envelope_size bytes.
9130            let cur_offset: usize = (1 - 1) * envelope_size;
9131
9132            // Zero reserved fields.
9133            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9134
9135            // Safety:
9136            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9137            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9138            //   envelope_size bytes, there is always sufficient room.
9139            fidl::encoding::encode_in_envelope_optional::<
9140                u32,
9141                fidl::encoding::DefaultFuchsiaResourceDialect,
9142            >(
9143                self.device_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
9144                encoder,
9145                offset + cur_offset,
9146                depth,
9147            )?;
9148
9149            _prev_end_offset = cur_offset + envelope_size;
9150
9151            Ok(())
9152        }
9153    }
9154
9155    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9156        for RegistryRegisterTouchScreenAndGetDeviceInfoResponse
9157    {
9158        #[inline(always)]
9159        fn new_empty() -> Self {
9160            Self::default()
9161        }
9162
9163        unsafe fn decode(
9164            &mut self,
9165            decoder: &mut fidl::encoding::Decoder<
9166                '_,
9167                fidl::encoding::DefaultFuchsiaResourceDialect,
9168            >,
9169            offset: usize,
9170            mut depth: fidl::encoding::Depth,
9171        ) -> fidl::Result<()> {
9172            decoder.debug_check_bounds::<Self>(offset);
9173            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9174                None => return Err(fidl::Error::NotNullable),
9175                Some(len) => len,
9176            };
9177            // Calling decoder.out_of_line_offset(0) is not allowed.
9178            if len == 0 {
9179                return Ok(());
9180            };
9181            depth.increment()?;
9182            let envelope_size = 8;
9183            let bytes_len = len * envelope_size;
9184            let offset = decoder.out_of_line_offset(bytes_len)?;
9185            // Decode the envelope for each type.
9186            let mut _next_ordinal_to_read = 0;
9187            let mut next_offset = offset;
9188            let end_offset = offset + bytes_len;
9189            _next_ordinal_to_read += 1;
9190            if next_offset >= end_offset {
9191                return Ok(());
9192            }
9193
9194            // Decode unknown envelopes for gaps in ordinals.
9195            while _next_ordinal_to_read < 1 {
9196                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9197                _next_ordinal_to_read += 1;
9198                next_offset += envelope_size;
9199            }
9200
9201            let next_out_of_line = decoder.next_out_of_line();
9202            let handles_before = decoder.remaining_handles();
9203            if let Some((inlined, num_bytes, num_handles)) =
9204                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9205            {
9206                let member_inline_size =
9207                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9208                if inlined != (member_inline_size <= 4) {
9209                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9210                }
9211                let inner_offset;
9212                let mut inner_depth = depth.clone();
9213                if inlined {
9214                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9215                    inner_offset = next_offset;
9216                } else {
9217                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9218                    inner_depth.increment()?;
9219                }
9220                let val_ref = self.device_id.get_or_insert_with(|| {
9221                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
9222                });
9223                fidl::decode!(
9224                    u32,
9225                    fidl::encoding::DefaultFuchsiaResourceDialect,
9226                    val_ref,
9227                    decoder,
9228                    inner_offset,
9229                    inner_depth
9230                )?;
9231                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9232                {
9233                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9234                }
9235                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9236                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9237                }
9238            }
9239
9240            next_offset += envelope_size;
9241
9242            // Decode the remaining unknown envelopes.
9243            while next_offset < end_offset {
9244                _next_ordinal_to_read += 1;
9245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9246                next_offset += envelope_size;
9247            }
9248
9249            Ok(())
9250        }
9251    }
9252
9253    impl RegistryRegisterTouchScreenRequest {
9254        #[inline(always)]
9255        fn max_ordinal_present(&self) -> u64 {
9256            if let Some(_) = self.display_dimensions {
9257                return 3;
9258            }
9259            if let Some(_) = self.coordinate_unit {
9260                return 2;
9261            }
9262            if let Some(_) = self.device {
9263                return 1;
9264            }
9265            0
9266        }
9267    }
9268
9269    impl fidl::encoding::ResourceTypeMarker for RegistryRegisterTouchScreenRequest {
9270        type Borrowed<'a> = &'a mut Self;
9271        fn take_or_borrow<'a>(
9272            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9273        ) -> Self::Borrowed<'a> {
9274            value
9275        }
9276    }
9277
9278    unsafe impl fidl::encoding::TypeMarker for RegistryRegisterTouchScreenRequest {
9279        type Owned = Self;
9280
9281        #[inline(always)]
9282        fn inline_align(_context: fidl::encoding::Context) -> usize {
9283            8
9284        }
9285
9286        #[inline(always)]
9287        fn inline_size(_context: fidl::encoding::Context) -> usize {
9288            16
9289        }
9290    }
9291
9292    unsafe impl
9293        fidl::encoding::Encode<
9294            RegistryRegisterTouchScreenRequest,
9295            fidl::encoding::DefaultFuchsiaResourceDialect,
9296        > for &mut RegistryRegisterTouchScreenRequest
9297    {
9298        unsafe fn encode(
9299            self,
9300            encoder: &mut fidl::encoding::Encoder<
9301                '_,
9302                fidl::encoding::DefaultFuchsiaResourceDialect,
9303            >,
9304            offset: usize,
9305            mut depth: fidl::encoding::Depth,
9306        ) -> fidl::Result<()> {
9307            encoder.debug_check_bounds::<RegistryRegisterTouchScreenRequest>(offset);
9308            // Vector header
9309            let max_ordinal: u64 = self.max_ordinal_present();
9310            encoder.write_num(max_ordinal, offset);
9311            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9312            // Calling encoder.out_of_line_offset(0) is not allowed.
9313            if max_ordinal == 0 {
9314                return Ok(());
9315            }
9316            depth.increment()?;
9317            let envelope_size = 8;
9318            let bytes_len = max_ordinal as usize * envelope_size;
9319            #[allow(unused_variables)]
9320            let offset = encoder.out_of_line_offset(bytes_len);
9321            let mut _prev_end_offset: usize = 0;
9322            if 1 > max_ordinal {
9323                return Ok(());
9324            }
9325
9326            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9327            // are envelope_size bytes.
9328            let cur_offset: usize = (1 - 1) * envelope_size;
9329
9330            // Zero reserved fields.
9331            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9332
9333            // Safety:
9334            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9335            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9336            //   envelope_size bytes, there is always sufficient room.
9337            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
9338            self.device.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
9339            encoder, offset + cur_offset, depth
9340        )?;
9341
9342            _prev_end_offset = cur_offset + envelope_size;
9343            if 2 > max_ordinal {
9344                return Ok(());
9345            }
9346
9347            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9348            // are envelope_size bytes.
9349            let cur_offset: usize = (2 - 1) * envelope_size;
9350
9351            // Zero reserved fields.
9352            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9353
9354            // Safety:
9355            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9356            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9357            //   envelope_size bytes, there is always sufficient room.
9358            fidl::encoding::encode_in_envelope_optional::<
9359                CoordinateUnit,
9360                fidl::encoding::DefaultFuchsiaResourceDialect,
9361            >(
9362                self.coordinate_unit
9363                    .as_ref()
9364                    .map(<CoordinateUnit as fidl::encoding::ValueTypeMarker>::borrow),
9365                encoder,
9366                offset + cur_offset,
9367                depth,
9368            )?;
9369
9370            _prev_end_offset = cur_offset + envelope_size;
9371            if 3 > max_ordinal {
9372                return Ok(());
9373            }
9374
9375            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9376            // are envelope_size bytes.
9377            let cur_offset: usize = (3 - 1) * envelope_size;
9378
9379            // Zero reserved fields.
9380            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9381
9382            // Safety:
9383            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9384            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9385            //   envelope_size bytes, there is always sufficient room.
9386            fidl::encoding::encode_in_envelope_optional::<
9387                DisplayDimensions,
9388                fidl::encoding::DefaultFuchsiaResourceDialect,
9389            >(
9390                self.display_dimensions
9391                    .as_ref()
9392                    .map(<DisplayDimensions as fidl::encoding::ValueTypeMarker>::borrow),
9393                encoder,
9394                offset + cur_offset,
9395                depth,
9396            )?;
9397
9398            _prev_end_offset = cur_offset + envelope_size;
9399
9400            Ok(())
9401        }
9402    }
9403
9404    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9405        for RegistryRegisterTouchScreenRequest
9406    {
9407        #[inline(always)]
9408        fn new_empty() -> Self {
9409            Self::default()
9410        }
9411
9412        unsafe fn decode(
9413            &mut self,
9414            decoder: &mut fidl::encoding::Decoder<
9415                '_,
9416                fidl::encoding::DefaultFuchsiaResourceDialect,
9417            >,
9418            offset: usize,
9419            mut depth: fidl::encoding::Depth,
9420        ) -> fidl::Result<()> {
9421            decoder.debug_check_bounds::<Self>(offset);
9422            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9423                None => return Err(fidl::Error::NotNullable),
9424                Some(len) => len,
9425            };
9426            // Calling decoder.out_of_line_offset(0) is not allowed.
9427            if len == 0 {
9428                return Ok(());
9429            };
9430            depth.increment()?;
9431            let envelope_size = 8;
9432            let bytes_len = len * envelope_size;
9433            let offset = decoder.out_of_line_offset(bytes_len)?;
9434            // Decode the envelope for each type.
9435            let mut _next_ordinal_to_read = 0;
9436            let mut next_offset = offset;
9437            let end_offset = offset + bytes_len;
9438            _next_ordinal_to_read += 1;
9439            if next_offset >= end_offset {
9440                return Ok(());
9441            }
9442
9443            // Decode unknown envelopes for gaps in ordinals.
9444            while _next_ordinal_to_read < 1 {
9445                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9446                _next_ordinal_to_read += 1;
9447                next_offset += envelope_size;
9448            }
9449
9450            let next_out_of_line = decoder.next_out_of_line();
9451            let handles_before = decoder.remaining_handles();
9452            if let Some((inlined, num_bytes, num_handles)) =
9453                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9454            {
9455                let member_inline_size = <fidl::encoding::Endpoint<
9456                    fidl::endpoints::ServerEnd<TouchScreenMarker>,
9457                > as fidl::encoding::TypeMarker>::inline_size(
9458                    decoder.context
9459                );
9460                if inlined != (member_inline_size <= 4) {
9461                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9462                }
9463                let inner_offset;
9464                let mut inner_depth = depth.clone();
9465                if inlined {
9466                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9467                    inner_offset = next_offset;
9468                } else {
9469                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9470                    inner_depth.increment()?;
9471                }
9472                let val_ref = self.device.get_or_insert_with(|| {
9473                    fidl::new_empty!(
9474                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>>,
9475                        fidl::encoding::DefaultFuchsiaResourceDialect
9476                    )
9477                });
9478                fidl::decode!(
9479                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TouchScreenMarker>>,
9480                    fidl::encoding::DefaultFuchsiaResourceDialect,
9481                    val_ref,
9482                    decoder,
9483                    inner_offset,
9484                    inner_depth
9485                )?;
9486                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9487                {
9488                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9489                }
9490                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9491                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9492                }
9493            }
9494
9495            next_offset += envelope_size;
9496            _next_ordinal_to_read += 1;
9497            if next_offset >= end_offset {
9498                return Ok(());
9499            }
9500
9501            // Decode unknown envelopes for gaps in ordinals.
9502            while _next_ordinal_to_read < 2 {
9503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9504                _next_ordinal_to_read += 1;
9505                next_offset += envelope_size;
9506            }
9507
9508            let next_out_of_line = decoder.next_out_of_line();
9509            let handles_before = decoder.remaining_handles();
9510            if let Some((inlined, num_bytes, num_handles)) =
9511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9512            {
9513                let member_inline_size =
9514                    <CoordinateUnit as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9515                if inlined != (member_inline_size <= 4) {
9516                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9517                }
9518                let inner_offset;
9519                let mut inner_depth = depth.clone();
9520                if inlined {
9521                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9522                    inner_offset = next_offset;
9523                } else {
9524                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9525                    inner_depth.increment()?;
9526                }
9527                let val_ref = self.coordinate_unit.get_or_insert_with(|| {
9528                    fidl::new_empty!(CoordinateUnit, fidl::encoding::DefaultFuchsiaResourceDialect)
9529                });
9530                fidl::decode!(
9531                    CoordinateUnit,
9532                    fidl::encoding::DefaultFuchsiaResourceDialect,
9533                    val_ref,
9534                    decoder,
9535                    inner_offset,
9536                    inner_depth
9537                )?;
9538                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9539                {
9540                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9541                }
9542                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9543                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9544                }
9545            }
9546
9547            next_offset += envelope_size;
9548            _next_ordinal_to_read += 1;
9549            if next_offset >= end_offset {
9550                return Ok(());
9551            }
9552
9553            // Decode unknown envelopes for gaps in ordinals.
9554            while _next_ordinal_to_read < 3 {
9555                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9556                _next_ordinal_to_read += 1;
9557                next_offset += envelope_size;
9558            }
9559
9560            let next_out_of_line = decoder.next_out_of_line();
9561            let handles_before = decoder.remaining_handles();
9562            if let Some((inlined, num_bytes, num_handles)) =
9563                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9564            {
9565                let member_inline_size =
9566                    <DisplayDimensions as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9567                if inlined != (member_inline_size <= 4) {
9568                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9569                }
9570                let inner_offset;
9571                let mut inner_depth = depth.clone();
9572                if inlined {
9573                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9574                    inner_offset = next_offset;
9575                } else {
9576                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9577                    inner_depth.increment()?;
9578                }
9579                let val_ref = self.display_dimensions.get_or_insert_with(|| {
9580                    fidl::new_empty!(
9581                        DisplayDimensions,
9582                        fidl::encoding::DefaultFuchsiaResourceDialect
9583                    )
9584                });
9585                fidl::decode!(
9586                    DisplayDimensions,
9587                    fidl::encoding::DefaultFuchsiaResourceDialect,
9588                    val_ref,
9589                    decoder,
9590                    inner_offset,
9591                    inner_depth
9592                )?;
9593                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9594                {
9595                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9596                }
9597                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9598                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9599                }
9600            }
9601
9602            next_offset += envelope_size;
9603
9604            // Decode the remaining unknown envelopes.
9605            while next_offset < end_offset {
9606                _next_ordinal_to_read += 1;
9607                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9608                next_offset += envelope_size;
9609            }
9610
9611            Ok(())
9612        }
9613    }
9614}