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_component_client_test__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct EmptyProtocolMarker;
16
17impl fidl::endpoints::ProtocolMarker for EmptyProtocolMarker {
18 type Proxy = EmptyProtocolProxy;
19 type RequestStream = EmptyProtocolRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = EmptyProtocolSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.component.client.test.EmptyProtocol";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for EmptyProtocolMarker {}
26
27pub trait EmptyProtocolProxyInterface: Send + Sync {}
28#[derive(Debug)]
29#[cfg(target_os = "fuchsia")]
30pub struct EmptyProtocolSynchronousProxy {
31 client: fidl::client::sync::Client,
32}
33
34#[cfg(target_os = "fuchsia")]
35impl fidl::endpoints::SynchronousProxy for EmptyProtocolSynchronousProxy {
36 type Proxy = EmptyProtocolProxy;
37 type Protocol = EmptyProtocolMarker;
38
39 fn from_channel(inner: fidl::Channel) -> Self {
40 Self::new(inner)
41 }
42
43 fn into_channel(self) -> fidl::Channel {
44 self.client.into_channel()
45 }
46
47 fn as_channel(&self) -> &fidl::Channel {
48 self.client.as_channel()
49 }
50}
51
52#[cfg(target_os = "fuchsia")]
53impl EmptyProtocolSynchronousProxy {
54 pub fn new(channel: fidl::Channel) -> Self {
55 let protocol_name = <EmptyProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
56 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
57 }
58
59 pub fn into_channel(self) -> fidl::Channel {
60 self.client.into_channel()
61 }
62
63 pub fn wait_for_event(
66 &self,
67 deadline: zx::MonotonicInstant,
68 ) -> Result<EmptyProtocolEvent, fidl::Error> {
69 EmptyProtocolEvent::decode(self.client.wait_for_event(deadline)?)
70 }
71}
72
73#[cfg(target_os = "fuchsia")]
74impl From<EmptyProtocolSynchronousProxy> for zx::Handle {
75 fn from(value: EmptyProtocolSynchronousProxy) -> Self {
76 value.into_channel().into()
77 }
78}
79
80#[cfg(target_os = "fuchsia")]
81impl From<fidl::Channel> for EmptyProtocolSynchronousProxy {
82 fn from(value: fidl::Channel) -> Self {
83 Self::new(value)
84 }
85}
86
87#[cfg(target_os = "fuchsia")]
88impl fidl::endpoints::FromClient for EmptyProtocolSynchronousProxy {
89 type Protocol = EmptyProtocolMarker;
90
91 fn from_client(value: fidl::endpoints::ClientEnd<EmptyProtocolMarker>) -> Self {
92 Self::new(value.into_channel())
93 }
94}
95
96#[derive(Debug, Clone)]
97pub struct EmptyProtocolProxy {
98 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
99}
100
101impl fidl::endpoints::Proxy for EmptyProtocolProxy {
102 type Protocol = EmptyProtocolMarker;
103
104 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
105 Self::new(inner)
106 }
107
108 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
109 self.client.into_channel().map_err(|client| Self { client })
110 }
111
112 fn as_channel(&self) -> &::fidl::AsyncChannel {
113 self.client.as_channel()
114 }
115}
116
117impl EmptyProtocolProxy {
118 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
120 let protocol_name = <EmptyProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
121 Self { client: fidl::client::Client::new(channel, protocol_name) }
122 }
123
124 pub fn take_event_stream(&self) -> EmptyProtocolEventStream {
130 EmptyProtocolEventStream { event_receiver: self.client.take_event_receiver() }
131 }
132}
133
134impl EmptyProtocolProxyInterface for EmptyProtocolProxy {}
135
136pub struct EmptyProtocolEventStream {
137 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
138}
139
140impl std::marker::Unpin for EmptyProtocolEventStream {}
141
142impl futures::stream::FusedStream for EmptyProtocolEventStream {
143 fn is_terminated(&self) -> bool {
144 self.event_receiver.is_terminated()
145 }
146}
147
148impl futures::Stream for EmptyProtocolEventStream {
149 type Item = Result<EmptyProtocolEvent, fidl::Error>;
150
151 fn poll_next(
152 mut self: std::pin::Pin<&mut Self>,
153 cx: &mut std::task::Context<'_>,
154 ) -> std::task::Poll<Option<Self::Item>> {
155 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
156 &mut self.event_receiver,
157 cx
158 )?) {
159 Some(buf) => std::task::Poll::Ready(Some(EmptyProtocolEvent::decode(buf))),
160 None => std::task::Poll::Ready(None),
161 }
162 }
163}
164
165#[derive(Debug)]
166pub enum EmptyProtocolEvent {}
167
168impl EmptyProtocolEvent {
169 fn decode(
171 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
172 ) -> Result<EmptyProtocolEvent, fidl::Error> {
173 let (bytes, _handles) = buf.split_mut();
174 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
175 debug_assert_eq!(tx_header.tx_id, 0);
176 match tx_header.ordinal {
177 _ => Err(fidl::Error::UnknownOrdinal {
178 ordinal: tx_header.ordinal,
179 protocol_name: <EmptyProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
180 }),
181 }
182 }
183}
184
185pub struct EmptyProtocolRequestStream {
187 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
188 is_terminated: bool,
189}
190
191impl std::marker::Unpin for EmptyProtocolRequestStream {}
192
193impl futures::stream::FusedStream for EmptyProtocolRequestStream {
194 fn is_terminated(&self) -> bool {
195 self.is_terminated
196 }
197}
198
199impl fidl::endpoints::RequestStream for EmptyProtocolRequestStream {
200 type Protocol = EmptyProtocolMarker;
201 type ControlHandle = EmptyProtocolControlHandle;
202
203 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
204 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
205 }
206
207 fn control_handle(&self) -> Self::ControlHandle {
208 EmptyProtocolControlHandle { inner: self.inner.clone() }
209 }
210
211 fn into_inner(
212 self,
213 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
214 {
215 (self.inner, self.is_terminated)
216 }
217
218 fn from_inner(
219 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
220 is_terminated: bool,
221 ) -> Self {
222 Self { inner, is_terminated }
223 }
224}
225
226impl futures::Stream for EmptyProtocolRequestStream {
227 type Item = Result<EmptyProtocolRequest, fidl::Error>;
228
229 fn poll_next(
230 mut self: std::pin::Pin<&mut Self>,
231 cx: &mut std::task::Context<'_>,
232 ) -> std::task::Poll<Option<Self::Item>> {
233 let this = &mut *self;
234 if this.inner.check_shutdown(cx) {
235 this.is_terminated = true;
236 return std::task::Poll::Ready(None);
237 }
238 if this.is_terminated {
239 panic!("polled EmptyProtocolRequestStream after completion");
240 }
241 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
242 |bytes, handles| {
243 match this.inner.channel().read_etc(cx, bytes, handles) {
244 std::task::Poll::Ready(Ok(())) => {}
245 std::task::Poll::Pending => return std::task::Poll::Pending,
246 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
247 this.is_terminated = true;
248 return std::task::Poll::Ready(None);
249 }
250 std::task::Poll::Ready(Err(e)) => {
251 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
252 e.into(),
253 ))));
254 }
255 }
256
257 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
259
260 std::task::Poll::Ready(Some(match header.ordinal {
261 _ => Err(fidl::Error::UnknownOrdinal {
262 ordinal: header.ordinal,
263 protocol_name:
264 <EmptyProtocolMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
265 }),
266 }))
267 },
268 )
269 }
270}
271
272#[derive(Debug)]
274pub enum EmptyProtocolRequest {}
275
276impl EmptyProtocolRequest {
277 pub fn method_name(&self) -> &'static str {
279 match *self {}
280 }
281}
282
283#[derive(Debug, Clone)]
284pub struct EmptyProtocolControlHandle {
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286}
287
288impl fidl::endpoints::ControlHandle for EmptyProtocolControlHandle {
289 fn shutdown(&self) {
290 self.inner.shutdown()
291 }
292 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
293 self.inner.shutdown_with_epitaph(status)
294 }
295
296 fn is_closed(&self) -> bool {
297 self.inner.channel().is_closed()
298 }
299 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
300 self.inner.channel().on_closed()
301 }
302
303 #[cfg(target_os = "fuchsia")]
304 fn signal_peer(
305 &self,
306 clear_mask: zx::Signals,
307 set_mask: zx::Signals,
308 ) -> Result<(), zx_status::Status> {
309 use fidl::Peered;
310 self.inner.channel().signal_peer(clear_mask, set_mask)
311 }
312}
313
314impl EmptyProtocolControlHandle {}
315
316#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
317pub struct ProtocolAMarker;
318
319impl fidl::endpoints::ProtocolMarker for ProtocolAMarker {
320 type Proxy = ProtocolAProxy;
321 type RequestStream = ProtocolARequestStream;
322 #[cfg(target_os = "fuchsia")]
323 type SynchronousProxy = ProtocolASynchronousProxy;
324
325 const DEBUG_NAME: &'static str = "fuchsia.component.client.test.ProtocolA";
326}
327impl fidl::endpoints::DiscoverableProtocolMarker for ProtocolAMarker {}
328
329pub trait ProtocolAProxyInterface: Send + Sync {
330 type FooResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
331 fn r#foo(&self) -> Self::FooResponseFut;
332}
333#[derive(Debug)]
334#[cfg(target_os = "fuchsia")]
335pub struct ProtocolASynchronousProxy {
336 client: fidl::client::sync::Client,
337}
338
339#[cfg(target_os = "fuchsia")]
340impl fidl::endpoints::SynchronousProxy for ProtocolASynchronousProxy {
341 type Proxy = ProtocolAProxy;
342 type Protocol = ProtocolAMarker;
343
344 fn from_channel(inner: fidl::Channel) -> Self {
345 Self::new(inner)
346 }
347
348 fn into_channel(self) -> fidl::Channel {
349 self.client.into_channel()
350 }
351
352 fn as_channel(&self) -> &fidl::Channel {
353 self.client.as_channel()
354 }
355}
356
357#[cfg(target_os = "fuchsia")]
358impl ProtocolASynchronousProxy {
359 pub fn new(channel: fidl::Channel) -> Self {
360 let protocol_name = <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
361 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
362 }
363
364 pub fn into_channel(self) -> fidl::Channel {
365 self.client.into_channel()
366 }
367
368 pub fn wait_for_event(
371 &self,
372 deadline: zx::MonotonicInstant,
373 ) -> Result<ProtocolAEvent, fidl::Error> {
374 ProtocolAEvent::decode(self.client.wait_for_event(deadline)?)
375 }
376
377 pub fn r#foo(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
379 let _response =
380 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
381 (),
382 0x5acb5937e9c47126,
383 fidl::encoding::DynamicFlags::empty(),
384 ___deadline,
385 )?;
386 Ok(_response)
387 }
388}
389
390#[cfg(target_os = "fuchsia")]
391impl From<ProtocolASynchronousProxy> for zx::Handle {
392 fn from(value: ProtocolASynchronousProxy) -> Self {
393 value.into_channel().into()
394 }
395}
396
397#[cfg(target_os = "fuchsia")]
398impl From<fidl::Channel> for ProtocolASynchronousProxy {
399 fn from(value: fidl::Channel) -> Self {
400 Self::new(value)
401 }
402}
403
404#[cfg(target_os = "fuchsia")]
405impl fidl::endpoints::FromClient for ProtocolASynchronousProxy {
406 type Protocol = ProtocolAMarker;
407
408 fn from_client(value: fidl::endpoints::ClientEnd<ProtocolAMarker>) -> Self {
409 Self::new(value.into_channel())
410 }
411}
412
413#[derive(Debug, Clone)]
414pub struct ProtocolAProxy {
415 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
416}
417
418impl fidl::endpoints::Proxy for ProtocolAProxy {
419 type Protocol = ProtocolAMarker;
420
421 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
422 Self::new(inner)
423 }
424
425 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
426 self.client.into_channel().map_err(|client| Self { client })
427 }
428
429 fn as_channel(&self) -> &::fidl::AsyncChannel {
430 self.client.as_channel()
431 }
432}
433
434impl ProtocolAProxy {
435 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
437 let protocol_name = <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
438 Self { client: fidl::client::Client::new(channel, protocol_name) }
439 }
440
441 pub fn take_event_stream(&self) -> ProtocolAEventStream {
447 ProtocolAEventStream { event_receiver: self.client.take_event_receiver() }
448 }
449
450 pub fn r#foo(
452 &self,
453 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
454 ProtocolAProxyInterface::r#foo(self)
455 }
456}
457
458impl ProtocolAProxyInterface for ProtocolAProxy {
459 type FooResponseFut =
460 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
461 fn r#foo(&self) -> Self::FooResponseFut {
462 fn _decode(
463 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
464 ) -> Result<(), fidl::Error> {
465 let _response = fidl::client::decode_transaction_body::<
466 fidl::encoding::EmptyPayload,
467 fidl::encoding::DefaultFuchsiaResourceDialect,
468 0x5acb5937e9c47126,
469 >(_buf?)?;
470 Ok(_response)
471 }
472 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
473 (),
474 0x5acb5937e9c47126,
475 fidl::encoding::DynamicFlags::empty(),
476 _decode,
477 )
478 }
479}
480
481pub struct ProtocolAEventStream {
482 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
483}
484
485impl std::marker::Unpin for ProtocolAEventStream {}
486
487impl futures::stream::FusedStream for ProtocolAEventStream {
488 fn is_terminated(&self) -> bool {
489 self.event_receiver.is_terminated()
490 }
491}
492
493impl futures::Stream for ProtocolAEventStream {
494 type Item = Result<ProtocolAEvent, fidl::Error>;
495
496 fn poll_next(
497 mut self: std::pin::Pin<&mut Self>,
498 cx: &mut std::task::Context<'_>,
499 ) -> std::task::Poll<Option<Self::Item>> {
500 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
501 &mut self.event_receiver,
502 cx
503 )?) {
504 Some(buf) => std::task::Poll::Ready(Some(ProtocolAEvent::decode(buf))),
505 None => std::task::Poll::Ready(None),
506 }
507 }
508}
509
510#[derive(Debug)]
511pub enum ProtocolAEvent {}
512
513impl ProtocolAEvent {
514 fn decode(
516 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
517 ) -> Result<ProtocolAEvent, fidl::Error> {
518 let (bytes, _handles) = buf.split_mut();
519 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
520 debug_assert_eq!(tx_header.tx_id, 0);
521 match tx_header.ordinal {
522 _ => Err(fidl::Error::UnknownOrdinal {
523 ordinal: tx_header.ordinal,
524 protocol_name: <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
525 }),
526 }
527 }
528}
529
530pub struct ProtocolARequestStream {
532 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
533 is_terminated: bool,
534}
535
536impl std::marker::Unpin for ProtocolARequestStream {}
537
538impl futures::stream::FusedStream for ProtocolARequestStream {
539 fn is_terminated(&self) -> bool {
540 self.is_terminated
541 }
542}
543
544impl fidl::endpoints::RequestStream for ProtocolARequestStream {
545 type Protocol = ProtocolAMarker;
546 type ControlHandle = ProtocolAControlHandle;
547
548 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
549 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
550 }
551
552 fn control_handle(&self) -> Self::ControlHandle {
553 ProtocolAControlHandle { inner: self.inner.clone() }
554 }
555
556 fn into_inner(
557 self,
558 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
559 {
560 (self.inner, self.is_terminated)
561 }
562
563 fn from_inner(
564 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
565 is_terminated: bool,
566 ) -> Self {
567 Self { inner, is_terminated }
568 }
569}
570
571impl futures::Stream for ProtocolARequestStream {
572 type Item = Result<ProtocolARequest, fidl::Error>;
573
574 fn poll_next(
575 mut self: std::pin::Pin<&mut Self>,
576 cx: &mut std::task::Context<'_>,
577 ) -> std::task::Poll<Option<Self::Item>> {
578 let this = &mut *self;
579 if this.inner.check_shutdown(cx) {
580 this.is_terminated = true;
581 return std::task::Poll::Ready(None);
582 }
583 if this.is_terminated {
584 panic!("polled ProtocolARequestStream after completion");
585 }
586 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
587 |bytes, handles| {
588 match this.inner.channel().read_etc(cx, bytes, handles) {
589 std::task::Poll::Ready(Ok(())) => {}
590 std::task::Poll::Pending => return std::task::Poll::Pending,
591 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
592 this.is_terminated = true;
593 return std::task::Poll::Ready(None);
594 }
595 std::task::Poll::Ready(Err(e)) => {
596 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
597 e.into(),
598 ))));
599 }
600 }
601
602 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
604
605 std::task::Poll::Ready(Some(match header.ordinal {
606 0x5acb5937e9c47126 => {
607 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
608 let mut req = fidl::new_empty!(
609 fidl::encoding::EmptyPayload,
610 fidl::encoding::DefaultFuchsiaResourceDialect
611 );
612 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
613 let control_handle = ProtocolAControlHandle { inner: this.inner.clone() };
614 Ok(ProtocolARequest::Foo {
615 responder: ProtocolAFooResponder {
616 control_handle: std::mem::ManuallyDrop::new(control_handle),
617 tx_id: header.tx_id,
618 },
619 })
620 }
621 _ => Err(fidl::Error::UnknownOrdinal {
622 ordinal: header.ordinal,
623 protocol_name:
624 <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
625 }),
626 }))
627 },
628 )
629 }
630}
631
632#[derive(Debug)]
634pub enum ProtocolARequest {
635 Foo { responder: ProtocolAFooResponder },
637}
638
639impl ProtocolARequest {
640 #[allow(irrefutable_let_patterns)]
641 pub fn into_foo(self) -> Option<(ProtocolAFooResponder)> {
642 if let ProtocolARequest::Foo { responder } = self { Some((responder)) } else { None }
643 }
644
645 pub fn method_name(&self) -> &'static str {
647 match *self {
648 ProtocolARequest::Foo { .. } => "foo",
649 }
650 }
651}
652
653#[derive(Debug, Clone)]
654pub struct ProtocolAControlHandle {
655 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
656}
657
658impl fidl::endpoints::ControlHandle for ProtocolAControlHandle {
659 fn shutdown(&self) {
660 self.inner.shutdown()
661 }
662 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
663 self.inner.shutdown_with_epitaph(status)
664 }
665
666 fn is_closed(&self) -> bool {
667 self.inner.channel().is_closed()
668 }
669 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
670 self.inner.channel().on_closed()
671 }
672
673 #[cfg(target_os = "fuchsia")]
674 fn signal_peer(
675 &self,
676 clear_mask: zx::Signals,
677 set_mask: zx::Signals,
678 ) -> Result<(), zx_status::Status> {
679 use fidl::Peered;
680 self.inner.channel().signal_peer(clear_mask, set_mask)
681 }
682}
683
684impl ProtocolAControlHandle {}
685
686#[must_use = "FIDL methods require a response to be sent"]
687#[derive(Debug)]
688pub struct ProtocolAFooResponder {
689 control_handle: std::mem::ManuallyDrop<ProtocolAControlHandle>,
690 tx_id: u32,
691}
692
693impl std::ops::Drop for ProtocolAFooResponder {
697 fn drop(&mut self) {
698 self.control_handle.shutdown();
699 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
701 }
702}
703
704impl fidl::endpoints::Responder for ProtocolAFooResponder {
705 type ControlHandle = ProtocolAControlHandle;
706
707 fn control_handle(&self) -> &ProtocolAControlHandle {
708 &self.control_handle
709 }
710
711 fn drop_without_shutdown(mut self) {
712 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
714 std::mem::forget(self);
716 }
717}
718
719impl ProtocolAFooResponder {
720 pub fn send(self) -> Result<(), fidl::Error> {
724 let _result = self.send_raw();
725 if _result.is_err() {
726 self.control_handle.shutdown();
727 }
728 self.drop_without_shutdown();
729 _result
730 }
731
732 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
734 let _result = self.send_raw();
735 self.drop_without_shutdown();
736 _result
737 }
738
739 fn send_raw(&self) -> Result<(), fidl::Error> {
740 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
741 (),
742 self.tx_id,
743 0x5acb5937e9c47126,
744 fidl::encoding::DynamicFlags::empty(),
745 )
746 }
747}
748
749#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
750pub struct ProtocolBMarker;
751
752impl fidl::endpoints::ProtocolMarker for ProtocolBMarker {
753 type Proxy = ProtocolBProxy;
754 type RequestStream = ProtocolBRequestStream;
755 #[cfg(target_os = "fuchsia")]
756 type SynchronousProxy = ProtocolBSynchronousProxy;
757
758 const DEBUG_NAME: &'static str = "fuchsia.component.client.test.ProtocolB";
759}
760impl fidl::endpoints::DiscoverableProtocolMarker for ProtocolBMarker {}
761
762pub trait ProtocolBProxyInterface: Send + Sync {
763 type FooResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
764 fn r#foo(&self) -> Self::FooResponseFut;
765}
766#[derive(Debug)]
767#[cfg(target_os = "fuchsia")]
768pub struct ProtocolBSynchronousProxy {
769 client: fidl::client::sync::Client,
770}
771
772#[cfg(target_os = "fuchsia")]
773impl fidl::endpoints::SynchronousProxy for ProtocolBSynchronousProxy {
774 type Proxy = ProtocolBProxy;
775 type Protocol = ProtocolBMarker;
776
777 fn from_channel(inner: fidl::Channel) -> Self {
778 Self::new(inner)
779 }
780
781 fn into_channel(self) -> fidl::Channel {
782 self.client.into_channel()
783 }
784
785 fn as_channel(&self) -> &fidl::Channel {
786 self.client.as_channel()
787 }
788}
789
790#[cfg(target_os = "fuchsia")]
791impl ProtocolBSynchronousProxy {
792 pub fn new(channel: fidl::Channel) -> Self {
793 let protocol_name = <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
794 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
795 }
796
797 pub fn into_channel(self) -> fidl::Channel {
798 self.client.into_channel()
799 }
800
801 pub fn wait_for_event(
804 &self,
805 deadline: zx::MonotonicInstant,
806 ) -> Result<ProtocolBEvent, fidl::Error> {
807 ProtocolBEvent::decode(self.client.wait_for_event(deadline)?)
808 }
809
810 pub fn r#foo(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
812 let _response =
813 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
814 (),
815 0x26550949f1431acf,
816 fidl::encoding::DynamicFlags::empty(),
817 ___deadline,
818 )?;
819 Ok(_response)
820 }
821}
822
823#[cfg(target_os = "fuchsia")]
824impl From<ProtocolBSynchronousProxy> for zx::Handle {
825 fn from(value: ProtocolBSynchronousProxy) -> Self {
826 value.into_channel().into()
827 }
828}
829
830#[cfg(target_os = "fuchsia")]
831impl From<fidl::Channel> for ProtocolBSynchronousProxy {
832 fn from(value: fidl::Channel) -> Self {
833 Self::new(value)
834 }
835}
836
837#[cfg(target_os = "fuchsia")]
838impl fidl::endpoints::FromClient for ProtocolBSynchronousProxy {
839 type Protocol = ProtocolBMarker;
840
841 fn from_client(value: fidl::endpoints::ClientEnd<ProtocolBMarker>) -> Self {
842 Self::new(value.into_channel())
843 }
844}
845
846#[derive(Debug, Clone)]
847pub struct ProtocolBProxy {
848 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
849}
850
851impl fidl::endpoints::Proxy for ProtocolBProxy {
852 type Protocol = ProtocolBMarker;
853
854 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
855 Self::new(inner)
856 }
857
858 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
859 self.client.into_channel().map_err(|client| Self { client })
860 }
861
862 fn as_channel(&self) -> &::fidl::AsyncChannel {
863 self.client.as_channel()
864 }
865}
866
867impl ProtocolBProxy {
868 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
870 let protocol_name = <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
871 Self { client: fidl::client::Client::new(channel, protocol_name) }
872 }
873
874 pub fn take_event_stream(&self) -> ProtocolBEventStream {
880 ProtocolBEventStream { event_receiver: self.client.take_event_receiver() }
881 }
882
883 pub fn r#foo(
885 &self,
886 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
887 ProtocolBProxyInterface::r#foo(self)
888 }
889}
890
891impl ProtocolBProxyInterface for ProtocolBProxy {
892 type FooResponseFut =
893 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
894 fn r#foo(&self) -> Self::FooResponseFut {
895 fn _decode(
896 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
897 ) -> Result<(), fidl::Error> {
898 let _response = fidl::client::decode_transaction_body::<
899 fidl::encoding::EmptyPayload,
900 fidl::encoding::DefaultFuchsiaResourceDialect,
901 0x26550949f1431acf,
902 >(_buf?)?;
903 Ok(_response)
904 }
905 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
906 (),
907 0x26550949f1431acf,
908 fidl::encoding::DynamicFlags::empty(),
909 _decode,
910 )
911 }
912}
913
914pub struct ProtocolBEventStream {
915 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
916}
917
918impl std::marker::Unpin for ProtocolBEventStream {}
919
920impl futures::stream::FusedStream for ProtocolBEventStream {
921 fn is_terminated(&self) -> bool {
922 self.event_receiver.is_terminated()
923 }
924}
925
926impl futures::Stream for ProtocolBEventStream {
927 type Item = Result<ProtocolBEvent, fidl::Error>;
928
929 fn poll_next(
930 mut self: std::pin::Pin<&mut Self>,
931 cx: &mut std::task::Context<'_>,
932 ) -> std::task::Poll<Option<Self::Item>> {
933 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
934 &mut self.event_receiver,
935 cx
936 )?) {
937 Some(buf) => std::task::Poll::Ready(Some(ProtocolBEvent::decode(buf))),
938 None => std::task::Poll::Ready(None),
939 }
940 }
941}
942
943#[derive(Debug)]
944pub enum ProtocolBEvent {}
945
946impl ProtocolBEvent {
947 fn decode(
949 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
950 ) -> Result<ProtocolBEvent, fidl::Error> {
951 let (bytes, _handles) = buf.split_mut();
952 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
953 debug_assert_eq!(tx_header.tx_id, 0);
954 match tx_header.ordinal {
955 _ => Err(fidl::Error::UnknownOrdinal {
956 ordinal: tx_header.ordinal,
957 protocol_name: <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
958 }),
959 }
960 }
961}
962
963pub struct ProtocolBRequestStream {
965 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
966 is_terminated: bool,
967}
968
969impl std::marker::Unpin for ProtocolBRequestStream {}
970
971impl futures::stream::FusedStream for ProtocolBRequestStream {
972 fn is_terminated(&self) -> bool {
973 self.is_terminated
974 }
975}
976
977impl fidl::endpoints::RequestStream for ProtocolBRequestStream {
978 type Protocol = ProtocolBMarker;
979 type ControlHandle = ProtocolBControlHandle;
980
981 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
982 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
983 }
984
985 fn control_handle(&self) -> Self::ControlHandle {
986 ProtocolBControlHandle { inner: self.inner.clone() }
987 }
988
989 fn into_inner(
990 self,
991 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
992 {
993 (self.inner, self.is_terminated)
994 }
995
996 fn from_inner(
997 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
998 is_terminated: bool,
999 ) -> Self {
1000 Self { inner, is_terminated }
1001 }
1002}
1003
1004impl futures::Stream for ProtocolBRequestStream {
1005 type Item = Result<ProtocolBRequest, fidl::Error>;
1006
1007 fn poll_next(
1008 mut self: std::pin::Pin<&mut Self>,
1009 cx: &mut std::task::Context<'_>,
1010 ) -> std::task::Poll<Option<Self::Item>> {
1011 let this = &mut *self;
1012 if this.inner.check_shutdown(cx) {
1013 this.is_terminated = true;
1014 return std::task::Poll::Ready(None);
1015 }
1016 if this.is_terminated {
1017 panic!("polled ProtocolBRequestStream after completion");
1018 }
1019 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1020 |bytes, handles| {
1021 match this.inner.channel().read_etc(cx, bytes, handles) {
1022 std::task::Poll::Ready(Ok(())) => {}
1023 std::task::Poll::Pending => return std::task::Poll::Pending,
1024 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1025 this.is_terminated = true;
1026 return std::task::Poll::Ready(None);
1027 }
1028 std::task::Poll::Ready(Err(e)) => {
1029 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1030 e.into(),
1031 ))));
1032 }
1033 }
1034
1035 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1037
1038 std::task::Poll::Ready(Some(match header.ordinal {
1039 0x26550949f1431acf => {
1040 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1041 let mut req = fidl::new_empty!(
1042 fidl::encoding::EmptyPayload,
1043 fidl::encoding::DefaultFuchsiaResourceDialect
1044 );
1045 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1046 let control_handle = ProtocolBControlHandle { inner: this.inner.clone() };
1047 Ok(ProtocolBRequest::Foo {
1048 responder: ProtocolBFooResponder {
1049 control_handle: std::mem::ManuallyDrop::new(control_handle),
1050 tx_id: header.tx_id,
1051 },
1052 })
1053 }
1054 _ => Err(fidl::Error::UnknownOrdinal {
1055 ordinal: header.ordinal,
1056 protocol_name:
1057 <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1058 }),
1059 }))
1060 },
1061 )
1062 }
1063}
1064
1065#[derive(Debug)]
1067pub enum ProtocolBRequest {
1068 Foo { responder: ProtocolBFooResponder },
1070}
1071
1072impl ProtocolBRequest {
1073 #[allow(irrefutable_let_patterns)]
1074 pub fn into_foo(self) -> Option<(ProtocolBFooResponder)> {
1075 if let ProtocolBRequest::Foo { responder } = self { Some((responder)) } else { None }
1076 }
1077
1078 pub fn method_name(&self) -> &'static str {
1080 match *self {
1081 ProtocolBRequest::Foo { .. } => "foo",
1082 }
1083 }
1084}
1085
1086#[derive(Debug, Clone)]
1087pub struct ProtocolBControlHandle {
1088 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1089}
1090
1091impl fidl::endpoints::ControlHandle for ProtocolBControlHandle {
1092 fn shutdown(&self) {
1093 self.inner.shutdown()
1094 }
1095 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1096 self.inner.shutdown_with_epitaph(status)
1097 }
1098
1099 fn is_closed(&self) -> bool {
1100 self.inner.channel().is_closed()
1101 }
1102 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1103 self.inner.channel().on_closed()
1104 }
1105
1106 #[cfg(target_os = "fuchsia")]
1107 fn signal_peer(
1108 &self,
1109 clear_mask: zx::Signals,
1110 set_mask: zx::Signals,
1111 ) -> Result<(), zx_status::Status> {
1112 use fidl::Peered;
1113 self.inner.channel().signal_peer(clear_mask, set_mask)
1114 }
1115}
1116
1117impl ProtocolBControlHandle {}
1118
1119#[must_use = "FIDL methods require a response to be sent"]
1120#[derive(Debug)]
1121pub struct ProtocolBFooResponder {
1122 control_handle: std::mem::ManuallyDrop<ProtocolBControlHandle>,
1123 tx_id: u32,
1124}
1125
1126impl std::ops::Drop for ProtocolBFooResponder {
1130 fn drop(&mut self) {
1131 self.control_handle.shutdown();
1132 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1134 }
1135}
1136
1137impl fidl::endpoints::Responder for ProtocolBFooResponder {
1138 type ControlHandle = ProtocolBControlHandle;
1139
1140 fn control_handle(&self) -> &ProtocolBControlHandle {
1141 &self.control_handle
1142 }
1143
1144 fn drop_without_shutdown(mut self) {
1145 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1147 std::mem::forget(self);
1149 }
1150}
1151
1152impl ProtocolBFooResponder {
1153 pub fn send(self) -> Result<(), fidl::Error> {
1157 let _result = self.send_raw();
1158 if _result.is_err() {
1159 self.control_handle.shutdown();
1160 }
1161 self.drop_without_shutdown();
1162 _result
1163 }
1164
1165 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1167 let _result = self.send_raw();
1168 self.drop_without_shutdown();
1169 _result
1170 }
1171
1172 fn send_raw(&self) -> Result<(), fidl::Error> {
1173 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1174 (),
1175 self.tx_id,
1176 0x26550949f1431acf,
1177 fidl::encoding::DynamicFlags::empty(),
1178 )
1179 }
1180}
1181
1182#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1183pub struct ServiceMarker;
1184
1185#[cfg(target_os = "fuchsia")]
1186impl fidl::endpoints::ServiceMarker for ServiceMarker {
1187 type Proxy = ServiceProxy;
1188 type Request = ServiceRequest;
1189 const SERVICE_NAME: &'static str = "fuchsia.component.client.test.Service";
1190}
1191
1192#[cfg(target_os = "fuchsia")]
1196pub enum ServiceRequest {
1197 First(ProtocolARequestStream),
1198 Second(ProtocolBRequestStream),
1199}
1200
1201#[cfg(target_os = "fuchsia")]
1202impl fidl::endpoints::ServiceRequest for ServiceRequest {
1203 type Service = ServiceMarker;
1204
1205 fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1206 match name {
1207 "first" => Self::First(
1208 <ProtocolARequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1209 ),
1210 "second" => Self::Second(
1211 <ProtocolBRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1212 ),
1213 _ => panic!("no such member protocol name for service Service"),
1214 }
1215 }
1216
1217 fn member_names() -> &'static [&'static str] {
1218 &["first", "second"]
1219 }
1220}
1221#[cfg(target_os = "fuchsia")]
1223pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1224
1225#[cfg(target_os = "fuchsia")]
1226impl fidl::endpoints::ServiceProxy for ServiceProxy {
1227 type Service = ServiceMarker;
1228
1229 fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1230 Self(opener)
1231 }
1232}
1233
1234#[cfg(target_os = "fuchsia")]
1235impl ServiceProxy {
1236 pub fn connect_to_first(&self) -> Result<ProtocolAProxy, fidl::Error> {
1237 let (proxy, server_end) = fidl::endpoints::create_proxy::<ProtocolAMarker>();
1238 self.connect_channel_to_first(server_end)?;
1239 Ok(proxy)
1240 }
1241
1242 pub fn connect_to_first_sync(&self) -> Result<ProtocolASynchronousProxy, fidl::Error> {
1245 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProtocolAMarker>();
1246 self.connect_channel_to_first(server_end)?;
1247 Ok(proxy)
1248 }
1249
1250 pub fn connect_channel_to_first(
1253 &self,
1254 server_end: fidl::endpoints::ServerEnd<ProtocolAMarker>,
1255 ) -> Result<(), fidl::Error> {
1256 self.0.open_member("first", server_end.into_channel())
1257 }
1258 pub fn connect_to_second(&self) -> Result<ProtocolBProxy, fidl::Error> {
1259 let (proxy, server_end) = fidl::endpoints::create_proxy::<ProtocolBMarker>();
1260 self.connect_channel_to_second(server_end)?;
1261 Ok(proxy)
1262 }
1263
1264 pub fn connect_to_second_sync(&self) -> Result<ProtocolBSynchronousProxy, fidl::Error> {
1267 let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProtocolBMarker>();
1268 self.connect_channel_to_second(server_end)?;
1269 Ok(proxy)
1270 }
1271
1272 pub fn connect_channel_to_second(
1275 &self,
1276 server_end: fidl::endpoints::ServerEnd<ProtocolBMarker>,
1277 ) -> Result<(), fidl::Error> {
1278 self.0.open_member("second", server_end.into_channel())
1279 }
1280
1281 pub fn instance_name(&self) -> &str {
1282 self.0.instance_name()
1283 }
1284}
1285
1286mod internal {
1287 use super::*;
1288}