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