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