fidl_fuchsia_net_mdns/
fidl_fuchsia_net_mdns.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_net_mdns_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct HostNameSubscriberSubscribeToHostNameRequest {
16    pub host: String,
17    pub options: HostNameSubscriptionOptions,
18    pub listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for HostNameSubscriberSubscribeToHostNameRequest
23{
24}
25
26#[derive(Debug, PartialEq)]
27pub struct ProxyHostPublisherPublishProxyHostRequest {
28    pub host: String,
29    pub addresses: Vec<fidl_fuchsia_net::IpAddress>,
30    pub options: ProxyHostPublicationOptions,
31    pub service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
35    for ProxyHostPublisherPublishProxyHostRequest
36{
37}
38
39#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
40pub struct PublisherPublishServiceInstanceRequest {
41    pub service: String,
42    pub instance: String,
43    pub media: Media,
44    pub perform_probe: bool,
45    pub publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
49    for PublisherPublishServiceInstanceRequest
50{
51}
52
53#[derive(Debug, PartialEq)]
54pub struct ServiceInstancePublisherPublishServiceInstanceRequest {
55    pub service: String,
56    pub instance: String,
57    pub options: ServiceInstancePublicationOptions,
58    pub publication_responder:
59        fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
60}
61
62impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
63    for ServiceInstancePublisherPublishServiceInstanceRequest
64{
65}
66
67#[derive(Debug, PartialEq)]
68pub struct ServiceSubscriber2SubscribeToAllServicesRequest {
69    pub options: ServiceSubscriptionOptions,
70    pub listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
71}
72
73impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
74    for ServiceSubscriber2SubscribeToAllServicesRequest
75{
76}
77
78#[derive(Debug, PartialEq)]
79pub struct ServiceSubscriber2SubscribeToServiceRequest {
80    pub service: String,
81    pub options: ServiceSubscriptionOptions,
82    pub listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
83}
84
85impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
86    for ServiceSubscriber2SubscribeToServiceRequest
87{
88}
89
90#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
91pub struct SubscriberSubscribeToServiceRequest {
92    pub service: String,
93    pub subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
94}
95
96impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
97    for SubscriberSubscribeToServiceRequest
98{
99}
100
101#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
102pub struct HostNameResolverMarker;
103
104impl fidl::endpoints::ProtocolMarker for HostNameResolverMarker {
105    type Proxy = HostNameResolverProxy;
106    type RequestStream = HostNameResolverRequestStream;
107    #[cfg(target_os = "fuchsia")]
108    type SynchronousProxy = HostNameResolverSynchronousProxy;
109
110    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.HostNameResolver";
111}
112impl fidl::endpoints::DiscoverableProtocolMarker for HostNameResolverMarker {}
113
114pub trait HostNameResolverProxyInterface: Send + Sync {
115    type ResolveHostNameResponseFut: std::future::Future<Output = Result<Vec<HostAddress>, fidl::Error>>
116        + Send;
117    fn r#resolve_host_name(
118        &self,
119        host: &str,
120        timeout: i64,
121        options: &HostNameResolutionOptions,
122    ) -> Self::ResolveHostNameResponseFut;
123}
124#[derive(Debug)]
125#[cfg(target_os = "fuchsia")]
126pub struct HostNameResolverSynchronousProxy {
127    client: fidl::client::sync::Client,
128}
129
130#[cfg(target_os = "fuchsia")]
131impl fidl::endpoints::SynchronousProxy for HostNameResolverSynchronousProxy {
132    type Proxy = HostNameResolverProxy;
133    type Protocol = HostNameResolverMarker;
134
135    fn from_channel(inner: fidl::Channel) -> Self {
136        Self::new(inner)
137    }
138
139    fn into_channel(self) -> fidl::Channel {
140        self.client.into_channel()
141    }
142
143    fn as_channel(&self) -> &fidl::Channel {
144        self.client.as_channel()
145    }
146}
147
148#[cfg(target_os = "fuchsia")]
149impl HostNameResolverSynchronousProxy {
150    pub fn new(channel: fidl::Channel) -> Self {
151        let protocol_name = <HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
152        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
153    }
154
155    pub fn into_channel(self) -> fidl::Channel {
156        self.client.into_channel()
157    }
158
159    /// Waits until an event arrives and returns it. It is safe for other
160    /// threads to make concurrent requests while waiting for an event.
161    pub fn wait_for_event(
162        &self,
163        deadline: zx::MonotonicInstant,
164    ) -> Result<HostNameResolverEvent, fidl::Error> {
165        HostNameResolverEvent::decode(self.client.wait_for_event(deadline)?)
166    }
167
168    /// Gets the addresses for the specified host.
169    ///
170    /// + request `host` the simple name of the host.
171    /// + request `timeout` specifies how long the service should wait before giving up when
172    ///   waiting for a response to a resolution query. In typical use, a timeout of two or three
173    ///   seconds is recommended.
174    /// + request `options` options to be applied to the resolution.
175    /// - response `addresses` the addresses of the specified host, if it was found, an empty vector
176    ///   if not.
177    pub fn r#resolve_host_name(
178        &self,
179        mut host: &str,
180        mut timeout: i64,
181        mut options: &HostNameResolutionOptions,
182        ___deadline: zx::MonotonicInstant,
183    ) -> Result<Vec<HostAddress>, fidl::Error> {
184        let _response = self.client.send_query::<
185            HostNameResolverResolveHostNameRequest,
186            HostNameResolverResolveHostNameResponse,
187        >(
188            (host, timeout, options,),
189            0x54f422692b53c46d,
190            fidl::encoding::DynamicFlags::empty(),
191            ___deadline,
192        )?;
193        Ok(_response.addresses)
194    }
195}
196
197#[derive(Debug, Clone)]
198pub struct HostNameResolverProxy {
199    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
200}
201
202impl fidl::endpoints::Proxy for HostNameResolverProxy {
203    type Protocol = HostNameResolverMarker;
204
205    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
206        Self::new(inner)
207    }
208
209    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
210        self.client.into_channel().map_err(|client| Self { client })
211    }
212
213    fn as_channel(&self) -> &::fidl::AsyncChannel {
214        self.client.as_channel()
215    }
216}
217
218impl HostNameResolverProxy {
219    /// Create a new Proxy for fuchsia.net.mdns/HostNameResolver.
220    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
221        let protocol_name = <HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
222        Self { client: fidl::client::Client::new(channel, protocol_name) }
223    }
224
225    /// Get a Stream of events from the remote end of the protocol.
226    ///
227    /// # Panics
228    ///
229    /// Panics if the event stream was already taken.
230    pub fn take_event_stream(&self) -> HostNameResolverEventStream {
231        HostNameResolverEventStream { event_receiver: self.client.take_event_receiver() }
232    }
233
234    /// Gets the addresses for the specified host.
235    ///
236    /// + request `host` the simple name of the host.
237    /// + request `timeout` specifies how long the service should wait before giving up when
238    ///   waiting for a response to a resolution query. In typical use, a timeout of two or three
239    ///   seconds is recommended.
240    /// + request `options` options to be applied to the resolution.
241    /// - response `addresses` the addresses of the specified host, if it was found, an empty vector
242    ///   if not.
243    pub fn r#resolve_host_name(
244        &self,
245        mut host: &str,
246        mut timeout: i64,
247        mut options: &HostNameResolutionOptions,
248    ) -> fidl::client::QueryResponseFut<
249        Vec<HostAddress>,
250        fidl::encoding::DefaultFuchsiaResourceDialect,
251    > {
252        HostNameResolverProxyInterface::r#resolve_host_name(self, host, timeout, options)
253    }
254}
255
256impl HostNameResolverProxyInterface for HostNameResolverProxy {
257    type ResolveHostNameResponseFut = fidl::client::QueryResponseFut<
258        Vec<HostAddress>,
259        fidl::encoding::DefaultFuchsiaResourceDialect,
260    >;
261    fn r#resolve_host_name(
262        &self,
263        mut host: &str,
264        mut timeout: i64,
265        mut options: &HostNameResolutionOptions,
266    ) -> Self::ResolveHostNameResponseFut {
267        fn _decode(
268            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
269        ) -> Result<Vec<HostAddress>, fidl::Error> {
270            let _response = fidl::client::decode_transaction_body::<
271                HostNameResolverResolveHostNameResponse,
272                fidl::encoding::DefaultFuchsiaResourceDialect,
273                0x54f422692b53c46d,
274            >(_buf?)?;
275            Ok(_response.addresses)
276        }
277        self.client
278            .send_query_and_decode::<HostNameResolverResolveHostNameRequest, Vec<HostAddress>>(
279                (host, timeout, options),
280                0x54f422692b53c46d,
281                fidl::encoding::DynamicFlags::empty(),
282                _decode,
283            )
284    }
285}
286
287pub struct HostNameResolverEventStream {
288    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
289}
290
291impl std::marker::Unpin for HostNameResolverEventStream {}
292
293impl futures::stream::FusedStream for HostNameResolverEventStream {
294    fn is_terminated(&self) -> bool {
295        self.event_receiver.is_terminated()
296    }
297}
298
299impl futures::Stream for HostNameResolverEventStream {
300    type Item = Result<HostNameResolverEvent, fidl::Error>;
301
302    fn poll_next(
303        mut self: std::pin::Pin<&mut Self>,
304        cx: &mut std::task::Context<'_>,
305    ) -> std::task::Poll<Option<Self::Item>> {
306        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
307            &mut self.event_receiver,
308            cx
309        )?) {
310            Some(buf) => std::task::Poll::Ready(Some(HostNameResolverEvent::decode(buf))),
311            None => std::task::Poll::Ready(None),
312        }
313    }
314}
315
316#[derive(Debug)]
317pub enum HostNameResolverEvent {}
318
319impl HostNameResolverEvent {
320    /// Decodes a message buffer as a [`HostNameResolverEvent`].
321    fn decode(
322        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
323    ) -> Result<HostNameResolverEvent, fidl::Error> {
324        let (bytes, _handles) = buf.split_mut();
325        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
326        debug_assert_eq!(tx_header.tx_id, 0);
327        match tx_header.ordinal {
328            _ => Err(fidl::Error::UnknownOrdinal {
329                ordinal: tx_header.ordinal,
330                protocol_name:
331                    <HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
332            }),
333        }
334    }
335}
336
337/// A Stream of incoming requests for fuchsia.net.mdns/HostNameResolver.
338pub struct HostNameResolverRequestStream {
339    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
340    is_terminated: bool,
341}
342
343impl std::marker::Unpin for HostNameResolverRequestStream {}
344
345impl futures::stream::FusedStream for HostNameResolverRequestStream {
346    fn is_terminated(&self) -> bool {
347        self.is_terminated
348    }
349}
350
351impl fidl::endpoints::RequestStream for HostNameResolverRequestStream {
352    type Protocol = HostNameResolverMarker;
353    type ControlHandle = HostNameResolverControlHandle;
354
355    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
356        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
357    }
358
359    fn control_handle(&self) -> Self::ControlHandle {
360        HostNameResolverControlHandle { inner: self.inner.clone() }
361    }
362
363    fn into_inner(
364        self,
365    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
366    {
367        (self.inner, self.is_terminated)
368    }
369
370    fn from_inner(
371        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
372        is_terminated: bool,
373    ) -> Self {
374        Self { inner, is_terminated }
375    }
376}
377
378impl futures::Stream for HostNameResolverRequestStream {
379    type Item = Result<HostNameResolverRequest, fidl::Error>;
380
381    fn poll_next(
382        mut self: std::pin::Pin<&mut Self>,
383        cx: &mut std::task::Context<'_>,
384    ) -> std::task::Poll<Option<Self::Item>> {
385        let this = &mut *self;
386        if this.inner.check_shutdown(cx) {
387            this.is_terminated = true;
388            return std::task::Poll::Ready(None);
389        }
390        if this.is_terminated {
391            panic!("polled HostNameResolverRequestStream after completion");
392        }
393        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
394            |bytes, handles| {
395                match this.inner.channel().read_etc(cx, bytes, handles) {
396                    std::task::Poll::Ready(Ok(())) => {}
397                    std::task::Poll::Pending => return std::task::Poll::Pending,
398                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
399                        this.is_terminated = true;
400                        return std::task::Poll::Ready(None);
401                    }
402                    std::task::Poll::Ready(Err(e)) => {
403                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
404                            e.into(),
405                        ))))
406                    }
407                }
408
409                // A message has been received from the channel
410                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
411
412                std::task::Poll::Ready(Some(match header.ordinal {
413                    0x54f422692b53c46d => {
414                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
415                        let mut req = fidl::new_empty!(
416                            HostNameResolverResolveHostNameRequest,
417                            fidl::encoding::DefaultFuchsiaResourceDialect
418                        );
419                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostNameResolverResolveHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
420                        let control_handle =
421                            HostNameResolverControlHandle { inner: this.inner.clone() };
422                        Ok(HostNameResolverRequest::ResolveHostName {
423                            host: req.host,
424                            timeout: req.timeout,
425                            options: req.options,
426
427                            responder: HostNameResolverResolveHostNameResponder {
428                                control_handle: std::mem::ManuallyDrop::new(control_handle),
429                                tx_id: header.tx_id,
430                            },
431                        })
432                    }
433                    _ => Err(fidl::Error::UnknownOrdinal {
434                        ordinal: header.ordinal,
435                        protocol_name:
436                            <HostNameResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
437                    }),
438                }))
439            },
440        )
441    }
442}
443
444/// Discoverable protocol for resolving host names to IP addresses.
445#[derive(Debug)]
446pub enum HostNameResolverRequest {
447    /// Gets the addresses for the specified host.
448    ///
449    /// + request `host` the simple name of the host.
450    /// + request `timeout` specifies how long the service should wait before giving up when
451    ///   waiting for a response to a resolution query. In typical use, a timeout of two or three
452    ///   seconds is recommended.
453    /// + request `options` options to be applied to the resolution.
454    /// - response `addresses` the addresses of the specified host, if it was found, an empty vector
455    ///   if not.
456    ResolveHostName {
457        host: String,
458        timeout: i64,
459        options: HostNameResolutionOptions,
460        responder: HostNameResolverResolveHostNameResponder,
461    },
462}
463
464impl HostNameResolverRequest {
465    #[allow(irrefutable_let_patterns)]
466    pub fn into_resolve_host_name(
467        self,
468    ) -> Option<(String, i64, HostNameResolutionOptions, HostNameResolverResolveHostNameResponder)>
469    {
470        if let HostNameResolverRequest::ResolveHostName { host, timeout, options, responder } = self
471        {
472            Some((host, timeout, options, responder))
473        } else {
474            None
475        }
476    }
477
478    /// Name of the method defined in FIDL
479    pub fn method_name(&self) -> &'static str {
480        match *self {
481            HostNameResolverRequest::ResolveHostName { .. } => "resolve_host_name",
482        }
483    }
484}
485
486#[derive(Debug, Clone)]
487pub struct HostNameResolverControlHandle {
488    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
489}
490
491impl fidl::endpoints::ControlHandle for HostNameResolverControlHandle {
492    fn shutdown(&self) {
493        self.inner.shutdown()
494    }
495    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
496        self.inner.shutdown_with_epitaph(status)
497    }
498
499    fn is_closed(&self) -> bool {
500        self.inner.channel().is_closed()
501    }
502    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
503        self.inner.channel().on_closed()
504    }
505
506    #[cfg(target_os = "fuchsia")]
507    fn signal_peer(
508        &self,
509        clear_mask: zx::Signals,
510        set_mask: zx::Signals,
511    ) -> Result<(), zx_status::Status> {
512        use fidl::Peered;
513        self.inner.channel().signal_peer(clear_mask, set_mask)
514    }
515}
516
517impl HostNameResolverControlHandle {}
518
519#[must_use = "FIDL methods require a response to be sent"]
520#[derive(Debug)]
521pub struct HostNameResolverResolveHostNameResponder {
522    control_handle: std::mem::ManuallyDrop<HostNameResolverControlHandle>,
523    tx_id: u32,
524}
525
526/// Set the the channel to be shutdown (see [`HostNameResolverControlHandle::shutdown`])
527/// if the responder is dropped without sending a response, so that the client
528/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
529impl std::ops::Drop for HostNameResolverResolveHostNameResponder {
530    fn drop(&mut self) {
531        self.control_handle.shutdown();
532        // Safety: drops once, never accessed again
533        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
534    }
535}
536
537impl fidl::endpoints::Responder for HostNameResolverResolveHostNameResponder {
538    type ControlHandle = HostNameResolverControlHandle;
539
540    fn control_handle(&self) -> &HostNameResolverControlHandle {
541        &self.control_handle
542    }
543
544    fn drop_without_shutdown(mut self) {
545        // Safety: drops once, never accessed again due to mem::forget
546        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
547        // Prevent Drop from running (which would shut down the channel)
548        std::mem::forget(self);
549    }
550}
551
552impl HostNameResolverResolveHostNameResponder {
553    /// Sends a response to the FIDL transaction.
554    ///
555    /// Sets the channel to shutdown if an error occurs.
556    pub fn send(self, mut addresses: &[HostAddress]) -> Result<(), fidl::Error> {
557        let _result = self.send_raw(addresses);
558        if _result.is_err() {
559            self.control_handle.shutdown();
560        }
561        self.drop_without_shutdown();
562        _result
563    }
564
565    /// Similar to "send" but does not shutdown the channel if an error occurs.
566    pub fn send_no_shutdown_on_err(self, mut addresses: &[HostAddress]) -> Result<(), fidl::Error> {
567        let _result = self.send_raw(addresses);
568        self.drop_without_shutdown();
569        _result
570    }
571
572    fn send_raw(&self, mut addresses: &[HostAddress]) -> Result<(), fidl::Error> {
573        self.control_handle.inner.send::<HostNameResolverResolveHostNameResponse>(
574            (addresses,),
575            self.tx_id,
576            0x54f422692b53c46d,
577            fidl::encoding::DynamicFlags::empty(),
578        )
579    }
580}
581
582#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
583pub struct HostNameSubscriberMarker;
584
585impl fidl::endpoints::ProtocolMarker for HostNameSubscriberMarker {
586    type Proxy = HostNameSubscriberProxy;
587    type RequestStream = HostNameSubscriberRequestStream;
588    #[cfg(target_os = "fuchsia")]
589    type SynchronousProxy = HostNameSubscriberSynchronousProxy;
590
591    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.HostNameSubscriber";
592}
593impl fidl::endpoints::DiscoverableProtocolMarker for HostNameSubscriberMarker {}
594
595pub trait HostNameSubscriberProxyInterface: Send + Sync {
596    fn r#subscribe_to_host_name(
597        &self,
598        host: &str,
599        options: &HostNameSubscriptionOptions,
600        listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
601    ) -> Result<(), fidl::Error>;
602}
603#[derive(Debug)]
604#[cfg(target_os = "fuchsia")]
605pub struct HostNameSubscriberSynchronousProxy {
606    client: fidl::client::sync::Client,
607}
608
609#[cfg(target_os = "fuchsia")]
610impl fidl::endpoints::SynchronousProxy for HostNameSubscriberSynchronousProxy {
611    type Proxy = HostNameSubscriberProxy;
612    type Protocol = HostNameSubscriberMarker;
613
614    fn from_channel(inner: fidl::Channel) -> Self {
615        Self::new(inner)
616    }
617
618    fn into_channel(self) -> fidl::Channel {
619        self.client.into_channel()
620    }
621
622    fn as_channel(&self) -> &fidl::Channel {
623        self.client.as_channel()
624    }
625}
626
627#[cfg(target_os = "fuchsia")]
628impl HostNameSubscriberSynchronousProxy {
629    pub fn new(channel: fidl::Channel) -> Self {
630        let protocol_name =
631            <HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
632        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
633    }
634
635    pub fn into_channel(self) -> fidl::Channel {
636        self.client.into_channel()
637    }
638
639    /// Waits until an event arrives and returns it. It is safe for other
640    /// threads to make concurrent requests while waiting for an event.
641    pub fn wait_for_event(
642        &self,
643        deadline: zx::MonotonicInstant,
644    ) -> Result<HostNameSubscriberEvent, fidl::Error> {
645        HostNameSubscriberEvent::decode(self.client.wait_for_event(deadline)?)
646    }
647
648    /// Gets the addresses for the specified host.
649    ///
650    /// + request `host` the simple name of the host.
651    /// + request `options` options to be applied to the subscription.
652    /// + request `listener` client end of the `HostNameSubscriptionListener` channel.
653    pub fn r#subscribe_to_host_name(
654        &self,
655        mut host: &str,
656        mut options: &HostNameSubscriptionOptions,
657        mut listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
658    ) -> Result<(), fidl::Error> {
659        self.client.send::<HostNameSubscriberSubscribeToHostNameRequest>(
660            (host, options, listener),
661            0x23b6c5f4954f40ea,
662            fidl::encoding::DynamicFlags::empty(),
663        )
664    }
665}
666
667#[derive(Debug, Clone)]
668pub struct HostNameSubscriberProxy {
669    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
670}
671
672impl fidl::endpoints::Proxy for HostNameSubscriberProxy {
673    type Protocol = HostNameSubscriberMarker;
674
675    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
676        Self::new(inner)
677    }
678
679    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
680        self.client.into_channel().map_err(|client| Self { client })
681    }
682
683    fn as_channel(&self) -> &::fidl::AsyncChannel {
684        self.client.as_channel()
685    }
686}
687
688impl HostNameSubscriberProxy {
689    /// Create a new Proxy for fuchsia.net.mdns/HostNameSubscriber.
690    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
691        let protocol_name =
692            <HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
693        Self { client: fidl::client::Client::new(channel, protocol_name) }
694    }
695
696    /// Get a Stream of events from the remote end of the protocol.
697    ///
698    /// # Panics
699    ///
700    /// Panics if the event stream was already taken.
701    pub fn take_event_stream(&self) -> HostNameSubscriberEventStream {
702        HostNameSubscriberEventStream { event_receiver: self.client.take_event_receiver() }
703    }
704
705    /// Gets the addresses for the specified host.
706    ///
707    /// + request `host` the simple name of the host.
708    /// + request `options` options to be applied to the subscription.
709    /// + request `listener` client end of the `HostNameSubscriptionListener` channel.
710    pub fn r#subscribe_to_host_name(
711        &self,
712        mut host: &str,
713        mut options: &HostNameSubscriptionOptions,
714        mut listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
715    ) -> Result<(), fidl::Error> {
716        HostNameSubscriberProxyInterface::r#subscribe_to_host_name(self, host, options, listener)
717    }
718}
719
720impl HostNameSubscriberProxyInterface for HostNameSubscriberProxy {
721    fn r#subscribe_to_host_name(
722        &self,
723        mut host: &str,
724        mut options: &HostNameSubscriptionOptions,
725        mut listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
726    ) -> Result<(), fidl::Error> {
727        self.client.send::<HostNameSubscriberSubscribeToHostNameRequest>(
728            (host, options, listener),
729            0x23b6c5f4954f40ea,
730            fidl::encoding::DynamicFlags::empty(),
731        )
732    }
733}
734
735pub struct HostNameSubscriberEventStream {
736    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
737}
738
739impl std::marker::Unpin for HostNameSubscriberEventStream {}
740
741impl futures::stream::FusedStream for HostNameSubscriberEventStream {
742    fn is_terminated(&self) -> bool {
743        self.event_receiver.is_terminated()
744    }
745}
746
747impl futures::Stream for HostNameSubscriberEventStream {
748    type Item = Result<HostNameSubscriberEvent, fidl::Error>;
749
750    fn poll_next(
751        mut self: std::pin::Pin<&mut Self>,
752        cx: &mut std::task::Context<'_>,
753    ) -> std::task::Poll<Option<Self::Item>> {
754        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
755            &mut self.event_receiver,
756            cx
757        )?) {
758            Some(buf) => std::task::Poll::Ready(Some(HostNameSubscriberEvent::decode(buf))),
759            None => std::task::Poll::Ready(None),
760        }
761    }
762}
763
764#[derive(Debug)]
765pub enum HostNameSubscriberEvent {}
766
767impl HostNameSubscriberEvent {
768    /// Decodes a message buffer as a [`HostNameSubscriberEvent`].
769    fn decode(
770        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
771    ) -> Result<HostNameSubscriberEvent, fidl::Error> {
772        let (bytes, _handles) = buf.split_mut();
773        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
774        debug_assert_eq!(tx_header.tx_id, 0);
775        match tx_header.ordinal {
776            _ => Err(fidl::Error::UnknownOrdinal {
777                ordinal: tx_header.ordinal,
778                protocol_name:
779                    <HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
780            }),
781        }
782    }
783}
784
785/// A Stream of incoming requests for fuchsia.net.mdns/HostNameSubscriber.
786pub struct HostNameSubscriberRequestStream {
787    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
788    is_terminated: bool,
789}
790
791impl std::marker::Unpin for HostNameSubscriberRequestStream {}
792
793impl futures::stream::FusedStream for HostNameSubscriberRequestStream {
794    fn is_terminated(&self) -> bool {
795        self.is_terminated
796    }
797}
798
799impl fidl::endpoints::RequestStream for HostNameSubscriberRequestStream {
800    type Protocol = HostNameSubscriberMarker;
801    type ControlHandle = HostNameSubscriberControlHandle;
802
803    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
804        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
805    }
806
807    fn control_handle(&self) -> Self::ControlHandle {
808        HostNameSubscriberControlHandle { inner: self.inner.clone() }
809    }
810
811    fn into_inner(
812        self,
813    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
814    {
815        (self.inner, self.is_terminated)
816    }
817
818    fn from_inner(
819        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
820        is_terminated: bool,
821    ) -> Self {
822        Self { inner, is_terminated }
823    }
824}
825
826impl futures::Stream for HostNameSubscriberRequestStream {
827    type Item = Result<HostNameSubscriberRequest, fidl::Error>;
828
829    fn poll_next(
830        mut self: std::pin::Pin<&mut Self>,
831        cx: &mut std::task::Context<'_>,
832    ) -> std::task::Poll<Option<Self::Item>> {
833        let this = &mut *self;
834        if this.inner.check_shutdown(cx) {
835            this.is_terminated = true;
836            return std::task::Poll::Ready(None);
837        }
838        if this.is_terminated {
839            panic!("polled HostNameSubscriberRequestStream after completion");
840        }
841        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
842            |bytes, handles| {
843                match this.inner.channel().read_etc(cx, bytes, handles) {
844                    std::task::Poll::Ready(Ok(())) => {}
845                    std::task::Poll::Pending => return std::task::Poll::Pending,
846                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
847                        this.is_terminated = true;
848                        return std::task::Poll::Ready(None);
849                    }
850                    std::task::Poll::Ready(Err(e)) => {
851                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
852                            e.into(),
853                        ))))
854                    }
855                }
856
857                // A message has been received from the channel
858                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
859
860                std::task::Poll::Ready(Some(match header.ordinal {
861                0x23b6c5f4954f40ea => {
862                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
863                    let mut req = fidl::new_empty!(HostNameSubscriberSubscribeToHostNameRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
864                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostNameSubscriberSubscribeToHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
865                    let control_handle = HostNameSubscriberControlHandle {
866                        inner: this.inner.clone(),
867                    };
868                    Ok(HostNameSubscriberRequest::SubscribeToHostName {host: req.host,
869options: req.options,
870listener: req.listener,
871
872                        control_handle,
873                    })
874                }
875                _ => Err(fidl::Error::UnknownOrdinal {
876                    ordinal: header.ordinal,
877                    protocol_name: <HostNameSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
878                }),
879            }))
880            },
881        )
882    }
883}
884
885/// Discoverable protocol for subscribing to address changes for given host names.
886#[derive(Debug)]
887pub enum HostNameSubscriberRequest {
888    /// Gets the addresses for the specified host.
889    ///
890    /// + request `host` the simple name of the host.
891    /// + request `options` options to be applied to the subscription.
892    /// + request `listener` client end of the `HostNameSubscriptionListener` channel.
893    SubscribeToHostName {
894        host: String,
895        options: HostNameSubscriptionOptions,
896        listener: fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
897        control_handle: HostNameSubscriberControlHandle,
898    },
899}
900
901impl HostNameSubscriberRequest {
902    #[allow(irrefutable_let_patterns)]
903    pub fn into_subscribe_to_host_name(
904        self,
905    ) -> Option<(
906        String,
907        HostNameSubscriptionOptions,
908        fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
909        HostNameSubscriberControlHandle,
910    )> {
911        if let HostNameSubscriberRequest::SubscribeToHostName {
912            host,
913            options,
914            listener,
915            control_handle,
916        } = self
917        {
918            Some((host, options, listener, control_handle))
919        } else {
920            None
921        }
922    }
923
924    /// Name of the method defined in FIDL
925    pub fn method_name(&self) -> &'static str {
926        match *self {
927            HostNameSubscriberRequest::SubscribeToHostName { .. } => "subscribe_to_host_name",
928        }
929    }
930}
931
932#[derive(Debug, Clone)]
933pub struct HostNameSubscriberControlHandle {
934    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
935}
936
937impl fidl::endpoints::ControlHandle for HostNameSubscriberControlHandle {
938    fn shutdown(&self) {
939        self.inner.shutdown()
940    }
941    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
942        self.inner.shutdown_with_epitaph(status)
943    }
944
945    fn is_closed(&self) -> bool {
946        self.inner.channel().is_closed()
947    }
948    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
949        self.inner.channel().on_closed()
950    }
951
952    #[cfg(target_os = "fuchsia")]
953    fn signal_peer(
954        &self,
955        clear_mask: zx::Signals,
956        set_mask: zx::Signals,
957    ) -> Result<(), zx_status::Status> {
958        use fidl::Peered;
959        self.inner.channel().signal_peer(clear_mask, set_mask)
960    }
961}
962
963impl HostNameSubscriberControlHandle {}
964
965#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
966pub struct HostNameSubscriptionListenerMarker;
967
968impl fidl::endpoints::ProtocolMarker for HostNameSubscriptionListenerMarker {
969    type Proxy = HostNameSubscriptionListenerProxy;
970    type RequestStream = HostNameSubscriptionListenerRequestStream;
971    #[cfg(target_os = "fuchsia")]
972    type SynchronousProxy = HostNameSubscriptionListenerSynchronousProxy;
973
974    const DEBUG_NAME: &'static str = "(anonymous) HostNameSubscriptionListener";
975}
976
977pub trait HostNameSubscriptionListenerProxyInterface: Send + Sync {
978    type OnAddressesChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
979    fn r#on_addresses_changed(
980        &self,
981        addresses: &[HostAddress],
982    ) -> Self::OnAddressesChangedResponseFut;
983}
984#[derive(Debug)]
985#[cfg(target_os = "fuchsia")]
986pub struct HostNameSubscriptionListenerSynchronousProxy {
987    client: fidl::client::sync::Client,
988}
989
990#[cfg(target_os = "fuchsia")]
991impl fidl::endpoints::SynchronousProxy for HostNameSubscriptionListenerSynchronousProxy {
992    type Proxy = HostNameSubscriptionListenerProxy;
993    type Protocol = HostNameSubscriptionListenerMarker;
994
995    fn from_channel(inner: fidl::Channel) -> Self {
996        Self::new(inner)
997    }
998
999    fn into_channel(self) -> fidl::Channel {
1000        self.client.into_channel()
1001    }
1002
1003    fn as_channel(&self) -> &fidl::Channel {
1004        self.client.as_channel()
1005    }
1006}
1007
1008#[cfg(target_os = "fuchsia")]
1009impl HostNameSubscriptionListenerSynchronousProxy {
1010    pub fn new(channel: fidl::Channel) -> Self {
1011        let protocol_name =
1012            <HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1013        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1014    }
1015
1016    pub fn into_channel(self) -> fidl::Channel {
1017        self.client.into_channel()
1018    }
1019
1020    /// Waits until an event arrives and returns it. It is safe for other
1021    /// threads to make concurrent requests while waiting for an event.
1022    pub fn wait_for_event(
1023        &self,
1024        deadline: zx::MonotonicInstant,
1025    ) -> Result<HostNameSubscriptionListenerEvent, fidl::Error> {
1026        HostNameSubscriptionListenerEvent::decode(self.client.wait_for_event(deadline)?)
1027    }
1028
1029    /// Notifies the subscriber that the addresses associated with a host name have changed.
1030    pub fn r#on_addresses_changed(
1031        &self,
1032        mut addresses: &[HostAddress],
1033        ___deadline: zx::MonotonicInstant,
1034    ) -> Result<(), fidl::Error> {
1035        let _response = self.client.send_query::<
1036            HostNameSubscriptionListenerOnAddressesChangedRequest,
1037            fidl::encoding::EmptyPayload,
1038        >(
1039            (addresses,),
1040            0x44f5e70b2e8c1472,
1041            fidl::encoding::DynamicFlags::empty(),
1042            ___deadline,
1043        )?;
1044        Ok(_response)
1045    }
1046}
1047
1048#[derive(Debug, Clone)]
1049pub struct HostNameSubscriptionListenerProxy {
1050    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1051}
1052
1053impl fidl::endpoints::Proxy for HostNameSubscriptionListenerProxy {
1054    type Protocol = HostNameSubscriptionListenerMarker;
1055
1056    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1057        Self::new(inner)
1058    }
1059
1060    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1061        self.client.into_channel().map_err(|client| Self { client })
1062    }
1063
1064    fn as_channel(&self) -> &::fidl::AsyncChannel {
1065        self.client.as_channel()
1066    }
1067}
1068
1069impl HostNameSubscriptionListenerProxy {
1070    /// Create a new Proxy for fuchsia.net.mdns/HostNameSubscriptionListener.
1071    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1072        let protocol_name =
1073            <HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1074        Self { client: fidl::client::Client::new(channel, protocol_name) }
1075    }
1076
1077    /// Get a Stream of events from the remote end of the protocol.
1078    ///
1079    /// # Panics
1080    ///
1081    /// Panics if the event stream was already taken.
1082    pub fn take_event_stream(&self) -> HostNameSubscriptionListenerEventStream {
1083        HostNameSubscriptionListenerEventStream {
1084            event_receiver: self.client.take_event_receiver(),
1085        }
1086    }
1087
1088    /// Notifies the subscriber that the addresses associated with a host name have changed.
1089    pub fn r#on_addresses_changed(
1090        &self,
1091        mut addresses: &[HostAddress],
1092    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1093        HostNameSubscriptionListenerProxyInterface::r#on_addresses_changed(self, addresses)
1094    }
1095}
1096
1097impl HostNameSubscriptionListenerProxyInterface for HostNameSubscriptionListenerProxy {
1098    type OnAddressesChangedResponseFut =
1099        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1100    fn r#on_addresses_changed(
1101        &self,
1102        mut addresses: &[HostAddress],
1103    ) -> Self::OnAddressesChangedResponseFut {
1104        fn _decode(
1105            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1106        ) -> Result<(), fidl::Error> {
1107            let _response = fidl::client::decode_transaction_body::<
1108                fidl::encoding::EmptyPayload,
1109                fidl::encoding::DefaultFuchsiaResourceDialect,
1110                0x44f5e70b2e8c1472,
1111            >(_buf?)?;
1112            Ok(_response)
1113        }
1114        self.client
1115            .send_query_and_decode::<HostNameSubscriptionListenerOnAddressesChangedRequest, ()>(
1116                (addresses,),
1117                0x44f5e70b2e8c1472,
1118                fidl::encoding::DynamicFlags::empty(),
1119                _decode,
1120            )
1121    }
1122}
1123
1124pub struct HostNameSubscriptionListenerEventStream {
1125    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1126}
1127
1128impl std::marker::Unpin for HostNameSubscriptionListenerEventStream {}
1129
1130impl futures::stream::FusedStream for HostNameSubscriptionListenerEventStream {
1131    fn is_terminated(&self) -> bool {
1132        self.event_receiver.is_terminated()
1133    }
1134}
1135
1136impl futures::Stream for HostNameSubscriptionListenerEventStream {
1137    type Item = Result<HostNameSubscriptionListenerEvent, fidl::Error>;
1138
1139    fn poll_next(
1140        mut self: std::pin::Pin<&mut Self>,
1141        cx: &mut std::task::Context<'_>,
1142    ) -> std::task::Poll<Option<Self::Item>> {
1143        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1144            &mut self.event_receiver,
1145            cx
1146        )?) {
1147            Some(buf) => {
1148                std::task::Poll::Ready(Some(HostNameSubscriptionListenerEvent::decode(buf)))
1149            }
1150            None => std::task::Poll::Ready(None),
1151        }
1152    }
1153}
1154
1155#[derive(Debug)]
1156pub enum HostNameSubscriptionListenerEvent {}
1157
1158impl HostNameSubscriptionListenerEvent {
1159    /// Decodes a message buffer as a [`HostNameSubscriptionListenerEvent`].
1160    fn decode(
1161        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1162    ) -> Result<HostNameSubscriptionListenerEvent, fidl::Error> {
1163        let (bytes, _handles) = buf.split_mut();
1164        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1165        debug_assert_eq!(tx_header.tx_id, 0);
1166        match tx_header.ordinal {
1167            _ => Err(fidl::Error::UnknownOrdinal {
1168                ordinal: tx_header.ordinal,
1169                protocol_name: <HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1170            })
1171        }
1172    }
1173}
1174
1175/// A Stream of incoming requests for fuchsia.net.mdns/HostNameSubscriptionListener.
1176pub struct HostNameSubscriptionListenerRequestStream {
1177    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1178    is_terminated: bool,
1179}
1180
1181impl std::marker::Unpin for HostNameSubscriptionListenerRequestStream {}
1182
1183impl futures::stream::FusedStream for HostNameSubscriptionListenerRequestStream {
1184    fn is_terminated(&self) -> bool {
1185        self.is_terminated
1186    }
1187}
1188
1189impl fidl::endpoints::RequestStream for HostNameSubscriptionListenerRequestStream {
1190    type Protocol = HostNameSubscriptionListenerMarker;
1191    type ControlHandle = HostNameSubscriptionListenerControlHandle;
1192
1193    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1194        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1195    }
1196
1197    fn control_handle(&self) -> Self::ControlHandle {
1198        HostNameSubscriptionListenerControlHandle { inner: self.inner.clone() }
1199    }
1200
1201    fn into_inner(
1202        self,
1203    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1204    {
1205        (self.inner, self.is_terminated)
1206    }
1207
1208    fn from_inner(
1209        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1210        is_terminated: bool,
1211    ) -> Self {
1212        Self { inner, is_terminated }
1213    }
1214}
1215
1216impl futures::Stream for HostNameSubscriptionListenerRequestStream {
1217    type Item = Result<HostNameSubscriptionListenerRequest, fidl::Error>;
1218
1219    fn poll_next(
1220        mut self: std::pin::Pin<&mut Self>,
1221        cx: &mut std::task::Context<'_>,
1222    ) -> std::task::Poll<Option<Self::Item>> {
1223        let this = &mut *self;
1224        if this.inner.check_shutdown(cx) {
1225            this.is_terminated = true;
1226            return std::task::Poll::Ready(None);
1227        }
1228        if this.is_terminated {
1229            panic!("polled HostNameSubscriptionListenerRequestStream after completion");
1230        }
1231        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1232            |bytes, handles| {
1233                match this.inner.channel().read_etc(cx, bytes, handles) {
1234                    std::task::Poll::Ready(Ok(())) => {}
1235                    std::task::Poll::Pending => return std::task::Poll::Pending,
1236                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1237                        this.is_terminated = true;
1238                        return std::task::Poll::Ready(None);
1239                    }
1240                    std::task::Poll::Ready(Err(e)) => {
1241                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1242                            e.into(),
1243                        ))))
1244                    }
1245                }
1246
1247                // A message has been received from the channel
1248                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1249
1250                std::task::Poll::Ready(Some(match header.ordinal {
1251                0x44f5e70b2e8c1472 => {
1252                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1253                    let mut req = fidl::new_empty!(HostNameSubscriptionListenerOnAddressesChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1254                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<HostNameSubscriptionListenerOnAddressesChangedRequest>(&header, _body_bytes, handles, &mut req)?;
1255                    let control_handle = HostNameSubscriptionListenerControlHandle {
1256                        inner: this.inner.clone(),
1257                    };
1258                    Ok(HostNameSubscriptionListenerRequest::OnAddressesChanged {addresses: req.addresses,
1259
1260                        responder: HostNameSubscriptionListenerOnAddressesChangedResponder {
1261                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1262                            tx_id: header.tx_id,
1263                        },
1264                    })
1265                }
1266                _ => Err(fidl::Error::UnknownOrdinal {
1267                    ordinal: header.ordinal,
1268                    protocol_name: <HostNameSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1269                }),
1270            }))
1271            },
1272        )
1273    }
1274}
1275
1276/// Client-implemented interface for subscribers. Method replies are used to
1277/// throttle traffic. The service won't necessarily wait for a reply before
1278/// calling another method.
1279#[derive(Debug)]
1280pub enum HostNameSubscriptionListenerRequest {
1281    /// Notifies the subscriber that the addresses associated with a host name have changed.
1282    OnAddressesChanged {
1283        addresses: Vec<HostAddress>,
1284        responder: HostNameSubscriptionListenerOnAddressesChangedResponder,
1285    },
1286}
1287
1288impl HostNameSubscriptionListenerRequest {
1289    #[allow(irrefutable_let_patterns)]
1290    pub fn into_on_addresses_changed(
1291        self,
1292    ) -> Option<(Vec<HostAddress>, HostNameSubscriptionListenerOnAddressesChangedResponder)> {
1293        if let HostNameSubscriptionListenerRequest::OnAddressesChanged { addresses, responder } =
1294            self
1295        {
1296            Some((addresses, responder))
1297        } else {
1298            None
1299        }
1300    }
1301
1302    /// Name of the method defined in FIDL
1303    pub fn method_name(&self) -> &'static str {
1304        match *self {
1305            HostNameSubscriptionListenerRequest::OnAddressesChanged { .. } => {
1306                "on_addresses_changed"
1307            }
1308        }
1309    }
1310}
1311
1312#[derive(Debug, Clone)]
1313pub struct HostNameSubscriptionListenerControlHandle {
1314    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1315}
1316
1317impl fidl::endpoints::ControlHandle for HostNameSubscriptionListenerControlHandle {
1318    fn shutdown(&self) {
1319        self.inner.shutdown()
1320    }
1321    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1322        self.inner.shutdown_with_epitaph(status)
1323    }
1324
1325    fn is_closed(&self) -> bool {
1326        self.inner.channel().is_closed()
1327    }
1328    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1329        self.inner.channel().on_closed()
1330    }
1331
1332    #[cfg(target_os = "fuchsia")]
1333    fn signal_peer(
1334        &self,
1335        clear_mask: zx::Signals,
1336        set_mask: zx::Signals,
1337    ) -> Result<(), zx_status::Status> {
1338        use fidl::Peered;
1339        self.inner.channel().signal_peer(clear_mask, set_mask)
1340    }
1341}
1342
1343impl HostNameSubscriptionListenerControlHandle {}
1344
1345#[must_use = "FIDL methods require a response to be sent"]
1346#[derive(Debug)]
1347pub struct HostNameSubscriptionListenerOnAddressesChangedResponder {
1348    control_handle: std::mem::ManuallyDrop<HostNameSubscriptionListenerControlHandle>,
1349    tx_id: u32,
1350}
1351
1352/// Set the the channel to be shutdown (see [`HostNameSubscriptionListenerControlHandle::shutdown`])
1353/// if the responder is dropped without sending a response, so that the client
1354/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1355impl std::ops::Drop for HostNameSubscriptionListenerOnAddressesChangedResponder {
1356    fn drop(&mut self) {
1357        self.control_handle.shutdown();
1358        // Safety: drops once, never accessed again
1359        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1360    }
1361}
1362
1363impl fidl::endpoints::Responder for HostNameSubscriptionListenerOnAddressesChangedResponder {
1364    type ControlHandle = HostNameSubscriptionListenerControlHandle;
1365
1366    fn control_handle(&self) -> &HostNameSubscriptionListenerControlHandle {
1367        &self.control_handle
1368    }
1369
1370    fn drop_without_shutdown(mut self) {
1371        // Safety: drops once, never accessed again due to mem::forget
1372        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1373        // Prevent Drop from running (which would shut down the channel)
1374        std::mem::forget(self);
1375    }
1376}
1377
1378impl HostNameSubscriptionListenerOnAddressesChangedResponder {
1379    /// Sends a response to the FIDL transaction.
1380    ///
1381    /// Sets the channel to shutdown if an error occurs.
1382    pub fn send(self) -> Result<(), fidl::Error> {
1383        let _result = self.send_raw();
1384        if _result.is_err() {
1385            self.control_handle.shutdown();
1386        }
1387        self.drop_without_shutdown();
1388        _result
1389    }
1390
1391    /// Similar to "send" but does not shutdown the channel if an error occurs.
1392    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1393        let _result = self.send_raw();
1394        self.drop_without_shutdown();
1395        _result
1396    }
1397
1398    fn send_raw(&self) -> Result<(), fidl::Error> {
1399        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1400            (),
1401            self.tx_id,
1402            0x44f5e70b2e8c1472,
1403            fidl::encoding::DynamicFlags::empty(),
1404        )
1405    }
1406}
1407
1408#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1409pub struct ProxyHostPublisherMarker;
1410
1411impl fidl::endpoints::ProtocolMarker for ProxyHostPublisherMarker {
1412    type Proxy = ProxyHostPublisherProxy;
1413    type RequestStream = ProxyHostPublisherRequestStream;
1414    #[cfg(target_os = "fuchsia")]
1415    type SynchronousProxy = ProxyHostPublisherSynchronousProxy;
1416
1417    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ProxyHostPublisher";
1418}
1419impl fidl::endpoints::DiscoverableProtocolMarker for ProxyHostPublisherMarker {}
1420pub type ProxyHostPublisherPublishProxyHostResult = Result<(), PublishProxyHostError>;
1421
1422pub trait ProxyHostPublisherProxyInterface: Send + Sync {
1423    type PublishProxyHostResponseFut: std::future::Future<Output = Result<ProxyHostPublisherPublishProxyHostResult, fidl::Error>>
1424        + Send;
1425    fn r#publish_proxy_host(
1426        &self,
1427        host: &str,
1428        addresses: &[fidl_fuchsia_net::IpAddress],
1429        options: &ProxyHostPublicationOptions,
1430        service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
1431    ) -> Self::PublishProxyHostResponseFut;
1432}
1433#[derive(Debug)]
1434#[cfg(target_os = "fuchsia")]
1435pub struct ProxyHostPublisherSynchronousProxy {
1436    client: fidl::client::sync::Client,
1437}
1438
1439#[cfg(target_os = "fuchsia")]
1440impl fidl::endpoints::SynchronousProxy for ProxyHostPublisherSynchronousProxy {
1441    type Proxy = ProxyHostPublisherProxy;
1442    type Protocol = ProxyHostPublisherMarker;
1443
1444    fn from_channel(inner: fidl::Channel) -> Self {
1445        Self::new(inner)
1446    }
1447
1448    fn into_channel(self) -> fidl::Channel {
1449        self.client.into_channel()
1450    }
1451
1452    fn as_channel(&self) -> &fidl::Channel {
1453        self.client.as_channel()
1454    }
1455}
1456
1457#[cfg(target_os = "fuchsia")]
1458impl ProxyHostPublisherSynchronousProxy {
1459    pub fn new(channel: fidl::Channel) -> Self {
1460        let protocol_name =
1461            <ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1462        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1463    }
1464
1465    pub fn into_channel(self) -> fidl::Channel {
1466        self.client.into_channel()
1467    }
1468
1469    /// Waits until an event arrives and returns it. It is safe for other
1470    /// threads to make concurrent requests while waiting for an event.
1471    pub fn wait_for_event(
1472        &self,
1473        deadline: zx::MonotonicInstant,
1474    ) -> Result<ProxyHostPublisherEvent, fidl::Error> {
1475        ProxyHostPublisherEvent::decode(self.client.wait_for_event(deadline)?)
1476    }
1477
1478    /// Publishes a host name on behalf of a remote host and provides a `ServiceInstancePublisher`
1479    /// for publishing service instances on behalf of that host.
1480    ///
1481    /// + request `host` host name to publish.
1482    /// + request `addresses` addresses to publish for the host name.
1483    /// + request `options` options to be applied to the publication.
1484    /// + request `service_instance_publisher` server end of the `ServiceInstancePublisher` for
1485    ///   the proxied host.
1486    ///
1487    /// This method causes the service to publish the host name at the specified addresses. The
1488    /// actual host must not be present on any relevant links or there will be a conflict. If
1489    /// the `perform_probe` option is true or not supplied (true by default), a probe will occur
1490    /// to verify that the host name isn't otherwise published.
1491    ///
1492    /// The proxy host created by this method persists until the `ServiceInstancePublisher`
1493    /// channel is closed.
1494    pub fn r#publish_proxy_host(
1495        &self,
1496        mut host: &str,
1497        mut addresses: &[fidl_fuchsia_net::IpAddress],
1498        mut options: &ProxyHostPublicationOptions,
1499        mut service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
1500        ___deadline: zx::MonotonicInstant,
1501    ) -> Result<ProxyHostPublisherPublishProxyHostResult, fidl::Error> {
1502        let _response = self.client.send_query::<
1503            ProxyHostPublisherPublishProxyHostRequest,
1504            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishProxyHostError>,
1505        >(
1506            (host, addresses, options, service_instance_publisher,),
1507            0x639bfff950f973c2,
1508            fidl::encoding::DynamicFlags::empty(),
1509            ___deadline,
1510        )?;
1511        Ok(_response.map(|x| x))
1512    }
1513}
1514
1515#[derive(Debug, Clone)]
1516pub struct ProxyHostPublisherProxy {
1517    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1518}
1519
1520impl fidl::endpoints::Proxy for ProxyHostPublisherProxy {
1521    type Protocol = ProxyHostPublisherMarker;
1522
1523    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1524        Self::new(inner)
1525    }
1526
1527    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1528        self.client.into_channel().map_err(|client| Self { client })
1529    }
1530
1531    fn as_channel(&self) -> &::fidl::AsyncChannel {
1532        self.client.as_channel()
1533    }
1534}
1535
1536impl ProxyHostPublisherProxy {
1537    /// Create a new Proxy for fuchsia.net.mdns/ProxyHostPublisher.
1538    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1539        let protocol_name =
1540            <ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1541        Self { client: fidl::client::Client::new(channel, protocol_name) }
1542    }
1543
1544    /// Get a Stream of events from the remote end of the protocol.
1545    ///
1546    /// # Panics
1547    ///
1548    /// Panics if the event stream was already taken.
1549    pub fn take_event_stream(&self) -> ProxyHostPublisherEventStream {
1550        ProxyHostPublisherEventStream { event_receiver: self.client.take_event_receiver() }
1551    }
1552
1553    /// Publishes a host name on behalf of a remote host and provides a `ServiceInstancePublisher`
1554    /// for publishing service instances on behalf of that host.
1555    ///
1556    /// + request `host` host name to publish.
1557    /// + request `addresses` addresses to publish for the host name.
1558    /// + request `options` options to be applied to the publication.
1559    /// + request `service_instance_publisher` server end of the `ServiceInstancePublisher` for
1560    ///   the proxied host.
1561    ///
1562    /// This method causes the service to publish the host name at the specified addresses. The
1563    /// actual host must not be present on any relevant links or there will be a conflict. If
1564    /// the `perform_probe` option is true or not supplied (true by default), a probe will occur
1565    /// to verify that the host name isn't otherwise published.
1566    ///
1567    /// The proxy host created by this method persists until the `ServiceInstancePublisher`
1568    /// channel is closed.
1569    pub fn r#publish_proxy_host(
1570        &self,
1571        mut host: &str,
1572        mut addresses: &[fidl_fuchsia_net::IpAddress],
1573        mut options: &ProxyHostPublicationOptions,
1574        mut service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
1575    ) -> fidl::client::QueryResponseFut<
1576        ProxyHostPublisherPublishProxyHostResult,
1577        fidl::encoding::DefaultFuchsiaResourceDialect,
1578    > {
1579        ProxyHostPublisherProxyInterface::r#publish_proxy_host(
1580            self,
1581            host,
1582            addresses,
1583            options,
1584            service_instance_publisher,
1585        )
1586    }
1587}
1588
1589impl ProxyHostPublisherProxyInterface for ProxyHostPublisherProxy {
1590    type PublishProxyHostResponseFut = fidl::client::QueryResponseFut<
1591        ProxyHostPublisherPublishProxyHostResult,
1592        fidl::encoding::DefaultFuchsiaResourceDialect,
1593    >;
1594    fn r#publish_proxy_host(
1595        &self,
1596        mut host: &str,
1597        mut addresses: &[fidl_fuchsia_net::IpAddress],
1598        mut options: &ProxyHostPublicationOptions,
1599        mut service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
1600    ) -> Self::PublishProxyHostResponseFut {
1601        fn _decode(
1602            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1603        ) -> Result<ProxyHostPublisherPublishProxyHostResult, fidl::Error> {
1604            let _response = fidl::client::decode_transaction_body::<
1605                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishProxyHostError>,
1606                fidl::encoding::DefaultFuchsiaResourceDialect,
1607                0x639bfff950f973c2,
1608            >(_buf?)?;
1609            Ok(_response.map(|x| x))
1610        }
1611        self.client.send_query_and_decode::<
1612            ProxyHostPublisherPublishProxyHostRequest,
1613            ProxyHostPublisherPublishProxyHostResult,
1614        >(
1615            (host, addresses, options, service_instance_publisher,),
1616            0x639bfff950f973c2,
1617            fidl::encoding::DynamicFlags::empty(),
1618            _decode,
1619        )
1620    }
1621}
1622
1623pub struct ProxyHostPublisherEventStream {
1624    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1625}
1626
1627impl std::marker::Unpin for ProxyHostPublisherEventStream {}
1628
1629impl futures::stream::FusedStream for ProxyHostPublisherEventStream {
1630    fn is_terminated(&self) -> bool {
1631        self.event_receiver.is_terminated()
1632    }
1633}
1634
1635impl futures::Stream for ProxyHostPublisherEventStream {
1636    type Item = Result<ProxyHostPublisherEvent, fidl::Error>;
1637
1638    fn poll_next(
1639        mut self: std::pin::Pin<&mut Self>,
1640        cx: &mut std::task::Context<'_>,
1641    ) -> std::task::Poll<Option<Self::Item>> {
1642        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1643            &mut self.event_receiver,
1644            cx
1645        )?) {
1646            Some(buf) => std::task::Poll::Ready(Some(ProxyHostPublisherEvent::decode(buf))),
1647            None => std::task::Poll::Ready(None),
1648        }
1649    }
1650}
1651
1652#[derive(Debug)]
1653pub enum ProxyHostPublisherEvent {}
1654
1655impl ProxyHostPublisherEvent {
1656    /// Decodes a message buffer as a [`ProxyHostPublisherEvent`].
1657    fn decode(
1658        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1659    ) -> Result<ProxyHostPublisherEvent, fidl::Error> {
1660        let (bytes, _handles) = buf.split_mut();
1661        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1662        debug_assert_eq!(tx_header.tx_id, 0);
1663        match tx_header.ordinal {
1664            _ => Err(fidl::Error::UnknownOrdinal {
1665                ordinal: tx_header.ordinal,
1666                protocol_name:
1667                    <ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1668            }),
1669        }
1670    }
1671}
1672
1673/// A Stream of incoming requests for fuchsia.net.mdns/ProxyHostPublisher.
1674pub struct ProxyHostPublisherRequestStream {
1675    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1676    is_terminated: bool,
1677}
1678
1679impl std::marker::Unpin for ProxyHostPublisherRequestStream {}
1680
1681impl futures::stream::FusedStream for ProxyHostPublisherRequestStream {
1682    fn is_terminated(&self) -> bool {
1683        self.is_terminated
1684    }
1685}
1686
1687impl fidl::endpoints::RequestStream for ProxyHostPublisherRequestStream {
1688    type Protocol = ProxyHostPublisherMarker;
1689    type ControlHandle = ProxyHostPublisherControlHandle;
1690
1691    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1692        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1693    }
1694
1695    fn control_handle(&self) -> Self::ControlHandle {
1696        ProxyHostPublisherControlHandle { inner: self.inner.clone() }
1697    }
1698
1699    fn into_inner(
1700        self,
1701    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1702    {
1703        (self.inner, self.is_terminated)
1704    }
1705
1706    fn from_inner(
1707        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1708        is_terminated: bool,
1709    ) -> Self {
1710        Self { inner, is_terminated }
1711    }
1712}
1713
1714impl futures::Stream for ProxyHostPublisherRequestStream {
1715    type Item = Result<ProxyHostPublisherRequest, fidl::Error>;
1716
1717    fn poll_next(
1718        mut self: std::pin::Pin<&mut Self>,
1719        cx: &mut std::task::Context<'_>,
1720    ) -> std::task::Poll<Option<Self::Item>> {
1721        let this = &mut *self;
1722        if this.inner.check_shutdown(cx) {
1723            this.is_terminated = true;
1724            return std::task::Poll::Ready(None);
1725        }
1726        if this.is_terminated {
1727            panic!("polled ProxyHostPublisherRequestStream after completion");
1728        }
1729        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1730            |bytes, handles| {
1731                match this.inner.channel().read_etc(cx, bytes, handles) {
1732                    std::task::Poll::Ready(Ok(())) => {}
1733                    std::task::Poll::Pending => return std::task::Poll::Pending,
1734                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1735                        this.is_terminated = true;
1736                        return std::task::Poll::Ready(None);
1737                    }
1738                    std::task::Poll::Ready(Err(e)) => {
1739                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1740                            e.into(),
1741                        ))))
1742                    }
1743                }
1744
1745                // A message has been received from the channel
1746                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1747
1748                std::task::Poll::Ready(Some(match header.ordinal {
1749                0x639bfff950f973c2 => {
1750                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1751                    let mut req = fidl::new_empty!(ProxyHostPublisherPublishProxyHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1752                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProxyHostPublisherPublishProxyHostRequest>(&header, _body_bytes, handles, &mut req)?;
1753                    let control_handle = ProxyHostPublisherControlHandle {
1754                        inner: this.inner.clone(),
1755                    };
1756                    Ok(ProxyHostPublisherRequest::PublishProxyHost {host: req.host,
1757addresses: req.addresses,
1758options: req.options,
1759service_instance_publisher: req.service_instance_publisher,
1760
1761                        responder: ProxyHostPublisherPublishProxyHostResponder {
1762                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1763                            tx_id: header.tx_id,
1764                        },
1765                    })
1766                }
1767                _ => Err(fidl::Error::UnknownOrdinal {
1768                    ordinal: header.ordinal,
1769                    protocol_name: <ProxyHostPublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1770                }),
1771            }))
1772            },
1773        )
1774    }
1775}
1776
1777/// Discoverable protocol for publishing on behalf of another host.
1778#[derive(Debug)]
1779pub enum ProxyHostPublisherRequest {
1780    /// Publishes a host name on behalf of a remote host and provides a `ServiceInstancePublisher`
1781    /// for publishing service instances on behalf of that host.
1782    ///
1783    /// + request `host` host name to publish.
1784    /// + request `addresses` addresses to publish for the host name.
1785    /// + request `options` options to be applied to the publication.
1786    /// + request `service_instance_publisher` server end of the `ServiceInstancePublisher` for
1787    ///   the proxied host.
1788    ///
1789    /// This method causes the service to publish the host name at the specified addresses. The
1790    /// actual host must not be present on any relevant links or there will be a conflict. If
1791    /// the `perform_probe` option is true or not supplied (true by default), a probe will occur
1792    /// to verify that the host name isn't otherwise published.
1793    ///
1794    /// The proxy host created by this method persists until the `ServiceInstancePublisher`
1795    /// channel is closed.
1796    PublishProxyHost {
1797        host: String,
1798        addresses: Vec<fidl_fuchsia_net::IpAddress>,
1799        options: ProxyHostPublicationOptions,
1800        service_instance_publisher: fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
1801        responder: ProxyHostPublisherPublishProxyHostResponder,
1802    },
1803}
1804
1805impl ProxyHostPublisherRequest {
1806    #[allow(irrefutable_let_patterns)]
1807    pub fn into_publish_proxy_host(
1808        self,
1809    ) -> Option<(
1810        String,
1811        Vec<fidl_fuchsia_net::IpAddress>,
1812        ProxyHostPublicationOptions,
1813        fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
1814        ProxyHostPublisherPublishProxyHostResponder,
1815    )> {
1816        if let ProxyHostPublisherRequest::PublishProxyHost {
1817            host,
1818            addresses,
1819            options,
1820            service_instance_publisher,
1821            responder,
1822        } = self
1823        {
1824            Some((host, addresses, options, service_instance_publisher, responder))
1825        } else {
1826            None
1827        }
1828    }
1829
1830    /// Name of the method defined in FIDL
1831    pub fn method_name(&self) -> &'static str {
1832        match *self {
1833            ProxyHostPublisherRequest::PublishProxyHost { .. } => "publish_proxy_host",
1834        }
1835    }
1836}
1837
1838#[derive(Debug, Clone)]
1839pub struct ProxyHostPublisherControlHandle {
1840    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1841}
1842
1843impl fidl::endpoints::ControlHandle for ProxyHostPublisherControlHandle {
1844    fn shutdown(&self) {
1845        self.inner.shutdown()
1846    }
1847    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1848        self.inner.shutdown_with_epitaph(status)
1849    }
1850
1851    fn is_closed(&self) -> bool {
1852        self.inner.channel().is_closed()
1853    }
1854    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1855        self.inner.channel().on_closed()
1856    }
1857
1858    #[cfg(target_os = "fuchsia")]
1859    fn signal_peer(
1860        &self,
1861        clear_mask: zx::Signals,
1862        set_mask: zx::Signals,
1863    ) -> Result<(), zx_status::Status> {
1864        use fidl::Peered;
1865        self.inner.channel().signal_peer(clear_mask, set_mask)
1866    }
1867}
1868
1869impl ProxyHostPublisherControlHandle {}
1870
1871#[must_use = "FIDL methods require a response to be sent"]
1872#[derive(Debug)]
1873pub struct ProxyHostPublisherPublishProxyHostResponder {
1874    control_handle: std::mem::ManuallyDrop<ProxyHostPublisherControlHandle>,
1875    tx_id: u32,
1876}
1877
1878/// Set the the channel to be shutdown (see [`ProxyHostPublisherControlHandle::shutdown`])
1879/// if the responder is dropped without sending a response, so that the client
1880/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1881impl std::ops::Drop for ProxyHostPublisherPublishProxyHostResponder {
1882    fn drop(&mut self) {
1883        self.control_handle.shutdown();
1884        // Safety: drops once, never accessed again
1885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1886    }
1887}
1888
1889impl fidl::endpoints::Responder for ProxyHostPublisherPublishProxyHostResponder {
1890    type ControlHandle = ProxyHostPublisherControlHandle;
1891
1892    fn control_handle(&self) -> &ProxyHostPublisherControlHandle {
1893        &self.control_handle
1894    }
1895
1896    fn drop_without_shutdown(mut self) {
1897        // Safety: drops once, never accessed again due to mem::forget
1898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1899        // Prevent Drop from running (which would shut down the channel)
1900        std::mem::forget(self);
1901    }
1902}
1903
1904impl ProxyHostPublisherPublishProxyHostResponder {
1905    /// Sends a response to the FIDL transaction.
1906    ///
1907    /// Sets the channel to shutdown if an error occurs.
1908    pub fn send(self, mut result: Result<(), PublishProxyHostError>) -> Result<(), fidl::Error> {
1909        let _result = self.send_raw(result);
1910        if _result.is_err() {
1911            self.control_handle.shutdown();
1912        }
1913        self.drop_without_shutdown();
1914        _result
1915    }
1916
1917    /// Similar to "send" but does not shutdown the channel if an error occurs.
1918    pub fn send_no_shutdown_on_err(
1919        self,
1920        mut result: Result<(), PublishProxyHostError>,
1921    ) -> Result<(), fidl::Error> {
1922        let _result = self.send_raw(result);
1923        self.drop_without_shutdown();
1924        _result
1925    }
1926
1927    fn send_raw(&self, mut result: Result<(), PublishProxyHostError>) -> Result<(), fidl::Error> {
1928        self.control_handle.inner.send::<fidl::encoding::ResultType<
1929            fidl::encoding::EmptyStruct,
1930            PublishProxyHostError,
1931        >>(
1932            result,
1933            self.tx_id,
1934            0x639bfff950f973c2,
1935            fidl::encoding::DynamicFlags::empty(),
1936        )
1937    }
1938}
1939
1940#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1941pub struct PublicationResponder_Marker;
1942
1943impl fidl::endpoints::ProtocolMarker for PublicationResponder_Marker {
1944    type Proxy = PublicationResponder_Proxy;
1945    type RequestStream = PublicationResponder_RequestStream;
1946    #[cfg(target_os = "fuchsia")]
1947    type SynchronousProxy = PublicationResponder_SynchronousProxy;
1948
1949    const DEBUG_NAME: &'static str = "(anonymous) PublicationResponder_";
1950}
1951
1952pub trait PublicationResponder_ProxyInterface: Send + Sync {
1953    type OnPublicationResponseFut: std::future::Future<Output = Result<Option<Box<Publication>>, fidl::Error>>
1954        + Send;
1955    fn r#on_publication(
1956        &self,
1957        publication_cause: PublicationCause,
1958        subtype: Option<&str>,
1959        source_addresses: &[fidl_fuchsia_net::IpAddress],
1960    ) -> Self::OnPublicationResponseFut;
1961}
1962#[derive(Debug)]
1963#[cfg(target_os = "fuchsia")]
1964pub struct PublicationResponder_SynchronousProxy {
1965    client: fidl::client::sync::Client,
1966}
1967
1968#[cfg(target_os = "fuchsia")]
1969impl fidl::endpoints::SynchronousProxy for PublicationResponder_SynchronousProxy {
1970    type Proxy = PublicationResponder_Proxy;
1971    type Protocol = PublicationResponder_Marker;
1972
1973    fn from_channel(inner: fidl::Channel) -> Self {
1974        Self::new(inner)
1975    }
1976
1977    fn into_channel(self) -> fidl::Channel {
1978        self.client.into_channel()
1979    }
1980
1981    fn as_channel(&self) -> &fidl::Channel {
1982        self.client.as_channel()
1983    }
1984}
1985
1986#[cfg(target_os = "fuchsia")]
1987impl PublicationResponder_SynchronousProxy {
1988    pub fn new(channel: fidl::Channel) -> Self {
1989        let protocol_name =
1990            <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1991        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1992    }
1993
1994    pub fn into_channel(self) -> fidl::Channel {
1995        self.client.into_channel()
1996    }
1997
1998    /// Waits until an event arrives and returns it. It is safe for other
1999    /// threads to make concurrent requests while waiting for an event.
2000    pub fn wait_for_event(
2001        &self,
2002        deadline: zx::MonotonicInstant,
2003    ) -> Result<PublicationResponder_Event, fidl::Error> {
2004        PublicationResponder_Event::decode(self.client.wait_for_event(deadline)?)
2005    }
2006
2007    /// Provides instance information for initial announcements and query
2008    /// responses relating to the service instance specified in
2009    /// `ServiceInstancePublisher.PublishServiceInstance`.  If the publication relates to a
2010    /// subtype of the service, `subtype` contains the subtype, otherwise
2011    /// it is null. If `publication` is null, no announcement or response is
2012    /// transmitted. Strings in `text` are transmitted in the TXT record.
2013    pub fn r#on_publication(
2014        &self,
2015        mut publication_cause: PublicationCause,
2016        mut subtype: Option<&str>,
2017        mut source_addresses: &[fidl_fuchsia_net::IpAddress],
2018        ___deadline: zx::MonotonicInstant,
2019    ) -> Result<Option<Box<Publication>>, fidl::Error> {
2020        let _response = self.client.send_query::<
2021            PublicationResponderOnPublicationRequest,
2022            PublicationResponderOnPublicationResponse,
2023        >(
2024            (publication_cause, subtype, source_addresses,),
2025            0x71d805aee2907d06,
2026            fidl::encoding::DynamicFlags::empty(),
2027            ___deadline,
2028        )?;
2029        Ok(_response.publication)
2030    }
2031}
2032
2033#[derive(Debug, Clone)]
2034pub struct PublicationResponder_Proxy {
2035    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2036}
2037
2038impl fidl::endpoints::Proxy for PublicationResponder_Proxy {
2039    type Protocol = PublicationResponder_Marker;
2040
2041    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2042        Self::new(inner)
2043    }
2044
2045    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2046        self.client.into_channel().map_err(|client| Self { client })
2047    }
2048
2049    fn as_channel(&self) -> &::fidl::AsyncChannel {
2050        self.client.as_channel()
2051    }
2052}
2053
2054impl PublicationResponder_Proxy {
2055    /// Create a new Proxy for fuchsia.net.mdns/PublicationResponder.
2056    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2057        let protocol_name =
2058            <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2059        Self { client: fidl::client::Client::new(channel, protocol_name) }
2060    }
2061
2062    /// Get a Stream of events from the remote end of the protocol.
2063    ///
2064    /// # Panics
2065    ///
2066    /// Panics if the event stream was already taken.
2067    pub fn take_event_stream(&self) -> PublicationResponder_EventStream {
2068        PublicationResponder_EventStream { event_receiver: self.client.take_event_receiver() }
2069    }
2070
2071    /// Provides instance information for initial announcements and query
2072    /// responses relating to the service instance specified in
2073    /// `ServiceInstancePublisher.PublishServiceInstance`.  If the publication relates to a
2074    /// subtype of the service, `subtype` contains the subtype, otherwise
2075    /// it is null. If `publication` is null, no announcement or response is
2076    /// transmitted. Strings in `text` are transmitted in the TXT record.
2077    pub fn r#on_publication(
2078        &self,
2079        mut publication_cause: PublicationCause,
2080        mut subtype: Option<&str>,
2081        mut source_addresses: &[fidl_fuchsia_net::IpAddress],
2082    ) -> fidl::client::QueryResponseFut<
2083        Option<Box<Publication>>,
2084        fidl::encoding::DefaultFuchsiaResourceDialect,
2085    > {
2086        PublicationResponder_ProxyInterface::r#on_publication(
2087            self,
2088            publication_cause,
2089            subtype,
2090            source_addresses,
2091        )
2092    }
2093}
2094
2095impl PublicationResponder_ProxyInterface for PublicationResponder_Proxy {
2096    type OnPublicationResponseFut = fidl::client::QueryResponseFut<
2097        Option<Box<Publication>>,
2098        fidl::encoding::DefaultFuchsiaResourceDialect,
2099    >;
2100    fn r#on_publication(
2101        &self,
2102        mut publication_cause: PublicationCause,
2103        mut subtype: Option<&str>,
2104        mut source_addresses: &[fidl_fuchsia_net::IpAddress],
2105    ) -> Self::OnPublicationResponseFut {
2106        fn _decode(
2107            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2108        ) -> Result<Option<Box<Publication>>, fidl::Error> {
2109            let _response = fidl::client::decode_transaction_body::<
2110                PublicationResponderOnPublicationResponse,
2111                fidl::encoding::DefaultFuchsiaResourceDialect,
2112                0x71d805aee2907d06,
2113            >(_buf?)?;
2114            Ok(_response.publication)
2115        }
2116        self.client.send_query_and_decode::<
2117            PublicationResponderOnPublicationRequest,
2118            Option<Box<Publication>>,
2119        >(
2120            (publication_cause, subtype, source_addresses,),
2121            0x71d805aee2907d06,
2122            fidl::encoding::DynamicFlags::empty(),
2123            _decode,
2124        )
2125    }
2126}
2127
2128pub struct PublicationResponder_EventStream {
2129    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2130}
2131
2132impl std::marker::Unpin for PublicationResponder_EventStream {}
2133
2134impl futures::stream::FusedStream for PublicationResponder_EventStream {
2135    fn is_terminated(&self) -> bool {
2136        self.event_receiver.is_terminated()
2137    }
2138}
2139
2140impl futures::Stream for PublicationResponder_EventStream {
2141    type Item = Result<PublicationResponder_Event, fidl::Error>;
2142
2143    fn poll_next(
2144        mut self: std::pin::Pin<&mut Self>,
2145        cx: &mut std::task::Context<'_>,
2146    ) -> std::task::Poll<Option<Self::Item>> {
2147        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2148            &mut self.event_receiver,
2149            cx
2150        )?) {
2151            Some(buf) => std::task::Poll::Ready(Some(PublicationResponder_Event::decode(buf))),
2152            None => std::task::Poll::Ready(None),
2153        }
2154    }
2155}
2156
2157#[derive(Debug)]
2158pub enum PublicationResponder_Event {
2159    SetSubtypes { subtypes: Vec<String> },
2160    Reannounce {},
2161}
2162
2163impl PublicationResponder_Event {
2164    #[allow(irrefutable_let_patterns)]
2165    pub fn into_set_subtypes(self) -> Option<Vec<String>> {
2166        if let PublicationResponder_Event::SetSubtypes { subtypes } = self {
2167            Some((subtypes))
2168        } else {
2169            None
2170        }
2171    }
2172    #[allow(irrefutable_let_patterns)]
2173    pub fn into_reannounce(self) -> Option<()> {
2174        if let PublicationResponder_Event::Reannounce {} = self {
2175            Some(())
2176        } else {
2177            None
2178        }
2179    }
2180
2181    /// Decodes a message buffer as a [`PublicationResponder_Event`].
2182    fn decode(
2183        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2184    ) -> Result<PublicationResponder_Event, fidl::Error> {
2185        let (bytes, _handles) = buf.split_mut();
2186        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2187        debug_assert_eq!(tx_header.tx_id, 0);
2188        match tx_header.ordinal {
2189            0x5593e156370b19df => {
2190                let mut out = fidl::new_empty!(
2191                    PublicationResponderSetSubtypesRequest,
2192                    fidl::encoding::DefaultFuchsiaResourceDialect
2193                );
2194                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublicationResponderSetSubtypesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2195                Ok((PublicationResponder_Event::SetSubtypes { subtypes: out.subtypes }))
2196            }
2197            0x2550cc2a43aa838b => {
2198                let mut out = fidl::new_empty!(
2199                    fidl::encoding::EmptyPayload,
2200                    fidl::encoding::DefaultFuchsiaResourceDialect
2201                );
2202                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
2203                Ok((PublicationResponder_Event::Reannounce {}))
2204            }
2205            _ => Err(fidl::Error::UnknownOrdinal {
2206                ordinal: tx_header.ordinal,
2207                protocol_name:
2208                    <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2209            }),
2210        }
2211    }
2212}
2213
2214/// A Stream of incoming requests for fuchsia.net.mdns/PublicationResponder.
2215pub struct PublicationResponder_RequestStream {
2216    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2217    is_terminated: bool,
2218}
2219
2220impl std::marker::Unpin for PublicationResponder_RequestStream {}
2221
2222impl futures::stream::FusedStream for PublicationResponder_RequestStream {
2223    fn is_terminated(&self) -> bool {
2224        self.is_terminated
2225    }
2226}
2227
2228impl fidl::endpoints::RequestStream for PublicationResponder_RequestStream {
2229    type Protocol = PublicationResponder_Marker;
2230    type ControlHandle = PublicationResponder_ControlHandle;
2231
2232    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2233        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2234    }
2235
2236    fn control_handle(&self) -> Self::ControlHandle {
2237        PublicationResponder_ControlHandle { inner: self.inner.clone() }
2238    }
2239
2240    fn into_inner(
2241        self,
2242    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2243    {
2244        (self.inner, self.is_terminated)
2245    }
2246
2247    fn from_inner(
2248        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2249        is_terminated: bool,
2250    ) -> Self {
2251        Self { inner, is_terminated }
2252    }
2253}
2254
2255impl futures::Stream for PublicationResponder_RequestStream {
2256    type Item = Result<PublicationResponder_Request, fidl::Error>;
2257
2258    fn poll_next(
2259        mut self: std::pin::Pin<&mut Self>,
2260        cx: &mut std::task::Context<'_>,
2261    ) -> std::task::Poll<Option<Self::Item>> {
2262        let this = &mut *self;
2263        if this.inner.check_shutdown(cx) {
2264            this.is_terminated = true;
2265            return std::task::Poll::Ready(None);
2266        }
2267        if this.is_terminated {
2268            panic!("polled PublicationResponder_RequestStream after completion");
2269        }
2270        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2271            |bytes, handles| {
2272                match this.inner.channel().read_etc(cx, bytes, handles) {
2273                    std::task::Poll::Ready(Ok(())) => {}
2274                    std::task::Poll::Pending => return std::task::Poll::Pending,
2275                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2276                        this.is_terminated = true;
2277                        return std::task::Poll::Ready(None);
2278                    }
2279                    std::task::Poll::Ready(Err(e)) => {
2280                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2281                            e.into(),
2282                        ))))
2283                    }
2284                }
2285
2286                // A message has been received from the channel
2287                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2288
2289                std::task::Poll::Ready(Some(match header.ordinal {
2290                0x71d805aee2907d06 => {
2291                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2292                    let mut req = fidl::new_empty!(PublicationResponderOnPublicationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2293                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublicationResponderOnPublicationRequest>(&header, _body_bytes, handles, &mut req)?;
2294                    let control_handle = PublicationResponder_ControlHandle {
2295                        inner: this.inner.clone(),
2296                    };
2297                    Ok(PublicationResponder_Request::OnPublication {publication_cause: req.publication_cause,
2298subtype: req.subtype,
2299source_addresses: req.source_addresses,
2300
2301                        responder: PublicationResponder_OnPublicationResponder {
2302                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2303                            tx_id: header.tx_id,
2304                        },
2305                    })
2306                }
2307                _ => Err(fidl::Error::UnknownOrdinal {
2308                    ordinal: header.ordinal,
2309                    protocol_name: <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2310                }),
2311            }))
2312            },
2313        )
2314    }
2315}
2316
2317/// Client-supplied publication responder interface.
2318#[derive(Debug)]
2319pub enum PublicationResponder_Request {
2320    /// Provides instance information for initial announcements and query
2321    /// responses relating to the service instance specified in
2322    /// `ServiceInstancePublisher.PublishServiceInstance`.  If the publication relates to a
2323    /// subtype of the service, `subtype` contains the subtype, otherwise
2324    /// it is null. If `publication` is null, no announcement or response is
2325    /// transmitted. Strings in `text` are transmitted in the TXT record.
2326    OnPublication {
2327        publication_cause: PublicationCause,
2328        subtype: Option<String>,
2329        source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
2330        responder: PublicationResponder_OnPublicationResponder,
2331    },
2332}
2333
2334impl PublicationResponder_Request {
2335    #[allow(irrefutable_let_patterns)]
2336    pub fn into_on_publication(
2337        self,
2338    ) -> Option<(
2339        PublicationCause,
2340        Option<String>,
2341        Vec<fidl_fuchsia_net::IpAddress>,
2342        PublicationResponder_OnPublicationResponder,
2343    )> {
2344        if let PublicationResponder_Request::OnPublication {
2345            publication_cause,
2346            subtype,
2347            source_addresses,
2348            responder,
2349        } = self
2350        {
2351            Some((publication_cause, subtype, source_addresses, responder))
2352        } else {
2353            None
2354        }
2355    }
2356
2357    /// Name of the method defined in FIDL
2358    pub fn method_name(&self) -> &'static str {
2359        match *self {
2360            PublicationResponder_Request::OnPublication { .. } => "on_publication",
2361        }
2362    }
2363}
2364
2365#[derive(Debug, Clone)]
2366pub struct PublicationResponder_ControlHandle {
2367    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2368}
2369
2370impl fidl::endpoints::ControlHandle for PublicationResponder_ControlHandle {
2371    fn shutdown(&self) {
2372        self.inner.shutdown()
2373    }
2374    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2375        self.inner.shutdown_with_epitaph(status)
2376    }
2377
2378    fn is_closed(&self) -> bool {
2379        self.inner.channel().is_closed()
2380    }
2381    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2382        self.inner.channel().on_closed()
2383    }
2384
2385    #[cfg(target_os = "fuchsia")]
2386    fn signal_peer(
2387        &self,
2388        clear_mask: zx::Signals,
2389        set_mask: zx::Signals,
2390    ) -> Result<(), zx_status::Status> {
2391        use fidl::Peered;
2392        self.inner.channel().signal_peer(clear_mask, set_mask)
2393    }
2394}
2395
2396impl PublicationResponder_ControlHandle {
2397    pub fn send_set_subtypes(&self, mut subtypes: &[String]) -> Result<(), fidl::Error> {
2398        self.inner.send::<PublicationResponderSetSubtypesRequest>(
2399            (subtypes,),
2400            0,
2401            0x5593e156370b19df,
2402            fidl::encoding::DynamicFlags::empty(),
2403        )
2404    }
2405
2406    pub fn send_reannounce(&self) -> Result<(), fidl::Error> {
2407        self.inner.send::<fidl::encoding::EmptyPayload>(
2408            (),
2409            0,
2410            0x2550cc2a43aa838b,
2411            fidl::encoding::DynamicFlags::empty(),
2412        )
2413    }
2414}
2415
2416#[must_use = "FIDL methods require a response to be sent"]
2417#[derive(Debug)]
2418pub struct PublicationResponder_OnPublicationResponder {
2419    control_handle: std::mem::ManuallyDrop<PublicationResponder_ControlHandle>,
2420    tx_id: u32,
2421}
2422
2423/// Set the the channel to be shutdown (see [`PublicationResponder_ControlHandle::shutdown`])
2424/// if the responder is dropped without sending a response, so that the client
2425/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2426impl std::ops::Drop for PublicationResponder_OnPublicationResponder {
2427    fn drop(&mut self) {
2428        self.control_handle.shutdown();
2429        // Safety: drops once, never accessed again
2430        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2431    }
2432}
2433
2434impl fidl::endpoints::Responder for PublicationResponder_OnPublicationResponder {
2435    type ControlHandle = PublicationResponder_ControlHandle;
2436
2437    fn control_handle(&self) -> &PublicationResponder_ControlHandle {
2438        &self.control_handle
2439    }
2440
2441    fn drop_without_shutdown(mut self) {
2442        // Safety: drops once, never accessed again due to mem::forget
2443        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2444        // Prevent Drop from running (which would shut down the channel)
2445        std::mem::forget(self);
2446    }
2447}
2448
2449impl PublicationResponder_OnPublicationResponder {
2450    /// Sends a response to the FIDL transaction.
2451    ///
2452    /// Sets the channel to shutdown if an error occurs.
2453    pub fn send(self, mut publication: Option<&Publication>) -> Result<(), fidl::Error> {
2454        let _result = self.send_raw(publication);
2455        if _result.is_err() {
2456            self.control_handle.shutdown();
2457        }
2458        self.drop_without_shutdown();
2459        _result
2460    }
2461
2462    /// Similar to "send" but does not shutdown the channel if an error occurs.
2463    pub fn send_no_shutdown_on_err(
2464        self,
2465        mut publication: Option<&Publication>,
2466    ) -> Result<(), fidl::Error> {
2467        let _result = self.send_raw(publication);
2468        self.drop_without_shutdown();
2469        _result
2470    }
2471
2472    fn send_raw(&self, mut publication: Option<&Publication>) -> Result<(), fidl::Error> {
2473        self.control_handle.inner.send::<PublicationResponderOnPublicationResponse>(
2474            (publication,),
2475            self.tx_id,
2476            0x71d805aee2907d06,
2477            fidl::encoding::DynamicFlags::empty(),
2478        )
2479    }
2480}
2481
2482#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2483pub struct PublisherMarker;
2484
2485impl fidl::endpoints::ProtocolMarker for PublisherMarker {
2486    type Proxy = PublisherProxy;
2487    type RequestStream = PublisherRequestStream;
2488    #[cfg(target_os = "fuchsia")]
2489    type SynchronousProxy = PublisherSynchronousProxy;
2490
2491    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Publisher";
2492}
2493impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
2494pub type PublisherPublishServiceInstanceResult = Result<(), Error>;
2495
2496pub trait PublisherProxyInterface: Send + Sync {
2497    type PublishServiceInstanceResponseFut: std::future::Future<Output = Result<PublisherPublishServiceInstanceResult, fidl::Error>>
2498        + Send;
2499    fn r#publish_service_instance(
2500        &self,
2501        service: &str,
2502        instance: &str,
2503        media: Media,
2504        perform_probe: bool,
2505        publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2506    ) -> Self::PublishServiceInstanceResponseFut;
2507}
2508#[derive(Debug)]
2509#[cfg(target_os = "fuchsia")]
2510pub struct PublisherSynchronousProxy {
2511    client: fidl::client::sync::Client,
2512}
2513
2514#[cfg(target_os = "fuchsia")]
2515impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
2516    type Proxy = PublisherProxy;
2517    type Protocol = PublisherMarker;
2518
2519    fn from_channel(inner: fidl::Channel) -> Self {
2520        Self::new(inner)
2521    }
2522
2523    fn into_channel(self) -> fidl::Channel {
2524        self.client.into_channel()
2525    }
2526
2527    fn as_channel(&self) -> &fidl::Channel {
2528        self.client.as_channel()
2529    }
2530}
2531
2532#[cfg(target_os = "fuchsia")]
2533impl PublisherSynchronousProxy {
2534    pub fn new(channel: fidl::Channel) -> Self {
2535        let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2536        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2537    }
2538
2539    pub fn into_channel(self) -> fidl::Channel {
2540        self.client.into_channel()
2541    }
2542
2543    /// Waits until an event arrives and returns it. It is safe for other
2544    /// threads to make concurrent requests while waiting for an event.
2545    pub fn wait_for_event(
2546        &self,
2547        deadline: zx::MonotonicInstant,
2548    ) -> Result<PublisherEvent, fidl::Error> {
2549        PublisherEvent::decode(self.client.wait_for_event(deadline)?)
2550    }
2551
2552    /// Publishes a service instance. `publication_responder` is consulted via its
2553    /// `OnPublication` method for initial announcements and to answer queries.
2554    /// The service is published until the `publication_responder` channel closes. In
2555    /// addition to announcements and queries for the service type, all queries
2556    /// for subtypes are answered subject to filtering through the responder.
2557    /// `perform_probe` indicates whether a probe for a conflicting instance
2558    /// should be performed before publishing the instance. This value should
2559    /// be `true` unless the instance name is known to be unique.
2560    ///
2561    /// If a service with the same service and instance names is already published, the
2562    /// old publication will be terminated, and the responder channel for the old
2563    /// publication will be closed.
2564    pub fn r#publish_service_instance(
2565        &self,
2566        mut service: &str,
2567        mut instance: &str,
2568        mut media: Media,
2569        mut perform_probe: bool,
2570        mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2571        ___deadline: zx::MonotonicInstant,
2572    ) -> Result<PublisherPublishServiceInstanceResult, fidl::Error> {
2573        let _response = self.client.send_query::<
2574            PublisherPublishServiceInstanceRequest,
2575            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2576        >(
2577            (service, instance, media, perform_probe, publication_responder,),
2578            0x3712171c42878797,
2579            fidl::encoding::DynamicFlags::empty(),
2580            ___deadline,
2581        )?;
2582        Ok(_response.map(|x| x))
2583    }
2584}
2585
2586#[derive(Debug, Clone)]
2587pub struct PublisherProxy {
2588    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2589}
2590
2591impl fidl::endpoints::Proxy for PublisherProxy {
2592    type Protocol = PublisherMarker;
2593
2594    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2595        Self::new(inner)
2596    }
2597
2598    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2599        self.client.into_channel().map_err(|client| Self { client })
2600    }
2601
2602    fn as_channel(&self) -> &::fidl::AsyncChannel {
2603        self.client.as_channel()
2604    }
2605}
2606
2607impl PublisherProxy {
2608    /// Create a new Proxy for fuchsia.net.mdns/Publisher.
2609    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2610        let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2611        Self { client: fidl::client::Client::new(channel, protocol_name) }
2612    }
2613
2614    /// Get a Stream of events from the remote end of the protocol.
2615    ///
2616    /// # Panics
2617    ///
2618    /// Panics if the event stream was already taken.
2619    pub fn take_event_stream(&self) -> PublisherEventStream {
2620        PublisherEventStream { event_receiver: self.client.take_event_receiver() }
2621    }
2622
2623    /// Publishes a service instance. `publication_responder` is consulted via its
2624    /// `OnPublication` method for initial announcements and to answer queries.
2625    /// The service is published until the `publication_responder` channel closes. In
2626    /// addition to announcements and queries for the service type, all queries
2627    /// for subtypes are answered subject to filtering through the responder.
2628    /// `perform_probe` indicates whether a probe for a conflicting instance
2629    /// should be performed before publishing the instance. This value should
2630    /// be `true` unless the instance name is known to be unique.
2631    ///
2632    /// If a service with the same service and instance names is already published, the
2633    /// old publication will be terminated, and the responder channel for the old
2634    /// publication will be closed.
2635    pub fn r#publish_service_instance(
2636        &self,
2637        mut service: &str,
2638        mut instance: &str,
2639        mut media: Media,
2640        mut perform_probe: bool,
2641        mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2642    ) -> fidl::client::QueryResponseFut<
2643        PublisherPublishServiceInstanceResult,
2644        fidl::encoding::DefaultFuchsiaResourceDialect,
2645    > {
2646        PublisherProxyInterface::r#publish_service_instance(
2647            self,
2648            service,
2649            instance,
2650            media,
2651            perform_probe,
2652            publication_responder,
2653        )
2654    }
2655}
2656
2657impl PublisherProxyInterface for PublisherProxy {
2658    type PublishServiceInstanceResponseFut = fidl::client::QueryResponseFut<
2659        PublisherPublishServiceInstanceResult,
2660        fidl::encoding::DefaultFuchsiaResourceDialect,
2661    >;
2662    fn r#publish_service_instance(
2663        &self,
2664        mut service: &str,
2665        mut instance: &str,
2666        mut media: Media,
2667        mut perform_probe: bool,
2668        mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2669    ) -> Self::PublishServiceInstanceResponseFut {
2670        fn _decode(
2671            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2672        ) -> Result<PublisherPublishServiceInstanceResult, fidl::Error> {
2673            let _response = fidl::client::decode_transaction_body::<
2674                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2675                fidl::encoding::DefaultFuchsiaResourceDialect,
2676                0x3712171c42878797,
2677            >(_buf?)?;
2678            Ok(_response.map(|x| x))
2679        }
2680        self.client.send_query_and_decode::<
2681            PublisherPublishServiceInstanceRequest,
2682            PublisherPublishServiceInstanceResult,
2683        >(
2684            (service, instance, media, perform_probe, publication_responder,),
2685            0x3712171c42878797,
2686            fidl::encoding::DynamicFlags::empty(),
2687            _decode,
2688        )
2689    }
2690}
2691
2692pub struct PublisherEventStream {
2693    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2694}
2695
2696impl std::marker::Unpin for PublisherEventStream {}
2697
2698impl futures::stream::FusedStream for PublisherEventStream {
2699    fn is_terminated(&self) -> bool {
2700        self.event_receiver.is_terminated()
2701    }
2702}
2703
2704impl futures::Stream for PublisherEventStream {
2705    type Item = Result<PublisherEvent, fidl::Error>;
2706
2707    fn poll_next(
2708        mut self: std::pin::Pin<&mut Self>,
2709        cx: &mut std::task::Context<'_>,
2710    ) -> std::task::Poll<Option<Self::Item>> {
2711        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2712            &mut self.event_receiver,
2713            cx
2714        )?) {
2715            Some(buf) => std::task::Poll::Ready(Some(PublisherEvent::decode(buf))),
2716            None => std::task::Poll::Ready(None),
2717        }
2718    }
2719}
2720
2721#[derive(Debug)]
2722pub enum PublisherEvent {}
2723
2724impl PublisherEvent {
2725    /// Decodes a message buffer as a [`PublisherEvent`].
2726    fn decode(
2727        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2728    ) -> Result<PublisherEvent, fidl::Error> {
2729        let (bytes, _handles) = buf.split_mut();
2730        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2731        debug_assert_eq!(tx_header.tx_id, 0);
2732        match tx_header.ordinal {
2733            _ => Err(fidl::Error::UnknownOrdinal {
2734                ordinal: tx_header.ordinal,
2735                protocol_name: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2736            }),
2737        }
2738    }
2739}
2740
2741/// A Stream of incoming requests for fuchsia.net.mdns/Publisher.
2742pub struct PublisherRequestStream {
2743    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2744    is_terminated: bool,
2745}
2746
2747impl std::marker::Unpin for PublisherRequestStream {}
2748
2749impl futures::stream::FusedStream for PublisherRequestStream {
2750    fn is_terminated(&self) -> bool {
2751        self.is_terminated
2752    }
2753}
2754
2755impl fidl::endpoints::RequestStream for PublisherRequestStream {
2756    type Protocol = PublisherMarker;
2757    type ControlHandle = PublisherControlHandle;
2758
2759    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2760        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2761    }
2762
2763    fn control_handle(&self) -> Self::ControlHandle {
2764        PublisherControlHandle { inner: self.inner.clone() }
2765    }
2766
2767    fn into_inner(
2768        self,
2769    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2770    {
2771        (self.inner, self.is_terminated)
2772    }
2773
2774    fn from_inner(
2775        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2776        is_terminated: bool,
2777    ) -> Self {
2778        Self { inner, is_terminated }
2779    }
2780}
2781
2782impl futures::Stream for PublisherRequestStream {
2783    type Item = Result<PublisherRequest, fidl::Error>;
2784
2785    fn poll_next(
2786        mut self: std::pin::Pin<&mut Self>,
2787        cx: &mut std::task::Context<'_>,
2788    ) -> std::task::Poll<Option<Self::Item>> {
2789        let this = &mut *self;
2790        if this.inner.check_shutdown(cx) {
2791            this.is_terminated = true;
2792            return std::task::Poll::Ready(None);
2793        }
2794        if this.is_terminated {
2795            panic!("polled PublisherRequestStream after completion");
2796        }
2797        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2798            |bytes, handles| {
2799                match this.inner.channel().read_etc(cx, bytes, handles) {
2800                    std::task::Poll::Ready(Ok(())) => {}
2801                    std::task::Poll::Pending => return std::task::Poll::Pending,
2802                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2803                        this.is_terminated = true;
2804                        return std::task::Poll::Ready(None);
2805                    }
2806                    std::task::Poll::Ready(Err(e)) => {
2807                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2808                            e.into(),
2809                        ))))
2810                    }
2811                }
2812
2813                // A message has been received from the channel
2814                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2815
2816                std::task::Poll::Ready(Some(match header.ordinal {
2817                    0x3712171c42878797 => {
2818                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2819                        let mut req = fidl::new_empty!(
2820                            PublisherPublishServiceInstanceRequest,
2821                            fidl::encoding::DefaultFuchsiaResourceDialect
2822                        );
2823                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
2824                        let control_handle = PublisherControlHandle { inner: this.inner.clone() };
2825                        Ok(PublisherRequest::PublishServiceInstance {
2826                            service: req.service,
2827                            instance: req.instance,
2828                            media: req.media,
2829                            perform_probe: req.perform_probe,
2830                            publication_responder: req.publication_responder,
2831
2832                            responder: PublisherPublishServiceInstanceResponder {
2833                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2834                                tx_id: header.tx_id,
2835                            },
2836                        })
2837                    }
2838                    _ => Err(fidl::Error::UnknownOrdinal {
2839                        ordinal: header.ordinal,
2840                        protocol_name:
2841                            <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2842                    }),
2843                }))
2844            },
2845        )
2846    }
2847}
2848
2849/// Discoverable protocol for publishing service instances.
2850/// Deprecated: use ServiceInstancePublisher.
2851#[derive(Debug)]
2852pub enum PublisherRequest {
2853    /// Publishes a service instance. `publication_responder` is consulted via its
2854    /// `OnPublication` method for initial announcements and to answer queries.
2855    /// The service is published until the `publication_responder` channel closes. In
2856    /// addition to announcements and queries for the service type, all queries
2857    /// for subtypes are answered subject to filtering through the responder.
2858    /// `perform_probe` indicates whether a probe for a conflicting instance
2859    /// should be performed before publishing the instance. This value should
2860    /// be `true` unless the instance name is known to be unique.
2861    ///
2862    /// If a service with the same service and instance names is already published, the
2863    /// old publication will be terminated, and the responder channel for the old
2864    /// publication will be closed.
2865    PublishServiceInstance {
2866        service: String,
2867        instance: String,
2868        media: Media,
2869        perform_probe: bool,
2870        publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2871        responder: PublisherPublishServiceInstanceResponder,
2872    },
2873}
2874
2875impl PublisherRequest {
2876    #[allow(irrefutable_let_patterns)]
2877    pub fn into_publish_service_instance(
2878        self,
2879    ) -> Option<(
2880        String,
2881        String,
2882        Media,
2883        bool,
2884        fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2885        PublisherPublishServiceInstanceResponder,
2886    )> {
2887        if let PublisherRequest::PublishServiceInstance {
2888            service,
2889            instance,
2890            media,
2891            perform_probe,
2892            publication_responder,
2893            responder,
2894        } = self
2895        {
2896            Some((service, instance, media, perform_probe, publication_responder, responder))
2897        } else {
2898            None
2899        }
2900    }
2901
2902    /// Name of the method defined in FIDL
2903    pub fn method_name(&self) -> &'static str {
2904        match *self {
2905            PublisherRequest::PublishServiceInstance { .. } => "publish_service_instance",
2906        }
2907    }
2908}
2909
2910#[derive(Debug, Clone)]
2911pub struct PublisherControlHandle {
2912    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2913}
2914
2915impl fidl::endpoints::ControlHandle for PublisherControlHandle {
2916    fn shutdown(&self) {
2917        self.inner.shutdown()
2918    }
2919    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2920        self.inner.shutdown_with_epitaph(status)
2921    }
2922
2923    fn is_closed(&self) -> bool {
2924        self.inner.channel().is_closed()
2925    }
2926    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2927        self.inner.channel().on_closed()
2928    }
2929
2930    #[cfg(target_os = "fuchsia")]
2931    fn signal_peer(
2932        &self,
2933        clear_mask: zx::Signals,
2934        set_mask: zx::Signals,
2935    ) -> Result<(), zx_status::Status> {
2936        use fidl::Peered;
2937        self.inner.channel().signal_peer(clear_mask, set_mask)
2938    }
2939}
2940
2941impl PublisherControlHandle {}
2942
2943#[must_use = "FIDL methods require a response to be sent"]
2944#[derive(Debug)]
2945pub struct PublisherPublishServiceInstanceResponder {
2946    control_handle: std::mem::ManuallyDrop<PublisherControlHandle>,
2947    tx_id: u32,
2948}
2949
2950/// Set the the channel to be shutdown (see [`PublisherControlHandle::shutdown`])
2951/// if the responder is dropped without sending a response, so that the client
2952/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2953impl std::ops::Drop for PublisherPublishServiceInstanceResponder {
2954    fn drop(&mut self) {
2955        self.control_handle.shutdown();
2956        // Safety: drops once, never accessed again
2957        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2958    }
2959}
2960
2961impl fidl::endpoints::Responder for PublisherPublishServiceInstanceResponder {
2962    type ControlHandle = PublisherControlHandle;
2963
2964    fn control_handle(&self) -> &PublisherControlHandle {
2965        &self.control_handle
2966    }
2967
2968    fn drop_without_shutdown(mut self) {
2969        // Safety: drops once, never accessed again due to mem::forget
2970        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2971        // Prevent Drop from running (which would shut down the channel)
2972        std::mem::forget(self);
2973    }
2974}
2975
2976impl PublisherPublishServiceInstanceResponder {
2977    /// Sends a response to the FIDL transaction.
2978    ///
2979    /// Sets the channel to shutdown if an error occurs.
2980    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2981        let _result = self.send_raw(result);
2982        if _result.is_err() {
2983            self.control_handle.shutdown();
2984        }
2985        self.drop_without_shutdown();
2986        _result
2987    }
2988
2989    /// Similar to "send" but does not shutdown the channel if an error occurs.
2990    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2991        let _result = self.send_raw(result);
2992        self.drop_without_shutdown();
2993        _result
2994    }
2995
2996    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2997        self.control_handle
2998            .inner
2999            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3000                result,
3001                self.tx_id,
3002                0x3712171c42878797,
3003                fidl::encoding::DynamicFlags::empty(),
3004            )
3005    }
3006}
3007
3008#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3009pub struct ResolverMarker;
3010
3011impl fidl::endpoints::ProtocolMarker for ResolverMarker {
3012    type Proxy = ResolverProxy;
3013    type RequestStream = ResolverRequestStream;
3014    #[cfg(target_os = "fuchsia")]
3015    type SynchronousProxy = ResolverSynchronousProxy;
3016
3017    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Resolver";
3018}
3019impl fidl::endpoints::DiscoverableProtocolMarker for ResolverMarker {}
3020
3021pub trait ResolverProxyInterface: Send + Sync {
3022    type ResolveHostNameResponseFut: std::future::Future<
3023            Output = Result<
3024                (
3025                    Option<Box<fidl_fuchsia_net::Ipv4Address>>,
3026                    Option<Box<fidl_fuchsia_net::Ipv6Address>>,
3027                ),
3028                fidl::Error,
3029            >,
3030        > + Send;
3031    fn r#resolve_host_name(&self, host: &str, timeout: i64) -> Self::ResolveHostNameResponseFut;
3032}
3033#[derive(Debug)]
3034#[cfg(target_os = "fuchsia")]
3035pub struct ResolverSynchronousProxy {
3036    client: fidl::client::sync::Client,
3037}
3038
3039#[cfg(target_os = "fuchsia")]
3040impl fidl::endpoints::SynchronousProxy for ResolverSynchronousProxy {
3041    type Proxy = ResolverProxy;
3042    type Protocol = ResolverMarker;
3043
3044    fn from_channel(inner: fidl::Channel) -> Self {
3045        Self::new(inner)
3046    }
3047
3048    fn into_channel(self) -> fidl::Channel {
3049        self.client.into_channel()
3050    }
3051
3052    fn as_channel(&self) -> &fidl::Channel {
3053        self.client.as_channel()
3054    }
3055}
3056
3057#[cfg(target_os = "fuchsia")]
3058impl ResolverSynchronousProxy {
3059    pub fn new(channel: fidl::Channel) -> Self {
3060        let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3061        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3062    }
3063
3064    pub fn into_channel(self) -> fidl::Channel {
3065        self.client.into_channel()
3066    }
3067
3068    /// Waits until an event arrives and returns it. It is safe for other
3069    /// threads to make concurrent requests while waiting for an event.
3070    pub fn wait_for_event(
3071        &self,
3072        deadline: zx::MonotonicInstant,
3073    ) -> Result<ResolverEvent, fidl::Error> {
3074        ResolverEvent::decode(self.client.wait_for_event(deadline)?)
3075    }
3076
3077    /// Gets the addresses for the specified host. `timeout` specifies how long
3078    /// the service should wait before giving up when waiting for a response to
3079    /// a resolution query. In typical use, a timeout of two or three seconds
3080    /// is recommended.
3081    ///
3082    /// A successful resolution may return one or both addresses. An
3083    /// unsuccessful resolution is indicated when both addresses are null.
3084    pub fn r#resolve_host_name(
3085        &self,
3086        mut host: &str,
3087        mut timeout: i64,
3088        ___deadline: zx::MonotonicInstant,
3089    ) -> Result<
3090        (Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
3091        fidl::Error,
3092    > {
3093        let _response = self
3094            .client
3095            .send_query::<ResolverResolveHostNameRequest, ResolverResolveHostNameResponse>(
3096                (host, timeout),
3097                0x3c8b2b50aad28e4a,
3098                fidl::encoding::DynamicFlags::empty(),
3099                ___deadline,
3100            )?;
3101        Ok((_response.v4_address, _response.v6_address))
3102    }
3103}
3104
3105#[derive(Debug, Clone)]
3106pub struct ResolverProxy {
3107    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3108}
3109
3110impl fidl::endpoints::Proxy for ResolverProxy {
3111    type Protocol = ResolverMarker;
3112
3113    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3114        Self::new(inner)
3115    }
3116
3117    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3118        self.client.into_channel().map_err(|client| Self { client })
3119    }
3120
3121    fn as_channel(&self) -> &::fidl::AsyncChannel {
3122        self.client.as_channel()
3123    }
3124}
3125
3126impl ResolverProxy {
3127    /// Create a new Proxy for fuchsia.net.mdns/Resolver.
3128    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3129        let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3130        Self { client: fidl::client::Client::new(channel, protocol_name) }
3131    }
3132
3133    /// Get a Stream of events from the remote end of the protocol.
3134    ///
3135    /// # Panics
3136    ///
3137    /// Panics if the event stream was already taken.
3138    pub fn take_event_stream(&self) -> ResolverEventStream {
3139        ResolverEventStream { event_receiver: self.client.take_event_receiver() }
3140    }
3141
3142    /// Gets the addresses for the specified host. `timeout` specifies how long
3143    /// the service should wait before giving up when waiting for a response to
3144    /// a resolution query. In typical use, a timeout of two or three seconds
3145    /// is recommended.
3146    ///
3147    /// A successful resolution may return one or both addresses. An
3148    /// unsuccessful resolution is indicated when both addresses are null.
3149    pub fn r#resolve_host_name(
3150        &self,
3151        mut host: &str,
3152        mut timeout: i64,
3153    ) -> fidl::client::QueryResponseFut<
3154        (Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
3155        fidl::encoding::DefaultFuchsiaResourceDialect,
3156    > {
3157        ResolverProxyInterface::r#resolve_host_name(self, host, timeout)
3158    }
3159}
3160
3161impl ResolverProxyInterface for ResolverProxy {
3162    type ResolveHostNameResponseFut = fidl::client::QueryResponseFut<
3163        (Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
3164        fidl::encoding::DefaultFuchsiaResourceDialect,
3165    >;
3166    fn r#resolve_host_name(
3167        &self,
3168        mut host: &str,
3169        mut timeout: i64,
3170    ) -> Self::ResolveHostNameResponseFut {
3171        fn _decode(
3172            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3173        ) -> Result<
3174            (
3175                Option<Box<fidl_fuchsia_net::Ipv4Address>>,
3176                Option<Box<fidl_fuchsia_net::Ipv6Address>>,
3177            ),
3178            fidl::Error,
3179        > {
3180            let _response = fidl::client::decode_transaction_body::<
3181                ResolverResolveHostNameResponse,
3182                fidl::encoding::DefaultFuchsiaResourceDialect,
3183                0x3c8b2b50aad28e4a,
3184            >(_buf?)?;
3185            Ok((_response.v4_address, _response.v6_address))
3186        }
3187        self.client.send_query_and_decode::<ResolverResolveHostNameRequest, (
3188            Option<Box<fidl_fuchsia_net::Ipv4Address>>,
3189            Option<Box<fidl_fuchsia_net::Ipv6Address>>,
3190        )>(
3191            (host, timeout),
3192            0x3c8b2b50aad28e4a,
3193            fidl::encoding::DynamicFlags::empty(),
3194            _decode,
3195        )
3196    }
3197}
3198
3199pub struct ResolverEventStream {
3200    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3201}
3202
3203impl std::marker::Unpin for ResolverEventStream {}
3204
3205impl futures::stream::FusedStream for ResolverEventStream {
3206    fn is_terminated(&self) -> bool {
3207        self.event_receiver.is_terminated()
3208    }
3209}
3210
3211impl futures::Stream for ResolverEventStream {
3212    type Item = Result<ResolverEvent, fidl::Error>;
3213
3214    fn poll_next(
3215        mut self: std::pin::Pin<&mut Self>,
3216        cx: &mut std::task::Context<'_>,
3217    ) -> std::task::Poll<Option<Self::Item>> {
3218        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3219            &mut self.event_receiver,
3220            cx
3221        )?) {
3222            Some(buf) => std::task::Poll::Ready(Some(ResolverEvent::decode(buf))),
3223            None => std::task::Poll::Ready(None),
3224        }
3225    }
3226}
3227
3228#[derive(Debug)]
3229pub enum ResolverEvent {}
3230
3231impl ResolverEvent {
3232    /// Decodes a message buffer as a [`ResolverEvent`].
3233    fn decode(
3234        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3235    ) -> Result<ResolverEvent, fidl::Error> {
3236        let (bytes, _handles) = buf.split_mut();
3237        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3238        debug_assert_eq!(tx_header.tx_id, 0);
3239        match tx_header.ordinal {
3240            _ => Err(fidl::Error::UnknownOrdinal {
3241                ordinal: tx_header.ordinal,
3242                protocol_name: <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3243            }),
3244        }
3245    }
3246}
3247
3248/// A Stream of incoming requests for fuchsia.net.mdns/Resolver.
3249pub struct ResolverRequestStream {
3250    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3251    is_terminated: bool,
3252}
3253
3254impl std::marker::Unpin for ResolverRequestStream {}
3255
3256impl futures::stream::FusedStream for ResolverRequestStream {
3257    fn is_terminated(&self) -> bool {
3258        self.is_terminated
3259    }
3260}
3261
3262impl fidl::endpoints::RequestStream for ResolverRequestStream {
3263    type Protocol = ResolverMarker;
3264    type ControlHandle = ResolverControlHandle;
3265
3266    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3267        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3268    }
3269
3270    fn control_handle(&self) -> Self::ControlHandle {
3271        ResolverControlHandle { inner: self.inner.clone() }
3272    }
3273
3274    fn into_inner(
3275        self,
3276    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3277    {
3278        (self.inner, self.is_terminated)
3279    }
3280
3281    fn from_inner(
3282        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3283        is_terminated: bool,
3284    ) -> Self {
3285        Self { inner, is_terminated }
3286    }
3287}
3288
3289impl futures::Stream for ResolverRequestStream {
3290    type Item = Result<ResolverRequest, fidl::Error>;
3291
3292    fn poll_next(
3293        mut self: std::pin::Pin<&mut Self>,
3294        cx: &mut std::task::Context<'_>,
3295    ) -> std::task::Poll<Option<Self::Item>> {
3296        let this = &mut *self;
3297        if this.inner.check_shutdown(cx) {
3298            this.is_terminated = true;
3299            return std::task::Poll::Ready(None);
3300        }
3301        if this.is_terminated {
3302            panic!("polled ResolverRequestStream after completion");
3303        }
3304        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3305            |bytes, handles| {
3306                match this.inner.channel().read_etc(cx, bytes, handles) {
3307                    std::task::Poll::Ready(Ok(())) => {}
3308                    std::task::Poll::Pending => return std::task::Poll::Pending,
3309                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3310                        this.is_terminated = true;
3311                        return std::task::Poll::Ready(None);
3312                    }
3313                    std::task::Poll::Ready(Err(e)) => {
3314                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3315                            e.into(),
3316                        ))))
3317                    }
3318                }
3319
3320                // A message has been received from the channel
3321                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3322
3323                std::task::Poll::Ready(Some(match header.ordinal {
3324                    0x3c8b2b50aad28e4a => {
3325                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3326                        let mut req = fidl::new_empty!(
3327                            ResolverResolveHostNameRequest,
3328                            fidl::encoding::DefaultFuchsiaResourceDialect
3329                        );
3330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ResolverResolveHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
3331                        let control_handle = ResolverControlHandle { inner: this.inner.clone() };
3332                        Ok(ResolverRequest::ResolveHostName {
3333                            host: req.host,
3334                            timeout: req.timeout,
3335
3336                            responder: ResolverResolveHostNameResponder {
3337                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3338                                tx_id: header.tx_id,
3339                            },
3340                        })
3341                    }
3342                    _ => Err(fidl::Error::UnknownOrdinal {
3343                        ordinal: header.ordinal,
3344                        protocol_name:
3345                            <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3346                    }),
3347                }))
3348            },
3349        )
3350    }
3351}
3352
3353/// Discoverable protocol for resolving host names to IP addresses.
3354/// Deprecated: use HostNameResolver.
3355#[derive(Debug)]
3356pub enum ResolverRequest {
3357    /// Gets the addresses for the specified host. `timeout` specifies how long
3358    /// the service should wait before giving up when waiting for a response to
3359    /// a resolution query. In typical use, a timeout of two or three seconds
3360    /// is recommended.
3361    ///
3362    /// A successful resolution may return one or both addresses. An
3363    /// unsuccessful resolution is indicated when both addresses are null.
3364    ResolveHostName { host: String, timeout: i64, responder: ResolverResolveHostNameResponder },
3365}
3366
3367impl ResolverRequest {
3368    #[allow(irrefutable_let_patterns)]
3369    pub fn into_resolve_host_name(self) -> Option<(String, i64, ResolverResolveHostNameResponder)> {
3370        if let ResolverRequest::ResolveHostName { host, timeout, responder } = self {
3371            Some((host, timeout, responder))
3372        } else {
3373            None
3374        }
3375    }
3376
3377    /// Name of the method defined in FIDL
3378    pub fn method_name(&self) -> &'static str {
3379        match *self {
3380            ResolverRequest::ResolveHostName { .. } => "resolve_host_name",
3381        }
3382    }
3383}
3384
3385#[derive(Debug, Clone)]
3386pub struct ResolverControlHandle {
3387    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3388}
3389
3390impl fidl::endpoints::ControlHandle for ResolverControlHandle {
3391    fn shutdown(&self) {
3392        self.inner.shutdown()
3393    }
3394    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3395        self.inner.shutdown_with_epitaph(status)
3396    }
3397
3398    fn is_closed(&self) -> bool {
3399        self.inner.channel().is_closed()
3400    }
3401    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3402        self.inner.channel().on_closed()
3403    }
3404
3405    #[cfg(target_os = "fuchsia")]
3406    fn signal_peer(
3407        &self,
3408        clear_mask: zx::Signals,
3409        set_mask: zx::Signals,
3410    ) -> Result<(), zx_status::Status> {
3411        use fidl::Peered;
3412        self.inner.channel().signal_peer(clear_mask, set_mask)
3413    }
3414}
3415
3416impl ResolverControlHandle {}
3417
3418#[must_use = "FIDL methods require a response to be sent"]
3419#[derive(Debug)]
3420pub struct ResolverResolveHostNameResponder {
3421    control_handle: std::mem::ManuallyDrop<ResolverControlHandle>,
3422    tx_id: u32,
3423}
3424
3425/// Set the the channel to be shutdown (see [`ResolverControlHandle::shutdown`])
3426/// if the responder is dropped without sending a response, so that the client
3427/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3428impl std::ops::Drop for ResolverResolveHostNameResponder {
3429    fn drop(&mut self) {
3430        self.control_handle.shutdown();
3431        // Safety: drops once, never accessed again
3432        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3433    }
3434}
3435
3436impl fidl::endpoints::Responder for ResolverResolveHostNameResponder {
3437    type ControlHandle = ResolverControlHandle;
3438
3439    fn control_handle(&self) -> &ResolverControlHandle {
3440        &self.control_handle
3441    }
3442
3443    fn drop_without_shutdown(mut self) {
3444        // Safety: drops once, never accessed again due to mem::forget
3445        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3446        // Prevent Drop from running (which would shut down the channel)
3447        std::mem::forget(self);
3448    }
3449}
3450
3451impl ResolverResolveHostNameResponder {
3452    /// Sends a response to the FIDL transaction.
3453    ///
3454    /// Sets the channel to shutdown if an error occurs.
3455    pub fn send(
3456        self,
3457        mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
3458        mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
3459    ) -> Result<(), fidl::Error> {
3460        let _result = self.send_raw(v4_address, v6_address);
3461        if _result.is_err() {
3462            self.control_handle.shutdown();
3463        }
3464        self.drop_without_shutdown();
3465        _result
3466    }
3467
3468    /// Similar to "send" but does not shutdown the channel if an error occurs.
3469    pub fn send_no_shutdown_on_err(
3470        self,
3471        mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
3472        mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
3473    ) -> Result<(), fidl::Error> {
3474        let _result = self.send_raw(v4_address, v6_address);
3475        self.drop_without_shutdown();
3476        _result
3477    }
3478
3479    fn send_raw(
3480        &self,
3481        mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
3482        mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
3483    ) -> Result<(), fidl::Error> {
3484        self.control_handle.inner.send::<ResolverResolveHostNameResponse>(
3485            (v4_address, v6_address),
3486            self.tx_id,
3487            0x3c8b2b50aad28e4a,
3488            fidl::encoding::DynamicFlags::empty(),
3489        )
3490    }
3491}
3492
3493#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3494pub struct ServiceInstancePublicationResponder_Marker;
3495
3496impl fidl::endpoints::ProtocolMarker for ServiceInstancePublicationResponder_Marker {
3497    type Proxy = ServiceInstancePublicationResponder_Proxy;
3498    type RequestStream = ServiceInstancePublicationResponder_RequestStream;
3499    #[cfg(target_os = "fuchsia")]
3500    type SynchronousProxy = ServiceInstancePublicationResponder_SynchronousProxy;
3501
3502    const DEBUG_NAME: &'static str = "(anonymous) ServiceInstancePublicationResponder_";
3503}
3504pub type ServiceInstancePublicationResponderOnPublicationResult =
3505    Result<ServiceInstancePublication, OnPublicationError>;
3506
3507pub trait ServiceInstancePublicationResponder_ProxyInterface: Send + Sync {
3508    type OnPublicationResponseFut: std::future::Future<
3509            Output = Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error>,
3510        > + Send;
3511    fn r#on_publication(
3512        &self,
3513        publication_cause: ServiceInstancePublicationCause,
3514        subtype: Option<&str>,
3515        source_addresses: &[fidl_fuchsia_net::IpAddress],
3516    ) -> Self::OnPublicationResponseFut;
3517}
3518#[derive(Debug)]
3519#[cfg(target_os = "fuchsia")]
3520pub struct ServiceInstancePublicationResponder_SynchronousProxy {
3521    client: fidl::client::sync::Client,
3522}
3523
3524#[cfg(target_os = "fuchsia")]
3525impl fidl::endpoints::SynchronousProxy for ServiceInstancePublicationResponder_SynchronousProxy {
3526    type Proxy = ServiceInstancePublicationResponder_Proxy;
3527    type Protocol = ServiceInstancePublicationResponder_Marker;
3528
3529    fn from_channel(inner: fidl::Channel) -> Self {
3530        Self::new(inner)
3531    }
3532
3533    fn into_channel(self) -> fidl::Channel {
3534        self.client.into_channel()
3535    }
3536
3537    fn as_channel(&self) -> &fidl::Channel {
3538        self.client.as_channel()
3539    }
3540}
3541
3542#[cfg(target_os = "fuchsia")]
3543impl ServiceInstancePublicationResponder_SynchronousProxy {
3544    pub fn new(channel: fidl::Channel) -> Self {
3545        let protocol_name = <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3546        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3547    }
3548
3549    pub fn into_channel(self) -> fidl::Channel {
3550        self.client.into_channel()
3551    }
3552
3553    /// Waits until an event arrives and returns it. It is safe for other
3554    /// threads to make concurrent requests while waiting for an event.
3555    pub fn wait_for_event(
3556        &self,
3557        deadline: zx::MonotonicInstant,
3558    ) -> Result<ServiceInstancePublicationResponder_Event, fidl::Error> {
3559        ServiceInstancePublicationResponder_Event::decode(self.client.wait_for_event(deadline)?)
3560    }
3561
3562    /// Provides instance information for initial announcements and query
3563    /// responses relating to the service instance specified in
3564    /// `ServiceInstancePublisher.PublishServiceInstance`.
3565    ///
3566    /// + request `publication_cause` the action that motivates this publication.
3567    /// + request `subtype` the subtype if the publication relates to a subtype of the service,
3568    ///   otherwise null.
3569    /// + request `source_addresses` addresses from which queries arrived, if applicable.
3570    /// - response `publication` the desired publication. Strings in `publication.text` are sent
3571    ///   in the TXT resource.
3572    /// * error indicates the publication should not be sent.
3573    ///
3574    /// If no publication should be sent, this method should return a `DO_NOT_RESPOND` error.
3575    pub fn r#on_publication(
3576        &self,
3577        mut publication_cause: ServiceInstancePublicationCause,
3578        mut subtype: Option<&str>,
3579        mut source_addresses: &[fidl_fuchsia_net::IpAddress],
3580        ___deadline: zx::MonotonicInstant,
3581    ) -> Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error> {
3582        let _response = self.client.send_query::<
3583            ServiceInstancePublicationResponderOnPublicationRequest,
3584            fidl::encoding::ResultType<ServiceInstancePublicationResponderOnPublicationResponse, OnPublicationError>,
3585        >(
3586            (publication_cause, subtype, source_addresses,),
3587            0x71753d79b12571ca,
3588            fidl::encoding::DynamicFlags::empty(),
3589            ___deadline,
3590        )?;
3591        Ok(_response.map(|x| x.publication))
3592    }
3593}
3594
3595#[derive(Debug, Clone)]
3596pub struct ServiceInstancePublicationResponder_Proxy {
3597    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3598}
3599
3600impl fidl::endpoints::Proxy for ServiceInstancePublicationResponder_Proxy {
3601    type Protocol = ServiceInstancePublicationResponder_Marker;
3602
3603    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3604        Self::new(inner)
3605    }
3606
3607    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3608        self.client.into_channel().map_err(|client| Self { client })
3609    }
3610
3611    fn as_channel(&self) -> &::fidl::AsyncChannel {
3612        self.client.as_channel()
3613    }
3614}
3615
3616impl ServiceInstancePublicationResponder_Proxy {
3617    /// Create a new Proxy for fuchsia.net.mdns/ServiceInstancePublicationResponder.
3618    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3619        let protocol_name = <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3620        Self { client: fidl::client::Client::new(channel, protocol_name) }
3621    }
3622
3623    /// Get a Stream of events from the remote end of the protocol.
3624    ///
3625    /// # Panics
3626    ///
3627    /// Panics if the event stream was already taken.
3628    pub fn take_event_stream(&self) -> ServiceInstancePublicationResponder_EventStream {
3629        ServiceInstancePublicationResponder_EventStream {
3630            event_receiver: self.client.take_event_receiver(),
3631        }
3632    }
3633
3634    /// Provides instance information for initial announcements and query
3635    /// responses relating to the service instance specified in
3636    /// `ServiceInstancePublisher.PublishServiceInstance`.
3637    ///
3638    /// + request `publication_cause` the action that motivates this publication.
3639    /// + request `subtype` the subtype if the publication relates to a subtype of the service,
3640    ///   otherwise null.
3641    /// + request `source_addresses` addresses from which queries arrived, if applicable.
3642    /// - response `publication` the desired publication. Strings in `publication.text` are sent
3643    ///   in the TXT resource.
3644    /// * error indicates the publication should not be sent.
3645    ///
3646    /// If no publication should be sent, this method should return a `DO_NOT_RESPOND` error.
3647    pub fn r#on_publication(
3648        &self,
3649        mut publication_cause: ServiceInstancePublicationCause,
3650        mut subtype: Option<&str>,
3651        mut source_addresses: &[fidl_fuchsia_net::IpAddress],
3652    ) -> fidl::client::QueryResponseFut<
3653        ServiceInstancePublicationResponderOnPublicationResult,
3654        fidl::encoding::DefaultFuchsiaResourceDialect,
3655    > {
3656        ServiceInstancePublicationResponder_ProxyInterface::r#on_publication(
3657            self,
3658            publication_cause,
3659            subtype,
3660            source_addresses,
3661        )
3662    }
3663}
3664
3665impl ServiceInstancePublicationResponder_ProxyInterface
3666    for ServiceInstancePublicationResponder_Proxy
3667{
3668    type OnPublicationResponseFut = fidl::client::QueryResponseFut<
3669        ServiceInstancePublicationResponderOnPublicationResult,
3670        fidl::encoding::DefaultFuchsiaResourceDialect,
3671    >;
3672    fn r#on_publication(
3673        &self,
3674        mut publication_cause: ServiceInstancePublicationCause,
3675        mut subtype: Option<&str>,
3676        mut source_addresses: &[fidl_fuchsia_net::IpAddress],
3677    ) -> Self::OnPublicationResponseFut {
3678        fn _decode(
3679            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3680        ) -> Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error> {
3681            let _response = fidl::client::decode_transaction_body::<
3682                fidl::encoding::ResultType<
3683                    ServiceInstancePublicationResponderOnPublicationResponse,
3684                    OnPublicationError,
3685                >,
3686                fidl::encoding::DefaultFuchsiaResourceDialect,
3687                0x71753d79b12571ca,
3688            >(_buf?)?;
3689            Ok(_response.map(|x| x.publication))
3690        }
3691        self.client.send_query_and_decode::<
3692            ServiceInstancePublicationResponderOnPublicationRequest,
3693            ServiceInstancePublicationResponderOnPublicationResult,
3694        >(
3695            (publication_cause, subtype, source_addresses,),
3696            0x71753d79b12571ca,
3697            fidl::encoding::DynamicFlags::empty(),
3698            _decode,
3699        )
3700    }
3701}
3702
3703pub struct ServiceInstancePublicationResponder_EventStream {
3704    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3705}
3706
3707impl std::marker::Unpin for ServiceInstancePublicationResponder_EventStream {}
3708
3709impl futures::stream::FusedStream for ServiceInstancePublicationResponder_EventStream {
3710    fn is_terminated(&self) -> bool {
3711        self.event_receiver.is_terminated()
3712    }
3713}
3714
3715impl futures::Stream for ServiceInstancePublicationResponder_EventStream {
3716    type Item = Result<ServiceInstancePublicationResponder_Event, fidl::Error>;
3717
3718    fn poll_next(
3719        mut self: std::pin::Pin<&mut Self>,
3720        cx: &mut std::task::Context<'_>,
3721    ) -> std::task::Poll<Option<Self::Item>> {
3722        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3723            &mut self.event_receiver,
3724            cx
3725        )?) {
3726            Some(buf) => {
3727                std::task::Poll::Ready(Some(ServiceInstancePublicationResponder_Event::decode(buf)))
3728            }
3729            None => std::task::Poll::Ready(None),
3730        }
3731    }
3732}
3733
3734#[derive(Debug)]
3735pub enum ServiceInstancePublicationResponder_Event {
3736    SetSubtypes { subtypes: Vec<String> },
3737    Reannounce {},
3738}
3739
3740impl ServiceInstancePublicationResponder_Event {
3741    #[allow(irrefutable_let_patterns)]
3742    pub fn into_set_subtypes(self) -> Option<Vec<String>> {
3743        if let ServiceInstancePublicationResponder_Event::SetSubtypes { subtypes } = self {
3744            Some((subtypes))
3745        } else {
3746            None
3747        }
3748    }
3749    #[allow(irrefutable_let_patterns)]
3750    pub fn into_reannounce(self) -> Option<()> {
3751        if let ServiceInstancePublicationResponder_Event::Reannounce {} = self {
3752            Some(())
3753        } else {
3754            None
3755        }
3756    }
3757
3758    /// Decodes a message buffer as a [`ServiceInstancePublicationResponder_Event`].
3759    fn decode(
3760        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3761    ) -> Result<ServiceInstancePublicationResponder_Event, fidl::Error> {
3762        let (bytes, _handles) = buf.split_mut();
3763        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3764        debug_assert_eq!(tx_header.tx_id, 0);
3765        match tx_header.ordinal {
3766            0x217fed6e404312a9 => {
3767                let mut out = fidl::new_empty!(ServiceInstancePublicationResponderSetSubtypesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3768                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublicationResponderSetSubtypesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3769                Ok((
3770                    ServiceInstancePublicationResponder_Event::SetSubtypes {subtypes: out.subtypes,
3771
3772                    }
3773                ))
3774            }
3775            0x1b48d9ed30dce1a8 => {
3776                let mut out = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3777                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
3778                Ok((
3779                    ServiceInstancePublicationResponder_Event::Reannounce {
3780                    }
3781                ))
3782            }
3783            _ => Err(fidl::Error::UnknownOrdinal {
3784                ordinal: tx_header.ordinal,
3785                protocol_name: <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3786            })
3787        }
3788    }
3789}
3790
3791/// A Stream of incoming requests for fuchsia.net.mdns/ServiceInstancePublicationResponder.
3792pub struct ServiceInstancePublicationResponder_RequestStream {
3793    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3794    is_terminated: bool,
3795}
3796
3797impl std::marker::Unpin for ServiceInstancePublicationResponder_RequestStream {}
3798
3799impl futures::stream::FusedStream for ServiceInstancePublicationResponder_RequestStream {
3800    fn is_terminated(&self) -> bool {
3801        self.is_terminated
3802    }
3803}
3804
3805impl fidl::endpoints::RequestStream for ServiceInstancePublicationResponder_RequestStream {
3806    type Protocol = ServiceInstancePublicationResponder_Marker;
3807    type ControlHandle = ServiceInstancePublicationResponder_ControlHandle;
3808
3809    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3810        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3811    }
3812
3813    fn control_handle(&self) -> Self::ControlHandle {
3814        ServiceInstancePublicationResponder_ControlHandle { inner: self.inner.clone() }
3815    }
3816
3817    fn into_inner(
3818        self,
3819    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3820    {
3821        (self.inner, self.is_terminated)
3822    }
3823
3824    fn from_inner(
3825        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3826        is_terminated: bool,
3827    ) -> Self {
3828        Self { inner, is_terminated }
3829    }
3830}
3831
3832impl futures::Stream for ServiceInstancePublicationResponder_RequestStream {
3833    type Item = Result<ServiceInstancePublicationResponder_Request, fidl::Error>;
3834
3835    fn poll_next(
3836        mut self: std::pin::Pin<&mut Self>,
3837        cx: &mut std::task::Context<'_>,
3838    ) -> std::task::Poll<Option<Self::Item>> {
3839        let this = &mut *self;
3840        if this.inner.check_shutdown(cx) {
3841            this.is_terminated = true;
3842            return std::task::Poll::Ready(None);
3843        }
3844        if this.is_terminated {
3845            panic!("polled ServiceInstancePublicationResponder_RequestStream after completion");
3846        }
3847        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3848            |bytes, handles| {
3849                match this.inner.channel().read_etc(cx, bytes, handles) {
3850                    std::task::Poll::Ready(Ok(())) => {}
3851                    std::task::Poll::Pending => return std::task::Poll::Pending,
3852                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3853                        this.is_terminated = true;
3854                        return std::task::Poll::Ready(None);
3855                    }
3856                    std::task::Poll::Ready(Err(e)) => {
3857                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3858                            e.into(),
3859                        ))))
3860                    }
3861                }
3862
3863                // A message has been received from the channel
3864                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3865
3866                std::task::Poll::Ready(Some(match header.ordinal {
3867                0x71753d79b12571ca => {
3868                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3869                    let mut req = fidl::new_empty!(ServiceInstancePublicationResponderOnPublicationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3870                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublicationResponderOnPublicationRequest>(&header, _body_bytes, handles, &mut req)?;
3871                    let control_handle = ServiceInstancePublicationResponder_ControlHandle {
3872                        inner: this.inner.clone(),
3873                    };
3874                    Ok(ServiceInstancePublicationResponder_Request::OnPublication {publication_cause: req.publication_cause,
3875subtype: req.subtype,
3876source_addresses: req.source_addresses,
3877
3878                        responder: ServiceInstancePublicationResponder_OnPublicationResponder {
3879                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3880                            tx_id: header.tx_id,
3881                        },
3882                    })
3883                }
3884                _ => Err(fidl::Error::UnknownOrdinal {
3885                    ordinal: header.ordinal,
3886                    protocol_name: <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3887                }),
3888            }))
3889            },
3890        )
3891    }
3892}
3893
3894/// Client-supplied publication responder interface.
3895#[derive(Debug)]
3896pub enum ServiceInstancePublicationResponder_Request {
3897    /// Provides instance information for initial announcements and query
3898    /// responses relating to the service instance specified in
3899    /// `ServiceInstancePublisher.PublishServiceInstance`.
3900    ///
3901    /// + request `publication_cause` the action that motivates this publication.
3902    /// + request `subtype` the subtype if the publication relates to a subtype of the service,
3903    ///   otherwise null.
3904    /// + request `source_addresses` addresses from which queries arrived, if applicable.
3905    /// - response `publication` the desired publication. Strings in `publication.text` are sent
3906    ///   in the TXT resource.
3907    /// * error indicates the publication should not be sent.
3908    ///
3909    /// If no publication should be sent, this method should return a `DO_NOT_RESPOND` error.
3910    OnPublication {
3911        publication_cause: ServiceInstancePublicationCause,
3912        subtype: Option<String>,
3913        source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
3914        responder: ServiceInstancePublicationResponder_OnPublicationResponder,
3915    },
3916}
3917
3918impl ServiceInstancePublicationResponder_Request {
3919    #[allow(irrefutable_let_patterns)]
3920    pub fn into_on_publication(
3921        self,
3922    ) -> Option<(
3923        ServiceInstancePublicationCause,
3924        Option<String>,
3925        Vec<fidl_fuchsia_net::IpAddress>,
3926        ServiceInstancePublicationResponder_OnPublicationResponder,
3927    )> {
3928        if let ServiceInstancePublicationResponder_Request::OnPublication {
3929            publication_cause,
3930            subtype,
3931            source_addresses,
3932            responder,
3933        } = self
3934        {
3935            Some((publication_cause, subtype, source_addresses, responder))
3936        } else {
3937            None
3938        }
3939    }
3940
3941    /// Name of the method defined in FIDL
3942    pub fn method_name(&self) -> &'static str {
3943        match *self {
3944            ServiceInstancePublicationResponder_Request::OnPublication { .. } => "on_publication",
3945        }
3946    }
3947}
3948
3949#[derive(Debug, Clone)]
3950pub struct ServiceInstancePublicationResponder_ControlHandle {
3951    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3952}
3953
3954impl fidl::endpoints::ControlHandle for ServiceInstancePublicationResponder_ControlHandle {
3955    fn shutdown(&self) {
3956        self.inner.shutdown()
3957    }
3958    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3959        self.inner.shutdown_with_epitaph(status)
3960    }
3961
3962    fn is_closed(&self) -> bool {
3963        self.inner.channel().is_closed()
3964    }
3965    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3966        self.inner.channel().on_closed()
3967    }
3968
3969    #[cfg(target_os = "fuchsia")]
3970    fn signal_peer(
3971        &self,
3972        clear_mask: zx::Signals,
3973        set_mask: zx::Signals,
3974    ) -> Result<(), zx_status::Status> {
3975        use fidl::Peered;
3976        self.inner.channel().signal_peer(clear_mask, set_mask)
3977    }
3978}
3979
3980impl ServiceInstancePublicationResponder_ControlHandle {
3981    pub fn send_set_subtypes(&self, mut subtypes: &[String]) -> Result<(), fidl::Error> {
3982        self.inner.send::<ServiceInstancePublicationResponderSetSubtypesRequest>(
3983            (subtypes,),
3984            0,
3985            0x217fed6e404312a9,
3986            fidl::encoding::DynamicFlags::empty(),
3987        )
3988    }
3989
3990    pub fn send_reannounce(&self) -> Result<(), fidl::Error> {
3991        self.inner.send::<fidl::encoding::EmptyPayload>(
3992            (),
3993            0,
3994            0x1b48d9ed30dce1a8,
3995            fidl::encoding::DynamicFlags::empty(),
3996        )
3997    }
3998}
3999
4000#[must_use = "FIDL methods require a response to be sent"]
4001#[derive(Debug)]
4002pub struct ServiceInstancePublicationResponder_OnPublicationResponder {
4003    control_handle: std::mem::ManuallyDrop<ServiceInstancePublicationResponder_ControlHandle>,
4004    tx_id: u32,
4005}
4006
4007/// Set the the channel to be shutdown (see [`ServiceInstancePublicationResponder_ControlHandle::shutdown`])
4008/// if the responder is dropped without sending a response, so that the client
4009/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4010impl std::ops::Drop for ServiceInstancePublicationResponder_OnPublicationResponder {
4011    fn drop(&mut self) {
4012        self.control_handle.shutdown();
4013        // Safety: drops once, never accessed again
4014        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4015    }
4016}
4017
4018impl fidl::endpoints::Responder for ServiceInstancePublicationResponder_OnPublicationResponder {
4019    type ControlHandle = ServiceInstancePublicationResponder_ControlHandle;
4020
4021    fn control_handle(&self) -> &ServiceInstancePublicationResponder_ControlHandle {
4022        &self.control_handle
4023    }
4024
4025    fn drop_without_shutdown(mut self) {
4026        // Safety: drops once, never accessed again due to mem::forget
4027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4028        // Prevent Drop from running (which would shut down the channel)
4029        std::mem::forget(self);
4030    }
4031}
4032
4033impl ServiceInstancePublicationResponder_OnPublicationResponder {
4034    /// Sends a response to the FIDL transaction.
4035    ///
4036    /// Sets the channel to shutdown if an error occurs.
4037    pub fn send(
4038        self,
4039        mut result: Result<&ServiceInstancePublication, OnPublicationError>,
4040    ) -> Result<(), fidl::Error> {
4041        let _result = self.send_raw(result);
4042        if _result.is_err() {
4043            self.control_handle.shutdown();
4044        }
4045        self.drop_without_shutdown();
4046        _result
4047    }
4048
4049    /// Similar to "send" but does not shutdown the channel if an error occurs.
4050    pub fn send_no_shutdown_on_err(
4051        self,
4052        mut result: Result<&ServiceInstancePublication, OnPublicationError>,
4053    ) -> Result<(), fidl::Error> {
4054        let _result = self.send_raw(result);
4055        self.drop_without_shutdown();
4056        _result
4057    }
4058
4059    fn send_raw(
4060        &self,
4061        mut result: Result<&ServiceInstancePublication, OnPublicationError>,
4062    ) -> Result<(), fidl::Error> {
4063        self.control_handle.inner.send::<fidl::encoding::ResultType<
4064            ServiceInstancePublicationResponderOnPublicationResponse,
4065            OnPublicationError,
4066        >>(
4067            result.map(|publication| (publication,)),
4068            self.tx_id,
4069            0x71753d79b12571ca,
4070            fidl::encoding::DynamicFlags::empty(),
4071        )
4072    }
4073}
4074
4075#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4076pub struct ServiceInstancePublisherMarker;
4077
4078impl fidl::endpoints::ProtocolMarker for ServiceInstancePublisherMarker {
4079    type Proxy = ServiceInstancePublisherProxy;
4080    type RequestStream = ServiceInstancePublisherRequestStream;
4081    #[cfg(target_os = "fuchsia")]
4082    type SynchronousProxy = ServiceInstancePublisherSynchronousProxy;
4083
4084    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceInstancePublisher";
4085}
4086impl fidl::endpoints::DiscoverableProtocolMarker for ServiceInstancePublisherMarker {}
4087pub type ServiceInstancePublisherPublishServiceInstanceResult =
4088    Result<(), PublishServiceInstanceError>;
4089
4090pub trait ServiceInstancePublisherProxyInterface: Send + Sync {
4091    type PublishServiceInstanceResponseFut: std::future::Future<
4092            Output = Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error>,
4093        > + Send;
4094    fn r#publish_service_instance(
4095        &self,
4096        service: &str,
4097        instance: &str,
4098        options: &ServiceInstancePublicationOptions,
4099        publication_responder: fidl::endpoints::ClientEnd<
4100            ServiceInstancePublicationResponder_Marker,
4101        >,
4102    ) -> Self::PublishServiceInstanceResponseFut;
4103}
4104#[derive(Debug)]
4105#[cfg(target_os = "fuchsia")]
4106pub struct ServiceInstancePublisherSynchronousProxy {
4107    client: fidl::client::sync::Client,
4108}
4109
4110#[cfg(target_os = "fuchsia")]
4111impl fidl::endpoints::SynchronousProxy for ServiceInstancePublisherSynchronousProxy {
4112    type Proxy = ServiceInstancePublisherProxy;
4113    type Protocol = ServiceInstancePublisherMarker;
4114
4115    fn from_channel(inner: fidl::Channel) -> Self {
4116        Self::new(inner)
4117    }
4118
4119    fn into_channel(self) -> fidl::Channel {
4120        self.client.into_channel()
4121    }
4122
4123    fn as_channel(&self) -> &fidl::Channel {
4124        self.client.as_channel()
4125    }
4126}
4127
4128#[cfg(target_os = "fuchsia")]
4129impl ServiceInstancePublisherSynchronousProxy {
4130    pub fn new(channel: fidl::Channel) -> Self {
4131        let protocol_name =
4132            <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4133        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4134    }
4135
4136    pub fn into_channel(self) -> fidl::Channel {
4137        self.client.into_channel()
4138    }
4139
4140    /// Waits until an event arrives and returns it. It is safe for other
4141    /// threads to make concurrent requests while waiting for an event.
4142    pub fn wait_for_event(
4143        &self,
4144        deadline: zx::MonotonicInstant,
4145    ) -> Result<ServiceInstancePublisherEvent, fidl::Error> {
4146        ServiceInstancePublisherEvent::decode(self.client.wait_for_event(deadline)?)
4147    }
4148
4149    /// Publishes a service instance. `publication_responder` is consulted via its
4150    /// `OnPublication` method for initial announcements and to answer queries.
4151    /// The service is published until the `publication_responder` channel closes. In
4152    /// addition to announcements and queries for the service type, all queries
4153    /// for subtypes are answered subject to filtering through the responder.
4154    ///
4155    /// + request `service` name of the type of service to be published. For example, cast uses
4156    ///   '_googlecast._tcp.'.
4157    /// + request `instance` name of the instance to be published. This is often a descriptive name
4158    ///   such as `Office Printer` or a name containing a large random number.
4159    /// + request `options` options to be applied to the publication.
4160    /// + request `publication_responder` client end of the `ServiceInstancePublicationResponder`
4161    ///   channel consulted when formulating service instance announcements and query responses.
4162    /// * error reason the requested operation failed.
4163    ///
4164    /// If a service with the same service and instance names is already published, the
4165    /// old publication will be terminated, and the responder channel for the old
4166    /// publication will be closed.
4167    pub fn r#publish_service_instance(
4168        &self,
4169        mut service: &str,
4170        mut instance: &str,
4171        mut options: &ServiceInstancePublicationOptions,
4172        mut publication_responder: fidl::endpoints::ClientEnd<
4173            ServiceInstancePublicationResponder_Marker,
4174        >,
4175        ___deadline: zx::MonotonicInstant,
4176    ) -> Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error> {
4177        let _response = self.client.send_query::<
4178            ServiceInstancePublisherPublishServiceInstanceRequest,
4179            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishServiceInstanceError>,
4180        >(
4181            (service, instance, options, publication_responder,),
4182            0x25d5fd0912cb5a9e,
4183            fidl::encoding::DynamicFlags::empty(),
4184            ___deadline,
4185        )?;
4186        Ok(_response.map(|x| x))
4187    }
4188}
4189
4190#[derive(Debug, Clone)]
4191pub struct ServiceInstancePublisherProxy {
4192    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4193}
4194
4195impl fidl::endpoints::Proxy for ServiceInstancePublisherProxy {
4196    type Protocol = ServiceInstancePublisherMarker;
4197
4198    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4199        Self::new(inner)
4200    }
4201
4202    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4203        self.client.into_channel().map_err(|client| Self { client })
4204    }
4205
4206    fn as_channel(&self) -> &::fidl::AsyncChannel {
4207        self.client.as_channel()
4208    }
4209}
4210
4211impl ServiceInstancePublisherProxy {
4212    /// Create a new Proxy for fuchsia.net.mdns/ServiceInstancePublisher.
4213    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4214        let protocol_name =
4215            <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4216        Self { client: fidl::client::Client::new(channel, protocol_name) }
4217    }
4218
4219    /// Get a Stream of events from the remote end of the protocol.
4220    ///
4221    /// # Panics
4222    ///
4223    /// Panics if the event stream was already taken.
4224    pub fn take_event_stream(&self) -> ServiceInstancePublisherEventStream {
4225        ServiceInstancePublisherEventStream { event_receiver: self.client.take_event_receiver() }
4226    }
4227
4228    /// Publishes a service instance. `publication_responder` is consulted via its
4229    /// `OnPublication` method for initial announcements and to answer queries.
4230    /// The service is published until the `publication_responder` channel closes. In
4231    /// addition to announcements and queries for the service type, all queries
4232    /// for subtypes are answered subject to filtering through the responder.
4233    ///
4234    /// + request `service` name of the type of service to be published. For example, cast uses
4235    ///   '_googlecast._tcp.'.
4236    /// + request `instance` name of the instance to be published. This is often a descriptive name
4237    ///   such as `Office Printer` or a name containing a large random number.
4238    /// + request `options` options to be applied to the publication.
4239    /// + request `publication_responder` client end of the `ServiceInstancePublicationResponder`
4240    ///   channel consulted when formulating service instance announcements and query responses.
4241    /// * error reason the requested operation failed.
4242    ///
4243    /// If a service with the same service and instance names is already published, the
4244    /// old publication will be terminated, and the responder channel for the old
4245    /// publication will be closed.
4246    pub fn r#publish_service_instance(
4247        &self,
4248        mut service: &str,
4249        mut instance: &str,
4250        mut options: &ServiceInstancePublicationOptions,
4251        mut publication_responder: fidl::endpoints::ClientEnd<
4252            ServiceInstancePublicationResponder_Marker,
4253        >,
4254    ) -> fidl::client::QueryResponseFut<
4255        ServiceInstancePublisherPublishServiceInstanceResult,
4256        fidl::encoding::DefaultFuchsiaResourceDialect,
4257    > {
4258        ServiceInstancePublisherProxyInterface::r#publish_service_instance(
4259            self,
4260            service,
4261            instance,
4262            options,
4263            publication_responder,
4264        )
4265    }
4266}
4267
4268impl ServiceInstancePublisherProxyInterface for ServiceInstancePublisherProxy {
4269    type PublishServiceInstanceResponseFut = fidl::client::QueryResponseFut<
4270        ServiceInstancePublisherPublishServiceInstanceResult,
4271        fidl::encoding::DefaultFuchsiaResourceDialect,
4272    >;
4273    fn r#publish_service_instance(
4274        &self,
4275        mut service: &str,
4276        mut instance: &str,
4277        mut options: &ServiceInstancePublicationOptions,
4278        mut publication_responder: fidl::endpoints::ClientEnd<
4279            ServiceInstancePublicationResponder_Marker,
4280        >,
4281    ) -> Self::PublishServiceInstanceResponseFut {
4282        fn _decode(
4283            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4284        ) -> Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error> {
4285            let _response = fidl::client::decode_transaction_body::<
4286                fidl::encoding::ResultType<
4287                    fidl::encoding::EmptyStruct,
4288                    PublishServiceInstanceError,
4289                >,
4290                fidl::encoding::DefaultFuchsiaResourceDialect,
4291                0x25d5fd0912cb5a9e,
4292            >(_buf?)?;
4293            Ok(_response.map(|x| x))
4294        }
4295        self.client.send_query_and_decode::<
4296            ServiceInstancePublisherPublishServiceInstanceRequest,
4297            ServiceInstancePublisherPublishServiceInstanceResult,
4298        >(
4299            (service, instance, options, publication_responder,),
4300            0x25d5fd0912cb5a9e,
4301            fidl::encoding::DynamicFlags::empty(),
4302            _decode,
4303        )
4304    }
4305}
4306
4307pub struct ServiceInstancePublisherEventStream {
4308    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4309}
4310
4311impl std::marker::Unpin for ServiceInstancePublisherEventStream {}
4312
4313impl futures::stream::FusedStream for ServiceInstancePublisherEventStream {
4314    fn is_terminated(&self) -> bool {
4315        self.event_receiver.is_terminated()
4316    }
4317}
4318
4319impl futures::Stream for ServiceInstancePublisherEventStream {
4320    type Item = Result<ServiceInstancePublisherEvent, fidl::Error>;
4321
4322    fn poll_next(
4323        mut self: std::pin::Pin<&mut Self>,
4324        cx: &mut std::task::Context<'_>,
4325    ) -> std::task::Poll<Option<Self::Item>> {
4326        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4327            &mut self.event_receiver,
4328            cx
4329        )?) {
4330            Some(buf) => std::task::Poll::Ready(Some(ServiceInstancePublisherEvent::decode(buf))),
4331            None => std::task::Poll::Ready(None),
4332        }
4333    }
4334}
4335
4336#[derive(Debug)]
4337pub enum ServiceInstancePublisherEvent {}
4338
4339impl ServiceInstancePublisherEvent {
4340    /// Decodes a message buffer as a [`ServiceInstancePublisherEvent`].
4341    fn decode(
4342        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4343    ) -> Result<ServiceInstancePublisherEvent, fidl::Error> {
4344        let (bytes, _handles) = buf.split_mut();
4345        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4346        debug_assert_eq!(tx_header.tx_id, 0);
4347        match tx_header.ordinal {
4348            _ => Err(fidl::Error::UnknownOrdinal {
4349                ordinal: tx_header.ordinal,
4350                protocol_name:
4351                    <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4352            }),
4353        }
4354    }
4355}
4356
4357/// A Stream of incoming requests for fuchsia.net.mdns/ServiceInstancePublisher.
4358pub struct ServiceInstancePublisherRequestStream {
4359    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4360    is_terminated: bool,
4361}
4362
4363impl std::marker::Unpin for ServiceInstancePublisherRequestStream {}
4364
4365impl futures::stream::FusedStream for ServiceInstancePublisherRequestStream {
4366    fn is_terminated(&self) -> bool {
4367        self.is_terminated
4368    }
4369}
4370
4371impl fidl::endpoints::RequestStream for ServiceInstancePublisherRequestStream {
4372    type Protocol = ServiceInstancePublisherMarker;
4373    type ControlHandle = ServiceInstancePublisherControlHandle;
4374
4375    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4376        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4377    }
4378
4379    fn control_handle(&self) -> Self::ControlHandle {
4380        ServiceInstancePublisherControlHandle { inner: self.inner.clone() }
4381    }
4382
4383    fn into_inner(
4384        self,
4385    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4386    {
4387        (self.inner, self.is_terminated)
4388    }
4389
4390    fn from_inner(
4391        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4392        is_terminated: bool,
4393    ) -> Self {
4394        Self { inner, is_terminated }
4395    }
4396}
4397
4398impl futures::Stream for ServiceInstancePublisherRequestStream {
4399    type Item = Result<ServiceInstancePublisherRequest, fidl::Error>;
4400
4401    fn poll_next(
4402        mut self: std::pin::Pin<&mut Self>,
4403        cx: &mut std::task::Context<'_>,
4404    ) -> std::task::Poll<Option<Self::Item>> {
4405        let this = &mut *self;
4406        if this.inner.check_shutdown(cx) {
4407            this.is_terminated = true;
4408            return std::task::Poll::Ready(None);
4409        }
4410        if this.is_terminated {
4411            panic!("polled ServiceInstancePublisherRequestStream after completion");
4412        }
4413        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4414            |bytes, handles| {
4415                match this.inner.channel().read_etc(cx, bytes, handles) {
4416                    std::task::Poll::Ready(Ok(())) => {}
4417                    std::task::Poll::Pending => return std::task::Poll::Pending,
4418                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4419                        this.is_terminated = true;
4420                        return std::task::Poll::Ready(None);
4421                    }
4422                    std::task::Poll::Ready(Err(e)) => {
4423                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4424                            e.into(),
4425                        ))))
4426                    }
4427                }
4428
4429                // A message has been received from the channel
4430                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4431
4432                std::task::Poll::Ready(Some(match header.ordinal {
4433                0x25d5fd0912cb5a9e => {
4434                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4435                    let mut req = fidl::new_empty!(ServiceInstancePublisherPublishServiceInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4436                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublisherPublishServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
4437                    let control_handle = ServiceInstancePublisherControlHandle {
4438                        inner: this.inner.clone(),
4439                    };
4440                    Ok(ServiceInstancePublisherRequest::PublishServiceInstance {service: req.service,
4441instance: req.instance,
4442options: req.options,
4443publication_responder: req.publication_responder,
4444
4445                        responder: ServiceInstancePublisherPublishServiceInstanceResponder {
4446                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4447                            tx_id: header.tx_id,
4448                        },
4449                    })
4450                }
4451                _ => Err(fidl::Error::UnknownOrdinal {
4452                    ordinal: header.ordinal,
4453                    protocol_name: <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4454                }),
4455            }))
4456            },
4457        )
4458    }
4459}
4460
4461/// Discoverable protocol for publishing service instances.
4462#[derive(Debug)]
4463pub enum ServiceInstancePublisherRequest {
4464    /// Publishes a service instance. `publication_responder` is consulted via its
4465    /// `OnPublication` method for initial announcements and to answer queries.
4466    /// The service is published until the `publication_responder` channel closes. In
4467    /// addition to announcements and queries for the service type, all queries
4468    /// for subtypes are answered subject to filtering through the responder.
4469    ///
4470    /// + request `service` name of the type of service to be published. For example, cast uses
4471    ///   '_googlecast._tcp.'.
4472    /// + request `instance` name of the instance to be published. This is often a descriptive name
4473    ///   such as `Office Printer` or a name containing a large random number.
4474    /// + request `options` options to be applied to the publication.
4475    /// + request `publication_responder` client end of the `ServiceInstancePublicationResponder`
4476    ///   channel consulted when formulating service instance announcements and query responses.
4477    /// * error reason the requested operation failed.
4478    ///
4479    /// If a service with the same service and instance names is already published, the
4480    /// old publication will be terminated, and the responder channel for the old
4481    /// publication will be closed.
4482    PublishServiceInstance {
4483        service: String,
4484        instance: String,
4485        options: ServiceInstancePublicationOptions,
4486        publication_responder:
4487            fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
4488        responder: ServiceInstancePublisherPublishServiceInstanceResponder,
4489    },
4490}
4491
4492impl ServiceInstancePublisherRequest {
4493    #[allow(irrefutable_let_patterns)]
4494    pub fn into_publish_service_instance(
4495        self,
4496    ) -> Option<(
4497        String,
4498        String,
4499        ServiceInstancePublicationOptions,
4500        fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
4501        ServiceInstancePublisherPublishServiceInstanceResponder,
4502    )> {
4503        if let ServiceInstancePublisherRequest::PublishServiceInstance {
4504            service,
4505            instance,
4506            options,
4507            publication_responder,
4508            responder,
4509        } = self
4510        {
4511            Some((service, instance, options, publication_responder, responder))
4512        } else {
4513            None
4514        }
4515    }
4516
4517    /// Name of the method defined in FIDL
4518    pub fn method_name(&self) -> &'static str {
4519        match *self {
4520            ServiceInstancePublisherRequest::PublishServiceInstance { .. } => {
4521                "publish_service_instance"
4522            }
4523        }
4524    }
4525}
4526
4527#[derive(Debug, Clone)]
4528pub struct ServiceInstancePublisherControlHandle {
4529    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4530}
4531
4532impl fidl::endpoints::ControlHandle for ServiceInstancePublisherControlHandle {
4533    fn shutdown(&self) {
4534        self.inner.shutdown()
4535    }
4536    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4537        self.inner.shutdown_with_epitaph(status)
4538    }
4539
4540    fn is_closed(&self) -> bool {
4541        self.inner.channel().is_closed()
4542    }
4543    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4544        self.inner.channel().on_closed()
4545    }
4546
4547    #[cfg(target_os = "fuchsia")]
4548    fn signal_peer(
4549        &self,
4550        clear_mask: zx::Signals,
4551        set_mask: zx::Signals,
4552    ) -> Result<(), zx_status::Status> {
4553        use fidl::Peered;
4554        self.inner.channel().signal_peer(clear_mask, set_mask)
4555    }
4556}
4557
4558impl ServiceInstancePublisherControlHandle {}
4559
4560#[must_use = "FIDL methods require a response to be sent"]
4561#[derive(Debug)]
4562pub struct ServiceInstancePublisherPublishServiceInstanceResponder {
4563    control_handle: std::mem::ManuallyDrop<ServiceInstancePublisherControlHandle>,
4564    tx_id: u32,
4565}
4566
4567/// Set the the channel to be shutdown (see [`ServiceInstancePublisherControlHandle::shutdown`])
4568/// if the responder is dropped without sending a response, so that the client
4569/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4570impl std::ops::Drop for ServiceInstancePublisherPublishServiceInstanceResponder {
4571    fn drop(&mut self) {
4572        self.control_handle.shutdown();
4573        // Safety: drops once, never accessed again
4574        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4575    }
4576}
4577
4578impl fidl::endpoints::Responder for ServiceInstancePublisherPublishServiceInstanceResponder {
4579    type ControlHandle = ServiceInstancePublisherControlHandle;
4580
4581    fn control_handle(&self) -> &ServiceInstancePublisherControlHandle {
4582        &self.control_handle
4583    }
4584
4585    fn drop_without_shutdown(mut self) {
4586        // Safety: drops once, never accessed again due to mem::forget
4587        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4588        // Prevent Drop from running (which would shut down the channel)
4589        std::mem::forget(self);
4590    }
4591}
4592
4593impl ServiceInstancePublisherPublishServiceInstanceResponder {
4594    /// Sends a response to the FIDL transaction.
4595    ///
4596    /// Sets the channel to shutdown if an error occurs.
4597    pub fn send(
4598        self,
4599        mut result: Result<(), PublishServiceInstanceError>,
4600    ) -> Result<(), fidl::Error> {
4601        let _result = self.send_raw(result);
4602        if _result.is_err() {
4603            self.control_handle.shutdown();
4604        }
4605        self.drop_without_shutdown();
4606        _result
4607    }
4608
4609    /// Similar to "send" but does not shutdown the channel if an error occurs.
4610    pub fn send_no_shutdown_on_err(
4611        self,
4612        mut result: Result<(), PublishServiceInstanceError>,
4613    ) -> Result<(), fidl::Error> {
4614        let _result = self.send_raw(result);
4615        self.drop_without_shutdown();
4616        _result
4617    }
4618
4619    fn send_raw(
4620        &self,
4621        mut result: Result<(), PublishServiceInstanceError>,
4622    ) -> Result<(), fidl::Error> {
4623        self.control_handle.inner.send::<fidl::encoding::ResultType<
4624            fidl::encoding::EmptyStruct,
4625            PublishServiceInstanceError,
4626        >>(
4627            result,
4628            self.tx_id,
4629            0x25d5fd0912cb5a9e,
4630            fidl::encoding::DynamicFlags::empty(),
4631        )
4632    }
4633}
4634
4635#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4636pub struct ServiceInstanceResolverMarker;
4637
4638impl fidl::endpoints::ProtocolMarker for ServiceInstanceResolverMarker {
4639    type Proxy = ServiceInstanceResolverProxy;
4640    type RequestStream = ServiceInstanceResolverRequestStream;
4641    #[cfg(target_os = "fuchsia")]
4642    type SynchronousProxy = ServiceInstanceResolverSynchronousProxy;
4643
4644    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceInstanceResolver";
4645}
4646impl fidl::endpoints::DiscoverableProtocolMarker for ServiceInstanceResolverMarker {}
4647
4648pub trait ServiceInstanceResolverProxyInterface: Send + Sync {
4649    type ResolveServiceInstanceResponseFut: std::future::Future<Output = Result<ServiceInstance, fidl::Error>>
4650        + Send;
4651    fn r#resolve_service_instance(
4652        &self,
4653        service: &str,
4654        instance: &str,
4655        timeout: i64,
4656        options: &ServiceInstanceResolutionOptions,
4657    ) -> Self::ResolveServiceInstanceResponseFut;
4658}
4659#[derive(Debug)]
4660#[cfg(target_os = "fuchsia")]
4661pub struct ServiceInstanceResolverSynchronousProxy {
4662    client: fidl::client::sync::Client,
4663}
4664
4665#[cfg(target_os = "fuchsia")]
4666impl fidl::endpoints::SynchronousProxy for ServiceInstanceResolverSynchronousProxy {
4667    type Proxy = ServiceInstanceResolverProxy;
4668    type Protocol = ServiceInstanceResolverMarker;
4669
4670    fn from_channel(inner: fidl::Channel) -> Self {
4671        Self::new(inner)
4672    }
4673
4674    fn into_channel(self) -> fidl::Channel {
4675        self.client.into_channel()
4676    }
4677
4678    fn as_channel(&self) -> &fidl::Channel {
4679        self.client.as_channel()
4680    }
4681}
4682
4683#[cfg(target_os = "fuchsia")]
4684impl ServiceInstanceResolverSynchronousProxy {
4685    pub fn new(channel: fidl::Channel) -> Self {
4686        let protocol_name =
4687            <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4688        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4689    }
4690
4691    pub fn into_channel(self) -> fidl::Channel {
4692        self.client.into_channel()
4693    }
4694
4695    /// Waits until an event arrives and returns it. It is safe for other
4696    /// threads to make concurrent requests while waiting for an event.
4697    pub fn wait_for_event(
4698        &self,
4699        deadline: zx::MonotonicInstant,
4700    ) -> Result<ServiceInstanceResolverEvent, fidl::Error> {
4701        ServiceInstanceResolverEvent::decode(self.client.wait_for_event(deadline)?)
4702    }
4703
4704    /// Resolves a specific service instance by sending an SRV query and returns
4705    /// the endpoints, target and text records.
4706    ///
4707    /// + request `service` name of the type of service to be resolved. For example, cast uses
4708    ///   '_googlecast._tcp.'.
4709    /// + request `instance` name of the instance to be resolved. This is often a descriptive name
4710    ///   such as `Office Printer` or a name containing a large random number.
4711    /// + request `timeout` specifies how long the service should wait before giving up when
4712    ///   waiting for a response to a resolution query.
4713    /// + request `options` options to be applied to the resolution.
4714    ///
4715    /// A successful resolution will return target and at least one endpoint.
4716    /// Unsuccessful resolution occurs when either the service instance doesn't respond or
4717    /// there is no endpoint (IP & port).
4718    pub fn r#resolve_service_instance(
4719        &self,
4720        mut service: &str,
4721        mut instance: &str,
4722        mut timeout: i64,
4723        mut options: &ServiceInstanceResolutionOptions,
4724        ___deadline: zx::MonotonicInstant,
4725    ) -> Result<ServiceInstance, fidl::Error> {
4726        let _response = self.client.send_query::<
4727            ServiceInstanceResolverResolveServiceInstanceRequest,
4728            ServiceInstanceResolverResolveServiceInstanceResponse,
4729        >(
4730            (service, instance, timeout, options,),
4731            0x1a0d0c9fc6f2fd7,
4732            fidl::encoding::DynamicFlags::empty(),
4733            ___deadline,
4734        )?;
4735        Ok(_response.instance)
4736    }
4737}
4738
4739#[derive(Debug, Clone)]
4740pub struct ServiceInstanceResolverProxy {
4741    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4742}
4743
4744impl fidl::endpoints::Proxy for ServiceInstanceResolverProxy {
4745    type Protocol = ServiceInstanceResolverMarker;
4746
4747    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4748        Self::new(inner)
4749    }
4750
4751    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4752        self.client.into_channel().map_err(|client| Self { client })
4753    }
4754
4755    fn as_channel(&self) -> &::fidl::AsyncChannel {
4756        self.client.as_channel()
4757    }
4758}
4759
4760impl ServiceInstanceResolverProxy {
4761    /// Create a new Proxy for fuchsia.net.mdns/ServiceInstanceResolver.
4762    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4763        let protocol_name =
4764            <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4765        Self { client: fidl::client::Client::new(channel, protocol_name) }
4766    }
4767
4768    /// Get a Stream of events from the remote end of the protocol.
4769    ///
4770    /// # Panics
4771    ///
4772    /// Panics if the event stream was already taken.
4773    pub fn take_event_stream(&self) -> ServiceInstanceResolverEventStream {
4774        ServiceInstanceResolverEventStream { event_receiver: self.client.take_event_receiver() }
4775    }
4776
4777    /// Resolves a specific service instance by sending an SRV query and returns
4778    /// the endpoints, target and text records.
4779    ///
4780    /// + request `service` name of the type of service to be resolved. For example, cast uses
4781    ///   '_googlecast._tcp.'.
4782    /// + request `instance` name of the instance to be resolved. This is often a descriptive name
4783    ///   such as `Office Printer` or a name containing a large random number.
4784    /// + request `timeout` specifies how long the service should wait before giving up when
4785    ///   waiting for a response to a resolution query.
4786    /// + request `options` options to be applied to the resolution.
4787    ///
4788    /// A successful resolution will return target and at least one endpoint.
4789    /// Unsuccessful resolution occurs when either the service instance doesn't respond or
4790    /// there is no endpoint (IP & port).
4791    pub fn r#resolve_service_instance(
4792        &self,
4793        mut service: &str,
4794        mut instance: &str,
4795        mut timeout: i64,
4796        mut options: &ServiceInstanceResolutionOptions,
4797    ) -> fidl::client::QueryResponseFut<
4798        ServiceInstance,
4799        fidl::encoding::DefaultFuchsiaResourceDialect,
4800    > {
4801        ServiceInstanceResolverProxyInterface::r#resolve_service_instance(
4802            self, service, instance, timeout, options,
4803        )
4804    }
4805}
4806
4807impl ServiceInstanceResolverProxyInterface for ServiceInstanceResolverProxy {
4808    type ResolveServiceInstanceResponseFut = fidl::client::QueryResponseFut<
4809        ServiceInstance,
4810        fidl::encoding::DefaultFuchsiaResourceDialect,
4811    >;
4812    fn r#resolve_service_instance(
4813        &self,
4814        mut service: &str,
4815        mut instance: &str,
4816        mut timeout: i64,
4817        mut options: &ServiceInstanceResolutionOptions,
4818    ) -> Self::ResolveServiceInstanceResponseFut {
4819        fn _decode(
4820            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4821        ) -> Result<ServiceInstance, fidl::Error> {
4822            let _response = fidl::client::decode_transaction_body::<
4823                ServiceInstanceResolverResolveServiceInstanceResponse,
4824                fidl::encoding::DefaultFuchsiaResourceDialect,
4825                0x1a0d0c9fc6f2fd7,
4826            >(_buf?)?;
4827            Ok(_response.instance)
4828        }
4829        self.client.send_query_and_decode::<
4830            ServiceInstanceResolverResolveServiceInstanceRequest,
4831            ServiceInstance,
4832        >(
4833            (service, instance, timeout, options,),
4834            0x1a0d0c9fc6f2fd7,
4835            fidl::encoding::DynamicFlags::empty(),
4836            _decode,
4837        )
4838    }
4839}
4840
4841pub struct ServiceInstanceResolverEventStream {
4842    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4843}
4844
4845impl std::marker::Unpin for ServiceInstanceResolverEventStream {}
4846
4847impl futures::stream::FusedStream for ServiceInstanceResolverEventStream {
4848    fn is_terminated(&self) -> bool {
4849        self.event_receiver.is_terminated()
4850    }
4851}
4852
4853impl futures::Stream for ServiceInstanceResolverEventStream {
4854    type Item = Result<ServiceInstanceResolverEvent, fidl::Error>;
4855
4856    fn poll_next(
4857        mut self: std::pin::Pin<&mut Self>,
4858        cx: &mut std::task::Context<'_>,
4859    ) -> std::task::Poll<Option<Self::Item>> {
4860        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4861            &mut self.event_receiver,
4862            cx
4863        )?) {
4864            Some(buf) => std::task::Poll::Ready(Some(ServiceInstanceResolverEvent::decode(buf))),
4865            None => std::task::Poll::Ready(None),
4866        }
4867    }
4868}
4869
4870#[derive(Debug)]
4871pub enum ServiceInstanceResolverEvent {}
4872
4873impl ServiceInstanceResolverEvent {
4874    /// Decodes a message buffer as a [`ServiceInstanceResolverEvent`].
4875    fn decode(
4876        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4877    ) -> Result<ServiceInstanceResolverEvent, fidl::Error> {
4878        let (bytes, _handles) = buf.split_mut();
4879        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4880        debug_assert_eq!(tx_header.tx_id, 0);
4881        match tx_header.ordinal {
4882            _ => Err(fidl::Error::UnknownOrdinal {
4883                ordinal: tx_header.ordinal,
4884                protocol_name:
4885                    <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4886            }),
4887        }
4888    }
4889}
4890
4891/// A Stream of incoming requests for fuchsia.net.mdns/ServiceInstanceResolver.
4892pub struct ServiceInstanceResolverRequestStream {
4893    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4894    is_terminated: bool,
4895}
4896
4897impl std::marker::Unpin for ServiceInstanceResolverRequestStream {}
4898
4899impl futures::stream::FusedStream for ServiceInstanceResolverRequestStream {
4900    fn is_terminated(&self) -> bool {
4901        self.is_terminated
4902    }
4903}
4904
4905impl fidl::endpoints::RequestStream for ServiceInstanceResolverRequestStream {
4906    type Protocol = ServiceInstanceResolverMarker;
4907    type ControlHandle = ServiceInstanceResolverControlHandle;
4908
4909    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4910        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4911    }
4912
4913    fn control_handle(&self) -> Self::ControlHandle {
4914        ServiceInstanceResolverControlHandle { inner: self.inner.clone() }
4915    }
4916
4917    fn into_inner(
4918        self,
4919    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4920    {
4921        (self.inner, self.is_terminated)
4922    }
4923
4924    fn from_inner(
4925        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4926        is_terminated: bool,
4927    ) -> Self {
4928        Self { inner, is_terminated }
4929    }
4930}
4931
4932impl futures::Stream for ServiceInstanceResolverRequestStream {
4933    type Item = Result<ServiceInstanceResolverRequest, fidl::Error>;
4934
4935    fn poll_next(
4936        mut self: std::pin::Pin<&mut Self>,
4937        cx: &mut std::task::Context<'_>,
4938    ) -> std::task::Poll<Option<Self::Item>> {
4939        let this = &mut *self;
4940        if this.inner.check_shutdown(cx) {
4941            this.is_terminated = true;
4942            return std::task::Poll::Ready(None);
4943        }
4944        if this.is_terminated {
4945            panic!("polled ServiceInstanceResolverRequestStream after completion");
4946        }
4947        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4948            |bytes, handles| {
4949                match this.inner.channel().read_etc(cx, bytes, handles) {
4950                    std::task::Poll::Ready(Ok(())) => {}
4951                    std::task::Poll::Pending => return std::task::Poll::Pending,
4952                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4953                        this.is_terminated = true;
4954                        return std::task::Poll::Ready(None);
4955                    }
4956                    std::task::Poll::Ready(Err(e)) => {
4957                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4958                            e.into(),
4959                        ))))
4960                    }
4961                }
4962
4963                // A message has been received from the channel
4964                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4965
4966                std::task::Poll::Ready(Some(match header.ordinal {
4967                0x1a0d0c9fc6f2fd7 => {
4968                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4969                    let mut req = fidl::new_empty!(ServiceInstanceResolverResolveServiceInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4970                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstanceResolverResolveServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
4971                    let control_handle = ServiceInstanceResolverControlHandle {
4972                        inner: this.inner.clone(),
4973                    };
4974                    Ok(ServiceInstanceResolverRequest::ResolveServiceInstance {service: req.service,
4975instance: req.instance,
4976timeout: req.timeout,
4977options: req.options,
4978
4979                        responder: ServiceInstanceResolverResolveServiceInstanceResponder {
4980                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4981                            tx_id: header.tx_id,
4982                        },
4983                    })
4984                }
4985                _ => Err(fidl::Error::UnknownOrdinal {
4986                    ordinal: header.ordinal,
4987                    protocol_name: <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4988                }),
4989            }))
4990            },
4991        )
4992    }
4993}
4994
4995/// Discoverable protocol for resolving service instances.
4996#[derive(Debug)]
4997pub enum ServiceInstanceResolverRequest {
4998    /// Resolves a specific service instance by sending an SRV query and returns
4999    /// the endpoints, target and text records.
5000    ///
5001    /// + request `service` name of the type of service to be resolved. For example, cast uses
5002    ///   '_googlecast._tcp.'.
5003    /// + request `instance` name of the instance to be resolved. This is often a descriptive name
5004    ///   such as `Office Printer` or a name containing a large random number.
5005    /// + request `timeout` specifies how long the service should wait before giving up when
5006    ///   waiting for a response to a resolution query.
5007    /// + request `options` options to be applied to the resolution.
5008    ///
5009    /// A successful resolution will return target and at least one endpoint.
5010    /// Unsuccessful resolution occurs when either the service instance doesn't respond or
5011    /// there is no endpoint (IP & port).
5012    ResolveServiceInstance {
5013        service: String,
5014        instance: String,
5015        timeout: i64,
5016        options: ServiceInstanceResolutionOptions,
5017        responder: ServiceInstanceResolverResolveServiceInstanceResponder,
5018    },
5019}
5020
5021impl ServiceInstanceResolverRequest {
5022    #[allow(irrefutable_let_patterns)]
5023    pub fn into_resolve_service_instance(
5024        self,
5025    ) -> Option<(
5026        String,
5027        String,
5028        i64,
5029        ServiceInstanceResolutionOptions,
5030        ServiceInstanceResolverResolveServiceInstanceResponder,
5031    )> {
5032        if let ServiceInstanceResolverRequest::ResolveServiceInstance {
5033            service,
5034            instance,
5035            timeout,
5036            options,
5037            responder,
5038        } = self
5039        {
5040            Some((service, instance, timeout, options, responder))
5041        } else {
5042            None
5043        }
5044    }
5045
5046    /// Name of the method defined in FIDL
5047    pub fn method_name(&self) -> &'static str {
5048        match *self {
5049            ServiceInstanceResolverRequest::ResolveServiceInstance { .. } => {
5050                "resolve_service_instance"
5051            }
5052        }
5053    }
5054}
5055
5056#[derive(Debug, Clone)]
5057pub struct ServiceInstanceResolverControlHandle {
5058    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5059}
5060
5061impl fidl::endpoints::ControlHandle for ServiceInstanceResolverControlHandle {
5062    fn shutdown(&self) {
5063        self.inner.shutdown()
5064    }
5065    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5066        self.inner.shutdown_with_epitaph(status)
5067    }
5068
5069    fn is_closed(&self) -> bool {
5070        self.inner.channel().is_closed()
5071    }
5072    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5073        self.inner.channel().on_closed()
5074    }
5075
5076    #[cfg(target_os = "fuchsia")]
5077    fn signal_peer(
5078        &self,
5079        clear_mask: zx::Signals,
5080        set_mask: zx::Signals,
5081    ) -> Result<(), zx_status::Status> {
5082        use fidl::Peered;
5083        self.inner.channel().signal_peer(clear_mask, set_mask)
5084    }
5085}
5086
5087impl ServiceInstanceResolverControlHandle {}
5088
5089#[must_use = "FIDL methods require a response to be sent"]
5090#[derive(Debug)]
5091pub struct ServiceInstanceResolverResolveServiceInstanceResponder {
5092    control_handle: std::mem::ManuallyDrop<ServiceInstanceResolverControlHandle>,
5093    tx_id: u32,
5094}
5095
5096/// Set the the channel to be shutdown (see [`ServiceInstanceResolverControlHandle::shutdown`])
5097/// if the responder is dropped without sending a response, so that the client
5098/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5099impl std::ops::Drop for ServiceInstanceResolverResolveServiceInstanceResponder {
5100    fn drop(&mut self) {
5101        self.control_handle.shutdown();
5102        // Safety: drops once, never accessed again
5103        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5104    }
5105}
5106
5107impl fidl::endpoints::Responder for ServiceInstanceResolverResolveServiceInstanceResponder {
5108    type ControlHandle = ServiceInstanceResolverControlHandle;
5109
5110    fn control_handle(&self) -> &ServiceInstanceResolverControlHandle {
5111        &self.control_handle
5112    }
5113
5114    fn drop_without_shutdown(mut self) {
5115        // Safety: drops once, never accessed again due to mem::forget
5116        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5117        // Prevent Drop from running (which would shut down the channel)
5118        std::mem::forget(self);
5119    }
5120}
5121
5122impl ServiceInstanceResolverResolveServiceInstanceResponder {
5123    /// Sends a response to the FIDL transaction.
5124    ///
5125    /// Sets the channel to shutdown if an error occurs.
5126    pub fn send(self, mut instance: &ServiceInstance) -> Result<(), fidl::Error> {
5127        let _result = self.send_raw(instance);
5128        if _result.is_err() {
5129            self.control_handle.shutdown();
5130        }
5131        self.drop_without_shutdown();
5132        _result
5133    }
5134
5135    /// Similar to "send" but does not shutdown the channel if an error occurs.
5136    pub fn send_no_shutdown_on_err(
5137        self,
5138        mut instance: &ServiceInstance,
5139    ) -> Result<(), fidl::Error> {
5140        let _result = self.send_raw(instance);
5141        self.drop_without_shutdown();
5142        _result
5143    }
5144
5145    fn send_raw(&self, mut instance: &ServiceInstance) -> Result<(), fidl::Error> {
5146        self.control_handle.inner.send::<ServiceInstanceResolverResolveServiceInstanceResponse>(
5147            (instance,),
5148            self.tx_id,
5149            0x1a0d0c9fc6f2fd7,
5150            fidl::encoding::DynamicFlags::empty(),
5151        )
5152    }
5153}
5154
5155#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5156pub struct ServiceSubscriberMarker;
5157
5158impl fidl::endpoints::ProtocolMarker for ServiceSubscriberMarker {
5159    type Proxy = ServiceSubscriberProxy;
5160    type RequestStream = ServiceSubscriberRequestStream;
5161    #[cfg(target_os = "fuchsia")]
5162    type SynchronousProxy = ServiceSubscriberSynchronousProxy;
5163
5164    const DEBUG_NAME: &'static str = "(anonymous) ServiceSubscriber";
5165}
5166
5167pub trait ServiceSubscriberProxyInterface: Send + Sync {
5168    type OnInstanceDiscoveredResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
5169        + Send;
5170    fn r#on_instance_discovered(
5171        &self,
5172        instance: &ServiceInstance,
5173    ) -> Self::OnInstanceDiscoveredResponseFut;
5174    type OnInstanceChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5175    fn r#on_instance_changed(
5176        &self,
5177        instance: &ServiceInstance,
5178    ) -> Self::OnInstanceChangedResponseFut;
5179    type OnInstanceLostResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5180    fn r#on_instance_lost(&self, service: &str, instance: &str) -> Self::OnInstanceLostResponseFut;
5181    type OnQueryResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5182    fn r#on_query(&self, resource_type: ResourceType) -> Self::OnQueryResponseFut;
5183}
5184#[derive(Debug)]
5185#[cfg(target_os = "fuchsia")]
5186pub struct ServiceSubscriberSynchronousProxy {
5187    client: fidl::client::sync::Client,
5188}
5189
5190#[cfg(target_os = "fuchsia")]
5191impl fidl::endpoints::SynchronousProxy for ServiceSubscriberSynchronousProxy {
5192    type Proxy = ServiceSubscriberProxy;
5193    type Protocol = ServiceSubscriberMarker;
5194
5195    fn from_channel(inner: fidl::Channel) -> Self {
5196        Self::new(inner)
5197    }
5198
5199    fn into_channel(self) -> fidl::Channel {
5200        self.client.into_channel()
5201    }
5202
5203    fn as_channel(&self) -> &fidl::Channel {
5204        self.client.as_channel()
5205    }
5206}
5207
5208#[cfg(target_os = "fuchsia")]
5209impl ServiceSubscriberSynchronousProxy {
5210    pub fn new(channel: fidl::Channel) -> Self {
5211        let protocol_name =
5212            <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5213        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5214    }
5215
5216    pub fn into_channel(self) -> fidl::Channel {
5217        self.client.into_channel()
5218    }
5219
5220    /// Waits until an event arrives and returns it. It is safe for other
5221    /// threads to make concurrent requests while waiting for an event.
5222    pub fn wait_for_event(
5223        &self,
5224        deadline: zx::MonotonicInstant,
5225    ) -> Result<ServiceSubscriberEvent, fidl::Error> {
5226        ServiceSubscriberEvent::decode(self.client.wait_for_event(deadline)?)
5227    }
5228
5229    /// Notifies the subscriber that a service instance has been discovered.
5230    pub fn r#on_instance_discovered(
5231        &self,
5232        mut instance: &ServiceInstance,
5233        ___deadline: zx::MonotonicInstant,
5234    ) -> Result<(), fidl::Error> {
5235        let _response = self.client.send_query::<
5236            ServiceSubscriberOnInstanceDiscoveredRequest,
5237            fidl::encoding::EmptyPayload,
5238        >(
5239            (instance,),
5240            0x74aa039fd81dcab2,
5241            fidl::encoding::DynamicFlags::empty(),
5242            ___deadline,
5243        )?;
5244        Ok(_response)
5245    }
5246
5247    /// Notifies the subscriber that addresses or text for a known service
5248    /// instance have changed.
5249    pub fn r#on_instance_changed(
5250        &self,
5251        mut instance: &ServiceInstance,
5252        ___deadline: zx::MonotonicInstant,
5253    ) -> Result<(), fidl::Error> {
5254        let _response = self
5255            .client
5256            .send_query::<ServiceSubscriberOnInstanceChangedRequest, fidl::encoding::EmptyPayload>(
5257                (instance,),
5258                0x24da258aad929434,
5259                fidl::encoding::DynamicFlags::empty(),
5260                ___deadline,
5261            )?;
5262        Ok(_response)
5263    }
5264
5265    /// Notifies the subscriber that a known service instance has been lost.
5266    pub fn r#on_instance_lost(
5267        &self,
5268        mut service: &str,
5269        mut instance: &str,
5270        ___deadline: zx::MonotonicInstant,
5271    ) -> Result<(), fidl::Error> {
5272        let _response = self
5273            .client
5274            .send_query::<ServiceSubscriberOnInstanceLostRequest, fidl::encoding::EmptyPayload>(
5275                (service, instance),
5276                0x5beddb781791773f,
5277                fidl::encoding::DynamicFlags::empty(),
5278                ___deadline,
5279            )?;
5280        Ok(_response)
5281    }
5282
5283    /// Notifies the subscriber that a PTR query has been sent.
5284    pub fn r#on_query(
5285        &self,
5286        mut resource_type: ResourceType,
5287        ___deadline: zx::MonotonicInstant,
5288    ) -> Result<(), fidl::Error> {
5289        let _response = self
5290            .client
5291            .send_query::<ServiceSubscriberOnQueryRequest, fidl::encoding::EmptyPayload>(
5292                (resource_type,),
5293                0x1d0496189fdb23f5,
5294                fidl::encoding::DynamicFlags::empty(),
5295                ___deadline,
5296            )?;
5297        Ok(_response)
5298    }
5299}
5300
5301#[derive(Debug, Clone)]
5302pub struct ServiceSubscriberProxy {
5303    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5304}
5305
5306impl fidl::endpoints::Proxy for ServiceSubscriberProxy {
5307    type Protocol = ServiceSubscriberMarker;
5308
5309    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5310        Self::new(inner)
5311    }
5312
5313    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5314        self.client.into_channel().map_err(|client| Self { client })
5315    }
5316
5317    fn as_channel(&self) -> &::fidl::AsyncChannel {
5318        self.client.as_channel()
5319    }
5320}
5321
5322impl ServiceSubscriberProxy {
5323    /// Create a new Proxy for fuchsia.net.mdns/ServiceSubscriber.
5324    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5325        let protocol_name =
5326            <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5327        Self { client: fidl::client::Client::new(channel, protocol_name) }
5328    }
5329
5330    /// Get a Stream of events from the remote end of the protocol.
5331    ///
5332    /// # Panics
5333    ///
5334    /// Panics if the event stream was already taken.
5335    pub fn take_event_stream(&self) -> ServiceSubscriberEventStream {
5336        ServiceSubscriberEventStream { event_receiver: self.client.take_event_receiver() }
5337    }
5338
5339    /// Notifies the subscriber that a service instance has been discovered.
5340    pub fn r#on_instance_discovered(
5341        &self,
5342        mut instance: &ServiceInstance,
5343    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5344        ServiceSubscriberProxyInterface::r#on_instance_discovered(self, instance)
5345    }
5346
5347    /// Notifies the subscriber that addresses or text for a known service
5348    /// instance have changed.
5349    pub fn r#on_instance_changed(
5350        &self,
5351        mut instance: &ServiceInstance,
5352    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5353        ServiceSubscriberProxyInterface::r#on_instance_changed(self, instance)
5354    }
5355
5356    /// Notifies the subscriber that a known service instance has been lost.
5357    pub fn r#on_instance_lost(
5358        &self,
5359        mut service: &str,
5360        mut instance: &str,
5361    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5362        ServiceSubscriberProxyInterface::r#on_instance_lost(self, service, instance)
5363    }
5364
5365    /// Notifies the subscriber that a PTR query has been sent.
5366    pub fn r#on_query(
5367        &self,
5368        mut resource_type: ResourceType,
5369    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5370        ServiceSubscriberProxyInterface::r#on_query(self, resource_type)
5371    }
5372}
5373
5374impl ServiceSubscriberProxyInterface for ServiceSubscriberProxy {
5375    type OnInstanceDiscoveredResponseFut =
5376        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5377    fn r#on_instance_discovered(
5378        &self,
5379        mut instance: &ServiceInstance,
5380    ) -> Self::OnInstanceDiscoveredResponseFut {
5381        fn _decode(
5382            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5383        ) -> Result<(), fidl::Error> {
5384            let _response = fidl::client::decode_transaction_body::<
5385                fidl::encoding::EmptyPayload,
5386                fidl::encoding::DefaultFuchsiaResourceDialect,
5387                0x74aa039fd81dcab2,
5388            >(_buf?)?;
5389            Ok(_response)
5390        }
5391        self.client.send_query_and_decode::<ServiceSubscriberOnInstanceDiscoveredRequest, ()>(
5392            (instance,),
5393            0x74aa039fd81dcab2,
5394            fidl::encoding::DynamicFlags::empty(),
5395            _decode,
5396        )
5397    }
5398
5399    type OnInstanceChangedResponseFut =
5400        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5401    fn r#on_instance_changed(
5402        &self,
5403        mut instance: &ServiceInstance,
5404    ) -> Self::OnInstanceChangedResponseFut {
5405        fn _decode(
5406            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5407        ) -> Result<(), fidl::Error> {
5408            let _response = fidl::client::decode_transaction_body::<
5409                fidl::encoding::EmptyPayload,
5410                fidl::encoding::DefaultFuchsiaResourceDialect,
5411                0x24da258aad929434,
5412            >(_buf?)?;
5413            Ok(_response)
5414        }
5415        self.client.send_query_and_decode::<ServiceSubscriberOnInstanceChangedRequest, ()>(
5416            (instance,),
5417            0x24da258aad929434,
5418            fidl::encoding::DynamicFlags::empty(),
5419            _decode,
5420        )
5421    }
5422
5423    type OnInstanceLostResponseFut =
5424        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5425    fn r#on_instance_lost(
5426        &self,
5427        mut service: &str,
5428        mut instance: &str,
5429    ) -> Self::OnInstanceLostResponseFut {
5430        fn _decode(
5431            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5432        ) -> Result<(), fidl::Error> {
5433            let _response = fidl::client::decode_transaction_body::<
5434                fidl::encoding::EmptyPayload,
5435                fidl::encoding::DefaultFuchsiaResourceDialect,
5436                0x5beddb781791773f,
5437            >(_buf?)?;
5438            Ok(_response)
5439        }
5440        self.client.send_query_and_decode::<ServiceSubscriberOnInstanceLostRequest, ()>(
5441            (service, instance),
5442            0x5beddb781791773f,
5443            fidl::encoding::DynamicFlags::empty(),
5444            _decode,
5445        )
5446    }
5447
5448    type OnQueryResponseFut =
5449        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5450    fn r#on_query(&self, mut resource_type: ResourceType) -> Self::OnQueryResponseFut {
5451        fn _decode(
5452            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5453        ) -> Result<(), fidl::Error> {
5454            let _response = fidl::client::decode_transaction_body::<
5455                fidl::encoding::EmptyPayload,
5456                fidl::encoding::DefaultFuchsiaResourceDialect,
5457                0x1d0496189fdb23f5,
5458            >(_buf?)?;
5459            Ok(_response)
5460        }
5461        self.client.send_query_and_decode::<ServiceSubscriberOnQueryRequest, ()>(
5462            (resource_type,),
5463            0x1d0496189fdb23f5,
5464            fidl::encoding::DynamicFlags::empty(),
5465            _decode,
5466        )
5467    }
5468}
5469
5470pub struct ServiceSubscriberEventStream {
5471    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5472}
5473
5474impl std::marker::Unpin for ServiceSubscriberEventStream {}
5475
5476impl futures::stream::FusedStream for ServiceSubscriberEventStream {
5477    fn is_terminated(&self) -> bool {
5478        self.event_receiver.is_terminated()
5479    }
5480}
5481
5482impl futures::Stream for ServiceSubscriberEventStream {
5483    type Item = Result<ServiceSubscriberEvent, fidl::Error>;
5484
5485    fn poll_next(
5486        mut self: std::pin::Pin<&mut Self>,
5487        cx: &mut std::task::Context<'_>,
5488    ) -> std::task::Poll<Option<Self::Item>> {
5489        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5490            &mut self.event_receiver,
5491            cx
5492        )?) {
5493            Some(buf) => std::task::Poll::Ready(Some(ServiceSubscriberEvent::decode(buf))),
5494            None => std::task::Poll::Ready(None),
5495        }
5496    }
5497}
5498
5499#[derive(Debug)]
5500pub enum ServiceSubscriberEvent {}
5501
5502impl ServiceSubscriberEvent {
5503    /// Decodes a message buffer as a [`ServiceSubscriberEvent`].
5504    fn decode(
5505        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5506    ) -> Result<ServiceSubscriberEvent, fidl::Error> {
5507        let (bytes, _handles) = buf.split_mut();
5508        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5509        debug_assert_eq!(tx_header.tx_id, 0);
5510        match tx_header.ordinal {
5511            _ => Err(fidl::Error::UnknownOrdinal {
5512                ordinal: tx_header.ordinal,
5513                protocol_name:
5514                    <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5515            }),
5516        }
5517    }
5518}
5519
5520/// A Stream of incoming requests for fuchsia.net.mdns/ServiceSubscriber.
5521pub struct ServiceSubscriberRequestStream {
5522    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5523    is_terminated: bool,
5524}
5525
5526impl std::marker::Unpin for ServiceSubscriberRequestStream {}
5527
5528impl futures::stream::FusedStream for ServiceSubscriberRequestStream {
5529    fn is_terminated(&self) -> bool {
5530        self.is_terminated
5531    }
5532}
5533
5534impl fidl::endpoints::RequestStream for ServiceSubscriberRequestStream {
5535    type Protocol = ServiceSubscriberMarker;
5536    type ControlHandle = ServiceSubscriberControlHandle;
5537
5538    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5539        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5540    }
5541
5542    fn control_handle(&self) -> Self::ControlHandle {
5543        ServiceSubscriberControlHandle { inner: self.inner.clone() }
5544    }
5545
5546    fn into_inner(
5547        self,
5548    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5549    {
5550        (self.inner, self.is_terminated)
5551    }
5552
5553    fn from_inner(
5554        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5555        is_terminated: bool,
5556    ) -> Self {
5557        Self { inner, is_terminated }
5558    }
5559}
5560
5561impl futures::Stream for ServiceSubscriberRequestStream {
5562    type Item = Result<ServiceSubscriberRequest, fidl::Error>;
5563
5564    fn poll_next(
5565        mut self: std::pin::Pin<&mut Self>,
5566        cx: &mut std::task::Context<'_>,
5567    ) -> std::task::Poll<Option<Self::Item>> {
5568        let this = &mut *self;
5569        if this.inner.check_shutdown(cx) {
5570            this.is_terminated = true;
5571            return std::task::Poll::Ready(None);
5572        }
5573        if this.is_terminated {
5574            panic!("polled ServiceSubscriberRequestStream after completion");
5575        }
5576        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5577            |bytes, handles| {
5578                match this.inner.channel().read_etc(cx, bytes, handles) {
5579                    std::task::Poll::Ready(Ok(())) => {}
5580                    std::task::Poll::Pending => return std::task::Poll::Pending,
5581                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5582                        this.is_terminated = true;
5583                        return std::task::Poll::Ready(None);
5584                    }
5585                    std::task::Poll::Ready(Err(e)) => {
5586                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5587                            e.into(),
5588                        ))))
5589                    }
5590                }
5591
5592                // A message has been received from the channel
5593                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5594
5595                std::task::Poll::Ready(Some(match header.ordinal {
5596                    0x74aa039fd81dcab2 => {
5597                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5598                        let mut req = fidl::new_empty!(
5599                            ServiceSubscriberOnInstanceDiscoveredRequest,
5600                            fidl::encoding::DefaultFuchsiaResourceDialect
5601                        );
5602                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceDiscoveredRequest>(&header, _body_bytes, handles, &mut req)?;
5603                        let control_handle =
5604                            ServiceSubscriberControlHandle { inner: this.inner.clone() };
5605                        Ok(ServiceSubscriberRequest::OnInstanceDiscovered {
5606                            instance: req.instance,
5607
5608                            responder: ServiceSubscriberOnInstanceDiscoveredResponder {
5609                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5610                                tx_id: header.tx_id,
5611                            },
5612                        })
5613                    }
5614                    0x24da258aad929434 => {
5615                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5616                        let mut req = fidl::new_empty!(
5617                            ServiceSubscriberOnInstanceChangedRequest,
5618                            fidl::encoding::DefaultFuchsiaResourceDialect
5619                        );
5620                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceChangedRequest>(&header, _body_bytes, handles, &mut req)?;
5621                        let control_handle =
5622                            ServiceSubscriberControlHandle { inner: this.inner.clone() };
5623                        Ok(ServiceSubscriberRequest::OnInstanceChanged {
5624                            instance: req.instance,
5625
5626                            responder: ServiceSubscriberOnInstanceChangedResponder {
5627                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5628                                tx_id: header.tx_id,
5629                            },
5630                        })
5631                    }
5632                    0x5beddb781791773f => {
5633                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5634                        let mut req = fidl::new_empty!(
5635                            ServiceSubscriberOnInstanceLostRequest,
5636                            fidl::encoding::DefaultFuchsiaResourceDialect
5637                        );
5638                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceLostRequest>(&header, _body_bytes, handles, &mut req)?;
5639                        let control_handle =
5640                            ServiceSubscriberControlHandle { inner: this.inner.clone() };
5641                        Ok(ServiceSubscriberRequest::OnInstanceLost {
5642                            service: req.service,
5643                            instance: req.instance,
5644
5645                            responder: ServiceSubscriberOnInstanceLostResponder {
5646                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5647                                tx_id: header.tx_id,
5648                            },
5649                        })
5650                    }
5651                    0x1d0496189fdb23f5 => {
5652                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5653                        let mut req = fidl::new_empty!(
5654                            ServiceSubscriberOnQueryRequest,
5655                            fidl::encoding::DefaultFuchsiaResourceDialect
5656                        );
5657                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnQueryRequest>(&header, _body_bytes, handles, &mut req)?;
5658                        let control_handle =
5659                            ServiceSubscriberControlHandle { inner: this.inner.clone() };
5660                        Ok(ServiceSubscriberRequest::OnQuery {
5661                            resource_type: req.resource_type,
5662
5663                            responder: ServiceSubscriberOnQueryResponder {
5664                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5665                                tx_id: header.tx_id,
5666                            },
5667                        })
5668                    }
5669                    _ => Err(fidl::Error::UnknownOrdinal {
5670                        ordinal: header.ordinal,
5671                        protocol_name:
5672                            <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5673                    }),
5674                }))
5675            },
5676        )
5677    }
5678}
5679
5680/// Client-implemented interface for subscribers. Method replies are used to
5681/// throttle traffic. The service won't necessarily wait for a reply before
5682/// calling another method.
5683#[derive(Debug)]
5684pub enum ServiceSubscriberRequest {
5685    /// Notifies the subscriber that a service instance has been discovered.
5686    OnInstanceDiscovered {
5687        instance: ServiceInstance,
5688        responder: ServiceSubscriberOnInstanceDiscoveredResponder,
5689    },
5690    /// Notifies the subscriber that addresses or text for a known service
5691    /// instance have changed.
5692    OnInstanceChanged {
5693        instance: ServiceInstance,
5694        responder: ServiceSubscriberOnInstanceChangedResponder,
5695    },
5696    /// Notifies the subscriber that a known service instance has been lost.
5697    OnInstanceLost {
5698        service: String,
5699        instance: String,
5700        responder: ServiceSubscriberOnInstanceLostResponder,
5701    },
5702    /// Notifies the subscriber that a PTR query has been sent.
5703    OnQuery { resource_type: ResourceType, responder: ServiceSubscriberOnQueryResponder },
5704}
5705
5706impl ServiceSubscriberRequest {
5707    #[allow(irrefutable_let_patterns)]
5708    pub fn into_on_instance_discovered(
5709        self,
5710    ) -> Option<(ServiceInstance, ServiceSubscriberOnInstanceDiscoveredResponder)> {
5711        if let ServiceSubscriberRequest::OnInstanceDiscovered { instance, responder } = self {
5712            Some((instance, responder))
5713        } else {
5714            None
5715        }
5716    }
5717
5718    #[allow(irrefutable_let_patterns)]
5719    pub fn into_on_instance_changed(
5720        self,
5721    ) -> Option<(ServiceInstance, ServiceSubscriberOnInstanceChangedResponder)> {
5722        if let ServiceSubscriberRequest::OnInstanceChanged { instance, responder } = self {
5723            Some((instance, responder))
5724        } else {
5725            None
5726        }
5727    }
5728
5729    #[allow(irrefutable_let_patterns)]
5730    pub fn into_on_instance_lost(
5731        self,
5732    ) -> Option<(String, String, ServiceSubscriberOnInstanceLostResponder)> {
5733        if let ServiceSubscriberRequest::OnInstanceLost { service, instance, responder } = self {
5734            Some((service, instance, responder))
5735        } else {
5736            None
5737        }
5738    }
5739
5740    #[allow(irrefutable_let_patterns)]
5741    pub fn into_on_query(self) -> Option<(ResourceType, ServiceSubscriberOnQueryResponder)> {
5742        if let ServiceSubscriberRequest::OnQuery { resource_type, responder } = self {
5743            Some((resource_type, responder))
5744        } else {
5745            None
5746        }
5747    }
5748
5749    /// Name of the method defined in FIDL
5750    pub fn method_name(&self) -> &'static str {
5751        match *self {
5752            ServiceSubscriberRequest::OnInstanceDiscovered { .. } => "on_instance_discovered",
5753            ServiceSubscriberRequest::OnInstanceChanged { .. } => "on_instance_changed",
5754            ServiceSubscriberRequest::OnInstanceLost { .. } => "on_instance_lost",
5755            ServiceSubscriberRequest::OnQuery { .. } => "on_query",
5756        }
5757    }
5758}
5759
5760#[derive(Debug, Clone)]
5761pub struct ServiceSubscriberControlHandle {
5762    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5763}
5764
5765impl fidl::endpoints::ControlHandle for ServiceSubscriberControlHandle {
5766    fn shutdown(&self) {
5767        self.inner.shutdown()
5768    }
5769    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5770        self.inner.shutdown_with_epitaph(status)
5771    }
5772
5773    fn is_closed(&self) -> bool {
5774        self.inner.channel().is_closed()
5775    }
5776    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5777        self.inner.channel().on_closed()
5778    }
5779
5780    #[cfg(target_os = "fuchsia")]
5781    fn signal_peer(
5782        &self,
5783        clear_mask: zx::Signals,
5784        set_mask: zx::Signals,
5785    ) -> Result<(), zx_status::Status> {
5786        use fidl::Peered;
5787        self.inner.channel().signal_peer(clear_mask, set_mask)
5788    }
5789}
5790
5791impl ServiceSubscriberControlHandle {}
5792
5793#[must_use = "FIDL methods require a response to be sent"]
5794#[derive(Debug)]
5795pub struct ServiceSubscriberOnInstanceDiscoveredResponder {
5796    control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
5797    tx_id: u32,
5798}
5799
5800/// Set the the channel to be shutdown (see [`ServiceSubscriberControlHandle::shutdown`])
5801/// if the responder is dropped without sending a response, so that the client
5802/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5803impl std::ops::Drop for ServiceSubscriberOnInstanceDiscoveredResponder {
5804    fn drop(&mut self) {
5805        self.control_handle.shutdown();
5806        // Safety: drops once, never accessed again
5807        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5808    }
5809}
5810
5811impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceDiscoveredResponder {
5812    type ControlHandle = ServiceSubscriberControlHandle;
5813
5814    fn control_handle(&self) -> &ServiceSubscriberControlHandle {
5815        &self.control_handle
5816    }
5817
5818    fn drop_without_shutdown(mut self) {
5819        // Safety: drops once, never accessed again due to mem::forget
5820        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5821        // Prevent Drop from running (which would shut down the channel)
5822        std::mem::forget(self);
5823    }
5824}
5825
5826impl ServiceSubscriberOnInstanceDiscoveredResponder {
5827    /// Sends a response to the FIDL transaction.
5828    ///
5829    /// Sets the channel to shutdown if an error occurs.
5830    pub fn send(self) -> Result<(), fidl::Error> {
5831        let _result = self.send_raw();
5832        if _result.is_err() {
5833            self.control_handle.shutdown();
5834        }
5835        self.drop_without_shutdown();
5836        _result
5837    }
5838
5839    /// Similar to "send" but does not shutdown the channel if an error occurs.
5840    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5841        let _result = self.send_raw();
5842        self.drop_without_shutdown();
5843        _result
5844    }
5845
5846    fn send_raw(&self) -> Result<(), fidl::Error> {
5847        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5848            (),
5849            self.tx_id,
5850            0x74aa039fd81dcab2,
5851            fidl::encoding::DynamicFlags::empty(),
5852        )
5853    }
5854}
5855
5856#[must_use = "FIDL methods require a response to be sent"]
5857#[derive(Debug)]
5858pub struct ServiceSubscriberOnInstanceChangedResponder {
5859    control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
5860    tx_id: u32,
5861}
5862
5863/// Set the the channel to be shutdown (see [`ServiceSubscriberControlHandle::shutdown`])
5864/// if the responder is dropped without sending a response, so that the client
5865/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5866impl std::ops::Drop for ServiceSubscriberOnInstanceChangedResponder {
5867    fn drop(&mut self) {
5868        self.control_handle.shutdown();
5869        // Safety: drops once, never accessed again
5870        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5871    }
5872}
5873
5874impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceChangedResponder {
5875    type ControlHandle = ServiceSubscriberControlHandle;
5876
5877    fn control_handle(&self) -> &ServiceSubscriberControlHandle {
5878        &self.control_handle
5879    }
5880
5881    fn drop_without_shutdown(mut self) {
5882        // Safety: drops once, never accessed again due to mem::forget
5883        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5884        // Prevent Drop from running (which would shut down the channel)
5885        std::mem::forget(self);
5886    }
5887}
5888
5889impl ServiceSubscriberOnInstanceChangedResponder {
5890    /// Sends a response to the FIDL transaction.
5891    ///
5892    /// Sets the channel to shutdown if an error occurs.
5893    pub fn send(self) -> Result<(), fidl::Error> {
5894        let _result = self.send_raw();
5895        if _result.is_err() {
5896            self.control_handle.shutdown();
5897        }
5898        self.drop_without_shutdown();
5899        _result
5900    }
5901
5902    /// Similar to "send" but does not shutdown the channel if an error occurs.
5903    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5904        let _result = self.send_raw();
5905        self.drop_without_shutdown();
5906        _result
5907    }
5908
5909    fn send_raw(&self) -> Result<(), fidl::Error> {
5910        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5911            (),
5912            self.tx_id,
5913            0x24da258aad929434,
5914            fidl::encoding::DynamicFlags::empty(),
5915        )
5916    }
5917}
5918
5919#[must_use = "FIDL methods require a response to be sent"]
5920#[derive(Debug)]
5921pub struct ServiceSubscriberOnInstanceLostResponder {
5922    control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
5923    tx_id: u32,
5924}
5925
5926/// Set the the channel to be shutdown (see [`ServiceSubscriberControlHandle::shutdown`])
5927/// if the responder is dropped without sending a response, so that the client
5928/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5929impl std::ops::Drop for ServiceSubscriberOnInstanceLostResponder {
5930    fn drop(&mut self) {
5931        self.control_handle.shutdown();
5932        // Safety: drops once, never accessed again
5933        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5934    }
5935}
5936
5937impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceLostResponder {
5938    type ControlHandle = ServiceSubscriberControlHandle;
5939
5940    fn control_handle(&self) -> &ServiceSubscriberControlHandle {
5941        &self.control_handle
5942    }
5943
5944    fn drop_without_shutdown(mut self) {
5945        // Safety: drops once, never accessed again due to mem::forget
5946        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5947        // Prevent Drop from running (which would shut down the channel)
5948        std::mem::forget(self);
5949    }
5950}
5951
5952impl ServiceSubscriberOnInstanceLostResponder {
5953    /// Sends a response to the FIDL transaction.
5954    ///
5955    /// Sets the channel to shutdown if an error occurs.
5956    pub fn send(self) -> Result<(), fidl::Error> {
5957        let _result = self.send_raw();
5958        if _result.is_err() {
5959            self.control_handle.shutdown();
5960        }
5961        self.drop_without_shutdown();
5962        _result
5963    }
5964
5965    /// Similar to "send" but does not shutdown the channel if an error occurs.
5966    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5967        let _result = self.send_raw();
5968        self.drop_without_shutdown();
5969        _result
5970    }
5971
5972    fn send_raw(&self) -> Result<(), fidl::Error> {
5973        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5974            (),
5975            self.tx_id,
5976            0x5beddb781791773f,
5977            fidl::encoding::DynamicFlags::empty(),
5978        )
5979    }
5980}
5981
5982#[must_use = "FIDL methods require a response to be sent"]
5983#[derive(Debug)]
5984pub struct ServiceSubscriberOnQueryResponder {
5985    control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
5986    tx_id: u32,
5987}
5988
5989/// Set the the channel to be shutdown (see [`ServiceSubscriberControlHandle::shutdown`])
5990/// if the responder is dropped without sending a response, so that the client
5991/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5992impl std::ops::Drop for ServiceSubscriberOnQueryResponder {
5993    fn drop(&mut self) {
5994        self.control_handle.shutdown();
5995        // Safety: drops once, never accessed again
5996        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5997    }
5998}
5999
6000impl fidl::endpoints::Responder for ServiceSubscriberOnQueryResponder {
6001    type ControlHandle = ServiceSubscriberControlHandle;
6002
6003    fn control_handle(&self) -> &ServiceSubscriberControlHandle {
6004        &self.control_handle
6005    }
6006
6007    fn drop_without_shutdown(mut self) {
6008        // Safety: drops once, never accessed again due to mem::forget
6009        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6010        // Prevent Drop from running (which would shut down the channel)
6011        std::mem::forget(self);
6012    }
6013}
6014
6015impl ServiceSubscriberOnQueryResponder {
6016    /// Sends a response to the FIDL transaction.
6017    ///
6018    /// Sets the channel to shutdown if an error occurs.
6019    pub fn send(self) -> Result<(), fidl::Error> {
6020        let _result = self.send_raw();
6021        if _result.is_err() {
6022            self.control_handle.shutdown();
6023        }
6024        self.drop_without_shutdown();
6025        _result
6026    }
6027
6028    /// Similar to "send" but does not shutdown the channel if an error occurs.
6029    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6030        let _result = self.send_raw();
6031        self.drop_without_shutdown();
6032        _result
6033    }
6034
6035    fn send_raw(&self) -> Result<(), fidl::Error> {
6036        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6037            (),
6038            self.tx_id,
6039            0x1d0496189fdb23f5,
6040            fidl::encoding::DynamicFlags::empty(),
6041        )
6042    }
6043}
6044
6045#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6046pub struct ServiceSubscriber2Marker;
6047
6048impl fidl::endpoints::ProtocolMarker for ServiceSubscriber2Marker {
6049    type Proxy = ServiceSubscriber2Proxy;
6050    type RequestStream = ServiceSubscriber2RequestStream;
6051    #[cfg(target_os = "fuchsia")]
6052    type SynchronousProxy = ServiceSubscriber2SynchronousProxy;
6053
6054    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceSubscriber2";
6055}
6056impl fidl::endpoints::DiscoverableProtocolMarker for ServiceSubscriber2Marker {}
6057
6058pub trait ServiceSubscriber2ProxyInterface: Send + Sync {
6059    fn r#subscribe_to_service(
6060        &self,
6061        service: &str,
6062        options: &ServiceSubscriptionOptions,
6063        listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6064    ) -> Result<(), fidl::Error>;
6065    fn r#subscribe_to_all_services(
6066        &self,
6067        options: &ServiceSubscriptionOptions,
6068        listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6069    ) -> Result<(), fidl::Error>;
6070}
6071#[derive(Debug)]
6072#[cfg(target_os = "fuchsia")]
6073pub struct ServiceSubscriber2SynchronousProxy {
6074    client: fidl::client::sync::Client,
6075}
6076
6077#[cfg(target_os = "fuchsia")]
6078impl fidl::endpoints::SynchronousProxy for ServiceSubscriber2SynchronousProxy {
6079    type Proxy = ServiceSubscriber2Proxy;
6080    type Protocol = ServiceSubscriber2Marker;
6081
6082    fn from_channel(inner: fidl::Channel) -> Self {
6083        Self::new(inner)
6084    }
6085
6086    fn into_channel(self) -> fidl::Channel {
6087        self.client.into_channel()
6088    }
6089
6090    fn as_channel(&self) -> &fidl::Channel {
6091        self.client.as_channel()
6092    }
6093}
6094
6095#[cfg(target_os = "fuchsia")]
6096impl ServiceSubscriber2SynchronousProxy {
6097    pub fn new(channel: fidl::Channel) -> Self {
6098        let protocol_name =
6099            <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6100        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6101    }
6102
6103    pub fn into_channel(self) -> fidl::Channel {
6104        self.client.into_channel()
6105    }
6106
6107    /// Waits until an event arrives and returns it. It is safe for other
6108    /// threads to make concurrent requests while waiting for an event.
6109    pub fn wait_for_event(
6110        &self,
6111        deadline: zx::MonotonicInstant,
6112    ) -> Result<ServiceSubscriber2Event, fidl::Error> {
6113        ServiceSubscriber2Event::decode(self.client.wait_for_event(deadline)?)
6114    }
6115
6116    /// Subscribes to a service. The subscription lasts until `subscriber` is unbound.
6117    ///
6118    /// + request `service` name of the type of service to which to subscribe. For example, cast
6119    ///   uses '_googlecast._tcp.'. If this value is not a valid service name, `subscriber` is
6120    ///   closed immediately and an error message is logged.
6121    /// + request `options` options to be applied to the subscription.
6122    /// + request `listener` client end of the `ServiceSubscriptionListener` channel.
6123    pub fn r#subscribe_to_service(
6124        &self,
6125        mut service: &str,
6126        mut options: &ServiceSubscriptionOptions,
6127        mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6128    ) -> Result<(), fidl::Error> {
6129        self.client.send::<ServiceSubscriber2SubscribeToServiceRequest>(
6130            (service, options, listener),
6131            0x78f713d88dcf34aa,
6132            fidl::encoding::DynamicFlags::empty(),
6133        )
6134    }
6135
6136    /// Subscribes to all services. The subscription lasts until `subscriber` is unbound.
6137    ///
6138    /// + request `options` options to be applied to the subscription.
6139    /// + request `listener` client end of the `ServiceSubscriptionListener` channel.
6140    pub fn r#subscribe_to_all_services(
6141        &self,
6142        mut options: &ServiceSubscriptionOptions,
6143        mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6144    ) -> Result<(), fidl::Error> {
6145        self.client.send::<ServiceSubscriber2SubscribeToAllServicesRequest>(
6146            (options, listener),
6147            0x7c5192d46e380468,
6148            fidl::encoding::DynamicFlags::empty(),
6149        )
6150    }
6151}
6152
6153#[derive(Debug, Clone)]
6154pub struct ServiceSubscriber2Proxy {
6155    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6156}
6157
6158impl fidl::endpoints::Proxy for ServiceSubscriber2Proxy {
6159    type Protocol = ServiceSubscriber2Marker;
6160
6161    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6162        Self::new(inner)
6163    }
6164
6165    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6166        self.client.into_channel().map_err(|client| Self { client })
6167    }
6168
6169    fn as_channel(&self) -> &::fidl::AsyncChannel {
6170        self.client.as_channel()
6171    }
6172}
6173
6174impl ServiceSubscriber2Proxy {
6175    /// Create a new Proxy for fuchsia.net.mdns/ServiceSubscriber2.
6176    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6177        let protocol_name =
6178            <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6179        Self { client: fidl::client::Client::new(channel, protocol_name) }
6180    }
6181
6182    /// Get a Stream of events from the remote end of the protocol.
6183    ///
6184    /// # Panics
6185    ///
6186    /// Panics if the event stream was already taken.
6187    pub fn take_event_stream(&self) -> ServiceSubscriber2EventStream {
6188        ServiceSubscriber2EventStream { event_receiver: self.client.take_event_receiver() }
6189    }
6190
6191    /// Subscribes to a service. The subscription lasts until `subscriber` is unbound.
6192    ///
6193    /// + request `service` name of the type of service to which to subscribe. For example, cast
6194    ///   uses '_googlecast._tcp.'. If this value is not a valid service name, `subscriber` is
6195    ///   closed immediately and an error message is logged.
6196    /// + request `options` options to be applied to the subscription.
6197    /// + request `listener` client end of the `ServiceSubscriptionListener` channel.
6198    pub fn r#subscribe_to_service(
6199        &self,
6200        mut service: &str,
6201        mut options: &ServiceSubscriptionOptions,
6202        mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6203    ) -> Result<(), fidl::Error> {
6204        ServiceSubscriber2ProxyInterface::r#subscribe_to_service(self, service, options, listener)
6205    }
6206
6207    /// Subscribes to all services. The subscription lasts until `subscriber` is unbound.
6208    ///
6209    /// + request `options` options to be applied to the subscription.
6210    /// + request `listener` client end of the `ServiceSubscriptionListener` channel.
6211    pub fn r#subscribe_to_all_services(
6212        &self,
6213        mut options: &ServiceSubscriptionOptions,
6214        mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6215    ) -> Result<(), fidl::Error> {
6216        ServiceSubscriber2ProxyInterface::r#subscribe_to_all_services(self, options, listener)
6217    }
6218}
6219
6220impl ServiceSubscriber2ProxyInterface for ServiceSubscriber2Proxy {
6221    fn r#subscribe_to_service(
6222        &self,
6223        mut service: &str,
6224        mut options: &ServiceSubscriptionOptions,
6225        mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6226    ) -> Result<(), fidl::Error> {
6227        self.client.send::<ServiceSubscriber2SubscribeToServiceRequest>(
6228            (service, options, listener),
6229            0x78f713d88dcf34aa,
6230            fidl::encoding::DynamicFlags::empty(),
6231        )
6232    }
6233
6234    fn r#subscribe_to_all_services(
6235        &self,
6236        mut options: &ServiceSubscriptionOptions,
6237        mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6238    ) -> Result<(), fidl::Error> {
6239        self.client.send::<ServiceSubscriber2SubscribeToAllServicesRequest>(
6240            (options, listener),
6241            0x7c5192d46e380468,
6242            fidl::encoding::DynamicFlags::empty(),
6243        )
6244    }
6245}
6246
6247pub struct ServiceSubscriber2EventStream {
6248    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6249}
6250
6251impl std::marker::Unpin for ServiceSubscriber2EventStream {}
6252
6253impl futures::stream::FusedStream for ServiceSubscriber2EventStream {
6254    fn is_terminated(&self) -> bool {
6255        self.event_receiver.is_terminated()
6256    }
6257}
6258
6259impl futures::Stream for ServiceSubscriber2EventStream {
6260    type Item = Result<ServiceSubscriber2Event, fidl::Error>;
6261
6262    fn poll_next(
6263        mut self: std::pin::Pin<&mut Self>,
6264        cx: &mut std::task::Context<'_>,
6265    ) -> std::task::Poll<Option<Self::Item>> {
6266        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6267            &mut self.event_receiver,
6268            cx
6269        )?) {
6270            Some(buf) => std::task::Poll::Ready(Some(ServiceSubscriber2Event::decode(buf))),
6271            None => std::task::Poll::Ready(None),
6272        }
6273    }
6274}
6275
6276#[derive(Debug)]
6277pub enum ServiceSubscriber2Event {}
6278
6279impl ServiceSubscriber2Event {
6280    /// Decodes a message buffer as a [`ServiceSubscriber2Event`].
6281    fn decode(
6282        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6283    ) -> Result<ServiceSubscriber2Event, fidl::Error> {
6284        let (bytes, _handles) = buf.split_mut();
6285        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6286        debug_assert_eq!(tx_header.tx_id, 0);
6287        match tx_header.ordinal {
6288            _ => Err(fidl::Error::UnknownOrdinal {
6289                ordinal: tx_header.ordinal,
6290                protocol_name:
6291                    <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6292            }),
6293        }
6294    }
6295}
6296
6297/// A Stream of incoming requests for fuchsia.net.mdns/ServiceSubscriber2.
6298pub struct ServiceSubscriber2RequestStream {
6299    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6300    is_terminated: bool,
6301}
6302
6303impl std::marker::Unpin for ServiceSubscriber2RequestStream {}
6304
6305impl futures::stream::FusedStream for ServiceSubscriber2RequestStream {
6306    fn is_terminated(&self) -> bool {
6307        self.is_terminated
6308    }
6309}
6310
6311impl fidl::endpoints::RequestStream for ServiceSubscriber2RequestStream {
6312    type Protocol = ServiceSubscriber2Marker;
6313    type ControlHandle = ServiceSubscriber2ControlHandle;
6314
6315    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6316        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6317    }
6318
6319    fn control_handle(&self) -> Self::ControlHandle {
6320        ServiceSubscriber2ControlHandle { inner: self.inner.clone() }
6321    }
6322
6323    fn into_inner(
6324        self,
6325    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6326    {
6327        (self.inner, self.is_terminated)
6328    }
6329
6330    fn from_inner(
6331        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6332        is_terminated: bool,
6333    ) -> Self {
6334        Self { inner, is_terminated }
6335    }
6336}
6337
6338impl futures::Stream for ServiceSubscriber2RequestStream {
6339    type Item = Result<ServiceSubscriber2Request, fidl::Error>;
6340
6341    fn poll_next(
6342        mut self: std::pin::Pin<&mut Self>,
6343        cx: &mut std::task::Context<'_>,
6344    ) -> std::task::Poll<Option<Self::Item>> {
6345        let this = &mut *self;
6346        if this.inner.check_shutdown(cx) {
6347            this.is_terminated = true;
6348            return std::task::Poll::Ready(None);
6349        }
6350        if this.is_terminated {
6351            panic!("polled ServiceSubscriber2RequestStream after completion");
6352        }
6353        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6354            |bytes, handles| {
6355                match this.inner.channel().read_etc(cx, bytes, handles) {
6356                    std::task::Poll::Ready(Ok(())) => {}
6357                    std::task::Poll::Pending => return std::task::Poll::Pending,
6358                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6359                        this.is_terminated = true;
6360                        return std::task::Poll::Ready(None);
6361                    }
6362                    std::task::Poll::Ready(Err(e)) => {
6363                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6364                            e.into(),
6365                        ))))
6366                    }
6367                }
6368
6369                // A message has been received from the channel
6370                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6371
6372                std::task::Poll::Ready(Some(match header.ordinal {
6373                0x78f713d88dcf34aa => {
6374                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6375                    let mut req = fidl::new_empty!(ServiceSubscriber2SubscribeToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6376                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriber2SubscribeToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
6377                    let control_handle = ServiceSubscriber2ControlHandle {
6378                        inner: this.inner.clone(),
6379                    };
6380                    Ok(ServiceSubscriber2Request::SubscribeToService {service: req.service,
6381options: req.options,
6382listener: req.listener,
6383
6384                        control_handle,
6385                    })
6386                }
6387                0x7c5192d46e380468 => {
6388                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6389                    let mut req = fidl::new_empty!(ServiceSubscriber2SubscribeToAllServicesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6390                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriber2SubscribeToAllServicesRequest>(&header, _body_bytes, handles, &mut req)?;
6391                    let control_handle = ServiceSubscriber2ControlHandle {
6392                        inner: this.inner.clone(),
6393                    };
6394                    Ok(ServiceSubscriber2Request::SubscribeToAllServices {options: req.options,
6395listener: req.listener,
6396
6397                        control_handle,
6398                    })
6399                }
6400                _ => Err(fidl::Error::UnknownOrdinal {
6401                    ordinal: header.ordinal,
6402                    protocol_name: <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6403                }),
6404            }))
6405            },
6406        )
6407    }
6408}
6409
6410/// Discoverable protocol for finding service instances.
6411#[derive(Debug)]
6412pub enum ServiceSubscriber2Request {
6413    /// Subscribes to a service. The subscription lasts until `subscriber` is unbound.
6414    ///
6415    /// + request `service` name of the type of service to which to subscribe. For example, cast
6416    ///   uses '_googlecast._tcp.'. If this value is not a valid service name, `subscriber` is
6417    ///   closed immediately and an error message is logged.
6418    /// + request `options` options to be applied to the subscription.
6419    /// + request `listener` client end of the `ServiceSubscriptionListener` channel.
6420    SubscribeToService {
6421        service: String,
6422        options: ServiceSubscriptionOptions,
6423        listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6424        control_handle: ServiceSubscriber2ControlHandle,
6425    },
6426    /// Subscribes to all services. The subscription lasts until `subscriber` is unbound.
6427    ///
6428    /// + request `options` options to be applied to the subscription.
6429    /// + request `listener` client end of the `ServiceSubscriptionListener` channel.
6430    SubscribeToAllServices {
6431        options: ServiceSubscriptionOptions,
6432        listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6433        control_handle: ServiceSubscriber2ControlHandle,
6434    },
6435}
6436
6437impl ServiceSubscriber2Request {
6438    #[allow(irrefutable_let_patterns)]
6439    pub fn into_subscribe_to_service(
6440        self,
6441    ) -> Option<(
6442        String,
6443        ServiceSubscriptionOptions,
6444        fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6445        ServiceSubscriber2ControlHandle,
6446    )> {
6447        if let ServiceSubscriber2Request::SubscribeToService {
6448            service,
6449            options,
6450            listener,
6451            control_handle,
6452        } = self
6453        {
6454            Some((service, options, listener, control_handle))
6455        } else {
6456            None
6457        }
6458    }
6459
6460    #[allow(irrefutable_let_patterns)]
6461    pub fn into_subscribe_to_all_services(
6462        self,
6463    ) -> Option<(
6464        ServiceSubscriptionOptions,
6465        fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6466        ServiceSubscriber2ControlHandle,
6467    )> {
6468        if let ServiceSubscriber2Request::SubscribeToAllServices {
6469            options,
6470            listener,
6471            control_handle,
6472        } = self
6473        {
6474            Some((options, listener, control_handle))
6475        } else {
6476            None
6477        }
6478    }
6479
6480    /// Name of the method defined in FIDL
6481    pub fn method_name(&self) -> &'static str {
6482        match *self {
6483            ServiceSubscriber2Request::SubscribeToService { .. } => "subscribe_to_service",
6484            ServiceSubscriber2Request::SubscribeToAllServices { .. } => "subscribe_to_all_services",
6485        }
6486    }
6487}
6488
6489#[derive(Debug, Clone)]
6490pub struct ServiceSubscriber2ControlHandle {
6491    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6492}
6493
6494impl fidl::endpoints::ControlHandle for ServiceSubscriber2ControlHandle {
6495    fn shutdown(&self) {
6496        self.inner.shutdown()
6497    }
6498    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6499        self.inner.shutdown_with_epitaph(status)
6500    }
6501
6502    fn is_closed(&self) -> bool {
6503        self.inner.channel().is_closed()
6504    }
6505    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6506        self.inner.channel().on_closed()
6507    }
6508
6509    #[cfg(target_os = "fuchsia")]
6510    fn signal_peer(
6511        &self,
6512        clear_mask: zx::Signals,
6513        set_mask: zx::Signals,
6514    ) -> Result<(), zx_status::Status> {
6515        use fidl::Peered;
6516        self.inner.channel().signal_peer(clear_mask, set_mask)
6517    }
6518}
6519
6520impl ServiceSubscriber2ControlHandle {}
6521
6522#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6523pub struct ServiceSubscriptionListenerMarker;
6524
6525impl fidl::endpoints::ProtocolMarker for ServiceSubscriptionListenerMarker {
6526    type Proxy = ServiceSubscriptionListenerProxy;
6527    type RequestStream = ServiceSubscriptionListenerRequestStream;
6528    #[cfg(target_os = "fuchsia")]
6529    type SynchronousProxy = ServiceSubscriptionListenerSynchronousProxy;
6530
6531    const DEBUG_NAME: &'static str = "(anonymous) ServiceSubscriptionListener";
6532}
6533
6534pub trait ServiceSubscriptionListenerProxyInterface: Send + Sync {
6535    type OnInstanceDiscoveredResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
6536        + Send;
6537    fn r#on_instance_discovered(
6538        &self,
6539        instance: &ServiceInstance,
6540    ) -> Self::OnInstanceDiscoveredResponseFut;
6541    type OnInstanceChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6542    fn r#on_instance_changed(
6543        &self,
6544        instance: &ServiceInstance,
6545    ) -> Self::OnInstanceChangedResponseFut;
6546    type OnInstanceLostResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6547    fn r#on_instance_lost(&self, service: &str, instance: &str) -> Self::OnInstanceLostResponseFut;
6548    type OnQueryResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6549    fn r#on_query(&self, resource_type: ResourceType) -> Self::OnQueryResponseFut;
6550}
6551#[derive(Debug)]
6552#[cfg(target_os = "fuchsia")]
6553pub struct ServiceSubscriptionListenerSynchronousProxy {
6554    client: fidl::client::sync::Client,
6555}
6556
6557#[cfg(target_os = "fuchsia")]
6558impl fidl::endpoints::SynchronousProxy for ServiceSubscriptionListenerSynchronousProxy {
6559    type Proxy = ServiceSubscriptionListenerProxy;
6560    type Protocol = ServiceSubscriptionListenerMarker;
6561
6562    fn from_channel(inner: fidl::Channel) -> Self {
6563        Self::new(inner)
6564    }
6565
6566    fn into_channel(self) -> fidl::Channel {
6567        self.client.into_channel()
6568    }
6569
6570    fn as_channel(&self) -> &fidl::Channel {
6571        self.client.as_channel()
6572    }
6573}
6574
6575#[cfg(target_os = "fuchsia")]
6576impl ServiceSubscriptionListenerSynchronousProxy {
6577    pub fn new(channel: fidl::Channel) -> Self {
6578        let protocol_name =
6579            <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6580        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6581    }
6582
6583    pub fn into_channel(self) -> fidl::Channel {
6584        self.client.into_channel()
6585    }
6586
6587    /// Waits until an event arrives and returns it. It is safe for other
6588    /// threads to make concurrent requests while waiting for an event.
6589    pub fn wait_for_event(
6590        &self,
6591        deadline: zx::MonotonicInstant,
6592    ) -> Result<ServiceSubscriptionListenerEvent, fidl::Error> {
6593        ServiceSubscriptionListenerEvent::decode(self.client.wait_for_event(deadline)?)
6594    }
6595
6596    /// Notifies the subscriber that a service instance has been discovered.
6597    pub fn r#on_instance_discovered(
6598        &self,
6599        mut instance: &ServiceInstance,
6600        ___deadline: zx::MonotonicInstant,
6601    ) -> Result<(), fidl::Error> {
6602        let _response = self.client.send_query::<
6603            ServiceSubscriptionListenerOnInstanceDiscoveredRequest,
6604            fidl::encoding::EmptyPayload,
6605        >(
6606            (instance,),
6607            0x82f861e0b26a186,
6608            fidl::encoding::DynamicFlags::empty(),
6609            ___deadline,
6610        )?;
6611        Ok(_response)
6612    }
6613
6614    /// Notifies the subscriber that addresses or text for a known service
6615    /// instance have changed.
6616    pub fn r#on_instance_changed(
6617        &self,
6618        mut instance: &ServiceInstance,
6619        ___deadline: zx::MonotonicInstant,
6620    ) -> Result<(), fidl::Error> {
6621        let _response = self.client.send_query::<
6622            ServiceSubscriptionListenerOnInstanceChangedRequest,
6623            fidl::encoding::EmptyPayload,
6624        >(
6625            (instance,),
6626            0x7da325aa758d8929,
6627            fidl::encoding::DynamicFlags::empty(),
6628            ___deadline,
6629        )?;
6630        Ok(_response)
6631    }
6632
6633    /// Notifies the subscriber that a known service instance has been lost.
6634    pub fn r#on_instance_lost(
6635        &self,
6636        mut service: &str,
6637        mut instance: &str,
6638        ___deadline: zx::MonotonicInstant,
6639    ) -> Result<(), fidl::Error> {
6640        let _response = self.client.send_query::<
6641            ServiceSubscriptionListenerOnInstanceLostRequest,
6642            fidl::encoding::EmptyPayload,
6643        >(
6644            (service, instance,),
6645            0x2ecb2f1600c5c6dc,
6646            fidl::encoding::DynamicFlags::empty(),
6647            ___deadline,
6648        )?;
6649        Ok(_response)
6650    }
6651
6652    /// Notifies the subscriber that a PTR query has been sent.
6653    pub fn r#on_query(
6654        &self,
6655        mut resource_type: ResourceType,
6656        ___deadline: zx::MonotonicInstant,
6657    ) -> Result<(), fidl::Error> {
6658        let _response = self
6659            .client
6660            .send_query::<ServiceSubscriptionListenerOnQueryRequest, fidl::encoding::EmptyPayload>(
6661                (resource_type,),
6662                0x4f4eb8e3d10db611,
6663                fidl::encoding::DynamicFlags::empty(),
6664                ___deadline,
6665            )?;
6666        Ok(_response)
6667    }
6668}
6669
6670#[derive(Debug, Clone)]
6671pub struct ServiceSubscriptionListenerProxy {
6672    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6673}
6674
6675impl fidl::endpoints::Proxy for ServiceSubscriptionListenerProxy {
6676    type Protocol = ServiceSubscriptionListenerMarker;
6677
6678    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6679        Self::new(inner)
6680    }
6681
6682    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6683        self.client.into_channel().map_err(|client| Self { client })
6684    }
6685
6686    fn as_channel(&self) -> &::fidl::AsyncChannel {
6687        self.client.as_channel()
6688    }
6689}
6690
6691impl ServiceSubscriptionListenerProxy {
6692    /// Create a new Proxy for fuchsia.net.mdns/ServiceSubscriptionListener.
6693    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6694        let protocol_name =
6695            <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6696        Self { client: fidl::client::Client::new(channel, protocol_name) }
6697    }
6698
6699    /// Get a Stream of events from the remote end of the protocol.
6700    ///
6701    /// # Panics
6702    ///
6703    /// Panics if the event stream was already taken.
6704    pub fn take_event_stream(&self) -> ServiceSubscriptionListenerEventStream {
6705        ServiceSubscriptionListenerEventStream { event_receiver: self.client.take_event_receiver() }
6706    }
6707
6708    /// Notifies the subscriber that a service instance has been discovered.
6709    pub fn r#on_instance_discovered(
6710        &self,
6711        mut instance: &ServiceInstance,
6712    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6713        ServiceSubscriptionListenerProxyInterface::r#on_instance_discovered(self, instance)
6714    }
6715
6716    /// Notifies the subscriber that addresses or text for a known service
6717    /// instance have changed.
6718    pub fn r#on_instance_changed(
6719        &self,
6720        mut instance: &ServiceInstance,
6721    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6722        ServiceSubscriptionListenerProxyInterface::r#on_instance_changed(self, instance)
6723    }
6724
6725    /// Notifies the subscriber that a known service instance has been lost.
6726    pub fn r#on_instance_lost(
6727        &self,
6728        mut service: &str,
6729        mut instance: &str,
6730    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6731        ServiceSubscriptionListenerProxyInterface::r#on_instance_lost(self, service, instance)
6732    }
6733
6734    /// Notifies the subscriber that a PTR query has been sent.
6735    pub fn r#on_query(
6736        &self,
6737        mut resource_type: ResourceType,
6738    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6739        ServiceSubscriptionListenerProxyInterface::r#on_query(self, resource_type)
6740    }
6741}
6742
6743impl ServiceSubscriptionListenerProxyInterface for ServiceSubscriptionListenerProxy {
6744    type OnInstanceDiscoveredResponseFut =
6745        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6746    fn r#on_instance_discovered(
6747        &self,
6748        mut instance: &ServiceInstance,
6749    ) -> Self::OnInstanceDiscoveredResponseFut {
6750        fn _decode(
6751            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6752        ) -> Result<(), fidl::Error> {
6753            let _response = fidl::client::decode_transaction_body::<
6754                fidl::encoding::EmptyPayload,
6755                fidl::encoding::DefaultFuchsiaResourceDialect,
6756                0x82f861e0b26a186,
6757            >(_buf?)?;
6758            Ok(_response)
6759        }
6760        self.client
6761            .send_query_and_decode::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest, ()>(
6762                (instance,),
6763                0x82f861e0b26a186,
6764                fidl::encoding::DynamicFlags::empty(),
6765                _decode,
6766            )
6767    }
6768
6769    type OnInstanceChangedResponseFut =
6770        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6771    fn r#on_instance_changed(
6772        &self,
6773        mut instance: &ServiceInstance,
6774    ) -> Self::OnInstanceChangedResponseFut {
6775        fn _decode(
6776            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6777        ) -> Result<(), fidl::Error> {
6778            let _response = fidl::client::decode_transaction_body::<
6779                fidl::encoding::EmptyPayload,
6780                fidl::encoding::DefaultFuchsiaResourceDialect,
6781                0x7da325aa758d8929,
6782            >(_buf?)?;
6783            Ok(_response)
6784        }
6785        self.client
6786            .send_query_and_decode::<ServiceSubscriptionListenerOnInstanceChangedRequest, ()>(
6787                (instance,),
6788                0x7da325aa758d8929,
6789                fidl::encoding::DynamicFlags::empty(),
6790                _decode,
6791            )
6792    }
6793
6794    type OnInstanceLostResponseFut =
6795        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6796    fn r#on_instance_lost(
6797        &self,
6798        mut service: &str,
6799        mut instance: &str,
6800    ) -> Self::OnInstanceLostResponseFut {
6801        fn _decode(
6802            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6803        ) -> Result<(), fidl::Error> {
6804            let _response = fidl::client::decode_transaction_body::<
6805                fidl::encoding::EmptyPayload,
6806                fidl::encoding::DefaultFuchsiaResourceDialect,
6807                0x2ecb2f1600c5c6dc,
6808            >(_buf?)?;
6809            Ok(_response)
6810        }
6811        self.client.send_query_and_decode::<ServiceSubscriptionListenerOnInstanceLostRequest, ()>(
6812            (service, instance),
6813            0x2ecb2f1600c5c6dc,
6814            fidl::encoding::DynamicFlags::empty(),
6815            _decode,
6816        )
6817    }
6818
6819    type OnQueryResponseFut =
6820        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6821    fn r#on_query(&self, mut resource_type: ResourceType) -> Self::OnQueryResponseFut {
6822        fn _decode(
6823            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6824        ) -> Result<(), fidl::Error> {
6825            let _response = fidl::client::decode_transaction_body::<
6826                fidl::encoding::EmptyPayload,
6827                fidl::encoding::DefaultFuchsiaResourceDialect,
6828                0x4f4eb8e3d10db611,
6829            >(_buf?)?;
6830            Ok(_response)
6831        }
6832        self.client.send_query_and_decode::<ServiceSubscriptionListenerOnQueryRequest, ()>(
6833            (resource_type,),
6834            0x4f4eb8e3d10db611,
6835            fidl::encoding::DynamicFlags::empty(),
6836            _decode,
6837        )
6838    }
6839}
6840
6841pub struct ServiceSubscriptionListenerEventStream {
6842    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6843}
6844
6845impl std::marker::Unpin for ServiceSubscriptionListenerEventStream {}
6846
6847impl futures::stream::FusedStream for ServiceSubscriptionListenerEventStream {
6848    fn is_terminated(&self) -> bool {
6849        self.event_receiver.is_terminated()
6850    }
6851}
6852
6853impl futures::Stream for ServiceSubscriptionListenerEventStream {
6854    type Item = Result<ServiceSubscriptionListenerEvent, fidl::Error>;
6855
6856    fn poll_next(
6857        mut self: std::pin::Pin<&mut Self>,
6858        cx: &mut std::task::Context<'_>,
6859    ) -> std::task::Poll<Option<Self::Item>> {
6860        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6861            &mut self.event_receiver,
6862            cx
6863        )?) {
6864            Some(buf) => {
6865                std::task::Poll::Ready(Some(ServiceSubscriptionListenerEvent::decode(buf)))
6866            }
6867            None => std::task::Poll::Ready(None),
6868        }
6869    }
6870}
6871
6872#[derive(Debug)]
6873pub enum ServiceSubscriptionListenerEvent {}
6874
6875impl ServiceSubscriptionListenerEvent {
6876    /// Decodes a message buffer as a [`ServiceSubscriptionListenerEvent`].
6877    fn decode(
6878        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6879    ) -> Result<ServiceSubscriptionListenerEvent, fidl::Error> {
6880        let (bytes, _handles) = buf.split_mut();
6881        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6882        debug_assert_eq!(tx_header.tx_id, 0);
6883        match tx_header.ordinal {
6884            _ => Err(fidl::Error::UnknownOrdinal {
6885                ordinal: tx_header.ordinal,
6886                protocol_name: <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6887            })
6888        }
6889    }
6890}
6891
6892/// A Stream of incoming requests for fuchsia.net.mdns/ServiceSubscriptionListener.
6893pub struct ServiceSubscriptionListenerRequestStream {
6894    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6895    is_terminated: bool,
6896}
6897
6898impl std::marker::Unpin for ServiceSubscriptionListenerRequestStream {}
6899
6900impl futures::stream::FusedStream for ServiceSubscriptionListenerRequestStream {
6901    fn is_terminated(&self) -> bool {
6902        self.is_terminated
6903    }
6904}
6905
6906impl fidl::endpoints::RequestStream for ServiceSubscriptionListenerRequestStream {
6907    type Protocol = ServiceSubscriptionListenerMarker;
6908    type ControlHandle = ServiceSubscriptionListenerControlHandle;
6909
6910    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6911        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6912    }
6913
6914    fn control_handle(&self) -> Self::ControlHandle {
6915        ServiceSubscriptionListenerControlHandle { inner: self.inner.clone() }
6916    }
6917
6918    fn into_inner(
6919        self,
6920    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6921    {
6922        (self.inner, self.is_terminated)
6923    }
6924
6925    fn from_inner(
6926        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6927        is_terminated: bool,
6928    ) -> Self {
6929        Self { inner, is_terminated }
6930    }
6931}
6932
6933impl futures::Stream for ServiceSubscriptionListenerRequestStream {
6934    type Item = Result<ServiceSubscriptionListenerRequest, fidl::Error>;
6935
6936    fn poll_next(
6937        mut self: std::pin::Pin<&mut Self>,
6938        cx: &mut std::task::Context<'_>,
6939    ) -> std::task::Poll<Option<Self::Item>> {
6940        let this = &mut *self;
6941        if this.inner.check_shutdown(cx) {
6942            this.is_terminated = true;
6943            return std::task::Poll::Ready(None);
6944        }
6945        if this.is_terminated {
6946            panic!("polled ServiceSubscriptionListenerRequestStream after completion");
6947        }
6948        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6949            |bytes, handles| {
6950                match this.inner.channel().read_etc(cx, bytes, handles) {
6951                    std::task::Poll::Ready(Ok(())) => {}
6952                    std::task::Poll::Pending => return std::task::Poll::Pending,
6953                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6954                        this.is_terminated = true;
6955                        return std::task::Poll::Ready(None);
6956                    }
6957                    std::task::Poll::Ready(Err(e)) => {
6958                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6959                            e.into(),
6960                        ))))
6961                    }
6962                }
6963
6964                // A message has been received from the channel
6965                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6966
6967                std::task::Poll::Ready(Some(match header.ordinal {
6968                0x82f861e0b26a186 => {
6969                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6970                    let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceDiscoveredRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6971                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest>(&header, _body_bytes, handles, &mut req)?;
6972                    let control_handle = ServiceSubscriptionListenerControlHandle {
6973                        inner: this.inner.clone(),
6974                    };
6975                    Ok(ServiceSubscriptionListenerRequest::OnInstanceDiscovered {instance: req.instance,
6976
6977                        responder: ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
6978                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6979                            tx_id: header.tx_id,
6980                        },
6981                    })
6982                }
6983                0x7da325aa758d8929 => {
6984                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6985                    let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6986                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceChangedRequest>(&header, _body_bytes, handles, &mut req)?;
6987                    let control_handle = ServiceSubscriptionListenerControlHandle {
6988                        inner: this.inner.clone(),
6989                    };
6990                    Ok(ServiceSubscriptionListenerRequest::OnInstanceChanged {instance: req.instance,
6991
6992                        responder: ServiceSubscriptionListenerOnInstanceChangedResponder {
6993                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6994                            tx_id: header.tx_id,
6995                        },
6996                    })
6997                }
6998                0x2ecb2f1600c5c6dc => {
6999                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7000                    let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceLostRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7001                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceLostRequest>(&header, _body_bytes, handles, &mut req)?;
7002                    let control_handle = ServiceSubscriptionListenerControlHandle {
7003                        inner: this.inner.clone(),
7004                    };
7005                    Ok(ServiceSubscriptionListenerRequest::OnInstanceLost {service: req.service,
7006instance: req.instance,
7007
7008                        responder: ServiceSubscriptionListenerOnInstanceLostResponder {
7009                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7010                            tx_id: header.tx_id,
7011                        },
7012                    })
7013                }
7014                0x4f4eb8e3d10db611 => {
7015                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7016                    let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnQueryRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7017                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnQueryRequest>(&header, _body_bytes, handles, &mut req)?;
7018                    let control_handle = ServiceSubscriptionListenerControlHandle {
7019                        inner: this.inner.clone(),
7020                    };
7021                    Ok(ServiceSubscriptionListenerRequest::OnQuery {resource_type: req.resource_type,
7022
7023                        responder: ServiceSubscriptionListenerOnQueryResponder {
7024                            control_handle: std::mem::ManuallyDrop::new(control_handle),
7025                            tx_id: header.tx_id,
7026                        },
7027                    })
7028                }
7029                _ => Err(fidl::Error::UnknownOrdinal {
7030                    ordinal: header.ordinal,
7031                    protocol_name: <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7032                }),
7033            }))
7034            },
7035        )
7036    }
7037}
7038
7039/// Client-implemented interface for subscribers. Method replies are used to
7040/// throttle traffic. The service won't necessarily wait for a reply before
7041/// calling another method.
7042#[derive(Debug)]
7043pub enum ServiceSubscriptionListenerRequest {
7044    /// Notifies the subscriber that a service instance has been discovered.
7045    OnInstanceDiscovered {
7046        instance: ServiceInstance,
7047        responder: ServiceSubscriptionListenerOnInstanceDiscoveredResponder,
7048    },
7049    /// Notifies the subscriber that addresses or text for a known service
7050    /// instance have changed.
7051    OnInstanceChanged {
7052        instance: ServiceInstance,
7053        responder: ServiceSubscriptionListenerOnInstanceChangedResponder,
7054    },
7055    /// Notifies the subscriber that a known service instance has been lost.
7056    OnInstanceLost {
7057        service: String,
7058        instance: String,
7059        responder: ServiceSubscriptionListenerOnInstanceLostResponder,
7060    },
7061    /// Notifies the subscriber that a PTR query has been sent.
7062    OnQuery { resource_type: ResourceType, responder: ServiceSubscriptionListenerOnQueryResponder },
7063}
7064
7065impl ServiceSubscriptionListenerRequest {
7066    #[allow(irrefutable_let_patterns)]
7067    pub fn into_on_instance_discovered(
7068        self,
7069    ) -> Option<(ServiceInstance, ServiceSubscriptionListenerOnInstanceDiscoveredResponder)> {
7070        if let ServiceSubscriptionListenerRequest::OnInstanceDiscovered { instance, responder } =
7071            self
7072        {
7073            Some((instance, responder))
7074        } else {
7075            None
7076        }
7077    }
7078
7079    #[allow(irrefutable_let_patterns)]
7080    pub fn into_on_instance_changed(
7081        self,
7082    ) -> Option<(ServiceInstance, ServiceSubscriptionListenerOnInstanceChangedResponder)> {
7083        if let ServiceSubscriptionListenerRequest::OnInstanceChanged { instance, responder } = self
7084        {
7085            Some((instance, responder))
7086        } else {
7087            None
7088        }
7089    }
7090
7091    #[allow(irrefutable_let_patterns)]
7092    pub fn into_on_instance_lost(
7093        self,
7094    ) -> Option<(String, String, ServiceSubscriptionListenerOnInstanceLostResponder)> {
7095        if let ServiceSubscriptionListenerRequest::OnInstanceLost { service, instance, responder } =
7096            self
7097        {
7098            Some((service, instance, responder))
7099        } else {
7100            None
7101        }
7102    }
7103
7104    #[allow(irrefutable_let_patterns)]
7105    pub fn into_on_query(
7106        self,
7107    ) -> Option<(ResourceType, ServiceSubscriptionListenerOnQueryResponder)> {
7108        if let ServiceSubscriptionListenerRequest::OnQuery { resource_type, responder } = self {
7109            Some((resource_type, responder))
7110        } else {
7111            None
7112        }
7113    }
7114
7115    /// Name of the method defined in FIDL
7116    pub fn method_name(&self) -> &'static str {
7117        match *self {
7118            ServiceSubscriptionListenerRequest::OnInstanceDiscovered { .. } => {
7119                "on_instance_discovered"
7120            }
7121            ServiceSubscriptionListenerRequest::OnInstanceChanged { .. } => "on_instance_changed",
7122            ServiceSubscriptionListenerRequest::OnInstanceLost { .. } => "on_instance_lost",
7123            ServiceSubscriptionListenerRequest::OnQuery { .. } => "on_query",
7124        }
7125    }
7126}
7127
7128#[derive(Debug, Clone)]
7129pub struct ServiceSubscriptionListenerControlHandle {
7130    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7131}
7132
7133impl fidl::endpoints::ControlHandle for ServiceSubscriptionListenerControlHandle {
7134    fn shutdown(&self) {
7135        self.inner.shutdown()
7136    }
7137    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7138        self.inner.shutdown_with_epitaph(status)
7139    }
7140
7141    fn is_closed(&self) -> bool {
7142        self.inner.channel().is_closed()
7143    }
7144    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7145        self.inner.channel().on_closed()
7146    }
7147
7148    #[cfg(target_os = "fuchsia")]
7149    fn signal_peer(
7150        &self,
7151        clear_mask: zx::Signals,
7152        set_mask: zx::Signals,
7153    ) -> Result<(), zx_status::Status> {
7154        use fidl::Peered;
7155        self.inner.channel().signal_peer(clear_mask, set_mask)
7156    }
7157}
7158
7159impl ServiceSubscriptionListenerControlHandle {}
7160
7161#[must_use = "FIDL methods require a response to be sent"]
7162#[derive(Debug)]
7163pub struct ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7164    control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7165    tx_id: u32,
7166}
7167
7168/// Set the the channel to be shutdown (see [`ServiceSubscriptionListenerControlHandle::shutdown`])
7169/// if the responder is dropped without sending a response, so that the client
7170/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7171impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7172    fn drop(&mut self) {
7173        self.control_handle.shutdown();
7174        // Safety: drops once, never accessed again
7175        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7176    }
7177}
7178
7179impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7180    type ControlHandle = ServiceSubscriptionListenerControlHandle;
7181
7182    fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7183        &self.control_handle
7184    }
7185
7186    fn drop_without_shutdown(mut self) {
7187        // Safety: drops once, never accessed again due to mem::forget
7188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7189        // Prevent Drop from running (which would shut down the channel)
7190        std::mem::forget(self);
7191    }
7192}
7193
7194impl ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7195    /// Sends a response to the FIDL transaction.
7196    ///
7197    /// Sets the channel to shutdown if an error occurs.
7198    pub fn send(self) -> Result<(), fidl::Error> {
7199        let _result = self.send_raw();
7200        if _result.is_err() {
7201            self.control_handle.shutdown();
7202        }
7203        self.drop_without_shutdown();
7204        _result
7205    }
7206
7207    /// Similar to "send" but does not shutdown the channel if an error occurs.
7208    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7209        let _result = self.send_raw();
7210        self.drop_without_shutdown();
7211        _result
7212    }
7213
7214    fn send_raw(&self) -> Result<(), fidl::Error> {
7215        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7216            (),
7217            self.tx_id,
7218            0x82f861e0b26a186,
7219            fidl::encoding::DynamicFlags::empty(),
7220        )
7221    }
7222}
7223
7224#[must_use = "FIDL methods require a response to be sent"]
7225#[derive(Debug)]
7226pub struct ServiceSubscriptionListenerOnInstanceChangedResponder {
7227    control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7228    tx_id: u32,
7229}
7230
7231/// Set the the channel to be shutdown (see [`ServiceSubscriptionListenerControlHandle::shutdown`])
7232/// if the responder is dropped without sending a response, so that the client
7233/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7234impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceChangedResponder {
7235    fn drop(&mut self) {
7236        self.control_handle.shutdown();
7237        // Safety: drops once, never accessed again
7238        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7239    }
7240}
7241
7242impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceChangedResponder {
7243    type ControlHandle = ServiceSubscriptionListenerControlHandle;
7244
7245    fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7246        &self.control_handle
7247    }
7248
7249    fn drop_without_shutdown(mut self) {
7250        // Safety: drops once, never accessed again due to mem::forget
7251        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7252        // Prevent Drop from running (which would shut down the channel)
7253        std::mem::forget(self);
7254    }
7255}
7256
7257impl ServiceSubscriptionListenerOnInstanceChangedResponder {
7258    /// Sends a response to the FIDL transaction.
7259    ///
7260    /// Sets the channel to shutdown if an error occurs.
7261    pub fn send(self) -> Result<(), fidl::Error> {
7262        let _result = self.send_raw();
7263        if _result.is_err() {
7264            self.control_handle.shutdown();
7265        }
7266        self.drop_without_shutdown();
7267        _result
7268    }
7269
7270    /// Similar to "send" but does not shutdown the channel if an error occurs.
7271    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7272        let _result = self.send_raw();
7273        self.drop_without_shutdown();
7274        _result
7275    }
7276
7277    fn send_raw(&self) -> Result<(), fidl::Error> {
7278        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7279            (),
7280            self.tx_id,
7281            0x7da325aa758d8929,
7282            fidl::encoding::DynamicFlags::empty(),
7283        )
7284    }
7285}
7286
7287#[must_use = "FIDL methods require a response to be sent"]
7288#[derive(Debug)]
7289pub struct ServiceSubscriptionListenerOnInstanceLostResponder {
7290    control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7291    tx_id: u32,
7292}
7293
7294/// Set the the channel to be shutdown (see [`ServiceSubscriptionListenerControlHandle::shutdown`])
7295/// if the responder is dropped without sending a response, so that the client
7296/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7297impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceLostResponder {
7298    fn drop(&mut self) {
7299        self.control_handle.shutdown();
7300        // Safety: drops once, never accessed again
7301        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7302    }
7303}
7304
7305impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceLostResponder {
7306    type ControlHandle = ServiceSubscriptionListenerControlHandle;
7307
7308    fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7309        &self.control_handle
7310    }
7311
7312    fn drop_without_shutdown(mut self) {
7313        // Safety: drops once, never accessed again due to mem::forget
7314        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7315        // Prevent Drop from running (which would shut down the channel)
7316        std::mem::forget(self);
7317    }
7318}
7319
7320impl ServiceSubscriptionListenerOnInstanceLostResponder {
7321    /// Sends a response to the FIDL transaction.
7322    ///
7323    /// Sets the channel to shutdown if an error occurs.
7324    pub fn send(self) -> Result<(), fidl::Error> {
7325        let _result = self.send_raw();
7326        if _result.is_err() {
7327            self.control_handle.shutdown();
7328        }
7329        self.drop_without_shutdown();
7330        _result
7331    }
7332
7333    /// Similar to "send" but does not shutdown the channel if an error occurs.
7334    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7335        let _result = self.send_raw();
7336        self.drop_without_shutdown();
7337        _result
7338    }
7339
7340    fn send_raw(&self) -> Result<(), fidl::Error> {
7341        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7342            (),
7343            self.tx_id,
7344            0x2ecb2f1600c5c6dc,
7345            fidl::encoding::DynamicFlags::empty(),
7346        )
7347    }
7348}
7349
7350#[must_use = "FIDL methods require a response to be sent"]
7351#[derive(Debug)]
7352pub struct ServiceSubscriptionListenerOnQueryResponder {
7353    control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7354    tx_id: u32,
7355}
7356
7357/// Set the the channel to be shutdown (see [`ServiceSubscriptionListenerControlHandle::shutdown`])
7358/// if the responder is dropped without sending a response, so that the client
7359/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7360impl std::ops::Drop for ServiceSubscriptionListenerOnQueryResponder {
7361    fn drop(&mut self) {
7362        self.control_handle.shutdown();
7363        // Safety: drops once, never accessed again
7364        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7365    }
7366}
7367
7368impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnQueryResponder {
7369    type ControlHandle = ServiceSubscriptionListenerControlHandle;
7370
7371    fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7372        &self.control_handle
7373    }
7374
7375    fn drop_without_shutdown(mut self) {
7376        // Safety: drops once, never accessed again due to mem::forget
7377        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7378        // Prevent Drop from running (which would shut down the channel)
7379        std::mem::forget(self);
7380    }
7381}
7382
7383impl ServiceSubscriptionListenerOnQueryResponder {
7384    /// Sends a response to the FIDL transaction.
7385    ///
7386    /// Sets the channel to shutdown if an error occurs.
7387    pub fn send(self) -> Result<(), fidl::Error> {
7388        let _result = self.send_raw();
7389        if _result.is_err() {
7390            self.control_handle.shutdown();
7391        }
7392        self.drop_without_shutdown();
7393        _result
7394    }
7395
7396    /// Similar to "send" but does not shutdown the channel if an error occurs.
7397    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7398        let _result = self.send_raw();
7399        self.drop_without_shutdown();
7400        _result
7401    }
7402
7403    fn send_raw(&self) -> Result<(), fidl::Error> {
7404        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7405            (),
7406            self.tx_id,
7407            0x4f4eb8e3d10db611,
7408            fidl::encoding::DynamicFlags::empty(),
7409        )
7410    }
7411}
7412
7413#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7414pub struct SubscriberMarker;
7415
7416impl fidl::endpoints::ProtocolMarker for SubscriberMarker {
7417    type Proxy = SubscriberProxy;
7418    type RequestStream = SubscriberRequestStream;
7419    #[cfg(target_os = "fuchsia")]
7420    type SynchronousProxy = SubscriberSynchronousProxy;
7421
7422    const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Subscriber";
7423}
7424impl fidl::endpoints::DiscoverableProtocolMarker for SubscriberMarker {}
7425
7426pub trait SubscriberProxyInterface: Send + Sync {
7427    fn r#subscribe_to_service(
7428        &self,
7429        service: &str,
7430        subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7431    ) -> Result<(), fidl::Error>;
7432}
7433#[derive(Debug)]
7434#[cfg(target_os = "fuchsia")]
7435pub struct SubscriberSynchronousProxy {
7436    client: fidl::client::sync::Client,
7437}
7438
7439#[cfg(target_os = "fuchsia")]
7440impl fidl::endpoints::SynchronousProxy for SubscriberSynchronousProxy {
7441    type Proxy = SubscriberProxy;
7442    type Protocol = SubscriberMarker;
7443
7444    fn from_channel(inner: fidl::Channel) -> Self {
7445        Self::new(inner)
7446    }
7447
7448    fn into_channel(self) -> fidl::Channel {
7449        self.client.into_channel()
7450    }
7451
7452    fn as_channel(&self) -> &fidl::Channel {
7453        self.client.as_channel()
7454    }
7455}
7456
7457#[cfg(target_os = "fuchsia")]
7458impl SubscriberSynchronousProxy {
7459    pub fn new(channel: fidl::Channel) -> Self {
7460        let protocol_name = <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7461        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7462    }
7463
7464    pub fn into_channel(self) -> fidl::Channel {
7465        self.client.into_channel()
7466    }
7467
7468    /// Waits until an event arrives and returns it. It is safe for other
7469    /// threads to make concurrent requests while waiting for an event.
7470    pub fn wait_for_event(
7471        &self,
7472        deadline: zx::MonotonicInstant,
7473    ) -> Result<SubscriberEvent, fidl::Error> {
7474        SubscriberEvent::decode(self.client.wait_for_event(deadline)?)
7475    }
7476
7477    /// Subscribes to a service. The subscription lasts until `subscriber` is
7478    /// unbound.
7479    pub fn r#subscribe_to_service(
7480        &self,
7481        mut service: &str,
7482        mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7483    ) -> Result<(), fidl::Error> {
7484        self.client.send::<SubscriberSubscribeToServiceRequest>(
7485            (service, subscriber),
7486            0x3a1a3b02c1809e3f,
7487            fidl::encoding::DynamicFlags::empty(),
7488        )
7489    }
7490}
7491
7492#[derive(Debug, Clone)]
7493pub struct SubscriberProxy {
7494    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7495}
7496
7497impl fidl::endpoints::Proxy for SubscriberProxy {
7498    type Protocol = SubscriberMarker;
7499
7500    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7501        Self::new(inner)
7502    }
7503
7504    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7505        self.client.into_channel().map_err(|client| Self { client })
7506    }
7507
7508    fn as_channel(&self) -> &::fidl::AsyncChannel {
7509        self.client.as_channel()
7510    }
7511}
7512
7513impl SubscriberProxy {
7514    /// Create a new Proxy for fuchsia.net.mdns/Subscriber.
7515    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7516        let protocol_name = <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7517        Self { client: fidl::client::Client::new(channel, protocol_name) }
7518    }
7519
7520    /// Get a Stream of events from the remote end of the protocol.
7521    ///
7522    /// # Panics
7523    ///
7524    /// Panics if the event stream was already taken.
7525    pub fn take_event_stream(&self) -> SubscriberEventStream {
7526        SubscriberEventStream { event_receiver: self.client.take_event_receiver() }
7527    }
7528
7529    /// Subscribes to a service. The subscription lasts until `subscriber` is
7530    /// unbound.
7531    pub fn r#subscribe_to_service(
7532        &self,
7533        mut service: &str,
7534        mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7535    ) -> Result<(), fidl::Error> {
7536        SubscriberProxyInterface::r#subscribe_to_service(self, service, subscriber)
7537    }
7538}
7539
7540impl SubscriberProxyInterface for SubscriberProxy {
7541    fn r#subscribe_to_service(
7542        &self,
7543        mut service: &str,
7544        mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7545    ) -> Result<(), fidl::Error> {
7546        self.client.send::<SubscriberSubscribeToServiceRequest>(
7547            (service, subscriber),
7548            0x3a1a3b02c1809e3f,
7549            fidl::encoding::DynamicFlags::empty(),
7550        )
7551    }
7552}
7553
7554pub struct SubscriberEventStream {
7555    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7556}
7557
7558impl std::marker::Unpin for SubscriberEventStream {}
7559
7560impl futures::stream::FusedStream for SubscriberEventStream {
7561    fn is_terminated(&self) -> bool {
7562        self.event_receiver.is_terminated()
7563    }
7564}
7565
7566impl futures::Stream for SubscriberEventStream {
7567    type Item = Result<SubscriberEvent, fidl::Error>;
7568
7569    fn poll_next(
7570        mut self: std::pin::Pin<&mut Self>,
7571        cx: &mut std::task::Context<'_>,
7572    ) -> std::task::Poll<Option<Self::Item>> {
7573        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7574            &mut self.event_receiver,
7575            cx
7576        )?) {
7577            Some(buf) => std::task::Poll::Ready(Some(SubscriberEvent::decode(buf))),
7578            None => std::task::Poll::Ready(None),
7579        }
7580    }
7581}
7582
7583#[derive(Debug)]
7584pub enum SubscriberEvent {}
7585
7586impl SubscriberEvent {
7587    /// Decodes a message buffer as a [`SubscriberEvent`].
7588    fn decode(
7589        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7590    ) -> Result<SubscriberEvent, fidl::Error> {
7591        let (bytes, _handles) = buf.split_mut();
7592        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7593        debug_assert_eq!(tx_header.tx_id, 0);
7594        match tx_header.ordinal {
7595            _ => Err(fidl::Error::UnknownOrdinal {
7596                ordinal: tx_header.ordinal,
7597                protocol_name: <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7598            }),
7599        }
7600    }
7601}
7602
7603/// A Stream of incoming requests for fuchsia.net.mdns/Subscriber.
7604pub struct SubscriberRequestStream {
7605    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7606    is_terminated: bool,
7607}
7608
7609impl std::marker::Unpin for SubscriberRequestStream {}
7610
7611impl futures::stream::FusedStream for SubscriberRequestStream {
7612    fn is_terminated(&self) -> bool {
7613        self.is_terminated
7614    }
7615}
7616
7617impl fidl::endpoints::RequestStream for SubscriberRequestStream {
7618    type Protocol = SubscriberMarker;
7619    type ControlHandle = SubscriberControlHandle;
7620
7621    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7622        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7623    }
7624
7625    fn control_handle(&self) -> Self::ControlHandle {
7626        SubscriberControlHandle { inner: self.inner.clone() }
7627    }
7628
7629    fn into_inner(
7630        self,
7631    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7632    {
7633        (self.inner, self.is_terminated)
7634    }
7635
7636    fn from_inner(
7637        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7638        is_terminated: bool,
7639    ) -> Self {
7640        Self { inner, is_terminated }
7641    }
7642}
7643
7644impl futures::Stream for SubscriberRequestStream {
7645    type Item = Result<SubscriberRequest, fidl::Error>;
7646
7647    fn poll_next(
7648        mut self: std::pin::Pin<&mut Self>,
7649        cx: &mut std::task::Context<'_>,
7650    ) -> std::task::Poll<Option<Self::Item>> {
7651        let this = &mut *self;
7652        if this.inner.check_shutdown(cx) {
7653            this.is_terminated = true;
7654            return std::task::Poll::Ready(None);
7655        }
7656        if this.is_terminated {
7657            panic!("polled SubscriberRequestStream after completion");
7658        }
7659        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7660            |bytes, handles| {
7661                match this.inner.channel().read_etc(cx, bytes, handles) {
7662                    std::task::Poll::Ready(Ok(())) => {}
7663                    std::task::Poll::Pending => return std::task::Poll::Pending,
7664                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7665                        this.is_terminated = true;
7666                        return std::task::Poll::Ready(None);
7667                    }
7668                    std::task::Poll::Ready(Err(e)) => {
7669                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7670                            e.into(),
7671                        ))))
7672                    }
7673                }
7674
7675                // A message has been received from the channel
7676                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7677
7678                std::task::Poll::Ready(Some(match header.ordinal {
7679                    0x3a1a3b02c1809e3f => {
7680                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7681                        let mut req = fidl::new_empty!(
7682                            SubscriberSubscribeToServiceRequest,
7683                            fidl::encoding::DefaultFuchsiaResourceDialect
7684                        );
7685                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SubscriberSubscribeToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
7686                        let control_handle = SubscriberControlHandle { inner: this.inner.clone() };
7687                        Ok(SubscriberRequest::SubscribeToService {
7688                            service: req.service,
7689                            subscriber: req.subscriber,
7690
7691                            control_handle,
7692                        })
7693                    }
7694                    _ => Err(fidl::Error::UnknownOrdinal {
7695                        ordinal: header.ordinal,
7696                        protocol_name:
7697                            <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7698                    }),
7699                }))
7700            },
7701        )
7702    }
7703}
7704
7705/// Discoverable protocol for finding service instances.
7706/// Deprecated: use ServiceInstanceSubscriber.
7707#[derive(Debug)]
7708pub enum SubscriberRequest {
7709    /// Subscribes to a service. The subscription lasts until `subscriber` is
7710    /// unbound.
7711    SubscribeToService {
7712        service: String,
7713        subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7714        control_handle: SubscriberControlHandle,
7715    },
7716}
7717
7718impl SubscriberRequest {
7719    #[allow(irrefutable_let_patterns)]
7720    pub fn into_subscribe_to_service(
7721        self,
7722    ) -> Option<(
7723        String,
7724        fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7725        SubscriberControlHandle,
7726    )> {
7727        if let SubscriberRequest::SubscribeToService { service, subscriber, control_handle } = self
7728        {
7729            Some((service, subscriber, control_handle))
7730        } else {
7731            None
7732        }
7733    }
7734
7735    /// Name of the method defined in FIDL
7736    pub fn method_name(&self) -> &'static str {
7737        match *self {
7738            SubscriberRequest::SubscribeToService { .. } => "subscribe_to_service",
7739        }
7740    }
7741}
7742
7743#[derive(Debug, Clone)]
7744pub struct SubscriberControlHandle {
7745    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7746}
7747
7748impl fidl::endpoints::ControlHandle for SubscriberControlHandle {
7749    fn shutdown(&self) {
7750        self.inner.shutdown()
7751    }
7752    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7753        self.inner.shutdown_with_epitaph(status)
7754    }
7755
7756    fn is_closed(&self) -> bool {
7757        self.inner.channel().is_closed()
7758    }
7759    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7760        self.inner.channel().on_closed()
7761    }
7762
7763    #[cfg(target_os = "fuchsia")]
7764    fn signal_peer(
7765        &self,
7766        clear_mask: zx::Signals,
7767        set_mask: zx::Signals,
7768    ) -> Result<(), zx_status::Status> {
7769        use fidl::Peered;
7770        self.inner.channel().signal_peer(clear_mask, set_mask)
7771    }
7772}
7773
7774impl SubscriberControlHandle {}
7775
7776mod internal {
7777    use super::*;
7778
7779    impl fidl::encoding::ResourceTypeMarker for HostNameSubscriberSubscribeToHostNameRequest {
7780        type Borrowed<'a> = &'a mut Self;
7781        fn take_or_borrow<'a>(
7782            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7783        ) -> Self::Borrowed<'a> {
7784            value
7785        }
7786    }
7787
7788    unsafe impl fidl::encoding::TypeMarker for HostNameSubscriberSubscribeToHostNameRequest {
7789        type Owned = Self;
7790
7791        #[inline(always)]
7792        fn inline_align(_context: fidl::encoding::Context) -> usize {
7793            8
7794        }
7795
7796        #[inline(always)]
7797        fn inline_size(_context: fidl::encoding::Context) -> usize {
7798            40
7799        }
7800    }
7801
7802    unsafe impl
7803        fidl::encoding::Encode<
7804            HostNameSubscriberSubscribeToHostNameRequest,
7805            fidl::encoding::DefaultFuchsiaResourceDialect,
7806        > for &mut HostNameSubscriberSubscribeToHostNameRequest
7807    {
7808        #[inline]
7809        unsafe fn encode(
7810            self,
7811            encoder: &mut fidl::encoding::Encoder<
7812                '_,
7813                fidl::encoding::DefaultFuchsiaResourceDialect,
7814            >,
7815            offset: usize,
7816            _depth: fidl::encoding::Depth,
7817        ) -> fidl::Result<()> {
7818            encoder.debug_check_bounds::<HostNameSubscriberSubscribeToHostNameRequest>(offset);
7819            // Delegate to tuple encoding.
7820            fidl::encoding::Encode::<
7821                HostNameSubscriberSubscribeToHostNameRequest,
7822                fidl::encoding::DefaultFuchsiaResourceDialect,
7823            >::encode(
7824                (
7825                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
7826                        &self.host,
7827                    ),
7828                    <HostNameSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
7829                        &self.options,
7830                    ),
7831                    <fidl::encoding::Endpoint<
7832                        fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
7833                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7834                        &mut self.listener
7835                    ),
7836                ),
7837                encoder,
7838                offset,
7839                _depth,
7840            )
7841        }
7842    }
7843    unsafe impl<
7844            T0: fidl::encoding::Encode<
7845                fidl::encoding::BoundedString<255>,
7846                fidl::encoding::DefaultFuchsiaResourceDialect,
7847            >,
7848            T1: fidl::encoding::Encode<
7849                HostNameSubscriptionOptions,
7850                fidl::encoding::DefaultFuchsiaResourceDialect,
7851            >,
7852            T2: fidl::encoding::Encode<
7853                fidl::encoding::Endpoint<
7854                    fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
7855                >,
7856                fidl::encoding::DefaultFuchsiaResourceDialect,
7857            >,
7858        >
7859        fidl::encoding::Encode<
7860            HostNameSubscriberSubscribeToHostNameRequest,
7861            fidl::encoding::DefaultFuchsiaResourceDialect,
7862        > for (T0, T1, T2)
7863    {
7864        #[inline]
7865        unsafe fn encode(
7866            self,
7867            encoder: &mut fidl::encoding::Encoder<
7868                '_,
7869                fidl::encoding::DefaultFuchsiaResourceDialect,
7870            >,
7871            offset: usize,
7872            depth: fidl::encoding::Depth,
7873        ) -> fidl::Result<()> {
7874            encoder.debug_check_bounds::<HostNameSubscriberSubscribeToHostNameRequest>(offset);
7875            // Zero out padding regions. There's no need to apply masks
7876            // because the unmasked parts will be overwritten by fields.
7877            unsafe {
7878                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
7879                (ptr as *mut u64).write_unaligned(0);
7880            }
7881            // Write the fields.
7882            self.0.encode(encoder, offset + 0, depth)?;
7883            self.1.encode(encoder, offset + 16, depth)?;
7884            self.2.encode(encoder, offset + 32, depth)?;
7885            Ok(())
7886        }
7887    }
7888
7889    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7890        for HostNameSubscriberSubscribeToHostNameRequest
7891    {
7892        #[inline(always)]
7893        fn new_empty() -> Self {
7894            Self {
7895                host: fidl::new_empty!(
7896                    fidl::encoding::BoundedString<255>,
7897                    fidl::encoding::DefaultFuchsiaResourceDialect
7898                ),
7899                options: fidl::new_empty!(
7900                    HostNameSubscriptionOptions,
7901                    fidl::encoding::DefaultFuchsiaResourceDialect
7902                ),
7903                listener: fidl::new_empty!(
7904                    fidl::encoding::Endpoint<
7905                        fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
7906                    >,
7907                    fidl::encoding::DefaultFuchsiaResourceDialect
7908                ),
7909            }
7910        }
7911
7912        #[inline]
7913        unsafe fn decode(
7914            &mut self,
7915            decoder: &mut fidl::encoding::Decoder<
7916                '_,
7917                fidl::encoding::DefaultFuchsiaResourceDialect,
7918            >,
7919            offset: usize,
7920            _depth: fidl::encoding::Depth,
7921        ) -> fidl::Result<()> {
7922            decoder.debug_check_bounds::<Self>(offset);
7923            // Verify that padding bytes are zero.
7924            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
7925            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7926            let mask = 0xffffffff00000000u64;
7927            let maskedval = padval & mask;
7928            if maskedval != 0 {
7929                return Err(fidl::Error::NonZeroPadding {
7930                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
7931                });
7932            }
7933            fidl::decode!(
7934                fidl::encoding::BoundedString<255>,
7935                fidl::encoding::DefaultFuchsiaResourceDialect,
7936                &mut self.host,
7937                decoder,
7938                offset + 0,
7939                _depth
7940            )?;
7941            fidl::decode!(
7942                HostNameSubscriptionOptions,
7943                fidl::encoding::DefaultFuchsiaResourceDialect,
7944                &mut self.options,
7945                decoder,
7946                offset + 16,
7947                _depth
7948            )?;
7949            fidl::decode!(
7950                fidl::encoding::Endpoint<
7951                    fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
7952                >,
7953                fidl::encoding::DefaultFuchsiaResourceDialect,
7954                &mut self.listener,
7955                decoder,
7956                offset + 32,
7957                _depth
7958            )?;
7959            Ok(())
7960        }
7961    }
7962
7963    impl fidl::encoding::ResourceTypeMarker for ProxyHostPublisherPublishProxyHostRequest {
7964        type Borrowed<'a> = &'a mut Self;
7965        fn take_or_borrow<'a>(
7966            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7967        ) -> Self::Borrowed<'a> {
7968            value
7969        }
7970    }
7971
7972    unsafe impl fidl::encoding::TypeMarker for ProxyHostPublisherPublishProxyHostRequest {
7973        type Owned = Self;
7974
7975        #[inline(always)]
7976        fn inline_align(_context: fidl::encoding::Context) -> usize {
7977            8
7978        }
7979
7980        #[inline(always)]
7981        fn inline_size(_context: fidl::encoding::Context) -> usize {
7982            56
7983        }
7984    }
7985
7986    unsafe impl
7987        fidl::encoding::Encode<
7988            ProxyHostPublisherPublishProxyHostRequest,
7989            fidl::encoding::DefaultFuchsiaResourceDialect,
7990        > for &mut ProxyHostPublisherPublishProxyHostRequest
7991    {
7992        #[inline]
7993        unsafe fn encode(
7994            self,
7995            encoder: &mut fidl::encoding::Encoder<
7996                '_,
7997                fidl::encoding::DefaultFuchsiaResourceDialect,
7998            >,
7999            offset: usize,
8000            _depth: fidl::encoding::Depth,
8001        ) -> fidl::Result<()> {
8002            encoder.debug_check_bounds::<ProxyHostPublisherPublishProxyHostRequest>(offset);
8003            // Delegate to tuple encoding.
8004            fidl::encoding::Encode::<ProxyHostPublisherPublishProxyHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8005                (
8006                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.host),
8007                    <fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
8008                    <ProxyHostPublicationOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
8009                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service_instance_publisher),
8010                ),
8011                encoder, offset, _depth
8012            )
8013        }
8014    }
8015    unsafe impl<
8016            T0: fidl::encoding::Encode<
8017                fidl::encoding::BoundedString<255>,
8018                fidl::encoding::DefaultFuchsiaResourceDialect,
8019            >,
8020            T1: fidl::encoding::Encode<
8021                fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>,
8022                fidl::encoding::DefaultFuchsiaResourceDialect,
8023            >,
8024            T2: fidl::encoding::Encode<
8025                ProxyHostPublicationOptions,
8026                fidl::encoding::DefaultFuchsiaResourceDialect,
8027            >,
8028            T3: fidl::encoding::Encode<
8029                fidl::encoding::Endpoint<
8030                    fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
8031                >,
8032                fidl::encoding::DefaultFuchsiaResourceDialect,
8033            >,
8034        >
8035        fidl::encoding::Encode<
8036            ProxyHostPublisherPublishProxyHostRequest,
8037            fidl::encoding::DefaultFuchsiaResourceDialect,
8038        > for (T0, T1, T2, T3)
8039    {
8040        #[inline]
8041        unsafe fn encode(
8042            self,
8043            encoder: &mut fidl::encoding::Encoder<
8044                '_,
8045                fidl::encoding::DefaultFuchsiaResourceDialect,
8046            >,
8047            offset: usize,
8048            depth: fidl::encoding::Depth,
8049        ) -> fidl::Result<()> {
8050            encoder.debug_check_bounds::<ProxyHostPublisherPublishProxyHostRequest>(offset);
8051            // Zero out padding regions. There's no need to apply masks
8052            // because the unmasked parts will be overwritten by fields.
8053            unsafe {
8054                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
8055                (ptr as *mut u64).write_unaligned(0);
8056            }
8057            // Write the fields.
8058            self.0.encode(encoder, offset + 0, depth)?;
8059            self.1.encode(encoder, offset + 16, depth)?;
8060            self.2.encode(encoder, offset + 32, depth)?;
8061            self.3.encode(encoder, offset + 48, depth)?;
8062            Ok(())
8063        }
8064    }
8065
8066    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8067        for ProxyHostPublisherPublishProxyHostRequest
8068    {
8069        #[inline(always)]
8070        fn new_empty() -> Self {
8071            Self {
8072                host: fidl::new_empty!(
8073                    fidl::encoding::BoundedString<255>,
8074                    fidl::encoding::DefaultFuchsiaResourceDialect
8075                ),
8076                addresses: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
8077                options: fidl::new_empty!(
8078                    ProxyHostPublicationOptions,
8079                    fidl::encoding::DefaultFuchsiaResourceDialect
8080                ),
8081                service_instance_publisher: fidl::new_empty!(
8082                    fidl::encoding::Endpoint<
8083                        fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
8084                    >,
8085                    fidl::encoding::DefaultFuchsiaResourceDialect
8086                ),
8087            }
8088        }
8089
8090        #[inline]
8091        unsafe fn decode(
8092            &mut self,
8093            decoder: &mut fidl::encoding::Decoder<
8094                '_,
8095                fidl::encoding::DefaultFuchsiaResourceDialect,
8096            >,
8097            offset: usize,
8098            _depth: fidl::encoding::Depth,
8099        ) -> fidl::Result<()> {
8100            decoder.debug_check_bounds::<Self>(offset);
8101            // Verify that padding bytes are zero.
8102            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
8103            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8104            let mask = 0xffffffff00000000u64;
8105            let maskedval = padval & mask;
8106            if maskedval != 0 {
8107                return Err(fidl::Error::NonZeroPadding {
8108                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
8109                });
8110            }
8111            fidl::decode!(
8112                fidl::encoding::BoundedString<255>,
8113                fidl::encoding::DefaultFuchsiaResourceDialect,
8114                &mut self.host,
8115                decoder,
8116                offset + 0,
8117                _depth
8118            )?;
8119            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.addresses, decoder, offset + 16, _depth)?;
8120            fidl::decode!(
8121                ProxyHostPublicationOptions,
8122                fidl::encoding::DefaultFuchsiaResourceDialect,
8123                &mut self.options,
8124                decoder,
8125                offset + 32,
8126                _depth
8127            )?;
8128            fidl::decode!(
8129                fidl::encoding::Endpoint<
8130                    fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
8131                >,
8132                fidl::encoding::DefaultFuchsiaResourceDialect,
8133                &mut self.service_instance_publisher,
8134                decoder,
8135                offset + 48,
8136                _depth
8137            )?;
8138            Ok(())
8139        }
8140    }
8141
8142    impl fidl::encoding::ResourceTypeMarker for PublisherPublishServiceInstanceRequest {
8143        type Borrowed<'a> = &'a mut Self;
8144        fn take_or_borrow<'a>(
8145            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8146        ) -> Self::Borrowed<'a> {
8147            value
8148        }
8149    }
8150
8151    unsafe impl fidl::encoding::TypeMarker for PublisherPublishServiceInstanceRequest {
8152        type Owned = Self;
8153
8154        #[inline(always)]
8155        fn inline_align(_context: fidl::encoding::Context) -> usize {
8156            8
8157        }
8158
8159        #[inline(always)]
8160        fn inline_size(_context: fidl::encoding::Context) -> usize {
8161            48
8162        }
8163    }
8164
8165    unsafe impl
8166        fidl::encoding::Encode<
8167            PublisherPublishServiceInstanceRequest,
8168            fidl::encoding::DefaultFuchsiaResourceDialect,
8169        > for &mut PublisherPublishServiceInstanceRequest
8170    {
8171        #[inline]
8172        unsafe fn encode(
8173            self,
8174            encoder: &mut fidl::encoding::Encoder<
8175                '_,
8176                fidl::encoding::DefaultFuchsiaResourceDialect,
8177            >,
8178            offset: usize,
8179            _depth: fidl::encoding::Depth,
8180        ) -> fidl::Result<()> {
8181            encoder.debug_check_bounds::<PublisherPublishServiceInstanceRequest>(offset);
8182            // Delegate to tuple encoding.
8183            fidl::encoding::Encode::<
8184                PublisherPublishServiceInstanceRequest,
8185                fidl::encoding::DefaultFuchsiaResourceDialect,
8186            >::encode(
8187                (
8188                    <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
8189                        &self.service,
8190                    ),
8191                    <fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
8192                        &self.instance,
8193                    ),
8194                    <Media as fidl::encoding::ValueTypeMarker>::borrow(&self.media),
8195                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.perform_probe),
8196                    <fidl::encoding::Endpoint<
8197                        fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
8198                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8199                        &mut self.publication_responder,
8200                    ),
8201                ),
8202                encoder,
8203                offset,
8204                _depth,
8205            )
8206        }
8207    }
8208    unsafe impl<
8209            T0: fidl::encoding::Encode<
8210                fidl::encoding::BoundedString<22>,
8211                fidl::encoding::DefaultFuchsiaResourceDialect,
8212            >,
8213            T1: fidl::encoding::Encode<
8214                fidl::encoding::BoundedString<63>,
8215                fidl::encoding::DefaultFuchsiaResourceDialect,
8216            >,
8217            T2: fidl::encoding::Encode<Media, fidl::encoding::DefaultFuchsiaResourceDialect>,
8218            T3: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
8219            T4: fidl::encoding::Encode<
8220                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PublicationResponder_Marker>>,
8221                fidl::encoding::DefaultFuchsiaResourceDialect,
8222            >,
8223        >
8224        fidl::encoding::Encode<
8225            PublisherPublishServiceInstanceRequest,
8226            fidl::encoding::DefaultFuchsiaResourceDialect,
8227        > for (T0, T1, T2, T3, T4)
8228    {
8229        #[inline]
8230        unsafe fn encode(
8231            self,
8232            encoder: &mut fidl::encoding::Encoder<
8233                '_,
8234                fidl::encoding::DefaultFuchsiaResourceDialect,
8235            >,
8236            offset: usize,
8237            depth: fidl::encoding::Depth,
8238        ) -> fidl::Result<()> {
8239            encoder.debug_check_bounds::<PublisherPublishServiceInstanceRequest>(offset);
8240            // Zero out padding regions. There's no need to apply masks
8241            // because the unmasked parts will be overwritten by fields.
8242            unsafe {
8243                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8244                (ptr as *mut u64).write_unaligned(0);
8245            }
8246            unsafe {
8247                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
8248                (ptr as *mut u64).write_unaligned(0);
8249            }
8250            // Write the fields.
8251            self.0.encode(encoder, offset + 0, depth)?;
8252            self.1.encode(encoder, offset + 16, depth)?;
8253            self.2.encode(encoder, offset + 32, depth)?;
8254            self.3.encode(encoder, offset + 36, depth)?;
8255            self.4.encode(encoder, offset + 40, depth)?;
8256            Ok(())
8257        }
8258    }
8259
8260    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8261        for PublisherPublishServiceInstanceRequest
8262    {
8263        #[inline(always)]
8264        fn new_empty() -> Self {
8265            Self {
8266                service: fidl::new_empty!(
8267                    fidl::encoding::BoundedString<22>,
8268                    fidl::encoding::DefaultFuchsiaResourceDialect
8269                ),
8270                instance: fidl::new_empty!(
8271                    fidl::encoding::BoundedString<63>,
8272                    fidl::encoding::DefaultFuchsiaResourceDialect
8273                ),
8274                media: fidl::new_empty!(Media, fidl::encoding::DefaultFuchsiaResourceDialect),
8275                perform_probe: fidl::new_empty!(
8276                    bool,
8277                    fidl::encoding::DefaultFuchsiaResourceDialect
8278                ),
8279                publication_responder: fidl::new_empty!(
8280                    fidl::encoding::Endpoint<
8281                        fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
8282                    >,
8283                    fidl::encoding::DefaultFuchsiaResourceDialect
8284                ),
8285            }
8286        }
8287
8288        #[inline]
8289        unsafe fn decode(
8290            &mut self,
8291            decoder: &mut fidl::encoding::Decoder<
8292                '_,
8293                fidl::encoding::DefaultFuchsiaResourceDialect,
8294            >,
8295            offset: usize,
8296            _depth: fidl::encoding::Depth,
8297        ) -> fidl::Result<()> {
8298            decoder.debug_check_bounds::<Self>(offset);
8299            // Verify that padding bytes are zero.
8300            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8301            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8302            let mask = 0xffffff0000000000u64;
8303            let maskedval = padval & mask;
8304            if maskedval != 0 {
8305                return Err(fidl::Error::NonZeroPadding {
8306                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8307                });
8308            }
8309            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
8310            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8311            let mask = 0xffffffff00000000u64;
8312            let maskedval = padval & mask;
8313            if maskedval != 0 {
8314                return Err(fidl::Error::NonZeroPadding {
8315                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
8316                });
8317            }
8318            fidl::decode!(
8319                fidl::encoding::BoundedString<22>,
8320                fidl::encoding::DefaultFuchsiaResourceDialect,
8321                &mut self.service,
8322                decoder,
8323                offset + 0,
8324                _depth
8325            )?;
8326            fidl::decode!(
8327                fidl::encoding::BoundedString<63>,
8328                fidl::encoding::DefaultFuchsiaResourceDialect,
8329                &mut self.instance,
8330                decoder,
8331                offset + 16,
8332                _depth
8333            )?;
8334            fidl::decode!(
8335                Media,
8336                fidl::encoding::DefaultFuchsiaResourceDialect,
8337                &mut self.media,
8338                decoder,
8339                offset + 32,
8340                _depth
8341            )?;
8342            fidl::decode!(
8343                bool,
8344                fidl::encoding::DefaultFuchsiaResourceDialect,
8345                &mut self.perform_probe,
8346                decoder,
8347                offset + 36,
8348                _depth
8349            )?;
8350            fidl::decode!(
8351                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PublicationResponder_Marker>>,
8352                fidl::encoding::DefaultFuchsiaResourceDialect,
8353                &mut self.publication_responder,
8354                decoder,
8355                offset + 40,
8356                _depth
8357            )?;
8358            Ok(())
8359        }
8360    }
8361
8362    impl fidl::encoding::ResourceTypeMarker for ServiceInstancePublisherPublishServiceInstanceRequest {
8363        type Borrowed<'a> = &'a mut Self;
8364        fn take_or_borrow<'a>(
8365            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8366        ) -> Self::Borrowed<'a> {
8367            value
8368        }
8369    }
8370
8371    unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublisherPublishServiceInstanceRequest {
8372        type Owned = Self;
8373
8374        #[inline(always)]
8375        fn inline_align(_context: fidl::encoding::Context) -> usize {
8376            8
8377        }
8378
8379        #[inline(always)]
8380        fn inline_size(_context: fidl::encoding::Context) -> usize {
8381            56
8382        }
8383    }
8384
8385    unsafe impl
8386        fidl::encoding::Encode<
8387            ServiceInstancePublisherPublishServiceInstanceRequest,
8388            fidl::encoding::DefaultFuchsiaResourceDialect,
8389        > for &mut ServiceInstancePublisherPublishServiceInstanceRequest
8390    {
8391        #[inline]
8392        unsafe fn encode(
8393            self,
8394            encoder: &mut fidl::encoding::Encoder<
8395                '_,
8396                fidl::encoding::DefaultFuchsiaResourceDialect,
8397            >,
8398            offset: usize,
8399            _depth: fidl::encoding::Depth,
8400        ) -> fidl::Result<()> {
8401            encoder.debug_check_bounds::<ServiceInstancePublisherPublishServiceInstanceRequest>(
8402                offset,
8403            );
8404            // Delegate to tuple encoding.
8405            fidl::encoding::Encode::<
8406                ServiceInstancePublisherPublishServiceInstanceRequest,
8407                fidl::encoding::DefaultFuchsiaResourceDialect,
8408            >::encode(
8409                (
8410                    <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
8411                        &self.service,
8412                    ),
8413                    <fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
8414                        &self.instance,
8415                    ),
8416                    <ServiceInstancePublicationOptions as fidl::encoding::ValueTypeMarker>::borrow(
8417                        &self.options,
8418                    ),
8419                    <fidl::encoding::Endpoint<
8420                        fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8421                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8422                        &mut self.publication_responder,
8423                    ),
8424                ),
8425                encoder,
8426                offset,
8427                _depth,
8428            )
8429        }
8430    }
8431    unsafe impl<
8432            T0: fidl::encoding::Encode<
8433                fidl::encoding::BoundedString<22>,
8434                fidl::encoding::DefaultFuchsiaResourceDialect,
8435            >,
8436            T1: fidl::encoding::Encode<
8437                fidl::encoding::BoundedString<63>,
8438                fidl::encoding::DefaultFuchsiaResourceDialect,
8439            >,
8440            T2: fidl::encoding::Encode<
8441                ServiceInstancePublicationOptions,
8442                fidl::encoding::DefaultFuchsiaResourceDialect,
8443            >,
8444            T3: fidl::encoding::Encode<
8445                fidl::encoding::Endpoint<
8446                    fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8447                >,
8448                fidl::encoding::DefaultFuchsiaResourceDialect,
8449            >,
8450        >
8451        fidl::encoding::Encode<
8452            ServiceInstancePublisherPublishServiceInstanceRequest,
8453            fidl::encoding::DefaultFuchsiaResourceDialect,
8454        > for (T0, T1, T2, T3)
8455    {
8456        #[inline]
8457        unsafe fn encode(
8458            self,
8459            encoder: &mut fidl::encoding::Encoder<
8460                '_,
8461                fidl::encoding::DefaultFuchsiaResourceDialect,
8462            >,
8463            offset: usize,
8464            depth: fidl::encoding::Depth,
8465        ) -> fidl::Result<()> {
8466            encoder.debug_check_bounds::<ServiceInstancePublisherPublishServiceInstanceRequest>(
8467                offset,
8468            );
8469            // Zero out padding regions. There's no need to apply masks
8470            // because the unmasked parts will be overwritten by fields.
8471            unsafe {
8472                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
8473                (ptr as *mut u64).write_unaligned(0);
8474            }
8475            // Write the fields.
8476            self.0.encode(encoder, offset + 0, depth)?;
8477            self.1.encode(encoder, offset + 16, depth)?;
8478            self.2.encode(encoder, offset + 32, depth)?;
8479            self.3.encode(encoder, offset + 48, depth)?;
8480            Ok(())
8481        }
8482    }
8483
8484    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8485        for ServiceInstancePublisherPublishServiceInstanceRequest
8486    {
8487        #[inline(always)]
8488        fn new_empty() -> Self {
8489            Self {
8490                service: fidl::new_empty!(
8491                    fidl::encoding::BoundedString<22>,
8492                    fidl::encoding::DefaultFuchsiaResourceDialect
8493                ),
8494                instance: fidl::new_empty!(
8495                    fidl::encoding::BoundedString<63>,
8496                    fidl::encoding::DefaultFuchsiaResourceDialect
8497                ),
8498                options: fidl::new_empty!(
8499                    ServiceInstancePublicationOptions,
8500                    fidl::encoding::DefaultFuchsiaResourceDialect
8501                ),
8502                publication_responder: fidl::new_empty!(
8503                    fidl::encoding::Endpoint<
8504                        fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8505                    >,
8506                    fidl::encoding::DefaultFuchsiaResourceDialect
8507                ),
8508            }
8509        }
8510
8511        #[inline]
8512        unsafe fn decode(
8513            &mut self,
8514            decoder: &mut fidl::encoding::Decoder<
8515                '_,
8516                fidl::encoding::DefaultFuchsiaResourceDialect,
8517            >,
8518            offset: usize,
8519            _depth: fidl::encoding::Depth,
8520        ) -> fidl::Result<()> {
8521            decoder.debug_check_bounds::<Self>(offset);
8522            // Verify that padding bytes are zero.
8523            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
8524            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8525            let mask = 0xffffffff00000000u64;
8526            let maskedval = padval & mask;
8527            if maskedval != 0 {
8528                return Err(fidl::Error::NonZeroPadding {
8529                    padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
8530                });
8531            }
8532            fidl::decode!(
8533                fidl::encoding::BoundedString<22>,
8534                fidl::encoding::DefaultFuchsiaResourceDialect,
8535                &mut self.service,
8536                decoder,
8537                offset + 0,
8538                _depth
8539            )?;
8540            fidl::decode!(
8541                fidl::encoding::BoundedString<63>,
8542                fidl::encoding::DefaultFuchsiaResourceDialect,
8543                &mut self.instance,
8544                decoder,
8545                offset + 16,
8546                _depth
8547            )?;
8548            fidl::decode!(
8549                ServiceInstancePublicationOptions,
8550                fidl::encoding::DefaultFuchsiaResourceDialect,
8551                &mut self.options,
8552                decoder,
8553                offset + 32,
8554                _depth
8555            )?;
8556            fidl::decode!(
8557                fidl::encoding::Endpoint<
8558                    fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8559                >,
8560                fidl::encoding::DefaultFuchsiaResourceDialect,
8561                &mut self.publication_responder,
8562                decoder,
8563                offset + 48,
8564                _depth
8565            )?;
8566            Ok(())
8567        }
8568    }
8569
8570    impl fidl::encoding::ResourceTypeMarker for ServiceSubscriber2SubscribeToAllServicesRequest {
8571        type Borrowed<'a> = &'a mut Self;
8572        fn take_or_borrow<'a>(
8573            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8574        ) -> Self::Borrowed<'a> {
8575            value
8576        }
8577    }
8578
8579    unsafe impl fidl::encoding::TypeMarker for ServiceSubscriber2SubscribeToAllServicesRequest {
8580        type Owned = Self;
8581
8582        #[inline(always)]
8583        fn inline_align(_context: fidl::encoding::Context) -> usize {
8584            8
8585        }
8586
8587        #[inline(always)]
8588        fn inline_size(_context: fidl::encoding::Context) -> usize {
8589            24
8590        }
8591    }
8592
8593    unsafe impl
8594        fidl::encoding::Encode<
8595            ServiceSubscriber2SubscribeToAllServicesRequest,
8596            fidl::encoding::DefaultFuchsiaResourceDialect,
8597        > for &mut ServiceSubscriber2SubscribeToAllServicesRequest
8598    {
8599        #[inline]
8600        unsafe fn encode(
8601            self,
8602            encoder: &mut fidl::encoding::Encoder<
8603                '_,
8604                fidl::encoding::DefaultFuchsiaResourceDialect,
8605            >,
8606            offset: usize,
8607            _depth: fidl::encoding::Depth,
8608        ) -> fidl::Result<()> {
8609            encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToAllServicesRequest>(offset);
8610            // Delegate to tuple encoding.
8611            fidl::encoding::Encode::<
8612                ServiceSubscriber2SubscribeToAllServicesRequest,
8613                fidl::encoding::DefaultFuchsiaResourceDialect,
8614            >::encode(
8615                (
8616                    <ServiceSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
8617                        &self.options,
8618                    ),
8619                    <fidl::encoding::Endpoint<
8620                        fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8621                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8622                        &mut self.listener
8623                    ),
8624                ),
8625                encoder,
8626                offset,
8627                _depth,
8628            )
8629        }
8630    }
8631    unsafe impl<
8632            T0: fidl::encoding::Encode<
8633                ServiceSubscriptionOptions,
8634                fidl::encoding::DefaultFuchsiaResourceDialect,
8635            >,
8636            T1: fidl::encoding::Encode<
8637                fidl::encoding::Endpoint<
8638                    fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8639                >,
8640                fidl::encoding::DefaultFuchsiaResourceDialect,
8641            >,
8642        >
8643        fidl::encoding::Encode<
8644            ServiceSubscriber2SubscribeToAllServicesRequest,
8645            fidl::encoding::DefaultFuchsiaResourceDialect,
8646        > for (T0, T1)
8647    {
8648        #[inline]
8649        unsafe fn encode(
8650            self,
8651            encoder: &mut fidl::encoding::Encoder<
8652                '_,
8653                fidl::encoding::DefaultFuchsiaResourceDialect,
8654            >,
8655            offset: usize,
8656            depth: fidl::encoding::Depth,
8657        ) -> fidl::Result<()> {
8658            encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToAllServicesRequest>(offset);
8659            // Zero out padding regions. There's no need to apply masks
8660            // because the unmasked parts will be overwritten by fields.
8661            unsafe {
8662                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8663                (ptr as *mut u64).write_unaligned(0);
8664            }
8665            // Write the fields.
8666            self.0.encode(encoder, offset + 0, depth)?;
8667            self.1.encode(encoder, offset + 16, depth)?;
8668            Ok(())
8669        }
8670    }
8671
8672    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8673        for ServiceSubscriber2SubscribeToAllServicesRequest
8674    {
8675        #[inline(always)]
8676        fn new_empty() -> Self {
8677            Self {
8678                options: fidl::new_empty!(
8679                    ServiceSubscriptionOptions,
8680                    fidl::encoding::DefaultFuchsiaResourceDialect
8681                ),
8682                listener: fidl::new_empty!(
8683                    fidl::encoding::Endpoint<
8684                        fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8685                    >,
8686                    fidl::encoding::DefaultFuchsiaResourceDialect
8687                ),
8688            }
8689        }
8690
8691        #[inline]
8692        unsafe fn decode(
8693            &mut self,
8694            decoder: &mut fidl::encoding::Decoder<
8695                '_,
8696                fidl::encoding::DefaultFuchsiaResourceDialect,
8697            >,
8698            offset: usize,
8699            _depth: fidl::encoding::Depth,
8700        ) -> fidl::Result<()> {
8701            decoder.debug_check_bounds::<Self>(offset);
8702            // Verify that padding bytes are zero.
8703            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8704            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8705            let mask = 0xffffffff00000000u64;
8706            let maskedval = padval & mask;
8707            if maskedval != 0 {
8708                return Err(fidl::Error::NonZeroPadding {
8709                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8710                });
8711            }
8712            fidl::decode!(
8713                ServiceSubscriptionOptions,
8714                fidl::encoding::DefaultFuchsiaResourceDialect,
8715                &mut self.options,
8716                decoder,
8717                offset + 0,
8718                _depth
8719            )?;
8720            fidl::decode!(
8721                fidl::encoding::Endpoint<
8722                    fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8723                >,
8724                fidl::encoding::DefaultFuchsiaResourceDialect,
8725                &mut self.listener,
8726                decoder,
8727                offset + 16,
8728                _depth
8729            )?;
8730            Ok(())
8731        }
8732    }
8733
8734    impl fidl::encoding::ResourceTypeMarker for ServiceSubscriber2SubscribeToServiceRequest {
8735        type Borrowed<'a> = &'a mut Self;
8736        fn take_or_borrow<'a>(
8737            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8738        ) -> Self::Borrowed<'a> {
8739            value
8740        }
8741    }
8742
8743    unsafe impl fidl::encoding::TypeMarker for ServiceSubscriber2SubscribeToServiceRequest {
8744        type Owned = Self;
8745
8746        #[inline(always)]
8747        fn inline_align(_context: fidl::encoding::Context) -> usize {
8748            8
8749        }
8750
8751        #[inline(always)]
8752        fn inline_size(_context: fidl::encoding::Context) -> usize {
8753            40
8754        }
8755    }
8756
8757    unsafe impl
8758        fidl::encoding::Encode<
8759            ServiceSubscriber2SubscribeToServiceRequest,
8760            fidl::encoding::DefaultFuchsiaResourceDialect,
8761        > for &mut ServiceSubscriber2SubscribeToServiceRequest
8762    {
8763        #[inline]
8764        unsafe fn encode(
8765            self,
8766            encoder: &mut fidl::encoding::Encoder<
8767                '_,
8768                fidl::encoding::DefaultFuchsiaResourceDialect,
8769            >,
8770            offset: usize,
8771            _depth: fidl::encoding::Depth,
8772        ) -> fidl::Result<()> {
8773            encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToServiceRequest>(offset);
8774            // Delegate to tuple encoding.
8775            fidl::encoding::Encode::<
8776                ServiceSubscriber2SubscribeToServiceRequest,
8777                fidl::encoding::DefaultFuchsiaResourceDialect,
8778            >::encode(
8779                (
8780                    <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
8781                        &self.service,
8782                    ),
8783                    <ServiceSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
8784                        &self.options,
8785                    ),
8786                    <fidl::encoding::Endpoint<
8787                        fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8788                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8789                        &mut self.listener
8790                    ),
8791                ),
8792                encoder,
8793                offset,
8794                _depth,
8795            )
8796        }
8797    }
8798    unsafe impl<
8799            T0: fidl::encoding::Encode<
8800                fidl::encoding::BoundedString<22>,
8801                fidl::encoding::DefaultFuchsiaResourceDialect,
8802            >,
8803            T1: fidl::encoding::Encode<
8804                ServiceSubscriptionOptions,
8805                fidl::encoding::DefaultFuchsiaResourceDialect,
8806            >,
8807            T2: fidl::encoding::Encode<
8808                fidl::encoding::Endpoint<
8809                    fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8810                >,
8811                fidl::encoding::DefaultFuchsiaResourceDialect,
8812            >,
8813        >
8814        fidl::encoding::Encode<
8815            ServiceSubscriber2SubscribeToServiceRequest,
8816            fidl::encoding::DefaultFuchsiaResourceDialect,
8817        > for (T0, T1, T2)
8818    {
8819        #[inline]
8820        unsafe fn encode(
8821            self,
8822            encoder: &mut fidl::encoding::Encoder<
8823                '_,
8824                fidl::encoding::DefaultFuchsiaResourceDialect,
8825            >,
8826            offset: usize,
8827            depth: fidl::encoding::Depth,
8828        ) -> fidl::Result<()> {
8829            encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToServiceRequest>(offset);
8830            // Zero out padding regions. There's no need to apply masks
8831            // because the unmasked parts will be overwritten by fields.
8832            unsafe {
8833                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8834                (ptr as *mut u64).write_unaligned(0);
8835            }
8836            // Write the fields.
8837            self.0.encode(encoder, offset + 0, depth)?;
8838            self.1.encode(encoder, offset + 16, depth)?;
8839            self.2.encode(encoder, offset + 32, depth)?;
8840            Ok(())
8841        }
8842    }
8843
8844    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8845        for ServiceSubscriber2SubscribeToServiceRequest
8846    {
8847        #[inline(always)]
8848        fn new_empty() -> Self {
8849            Self {
8850                service: fidl::new_empty!(
8851                    fidl::encoding::BoundedString<22>,
8852                    fidl::encoding::DefaultFuchsiaResourceDialect
8853                ),
8854                options: fidl::new_empty!(
8855                    ServiceSubscriptionOptions,
8856                    fidl::encoding::DefaultFuchsiaResourceDialect
8857                ),
8858                listener: fidl::new_empty!(
8859                    fidl::encoding::Endpoint<
8860                        fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8861                    >,
8862                    fidl::encoding::DefaultFuchsiaResourceDialect
8863                ),
8864            }
8865        }
8866
8867        #[inline]
8868        unsafe fn decode(
8869            &mut self,
8870            decoder: &mut fidl::encoding::Decoder<
8871                '_,
8872                fidl::encoding::DefaultFuchsiaResourceDialect,
8873            >,
8874            offset: usize,
8875            _depth: fidl::encoding::Depth,
8876        ) -> fidl::Result<()> {
8877            decoder.debug_check_bounds::<Self>(offset);
8878            // Verify that padding bytes are zero.
8879            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8880            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8881            let mask = 0xffffffff00000000u64;
8882            let maskedval = padval & mask;
8883            if maskedval != 0 {
8884                return Err(fidl::Error::NonZeroPadding {
8885                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8886                });
8887            }
8888            fidl::decode!(
8889                fidl::encoding::BoundedString<22>,
8890                fidl::encoding::DefaultFuchsiaResourceDialect,
8891                &mut self.service,
8892                decoder,
8893                offset + 0,
8894                _depth
8895            )?;
8896            fidl::decode!(
8897                ServiceSubscriptionOptions,
8898                fidl::encoding::DefaultFuchsiaResourceDialect,
8899                &mut self.options,
8900                decoder,
8901                offset + 16,
8902                _depth
8903            )?;
8904            fidl::decode!(
8905                fidl::encoding::Endpoint<
8906                    fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8907                >,
8908                fidl::encoding::DefaultFuchsiaResourceDialect,
8909                &mut self.listener,
8910                decoder,
8911                offset + 32,
8912                _depth
8913            )?;
8914            Ok(())
8915        }
8916    }
8917
8918    impl fidl::encoding::ResourceTypeMarker for SubscriberSubscribeToServiceRequest {
8919        type Borrowed<'a> = &'a mut Self;
8920        fn take_or_borrow<'a>(
8921            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8922        ) -> Self::Borrowed<'a> {
8923            value
8924        }
8925    }
8926
8927    unsafe impl fidl::encoding::TypeMarker for SubscriberSubscribeToServiceRequest {
8928        type Owned = Self;
8929
8930        #[inline(always)]
8931        fn inline_align(_context: fidl::encoding::Context) -> usize {
8932            8
8933        }
8934
8935        #[inline(always)]
8936        fn inline_size(_context: fidl::encoding::Context) -> usize {
8937            24
8938        }
8939    }
8940
8941    unsafe impl
8942        fidl::encoding::Encode<
8943            SubscriberSubscribeToServiceRequest,
8944            fidl::encoding::DefaultFuchsiaResourceDialect,
8945        > for &mut SubscriberSubscribeToServiceRequest
8946    {
8947        #[inline]
8948        unsafe fn encode(
8949            self,
8950            encoder: &mut fidl::encoding::Encoder<
8951                '_,
8952                fidl::encoding::DefaultFuchsiaResourceDialect,
8953            >,
8954            offset: usize,
8955            _depth: fidl::encoding::Depth,
8956        ) -> fidl::Result<()> {
8957            encoder.debug_check_bounds::<SubscriberSubscribeToServiceRequest>(offset);
8958            // Delegate to tuple encoding.
8959            fidl::encoding::Encode::<SubscriberSubscribeToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8960                (
8961                    <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(&self.service),
8962                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.subscriber),
8963                ),
8964                encoder, offset, _depth
8965            )
8966        }
8967    }
8968    unsafe impl<
8969            T0: fidl::encoding::Encode<
8970                fidl::encoding::BoundedString<22>,
8971                fidl::encoding::DefaultFuchsiaResourceDialect,
8972            >,
8973            T1: fidl::encoding::Encode<
8974                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
8975                fidl::encoding::DefaultFuchsiaResourceDialect,
8976            >,
8977        >
8978        fidl::encoding::Encode<
8979            SubscriberSubscribeToServiceRequest,
8980            fidl::encoding::DefaultFuchsiaResourceDialect,
8981        > for (T0, T1)
8982    {
8983        #[inline]
8984        unsafe fn encode(
8985            self,
8986            encoder: &mut fidl::encoding::Encoder<
8987                '_,
8988                fidl::encoding::DefaultFuchsiaResourceDialect,
8989            >,
8990            offset: usize,
8991            depth: fidl::encoding::Depth,
8992        ) -> fidl::Result<()> {
8993            encoder.debug_check_bounds::<SubscriberSubscribeToServiceRequest>(offset);
8994            // Zero out padding regions. There's no need to apply masks
8995            // because the unmasked parts will be overwritten by fields.
8996            unsafe {
8997                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8998                (ptr as *mut u64).write_unaligned(0);
8999            }
9000            // Write the fields.
9001            self.0.encode(encoder, offset + 0, depth)?;
9002            self.1.encode(encoder, offset + 16, depth)?;
9003            Ok(())
9004        }
9005    }
9006
9007    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9008        for SubscriberSubscribeToServiceRequest
9009    {
9010        #[inline(always)]
9011        fn new_empty() -> Self {
9012            Self {
9013                service: fidl::new_empty!(
9014                    fidl::encoding::BoundedString<22>,
9015                    fidl::encoding::DefaultFuchsiaResourceDialect
9016                ),
9017                subscriber: fidl::new_empty!(
9018                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
9019                    fidl::encoding::DefaultFuchsiaResourceDialect
9020                ),
9021            }
9022        }
9023
9024        #[inline]
9025        unsafe fn decode(
9026            &mut self,
9027            decoder: &mut fidl::encoding::Decoder<
9028                '_,
9029                fidl::encoding::DefaultFuchsiaResourceDialect,
9030            >,
9031            offset: usize,
9032            _depth: fidl::encoding::Depth,
9033        ) -> fidl::Result<()> {
9034            decoder.debug_check_bounds::<Self>(offset);
9035            // Verify that padding bytes are zero.
9036            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9037            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9038            let mask = 0xffffffff00000000u64;
9039            let maskedval = padval & mask;
9040            if maskedval != 0 {
9041                return Err(fidl::Error::NonZeroPadding {
9042                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9043                });
9044            }
9045            fidl::decode!(
9046                fidl::encoding::BoundedString<22>,
9047                fidl::encoding::DefaultFuchsiaResourceDialect,
9048                &mut self.service,
9049                decoder,
9050                offset + 0,
9051                _depth
9052            )?;
9053            fidl::decode!(
9054                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
9055                fidl::encoding::DefaultFuchsiaResourceDialect,
9056                &mut self.subscriber,
9057                decoder,
9058                offset + 16,
9059                _depth
9060            )?;
9061            Ok(())
9062        }
9063    }
9064}