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