fidl_fuchsia_compat_runtime_test/
fidl_fuchsia_compat_runtime_test.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_compat_runtime_test_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct LeafMarker;
16
17impl fidl::endpoints::ProtocolMarker for LeafMarker {
18    type Proxy = LeafProxy;
19    type RequestStream = LeafRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = LeafSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "(anonymous) Leaf";
24}
25
26pub trait LeafProxyInterface: Send + Sync {
27    type GetStringResponseFut: std::future::Future<Output = Result<String, fidl::Error>> + Send;
28    fn r#get_string(&self) -> Self::GetStringResponseFut;
29}
30#[derive(Debug)]
31#[cfg(target_os = "fuchsia")]
32pub struct LeafSynchronousProxy {
33    client: fidl::client::sync::Client,
34}
35
36#[cfg(target_os = "fuchsia")]
37impl fidl::endpoints::SynchronousProxy for LeafSynchronousProxy {
38    type Proxy = LeafProxy;
39    type Protocol = LeafMarker;
40
41    fn from_channel(inner: fidl::Channel) -> Self {
42        Self::new(inner)
43    }
44
45    fn into_channel(self) -> fidl::Channel {
46        self.client.into_channel()
47    }
48
49    fn as_channel(&self) -> &fidl::Channel {
50        self.client.as_channel()
51    }
52}
53
54#[cfg(target_os = "fuchsia")]
55impl LeafSynchronousProxy {
56    pub fn new(channel: fidl::Channel) -> Self {
57        let protocol_name = <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
58        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
59    }
60
61    pub fn into_channel(self) -> fidl::Channel {
62        self.client.into_channel()
63    }
64
65    /// Waits until an event arrives and returns it. It is safe for other
66    /// threads to make concurrent requests while waiting for an event.
67    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<LeafEvent, fidl::Error> {
68        LeafEvent::decode(self.client.wait_for_event(deadline)?)
69    }
70
71    pub fn r#get_string(&self, ___deadline: zx::MonotonicInstant) -> Result<String, fidl::Error> {
72        let _response =
73            self.client.send_query::<fidl::encoding::EmptyPayload, LeafGetStringResponse>(
74                (),
75                0x765999b3a5e5cbcc,
76                fidl::encoding::DynamicFlags::empty(),
77                ___deadline,
78            )?;
79        Ok(_response.response)
80    }
81}
82
83#[derive(Debug, Clone)]
84pub struct LeafProxy {
85    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
86}
87
88impl fidl::endpoints::Proxy for LeafProxy {
89    type Protocol = LeafMarker;
90
91    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
92        Self::new(inner)
93    }
94
95    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
96        self.client.into_channel().map_err(|client| Self { client })
97    }
98
99    fn as_channel(&self) -> &::fidl::AsyncChannel {
100        self.client.as_channel()
101    }
102}
103
104impl LeafProxy {
105    /// Create a new Proxy for fuchsia.compat.runtime.test/Leaf.
106    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
107        let protocol_name = <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
108        Self { client: fidl::client::Client::new(channel, protocol_name) }
109    }
110
111    /// Get a Stream of events from the remote end of the protocol.
112    ///
113    /// # Panics
114    ///
115    /// Panics if the event stream was already taken.
116    pub fn take_event_stream(&self) -> LeafEventStream {
117        LeafEventStream { event_receiver: self.client.take_event_receiver() }
118    }
119
120    pub fn r#get_string(
121        &self,
122    ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
123        LeafProxyInterface::r#get_string(self)
124    }
125}
126
127impl LeafProxyInterface for LeafProxy {
128    type GetStringResponseFut =
129        fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
130    fn r#get_string(&self) -> Self::GetStringResponseFut {
131        fn _decode(
132            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
133        ) -> Result<String, fidl::Error> {
134            let _response = fidl::client::decode_transaction_body::<
135                LeafGetStringResponse,
136                fidl::encoding::DefaultFuchsiaResourceDialect,
137                0x765999b3a5e5cbcc,
138            >(_buf?)?;
139            Ok(_response.response)
140        }
141        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
142            (),
143            0x765999b3a5e5cbcc,
144            fidl::encoding::DynamicFlags::empty(),
145            _decode,
146        )
147    }
148}
149
150pub struct LeafEventStream {
151    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
152}
153
154impl std::marker::Unpin for LeafEventStream {}
155
156impl futures::stream::FusedStream for LeafEventStream {
157    fn is_terminated(&self) -> bool {
158        self.event_receiver.is_terminated()
159    }
160}
161
162impl futures::Stream for LeafEventStream {
163    type Item = Result<LeafEvent, fidl::Error>;
164
165    fn poll_next(
166        mut self: std::pin::Pin<&mut Self>,
167        cx: &mut std::task::Context<'_>,
168    ) -> std::task::Poll<Option<Self::Item>> {
169        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
170            &mut self.event_receiver,
171            cx
172        )?) {
173            Some(buf) => std::task::Poll::Ready(Some(LeafEvent::decode(buf))),
174            None => std::task::Poll::Ready(None),
175        }
176    }
177}
178
179#[derive(Debug)]
180pub enum LeafEvent {}
181
182impl LeafEvent {
183    /// Decodes a message buffer as a [`LeafEvent`].
184    fn decode(
185        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
186    ) -> Result<LeafEvent, fidl::Error> {
187        let (bytes, _handles) = buf.split_mut();
188        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
189        debug_assert_eq!(tx_header.tx_id, 0);
190        match tx_header.ordinal {
191            _ => Err(fidl::Error::UnknownOrdinal {
192                ordinal: tx_header.ordinal,
193                protocol_name: <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
194            }),
195        }
196    }
197}
198
199/// A Stream of incoming requests for fuchsia.compat.runtime.test/Leaf.
200pub struct LeafRequestStream {
201    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
202    is_terminated: bool,
203}
204
205impl std::marker::Unpin for LeafRequestStream {}
206
207impl futures::stream::FusedStream for LeafRequestStream {
208    fn is_terminated(&self) -> bool {
209        self.is_terminated
210    }
211}
212
213impl fidl::endpoints::RequestStream for LeafRequestStream {
214    type Protocol = LeafMarker;
215    type ControlHandle = LeafControlHandle;
216
217    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
218        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
219    }
220
221    fn control_handle(&self) -> Self::ControlHandle {
222        LeafControlHandle { inner: self.inner.clone() }
223    }
224
225    fn into_inner(
226        self,
227    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
228    {
229        (self.inner, self.is_terminated)
230    }
231
232    fn from_inner(
233        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
234        is_terminated: bool,
235    ) -> Self {
236        Self { inner, is_terminated }
237    }
238}
239
240impl futures::Stream for LeafRequestStream {
241    type Item = Result<LeafRequest, fidl::Error>;
242
243    fn poll_next(
244        mut self: std::pin::Pin<&mut Self>,
245        cx: &mut std::task::Context<'_>,
246    ) -> std::task::Poll<Option<Self::Item>> {
247        let this = &mut *self;
248        if this.inner.check_shutdown(cx) {
249            this.is_terminated = true;
250            return std::task::Poll::Ready(None);
251        }
252        if this.is_terminated {
253            panic!("polled LeafRequestStream after completion");
254        }
255        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
256            |bytes, handles| {
257                match this.inner.channel().read_etc(cx, bytes, handles) {
258                    std::task::Poll::Ready(Ok(())) => {}
259                    std::task::Poll::Pending => return std::task::Poll::Pending,
260                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
261                        this.is_terminated = true;
262                        return std::task::Poll::Ready(None);
263                    }
264                    std::task::Poll::Ready(Err(e)) => {
265                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
266                            e.into(),
267                        ))))
268                    }
269                }
270
271                // A message has been received from the channel
272                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
273
274                std::task::Poll::Ready(Some(match header.ordinal {
275                    0x765999b3a5e5cbcc => {
276                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
277                        let mut req = fidl::new_empty!(
278                            fidl::encoding::EmptyPayload,
279                            fidl::encoding::DefaultFuchsiaResourceDialect
280                        );
281                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
282                        let control_handle = LeafControlHandle { inner: this.inner.clone() };
283                        Ok(LeafRequest::GetString {
284                            responder: LeafGetStringResponder {
285                                control_handle: std::mem::ManuallyDrop::new(control_handle),
286                                tx_id: header.tx_id,
287                            },
288                        })
289                    }
290                    _ => Err(fidl::Error::UnknownOrdinal {
291                        ordinal: header.ordinal,
292                        protocol_name: <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
293                    }),
294                }))
295            },
296        )
297    }
298}
299
300#[derive(Debug)]
301pub enum LeafRequest {
302    GetString { responder: LeafGetStringResponder },
303}
304
305impl LeafRequest {
306    #[allow(irrefutable_let_patterns)]
307    pub fn into_get_string(self) -> Option<(LeafGetStringResponder)> {
308        if let LeafRequest::GetString { responder } = self {
309            Some((responder))
310        } else {
311            None
312        }
313    }
314
315    /// Name of the method defined in FIDL
316    pub fn method_name(&self) -> &'static str {
317        match *self {
318            LeafRequest::GetString { .. } => "get_string",
319        }
320    }
321}
322
323#[derive(Debug, Clone)]
324pub struct LeafControlHandle {
325    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
326}
327
328impl fidl::endpoints::ControlHandle for LeafControlHandle {
329    fn shutdown(&self) {
330        self.inner.shutdown()
331    }
332    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
333        self.inner.shutdown_with_epitaph(status)
334    }
335
336    fn is_closed(&self) -> bool {
337        self.inner.channel().is_closed()
338    }
339    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
340        self.inner.channel().on_closed()
341    }
342
343    #[cfg(target_os = "fuchsia")]
344    fn signal_peer(
345        &self,
346        clear_mask: zx::Signals,
347        set_mask: zx::Signals,
348    ) -> Result<(), zx_status::Status> {
349        use fidl::Peered;
350        self.inner.channel().signal_peer(clear_mask, set_mask)
351    }
352}
353
354impl LeafControlHandle {}
355
356#[must_use = "FIDL methods require a response to be sent"]
357#[derive(Debug)]
358pub struct LeafGetStringResponder {
359    control_handle: std::mem::ManuallyDrop<LeafControlHandle>,
360    tx_id: u32,
361}
362
363/// Set the the channel to be shutdown (see [`LeafControlHandle::shutdown`])
364/// if the responder is dropped without sending a response, so that the client
365/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
366impl std::ops::Drop for LeafGetStringResponder {
367    fn drop(&mut self) {
368        self.control_handle.shutdown();
369        // Safety: drops once, never accessed again
370        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
371    }
372}
373
374impl fidl::endpoints::Responder for LeafGetStringResponder {
375    type ControlHandle = LeafControlHandle;
376
377    fn control_handle(&self) -> &LeafControlHandle {
378        &self.control_handle
379    }
380
381    fn drop_without_shutdown(mut self) {
382        // Safety: drops once, never accessed again due to mem::forget
383        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
384        // Prevent Drop from running (which would shut down the channel)
385        std::mem::forget(self);
386    }
387}
388
389impl LeafGetStringResponder {
390    /// Sends a response to the FIDL transaction.
391    ///
392    /// Sets the channel to shutdown if an error occurs.
393    pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
394        let _result = self.send_raw(response);
395        if _result.is_err() {
396            self.control_handle.shutdown();
397        }
398        self.drop_without_shutdown();
399        _result
400    }
401
402    /// Similar to "send" but does not shutdown the channel if an error occurs.
403    pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
404        let _result = self.send_raw(response);
405        self.drop_without_shutdown();
406        _result
407    }
408
409    fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
410        self.control_handle.inner.send::<LeafGetStringResponse>(
411            (response,),
412            self.tx_id,
413            0x765999b3a5e5cbcc,
414            fidl::encoding::DynamicFlags::empty(),
415        )
416    }
417}
418
419#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
420pub struct WaiterMarker;
421
422impl fidl::endpoints::ProtocolMarker for WaiterMarker {
423    type Proxy = WaiterProxy;
424    type RequestStream = WaiterRequestStream;
425    #[cfg(target_os = "fuchsia")]
426    type SynchronousProxy = WaiterSynchronousProxy;
427
428    const DEBUG_NAME: &'static str = "fuchsia.compat.runtime.test.Waiter";
429}
430impl fidl::endpoints::DiscoverableProtocolMarker for WaiterMarker {}
431
432pub trait WaiterProxyInterface: Send + Sync {
433    fn r#ack(&self) -> Result<(), fidl::Error>;
434}
435#[derive(Debug)]
436#[cfg(target_os = "fuchsia")]
437pub struct WaiterSynchronousProxy {
438    client: fidl::client::sync::Client,
439}
440
441#[cfg(target_os = "fuchsia")]
442impl fidl::endpoints::SynchronousProxy for WaiterSynchronousProxy {
443    type Proxy = WaiterProxy;
444    type Protocol = WaiterMarker;
445
446    fn from_channel(inner: fidl::Channel) -> Self {
447        Self::new(inner)
448    }
449
450    fn into_channel(self) -> fidl::Channel {
451        self.client.into_channel()
452    }
453
454    fn as_channel(&self) -> &fidl::Channel {
455        self.client.as_channel()
456    }
457}
458
459#[cfg(target_os = "fuchsia")]
460impl WaiterSynchronousProxy {
461    pub fn new(channel: fidl::Channel) -> Self {
462        let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
463        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
464    }
465
466    pub fn into_channel(self) -> fidl::Channel {
467        self.client.into_channel()
468    }
469
470    /// Waits until an event arrives and returns it. It is safe for other
471    /// threads to make concurrent requests while waiting for an event.
472    pub fn wait_for_event(
473        &self,
474        deadline: zx::MonotonicInstant,
475    ) -> Result<WaiterEvent, fidl::Error> {
476        WaiterEvent::decode(self.client.wait_for_event(deadline)?)
477    }
478
479    pub fn r#ack(&self) -> Result<(), fidl::Error> {
480        self.client.send::<fidl::encoding::EmptyPayload>(
481            (),
482            0x37380907dd9472fa,
483            fidl::encoding::DynamicFlags::empty(),
484        )
485    }
486}
487
488#[derive(Debug, Clone)]
489pub struct WaiterProxy {
490    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
491}
492
493impl fidl::endpoints::Proxy for WaiterProxy {
494    type Protocol = WaiterMarker;
495
496    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
497        Self::new(inner)
498    }
499
500    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
501        self.client.into_channel().map_err(|client| Self { client })
502    }
503
504    fn as_channel(&self) -> &::fidl::AsyncChannel {
505        self.client.as_channel()
506    }
507}
508
509impl WaiterProxy {
510    /// Create a new Proxy for fuchsia.compat.runtime.test/Waiter.
511    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
512        let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
513        Self { client: fidl::client::Client::new(channel, protocol_name) }
514    }
515
516    /// Get a Stream of events from the remote end of the protocol.
517    ///
518    /// # Panics
519    ///
520    /// Panics if the event stream was already taken.
521    pub fn take_event_stream(&self) -> WaiterEventStream {
522        WaiterEventStream { event_receiver: self.client.take_event_receiver() }
523    }
524
525    pub fn r#ack(&self) -> Result<(), fidl::Error> {
526        WaiterProxyInterface::r#ack(self)
527    }
528}
529
530impl WaiterProxyInterface for WaiterProxy {
531    fn r#ack(&self) -> Result<(), fidl::Error> {
532        self.client.send::<fidl::encoding::EmptyPayload>(
533            (),
534            0x37380907dd9472fa,
535            fidl::encoding::DynamicFlags::empty(),
536        )
537    }
538}
539
540pub struct WaiterEventStream {
541    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
542}
543
544impl std::marker::Unpin for WaiterEventStream {}
545
546impl futures::stream::FusedStream for WaiterEventStream {
547    fn is_terminated(&self) -> bool {
548        self.event_receiver.is_terminated()
549    }
550}
551
552impl futures::Stream for WaiterEventStream {
553    type Item = Result<WaiterEvent, fidl::Error>;
554
555    fn poll_next(
556        mut self: std::pin::Pin<&mut Self>,
557        cx: &mut std::task::Context<'_>,
558    ) -> std::task::Poll<Option<Self::Item>> {
559        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
560            &mut self.event_receiver,
561            cx
562        )?) {
563            Some(buf) => std::task::Poll::Ready(Some(WaiterEvent::decode(buf))),
564            None => std::task::Poll::Ready(None),
565        }
566    }
567}
568
569#[derive(Debug)]
570pub enum WaiterEvent {}
571
572impl WaiterEvent {
573    /// Decodes a message buffer as a [`WaiterEvent`].
574    fn decode(
575        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
576    ) -> Result<WaiterEvent, fidl::Error> {
577        let (bytes, _handles) = buf.split_mut();
578        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
579        debug_assert_eq!(tx_header.tx_id, 0);
580        match tx_header.ordinal {
581            _ => Err(fidl::Error::UnknownOrdinal {
582                ordinal: tx_header.ordinal,
583                protocol_name: <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
584            }),
585        }
586    }
587}
588
589/// A Stream of incoming requests for fuchsia.compat.runtime.test/Waiter.
590pub struct WaiterRequestStream {
591    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
592    is_terminated: bool,
593}
594
595impl std::marker::Unpin for WaiterRequestStream {}
596
597impl futures::stream::FusedStream for WaiterRequestStream {
598    fn is_terminated(&self) -> bool {
599        self.is_terminated
600    }
601}
602
603impl fidl::endpoints::RequestStream for WaiterRequestStream {
604    type Protocol = WaiterMarker;
605    type ControlHandle = WaiterControlHandle;
606
607    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
608        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
609    }
610
611    fn control_handle(&self) -> Self::ControlHandle {
612        WaiterControlHandle { inner: self.inner.clone() }
613    }
614
615    fn into_inner(
616        self,
617    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
618    {
619        (self.inner, self.is_terminated)
620    }
621
622    fn from_inner(
623        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
624        is_terminated: bool,
625    ) -> Self {
626        Self { inner, is_terminated }
627    }
628}
629
630impl futures::Stream for WaiterRequestStream {
631    type Item = Result<WaiterRequest, fidl::Error>;
632
633    fn poll_next(
634        mut self: std::pin::Pin<&mut Self>,
635        cx: &mut std::task::Context<'_>,
636    ) -> std::task::Poll<Option<Self::Item>> {
637        let this = &mut *self;
638        if this.inner.check_shutdown(cx) {
639            this.is_terminated = true;
640            return std::task::Poll::Ready(None);
641        }
642        if this.is_terminated {
643            panic!("polled WaiterRequestStream after completion");
644        }
645        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
646            |bytes, handles| {
647                match this.inner.channel().read_etc(cx, bytes, handles) {
648                    std::task::Poll::Ready(Ok(())) => {}
649                    std::task::Poll::Pending => return std::task::Poll::Pending,
650                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
651                        this.is_terminated = true;
652                        return std::task::Poll::Ready(None);
653                    }
654                    std::task::Poll::Ready(Err(e)) => {
655                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
656                            e.into(),
657                        ))))
658                    }
659                }
660
661                // A message has been received from the channel
662                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
663
664                std::task::Poll::Ready(Some(match header.ordinal {
665                    0x37380907dd9472fa => {
666                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
667                        let mut req = fidl::new_empty!(
668                            fidl::encoding::EmptyPayload,
669                            fidl::encoding::DefaultFuchsiaResourceDialect
670                        );
671                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
672                        let control_handle = WaiterControlHandle { inner: this.inner.clone() };
673                        Ok(WaiterRequest::Ack { control_handle })
674                    }
675                    _ => Err(fidl::Error::UnknownOrdinal {
676                        ordinal: header.ordinal,
677                        protocol_name:
678                            <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
679                    }),
680                }))
681            },
682        )
683    }
684}
685
686#[derive(Debug)]
687pub enum WaiterRequest {
688    Ack { control_handle: WaiterControlHandle },
689}
690
691impl WaiterRequest {
692    #[allow(irrefutable_let_patterns)]
693    pub fn into_ack(self) -> Option<(WaiterControlHandle)> {
694        if let WaiterRequest::Ack { control_handle } = self {
695            Some((control_handle))
696        } else {
697            None
698        }
699    }
700
701    /// Name of the method defined in FIDL
702    pub fn method_name(&self) -> &'static str {
703        match *self {
704            WaiterRequest::Ack { .. } => "ack",
705        }
706    }
707}
708
709#[derive(Debug, Clone)]
710pub struct WaiterControlHandle {
711    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
712}
713
714impl fidl::endpoints::ControlHandle for WaiterControlHandle {
715    fn shutdown(&self) {
716        self.inner.shutdown()
717    }
718    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
719        self.inner.shutdown_with_epitaph(status)
720    }
721
722    fn is_closed(&self) -> bool {
723        self.inner.channel().is_closed()
724    }
725    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
726        self.inner.channel().on_closed()
727    }
728
729    #[cfg(target_os = "fuchsia")]
730    fn signal_peer(
731        &self,
732        clear_mask: zx::Signals,
733        set_mask: zx::Signals,
734    ) -> Result<(), zx_status::Status> {
735        use fidl::Peered;
736        self.inner.channel().signal_peer(clear_mask, set_mask)
737    }
738}
739
740impl WaiterControlHandle {}
741
742mod internal {
743    use super::*;
744}