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