Skip to main content

fidl_fuchsia_component_client_test/
fidl_fuchsia_component_client_test.rs

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