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