fidl_fuchsia_ui_pointer_augment/
fidl_fuchsia_ui_pointer_augment.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_pointer_augment_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ErrorForLocalHit {
16    /// Abnormal reason for return.
17    pub error_reason: ErrorReason,
18    /// Original protocol endpoint for client use.
19    pub original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ErrorForLocalHit {}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct LocalHitUpgradeRequest {
26    pub original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
27}
28
29impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LocalHitUpgradeRequest {}
30
31#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
32pub struct LocalHitUpgradeResponse {
33    pub augmented: Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
34    pub error: Option<Box<ErrorForLocalHit>>,
35}
36
37impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for LocalHitUpgradeResponse {}
38
39#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
40pub struct LocalHitMarker;
41
42impl fidl::endpoints::ProtocolMarker for LocalHitMarker {
43    type Proxy = LocalHitProxy;
44    type RequestStream = LocalHitRequestStream;
45    #[cfg(target_os = "fuchsia")]
46    type SynchronousProxy = LocalHitSynchronousProxy;
47
48    const DEBUG_NAME: &'static str = "fuchsia.ui.pointer.augment.LocalHit";
49}
50impl fidl::endpoints::DiscoverableProtocolMarker for LocalHitMarker {}
51
52pub trait LocalHitProxyInterface: Send + Sync {
53    type UpgradeResponseFut: std::future::Future<
54            Output = Result<
55                (
56                    Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
57                    Option<Box<ErrorForLocalHit>>,
58                ),
59                fidl::Error,
60            >,
61        > + Send;
62    fn r#upgrade(
63        &self,
64        original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
65    ) -> Self::UpgradeResponseFut;
66}
67#[derive(Debug)]
68#[cfg(target_os = "fuchsia")]
69pub struct LocalHitSynchronousProxy {
70    client: fidl::client::sync::Client,
71}
72
73#[cfg(target_os = "fuchsia")]
74impl fidl::endpoints::SynchronousProxy for LocalHitSynchronousProxy {
75    type Proxy = LocalHitProxy;
76    type Protocol = LocalHitMarker;
77
78    fn from_channel(inner: fidl::Channel) -> Self {
79        Self::new(inner)
80    }
81
82    fn into_channel(self) -> fidl::Channel {
83        self.client.into_channel()
84    }
85
86    fn as_channel(&self) -> &fidl::Channel {
87        self.client.as_channel()
88    }
89}
90
91#[cfg(target_os = "fuchsia")]
92impl LocalHitSynchronousProxy {
93    pub fn new(channel: fidl::Channel) -> Self {
94        let protocol_name = <LocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
95        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
96    }
97
98    pub fn into_channel(self) -> fidl::Channel {
99        self.client.into_channel()
100    }
101
102    /// Waits until an event arrives and returns it. It is safe for other
103    /// threads to make concurrent requests while waiting for an event.
104    pub fn wait_for_event(
105        &self,
106        deadline: zx::MonotonicInstant,
107    ) -> Result<LocalHitEvent, fidl::Error> {
108        LocalHitEvent::decode(self.client.wait_for_event(deadline)?)
109    }
110
111    /// An exchange from an `original` touch protocol endpoint to an `augmented`
112    /// touch protocol endpoint. If successful, `error` is empty, `original` is
113    /// consumed, and `augmented` is returned for the client's use. Otherwise,
114    /// the `error` carries back `original` for the client's use, and
115    /// `augmented` is null.
116    pub fn r#upgrade(
117        &self,
118        mut original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
119        ___deadline: zx::MonotonicInstant,
120    ) -> Result<
121        (
122            Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
123            Option<Box<ErrorForLocalHit>>,
124        ),
125        fidl::Error,
126    > {
127        let _response = self.client.send_query::<LocalHitUpgradeRequest, LocalHitUpgradeResponse>(
128            (original,),
129            0x1ec0c985bbfe4e8c,
130            fidl::encoding::DynamicFlags::empty(),
131            ___deadline,
132        )?;
133        Ok((_response.augmented, _response.error))
134    }
135}
136
137#[cfg(target_os = "fuchsia")]
138impl From<LocalHitSynchronousProxy> for zx::Handle {
139    fn from(value: LocalHitSynchronousProxy) -> Self {
140        value.into_channel().into()
141    }
142}
143
144#[cfg(target_os = "fuchsia")]
145impl From<fidl::Channel> for LocalHitSynchronousProxy {
146    fn from(value: fidl::Channel) -> Self {
147        Self::new(value)
148    }
149}
150
151#[derive(Debug, Clone)]
152pub struct LocalHitProxy {
153    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
154}
155
156impl fidl::endpoints::Proxy for LocalHitProxy {
157    type Protocol = LocalHitMarker;
158
159    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
160        Self::new(inner)
161    }
162
163    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
164        self.client.into_channel().map_err(|client| Self { client })
165    }
166
167    fn as_channel(&self) -> &::fidl::AsyncChannel {
168        self.client.as_channel()
169    }
170}
171
172impl LocalHitProxy {
173    /// Create a new Proxy for fuchsia.ui.pointer.augment/LocalHit.
174    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
175        let protocol_name = <LocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
176        Self { client: fidl::client::Client::new(channel, protocol_name) }
177    }
178
179    /// Get a Stream of events from the remote end of the protocol.
180    ///
181    /// # Panics
182    ///
183    /// Panics if the event stream was already taken.
184    pub fn take_event_stream(&self) -> LocalHitEventStream {
185        LocalHitEventStream { event_receiver: self.client.take_event_receiver() }
186    }
187
188    /// An exchange from an `original` touch protocol endpoint to an `augmented`
189    /// touch protocol endpoint. If successful, `error` is empty, `original` is
190    /// consumed, and `augmented` is returned for the client's use. Otherwise,
191    /// the `error` carries back `original` for the client's use, and
192    /// `augmented` is null.
193    pub fn r#upgrade(
194        &self,
195        mut original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
196    ) -> fidl::client::QueryResponseFut<
197        (
198            Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
199            Option<Box<ErrorForLocalHit>>,
200        ),
201        fidl::encoding::DefaultFuchsiaResourceDialect,
202    > {
203        LocalHitProxyInterface::r#upgrade(self, original)
204    }
205}
206
207impl LocalHitProxyInterface for LocalHitProxy {
208    type UpgradeResponseFut = fidl::client::QueryResponseFut<
209        (
210            Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
211            Option<Box<ErrorForLocalHit>>,
212        ),
213        fidl::encoding::DefaultFuchsiaResourceDialect,
214    >;
215    fn r#upgrade(
216        &self,
217        mut original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
218    ) -> Self::UpgradeResponseFut {
219        fn _decode(
220            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
221        ) -> Result<
222            (
223                Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
224                Option<Box<ErrorForLocalHit>>,
225            ),
226            fidl::Error,
227        > {
228            let _response = fidl::client::decode_transaction_body::<
229                LocalHitUpgradeResponse,
230                fidl::encoding::DefaultFuchsiaResourceDialect,
231                0x1ec0c985bbfe4e8c,
232            >(_buf?)?;
233            Ok((_response.augmented, _response.error))
234        }
235        self.client.send_query_and_decode::<LocalHitUpgradeRequest, (
236            Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
237            Option<Box<ErrorForLocalHit>>,
238        )>(
239            (original,), 0x1ec0c985bbfe4e8c, fidl::encoding::DynamicFlags::empty(), _decode
240        )
241    }
242}
243
244pub struct LocalHitEventStream {
245    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
246}
247
248impl std::marker::Unpin for LocalHitEventStream {}
249
250impl futures::stream::FusedStream for LocalHitEventStream {
251    fn is_terminated(&self) -> bool {
252        self.event_receiver.is_terminated()
253    }
254}
255
256impl futures::Stream for LocalHitEventStream {
257    type Item = Result<LocalHitEvent, fidl::Error>;
258
259    fn poll_next(
260        mut self: std::pin::Pin<&mut Self>,
261        cx: &mut std::task::Context<'_>,
262    ) -> std::task::Poll<Option<Self::Item>> {
263        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
264            &mut self.event_receiver,
265            cx
266        )?) {
267            Some(buf) => std::task::Poll::Ready(Some(LocalHitEvent::decode(buf))),
268            None => std::task::Poll::Ready(None),
269        }
270    }
271}
272
273#[derive(Debug)]
274pub enum LocalHitEvent {}
275
276impl LocalHitEvent {
277    /// Decodes a message buffer as a [`LocalHitEvent`].
278    fn decode(
279        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
280    ) -> Result<LocalHitEvent, fidl::Error> {
281        let (bytes, _handles) = buf.split_mut();
282        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
283        debug_assert_eq!(tx_header.tx_id, 0);
284        match tx_header.ordinal {
285            _ => Err(fidl::Error::UnknownOrdinal {
286                ordinal: tx_header.ordinal,
287                protocol_name: <LocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
288            }),
289        }
290    }
291}
292
293/// A Stream of incoming requests for fuchsia.ui.pointer.augment/LocalHit.
294pub struct LocalHitRequestStream {
295    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
296    is_terminated: bool,
297}
298
299impl std::marker::Unpin for LocalHitRequestStream {}
300
301impl futures::stream::FusedStream for LocalHitRequestStream {
302    fn is_terminated(&self) -> bool {
303        self.is_terminated
304    }
305}
306
307impl fidl::endpoints::RequestStream for LocalHitRequestStream {
308    type Protocol = LocalHitMarker;
309    type ControlHandle = LocalHitControlHandle;
310
311    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
312        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
313    }
314
315    fn control_handle(&self) -> Self::ControlHandle {
316        LocalHitControlHandle { inner: self.inner.clone() }
317    }
318
319    fn into_inner(
320        self,
321    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
322    {
323        (self.inner, self.is_terminated)
324    }
325
326    fn from_inner(
327        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
328        is_terminated: bool,
329    ) -> Self {
330        Self { inner, is_terminated }
331    }
332}
333
334impl futures::Stream for LocalHitRequestStream {
335    type Item = Result<LocalHitRequest, fidl::Error>;
336
337    fn poll_next(
338        mut self: std::pin::Pin<&mut Self>,
339        cx: &mut std::task::Context<'_>,
340    ) -> std::task::Poll<Option<Self::Item>> {
341        let this = &mut *self;
342        if this.inner.check_shutdown(cx) {
343            this.is_terminated = true;
344            return std::task::Poll::Ready(None);
345        }
346        if this.is_terminated {
347            panic!("polled LocalHitRequestStream after completion");
348        }
349        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
350            |bytes, handles| {
351                match this.inner.channel().read_etc(cx, bytes, handles) {
352                    std::task::Poll::Ready(Ok(())) => {}
353                    std::task::Poll::Pending => return std::task::Poll::Pending,
354                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
355                        this.is_terminated = true;
356                        return std::task::Poll::Ready(None);
357                    }
358                    std::task::Poll::Ready(Err(e)) => {
359                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
360                            e.into(),
361                        ))))
362                    }
363                }
364
365                // A message has been received from the channel
366                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
367
368                std::task::Poll::Ready(Some(match header.ordinal {
369                    0x1ec0c985bbfe4e8c => {
370                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
371                        let mut req = fidl::new_empty!(
372                            LocalHitUpgradeRequest,
373                            fidl::encoding::DefaultFuchsiaResourceDialect
374                        );
375                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LocalHitUpgradeRequest>(&header, _body_bytes, handles, &mut req)?;
376                        let control_handle = LocalHitControlHandle { inner: this.inner.clone() };
377                        Ok(LocalHitRequest::Upgrade {
378                            original: req.original,
379
380                            responder: LocalHitUpgradeResponder {
381                                control_handle: std::mem::ManuallyDrop::new(control_handle),
382                                tx_id: header.tx_id,
383                            },
384                        })
385                    }
386                    _ => Err(fidl::Error::UnknownOrdinal {
387                        ordinal: header.ordinal,
388                        protocol_name:
389                            <LocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
390                    }),
391                }))
392            },
393        )
394    }
395}
396
397/// A method for a client to upgrade its touch event protocol to additionally
398/// receive local-hit data for touch events.
399#[derive(Debug)]
400pub enum LocalHitRequest {
401    /// An exchange from an `original` touch protocol endpoint to an `augmented`
402    /// touch protocol endpoint. If successful, `error` is empty, `original` is
403    /// consumed, and `augmented` is returned for the client's use. Otherwise,
404    /// the `error` carries back `original` for the client's use, and
405    /// `augmented` is null.
406    Upgrade {
407        original: fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
408        responder: LocalHitUpgradeResponder,
409    },
410}
411
412impl LocalHitRequest {
413    #[allow(irrefutable_let_patterns)]
414    pub fn into_upgrade(
415        self,
416    ) -> Option<(
417        fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
418        LocalHitUpgradeResponder,
419    )> {
420        if let LocalHitRequest::Upgrade { original, responder } = self {
421            Some((original, responder))
422        } else {
423            None
424        }
425    }
426
427    /// Name of the method defined in FIDL
428    pub fn method_name(&self) -> &'static str {
429        match *self {
430            LocalHitRequest::Upgrade { .. } => "upgrade",
431        }
432    }
433}
434
435#[derive(Debug, Clone)]
436pub struct LocalHitControlHandle {
437    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
438}
439
440impl fidl::endpoints::ControlHandle for LocalHitControlHandle {
441    fn shutdown(&self) {
442        self.inner.shutdown()
443    }
444    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
445        self.inner.shutdown_with_epitaph(status)
446    }
447
448    fn is_closed(&self) -> bool {
449        self.inner.channel().is_closed()
450    }
451    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
452        self.inner.channel().on_closed()
453    }
454
455    #[cfg(target_os = "fuchsia")]
456    fn signal_peer(
457        &self,
458        clear_mask: zx::Signals,
459        set_mask: zx::Signals,
460    ) -> Result<(), zx_status::Status> {
461        use fidl::Peered;
462        self.inner.channel().signal_peer(clear_mask, set_mask)
463    }
464}
465
466impl LocalHitControlHandle {}
467
468#[must_use = "FIDL methods require a response to be sent"]
469#[derive(Debug)]
470pub struct LocalHitUpgradeResponder {
471    control_handle: std::mem::ManuallyDrop<LocalHitControlHandle>,
472    tx_id: u32,
473}
474
475/// Set the the channel to be shutdown (see [`LocalHitControlHandle::shutdown`])
476/// if the responder is dropped without sending a response, so that the client
477/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
478impl std::ops::Drop for LocalHitUpgradeResponder {
479    fn drop(&mut self) {
480        self.control_handle.shutdown();
481        // Safety: drops once, never accessed again
482        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
483    }
484}
485
486impl fidl::endpoints::Responder for LocalHitUpgradeResponder {
487    type ControlHandle = LocalHitControlHandle;
488
489    fn control_handle(&self) -> &LocalHitControlHandle {
490        &self.control_handle
491    }
492
493    fn drop_without_shutdown(mut self) {
494        // Safety: drops once, never accessed again due to mem::forget
495        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
496        // Prevent Drop from running (which would shut down the channel)
497        std::mem::forget(self);
498    }
499}
500
501impl LocalHitUpgradeResponder {
502    /// Sends a response to the FIDL transaction.
503    ///
504    /// Sets the channel to shutdown if an error occurs.
505    pub fn send(
506        self,
507        mut augmented: Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
508        mut error: Option<ErrorForLocalHit>,
509    ) -> Result<(), fidl::Error> {
510        let _result = self.send_raw(augmented, error);
511        if _result.is_err() {
512            self.control_handle.shutdown();
513        }
514        self.drop_without_shutdown();
515        _result
516    }
517
518    /// Similar to "send" but does not shutdown the channel if an error occurs.
519    pub fn send_no_shutdown_on_err(
520        self,
521        mut augmented: Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
522        mut error: Option<ErrorForLocalHit>,
523    ) -> Result<(), fidl::Error> {
524        let _result = self.send_raw(augmented, error);
525        self.drop_without_shutdown();
526        _result
527    }
528
529    fn send_raw(
530        &self,
531        mut augmented: Option<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>,
532        mut error: Option<ErrorForLocalHit>,
533    ) -> Result<(), fidl::Error> {
534        self.control_handle.inner.send::<LocalHitUpgradeResponse>(
535            (augmented, error.as_mut()),
536            self.tx_id,
537            0x1ec0c985bbfe4e8c,
538            fidl::encoding::DynamicFlags::empty(),
539        )
540    }
541}
542
543#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
544pub struct TouchSourceWithLocalHitMarker;
545
546impl fidl::endpoints::ProtocolMarker for TouchSourceWithLocalHitMarker {
547    type Proxy = TouchSourceWithLocalHitProxy;
548    type RequestStream = TouchSourceWithLocalHitRequestStream;
549    #[cfg(target_os = "fuchsia")]
550    type SynchronousProxy = TouchSourceWithLocalHitSynchronousProxy;
551
552    const DEBUG_NAME: &'static str = "(anonymous) TouchSourceWithLocalHit";
553}
554
555pub trait TouchSourceWithLocalHitProxyInterface: Send + Sync {
556    type WatchResponseFut: std::future::Future<Output = Result<Vec<TouchEventWithLocalHit>, fidl::Error>>
557        + Send;
558    fn r#watch(
559        &self,
560        responses: &[fidl_fuchsia_ui_pointer::TouchResponse],
561    ) -> Self::WatchResponseFut;
562    type UpdateResponseResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
563    fn r#update_response(
564        &self,
565        interaction: &fidl_fuchsia_ui_pointer::TouchInteractionId,
566        response: &fidl_fuchsia_ui_pointer::TouchResponse,
567    ) -> Self::UpdateResponseResponseFut;
568}
569#[derive(Debug)]
570#[cfg(target_os = "fuchsia")]
571pub struct TouchSourceWithLocalHitSynchronousProxy {
572    client: fidl::client::sync::Client,
573}
574
575#[cfg(target_os = "fuchsia")]
576impl fidl::endpoints::SynchronousProxy for TouchSourceWithLocalHitSynchronousProxy {
577    type Proxy = TouchSourceWithLocalHitProxy;
578    type Protocol = TouchSourceWithLocalHitMarker;
579
580    fn from_channel(inner: fidl::Channel) -> Self {
581        Self::new(inner)
582    }
583
584    fn into_channel(self) -> fidl::Channel {
585        self.client.into_channel()
586    }
587
588    fn as_channel(&self) -> &fidl::Channel {
589        self.client.as_channel()
590    }
591}
592
593#[cfg(target_os = "fuchsia")]
594impl TouchSourceWithLocalHitSynchronousProxy {
595    pub fn new(channel: fidl::Channel) -> Self {
596        let protocol_name =
597            <TouchSourceWithLocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
598        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
599    }
600
601    pub fn into_channel(self) -> fidl::Channel {
602        self.client.into_channel()
603    }
604
605    /// Waits until an event arrives and returns it. It is safe for other
606    /// threads to make concurrent requests while waiting for an event.
607    pub fn wait_for_event(
608        &self,
609        deadline: zx::MonotonicInstant,
610    ) -> Result<TouchSourceWithLocalHitEvent, fidl::Error> {
611        TouchSourceWithLocalHitEvent::decode(self.client.wait_for_event(deadline)?)
612    }
613
614    /// Identical usage to [`fuchsia.ui.pointer.TouchSource.Watch`], but with
615    /// augmented data.
616    pub fn r#watch(
617        &self,
618        mut responses: &[fidl_fuchsia_ui_pointer::TouchResponse],
619        ___deadline: zx::MonotonicInstant,
620    ) -> Result<Vec<TouchEventWithLocalHit>, fidl::Error> {
621        let _response = self.client.send_query::<
622            TouchSourceWithLocalHitWatchRequest,
623            TouchSourceWithLocalHitWatchResponse,
624        >(
625            (responses,),
626            0x4eb5acc052ada449,
627            fidl::encoding::DynamicFlags::empty(),
628            ___deadline,
629        )?;
630        Ok(_response.events)
631    }
632
633    /// Identical usage to [`fuchsia.ui.pointer.TouchSource.UpdateResponse`].
634    pub fn r#update_response(
635        &self,
636        mut interaction: &fidl_fuchsia_ui_pointer::TouchInteractionId,
637        mut response: &fidl_fuchsia_ui_pointer::TouchResponse,
638        ___deadline: zx::MonotonicInstant,
639    ) -> Result<(), fidl::Error> {
640        let _response = self.client.send_query::<
641            TouchSourceWithLocalHitUpdateResponseRequest,
642            fidl::encoding::EmptyPayload,
643        >(
644            (interaction, response,),
645            0x1f2fde6734e7da1,
646            fidl::encoding::DynamicFlags::empty(),
647            ___deadline,
648        )?;
649        Ok(_response)
650    }
651}
652
653#[cfg(target_os = "fuchsia")]
654impl From<TouchSourceWithLocalHitSynchronousProxy> for zx::Handle {
655    fn from(value: TouchSourceWithLocalHitSynchronousProxy) -> Self {
656        value.into_channel().into()
657    }
658}
659
660#[cfg(target_os = "fuchsia")]
661impl From<fidl::Channel> for TouchSourceWithLocalHitSynchronousProxy {
662    fn from(value: fidl::Channel) -> Self {
663        Self::new(value)
664    }
665}
666
667#[derive(Debug, Clone)]
668pub struct TouchSourceWithLocalHitProxy {
669    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
670}
671
672impl fidl::endpoints::Proxy for TouchSourceWithLocalHitProxy {
673    type Protocol = TouchSourceWithLocalHitMarker;
674
675    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
676        Self::new(inner)
677    }
678
679    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
680        self.client.into_channel().map_err(|client| Self { client })
681    }
682
683    fn as_channel(&self) -> &::fidl::AsyncChannel {
684        self.client.as_channel()
685    }
686}
687
688impl TouchSourceWithLocalHitProxy {
689    /// Create a new Proxy for fuchsia.ui.pointer.augment/TouchSourceWithLocalHit.
690    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
691        let protocol_name =
692            <TouchSourceWithLocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
693        Self { client: fidl::client::Client::new(channel, protocol_name) }
694    }
695
696    /// Get a Stream of events from the remote end of the protocol.
697    ///
698    /// # Panics
699    ///
700    /// Panics if the event stream was already taken.
701    pub fn take_event_stream(&self) -> TouchSourceWithLocalHitEventStream {
702        TouchSourceWithLocalHitEventStream { event_receiver: self.client.take_event_receiver() }
703    }
704
705    /// Identical usage to [`fuchsia.ui.pointer.TouchSource.Watch`], but with
706    /// augmented data.
707    pub fn r#watch(
708        &self,
709        mut responses: &[fidl_fuchsia_ui_pointer::TouchResponse],
710    ) -> fidl::client::QueryResponseFut<
711        Vec<TouchEventWithLocalHit>,
712        fidl::encoding::DefaultFuchsiaResourceDialect,
713    > {
714        TouchSourceWithLocalHitProxyInterface::r#watch(self, responses)
715    }
716
717    /// Identical usage to [`fuchsia.ui.pointer.TouchSource.UpdateResponse`].
718    pub fn r#update_response(
719        &self,
720        mut interaction: &fidl_fuchsia_ui_pointer::TouchInteractionId,
721        mut response: &fidl_fuchsia_ui_pointer::TouchResponse,
722    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
723        TouchSourceWithLocalHitProxyInterface::r#update_response(self, interaction, response)
724    }
725}
726
727impl TouchSourceWithLocalHitProxyInterface for TouchSourceWithLocalHitProxy {
728    type WatchResponseFut = fidl::client::QueryResponseFut<
729        Vec<TouchEventWithLocalHit>,
730        fidl::encoding::DefaultFuchsiaResourceDialect,
731    >;
732    fn r#watch(
733        &self,
734        mut responses: &[fidl_fuchsia_ui_pointer::TouchResponse],
735    ) -> Self::WatchResponseFut {
736        fn _decode(
737            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
738        ) -> Result<Vec<TouchEventWithLocalHit>, fidl::Error> {
739            let _response = fidl::client::decode_transaction_body::<
740                TouchSourceWithLocalHitWatchResponse,
741                fidl::encoding::DefaultFuchsiaResourceDialect,
742                0x4eb5acc052ada449,
743            >(_buf?)?;
744            Ok(_response.events)
745        }
746        self.client.send_query_and_decode::<
747            TouchSourceWithLocalHitWatchRequest,
748            Vec<TouchEventWithLocalHit>,
749        >(
750            (responses,),
751            0x4eb5acc052ada449,
752            fidl::encoding::DynamicFlags::empty(),
753            _decode,
754        )
755    }
756
757    type UpdateResponseResponseFut =
758        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
759    fn r#update_response(
760        &self,
761        mut interaction: &fidl_fuchsia_ui_pointer::TouchInteractionId,
762        mut response: &fidl_fuchsia_ui_pointer::TouchResponse,
763    ) -> Self::UpdateResponseResponseFut {
764        fn _decode(
765            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
766        ) -> Result<(), fidl::Error> {
767            let _response = fidl::client::decode_transaction_body::<
768                fidl::encoding::EmptyPayload,
769                fidl::encoding::DefaultFuchsiaResourceDialect,
770                0x1f2fde6734e7da1,
771            >(_buf?)?;
772            Ok(_response)
773        }
774        self.client.send_query_and_decode::<TouchSourceWithLocalHitUpdateResponseRequest, ()>(
775            (interaction, response),
776            0x1f2fde6734e7da1,
777            fidl::encoding::DynamicFlags::empty(),
778            _decode,
779        )
780    }
781}
782
783pub struct TouchSourceWithLocalHitEventStream {
784    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
785}
786
787impl std::marker::Unpin for TouchSourceWithLocalHitEventStream {}
788
789impl futures::stream::FusedStream for TouchSourceWithLocalHitEventStream {
790    fn is_terminated(&self) -> bool {
791        self.event_receiver.is_terminated()
792    }
793}
794
795impl futures::Stream for TouchSourceWithLocalHitEventStream {
796    type Item = Result<TouchSourceWithLocalHitEvent, fidl::Error>;
797
798    fn poll_next(
799        mut self: std::pin::Pin<&mut Self>,
800        cx: &mut std::task::Context<'_>,
801    ) -> std::task::Poll<Option<Self::Item>> {
802        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
803            &mut self.event_receiver,
804            cx
805        )?) {
806            Some(buf) => std::task::Poll::Ready(Some(TouchSourceWithLocalHitEvent::decode(buf))),
807            None => std::task::Poll::Ready(None),
808        }
809    }
810}
811
812#[derive(Debug)]
813pub enum TouchSourceWithLocalHitEvent {}
814
815impl TouchSourceWithLocalHitEvent {
816    /// Decodes a message buffer as a [`TouchSourceWithLocalHitEvent`].
817    fn decode(
818        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
819    ) -> Result<TouchSourceWithLocalHitEvent, fidl::Error> {
820        let (bytes, _handles) = buf.split_mut();
821        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
822        debug_assert_eq!(tx_header.tx_id, 0);
823        match tx_header.ordinal {
824            _ => Err(fidl::Error::UnknownOrdinal {
825                ordinal: tx_header.ordinal,
826                protocol_name:
827                    <TouchSourceWithLocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
828            }),
829        }
830    }
831}
832
833/// A Stream of incoming requests for fuchsia.ui.pointer.augment/TouchSourceWithLocalHit.
834pub struct TouchSourceWithLocalHitRequestStream {
835    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
836    is_terminated: bool,
837}
838
839impl std::marker::Unpin for TouchSourceWithLocalHitRequestStream {}
840
841impl futures::stream::FusedStream for TouchSourceWithLocalHitRequestStream {
842    fn is_terminated(&self) -> bool {
843        self.is_terminated
844    }
845}
846
847impl fidl::endpoints::RequestStream for TouchSourceWithLocalHitRequestStream {
848    type Protocol = TouchSourceWithLocalHitMarker;
849    type ControlHandle = TouchSourceWithLocalHitControlHandle;
850
851    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
852        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
853    }
854
855    fn control_handle(&self) -> Self::ControlHandle {
856        TouchSourceWithLocalHitControlHandle { inner: self.inner.clone() }
857    }
858
859    fn into_inner(
860        self,
861    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
862    {
863        (self.inner, self.is_terminated)
864    }
865
866    fn from_inner(
867        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
868        is_terminated: bool,
869    ) -> Self {
870        Self { inner, is_terminated }
871    }
872}
873
874impl futures::Stream for TouchSourceWithLocalHitRequestStream {
875    type Item = Result<TouchSourceWithLocalHitRequest, fidl::Error>;
876
877    fn poll_next(
878        mut self: std::pin::Pin<&mut Self>,
879        cx: &mut std::task::Context<'_>,
880    ) -> std::task::Poll<Option<Self::Item>> {
881        let this = &mut *self;
882        if this.inner.check_shutdown(cx) {
883            this.is_terminated = true;
884            return std::task::Poll::Ready(None);
885        }
886        if this.is_terminated {
887            panic!("polled TouchSourceWithLocalHitRequestStream after completion");
888        }
889        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
890            |bytes, handles| {
891                match this.inner.channel().read_etc(cx, bytes, handles) {
892                    std::task::Poll::Ready(Ok(())) => {}
893                    std::task::Poll::Pending => return std::task::Poll::Pending,
894                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
895                        this.is_terminated = true;
896                        return std::task::Poll::Ready(None);
897                    }
898                    std::task::Poll::Ready(Err(e)) => {
899                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
900                            e.into(),
901                        ))))
902                    }
903                }
904
905                // A message has been received from the channel
906                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
907
908                std::task::Poll::Ready(Some(match header.ordinal {
909                0x4eb5acc052ada449 => {
910                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
911                    let mut req = fidl::new_empty!(TouchSourceWithLocalHitWatchRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
912                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchSourceWithLocalHitWatchRequest>(&header, _body_bytes, handles, &mut req)?;
913                    let control_handle = TouchSourceWithLocalHitControlHandle {
914                        inner: this.inner.clone(),
915                    };
916                    Ok(TouchSourceWithLocalHitRequest::Watch {responses: req.responses,
917
918                        responder: TouchSourceWithLocalHitWatchResponder {
919                            control_handle: std::mem::ManuallyDrop::new(control_handle),
920                            tx_id: header.tx_id,
921                        },
922                    })
923                }
924                0x1f2fde6734e7da1 => {
925                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
926                    let mut req = fidl::new_empty!(TouchSourceWithLocalHitUpdateResponseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
927                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TouchSourceWithLocalHitUpdateResponseRequest>(&header, _body_bytes, handles, &mut req)?;
928                    let control_handle = TouchSourceWithLocalHitControlHandle {
929                        inner: this.inner.clone(),
930                    };
931                    Ok(TouchSourceWithLocalHitRequest::UpdateResponse {interaction: req.interaction,
932response: req.response,
933
934                        responder: TouchSourceWithLocalHitUpdateResponseResponder {
935                            control_handle: std::mem::ManuallyDrop::new(control_handle),
936                            tx_id: header.tx_id,
937                        },
938                    })
939                }
940                _ => Err(fidl::Error::UnknownOrdinal {
941                    ordinal: header.ordinal,
942                    protocol_name: <TouchSourceWithLocalHitMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
943                }),
944            }))
945            },
946        )
947    }
948}
949
950/// Like [`fuchsia.ui.pointer.TouchSource`], but with additional information
951/// about the local-hit position of touch events, and otherwise identical in
952/// operation. See [`fuchsia.ui.pointer.TouchSource`] for regular usage
953/// information.
954#[derive(Debug)]
955pub enum TouchSourceWithLocalHitRequest {
956    /// Identical usage to [`fuchsia.ui.pointer.TouchSource.Watch`], but with
957    /// augmented data.
958    Watch {
959        responses: Vec<fidl_fuchsia_ui_pointer::TouchResponse>,
960        responder: TouchSourceWithLocalHitWatchResponder,
961    },
962    /// Identical usage to [`fuchsia.ui.pointer.TouchSource.UpdateResponse`].
963    UpdateResponse {
964        interaction: fidl_fuchsia_ui_pointer::TouchInteractionId,
965        response: fidl_fuchsia_ui_pointer::TouchResponse,
966        responder: TouchSourceWithLocalHitUpdateResponseResponder,
967    },
968}
969
970impl TouchSourceWithLocalHitRequest {
971    #[allow(irrefutable_let_patterns)]
972    pub fn into_watch(
973        self,
974    ) -> Option<(Vec<fidl_fuchsia_ui_pointer::TouchResponse>, TouchSourceWithLocalHitWatchResponder)>
975    {
976        if let TouchSourceWithLocalHitRequest::Watch { responses, responder } = self {
977            Some((responses, responder))
978        } else {
979            None
980        }
981    }
982
983    #[allow(irrefutable_let_patterns)]
984    pub fn into_update_response(
985        self,
986    ) -> Option<(
987        fidl_fuchsia_ui_pointer::TouchInteractionId,
988        fidl_fuchsia_ui_pointer::TouchResponse,
989        TouchSourceWithLocalHitUpdateResponseResponder,
990    )> {
991        if let TouchSourceWithLocalHitRequest::UpdateResponse { interaction, response, responder } =
992            self
993        {
994            Some((interaction, response, responder))
995        } else {
996            None
997        }
998    }
999
1000    /// Name of the method defined in FIDL
1001    pub fn method_name(&self) -> &'static str {
1002        match *self {
1003            TouchSourceWithLocalHitRequest::Watch { .. } => "watch",
1004            TouchSourceWithLocalHitRequest::UpdateResponse { .. } => "update_response",
1005        }
1006    }
1007}
1008
1009#[derive(Debug, Clone)]
1010pub struct TouchSourceWithLocalHitControlHandle {
1011    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1012}
1013
1014impl fidl::endpoints::ControlHandle for TouchSourceWithLocalHitControlHandle {
1015    fn shutdown(&self) {
1016        self.inner.shutdown()
1017    }
1018    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1019        self.inner.shutdown_with_epitaph(status)
1020    }
1021
1022    fn is_closed(&self) -> bool {
1023        self.inner.channel().is_closed()
1024    }
1025    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1026        self.inner.channel().on_closed()
1027    }
1028
1029    #[cfg(target_os = "fuchsia")]
1030    fn signal_peer(
1031        &self,
1032        clear_mask: zx::Signals,
1033        set_mask: zx::Signals,
1034    ) -> Result<(), zx_status::Status> {
1035        use fidl::Peered;
1036        self.inner.channel().signal_peer(clear_mask, set_mask)
1037    }
1038}
1039
1040impl TouchSourceWithLocalHitControlHandle {}
1041
1042#[must_use = "FIDL methods require a response to be sent"]
1043#[derive(Debug)]
1044pub struct TouchSourceWithLocalHitWatchResponder {
1045    control_handle: std::mem::ManuallyDrop<TouchSourceWithLocalHitControlHandle>,
1046    tx_id: u32,
1047}
1048
1049/// Set the the channel to be shutdown (see [`TouchSourceWithLocalHitControlHandle::shutdown`])
1050/// if the responder is dropped without sending a response, so that the client
1051/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1052impl std::ops::Drop for TouchSourceWithLocalHitWatchResponder {
1053    fn drop(&mut self) {
1054        self.control_handle.shutdown();
1055        // Safety: drops once, never accessed again
1056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1057    }
1058}
1059
1060impl fidl::endpoints::Responder for TouchSourceWithLocalHitWatchResponder {
1061    type ControlHandle = TouchSourceWithLocalHitControlHandle;
1062
1063    fn control_handle(&self) -> &TouchSourceWithLocalHitControlHandle {
1064        &self.control_handle
1065    }
1066
1067    fn drop_without_shutdown(mut self) {
1068        // Safety: drops once, never accessed again due to mem::forget
1069        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1070        // Prevent Drop from running (which would shut down the channel)
1071        std::mem::forget(self);
1072    }
1073}
1074
1075impl TouchSourceWithLocalHitWatchResponder {
1076    /// Sends a response to the FIDL transaction.
1077    ///
1078    /// Sets the channel to shutdown if an error occurs.
1079    pub fn send(self, mut events: &[TouchEventWithLocalHit]) -> Result<(), fidl::Error> {
1080        let _result = self.send_raw(events);
1081        if _result.is_err() {
1082            self.control_handle.shutdown();
1083        }
1084        self.drop_without_shutdown();
1085        _result
1086    }
1087
1088    /// Similar to "send" but does not shutdown the channel if an error occurs.
1089    pub fn send_no_shutdown_on_err(
1090        self,
1091        mut events: &[TouchEventWithLocalHit],
1092    ) -> Result<(), fidl::Error> {
1093        let _result = self.send_raw(events);
1094        self.drop_without_shutdown();
1095        _result
1096    }
1097
1098    fn send_raw(&self, mut events: &[TouchEventWithLocalHit]) -> Result<(), fidl::Error> {
1099        self.control_handle.inner.send::<TouchSourceWithLocalHitWatchResponse>(
1100            (events,),
1101            self.tx_id,
1102            0x4eb5acc052ada449,
1103            fidl::encoding::DynamicFlags::empty(),
1104        )
1105    }
1106}
1107
1108#[must_use = "FIDL methods require a response to be sent"]
1109#[derive(Debug)]
1110pub struct TouchSourceWithLocalHitUpdateResponseResponder {
1111    control_handle: std::mem::ManuallyDrop<TouchSourceWithLocalHitControlHandle>,
1112    tx_id: u32,
1113}
1114
1115/// Set the the channel to be shutdown (see [`TouchSourceWithLocalHitControlHandle::shutdown`])
1116/// if the responder is dropped without sending a response, so that the client
1117/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1118impl std::ops::Drop for TouchSourceWithLocalHitUpdateResponseResponder {
1119    fn drop(&mut self) {
1120        self.control_handle.shutdown();
1121        // Safety: drops once, never accessed again
1122        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1123    }
1124}
1125
1126impl fidl::endpoints::Responder for TouchSourceWithLocalHitUpdateResponseResponder {
1127    type ControlHandle = TouchSourceWithLocalHitControlHandle;
1128
1129    fn control_handle(&self) -> &TouchSourceWithLocalHitControlHandle {
1130        &self.control_handle
1131    }
1132
1133    fn drop_without_shutdown(mut self) {
1134        // Safety: drops once, never accessed again due to mem::forget
1135        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1136        // Prevent Drop from running (which would shut down the channel)
1137        std::mem::forget(self);
1138    }
1139}
1140
1141impl TouchSourceWithLocalHitUpdateResponseResponder {
1142    /// Sends a response to the FIDL transaction.
1143    ///
1144    /// Sets the channel to shutdown if an error occurs.
1145    pub fn send(self) -> Result<(), fidl::Error> {
1146        let _result = self.send_raw();
1147        if _result.is_err() {
1148            self.control_handle.shutdown();
1149        }
1150        self.drop_without_shutdown();
1151        _result
1152    }
1153
1154    /// Similar to "send" but does not shutdown the channel if an error occurs.
1155    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1156        let _result = self.send_raw();
1157        self.drop_without_shutdown();
1158        _result
1159    }
1160
1161    fn send_raw(&self) -> Result<(), fidl::Error> {
1162        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1163            (),
1164            self.tx_id,
1165            0x1f2fde6734e7da1,
1166            fidl::encoding::DynamicFlags::empty(),
1167        )
1168    }
1169}
1170
1171mod internal {
1172    use super::*;
1173
1174    impl fidl::encoding::ResourceTypeMarker for ErrorForLocalHit {
1175        type Borrowed<'a> = &'a mut Self;
1176        fn take_or_borrow<'a>(
1177            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1178        ) -> Self::Borrowed<'a> {
1179            value
1180        }
1181    }
1182
1183    unsafe impl fidl::encoding::TypeMarker for ErrorForLocalHit {
1184        type Owned = Self;
1185
1186        #[inline(always)]
1187        fn inline_align(_context: fidl::encoding::Context) -> usize {
1188            4
1189        }
1190
1191        #[inline(always)]
1192        fn inline_size(_context: fidl::encoding::Context) -> usize {
1193            8
1194        }
1195    }
1196
1197    unsafe impl
1198        fidl::encoding::Encode<ErrorForLocalHit, fidl::encoding::DefaultFuchsiaResourceDialect>
1199        for &mut ErrorForLocalHit
1200    {
1201        #[inline]
1202        unsafe fn encode(
1203            self,
1204            encoder: &mut fidl::encoding::Encoder<
1205                '_,
1206                fidl::encoding::DefaultFuchsiaResourceDialect,
1207            >,
1208            offset: usize,
1209            _depth: fidl::encoding::Depth,
1210        ) -> fidl::Result<()> {
1211            encoder.debug_check_bounds::<ErrorForLocalHit>(offset);
1212            // Delegate to tuple encoding.
1213            fidl::encoding::Encode::<ErrorForLocalHit, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1214                (
1215                    <ErrorReason as fidl::encoding::ValueTypeMarker>::borrow(&self.error_reason),
1216                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.original),
1217                ),
1218                encoder, offset, _depth
1219            )
1220        }
1221    }
1222    unsafe impl<
1223            T0: fidl::encoding::Encode<ErrorReason, fidl::encoding::DefaultFuchsiaResourceDialect>,
1224            T1: fidl::encoding::Encode<
1225                fidl::encoding::Endpoint<
1226                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1227                >,
1228                fidl::encoding::DefaultFuchsiaResourceDialect,
1229            >,
1230        >
1231        fidl::encoding::Encode<ErrorForLocalHit, fidl::encoding::DefaultFuchsiaResourceDialect>
1232        for (T0, T1)
1233    {
1234        #[inline]
1235        unsafe fn encode(
1236            self,
1237            encoder: &mut fidl::encoding::Encoder<
1238                '_,
1239                fidl::encoding::DefaultFuchsiaResourceDialect,
1240            >,
1241            offset: usize,
1242            depth: fidl::encoding::Depth,
1243        ) -> fidl::Result<()> {
1244            encoder.debug_check_bounds::<ErrorForLocalHit>(offset);
1245            // Zero out padding regions. There's no need to apply masks
1246            // because the unmasked parts will be overwritten by fields.
1247            // Write the fields.
1248            self.0.encode(encoder, offset + 0, depth)?;
1249            self.1.encode(encoder, offset + 4, depth)?;
1250            Ok(())
1251        }
1252    }
1253
1254    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1255        for ErrorForLocalHit
1256    {
1257        #[inline(always)]
1258        fn new_empty() -> Self {
1259            Self {
1260                error_reason: fidl::new_empty!(
1261                    ErrorReason,
1262                    fidl::encoding::DefaultFuchsiaResourceDialect
1263                ),
1264                original: fidl::new_empty!(
1265                    fidl::encoding::Endpoint<
1266                        fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1267                    >,
1268                    fidl::encoding::DefaultFuchsiaResourceDialect
1269                ),
1270            }
1271        }
1272
1273        #[inline]
1274        unsafe fn decode(
1275            &mut self,
1276            decoder: &mut fidl::encoding::Decoder<
1277                '_,
1278                fidl::encoding::DefaultFuchsiaResourceDialect,
1279            >,
1280            offset: usize,
1281            _depth: fidl::encoding::Depth,
1282        ) -> fidl::Result<()> {
1283            decoder.debug_check_bounds::<Self>(offset);
1284            // Verify that padding bytes are zero.
1285            fidl::decode!(
1286                ErrorReason,
1287                fidl::encoding::DefaultFuchsiaResourceDialect,
1288                &mut self.error_reason,
1289                decoder,
1290                offset + 0,
1291                _depth
1292            )?;
1293            fidl::decode!(
1294                fidl::encoding::Endpoint<
1295                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1296                >,
1297                fidl::encoding::DefaultFuchsiaResourceDialect,
1298                &mut self.original,
1299                decoder,
1300                offset + 4,
1301                _depth
1302            )?;
1303            Ok(())
1304        }
1305    }
1306
1307    impl fidl::encoding::ResourceTypeMarker for LocalHitUpgradeRequest {
1308        type Borrowed<'a> = &'a mut Self;
1309        fn take_or_borrow<'a>(
1310            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1311        ) -> Self::Borrowed<'a> {
1312            value
1313        }
1314    }
1315
1316    unsafe impl fidl::encoding::TypeMarker for LocalHitUpgradeRequest {
1317        type Owned = Self;
1318
1319        #[inline(always)]
1320        fn inline_align(_context: fidl::encoding::Context) -> usize {
1321            4
1322        }
1323
1324        #[inline(always)]
1325        fn inline_size(_context: fidl::encoding::Context) -> usize {
1326            4
1327        }
1328    }
1329
1330    unsafe impl
1331        fidl::encoding::Encode<
1332            LocalHitUpgradeRequest,
1333            fidl::encoding::DefaultFuchsiaResourceDialect,
1334        > for &mut LocalHitUpgradeRequest
1335    {
1336        #[inline]
1337        unsafe fn encode(
1338            self,
1339            encoder: &mut fidl::encoding::Encoder<
1340                '_,
1341                fidl::encoding::DefaultFuchsiaResourceDialect,
1342            >,
1343            offset: usize,
1344            _depth: fidl::encoding::Depth,
1345        ) -> fidl::Result<()> {
1346            encoder.debug_check_bounds::<LocalHitUpgradeRequest>(offset);
1347            // Delegate to tuple encoding.
1348            fidl::encoding::Encode::<
1349                LocalHitUpgradeRequest,
1350                fidl::encoding::DefaultFuchsiaResourceDialect,
1351            >::encode(
1352                (<fidl::encoding::Endpoint<
1353                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1354                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1355                    &mut self.original
1356                ),),
1357                encoder,
1358                offset,
1359                _depth,
1360            )
1361        }
1362    }
1363    unsafe impl<
1364            T0: fidl::encoding::Encode<
1365                fidl::encoding::Endpoint<
1366                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1367                >,
1368                fidl::encoding::DefaultFuchsiaResourceDialect,
1369            >,
1370        >
1371        fidl::encoding::Encode<
1372            LocalHitUpgradeRequest,
1373            fidl::encoding::DefaultFuchsiaResourceDialect,
1374        > for (T0,)
1375    {
1376        #[inline]
1377        unsafe fn encode(
1378            self,
1379            encoder: &mut fidl::encoding::Encoder<
1380                '_,
1381                fidl::encoding::DefaultFuchsiaResourceDialect,
1382            >,
1383            offset: usize,
1384            depth: fidl::encoding::Depth,
1385        ) -> fidl::Result<()> {
1386            encoder.debug_check_bounds::<LocalHitUpgradeRequest>(offset);
1387            // Zero out padding regions. There's no need to apply masks
1388            // because the unmasked parts will be overwritten by fields.
1389            // Write the fields.
1390            self.0.encode(encoder, offset + 0, depth)?;
1391            Ok(())
1392        }
1393    }
1394
1395    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1396        for LocalHitUpgradeRequest
1397    {
1398        #[inline(always)]
1399        fn new_empty() -> Self {
1400            Self {
1401                original: fidl::new_empty!(
1402                    fidl::encoding::Endpoint<
1403                        fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1404                    >,
1405                    fidl::encoding::DefaultFuchsiaResourceDialect
1406                ),
1407            }
1408        }
1409
1410        #[inline]
1411        unsafe fn decode(
1412            &mut self,
1413            decoder: &mut fidl::encoding::Decoder<
1414                '_,
1415                fidl::encoding::DefaultFuchsiaResourceDialect,
1416            >,
1417            offset: usize,
1418            _depth: fidl::encoding::Depth,
1419        ) -> fidl::Result<()> {
1420            decoder.debug_check_bounds::<Self>(offset);
1421            // Verify that padding bytes are zero.
1422            fidl::decode!(
1423                fidl::encoding::Endpoint<
1424                    fidl::endpoints::ClientEnd<fidl_fuchsia_ui_pointer::TouchSourceMarker>,
1425                >,
1426                fidl::encoding::DefaultFuchsiaResourceDialect,
1427                &mut self.original,
1428                decoder,
1429                offset + 0,
1430                _depth
1431            )?;
1432            Ok(())
1433        }
1434    }
1435
1436    impl fidl::encoding::ResourceTypeMarker for LocalHitUpgradeResponse {
1437        type Borrowed<'a> = &'a mut Self;
1438        fn take_or_borrow<'a>(
1439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1440        ) -> Self::Borrowed<'a> {
1441            value
1442        }
1443    }
1444
1445    unsafe impl fidl::encoding::TypeMarker for LocalHitUpgradeResponse {
1446        type Owned = Self;
1447
1448        #[inline(always)]
1449        fn inline_align(_context: fidl::encoding::Context) -> usize {
1450            8
1451        }
1452
1453        #[inline(always)]
1454        fn inline_size(_context: fidl::encoding::Context) -> usize {
1455            16
1456        }
1457    }
1458
1459    unsafe impl
1460        fidl::encoding::Encode<
1461            LocalHitUpgradeResponse,
1462            fidl::encoding::DefaultFuchsiaResourceDialect,
1463        > for &mut LocalHitUpgradeResponse
1464    {
1465        #[inline]
1466        unsafe fn encode(
1467            self,
1468            encoder: &mut fidl::encoding::Encoder<
1469                '_,
1470                fidl::encoding::DefaultFuchsiaResourceDialect,
1471            >,
1472            offset: usize,
1473            _depth: fidl::encoding::Depth,
1474        ) -> fidl::Result<()> {
1475            encoder.debug_check_bounds::<LocalHitUpgradeResponse>(offset);
1476            // Delegate to tuple encoding.
1477            fidl::encoding::Encode::<LocalHitUpgradeResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1478                (
1479                    <fidl::encoding::Optional<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.augmented),
1480                    <fidl::encoding::Boxed<ErrorForLocalHit> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.error),
1481                ),
1482                encoder, offset, _depth
1483            )
1484        }
1485    }
1486    unsafe impl<
1487            T0: fidl::encoding::Encode<
1488                fidl::encoding::Optional<
1489                    fidl::encoding::Endpoint<
1490                        fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>,
1491                    >,
1492                >,
1493                fidl::encoding::DefaultFuchsiaResourceDialect,
1494            >,
1495            T1: fidl::encoding::Encode<
1496                fidl::encoding::Boxed<ErrorForLocalHit>,
1497                fidl::encoding::DefaultFuchsiaResourceDialect,
1498            >,
1499        >
1500        fidl::encoding::Encode<
1501            LocalHitUpgradeResponse,
1502            fidl::encoding::DefaultFuchsiaResourceDialect,
1503        > for (T0, T1)
1504    {
1505        #[inline]
1506        unsafe fn encode(
1507            self,
1508            encoder: &mut fidl::encoding::Encoder<
1509                '_,
1510                fidl::encoding::DefaultFuchsiaResourceDialect,
1511            >,
1512            offset: usize,
1513            depth: fidl::encoding::Depth,
1514        ) -> fidl::Result<()> {
1515            encoder.debug_check_bounds::<LocalHitUpgradeResponse>(offset);
1516            // Zero out padding regions. There's no need to apply masks
1517            // because the unmasked parts will be overwritten by fields.
1518            unsafe {
1519                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1520                (ptr as *mut u64).write_unaligned(0);
1521            }
1522            // Write the fields.
1523            self.0.encode(encoder, offset + 0, depth)?;
1524            self.1.encode(encoder, offset + 8, depth)?;
1525            Ok(())
1526        }
1527    }
1528
1529    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1530        for LocalHitUpgradeResponse
1531    {
1532        #[inline(always)]
1533        fn new_empty() -> Self {
1534            Self {
1535                augmented: fidl::new_empty!(
1536                    fidl::encoding::Optional<
1537                        fidl::encoding::Endpoint<
1538                            fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>,
1539                        >,
1540                    >,
1541                    fidl::encoding::DefaultFuchsiaResourceDialect
1542                ),
1543                error: fidl::new_empty!(
1544                    fidl::encoding::Boxed<ErrorForLocalHit>,
1545                    fidl::encoding::DefaultFuchsiaResourceDialect
1546                ),
1547            }
1548        }
1549
1550        #[inline]
1551        unsafe fn decode(
1552            &mut self,
1553            decoder: &mut fidl::encoding::Decoder<
1554                '_,
1555                fidl::encoding::DefaultFuchsiaResourceDialect,
1556            >,
1557            offset: usize,
1558            _depth: fidl::encoding::Depth,
1559        ) -> fidl::Result<()> {
1560            decoder.debug_check_bounds::<Self>(offset);
1561            // Verify that padding bytes are zero.
1562            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1563            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1564            let mask = 0xffffffff00000000u64;
1565            let maskedval = padval & mask;
1566            if maskedval != 0 {
1567                return Err(fidl::Error::NonZeroPadding {
1568                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1569                });
1570            }
1571            fidl::decode!(
1572                fidl::encoding::Optional<
1573                    fidl::encoding::Endpoint<
1574                        fidl::endpoints::ClientEnd<TouchSourceWithLocalHitMarker>,
1575                    >,
1576                >,
1577                fidl::encoding::DefaultFuchsiaResourceDialect,
1578                &mut self.augmented,
1579                decoder,
1580                offset + 0,
1581                _depth
1582            )?;
1583            fidl::decode!(
1584                fidl::encoding::Boxed<ErrorForLocalHit>,
1585                fidl::encoding::DefaultFuchsiaResourceDialect,
1586                &mut self.error,
1587                decoder,
1588                offset + 8,
1589                _depth
1590            )?;
1591            Ok(())
1592        }
1593    }
1594}