fidl_fuchsia_ui_test_input/
fidl_fuchsia_ui_test_input.rs

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