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