Skip to main content

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