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