Skip to main content

fidl_fuchsia_ui_test_input/
fidl_fuchsia_ui_test_input.rs

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