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