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