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