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_offers_test__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct HandshakeMarker;
16
17impl fidl::endpoints::ProtocolMarker for HandshakeMarker {
18 type Proxy = HandshakeProxy;
19 type RequestStream = HandshakeRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = HandshakeSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.offers.test.Handshake";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for HandshakeMarker {}
26
27pub trait HandshakeProxyInterface: Send + Sync {
28 type DoResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
29 fn r#do(&self) -> Self::DoResponseFut;
30}
31#[derive(Debug)]
32#[cfg(target_os = "fuchsia")]
33pub struct HandshakeSynchronousProxy {
34 client: fidl::client::sync::Client,
35}
36
37#[cfg(target_os = "fuchsia")]
38impl fidl::endpoints::SynchronousProxy for HandshakeSynchronousProxy {
39 type Proxy = HandshakeProxy;
40 type Protocol = HandshakeMarker;
41
42 fn from_channel(inner: fidl::Channel) -> Self {
43 Self::new(inner)
44 }
45
46 fn into_channel(self) -> fidl::Channel {
47 self.client.into_channel()
48 }
49
50 fn as_channel(&self) -> &fidl::Channel {
51 self.client.as_channel()
52 }
53}
54
55#[cfg(target_os = "fuchsia")]
56impl HandshakeSynchronousProxy {
57 pub fn new(channel: fidl::Channel) -> Self {
58 let protocol_name = <HandshakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
59 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
60 }
61
62 pub fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 pub fn wait_for_event(
69 &self,
70 deadline: zx::MonotonicInstant,
71 ) -> Result<HandshakeEvent, fidl::Error> {
72 HandshakeEvent::decode(self.client.wait_for_event(deadline)?)
73 }
74
75 pub fn r#do(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
76 let _response =
77 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
78 (),
79 0x7baa967dfb1cdc7f,
80 fidl::encoding::DynamicFlags::empty(),
81 ___deadline,
82 )?;
83 Ok(_response)
84 }
85}
86
87#[cfg(target_os = "fuchsia")]
88impl From<HandshakeSynchronousProxy> for zx::Handle {
89 fn from(value: HandshakeSynchronousProxy) -> Self {
90 value.into_channel().into()
91 }
92}
93
94#[cfg(target_os = "fuchsia")]
95impl From<fidl::Channel> for HandshakeSynchronousProxy {
96 fn from(value: fidl::Channel) -> Self {
97 Self::new(value)
98 }
99}
100
101#[cfg(target_os = "fuchsia")]
102impl fidl::endpoints::FromClient for HandshakeSynchronousProxy {
103 type Protocol = HandshakeMarker;
104
105 fn from_client(value: fidl::endpoints::ClientEnd<HandshakeMarker>) -> Self {
106 Self::new(value.into_channel())
107 }
108}
109
110#[derive(Debug, Clone)]
111pub struct HandshakeProxy {
112 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
113}
114
115impl fidl::endpoints::Proxy for HandshakeProxy {
116 type Protocol = HandshakeMarker;
117
118 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
119 Self::new(inner)
120 }
121
122 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
123 self.client.into_channel().map_err(|client| Self { client })
124 }
125
126 fn as_channel(&self) -> &::fidl::AsyncChannel {
127 self.client.as_channel()
128 }
129}
130
131impl HandshakeProxy {
132 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
134 let protocol_name = <HandshakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
135 Self { client: fidl::client::Client::new(channel, protocol_name) }
136 }
137
138 pub fn take_event_stream(&self) -> HandshakeEventStream {
144 HandshakeEventStream { event_receiver: self.client.take_event_receiver() }
145 }
146
147 pub fn r#do(
148 &self,
149 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
150 HandshakeProxyInterface::r#do(self)
151 }
152}
153
154impl HandshakeProxyInterface for HandshakeProxy {
155 type DoResponseFut =
156 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
157 fn r#do(&self) -> Self::DoResponseFut {
158 fn _decode(
159 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
160 ) -> Result<(), fidl::Error> {
161 let _response = fidl::client::decode_transaction_body::<
162 fidl::encoding::EmptyPayload,
163 fidl::encoding::DefaultFuchsiaResourceDialect,
164 0x7baa967dfb1cdc7f,
165 >(_buf?)?;
166 Ok(_response)
167 }
168 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
169 (),
170 0x7baa967dfb1cdc7f,
171 fidl::encoding::DynamicFlags::empty(),
172 _decode,
173 )
174 }
175}
176
177pub struct HandshakeEventStream {
178 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
179}
180
181impl std::marker::Unpin for HandshakeEventStream {}
182
183impl futures::stream::FusedStream for HandshakeEventStream {
184 fn is_terminated(&self) -> bool {
185 self.event_receiver.is_terminated()
186 }
187}
188
189impl futures::Stream for HandshakeEventStream {
190 type Item = Result<HandshakeEvent, fidl::Error>;
191
192 fn poll_next(
193 mut self: std::pin::Pin<&mut Self>,
194 cx: &mut std::task::Context<'_>,
195 ) -> std::task::Poll<Option<Self::Item>> {
196 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
197 &mut self.event_receiver,
198 cx
199 )?) {
200 Some(buf) => std::task::Poll::Ready(Some(HandshakeEvent::decode(buf))),
201 None => std::task::Poll::Ready(None),
202 }
203 }
204}
205
206#[derive(Debug)]
207pub enum HandshakeEvent {}
208
209impl HandshakeEvent {
210 fn decode(
212 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
213 ) -> Result<HandshakeEvent, fidl::Error> {
214 let (bytes, _handles) = buf.split_mut();
215 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
216 debug_assert_eq!(tx_header.tx_id, 0);
217 match tx_header.ordinal {
218 _ => Err(fidl::Error::UnknownOrdinal {
219 ordinal: tx_header.ordinal,
220 protocol_name: <HandshakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
221 }),
222 }
223 }
224}
225
226pub struct HandshakeRequestStream {
228 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
229 is_terminated: bool,
230}
231
232impl std::marker::Unpin for HandshakeRequestStream {}
233
234impl futures::stream::FusedStream for HandshakeRequestStream {
235 fn is_terminated(&self) -> bool {
236 self.is_terminated
237 }
238}
239
240impl fidl::endpoints::RequestStream for HandshakeRequestStream {
241 type Protocol = HandshakeMarker;
242 type ControlHandle = HandshakeControlHandle;
243
244 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
245 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
246 }
247
248 fn control_handle(&self) -> Self::ControlHandle {
249 HandshakeControlHandle { inner: self.inner.clone() }
250 }
251
252 fn into_inner(
253 self,
254 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
255 {
256 (self.inner, self.is_terminated)
257 }
258
259 fn from_inner(
260 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
261 is_terminated: bool,
262 ) -> Self {
263 Self { inner, is_terminated }
264 }
265}
266
267impl futures::Stream for HandshakeRequestStream {
268 type Item = Result<HandshakeRequest, fidl::Error>;
269
270 fn poll_next(
271 mut self: std::pin::Pin<&mut Self>,
272 cx: &mut std::task::Context<'_>,
273 ) -> std::task::Poll<Option<Self::Item>> {
274 let this = &mut *self;
275 if this.inner.check_shutdown(cx) {
276 this.is_terminated = true;
277 return std::task::Poll::Ready(None);
278 }
279 if this.is_terminated {
280 panic!("polled HandshakeRequestStream after completion");
281 }
282 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
283 |bytes, handles| {
284 match this.inner.channel().read_etc(cx, bytes, handles) {
285 std::task::Poll::Ready(Ok(())) => {}
286 std::task::Poll::Pending => return std::task::Poll::Pending,
287 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
288 this.is_terminated = true;
289 return std::task::Poll::Ready(None);
290 }
291 std::task::Poll::Ready(Err(e)) => {
292 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
293 e.into(),
294 ))))
295 }
296 }
297
298 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
300
301 std::task::Poll::Ready(Some(match header.ordinal {
302 0x7baa967dfb1cdc7f => {
303 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
304 let mut req = fidl::new_empty!(
305 fidl::encoding::EmptyPayload,
306 fidl::encoding::DefaultFuchsiaResourceDialect
307 );
308 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
309 let control_handle = HandshakeControlHandle { inner: this.inner.clone() };
310 Ok(HandshakeRequest::Do {
311 responder: HandshakeDoResponder {
312 control_handle: std::mem::ManuallyDrop::new(control_handle),
313 tx_id: header.tx_id,
314 },
315 })
316 }
317 _ => Err(fidl::Error::UnknownOrdinal {
318 ordinal: header.ordinal,
319 protocol_name:
320 <HandshakeMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
321 }),
322 }))
323 },
324 )
325 }
326}
327
328#[derive(Debug)]
329pub enum HandshakeRequest {
330 Do { responder: HandshakeDoResponder },
331}
332
333impl HandshakeRequest {
334 #[allow(irrefutable_let_patterns)]
335 pub fn into_do(self) -> Option<(HandshakeDoResponder)> {
336 if let HandshakeRequest::Do { responder } = self {
337 Some((responder))
338 } else {
339 None
340 }
341 }
342
343 pub fn method_name(&self) -> &'static str {
345 match *self {
346 HandshakeRequest::Do { .. } => "do",
347 }
348 }
349}
350
351#[derive(Debug, Clone)]
352pub struct HandshakeControlHandle {
353 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
354}
355
356impl fidl::endpoints::ControlHandle for HandshakeControlHandle {
357 fn shutdown(&self) {
358 self.inner.shutdown()
359 }
360 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
361 self.inner.shutdown_with_epitaph(status)
362 }
363
364 fn is_closed(&self) -> bool {
365 self.inner.channel().is_closed()
366 }
367 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
368 self.inner.channel().on_closed()
369 }
370
371 #[cfg(target_os = "fuchsia")]
372 fn signal_peer(
373 &self,
374 clear_mask: zx::Signals,
375 set_mask: zx::Signals,
376 ) -> Result<(), zx_status::Status> {
377 use fidl::Peered;
378 self.inner.channel().signal_peer(clear_mask, set_mask)
379 }
380}
381
382impl HandshakeControlHandle {}
383
384#[must_use = "FIDL methods require a response to be sent"]
385#[derive(Debug)]
386pub struct HandshakeDoResponder {
387 control_handle: std::mem::ManuallyDrop<HandshakeControlHandle>,
388 tx_id: u32,
389}
390
391impl std::ops::Drop for HandshakeDoResponder {
395 fn drop(&mut self) {
396 self.control_handle.shutdown();
397 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
399 }
400}
401
402impl fidl::endpoints::Responder for HandshakeDoResponder {
403 type ControlHandle = HandshakeControlHandle;
404
405 fn control_handle(&self) -> &HandshakeControlHandle {
406 &self.control_handle
407 }
408
409 fn drop_without_shutdown(mut self) {
410 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
412 std::mem::forget(self);
414 }
415}
416
417impl HandshakeDoResponder {
418 pub fn send(self) -> Result<(), fidl::Error> {
422 let _result = self.send_raw();
423 if _result.is_err() {
424 self.control_handle.shutdown();
425 }
426 self.drop_without_shutdown();
427 _result
428 }
429
430 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
432 let _result = self.send_raw();
433 self.drop_without_shutdown();
434 _result
435 }
436
437 fn send_raw(&self) -> Result<(), fidl::Error> {
438 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
439 (),
440 self.tx_id,
441 0x7baa967dfb1cdc7f,
442 fidl::encoding::DynamicFlags::empty(),
443 )
444 }
445}
446
447#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
448pub struct WaiterMarker;
449
450impl fidl::endpoints::ProtocolMarker for WaiterMarker {
451 type Proxy = WaiterProxy;
452 type RequestStream = WaiterRequestStream;
453 #[cfg(target_os = "fuchsia")]
454 type SynchronousProxy = WaiterSynchronousProxy;
455
456 const DEBUG_NAME: &'static str = "fuchsia.offers.test.Waiter";
457}
458impl fidl::endpoints::DiscoverableProtocolMarker for WaiterMarker {}
459
460pub trait WaiterProxyInterface: Send + Sync {
461 fn r#ack(&self) -> Result<(), fidl::Error>;
462}
463#[derive(Debug)]
464#[cfg(target_os = "fuchsia")]
465pub struct WaiterSynchronousProxy {
466 client: fidl::client::sync::Client,
467}
468
469#[cfg(target_os = "fuchsia")]
470impl fidl::endpoints::SynchronousProxy for WaiterSynchronousProxy {
471 type Proxy = WaiterProxy;
472 type Protocol = WaiterMarker;
473
474 fn from_channel(inner: fidl::Channel) -> Self {
475 Self::new(inner)
476 }
477
478 fn into_channel(self) -> fidl::Channel {
479 self.client.into_channel()
480 }
481
482 fn as_channel(&self) -> &fidl::Channel {
483 self.client.as_channel()
484 }
485}
486
487#[cfg(target_os = "fuchsia")]
488impl WaiterSynchronousProxy {
489 pub fn new(channel: fidl::Channel) -> Self {
490 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
491 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
492 }
493
494 pub fn into_channel(self) -> fidl::Channel {
495 self.client.into_channel()
496 }
497
498 pub fn wait_for_event(
501 &self,
502 deadline: zx::MonotonicInstant,
503 ) -> Result<WaiterEvent, fidl::Error> {
504 WaiterEvent::decode(self.client.wait_for_event(deadline)?)
505 }
506
507 pub fn r#ack(&self) -> Result<(), fidl::Error> {
508 self.client.send::<fidl::encoding::EmptyPayload>(
509 (),
510 0x58ced0dfeb239d0f,
511 fidl::encoding::DynamicFlags::empty(),
512 )
513 }
514}
515
516#[cfg(target_os = "fuchsia")]
517impl From<WaiterSynchronousProxy> for zx::Handle {
518 fn from(value: WaiterSynchronousProxy) -> Self {
519 value.into_channel().into()
520 }
521}
522
523#[cfg(target_os = "fuchsia")]
524impl From<fidl::Channel> for WaiterSynchronousProxy {
525 fn from(value: fidl::Channel) -> Self {
526 Self::new(value)
527 }
528}
529
530#[cfg(target_os = "fuchsia")]
531impl fidl::endpoints::FromClient for WaiterSynchronousProxy {
532 type Protocol = WaiterMarker;
533
534 fn from_client(value: fidl::endpoints::ClientEnd<WaiterMarker>) -> Self {
535 Self::new(value.into_channel())
536 }
537}
538
539#[derive(Debug, Clone)]
540pub struct WaiterProxy {
541 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
542}
543
544impl fidl::endpoints::Proxy for WaiterProxy {
545 type Protocol = WaiterMarker;
546
547 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
548 Self::new(inner)
549 }
550
551 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
552 self.client.into_channel().map_err(|client| Self { client })
553 }
554
555 fn as_channel(&self) -> &::fidl::AsyncChannel {
556 self.client.as_channel()
557 }
558}
559
560impl WaiterProxy {
561 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
563 let protocol_name = <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
564 Self { client: fidl::client::Client::new(channel, protocol_name) }
565 }
566
567 pub fn take_event_stream(&self) -> WaiterEventStream {
573 WaiterEventStream { event_receiver: self.client.take_event_receiver() }
574 }
575
576 pub fn r#ack(&self) -> Result<(), fidl::Error> {
577 WaiterProxyInterface::r#ack(self)
578 }
579}
580
581impl WaiterProxyInterface for WaiterProxy {
582 fn r#ack(&self) -> Result<(), fidl::Error> {
583 self.client.send::<fidl::encoding::EmptyPayload>(
584 (),
585 0x58ced0dfeb239d0f,
586 fidl::encoding::DynamicFlags::empty(),
587 )
588 }
589}
590
591pub struct WaiterEventStream {
592 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
593}
594
595impl std::marker::Unpin for WaiterEventStream {}
596
597impl futures::stream::FusedStream for WaiterEventStream {
598 fn is_terminated(&self) -> bool {
599 self.event_receiver.is_terminated()
600 }
601}
602
603impl futures::Stream for WaiterEventStream {
604 type Item = Result<WaiterEvent, fidl::Error>;
605
606 fn poll_next(
607 mut self: std::pin::Pin<&mut Self>,
608 cx: &mut std::task::Context<'_>,
609 ) -> std::task::Poll<Option<Self::Item>> {
610 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
611 &mut self.event_receiver,
612 cx
613 )?) {
614 Some(buf) => std::task::Poll::Ready(Some(WaiterEvent::decode(buf))),
615 None => std::task::Poll::Ready(None),
616 }
617 }
618}
619
620#[derive(Debug)]
621pub enum WaiterEvent {}
622
623impl WaiterEvent {
624 fn decode(
626 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
627 ) -> Result<WaiterEvent, fidl::Error> {
628 let (bytes, _handles) = buf.split_mut();
629 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
630 debug_assert_eq!(tx_header.tx_id, 0);
631 match tx_header.ordinal {
632 _ => Err(fidl::Error::UnknownOrdinal {
633 ordinal: tx_header.ordinal,
634 protocol_name: <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
635 }),
636 }
637 }
638}
639
640pub struct WaiterRequestStream {
642 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
643 is_terminated: bool,
644}
645
646impl std::marker::Unpin for WaiterRequestStream {}
647
648impl futures::stream::FusedStream for WaiterRequestStream {
649 fn is_terminated(&self) -> bool {
650 self.is_terminated
651 }
652}
653
654impl fidl::endpoints::RequestStream for WaiterRequestStream {
655 type Protocol = WaiterMarker;
656 type ControlHandle = WaiterControlHandle;
657
658 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
659 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
660 }
661
662 fn control_handle(&self) -> Self::ControlHandle {
663 WaiterControlHandle { inner: self.inner.clone() }
664 }
665
666 fn into_inner(
667 self,
668 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
669 {
670 (self.inner, self.is_terminated)
671 }
672
673 fn from_inner(
674 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
675 is_terminated: bool,
676 ) -> Self {
677 Self { inner, is_terminated }
678 }
679}
680
681impl futures::Stream for WaiterRequestStream {
682 type Item = Result<WaiterRequest, fidl::Error>;
683
684 fn poll_next(
685 mut self: std::pin::Pin<&mut Self>,
686 cx: &mut std::task::Context<'_>,
687 ) -> std::task::Poll<Option<Self::Item>> {
688 let this = &mut *self;
689 if this.inner.check_shutdown(cx) {
690 this.is_terminated = true;
691 return std::task::Poll::Ready(None);
692 }
693 if this.is_terminated {
694 panic!("polled WaiterRequestStream after completion");
695 }
696 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
697 |bytes, handles| {
698 match this.inner.channel().read_etc(cx, bytes, handles) {
699 std::task::Poll::Ready(Ok(())) => {}
700 std::task::Poll::Pending => return std::task::Poll::Pending,
701 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
702 this.is_terminated = true;
703 return std::task::Poll::Ready(None);
704 }
705 std::task::Poll::Ready(Err(e)) => {
706 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
707 e.into(),
708 ))))
709 }
710 }
711
712 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
714
715 std::task::Poll::Ready(Some(match header.ordinal {
716 0x58ced0dfeb239d0f => {
717 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
718 let mut req = fidl::new_empty!(
719 fidl::encoding::EmptyPayload,
720 fidl::encoding::DefaultFuchsiaResourceDialect
721 );
722 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
723 let control_handle = WaiterControlHandle { inner: this.inner.clone() };
724 Ok(WaiterRequest::Ack { control_handle })
725 }
726 _ => Err(fidl::Error::UnknownOrdinal {
727 ordinal: header.ordinal,
728 protocol_name:
729 <WaiterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
730 }),
731 }))
732 },
733 )
734 }
735}
736
737#[derive(Debug)]
738pub enum WaiterRequest {
739 Ack { control_handle: WaiterControlHandle },
740}
741
742impl WaiterRequest {
743 #[allow(irrefutable_let_patterns)]
744 pub fn into_ack(self) -> Option<(WaiterControlHandle)> {
745 if let WaiterRequest::Ack { control_handle } = self {
746 Some((control_handle))
747 } else {
748 None
749 }
750 }
751
752 pub fn method_name(&self) -> &'static str {
754 match *self {
755 WaiterRequest::Ack { .. } => "ack",
756 }
757 }
758}
759
760#[derive(Debug, Clone)]
761pub struct WaiterControlHandle {
762 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
763}
764
765impl fidl::endpoints::ControlHandle for WaiterControlHandle {
766 fn shutdown(&self) {
767 self.inner.shutdown()
768 }
769 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
770 self.inner.shutdown_with_epitaph(status)
771 }
772
773 fn is_closed(&self) -> bool {
774 self.inner.channel().is_closed()
775 }
776 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
777 self.inner.channel().on_closed()
778 }
779
780 #[cfg(target_os = "fuchsia")]
781 fn signal_peer(
782 &self,
783 clear_mask: zx::Signals,
784 set_mask: zx::Signals,
785 ) -> Result<(), zx_status::Status> {
786 use fidl::Peered;
787 self.inner.channel().signal_peer(clear_mask, set_mask)
788 }
789}
790
791impl WaiterControlHandle {}
792
793#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
794pub struct ServiceMarker;
795
796#[cfg(target_os = "fuchsia")]
797impl fidl::endpoints::ServiceMarker for ServiceMarker {
798 type Proxy = ServiceProxy;
799 type Request = ServiceRequest;
800 const SERVICE_NAME: &'static str = "fuchsia.offers.test.Service";
801}
802
803#[cfg(target_os = "fuchsia")]
806pub enum ServiceRequest {
807 Device(HandshakeRequestStream),
808}
809
810#[cfg(target_os = "fuchsia")]
811impl fidl::endpoints::ServiceRequest for ServiceRequest {
812 type Service = ServiceMarker;
813
814 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
815 match name {
816 "device" => Self::Device(
817 <HandshakeRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
818 ),
819 _ => panic!("no such member protocol name for service Service"),
820 }
821 }
822
823 fn member_names() -> &'static [&'static str] {
824 &["device"]
825 }
826}
827#[cfg(target_os = "fuchsia")]
828pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
829
830#[cfg(target_os = "fuchsia")]
831impl fidl::endpoints::ServiceProxy for ServiceProxy {
832 type Service = ServiceMarker;
833
834 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
835 Self(opener)
836 }
837}
838
839#[cfg(target_os = "fuchsia")]
840impl ServiceProxy {
841 pub fn connect_to_device(&self) -> Result<HandshakeProxy, fidl::Error> {
842 let (proxy, server_end) = fidl::endpoints::create_proxy::<HandshakeMarker>();
843 self.connect_channel_to_device(server_end)?;
844 Ok(proxy)
845 }
846
847 pub fn connect_to_device_sync(&self) -> Result<HandshakeSynchronousProxy, fidl::Error> {
850 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<HandshakeMarker>();
851 self.connect_channel_to_device(server_end)?;
852 Ok(proxy)
853 }
854
855 pub fn connect_channel_to_device(
858 &self,
859 server_end: fidl::endpoints::ServerEnd<HandshakeMarker>,
860 ) -> Result<(), fidl::Error> {
861 self.0.open_member("device", server_end.into_channel())
862 }
863
864 pub fn instance_name(&self) -> &str {
865 self.0.instance_name()
866 }
867}
868
869mod internal {
870 use super::*;
871}