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