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 fidl::endpoints::ControlHandle for EmptyProtocolControlHandle {
288    fn shutdown(&self) {
289        self.inner.shutdown()
290    }
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        Self { client: fidl::client::sync::Client::new(channel) }
361    }
362
363    pub fn into_channel(self) -> fidl::Channel {
364        self.client.into_channel()
365    }
366
367    /// Waits until an event arrives and returns it. It is safe for other
368    /// threads to make concurrent requests while waiting for an event.
369    pub fn wait_for_event(
370        &self,
371        deadline: zx::MonotonicInstant,
372    ) -> Result<ProtocolAEvent, fidl::Error> {
373        ProtocolAEvent::decode(self.client.wait_for_event::<ProtocolAMarker>(deadline)?)
374    }
375
376    /// Does nothing.
377    pub fn r#foo(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
378        let _response = self.client.send_query::<
379            fidl::encoding::EmptyPayload,
380            fidl::encoding::EmptyPayload,
381            ProtocolAMarker,
382        >(
383            (),
384            0x5acb5937e9c47126,
385            fidl::encoding::DynamicFlags::empty(),
386            ___deadline,
387        )?;
388        Ok(_response)
389    }
390}
391
392#[cfg(target_os = "fuchsia")]
393impl From<ProtocolASynchronousProxy> for zx::NullableHandle {
394    fn from(value: ProtocolASynchronousProxy) -> Self {
395        value.into_channel().into()
396    }
397}
398
399#[cfg(target_os = "fuchsia")]
400impl From<fidl::Channel> for ProtocolASynchronousProxy {
401    fn from(value: fidl::Channel) -> Self {
402        Self::new(value)
403    }
404}
405
406#[cfg(target_os = "fuchsia")]
407impl fidl::endpoints::FromClient for ProtocolASynchronousProxy {
408    type Protocol = ProtocolAMarker;
409
410    fn from_client(value: fidl::endpoints::ClientEnd<ProtocolAMarker>) -> Self {
411        Self::new(value.into_channel())
412    }
413}
414
415#[derive(Debug, Clone)]
416pub struct ProtocolAProxy {
417    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
418}
419
420impl fidl::endpoints::Proxy for ProtocolAProxy {
421    type Protocol = ProtocolAMarker;
422
423    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
424        Self::new(inner)
425    }
426
427    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
428        self.client.into_channel().map_err(|client| Self { client })
429    }
430
431    fn as_channel(&self) -> &::fidl::AsyncChannel {
432        self.client.as_channel()
433    }
434}
435
436impl ProtocolAProxy {
437    /// Create a new Proxy for fuchsia.component.client.test/ProtocolA.
438    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
439        let protocol_name = <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
440        Self { client: fidl::client::Client::new(channel, protocol_name) }
441    }
442
443    /// Get a Stream of events from the remote end of the protocol.
444    ///
445    /// # Panics
446    ///
447    /// Panics if the event stream was already taken.
448    pub fn take_event_stream(&self) -> ProtocolAEventStream {
449        ProtocolAEventStream { event_receiver: self.client.take_event_receiver() }
450    }
451
452    /// Does nothing.
453    pub fn r#foo(
454        &self,
455    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
456        ProtocolAProxyInterface::r#foo(self)
457    }
458}
459
460impl ProtocolAProxyInterface for ProtocolAProxy {
461    type FooResponseFut =
462        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
463    fn r#foo(&self) -> Self::FooResponseFut {
464        fn _decode(
465            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
466        ) -> Result<(), fidl::Error> {
467            let _response = fidl::client::decode_transaction_body::<
468                fidl::encoding::EmptyPayload,
469                fidl::encoding::DefaultFuchsiaResourceDialect,
470                0x5acb5937e9c47126,
471            >(_buf?)?;
472            Ok(_response)
473        }
474        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
475            (),
476            0x5acb5937e9c47126,
477            fidl::encoding::DynamicFlags::empty(),
478            _decode,
479        )
480    }
481}
482
483pub struct ProtocolAEventStream {
484    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
485}
486
487impl std::marker::Unpin for ProtocolAEventStream {}
488
489impl futures::stream::FusedStream for ProtocolAEventStream {
490    fn is_terminated(&self) -> bool {
491        self.event_receiver.is_terminated()
492    }
493}
494
495impl futures::Stream for ProtocolAEventStream {
496    type Item = Result<ProtocolAEvent, fidl::Error>;
497
498    fn poll_next(
499        mut self: std::pin::Pin<&mut Self>,
500        cx: &mut std::task::Context<'_>,
501    ) -> std::task::Poll<Option<Self::Item>> {
502        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
503            &mut self.event_receiver,
504            cx
505        )?) {
506            Some(buf) => std::task::Poll::Ready(Some(ProtocolAEvent::decode(buf))),
507            None => std::task::Poll::Ready(None),
508        }
509    }
510}
511
512#[derive(Debug)]
513pub enum ProtocolAEvent {}
514
515impl ProtocolAEvent {
516    /// Decodes a message buffer as a [`ProtocolAEvent`].
517    fn decode(
518        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
519    ) -> Result<ProtocolAEvent, fidl::Error> {
520        let (bytes, _handles) = buf.split_mut();
521        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
522        debug_assert_eq!(tx_header.tx_id, 0);
523        match tx_header.ordinal {
524            _ => Err(fidl::Error::UnknownOrdinal {
525                ordinal: tx_header.ordinal,
526                protocol_name: <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
527            }),
528        }
529    }
530}
531
532/// A Stream of incoming requests for fuchsia.component.client.test/ProtocolA.
533pub struct ProtocolARequestStream {
534    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
535    is_terminated: bool,
536}
537
538impl std::marker::Unpin for ProtocolARequestStream {}
539
540impl futures::stream::FusedStream for ProtocolARequestStream {
541    fn is_terminated(&self) -> bool {
542        self.is_terminated
543    }
544}
545
546impl fidl::endpoints::RequestStream for ProtocolARequestStream {
547    type Protocol = ProtocolAMarker;
548    type ControlHandle = ProtocolAControlHandle;
549
550    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
551        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
552    }
553
554    fn control_handle(&self) -> Self::ControlHandle {
555        ProtocolAControlHandle { inner: self.inner.clone() }
556    }
557
558    fn into_inner(
559        self,
560    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
561    {
562        (self.inner, self.is_terminated)
563    }
564
565    fn from_inner(
566        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
567        is_terminated: bool,
568    ) -> Self {
569        Self { inner, is_terminated }
570    }
571}
572
573impl futures::Stream for ProtocolARequestStream {
574    type Item = Result<ProtocolARequest, fidl::Error>;
575
576    fn poll_next(
577        mut self: std::pin::Pin<&mut Self>,
578        cx: &mut std::task::Context<'_>,
579    ) -> std::task::Poll<Option<Self::Item>> {
580        let this = &mut *self;
581        if this.inner.check_shutdown(cx) {
582            this.is_terminated = true;
583            return std::task::Poll::Ready(None);
584        }
585        if this.is_terminated {
586            panic!("polled ProtocolARequestStream after completion");
587        }
588        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
589            |bytes, handles| {
590                match this.inner.channel().read_etc(cx, bytes, handles) {
591                    std::task::Poll::Ready(Ok(())) => {}
592                    std::task::Poll::Pending => return std::task::Poll::Pending,
593                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
594                        this.is_terminated = true;
595                        return std::task::Poll::Ready(None);
596                    }
597                    std::task::Poll::Ready(Err(e)) => {
598                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
599                            e.into(),
600                        ))));
601                    }
602                }
603
604                // A message has been received from the channel
605                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
606
607                std::task::Poll::Ready(Some(match header.ordinal {
608                    0x5acb5937e9c47126 => {
609                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
610                        let mut req = fidl::new_empty!(
611                            fidl::encoding::EmptyPayload,
612                            fidl::encoding::DefaultFuchsiaResourceDialect
613                        );
614                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
615                        let control_handle = ProtocolAControlHandle { inner: this.inner.clone() };
616                        Ok(ProtocolARequest::Foo {
617                            responder: ProtocolAFooResponder {
618                                control_handle: std::mem::ManuallyDrop::new(control_handle),
619                                tx_id: header.tx_id,
620                            },
621                        })
622                    }
623                    _ => Err(fidl::Error::UnknownOrdinal {
624                        ordinal: header.ordinal,
625                        protocol_name:
626                            <ProtocolAMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
627                    }),
628                }))
629            },
630        )
631    }
632}
633
634/// A discoverable protocol.
635#[derive(Debug)]
636pub enum ProtocolARequest {
637    /// Does nothing.
638    Foo { responder: ProtocolAFooResponder },
639}
640
641impl ProtocolARequest {
642    #[allow(irrefutable_let_patterns)]
643    pub fn into_foo(self) -> Option<(ProtocolAFooResponder)> {
644        if let ProtocolARequest::Foo { responder } = self { Some((responder)) } else { None }
645    }
646
647    /// Name of the method defined in FIDL
648    pub fn method_name(&self) -> &'static str {
649        match *self {
650            ProtocolARequest::Foo { .. } => "foo",
651        }
652    }
653}
654
655#[derive(Debug, Clone)]
656pub struct ProtocolAControlHandle {
657    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
658}
659
660impl fidl::endpoints::ControlHandle for ProtocolAControlHandle {
661    fn shutdown(&self) {
662        self.inner.shutdown()
663    }
664
665    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
666        self.inner.shutdown_with_epitaph(status)
667    }
668
669    fn is_closed(&self) -> bool {
670        self.inner.channel().is_closed()
671    }
672    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
673        self.inner.channel().on_closed()
674    }
675
676    #[cfg(target_os = "fuchsia")]
677    fn signal_peer(
678        &self,
679        clear_mask: zx::Signals,
680        set_mask: zx::Signals,
681    ) -> Result<(), zx_status::Status> {
682        use fidl::Peered;
683        self.inner.channel().signal_peer(clear_mask, set_mask)
684    }
685}
686
687impl ProtocolAControlHandle {}
688
689#[must_use = "FIDL methods require a response to be sent"]
690#[derive(Debug)]
691pub struct ProtocolAFooResponder {
692    control_handle: std::mem::ManuallyDrop<ProtocolAControlHandle>,
693    tx_id: u32,
694}
695
696/// Set the the channel to be shutdown (see [`ProtocolAControlHandle::shutdown`])
697/// if the responder is dropped without sending a response, so that the client
698/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
699impl std::ops::Drop for ProtocolAFooResponder {
700    fn drop(&mut self) {
701        self.control_handle.shutdown();
702        // Safety: drops once, never accessed again
703        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
704    }
705}
706
707impl fidl::endpoints::Responder for ProtocolAFooResponder {
708    type ControlHandle = ProtocolAControlHandle;
709
710    fn control_handle(&self) -> &ProtocolAControlHandle {
711        &self.control_handle
712    }
713
714    fn drop_without_shutdown(mut self) {
715        // Safety: drops once, never accessed again due to mem::forget
716        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
717        // Prevent Drop from running (which would shut down the channel)
718        std::mem::forget(self);
719    }
720}
721
722impl ProtocolAFooResponder {
723    /// Sends a response to the FIDL transaction.
724    ///
725    /// Sets the channel to shutdown if an error occurs.
726    pub fn send(self) -> Result<(), fidl::Error> {
727        let _result = self.send_raw();
728        if _result.is_err() {
729            self.control_handle.shutdown();
730        }
731        self.drop_without_shutdown();
732        _result
733    }
734
735    /// Similar to "send" but does not shutdown the channel if an error occurs.
736    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
737        let _result = self.send_raw();
738        self.drop_without_shutdown();
739        _result
740    }
741
742    fn send_raw(&self) -> Result<(), fidl::Error> {
743        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
744            (),
745            self.tx_id,
746            0x5acb5937e9c47126,
747            fidl::encoding::DynamicFlags::empty(),
748        )
749    }
750}
751
752#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
753pub struct ProtocolBMarker;
754
755impl fidl::endpoints::ProtocolMarker for ProtocolBMarker {
756    type Proxy = ProtocolBProxy;
757    type RequestStream = ProtocolBRequestStream;
758    #[cfg(target_os = "fuchsia")]
759    type SynchronousProxy = ProtocolBSynchronousProxy;
760
761    const DEBUG_NAME: &'static str = "fuchsia.component.client.test.ProtocolB";
762}
763impl fidl::endpoints::DiscoverableProtocolMarker for ProtocolBMarker {}
764
765pub trait ProtocolBProxyInterface: Send + Sync {
766    type FooResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
767    fn r#foo(&self) -> Self::FooResponseFut;
768}
769#[derive(Debug)]
770#[cfg(target_os = "fuchsia")]
771pub struct ProtocolBSynchronousProxy {
772    client: fidl::client::sync::Client,
773}
774
775#[cfg(target_os = "fuchsia")]
776impl fidl::endpoints::SynchronousProxy for ProtocolBSynchronousProxy {
777    type Proxy = ProtocolBProxy;
778    type Protocol = ProtocolBMarker;
779
780    fn from_channel(inner: fidl::Channel) -> Self {
781        Self::new(inner)
782    }
783
784    fn into_channel(self) -> fidl::Channel {
785        self.client.into_channel()
786    }
787
788    fn as_channel(&self) -> &fidl::Channel {
789        self.client.as_channel()
790    }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl ProtocolBSynchronousProxy {
795    pub fn new(channel: fidl::Channel) -> Self {
796        Self { client: fidl::client::sync::Client::new(channel) }
797    }
798
799    pub fn into_channel(self) -> fidl::Channel {
800        self.client.into_channel()
801    }
802
803    /// Waits until an event arrives and returns it. It is safe for other
804    /// threads to make concurrent requests while waiting for an event.
805    pub fn wait_for_event(
806        &self,
807        deadline: zx::MonotonicInstant,
808    ) -> Result<ProtocolBEvent, fidl::Error> {
809        ProtocolBEvent::decode(self.client.wait_for_event::<ProtocolBMarker>(deadline)?)
810    }
811
812    /// Does nothing.
813    pub fn r#foo(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
814        let _response = self.client.send_query::<
815            fidl::encoding::EmptyPayload,
816            fidl::encoding::EmptyPayload,
817            ProtocolBMarker,
818        >(
819            (),
820            0x26550949f1431acf,
821            fidl::encoding::DynamicFlags::empty(),
822            ___deadline,
823        )?;
824        Ok(_response)
825    }
826}
827
828#[cfg(target_os = "fuchsia")]
829impl From<ProtocolBSynchronousProxy> for zx::NullableHandle {
830    fn from(value: ProtocolBSynchronousProxy) -> Self {
831        value.into_channel().into()
832    }
833}
834
835#[cfg(target_os = "fuchsia")]
836impl From<fidl::Channel> for ProtocolBSynchronousProxy {
837    fn from(value: fidl::Channel) -> Self {
838        Self::new(value)
839    }
840}
841
842#[cfg(target_os = "fuchsia")]
843impl fidl::endpoints::FromClient for ProtocolBSynchronousProxy {
844    type Protocol = ProtocolBMarker;
845
846    fn from_client(value: fidl::endpoints::ClientEnd<ProtocolBMarker>) -> Self {
847        Self::new(value.into_channel())
848    }
849}
850
851#[derive(Debug, Clone)]
852pub struct ProtocolBProxy {
853    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
854}
855
856impl fidl::endpoints::Proxy for ProtocolBProxy {
857    type Protocol = ProtocolBMarker;
858
859    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
860        Self::new(inner)
861    }
862
863    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
864        self.client.into_channel().map_err(|client| Self { client })
865    }
866
867    fn as_channel(&self) -> &::fidl::AsyncChannel {
868        self.client.as_channel()
869    }
870}
871
872impl ProtocolBProxy {
873    /// Create a new Proxy for fuchsia.component.client.test/ProtocolB.
874    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
875        let protocol_name = <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
876        Self { client: fidl::client::Client::new(channel, protocol_name) }
877    }
878
879    /// Get a Stream of events from the remote end of the protocol.
880    ///
881    /// # Panics
882    ///
883    /// Panics if the event stream was already taken.
884    pub fn take_event_stream(&self) -> ProtocolBEventStream {
885        ProtocolBEventStream { event_receiver: self.client.take_event_receiver() }
886    }
887
888    /// Does nothing.
889    pub fn r#foo(
890        &self,
891    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
892        ProtocolBProxyInterface::r#foo(self)
893    }
894}
895
896impl ProtocolBProxyInterface for ProtocolBProxy {
897    type FooResponseFut =
898        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
899    fn r#foo(&self) -> Self::FooResponseFut {
900        fn _decode(
901            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
902        ) -> Result<(), fidl::Error> {
903            let _response = fidl::client::decode_transaction_body::<
904                fidl::encoding::EmptyPayload,
905                fidl::encoding::DefaultFuchsiaResourceDialect,
906                0x26550949f1431acf,
907            >(_buf?)?;
908            Ok(_response)
909        }
910        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
911            (),
912            0x26550949f1431acf,
913            fidl::encoding::DynamicFlags::empty(),
914            _decode,
915        )
916    }
917}
918
919pub struct ProtocolBEventStream {
920    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
921}
922
923impl std::marker::Unpin for ProtocolBEventStream {}
924
925impl futures::stream::FusedStream for ProtocolBEventStream {
926    fn is_terminated(&self) -> bool {
927        self.event_receiver.is_terminated()
928    }
929}
930
931impl futures::Stream for ProtocolBEventStream {
932    type Item = Result<ProtocolBEvent, fidl::Error>;
933
934    fn poll_next(
935        mut self: std::pin::Pin<&mut Self>,
936        cx: &mut std::task::Context<'_>,
937    ) -> std::task::Poll<Option<Self::Item>> {
938        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
939            &mut self.event_receiver,
940            cx
941        )?) {
942            Some(buf) => std::task::Poll::Ready(Some(ProtocolBEvent::decode(buf))),
943            None => std::task::Poll::Ready(None),
944        }
945    }
946}
947
948#[derive(Debug)]
949pub enum ProtocolBEvent {}
950
951impl ProtocolBEvent {
952    /// Decodes a message buffer as a [`ProtocolBEvent`].
953    fn decode(
954        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
955    ) -> Result<ProtocolBEvent, fidl::Error> {
956        let (bytes, _handles) = buf.split_mut();
957        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
958        debug_assert_eq!(tx_header.tx_id, 0);
959        match tx_header.ordinal {
960            _ => Err(fidl::Error::UnknownOrdinal {
961                ordinal: tx_header.ordinal,
962                protocol_name: <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
963            }),
964        }
965    }
966}
967
968/// A Stream of incoming requests for fuchsia.component.client.test/ProtocolB.
969pub struct ProtocolBRequestStream {
970    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
971    is_terminated: bool,
972}
973
974impl std::marker::Unpin for ProtocolBRequestStream {}
975
976impl futures::stream::FusedStream for ProtocolBRequestStream {
977    fn is_terminated(&self) -> bool {
978        self.is_terminated
979    }
980}
981
982impl fidl::endpoints::RequestStream for ProtocolBRequestStream {
983    type Protocol = ProtocolBMarker;
984    type ControlHandle = ProtocolBControlHandle;
985
986    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
987        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
988    }
989
990    fn control_handle(&self) -> Self::ControlHandle {
991        ProtocolBControlHandle { inner: self.inner.clone() }
992    }
993
994    fn into_inner(
995        self,
996    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
997    {
998        (self.inner, self.is_terminated)
999    }
1000
1001    fn from_inner(
1002        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1003        is_terminated: bool,
1004    ) -> Self {
1005        Self { inner, is_terminated }
1006    }
1007}
1008
1009impl futures::Stream for ProtocolBRequestStream {
1010    type Item = Result<ProtocolBRequest, fidl::Error>;
1011
1012    fn poll_next(
1013        mut self: std::pin::Pin<&mut Self>,
1014        cx: &mut std::task::Context<'_>,
1015    ) -> std::task::Poll<Option<Self::Item>> {
1016        let this = &mut *self;
1017        if this.inner.check_shutdown(cx) {
1018            this.is_terminated = true;
1019            return std::task::Poll::Ready(None);
1020        }
1021        if this.is_terminated {
1022            panic!("polled ProtocolBRequestStream after completion");
1023        }
1024        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1025            |bytes, handles| {
1026                match this.inner.channel().read_etc(cx, bytes, handles) {
1027                    std::task::Poll::Ready(Ok(())) => {}
1028                    std::task::Poll::Pending => return std::task::Poll::Pending,
1029                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1030                        this.is_terminated = true;
1031                        return std::task::Poll::Ready(None);
1032                    }
1033                    std::task::Poll::Ready(Err(e)) => {
1034                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1035                            e.into(),
1036                        ))));
1037                    }
1038                }
1039
1040                // A message has been received from the channel
1041                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1042
1043                std::task::Poll::Ready(Some(match header.ordinal {
1044                    0x26550949f1431acf => {
1045                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1046                        let mut req = fidl::new_empty!(
1047                            fidl::encoding::EmptyPayload,
1048                            fidl::encoding::DefaultFuchsiaResourceDialect
1049                        );
1050                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1051                        let control_handle = ProtocolBControlHandle { inner: this.inner.clone() };
1052                        Ok(ProtocolBRequest::Foo {
1053                            responder: ProtocolBFooResponder {
1054                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1055                                tx_id: header.tx_id,
1056                            },
1057                        })
1058                    }
1059                    _ => Err(fidl::Error::UnknownOrdinal {
1060                        ordinal: header.ordinal,
1061                        protocol_name:
1062                            <ProtocolBMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1063                    }),
1064                }))
1065            },
1066        )
1067    }
1068}
1069
1070/// Yet another discoverable protocol.
1071#[derive(Debug)]
1072pub enum ProtocolBRequest {
1073    /// Does nothing.
1074    Foo { responder: ProtocolBFooResponder },
1075}
1076
1077impl ProtocolBRequest {
1078    #[allow(irrefutable_let_patterns)]
1079    pub fn into_foo(self) -> Option<(ProtocolBFooResponder)> {
1080        if let ProtocolBRequest::Foo { responder } = self { Some((responder)) } else { None }
1081    }
1082
1083    /// Name of the method defined in FIDL
1084    pub fn method_name(&self) -> &'static str {
1085        match *self {
1086            ProtocolBRequest::Foo { .. } => "foo",
1087        }
1088    }
1089}
1090
1091#[derive(Debug, Clone)]
1092pub struct ProtocolBControlHandle {
1093    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1094}
1095
1096impl fidl::endpoints::ControlHandle for ProtocolBControlHandle {
1097    fn shutdown(&self) {
1098        self.inner.shutdown()
1099    }
1100
1101    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1102        self.inner.shutdown_with_epitaph(status)
1103    }
1104
1105    fn is_closed(&self) -> bool {
1106        self.inner.channel().is_closed()
1107    }
1108    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1109        self.inner.channel().on_closed()
1110    }
1111
1112    #[cfg(target_os = "fuchsia")]
1113    fn signal_peer(
1114        &self,
1115        clear_mask: zx::Signals,
1116        set_mask: zx::Signals,
1117    ) -> Result<(), zx_status::Status> {
1118        use fidl::Peered;
1119        self.inner.channel().signal_peer(clear_mask, set_mask)
1120    }
1121}
1122
1123impl ProtocolBControlHandle {}
1124
1125#[must_use = "FIDL methods require a response to be sent"]
1126#[derive(Debug)]
1127pub struct ProtocolBFooResponder {
1128    control_handle: std::mem::ManuallyDrop<ProtocolBControlHandle>,
1129    tx_id: u32,
1130}
1131
1132/// Set the the channel to be shutdown (see [`ProtocolBControlHandle::shutdown`])
1133/// if the responder is dropped without sending a response, so that the client
1134/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1135impl std::ops::Drop for ProtocolBFooResponder {
1136    fn drop(&mut self) {
1137        self.control_handle.shutdown();
1138        // Safety: drops once, never accessed again
1139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1140    }
1141}
1142
1143impl fidl::endpoints::Responder for ProtocolBFooResponder {
1144    type ControlHandle = ProtocolBControlHandle;
1145
1146    fn control_handle(&self) -> &ProtocolBControlHandle {
1147        &self.control_handle
1148    }
1149
1150    fn drop_without_shutdown(mut self) {
1151        // Safety: drops once, never accessed again due to mem::forget
1152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1153        // Prevent Drop from running (which would shut down the channel)
1154        std::mem::forget(self);
1155    }
1156}
1157
1158impl ProtocolBFooResponder {
1159    /// Sends a response to the FIDL transaction.
1160    ///
1161    /// Sets the channel to shutdown if an error occurs.
1162    pub fn send(self) -> Result<(), fidl::Error> {
1163        let _result = self.send_raw();
1164        if _result.is_err() {
1165            self.control_handle.shutdown();
1166        }
1167        self.drop_without_shutdown();
1168        _result
1169    }
1170
1171    /// Similar to "send" but does not shutdown the channel if an error occurs.
1172    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1173        let _result = self.send_raw();
1174        self.drop_without_shutdown();
1175        _result
1176    }
1177
1178    fn send_raw(&self) -> Result<(), fidl::Error> {
1179        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1180            (),
1181            self.tx_id,
1182            0x26550949f1431acf,
1183            fidl::encoding::DynamicFlags::empty(),
1184        )
1185    }
1186}
1187
1188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1189pub struct ServiceMarker;
1190
1191#[cfg(target_os = "fuchsia")]
1192impl fidl::endpoints::ServiceMarker for ServiceMarker {
1193    type Proxy = ServiceProxy;
1194    type Request = ServiceRequest;
1195    const SERVICE_NAME: &'static str = "fuchsia.component.client.test.Service";
1196}
1197
1198/// A request for one of the member protocols of Service.
1199///
1200/// A service with protocols in it
1201#[cfg(target_os = "fuchsia")]
1202pub enum ServiceRequest {
1203    First(ProtocolARequestStream),
1204    Second(ProtocolBRequestStream),
1205}
1206
1207#[cfg(target_os = "fuchsia")]
1208impl fidl::endpoints::ServiceRequest for ServiceRequest {
1209    type Service = ServiceMarker;
1210
1211    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1212        match name {
1213            "first" => Self::First(
1214                <ProtocolARequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1215            ),
1216            "second" => Self::Second(
1217                <ProtocolBRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1218            ),
1219            _ => panic!("no such member protocol name for service Service"),
1220        }
1221    }
1222
1223    fn member_names() -> &'static [&'static str] {
1224        &["first", "second"]
1225    }
1226}
1227/// A service with protocols in it
1228#[cfg(target_os = "fuchsia")]
1229pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1230
1231#[cfg(target_os = "fuchsia")]
1232impl fidl::endpoints::ServiceProxy for ServiceProxy {
1233    type Service = ServiceMarker;
1234
1235    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1236        Self(opener)
1237    }
1238}
1239
1240#[cfg(target_os = "fuchsia")]
1241impl ServiceProxy {
1242    pub fn connect_to_first(&self) -> Result<ProtocolAProxy, fidl::Error> {
1243        let (proxy, server_end) = fidl::endpoints::create_proxy::<ProtocolAMarker>();
1244        self.connect_channel_to_first(server_end)?;
1245        Ok(proxy)
1246    }
1247
1248    /// Like `connect_to_first`, but returns a sync proxy.
1249    /// See [`Self::connect_to_first`] for more details.
1250    pub fn connect_to_first_sync(&self) -> Result<ProtocolASynchronousProxy, fidl::Error> {
1251        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProtocolAMarker>();
1252        self.connect_channel_to_first(server_end)?;
1253        Ok(proxy)
1254    }
1255
1256    /// Like `connect_to_first`, but accepts a server end.
1257    /// See [`Self::connect_to_first`] for more details.
1258    pub fn connect_channel_to_first(
1259        &self,
1260        server_end: fidl::endpoints::ServerEnd<ProtocolAMarker>,
1261    ) -> Result<(), fidl::Error> {
1262        self.0.open_member("first", server_end.into_channel())
1263    }
1264    pub fn connect_to_second(&self) -> Result<ProtocolBProxy, fidl::Error> {
1265        let (proxy, server_end) = fidl::endpoints::create_proxy::<ProtocolBMarker>();
1266        self.connect_channel_to_second(server_end)?;
1267        Ok(proxy)
1268    }
1269
1270    /// Like `connect_to_second`, but returns a sync proxy.
1271    /// See [`Self::connect_to_second`] for more details.
1272    pub fn connect_to_second_sync(&self) -> Result<ProtocolBSynchronousProxy, fidl::Error> {
1273        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ProtocolBMarker>();
1274        self.connect_channel_to_second(server_end)?;
1275        Ok(proxy)
1276    }
1277
1278    /// Like `connect_to_second`, but accepts a server end.
1279    /// See [`Self::connect_to_second`] for more details.
1280    pub fn connect_channel_to_second(
1281        &self,
1282        server_end: fidl::endpoints::ServerEnd<ProtocolBMarker>,
1283    ) -> Result<(), fidl::Error> {
1284        self.0.open_member("second", server_end.into_channel())
1285    }
1286
1287    pub fn instance_name(&self) -> &str {
1288        self.0.instance_name()
1289    }
1290}
1291
1292mod internal {
1293    use super::*;
1294}