1#![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 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#[cfg(target_os = "fuchsia")]
84impl From<LeafSynchronousProxy> for zx::Handle {
85 fn from(value: LeafSynchronousProxy) -> Self {
86 value.into_channel().into()
87 }
88}
89
90#[cfg(target_os = "fuchsia")]
91impl From<fidl::Channel> for LeafSynchronousProxy {
92 fn from(value: fidl::Channel) -> Self {
93 Self::new(value)
94 }
95}
96
97#[cfg(target_os = "fuchsia")]
98impl fidl::endpoints::FromClient for LeafSynchronousProxy {
99 type Protocol = LeafMarker;
100
101 fn from_client(value: fidl::endpoints::ClientEnd<LeafMarker>) -> Self {
102 Self::new(value.into_channel())
103 }
104}
105
106#[derive(Debug, Clone)]
107pub struct LeafProxy {
108 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
109}
110
111impl fidl::endpoints::Proxy for LeafProxy {
112 type Protocol = LeafMarker;
113
114 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
115 Self::new(inner)
116 }
117
118 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
119 self.client.into_channel().map_err(|client| Self { client })
120 }
121
122 fn as_channel(&self) -> &::fidl::AsyncChannel {
123 self.client.as_channel()
124 }
125}
126
127impl LeafProxy {
128 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
130 let protocol_name = <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
131 Self { client: fidl::client::Client::new(channel, protocol_name) }
132 }
133
134 pub fn take_event_stream(&self) -> LeafEventStream {
140 LeafEventStream { event_receiver: self.client.take_event_receiver() }
141 }
142
143 pub fn r#get_string(
144 &self,
145 ) -> fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect> {
146 LeafProxyInterface::r#get_string(self)
147 }
148}
149
150impl LeafProxyInterface for LeafProxy {
151 type GetStringResponseFut =
152 fidl::client::QueryResponseFut<String, fidl::encoding::DefaultFuchsiaResourceDialect>;
153 fn r#get_string(&self) -> Self::GetStringResponseFut {
154 fn _decode(
155 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
156 ) -> Result<String, fidl::Error> {
157 let _response = fidl::client::decode_transaction_body::<
158 LeafGetStringResponse,
159 fidl::encoding::DefaultFuchsiaResourceDialect,
160 0x765999b3a5e5cbcc,
161 >(_buf?)?;
162 Ok(_response.response)
163 }
164 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, String>(
165 (),
166 0x765999b3a5e5cbcc,
167 fidl::encoding::DynamicFlags::empty(),
168 _decode,
169 )
170 }
171}
172
173pub struct LeafEventStream {
174 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
175}
176
177impl std::marker::Unpin for LeafEventStream {}
178
179impl futures::stream::FusedStream for LeafEventStream {
180 fn is_terminated(&self) -> bool {
181 self.event_receiver.is_terminated()
182 }
183}
184
185impl futures::Stream for LeafEventStream {
186 type Item = Result<LeafEvent, fidl::Error>;
187
188 fn poll_next(
189 mut self: std::pin::Pin<&mut Self>,
190 cx: &mut std::task::Context<'_>,
191 ) -> std::task::Poll<Option<Self::Item>> {
192 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
193 &mut self.event_receiver,
194 cx
195 )?) {
196 Some(buf) => std::task::Poll::Ready(Some(LeafEvent::decode(buf))),
197 None => std::task::Poll::Ready(None),
198 }
199 }
200}
201
202#[derive(Debug)]
203pub enum LeafEvent {}
204
205impl LeafEvent {
206 fn decode(
208 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
209 ) -> Result<LeafEvent, fidl::Error> {
210 let (bytes, _handles) = buf.split_mut();
211 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
212 debug_assert_eq!(tx_header.tx_id, 0);
213 match tx_header.ordinal {
214 _ => Err(fidl::Error::UnknownOrdinal {
215 ordinal: tx_header.ordinal,
216 protocol_name: <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
217 }),
218 }
219 }
220}
221
222pub struct LeafRequestStream {
224 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
225 is_terminated: bool,
226}
227
228impl std::marker::Unpin for LeafRequestStream {}
229
230impl futures::stream::FusedStream for LeafRequestStream {
231 fn is_terminated(&self) -> bool {
232 self.is_terminated
233 }
234}
235
236impl fidl::endpoints::RequestStream for LeafRequestStream {
237 type Protocol = LeafMarker;
238 type ControlHandle = LeafControlHandle;
239
240 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
241 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
242 }
243
244 fn control_handle(&self) -> Self::ControlHandle {
245 LeafControlHandle { inner: self.inner.clone() }
246 }
247
248 fn into_inner(
249 self,
250 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
251 {
252 (self.inner, self.is_terminated)
253 }
254
255 fn from_inner(
256 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
257 is_terminated: bool,
258 ) -> Self {
259 Self { inner, is_terminated }
260 }
261}
262
263impl futures::Stream for LeafRequestStream {
264 type Item = Result<LeafRequest, fidl::Error>;
265
266 fn poll_next(
267 mut self: std::pin::Pin<&mut Self>,
268 cx: &mut std::task::Context<'_>,
269 ) -> std::task::Poll<Option<Self::Item>> {
270 let this = &mut *self;
271 if this.inner.check_shutdown(cx) {
272 this.is_terminated = true;
273 return std::task::Poll::Ready(None);
274 }
275 if this.is_terminated {
276 panic!("polled LeafRequestStream after completion");
277 }
278 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
279 |bytes, handles| {
280 match this.inner.channel().read_etc(cx, bytes, handles) {
281 std::task::Poll::Ready(Ok(())) => {}
282 std::task::Poll::Pending => return std::task::Poll::Pending,
283 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
284 this.is_terminated = true;
285 return std::task::Poll::Ready(None);
286 }
287 std::task::Poll::Ready(Err(e)) => {
288 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
289 e.into(),
290 ))));
291 }
292 }
293
294 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
296
297 std::task::Poll::Ready(Some(match header.ordinal {
298 0x765999b3a5e5cbcc => {
299 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
300 let mut req = fidl::new_empty!(
301 fidl::encoding::EmptyPayload,
302 fidl::encoding::DefaultFuchsiaResourceDialect
303 );
304 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
305 let control_handle = LeafControlHandle { inner: this.inner.clone() };
306 Ok(LeafRequest::GetString {
307 responder: LeafGetStringResponder {
308 control_handle: std::mem::ManuallyDrop::new(control_handle),
309 tx_id: header.tx_id,
310 },
311 })
312 }
313 _ => Err(fidl::Error::UnknownOrdinal {
314 ordinal: header.ordinal,
315 protocol_name: <LeafMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
316 }),
317 }))
318 },
319 )
320 }
321}
322
323#[derive(Debug)]
324pub enum LeafRequest {
325 GetString { responder: LeafGetStringResponder },
326}
327
328impl LeafRequest {
329 #[allow(irrefutable_let_patterns)]
330 pub fn into_get_string(self) -> Option<(LeafGetStringResponder)> {
331 if let LeafRequest::GetString { responder } = self { Some((responder)) } else { None }
332 }
333
334 pub fn method_name(&self) -> &'static str {
336 match *self {
337 LeafRequest::GetString { .. } => "get_string",
338 }
339 }
340}
341
342#[derive(Debug, Clone)]
343pub struct LeafControlHandle {
344 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
345}
346
347impl fidl::endpoints::ControlHandle for LeafControlHandle {
348 fn shutdown(&self) {
349 self.inner.shutdown()
350 }
351 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
352 self.inner.shutdown_with_epitaph(status)
353 }
354
355 fn is_closed(&self) -> bool {
356 self.inner.channel().is_closed()
357 }
358 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
359 self.inner.channel().on_closed()
360 }
361
362 #[cfg(target_os = "fuchsia")]
363 fn signal_peer(
364 &self,
365 clear_mask: zx::Signals,
366 set_mask: zx::Signals,
367 ) -> Result<(), zx_status::Status> {
368 use fidl::Peered;
369 self.inner.channel().signal_peer(clear_mask, set_mask)
370 }
371}
372
373impl LeafControlHandle {}
374
375#[must_use = "FIDL methods require a response to be sent"]
376#[derive(Debug)]
377pub struct LeafGetStringResponder {
378 control_handle: std::mem::ManuallyDrop<LeafControlHandle>,
379 tx_id: u32,
380}
381
382impl std::ops::Drop for LeafGetStringResponder {
386 fn drop(&mut self) {
387 self.control_handle.shutdown();
388 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
390 }
391}
392
393impl fidl::endpoints::Responder for LeafGetStringResponder {
394 type ControlHandle = LeafControlHandle;
395
396 fn control_handle(&self) -> &LeafControlHandle {
397 &self.control_handle
398 }
399
400 fn drop_without_shutdown(mut self) {
401 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
403 std::mem::forget(self);
405 }
406}
407
408impl LeafGetStringResponder {
409 pub fn send(self, mut response: &str) -> Result<(), fidl::Error> {
413 let _result = self.send_raw(response);
414 if _result.is_err() {
415 self.control_handle.shutdown();
416 }
417 self.drop_without_shutdown();
418 _result
419 }
420
421 pub fn send_no_shutdown_on_err(self, mut response: &str) -> Result<(), fidl::Error> {
423 let _result = self.send_raw(response);
424 self.drop_without_shutdown();
425 _result
426 }
427
428 fn send_raw(&self, mut response: &str) -> Result<(), fidl::Error> {
429 self.control_handle.inner.send::<LeafGetStringResponse>(
430 (response,),
431 self.tx_id,
432 0x765999b3a5e5cbcc,
433 fidl::encoding::DynamicFlags::empty(),
434 )
435 }
436}
437
438#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
439pub struct WaiterMarker;
440
441impl fidl::endpoints::ProtocolMarker for WaiterMarker {
442 type Proxy = WaiterProxy;
443 type RequestStream = WaiterRequestStream;
444 #[cfg(target_os = "fuchsia")]
445 type SynchronousProxy = WaiterSynchronousProxy;
446
447 const DEBUG_NAME: &'static str = "fuchsia.compat.runtime.test.Waiter";
448}
449impl fidl::endpoints::DiscoverableProtocolMarker for WaiterMarker {}
450
451pub trait WaiterProxyInterface: Send + Sync {
452 fn r#ack(&self) -> Result<(), fidl::Error>;
453}
454#[derive(Debug)]
455#[cfg(target_os = "fuchsia")]
456pub struct WaiterSynchronousProxy {
457 client: fidl::client::sync::Client,
458}
459
460#[cfg(target_os = "fuchsia")]
461impl fidl::endpoints::SynchronousProxy for WaiterSynchronousProxy {
462 type Proxy = WaiterProxy;
463 type Protocol = WaiterMarker;
464
465 fn from_channel(inner: fidl::Channel) -> Self {
466 Self::new(inner)
467 }
468
469 fn into_channel(self) -> fidl::Channel {
470 self.client.into_channel()
471 }
472
473 fn as_channel(&self) -> &fidl::Channel {
474 self.client.as_channel()
475 }
476}
477
478#[cfg(target_os = "fuchsia")]
479impl WaiterSynchronousProxy {
480 pub fn new(channel: fidl::Channel) -> Self {
481 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
482 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
483 }
484
485 pub fn into_channel(self) -> fidl::Channel {
486 self.client.into_channel()
487 }
488
489 pub fn wait_for_event(
492 &self,
493 deadline: zx::MonotonicInstant,
494 ) -> Result<WaiterEvent, fidl::Error> {
495 WaiterEvent::decode(self.client.wait_for_event(deadline)?)
496 }
497
498 pub fn r#ack(&self) -> Result<(), fidl::Error> {
499 self.client.send::<fidl::encoding::EmptyPayload>(
500 (),
501 0x37380907dd9472fa,
502 fidl::encoding::DynamicFlags::empty(),
503 )
504 }
505}
506
507#[cfg(target_os = "fuchsia")]
508impl From<WaiterSynchronousProxy> for zx::Handle {
509 fn from(value: WaiterSynchronousProxy) -> Self {
510 value.into_channel().into()
511 }
512}
513
514#[cfg(target_os = "fuchsia")]
515impl From<fidl::Channel> for WaiterSynchronousProxy {
516 fn from(value: fidl::Channel) -> Self {
517 Self::new(value)
518 }
519}
520
521#[cfg(target_os = "fuchsia")]
522impl fidl::endpoints::FromClient for WaiterSynchronousProxy {
523 type Protocol = WaiterMarker;
524
525 fn from_client(value: fidl::endpoints::ClientEnd<WaiterMarker>) -> Self {
526 Self::new(value.into_channel())
527 }
528}
529
530#[derive(Debug, Clone)]
531pub struct WaiterProxy {
532 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
533}
534
535impl fidl::endpoints::Proxy for WaiterProxy {
536 type Protocol = WaiterMarker;
537
538 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
539 Self::new(inner)
540 }
541
542 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
543 self.client.into_channel().map_err(|client| Self { client })
544 }
545
546 fn as_channel(&self) -> &::fidl::AsyncChannel {
547 self.client.as_channel()
548 }
549}
550
551impl WaiterProxy {
552 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
554 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
555 Self { client: fidl::client::Client::new(channel, protocol_name) }
556 }
557
558 pub fn take_event_stream(&self) -> WaiterEventStream {
564 WaiterEventStream { event_receiver: self.client.take_event_receiver() }
565 }
566
567 pub fn r#ack(&self) -> Result<(), fidl::Error> {
568 WaiterProxyInterface::r#ack(self)
569 }
570}
571
572impl WaiterProxyInterface for WaiterProxy {
573 fn r#ack(&self) -> Result<(), fidl::Error> {
574 self.client.send::<fidl::encoding::EmptyPayload>(
575 (),
576 0x37380907dd9472fa,
577 fidl::encoding::DynamicFlags::empty(),
578 )
579 }
580}
581
582pub struct WaiterEventStream {
583 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
584}
585
586impl std::marker::Unpin for WaiterEventStream {}
587
588impl futures::stream::FusedStream for WaiterEventStream {
589 fn is_terminated(&self) -> bool {
590 self.event_receiver.is_terminated()
591 }
592}
593
594impl futures::Stream for WaiterEventStream {
595 type Item = Result<WaiterEvent, fidl::Error>;
596
597 fn poll_next(
598 mut self: std::pin::Pin<&mut Self>,
599 cx: &mut std::task::Context<'_>,
600 ) -> std::task::Poll<Option<Self::Item>> {
601 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
602 &mut self.event_receiver,
603 cx
604 )?) {
605 Some(buf) => std::task::Poll::Ready(Some(WaiterEvent::decode(buf))),
606 None => std::task::Poll::Ready(None),
607 }
608 }
609}
610
611#[derive(Debug)]
612pub enum WaiterEvent {}
613
614impl WaiterEvent {
615 fn decode(
617 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
618 ) -> Result<WaiterEvent, fidl::Error> {
619 let (bytes, _handles) = buf.split_mut();
620 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
621 debug_assert_eq!(tx_header.tx_id, 0);
622 match tx_header.ordinal {
623 _ => Err(fidl::Error::UnknownOrdinal {
624 ordinal: tx_header.ordinal,
625 protocol_name: <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
626 }),
627 }
628 }
629}
630
631pub struct WaiterRequestStream {
633 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
634 is_terminated: bool,
635}
636
637impl std::marker::Unpin for WaiterRequestStream {}
638
639impl futures::stream::FusedStream for WaiterRequestStream {
640 fn is_terminated(&self) -> bool {
641 self.is_terminated
642 }
643}
644
645impl fidl::endpoints::RequestStream for WaiterRequestStream {
646 type Protocol = WaiterMarker;
647 type ControlHandle = WaiterControlHandle;
648
649 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
650 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
651 }
652
653 fn control_handle(&self) -> Self::ControlHandle {
654 WaiterControlHandle { inner: self.inner.clone() }
655 }
656
657 fn into_inner(
658 self,
659 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
660 {
661 (self.inner, self.is_terminated)
662 }
663
664 fn from_inner(
665 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
666 is_terminated: bool,
667 ) -> Self {
668 Self { inner, is_terminated }
669 }
670}
671
672impl futures::Stream for WaiterRequestStream {
673 type Item = Result<WaiterRequest, fidl::Error>;
674
675 fn poll_next(
676 mut self: std::pin::Pin<&mut Self>,
677 cx: &mut std::task::Context<'_>,
678 ) -> std::task::Poll<Option<Self::Item>> {
679 let this = &mut *self;
680 if this.inner.check_shutdown(cx) {
681 this.is_terminated = true;
682 return std::task::Poll::Ready(None);
683 }
684 if this.is_terminated {
685 panic!("polled WaiterRequestStream after completion");
686 }
687 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
688 |bytes, handles| {
689 match this.inner.channel().read_etc(cx, bytes, handles) {
690 std::task::Poll::Ready(Ok(())) => {}
691 std::task::Poll::Pending => return std::task::Poll::Pending,
692 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
693 this.is_terminated = true;
694 return std::task::Poll::Ready(None);
695 }
696 std::task::Poll::Ready(Err(e)) => {
697 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
698 e.into(),
699 ))));
700 }
701 }
702
703 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
705
706 std::task::Poll::Ready(Some(match header.ordinal {
707 0x37380907dd9472fa => {
708 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
709 let mut req = fidl::new_empty!(
710 fidl::encoding::EmptyPayload,
711 fidl::encoding::DefaultFuchsiaResourceDialect
712 );
713 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
714 let control_handle = WaiterControlHandle { inner: this.inner.clone() };
715 Ok(WaiterRequest::Ack { control_handle })
716 }
717 _ => Err(fidl::Error::UnknownOrdinal {
718 ordinal: header.ordinal,
719 protocol_name:
720 <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
721 }),
722 }))
723 },
724 )
725 }
726}
727
728#[derive(Debug)]
729pub enum WaiterRequest {
730 Ack { control_handle: WaiterControlHandle },
731}
732
733impl WaiterRequest {
734 #[allow(irrefutable_let_patterns)]
735 pub fn into_ack(self) -> Option<(WaiterControlHandle)> {
736 if let WaiterRequest::Ack { control_handle } = self { Some((control_handle)) } else { None }
737 }
738
739 pub fn method_name(&self) -> &'static str {
741 match *self {
742 WaiterRequest::Ack { .. } => "ack",
743 }
744 }
745}
746
747#[derive(Debug, Clone)]
748pub struct WaiterControlHandle {
749 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
750}
751
752impl fidl::endpoints::ControlHandle for WaiterControlHandle {
753 fn shutdown(&self) {
754 self.inner.shutdown()
755 }
756 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
757 self.inner.shutdown_with_epitaph(status)
758 }
759
760 fn is_closed(&self) -> bool {
761 self.inner.channel().is_closed()
762 }
763 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
764 self.inner.channel().on_closed()
765 }
766
767 #[cfg(target_os = "fuchsia")]
768 fn signal_peer(
769 &self,
770 clear_mask: zx::Signals,
771 set_mask: zx::Signals,
772 ) -> Result<(), zx_status::Status> {
773 use fidl::Peered;
774 self.inner.channel().signal_peer(clear_mask, set_mask)
775 }
776}
777
778impl WaiterControlHandle {}
779
780mod internal {
781 use super::*;
782}