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