fidl_fuchsia_ui_pointer_augment/
fidl_fuchsia_ui_pointer_augment.rs

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