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